Anonymous 3D Imageboard http://cyberia.digital/
Nie możesz wybrać więcej, niż 25 tematów Tematy muszą się zaczynać od litery lub cyfry, mogą zawierać myślniki ('-') i mogą mieć do 35 znaków.

82454 wiersze
5.7MB

  1. (window["webpackJsonp"] = window["webpackJsonp"] || []).push([["vendor"],{
  2. /***/ "./node_modules/@angular/common/fesm5/common.js":
  3. /*!******************************************************!*\
  4. !*** ./node_modules/@angular/common/fesm5/common.js ***!
  5. \******************************************************/
  6. /*! exports provided: ɵangular_packages_common_common_e, ɵangular_packages_common_common_d, ɵangular_packages_common_common_a, ɵangular_packages_common_common_b, ɵangular_packages_common_common_g, ɵangular_packages_common_common_f, ɵregisterLocaleData, formatDate, formatCurrency, formatNumber, formatPercent, NgLocaleLocalization, NgLocalization, registerLocaleData, Plural, NumberFormatStyle, FormStyle, TranslationWidth, FormatWidth, NumberSymbol, WeekDay, getNumberOfCurrencyDigits, getCurrencySymbol, getLocaleDayPeriods, getLocaleDayNames, getLocaleMonthNames, getLocaleId, getLocaleEraNames, getLocaleWeekEndRange, getLocaleFirstDayOfWeek, getLocaleDateFormat, getLocaleDateTimeFormat, getLocaleExtraDayPeriodRules, getLocaleExtraDayPeriods, getLocalePluralCase, getLocaleTimeFormat, getLocaleNumberSymbol, getLocaleNumberFormat, getLocaleCurrencyName, getLocaleCurrencySymbol, ɵparseCookieValue, CommonModule, DeprecatedI18NPipesModule, NgClass, NgForOf, NgForOfContext, NgIf, NgIfContext, NgPlural, NgPluralCase, NgStyle, NgSwitch, NgSwitchCase, NgSwitchDefault, NgTemplateOutlet, NgComponentOutlet, DOCUMENT, AsyncPipe, DatePipe, I18nPluralPipe, I18nSelectPipe, JsonPipe, LowerCasePipe, CurrencyPipe, DecimalPipe, PercentPipe, SlicePipe, UpperCasePipe, TitleCasePipe, KeyValuePipe, DeprecatedDatePipe, DeprecatedCurrencyPipe, DeprecatedDecimalPipe, DeprecatedPercentPipe, ɵPLATFORM_BROWSER_ID, ɵPLATFORM_SERVER_ID, ɵPLATFORM_WORKER_APP_ID, ɵPLATFORM_WORKER_UI_ID, isPlatformBrowser, isPlatformServer, isPlatformWorkerApp, isPlatformWorkerUi, VERSION, ViewportScroller, ɵNullViewportScroller, PlatformLocation, LOCATION_INITIALIZED, LocationStrategy, APP_BASE_HREF, HashLocationStrategy, PathLocationStrategy, Location */
  7. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  8. "use strict";
  9. __webpack_require__.r(__webpack_exports__);
  10. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_e", function() { return COMMON_DIRECTIVES; });
  11. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_d", function() { return findLocaleData; });
  12. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_a", function() { return DEPRECATED_PLURAL_FN; });
  13. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_b", function() { return getPluralCase; });
  14. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_g", function() { return COMMON_DEPRECATED_I18N_PIPES; });
  15. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_common_f", function() { return COMMON_PIPES; });
  16. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterLocaleData", function() { return registerLocaleData; });
  17. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatDate", function() { return formatDate; });
  18. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatCurrency", function() { return formatCurrency; });
  19. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatNumber", function() { return formatNumber; });
  20. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formatPercent", function() { return formatPercent; });
  21. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocaleLocalization", function() { return NgLocaleLocalization; });
  22. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgLocalization", function() { return NgLocalization; });
  23. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "registerLocaleData", function() { return registerLocaleData; });
  24. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Plural", function() { return Plural; });
  25. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberFormatStyle", function() { return NumberFormatStyle; });
  26. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormStyle", function() { return FormStyle; });
  27. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TranslationWidth", function() { return TranslationWidth; });
  28. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormatWidth", function() { return FormatWidth; });
  29. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NumberSymbol", function() { return NumberSymbol; });
  30. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WeekDay", function() { return WeekDay; });
  31. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNumberOfCurrencyDigits", function() { return getNumberOfCurrencyDigits; });
  32. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getCurrencySymbol", function() { return getCurrencySymbol; });
  33. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayPeriods", function() { return getLocaleDayPeriods; });
  34. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDayNames", function() { return getLocaleDayNames; });
  35. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleMonthNames", function() { return getLocaleMonthNames; });
  36. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleId", function() { return getLocaleId; });
  37. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleEraNames", function() { return getLocaleEraNames; });
  38. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleWeekEndRange", function() { return getLocaleWeekEndRange; });
  39. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleFirstDayOfWeek", function() { return getLocaleFirstDayOfWeek; });
  40. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateFormat", function() { return getLocaleDateFormat; });
  41. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleDateTimeFormat", function() { return getLocaleDateTimeFormat; });
  42. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriodRules", function() { return getLocaleExtraDayPeriodRules; });
  43. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleExtraDayPeriods", function() { return getLocaleExtraDayPeriods; });
  44. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocalePluralCase", function() { return getLocalePluralCase; });
  45. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleTimeFormat", function() { return getLocaleTimeFormat; });
  46. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberSymbol", function() { return getLocaleNumberSymbol; });
  47. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleNumberFormat", function() { return getLocaleNumberFormat; });
  48. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencyName", function() { return getLocaleCurrencyName; });
  49. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getLocaleCurrencySymbol", function() { return getLocaleCurrencySymbol; });
  50. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵparseCookieValue", function() { return parseCookieValue; });
  51. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommonModule", function() { return CommonModule; });
  52. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedI18NPipesModule", function() { return DeprecatedI18NPipesModule; });
  53. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgClass", function() { return NgClass; });
  54. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOf", function() { return NgForOf; });
  55. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForOfContext", function() { return NgForOfContext; });
  56. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIf", function() { return NgIf; });
  57. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgIfContext", function() { return NgIfContext; });
  58. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPlural", function() { return NgPlural; });
  59. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgPluralCase", function() { return NgPluralCase; });
  60. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgStyle", function() { return NgStyle; });
  61. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitch", function() { return NgSwitch; });
  62. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchCase", function() { return NgSwitchCase; });
  63. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSwitchDefault", function() { return NgSwitchDefault; });
  64. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgTemplateOutlet", function() { return NgTemplateOutlet; });
  65. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgComponentOutlet", function() { return NgComponentOutlet; });
  66. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT; });
  67. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncPipe", function() { return AsyncPipe; });
  68. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DatePipe", function() { return DatePipe; });
  69. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nPluralPipe", function() { return I18nPluralPipe; });
  70. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18nSelectPipe", function() { return I18nSelectPipe; });
  71. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonPipe", function() { return JsonPipe; });
  72. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LowerCasePipe", function() { return LowerCasePipe; });
  73. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CurrencyPipe", function() { return CurrencyPipe; });
  74. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DecimalPipe", function() { return DecimalPipe; });
  75. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PercentPipe", function() { return PercentPipe; });
  76. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SlicePipe", function() { return SlicePipe; });
  77. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UpperCasePipe", function() { return UpperCasePipe; });
  78. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TitleCasePipe", function() { return TitleCasePipe; });
  79. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValuePipe", function() { return KeyValuePipe; });
  80. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDatePipe", function() { return DeprecatedDatePipe; });
  81. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedCurrencyPipe", function() { return DeprecatedCurrencyPipe; });
  82. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedDecimalPipe", function() { return DeprecatedDecimalPipe; });
  83. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeprecatedPercentPipe", function() { return DeprecatedPercentPipe; });
  84. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_BROWSER_ID", function() { return PLATFORM_BROWSER_ID; });
  85. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_SERVER_ID", function() { return PLATFORM_SERVER_ID; });
  86. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_APP_ID", function() { return PLATFORM_WORKER_APP_ID; });
  87. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPLATFORM_WORKER_UI_ID", function() { return PLATFORM_WORKER_UI_ID; });
  88. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformBrowser", function() { return isPlatformBrowser; });
  89. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformServer", function() { return isPlatformServer; });
  90. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerApp", function() { return isPlatformWorkerApp; });
  91. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPlatformWorkerUi", function() { return isPlatformWorkerUi; });
  92. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  93. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewportScroller", function() { return ViewportScroller; });
  94. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNullViewportScroller", function() { return NullViewportScroller; });
  95. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformLocation", function() { return PlatformLocation; });
  96. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCATION_INITIALIZED", function() { return LOCATION_INITIALIZED; });
  97. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LocationStrategy", function() { return LocationStrategy; });
  98. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BASE_HREF", function() { return APP_BASE_HREF; });
  99. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HashLocationStrategy", function() { return HashLocationStrategy; });
  100. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PathLocationStrategy", function() { return PathLocationStrategy; });
  101. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Location", function() { return Location; });
  102. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  103. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  104. /**
  105. * @license Angular v6.1.10
  106. * (c) 2010-2018 Google, Inc. https://angular.io/
  107. * License: MIT
  108. */
  109. /**
  110. * @license
  111. * Copyright Google Inc. All Rights Reserved.
  112. *
  113. * Use of this source code is governed by an MIT-style license that can be
  114. * found in the LICENSE file at https://angular.io/license
  115. */
  116. /**
  117. * This class should not be used directly by an application developer. Instead, use
  118. * {@link Location}.
  119. *
  120. * `PlatformLocation` encapsulates all calls to DOM apis, which allows the Router to be platform
  121. * agnostic.
  122. * This means that we can have different implementation of `PlatformLocation` for the different
  123. * platforms that angular supports. For example, `@angular/platform-browser` provides an
  124. * implementation specific to the browser environment, while `@angular/platform-webworker` provides
  125. * one suitable for use with web workers.
  126. *
  127. * The `PlatformLocation` class is used directly by all implementations of {@link LocationStrategy}
  128. * when they need to interact with the DOM apis like pushState, popState, etc...
  129. *
  130. * {@link LocationStrategy} in turn is used by the {@link Location} service which is used directly
  131. * by the {@link Router} in order to navigate between routes. Since all interactions between {@link
  132. * Router} /
  133. * {@link Location} / {@link LocationStrategy} and DOM apis flow through the `PlatformLocation`
  134. * class they are all platform independent.
  135. *
  136. *
  137. */
  138. var PlatformLocation = /** @class */ (function () {
  139. function PlatformLocation() {
  140. }
  141. return PlatformLocation;
  142. }());
  143. /**
  144. * @description Indicates when a location is initialized.
  145. * @experimental
  146. */
  147. var LOCATION_INITIALIZED = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('Location Initialized');
  148. /**
  149. * @license
  150. * Copyright Google Inc. All Rights Reserved.
  151. *
  152. * Use of this source code is governed by an MIT-style license that can be
  153. * found in the LICENSE file at https://angular.io/license
  154. */
  155. /**
  156. * `LocationStrategy` is responsible for representing and reading route state
  157. * from the browser's URL. Angular provides two strategies:
  158. * {@link HashLocationStrategy} and {@link PathLocationStrategy}.
  159. *
  160. * This is used under the hood of the {@link Location} service.
  161. *
  162. * Applications should use the {@link Router} or {@link Location} services to
  163. * interact with application route state.
  164. *
  165. * For instance, {@link HashLocationStrategy} produces URLs like
  166. * `http://example.com#/foo`, and {@link PathLocationStrategy} produces
  167. * `http://example.com/foo` as an equivalent URL.
  168. *
  169. * See these two classes for more.
  170. *
  171. *
  172. */
  173. var LocationStrategy = /** @class */ (function () {
  174. function LocationStrategy() {
  175. }
  176. return LocationStrategy;
  177. }());
  178. /**
  179. * The `APP_BASE_HREF` token represents the base href to be used with the
  180. * {@link PathLocationStrategy}.
  181. *
  182. * If you're using {@link PathLocationStrategy}, you must provide a provider to a string
  183. * representing the URL prefix that should be preserved when generating and recognizing
  184. * URLs.
  185. *
  186. * @usageNotes
  187. *
  188. * ### Example
  189. *
  190. * ```typescript
  191. * import {Component, NgModule} from '@angular/core';
  192. * import {APP_BASE_HREF} from '@angular/common';
  193. *
  194. * @NgModule({
  195. * providers: [{provide: APP_BASE_HREF, useValue: '/my/app'}]
  196. * })
  197. * class AppModule {}
  198. * ```
  199. *
  200. *
  201. */
  202. var APP_BASE_HREF = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('appBaseHref');
  203. /**
  204. * @license
  205. * Copyright Google Inc. All Rights Reserved.
  206. *
  207. * Use of this source code is governed by an MIT-style license that can be
  208. * found in the LICENSE file at https://angular.io/license
  209. */
  210. /**
  211. * @description
  212. *
  213. * A service that applications can use to interact with a browser's URL.
  214. *
  215. * Depending on which {@link LocationStrategy} is used, `Location` will either persist
  216. * to the URL's path or the URL's hash segment.
  217. *
  218. * @usageNotes
  219. *
  220. * It's better to use {@link Router#navigate} service to trigger route changes. Use
  221. * `Location` only if you need to interact with or create normalized URLs outside of
  222. * routing.
  223. *
  224. * `Location` is responsible for normalizing the URL against the application's base href.
  225. * A normalized URL is absolute from the URL host, includes the application's base href, and has no
  226. * trailing slash:
  227. * - `/my/app/user/123` is normalized
  228. * - `my/app/user/123` **is not** normalized
  229. * - `/my/app/user/123/` **is not** normalized
  230. *
  231. * ### Example
  232. *
  233. * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
  234. *
  235. */
  236. var Location = /** @class */ (function () {
  237. function Location(platformStrategy) {
  238. var _this = this;
  239. /** @internal */
  240. this._subject = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  241. this._platformStrategy = platformStrategy;
  242. var browserBaseHref = this._platformStrategy.getBaseHref();
  243. this._baseHref = Location_1.stripTrailingSlash(_stripIndexHtml(browserBaseHref));
  244. this._platformStrategy.onPopState(function (ev) {
  245. _this._subject.emit({
  246. 'url': _this.path(true),
  247. 'pop': true,
  248. 'state': ev.state,
  249. 'type': ev.type,
  250. });
  251. });
  252. }
  253. Location_1 = Location;
  254. /**
  255. * Returns the normalized URL path.
  256. */
  257. // TODO: vsavkin. Remove the boolean flag and always include hash once the deprecated router is
  258. // removed.
  259. Location.prototype.path = function (includeHash) {
  260. if (includeHash === void 0) { includeHash = false; }
  261. return this.normalize(this._platformStrategy.path(includeHash));
  262. };
  263. /**
  264. * Normalizes the given path and compares to the current normalized path.
  265. */
  266. Location.prototype.isCurrentPathEqualTo = function (path, query) {
  267. if (query === void 0) { query = ''; }
  268. return this.path() == this.normalize(path + Location_1.normalizeQueryParams(query));
  269. };
  270. /**
  271. * Given a string representing a URL, returns the normalized URL path without leading or
  272. * trailing slashes.
  273. */
  274. Location.prototype.normalize = function (url) {
  275. return Location_1.stripTrailingSlash(_stripBaseHref(this._baseHref, _stripIndexHtml(url)));
  276. };
  277. /**
  278. * Given a string representing a URL, returns the platform-specific external URL path.
  279. * If the given URL doesn't begin with a leading slash (`'/'`), this method adds one
  280. * before normalizing. This method will also add a hash if `HashLocationStrategy` is
  281. * used, or the `APP_BASE_HREF` if the `PathLocationStrategy` is in use.
  282. */
  283. Location.prototype.prepareExternalUrl = function (url) {
  284. if (url && url[0] !== '/') {
  285. url = '/' + url;
  286. }
  287. return this._platformStrategy.prepareExternalUrl(url);
  288. };
  289. // TODO: rename this method to pushState
  290. /**
  291. * Changes the browsers URL to the normalized version of the given URL, and pushes a
  292. * new item onto the platform's history.
  293. */
  294. Location.prototype.go = function (path, query, state) {
  295. if (query === void 0) { query = ''; }
  296. if (state === void 0) { state = null; }
  297. this._platformStrategy.pushState(state, '', path, query);
  298. };
  299. /**
  300. * Changes the browsers URL to the normalized version of the given URL, and replaces
  301. * the top item on the platform's history stack.
  302. */
  303. Location.prototype.replaceState = function (path, query, state) {
  304. if (query === void 0) { query = ''; }
  305. if (state === void 0) { state = null; }
  306. this._platformStrategy.replaceState(state, '', path, query);
  307. };
  308. /**
  309. * Navigates forward in the platform's history.
  310. */
  311. Location.prototype.forward = function () { this._platformStrategy.forward(); };
  312. /**
  313. * Navigates back in the platform's history.
  314. */
  315. Location.prototype.back = function () { this._platformStrategy.back(); };
  316. /**
  317. * Subscribe to the platform's `popState` events.
  318. */
  319. Location.prototype.subscribe = function (onNext, onThrow, onReturn) {
  320. return this._subject.subscribe({ next: onNext, error: onThrow, complete: onReturn });
  321. };
  322. /**
  323. * Given a string of url parameters, prepend with '?' if needed, otherwise return parameters as
  324. * is.
  325. */
  326. Location.normalizeQueryParams = function (params) {
  327. return params && params[0] !== '?' ? '?' + params : params;
  328. };
  329. /**
  330. * Given 2 parts of a url, join them with a slash if needed.
  331. */
  332. Location.joinWithSlash = function (start, end) {
  333. if (start.length == 0) {
  334. return end;
  335. }
  336. if (end.length == 0) {
  337. return start;
  338. }
  339. var slashes = 0;
  340. if (start.endsWith('/')) {
  341. slashes++;
  342. }
  343. if (end.startsWith('/')) {
  344. slashes++;
  345. }
  346. if (slashes == 2) {
  347. return start + end.substring(1);
  348. }
  349. if (slashes == 1) {
  350. return start + end;
  351. }
  352. return start + '/' + end;
  353. };
  354. /**
  355. * If url has a trailing slash, remove it, otherwise return url as is. This
  356. * method looks for the first occurrence of either #, ?, or the end of the
  357. * line as `/` characters after any of these should not be replaced.
  358. */
  359. Location.stripTrailingSlash = function (url) {
  360. var match = url.match(/#|\?|$/);
  361. var pathEndIdx = match && match.index || url.length;
  362. var droppedSlashIdx = pathEndIdx - (url[pathEndIdx - 1] === '/' ? 1 : 0);
  363. return url.slice(0, droppedSlashIdx) + url.slice(pathEndIdx);
  364. };
  365. var Location_1;
  366. Location = Location_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  367. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(),
  368. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [LocationStrategy])
  369. ], Location);
  370. return Location;
  371. }());
  372. function _stripBaseHref(baseHref, url) {
  373. return baseHref && url.startsWith(baseHref) ? url.substring(baseHref.length) : url;
  374. }
  375. function _stripIndexHtml(url) {
  376. return url.replace(/\/index.html$/, '');
  377. }
  378. /**
  379. * @license
  380. * Copyright Google Inc. All Rights Reserved.
  381. *
  382. * Use of this source code is governed by an MIT-style license that can be
  383. * found in the LICENSE file at https://angular.io/license
  384. */
  385. /**
  386. * @description
  387. * A {@link LocationStrategy} used to configure the {@link Location} service to
  388. * represent its state in the
  389. * [hash fragment](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax)
  390. * of the browser's URL.
  391. *
  392. * For instance, if you call `location.go('/foo')`, the browser's URL will become
  393. * `example.com#/foo`.
  394. *
  395. * @usageNotes
  396. *
  397. * ### Example
  398. *
  399. * {@example common/location/ts/hash_location_component.ts region='LocationComponent'}
  400. *
  401. *
  402. */
  403. var HashLocationStrategy = /** @class */ (function (_super) {
  404. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(HashLocationStrategy, _super);
  405. function HashLocationStrategy(_platformLocation, _baseHref) {
  406. var _this = _super.call(this) || this;
  407. _this._platformLocation = _platformLocation;
  408. _this._baseHref = '';
  409. if (_baseHref != null) {
  410. _this._baseHref = _baseHref;
  411. }
  412. return _this;
  413. }
  414. HashLocationStrategy.prototype.onPopState = function (fn) {
  415. this._platformLocation.onPopState(fn);
  416. this._platformLocation.onHashChange(fn);
  417. };
  418. HashLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
  419. HashLocationStrategy.prototype.path = function (includeHash) {
  420. if (includeHash === void 0) { includeHash = false; }
  421. // the hash value is always prefixed with a `#`
  422. // and if it is empty then it will stay empty
  423. var path = this._platformLocation.hash;
  424. if (path == null)
  425. path = '#';
  426. return path.length > 0 ? path.substring(1) : path;
  427. };
  428. HashLocationStrategy.prototype.prepareExternalUrl = function (internal) {
  429. var url = Location.joinWithSlash(this._baseHref, internal);
  430. return url.length > 0 ? ('#' + url) : url;
  431. };
  432. HashLocationStrategy.prototype.pushState = function (state, title, path, queryParams) {
  433. var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
  434. if (url.length == 0) {
  435. url = this._platformLocation.pathname;
  436. }
  437. this._platformLocation.pushState(state, title, url);
  438. };
  439. HashLocationStrategy.prototype.replaceState = function (state, title, path, queryParams) {
  440. var url = this.prepareExternalUrl(path + Location.normalizeQueryParams(queryParams));
  441. if (url.length == 0) {
  442. url = this._platformLocation.pathname;
  443. }
  444. this._platformLocation.replaceState(state, title, url);
  445. };
  446. HashLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
  447. HashLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
  448. HashLocationStrategy = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  449. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(),
  450. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(APP_BASE_HREF)),
  451. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [PlatformLocation, String])
  452. ], HashLocationStrategy);
  453. return HashLocationStrategy;
  454. }(LocationStrategy));
  455. /**
  456. * @license
  457. * Copyright Google Inc. All Rights Reserved.
  458. *
  459. * Use of this source code is governed by an MIT-style license that can be
  460. * found in the LICENSE file at https://angular.io/license
  461. */
  462. /**
  463. * @description
  464. * A {@link LocationStrategy} used to configure the {@link Location} service to
  465. * represent its state in the
  466. * [path](https://en.wikipedia.org/wiki/Uniform_Resource_Locator#Syntax) of the
  467. * browser's URL.
  468. *
  469. * If you're using `PathLocationStrategy`, you must provide a {@link APP_BASE_HREF}
  470. * or add a base element to the document. This URL prefix that will be preserved
  471. * when generating and recognizing URLs.
  472. *
  473. * For instance, if you provide an `APP_BASE_HREF` of `'/my/app'` and call
  474. * `location.go('/foo')`, the browser's URL will become
  475. * `example.com/my/app/foo`.
  476. *
  477. * Similarly, if you add `<base href='/my/app'/>` to the document and call
  478. * `location.go('/foo')`, the browser's URL will become
  479. * `example.com/my/app/foo`.
  480. *
  481. * @usageNotes
  482. *
  483. * ### Example
  484. *
  485. * {@example common/location/ts/path_location_component.ts region='LocationComponent'}
  486. *
  487. *
  488. */
  489. var PathLocationStrategy = /** @class */ (function (_super) {
  490. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(PathLocationStrategy, _super);
  491. function PathLocationStrategy(_platformLocation, href) {
  492. var _this = _super.call(this) || this;
  493. _this._platformLocation = _platformLocation;
  494. if (href == null) {
  495. href = _this._platformLocation.getBaseHrefFromDOM();
  496. }
  497. if (href == null) {
  498. 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.");
  499. }
  500. _this._baseHref = href;
  501. return _this;
  502. }
  503. PathLocationStrategy.prototype.onPopState = function (fn) {
  504. this._platformLocation.onPopState(fn);
  505. this._platformLocation.onHashChange(fn);
  506. };
  507. PathLocationStrategy.prototype.getBaseHref = function () { return this._baseHref; };
  508. PathLocationStrategy.prototype.prepareExternalUrl = function (internal) {
  509. return Location.joinWithSlash(this._baseHref, internal);
  510. };
  511. PathLocationStrategy.prototype.path = function (includeHash) {
  512. if (includeHash === void 0) { includeHash = false; }
  513. var pathname = this._platformLocation.pathname +
  514. Location.normalizeQueryParams(this._platformLocation.search);
  515. var hash = this._platformLocation.hash;
  516. return hash && includeHash ? "" + pathname + hash : pathname;
  517. };
  518. PathLocationStrategy.prototype.pushState = function (state, title, url, queryParams) {
  519. var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
  520. this._platformLocation.pushState(state, title, externalUrl);
  521. };
  522. PathLocationStrategy.prototype.replaceState = function (state, title, url, queryParams) {
  523. var externalUrl = this.prepareExternalUrl(url + Location.normalizeQueryParams(queryParams));
  524. this._platformLocation.replaceState(state, title, externalUrl);
  525. };
  526. PathLocationStrategy.prototype.forward = function () { this._platformLocation.forward(); };
  527. PathLocationStrategy.prototype.back = function () { this._platformLocation.back(); };
  528. PathLocationStrategy = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  529. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(),
  530. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(APP_BASE_HREF)),
  531. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [PlatformLocation, String])
  532. ], PathLocationStrategy);
  533. return PathLocationStrategy;
  534. }(LocationStrategy));
  535. /**
  536. * @license
  537. * Copyright Google Inc. All Rights Reserved.
  538. *
  539. * Use of this source code is governed by an MIT-style license that can be
  540. * found in the LICENSE file at https://angular.io/license
  541. */
  542. /**
  543. * @license
  544. * Copyright Google Inc. All Rights Reserved.
  545. *
  546. * Use of this source code is governed by an MIT-style license that can be
  547. * found in the LICENSE file at https://angular.io/license
  548. */
  549. // THIS CODE IS GENERATED - DO NOT MODIFY
  550. // See angular/tools/gulp-tasks/cldr/extract.js
  551. var u = undefined;
  552. function plural(n) {
  553. var i = Math.floor(Math.abs(n)), v = n.toString().replace(/^[^.]*\.?/, '').length;
  554. if (i === 1 && v === 0)
  555. return 1;
  556. return 5;
  557. }
  558. var localeEn = [
  559. 'en', [['a', 'p'], ['AM', 'PM'], u], [['AM', 'PM'], u, u],
  560. [
  561. ['S', 'M', 'T', 'W', 'T', 'F', 'S'], ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
  562. ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
  563. ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa']
  564. ],
  565. u,
  566. [
  567. ['J', 'F', 'M', 'A', 'M', 'J', 'J', 'A', 'S', 'O', 'N', 'D'],
  568. ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
  569. [
  570. 'January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September',
  571. 'October', 'November', 'December'
  572. ]
  573. ],
  574. u, [['B', 'A'], ['BC', 'AD'], ['Before Christ', 'Anno Domini']], 0, [6, 0],
  575. ['M/d/yy', 'MMM d, y', 'MMMM d, y', 'EEEE, MMMM d, y'],
  576. ['h:mm a', 'h:mm:ss a', 'h:mm:ss a z', 'h:mm:ss a zzzz'], ['{1}, {0}', u, '{1} \'at\' {0}', u],
  577. ['.', ',', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],
  578. ['#,##0.###', '#,##0%', '¤#,##0.00', '#E0'], '$', 'US Dollar', {}, plural
  579. ];
  580. /**
  581. * @license
  582. * Copyright Google Inc. All Rights Reserved.
  583. *
  584. * Use of this source code is governed by an MIT-style license that can be
  585. * found in the LICENSE file at https://angular.io/license
  586. */
  587. /**
  588. * @experimental i18n support is experimental.
  589. */
  590. var LOCALE_DATA = {};
  591. /**
  592. * Register global data to be used internally by Angular. See the
  593. * ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale data.
  594. *
  595. * @experimental i18n support is experimental.
  596. */
  597. // The signature registerLocaleData(data: any, extraData?: any) is deprecated since v5.1
  598. function registerLocaleData(data, localeId, extraData) {
  599. if (typeof localeId !== 'string') {
  600. extraData = localeId;
  601. localeId = data[0 /* LocaleId */];
  602. }
  603. localeId = localeId.toLowerCase().replace(/_/g, '-');
  604. LOCALE_DATA[localeId] = data;
  605. if (extraData) {
  606. LOCALE_DATA[localeId][19 /* ExtraData */] = extraData;
  607. }
  608. }
  609. /**
  610. * @license
  611. * Copyright Google Inc. All Rights Reserved.
  612. *
  613. * Use of this source code is governed by an MIT-style license that can be
  614. * found in the LICENSE file at https://angular.io/license
  615. */
  616. /** @internal */
  617. var CURRENCIES_EN = {
  618. 'ADP': [undefined, undefined, 0],
  619. 'AFN': [undefined, undefined, 0],
  620. 'ALL': [undefined, undefined, 0],
  621. 'AMD': [undefined, undefined, 0],
  622. 'AOA': [undefined, 'Kz'],
  623. 'ARS': [undefined, '$'],
  624. 'AUD': ['A$', '$'],
  625. 'BAM': [undefined, 'KM'],
  626. 'BBD': [undefined, '$'],
  627. 'BDT': [undefined, '৳'],
  628. 'BHD': [undefined, undefined, 3],
  629. 'BIF': [undefined, undefined, 0],
  630. 'BMD': [undefined, '$'],
  631. 'BND': [undefined, '$'],
  632. 'BOB': [undefined, 'Bs'],
  633. 'BRL': ['R$'],
  634. 'BSD': [undefined, '$'],
  635. 'BWP': [undefined, 'P'],
  636. 'BYN': [undefined, 'р.', 2],
  637. 'BYR': [undefined, undefined, 0],
  638. 'BZD': [undefined, '$'],
  639. 'CAD': ['CA$', '$', 2],
  640. 'CHF': [undefined, undefined, 2],
  641. 'CLF': [undefined, undefined, 4],
  642. 'CLP': [undefined, '$', 0],
  643. 'CNY': ['CN¥', '¥'],
  644. 'COP': [undefined, '$', 0],
  645. 'CRC': [undefined, '₡', 2],
  646. 'CUC': [undefined, '$'],
  647. 'CUP': [undefined, '$'],
  648. 'CZK': [undefined, 'Kč', 2],
  649. 'DJF': [undefined, undefined, 0],
  650. 'DKK': [undefined, 'kr', 2],
  651. 'DOP': [undefined, '$'],
  652. 'EGP': [undefined, 'E£'],
  653. 'ESP': [undefined, '₧', 0],
  654. 'EUR': ['€'],
  655. 'FJD': [undefined, '$'],
  656. 'FKP': [undefined, '£'],
  657. 'GBP': ['£'],
  658. 'GEL': [undefined, '₾'],
  659. 'GIP': [undefined, '£'],
  660. 'GNF': [undefined, 'FG', 0],
  661. 'GTQ': [undefined, 'Q'],
  662. 'GYD': [undefined, '$', 0],
  663. 'HKD': ['HK$', '$'],
  664. 'HNL': [undefined, 'L'],
  665. 'HRK': [undefined, 'kn'],
  666. 'HUF': [undefined, 'Ft', 2],
  667. 'IDR': [undefined, 'Rp', 0],
  668. 'ILS': ['₪'],
  669. 'INR': ['₹'],
  670. 'IQD': [undefined, undefined, 0],
  671. 'IRR': [undefined, undefined, 0],
  672. 'ISK': [undefined, 'kr', 0],
  673. 'ITL': [undefined, undefined, 0],
  674. 'JMD': [undefined, '$'],
  675. 'JOD': [undefined, undefined, 3],
  676. 'JPY': ['¥', undefined, 0],
  677. 'KHR': [undefined, '៛'],
  678. 'KMF': [undefined, 'CF', 0],
  679. 'KPW': [undefined, '₩', 0],
  680. 'KRW': ['₩', undefined, 0],
  681. 'KWD': [undefined, undefined, 3],
  682. 'KYD': [undefined, '$'],
  683. 'KZT': [undefined, '₸'],
  684. 'LAK': [undefined, '₭', 0],
  685. 'LBP': [undefined, 'L£', 0],
  686. 'LKR': [undefined, 'Rs'],
  687. 'LRD': [undefined, '$'],
  688. 'LTL': [undefined, 'Lt'],
  689. 'LUF': [undefined, undefined, 0],
  690. 'LVL': [undefined, 'Ls'],
  691. 'LYD': [undefined, undefined, 3],
  692. 'MGA': [undefined, 'Ar', 0],
  693. 'MGF': [undefined, undefined, 0],
  694. 'MMK': [undefined, 'K', 0],
  695. 'MNT': [undefined, '₮', 0],
  696. 'MRO': [undefined, undefined, 0],
  697. 'MUR': [undefined, 'Rs', 0],
  698. 'MXN': ['MX$', '$'],
  699. 'MYR': [undefined, 'RM'],
  700. 'NAD': [undefined, '$'],
  701. 'NGN': [undefined, '₦'],
  702. 'NIO': [undefined, 'C$'],
  703. 'NOK': [undefined, 'kr', 2],
  704. 'NPR': [undefined, 'Rs'],
  705. 'NZD': ['NZ$', '$'],
  706. 'OMR': [undefined, undefined, 3],
  707. 'PHP': [undefined, '₱'],
  708. 'PKR': [undefined, 'Rs', 0],
  709. 'PLN': [undefined, 'zł'],
  710. 'PYG': [undefined, '₲', 0],
  711. 'RON': [undefined, 'lei'],
  712. 'RSD': [undefined, undefined, 0],
  713. 'RUB': [undefined, '₽'],
  714. 'RUR': [undefined, 'р.'],
  715. 'RWF': [undefined, 'RF', 0],
  716. 'SBD': [undefined, '$'],
  717. 'SEK': [undefined, 'kr', 2],
  718. 'SGD': [undefined, '$'],
  719. 'SHP': [undefined, '£'],
  720. 'SLL': [undefined, undefined, 0],
  721. 'SOS': [undefined, undefined, 0],
  722. 'SRD': [undefined, '$'],
  723. 'SSP': [undefined, '£'],
  724. 'STD': [undefined, undefined, 0],
  725. 'STN': [undefined, 'Db'],
  726. 'SYP': [undefined, '£', 0],
  727. 'THB': [undefined, '฿'],
  728. 'TMM': [undefined, undefined, 0],
  729. 'TND': [undefined, undefined, 3],
  730. 'TOP': [undefined, 'T$'],
  731. 'TRL': [undefined, undefined, 0],
  732. 'TRY': [undefined, '₺'],
  733. 'TTD': [undefined, '$'],
  734. 'TWD': ['NT$', '$', 2],
  735. 'TZS': [undefined, undefined, 0],
  736. 'UAH': [undefined, '₴'],
  737. 'UGX': [undefined, undefined, 0],
  738. 'USD': ['$'],
  739. 'UYI': [undefined, undefined, 0],
  740. 'UYU': [undefined, '$'],
  741. 'UZS': [undefined, undefined, 0],
  742. 'VEF': [undefined, 'Bs'],
  743. 'VND': ['₫', undefined, 0],
  744. 'VUV': [undefined, undefined, 0],
  745. 'XAF': ['FCFA', undefined, 0],
  746. 'XCD': ['EC$', '$'],
  747. 'XOF': ['CFA', undefined, 0],
  748. 'XPF': ['CFPF', undefined, 0],
  749. 'YER': [undefined, undefined, 0],
  750. 'ZAR': [undefined, 'R'],
  751. 'ZMK': [undefined, undefined, 0],
  752. 'ZMW': [undefined, 'ZK'],
  753. 'ZWD': [undefined, undefined, 0]
  754. };
  755. /**
  756. * @license
  757. * Copyright Google Inc. All Rights Reserved.
  758. *
  759. * Use of this source code is governed by an MIT-style license that can be
  760. * found in the LICENSE file at https://angular.io/license
  761. */
  762. /**
  763. * The different format styles that can be used to represent numbers.
  764. * Used by the function {@link getLocaleNumberFormat}.
  765. *
  766. * @experimental i18n support is experimental.
  767. */
  768. var NumberFormatStyle;
  769. (function (NumberFormatStyle) {
  770. NumberFormatStyle[NumberFormatStyle["Decimal"] = 0] = "Decimal";
  771. NumberFormatStyle[NumberFormatStyle["Percent"] = 1] = "Percent";
  772. NumberFormatStyle[NumberFormatStyle["Currency"] = 2] = "Currency";
  773. NumberFormatStyle[NumberFormatStyle["Scientific"] = 3] = "Scientific";
  774. })(NumberFormatStyle || (NumberFormatStyle = {}));
  775. /** @experimental */
  776. var Plural;
  777. (function (Plural) {
  778. Plural[Plural["Zero"] = 0] = "Zero";
  779. Plural[Plural["One"] = 1] = "One";
  780. Plural[Plural["Two"] = 2] = "Two";
  781. Plural[Plural["Few"] = 3] = "Few";
  782. Plural[Plural["Many"] = 4] = "Many";
  783. Plural[Plural["Other"] = 5] = "Other";
  784. })(Plural || (Plural = {}));
  785. /**
  786. * Some languages use two different forms of strings (standalone and format) depending on the
  787. * context.
  788. * Typically the standalone version is the nominative form of the word, and the format version is in
  789. * the genitive.
  790. * See [the CLDR website](http://cldr.unicode.org/translation/date-time) for more information.
  791. *
  792. * @experimental i18n support is experimental.
  793. */
  794. var FormStyle;
  795. (function (FormStyle) {
  796. FormStyle[FormStyle["Format"] = 0] = "Format";
  797. FormStyle[FormStyle["Standalone"] = 1] = "Standalone";
  798. })(FormStyle || (FormStyle = {}));
  799. /**
  800. * Multiple widths are available for translations: narrow (1 character), abbreviated (3 characters),
  801. * wide (full length), and short (2 characters, only for days).
  802. *
  803. * For example the day `Sunday` will be:
  804. * - Narrow: `S`
  805. * - Short: `Su`
  806. * - Abbreviated: `Sun`
  807. * - Wide: `Sunday`
  808. *
  809. * @experimental i18n support is experimental.
  810. */
  811. var TranslationWidth;
  812. (function (TranslationWidth) {
  813. TranslationWidth[TranslationWidth["Narrow"] = 0] = "Narrow";
  814. TranslationWidth[TranslationWidth["Abbreviated"] = 1] = "Abbreviated";
  815. TranslationWidth[TranslationWidth["Wide"] = 2] = "Wide";
  816. TranslationWidth[TranslationWidth["Short"] = 3] = "Short";
  817. })(TranslationWidth || (TranslationWidth = {}));
  818. /**
  819. * Multiple widths are available for formats: short (minimal amount of data), medium (small amount
  820. * of data), long (complete amount of data), full (complete amount of data and extra information).
  821. *
  822. * For example the date-time formats for the english locale will be:
  823. * - `'short'`: `'M/d/yy, h:mm a'` (e.g. `6/15/15, 9:03 AM`)
  824. * - `'medium'`: `'MMM d, y, h:mm:ss a'` (e.g. `Jun 15, 2015, 9:03:01 AM`)
  825. * - `'long'`: `'MMMM d, y, h:mm:ss a z'` (e.g. `June 15, 2015 at 9:03:01 AM GMT+1`)
  826. * - `'full'`: `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (e.g. `Monday, June 15, 2015 at
  827. * 9:03:01 AM GMT+01:00`)
  828. *
  829. * @experimental i18n support is experimental.
  830. */
  831. var FormatWidth;
  832. (function (FormatWidth) {
  833. FormatWidth[FormatWidth["Short"] = 0] = "Short";
  834. FormatWidth[FormatWidth["Medium"] = 1] = "Medium";
  835. FormatWidth[FormatWidth["Long"] = 2] = "Long";
  836. FormatWidth[FormatWidth["Full"] = 3] = "Full";
  837. })(FormatWidth || (FormatWidth = {}));
  838. /**
  839. * Number symbol that can be used to replace placeholders in number patterns.
  840. * The placeholders are based on english values:
  841. *
  842. * | Name | Example for en-US | Meaning |
  843. * |------------------------|-------------------|---------------------------------------------|
  844. * | decimal | 2,345`.`67 | decimal separator |
  845. * | group | 2`,`345.67 | grouping separator, typically for thousands |
  846. * | plusSign | `+`23 | the plus sign used with numbers |
  847. * | minusSign | `-`23 | the minus sign used with numbers |
  848. * | percentSign | 23.4`%` | the percent sign (out of 100) |
  849. * | perMille | 234`‰` | the permille sign (out of 1000) |
  850. * | exponential | 1.2`E`3 | used in computers for 1.2×10³. |
  851. * | superscriptingExponent | 1.2`×`103 | human-readable format of exponential |
  852. * | infinity | `∞` | used in +∞ and -∞. |
  853. * | nan | `NaN` | "not a number". |
  854. * | timeSeparator | 10`:`52 | symbol used between time units |
  855. * | currencyDecimal | $2,345`.`67 | decimal separator, fallback to "decimal" |
  856. * | currencyGroup | $2`,`345.67 | grouping separator, fallback to "group" |
  857. *
  858. * @experimental i18n support is experimental.
  859. */
  860. var NumberSymbol;
  861. (function (NumberSymbol) {
  862. NumberSymbol[NumberSymbol["Decimal"] = 0] = "Decimal";
  863. NumberSymbol[NumberSymbol["Group"] = 1] = "Group";
  864. NumberSymbol[NumberSymbol["List"] = 2] = "List";
  865. NumberSymbol[NumberSymbol["PercentSign"] = 3] = "PercentSign";
  866. NumberSymbol[NumberSymbol["PlusSign"] = 4] = "PlusSign";
  867. NumberSymbol[NumberSymbol["MinusSign"] = 5] = "MinusSign";
  868. NumberSymbol[NumberSymbol["Exponential"] = 6] = "Exponential";
  869. NumberSymbol[NumberSymbol["SuperscriptingExponent"] = 7] = "SuperscriptingExponent";
  870. NumberSymbol[NumberSymbol["PerMille"] = 8] = "PerMille";
  871. NumberSymbol[NumberSymbol["Infinity"] = 9] = "Infinity";
  872. NumberSymbol[NumberSymbol["NaN"] = 10] = "NaN";
  873. NumberSymbol[NumberSymbol["TimeSeparator"] = 11] = "TimeSeparator";
  874. NumberSymbol[NumberSymbol["CurrencyDecimal"] = 12] = "CurrencyDecimal";
  875. NumberSymbol[NumberSymbol["CurrencyGroup"] = 13] = "CurrencyGroup";
  876. })(NumberSymbol || (NumberSymbol = {}));
  877. /**
  878. * The value for each day of the week, based on the en-US locale
  879. *
  880. * @experimental
  881. */
  882. var WeekDay;
  883. (function (WeekDay) {
  884. WeekDay[WeekDay["Sunday"] = 0] = "Sunday";
  885. WeekDay[WeekDay["Monday"] = 1] = "Monday";
  886. WeekDay[WeekDay["Tuesday"] = 2] = "Tuesday";
  887. WeekDay[WeekDay["Wednesday"] = 3] = "Wednesday";
  888. WeekDay[WeekDay["Thursday"] = 4] = "Thursday";
  889. WeekDay[WeekDay["Friday"] = 5] = "Friday";
  890. WeekDay[WeekDay["Saturday"] = 6] = "Saturday";
  891. })(WeekDay || (WeekDay = {}));
  892. /**
  893. * The locale id for the chosen locale (e.g `en-GB`).
  894. *
  895. * @experimental i18n support is experimental.
  896. */
  897. function getLocaleId(locale) {
  898. return findLocaleData(locale)[0 /* LocaleId */];
  899. }
  900. /**
  901. * Periods of the day (e.g. `[AM, PM]` for en-US).
  902. *
  903. * @experimental i18n support is experimental.
  904. */
  905. function getLocaleDayPeriods(locale, formStyle, width) {
  906. var data = findLocaleData(locale);
  907. var amPmData = [data[1 /* DayPeriodsFormat */], data[2 /* DayPeriodsStandalone */]];
  908. var amPm = getLastDefinedValue(amPmData, formStyle);
  909. return getLastDefinedValue(amPm, width);
  910. }
  911. /**
  912. * Days of the week for the Gregorian calendar (e.g. `[Sunday, Monday, ... Saturday]` for en-US).
  913. *
  914. * @experimental i18n support is experimental.
  915. */
  916. function getLocaleDayNames(locale, formStyle, width) {
  917. var data = findLocaleData(locale);
  918. var daysData = [data[3 /* DaysFormat */], data[4 /* DaysStandalone */]];
  919. var days = getLastDefinedValue(daysData, formStyle);
  920. return getLastDefinedValue(days, width);
  921. }
  922. /**
  923. * Months of the year for the Gregorian calendar (e.g. `[January, February, ...]` for en-US).
  924. *
  925. * @experimental i18n support is experimental.
  926. */
  927. function getLocaleMonthNames(locale, formStyle, width) {
  928. var data = findLocaleData(locale);
  929. var monthsData = [data[5 /* MonthsFormat */], data[6 /* MonthsStandalone */]];
  930. var months = getLastDefinedValue(monthsData, formStyle);
  931. return getLastDefinedValue(months, width);
  932. }
  933. /**
  934. * Eras for the Gregorian calendar (e.g. AD/BC).
  935. *
  936. * @experimental i18n support is experimental.
  937. */
  938. function getLocaleEraNames(locale, width) {
  939. var data = findLocaleData(locale);
  940. var erasData = data[7 /* Eras */];
  941. return getLastDefinedValue(erasData, width);
  942. }
  943. /**
  944. * First day of the week for this locale, based on english days (Sunday = 0, Monday = 1, ...).
  945. * For example in french the value would be 1 because the first day of the week is Monday.
  946. *
  947. * @experimental i18n support is experimental.
  948. */
  949. function getLocaleFirstDayOfWeek(locale) {
  950. var data = findLocaleData(locale);
  951. return data[8 /* FirstDayOfWeek */];
  952. }
  953. /**
  954. * Range of days in the week that represent the week-end for this locale, based on english days
  955. * (Sunday = 0, Monday = 1, ...).
  956. * For example in english the value would be [6,0] for Saturday to Sunday.
  957. *
  958. * @experimental i18n support is experimental.
  959. */
  960. function getLocaleWeekEndRange(locale) {
  961. var data = findLocaleData(locale);
  962. return data[9 /* WeekendRange */];
  963. }
  964. /**
  965. * Date format that depends on the locale.
  966. *
  967. * There are four basic date formats:
  968. * - `full` should contain long-weekday (EEEE), year (y), long-month (MMMM), day (d).
  969. *
  970. * For example, English uses `EEEE, MMMM d, y`, corresponding to a date like
  971. * "Tuesday, September 14, 1999".
  972. *
  973. * - `long` should contain year, long-month, day.
  974. *
  975. * For example, `MMMM d, y`, corresponding to a date like "September 14, 1999".
  976. *
  977. * - `medium` should contain year, abbreviated-month (MMM), day.
  978. *
  979. * For example, `MMM d, y`, corresponding to a date like "Sep 14, 1999".
  980. * For languages that do not use abbreviated months, use the numeric month (MM/M). For example,
  981. * `y/MM/dd`, corresponding to a date like "1999/09/14".
  982. *
  983. * - `short` should contain year, numeric-month (MM/M), and day.
  984. *
  985. * For example, `M/d/yy`, corresponding to a date like "9/14/99".
  986. *
  987. * @experimental i18n support is experimental.
  988. */
  989. function getLocaleDateFormat(locale, width) {
  990. var data = findLocaleData(locale);
  991. return getLastDefinedValue(data[10 /* DateFormat */], width);
  992. }
  993. /**
  994. * Time format that depends on the locale.
  995. *
  996. * The standard formats include four basic time formats:
  997. * - `full` should contain hour (h/H), minute (mm), second (ss), and zone (zzzz).
  998. * - `long` should contain hour, minute, second, and zone (z)
  999. * - `medium` should contain hour, minute, second.
  1000. * - `short` should contain hour, minute.
  1001. *
  1002. * Note: The patterns depend on whether the main country using your language uses 12-hour time or
  1003. * not:
  1004. * - For 12-hour time, use a pattern like `hh:mm a` using h to mean a 12-hour clock cycle running
  1005. * 1 through 12 (midnight plus 1 minute is 12:01), or using K to mean a 12-hour clock cycle
  1006. * running 0 through 11 (midnight plus 1 minute is 0:01).
  1007. * - For 24-hour time, use a pattern like `HH:mm` using H to mean a 24-hour clock cycle running 0
  1008. * through 23 (midnight plus 1 minute is 0:01), or using k to mean a 24-hour clock cycle running
  1009. * 1 through 24 (midnight plus 1 minute is 24:01).
  1010. *
  1011. * @experimental i18n support is experimental.
  1012. */
  1013. function getLocaleTimeFormat(locale, width) {
  1014. var data = findLocaleData(locale);
  1015. return getLastDefinedValue(data[11 /* TimeFormat */], width);
  1016. }
  1017. /**
  1018. * Date-time format that depends on the locale.
  1019. *
  1020. * The date-time pattern shows how to combine separate patterns for date (represented by {1})
  1021. * and time (represented by {0}) into a single pattern. It usually doesn't need to be changed.
  1022. * What you want to pay attention to are:
  1023. * - possibly removing a space for languages that don't use it, such as many East Asian languages
  1024. * - possibly adding a comma, other punctuation, or a combining word
  1025. *
  1026. * For example:
  1027. * - English uses `{1} 'at' {0}` or `{1}, {0}` (depending on date style), while Japanese uses
  1028. * `{1}{0}`.
  1029. * - An English formatted date-time using the combining pattern `{1}, {0}` could be
  1030. * `Dec 10, 2010, 3:59:49 PM`. Notice the comma and space between the date portion and the time
  1031. * portion.
  1032. *
  1033. * There are four formats (`full`, `long`, `medium`, `short`); the determination of which to use
  1034. * is normally based on the date style. For example, if the date has a full month and weekday
  1035. * name, the full combining pattern will be used to combine that with a time. If the date has
  1036. * numeric month, the short version of the combining pattern will be used to combine that with a
  1037. * time. English uses `{1} 'at' {0}` for full and long styles, and `{1}, {0}` for medium and short
  1038. * styles.
  1039. *
  1040. * @experimental i18n support is experimental.
  1041. */
  1042. function getLocaleDateTimeFormat(locale, width) {
  1043. var data = findLocaleData(locale);
  1044. var dateTimeFormatData = data[12 /* DateTimeFormat */];
  1045. return getLastDefinedValue(dateTimeFormatData, width);
  1046. }
  1047. /**
  1048. * Number symbol that can be used to replace placeholders in number formats.
  1049. * See {@link NumberSymbol} for more information.
  1050. *
  1051. * @experimental i18n support is experimental.
  1052. */
  1053. function getLocaleNumberSymbol(locale, symbol) {
  1054. var data = findLocaleData(locale);
  1055. var res = data[13 /* NumberSymbols */][symbol];
  1056. if (typeof res === 'undefined') {
  1057. if (symbol === NumberSymbol.CurrencyDecimal) {
  1058. return data[13 /* NumberSymbols */][NumberSymbol.Decimal];
  1059. }
  1060. else if (symbol === NumberSymbol.CurrencyGroup) {
  1061. return data[13 /* NumberSymbols */][NumberSymbol.Group];
  1062. }
  1063. }
  1064. return res;
  1065. }
  1066. /**
  1067. * Number format that depends on the locale.
  1068. *
  1069. * Numbers are formatted using patterns, like `#,###.00`. For example, the pattern `#,###.00`
  1070. * when used to format the number 12345.678 could result in "12'345,67". That would happen if the
  1071. * grouping separator for your language is an apostrophe, and the decimal separator is a comma.
  1072. *
  1073. * <b>Important:</b> The characters `.` `,` `0` `#` (and others below) are special placeholders;
  1074. * they stand for the decimal separator, and so on, and are NOT real characters.
  1075. * You must NOT "translate" the placeholders; for example, don't change `.` to `,` even though in
  1076. * your language the decimal point is written with a comma. The symbols should be replaced by the
  1077. * local equivalents, using the Number Symbols for your language.
  1078. *
  1079. * Here are the special characters used in number patterns:
  1080. *
  1081. * | Symbol | Meaning |
  1082. * |--------|---------|
  1083. * | . | Replaced automatically by the character used for the decimal point. |
  1084. * | , | Replaced by the "grouping" (thousands) separator. |
  1085. * | 0 | Replaced by a digit (or zero if there aren't enough digits). |
  1086. * | # | Replaced by a digit (or nothing if there aren't enough). |
  1087. * | ¤ | This will be replaced by a currency symbol, such as $ or USD. |
  1088. * | % | This marks a percent format. The % symbol may change position, but must be retained. |
  1089. * | E | This marks a scientific format. The E symbol may change position, but must be retained. |
  1090. * | ' | Special characters used as literal characters are quoted with ASCII single quotes. |
  1091. *
  1092. * You can find more information
  1093. * [on the CLDR website](http://cldr.unicode.org/translation/number-patterns)
  1094. *
  1095. * @experimental i18n support is experimental.
  1096. */
  1097. function getLocaleNumberFormat(locale, type) {
  1098. var data = findLocaleData(locale);
  1099. return data[14 /* NumberFormats */][type];
  1100. }
  1101. /**
  1102. * The symbol used to represent the currency for the main country using this locale (e.g. $ for
  1103. * the locale en-US).
  1104. * The symbol will be `null` if the main country cannot be determined.
  1105. *
  1106. * @experimental i18n support is experimental.
  1107. */
  1108. function getLocaleCurrencySymbol(locale) {
  1109. var data = findLocaleData(locale);
  1110. return data[15 /* CurrencySymbol */] || null;
  1111. }
  1112. /**
  1113. * The name of the currency for the main country using this locale (e.g. USD for the locale
  1114. * en-US).
  1115. * The name will be `null` if the main country cannot be determined.
  1116. *
  1117. * @experimental i18n support is experimental.
  1118. */
  1119. function getLocaleCurrencyName(locale) {
  1120. var data = findLocaleData(locale);
  1121. return data[16 /* CurrencyName */] || null;
  1122. }
  1123. /**
  1124. * Returns the currency values for the locale
  1125. */
  1126. function getLocaleCurrencies(locale) {
  1127. var data = findLocaleData(locale);
  1128. return data[17 /* Currencies */];
  1129. }
  1130. /**
  1131. * The locale plural function used by ICU expressions to determine the plural case to use.
  1132. * See {@link NgPlural} for more information.
  1133. *
  1134. * @experimental i18n support is experimental.
  1135. */
  1136. function getLocalePluralCase(locale) {
  1137. var data = findLocaleData(locale);
  1138. return data[18 /* PluralCase */];
  1139. }
  1140. function checkFullData(data) {
  1141. if (!data[19 /* ExtraData */]) {
  1142. 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.");
  1143. }
  1144. }
  1145. /**
  1146. * Rules used to determine which day period to use (See `dayPeriods` below).
  1147. * The rules can either be an array or a single value. If it's an array, consider it as "from"
  1148. * and "to". If it's a single value then it means that the period is only valid at this exact
  1149. * value.
  1150. * There is always the same number of rules as the number of day periods, which means that the
  1151. * first rule is applied to the first day period and so on.
  1152. * You should fallback to AM/PM when there are no rules available.
  1153. *
  1154. * Note: this is only available if you load the full locale data.
  1155. * See the ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale
  1156. * data.
  1157. *
  1158. * @experimental i18n support is experimental.
  1159. */
  1160. function getLocaleExtraDayPeriodRules(locale) {
  1161. var data = findLocaleData(locale);
  1162. checkFullData(data);
  1163. var rules = data[19 /* ExtraData */][2 /* ExtraDayPeriodsRules */] || [];
  1164. return rules.map(function (rule) {
  1165. if (typeof rule === 'string') {
  1166. return extractTime(rule);
  1167. }
  1168. return [extractTime(rule[0]), extractTime(rule[1])];
  1169. });
  1170. }
  1171. /**
  1172. * Day Periods indicate roughly how the day is broken up in different languages (e.g. morning,
  1173. * noon, afternoon, midnight, ...).
  1174. * You should use the function {@link getLocaleExtraDayPeriodRules} to determine which period to
  1175. * use.
  1176. * You should fallback to AM/PM when there are no day periods available.
  1177. *
  1178. * Note: this is only available if you load the full locale data.
  1179. * See the ["I18n guide"](guide/i18n#i18n-pipes) to know how to import additional locale
  1180. * data.
  1181. *
  1182. * @experimental i18n support is experimental.
  1183. */
  1184. function getLocaleExtraDayPeriods(locale, formStyle, width) {
  1185. var data = findLocaleData(locale);
  1186. checkFullData(data);
  1187. var dayPeriodsData = [
  1188. data[19 /* ExtraData */][0 /* ExtraDayPeriodFormats */],
  1189. data[19 /* ExtraData */][1 /* ExtraDayPeriodStandalone */]
  1190. ];
  1191. var dayPeriods = getLastDefinedValue(dayPeriodsData, formStyle) || [];
  1192. return getLastDefinedValue(dayPeriods, width) || [];
  1193. }
  1194. /**
  1195. * Returns the first value that is defined in an array, going backwards.
  1196. *
  1197. * To avoid repeating the same data (e.g. when "format" and "standalone" are the same) we only
  1198. * add the first one to the locale data arrays, the other ones are only defined when different.
  1199. * We use this function to retrieve the first defined value.
  1200. *
  1201. * @experimental i18n support is experimental.
  1202. */
  1203. function getLastDefinedValue(data, index) {
  1204. for (var i = index; i > -1; i--) {
  1205. if (typeof data[i] !== 'undefined') {
  1206. return data[i];
  1207. }
  1208. }
  1209. throw new Error('Locale data API: locale data undefined');
  1210. }
  1211. /**
  1212. * Extract the hours and minutes from a string like "15:45"
  1213. */
  1214. function extractTime(time) {
  1215. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(time.split(':'), 2), h = _a[0], m = _a[1];
  1216. return { hours: +h, minutes: +m };
  1217. }
  1218. /**
  1219. * Finds the locale data for a locale id
  1220. *
  1221. * @experimental i18n support is experimental.
  1222. */
  1223. function findLocaleData(locale) {
  1224. var normalizedLocale = locale.toLowerCase().replace(/_/g, '-');
  1225. var match = LOCALE_DATA[normalizedLocale];
  1226. if (match) {
  1227. return match;
  1228. }
  1229. // let's try to find a parent locale
  1230. var parentLocale = normalizedLocale.split('-')[0];
  1231. match = LOCALE_DATA[parentLocale];
  1232. if (match) {
  1233. return match;
  1234. }
  1235. if (parentLocale === 'en') {
  1236. return localeEn;
  1237. }
  1238. throw new Error("Missing locale data for the locale \"" + locale + "\".");
  1239. }
  1240. /**
  1241. * Returns the currency symbol for a given currency code, or the code if no symbol available
  1242. * (e.g.: format narrow = $, format wide = US$, code = USD)
  1243. * If no locale is provided, it uses the locale "en" by default
  1244. *
  1245. * @experimental i18n support is experimental.
  1246. */
  1247. function getCurrencySymbol(code, format, locale) {
  1248. if (locale === void 0) { locale = 'en'; }
  1249. var currency = getLocaleCurrencies(locale)[code] || CURRENCIES_EN[code] || [];
  1250. var symbolNarrow = currency[1 /* SymbolNarrow */];
  1251. if (format === 'narrow' && typeof symbolNarrow === 'string') {
  1252. return symbolNarrow;
  1253. }
  1254. return currency[0 /* Symbol */] || code;
  1255. }
  1256. // Most currencies have cents, that's why the default is 2
  1257. var DEFAULT_NB_OF_CURRENCY_DIGITS = 2;
  1258. /**
  1259. * Returns the number of decimal digits for the given currency.
  1260. * Its value depends upon the presence of cents in that particular currency.
  1261. *
  1262. * @experimental i18n support is experimental.
  1263. */
  1264. function getNumberOfCurrencyDigits(code) {
  1265. var digits;
  1266. var currency = CURRENCIES_EN[code];
  1267. if (currency) {
  1268. digits = currency[2 /* NbOfDigits */];
  1269. }
  1270. return typeof digits === 'number' ? digits : DEFAULT_NB_OF_CURRENCY_DIGITS;
  1271. }
  1272. /**
  1273. * @license
  1274. * Copyright Google Inc. All Rights Reserved.
  1275. *
  1276. * Use of this source code is governed by an MIT-style license that can be
  1277. * found in the LICENSE file at https://angular.io/license
  1278. */
  1279. var ISO8601_DATE_REGEX = /^(\d{4})-?(\d\d)-?(\d\d)(?:T(\d\d)(?::?(\d\d)(?::?(\d\d)(?:\.(\d+))?)?)?(Z|([+-])(\d\d):?(\d\d))?)?$/;
  1280. // 1 2 3 4 5 6 7 8 9 10 11
  1281. var NAMED_FORMATS = {};
  1282. var 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]*)/;
  1283. var ZoneWidth;
  1284. (function (ZoneWidth) {
  1285. ZoneWidth[ZoneWidth["Short"] = 0] = "Short";
  1286. ZoneWidth[ZoneWidth["ShortGMT"] = 1] = "ShortGMT";
  1287. ZoneWidth[ZoneWidth["Long"] = 2] = "Long";
  1288. ZoneWidth[ZoneWidth["Extended"] = 3] = "Extended";
  1289. })(ZoneWidth || (ZoneWidth = {}));
  1290. var DateType;
  1291. (function (DateType) {
  1292. DateType[DateType["FullYear"] = 0] = "FullYear";
  1293. DateType[DateType["Month"] = 1] = "Month";
  1294. DateType[DateType["Date"] = 2] = "Date";
  1295. DateType[DateType["Hours"] = 3] = "Hours";
  1296. DateType[DateType["Minutes"] = 4] = "Minutes";
  1297. DateType[DateType["Seconds"] = 5] = "Seconds";
  1298. DateType[DateType["FractionalSeconds"] = 6] = "FractionalSeconds";
  1299. DateType[DateType["Day"] = 7] = "Day";
  1300. })(DateType || (DateType = {}));
  1301. var TranslationType;
  1302. (function (TranslationType) {
  1303. TranslationType[TranslationType["DayPeriods"] = 0] = "DayPeriods";
  1304. TranslationType[TranslationType["Days"] = 1] = "Days";
  1305. TranslationType[TranslationType["Months"] = 2] = "Months";
  1306. TranslationType[TranslationType["Eras"] = 3] = "Eras";
  1307. })(TranslationType || (TranslationType = {}));
  1308. /**
  1309. * @ngModule CommonModule
  1310. * @description
  1311. *
  1312. * Formats a date according to locale rules.
  1313. *
  1314. * Where:
  1315. * - `value` is a Date, a number (milliseconds since UTC epoch) or an ISO string
  1316. * (https://www.w3.org/TR/NOTE-datetime).
  1317. * - `format` indicates which date/time components to include. See {@link DatePipe} for more
  1318. * details.
  1319. * - `locale` is a `string` defining the locale to use.
  1320. * - `timezone` to be used for formatting. It understands UTC/GMT and the continental US time zone
  1321. * abbreviations, but for general use, use a time zone offset (e.g. `'+0430'`).
  1322. * If not specified, host system settings are used.
  1323. *
  1324. * See {@link DatePipe} for more details.
  1325. */
  1326. function formatDate(value, format, locale, timezone) {
  1327. var date = toDate(value);
  1328. var namedFormat = getNamedFormat(locale, format);
  1329. format = namedFormat || format;
  1330. var parts = [];
  1331. var match;
  1332. while (format) {
  1333. match = DATE_FORMATS_SPLIT.exec(format);
  1334. if (match) {
  1335. parts = parts.concat(match.slice(1));
  1336. var part = parts.pop();
  1337. if (!part) {
  1338. break;
  1339. }
  1340. format = part;
  1341. }
  1342. else {
  1343. parts.push(format);
  1344. break;
  1345. }
  1346. }
  1347. var dateTimezoneOffset = date.getTimezoneOffset();
  1348. if (timezone) {
  1349. dateTimezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  1350. date = convertTimezoneToLocal(date, timezone, true);
  1351. }
  1352. var text = '';
  1353. parts.forEach(function (value) {
  1354. var dateFormatter = getDateFormatter(value);
  1355. text += dateFormatter ?
  1356. dateFormatter(date, locale, dateTimezoneOffset) :
  1357. value === '\'\'' ? '\'' : value.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
  1358. });
  1359. return text;
  1360. }
  1361. function getNamedFormat(locale, format) {
  1362. var localeId = getLocaleId(locale);
  1363. NAMED_FORMATS[localeId] = NAMED_FORMATS[localeId] || {};
  1364. if (NAMED_FORMATS[localeId][format]) {
  1365. return NAMED_FORMATS[localeId][format];
  1366. }
  1367. var formatValue = '';
  1368. switch (format) {
  1369. case 'shortDate':
  1370. formatValue = getLocaleDateFormat(locale, FormatWidth.Short);
  1371. break;
  1372. case 'mediumDate':
  1373. formatValue = getLocaleDateFormat(locale, FormatWidth.Medium);
  1374. break;
  1375. case 'longDate':
  1376. formatValue = getLocaleDateFormat(locale, FormatWidth.Long);
  1377. break;
  1378. case 'fullDate':
  1379. formatValue = getLocaleDateFormat(locale, FormatWidth.Full);
  1380. break;
  1381. case 'shortTime':
  1382. formatValue = getLocaleTimeFormat(locale, FormatWidth.Short);
  1383. break;
  1384. case 'mediumTime':
  1385. formatValue = getLocaleTimeFormat(locale, FormatWidth.Medium);
  1386. break;
  1387. case 'longTime':
  1388. formatValue = getLocaleTimeFormat(locale, FormatWidth.Long);
  1389. break;
  1390. case 'fullTime':
  1391. formatValue = getLocaleTimeFormat(locale, FormatWidth.Full);
  1392. break;
  1393. case 'short':
  1394. var shortTime = getNamedFormat(locale, 'shortTime');
  1395. var shortDate = getNamedFormat(locale, 'shortDate');
  1396. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Short), [shortTime, shortDate]);
  1397. break;
  1398. case 'medium':
  1399. var mediumTime = getNamedFormat(locale, 'mediumTime');
  1400. var mediumDate = getNamedFormat(locale, 'mediumDate');
  1401. formatValue = formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Medium), [mediumTime, mediumDate]);
  1402. break;
  1403. case 'long':
  1404. var longTime = getNamedFormat(locale, 'longTime');
  1405. var longDate = getNamedFormat(locale, 'longDate');
  1406. formatValue =
  1407. formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Long), [longTime, longDate]);
  1408. break;
  1409. case 'full':
  1410. var fullTime = getNamedFormat(locale, 'fullTime');
  1411. var fullDate = getNamedFormat(locale, 'fullDate');
  1412. formatValue =
  1413. formatDateTime(getLocaleDateTimeFormat(locale, FormatWidth.Full), [fullTime, fullDate]);
  1414. break;
  1415. }
  1416. if (formatValue) {
  1417. NAMED_FORMATS[localeId][format] = formatValue;
  1418. }
  1419. return formatValue;
  1420. }
  1421. function formatDateTime(str, opt_values) {
  1422. if (opt_values) {
  1423. str = str.replace(/\{([^}]+)}/g, function (match, key) {
  1424. return (opt_values != null && key in opt_values) ? opt_values[key] : match;
  1425. });
  1426. }
  1427. return str;
  1428. }
  1429. function padNumber(num, digits, minusSign, trim, negWrap) {
  1430. if (minusSign === void 0) { minusSign = '-'; }
  1431. var neg = '';
  1432. if (num < 0 || (negWrap && num <= 0)) {
  1433. if (negWrap) {
  1434. num = -num + 1;
  1435. }
  1436. else {
  1437. num = -num;
  1438. neg = minusSign;
  1439. }
  1440. }
  1441. var strNum = String(num);
  1442. while (strNum.length < digits) {
  1443. strNum = '0' + strNum;
  1444. }
  1445. if (trim) {
  1446. strNum = strNum.substr(strNum.length - digits);
  1447. }
  1448. return neg + strNum;
  1449. }
  1450. function formatFractionalSeconds(milliseconds, digits) {
  1451. var strMs = padNumber(milliseconds, 3);
  1452. return strMs.substr(0, digits);
  1453. }
  1454. /**
  1455. * Returns a date formatter that transforms a date into its locale digit representation
  1456. */
  1457. function dateGetter(name, size, offset, trim, negWrap) {
  1458. if (offset === void 0) { offset = 0; }
  1459. if (trim === void 0) { trim = false; }
  1460. if (negWrap === void 0) { negWrap = false; }
  1461. return function (date, locale) {
  1462. var part = getDatePart(name, date);
  1463. if (offset > 0 || part > -offset) {
  1464. part += offset;
  1465. }
  1466. if (name === DateType.Hours) {
  1467. if (part === 0 && offset === -12) {
  1468. part = 12;
  1469. }
  1470. }
  1471. else if (name === DateType.FractionalSeconds) {
  1472. return formatFractionalSeconds(part, size);
  1473. }
  1474. var localeMinus = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
  1475. return padNumber(part, size, localeMinus, trim, negWrap);
  1476. };
  1477. }
  1478. function getDatePart(part, date) {
  1479. switch (part) {
  1480. case DateType.FullYear:
  1481. return date.getFullYear();
  1482. case DateType.Month:
  1483. return date.getMonth();
  1484. case DateType.Date:
  1485. return date.getDate();
  1486. case DateType.Hours:
  1487. return date.getHours();
  1488. case DateType.Minutes:
  1489. return date.getMinutes();
  1490. case DateType.Seconds:
  1491. return date.getSeconds();
  1492. case DateType.FractionalSeconds:
  1493. return date.getMilliseconds();
  1494. case DateType.Day:
  1495. return date.getDay();
  1496. default:
  1497. throw new Error("Unknown DateType value \"" + part + "\".");
  1498. }
  1499. }
  1500. /**
  1501. * Returns a date formatter that transforms a date into its locale string representation
  1502. */
  1503. function dateStrGetter(name, width, form, extended) {
  1504. if (form === void 0) { form = FormStyle.Format; }
  1505. if (extended === void 0) { extended = false; }
  1506. return function (date, locale) {
  1507. return getDateTranslation(date, locale, name, width, form, extended);
  1508. };
  1509. }
  1510. /**
  1511. * Returns the locale translation of a date for a given form, type and width
  1512. */
  1513. function getDateTranslation(date, locale, name, width, form, extended) {
  1514. switch (name) {
  1515. case TranslationType.Months:
  1516. return getLocaleMonthNames(locale, form, width)[date.getMonth()];
  1517. case TranslationType.Days:
  1518. return getLocaleDayNames(locale, form, width)[date.getDay()];
  1519. case TranslationType.DayPeriods:
  1520. var currentHours_1 = date.getHours();
  1521. var currentMinutes_1 = date.getMinutes();
  1522. if (extended) {
  1523. var rules = getLocaleExtraDayPeriodRules(locale);
  1524. var dayPeriods_1 = getLocaleExtraDayPeriods(locale, form, width);
  1525. var result_1;
  1526. rules.forEach(function (rule, index) {
  1527. if (Array.isArray(rule)) {
  1528. // morning, afternoon, evening, night
  1529. var _a = rule[0], hoursFrom = _a.hours, minutesFrom = _a.minutes;
  1530. var _b = rule[1], hoursTo = _b.hours, minutesTo = _b.minutes;
  1531. if (currentHours_1 >= hoursFrom && currentMinutes_1 >= minutesFrom &&
  1532. (currentHours_1 < hoursTo ||
  1533. (currentHours_1 === hoursTo && currentMinutes_1 < minutesTo))) {
  1534. result_1 = dayPeriods_1[index];
  1535. }
  1536. }
  1537. else { // noon or midnight
  1538. var hours = rule.hours, minutes = rule.minutes;
  1539. if (hours === currentHours_1 && minutes === currentMinutes_1) {
  1540. result_1 = dayPeriods_1[index];
  1541. }
  1542. }
  1543. });
  1544. if (result_1) {
  1545. return result_1;
  1546. }
  1547. }
  1548. // if no rules for the day periods, we use am/pm by default
  1549. return getLocaleDayPeriods(locale, form, width)[currentHours_1 < 12 ? 0 : 1];
  1550. case TranslationType.Eras:
  1551. return getLocaleEraNames(locale, width)[date.getFullYear() <= 0 ? 0 : 1];
  1552. default:
  1553. // This default case is not needed by TypeScript compiler, as the switch is exhaustive.
  1554. // However Closure Compiler does not understand that and reports an error in typed mode.
  1555. // The `throw new Error` below works around the problem, and the unexpected: never variable
  1556. // makes sure tsc still checks this code is unreachable.
  1557. var unexpected = name;
  1558. throw new Error("unexpected translation type " + unexpected);
  1559. }
  1560. }
  1561. /**
  1562. * Returns a date formatter that transforms a date and an offset into a timezone with ISO8601 or
  1563. * GMT format depending on the width (eg: short = +0430, short:GMT = GMT+4, long = GMT+04:30,
  1564. * extended = +04:30)
  1565. */
  1566. function timeZoneGetter(width) {
  1567. return function (date, locale, offset) {
  1568. var zone = -1 * offset;
  1569. var minusSign = getLocaleNumberSymbol(locale, NumberSymbol.MinusSign);
  1570. var hours = zone > 0 ? Math.floor(zone / 60) : Math.ceil(zone / 60);
  1571. switch (width) {
  1572. case ZoneWidth.Short:
  1573. return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) +
  1574. padNumber(Math.abs(zone % 60), 2, minusSign);
  1575. case ZoneWidth.ShortGMT:
  1576. return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 1, minusSign);
  1577. case ZoneWidth.Long:
  1578. return 'GMT' + ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
  1579. padNumber(Math.abs(zone % 60), 2, minusSign);
  1580. case ZoneWidth.Extended:
  1581. if (offset === 0) {
  1582. return 'Z';
  1583. }
  1584. else {
  1585. return ((zone >= 0) ? '+' : '') + padNumber(hours, 2, minusSign) + ':' +
  1586. padNumber(Math.abs(zone % 60), 2, minusSign);
  1587. }
  1588. default:
  1589. throw new Error("Unknown zone width \"" + width + "\"");
  1590. }
  1591. };
  1592. }
  1593. var JANUARY = 0;
  1594. var THURSDAY = 4;
  1595. function getFirstThursdayOfYear(year) {
  1596. var firstDayOfYear = (new Date(year, JANUARY, 1)).getDay();
  1597. return new Date(year, 0, 1 + ((firstDayOfYear <= THURSDAY) ? THURSDAY : THURSDAY + 7) - firstDayOfYear);
  1598. }
  1599. function getThursdayThisWeek(datetime) {
  1600. return new Date(datetime.getFullYear(), datetime.getMonth(), datetime.getDate() + (THURSDAY - datetime.getDay()));
  1601. }
  1602. function weekGetter(size, monthBased) {
  1603. if (monthBased === void 0) { monthBased = false; }
  1604. return function (date, locale) {
  1605. var result;
  1606. if (monthBased) {
  1607. var nbDaysBefore1stDayOfMonth = new Date(date.getFullYear(), date.getMonth(), 1).getDay() - 1;
  1608. var today = date.getDate();
  1609. result = 1 + Math.floor((today + nbDaysBefore1stDayOfMonth) / 7);
  1610. }
  1611. else {
  1612. var firstThurs = getFirstThursdayOfYear(date.getFullYear());
  1613. var thisThurs = getThursdayThisWeek(date);
  1614. var diff = thisThurs.getTime() - firstThurs.getTime();
  1615. result = 1 + Math.round(diff / 6.048e8); // 6.048e8 ms per week
  1616. }
  1617. return padNumber(result, size, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  1618. };
  1619. }
  1620. var DATE_FORMATS = {};
  1621. // Based on CLDR formats:
  1622. // See complete list: http://www.unicode.org/reports/tr35/tr35-dates.html#Date_Field_Symbol_Table
  1623. // See also explanations: http://cldr.unicode.org/translation/date-time
  1624. // TODO(ocombe): support all missing cldr formats: Y, U, Q, D, F, e, c, j, J, C, A, v, V, X, x
  1625. function getDateFormatter(format) {
  1626. if (DATE_FORMATS[format]) {
  1627. return DATE_FORMATS[format];
  1628. }
  1629. var formatter;
  1630. switch (format) {
  1631. // Era name (AD/BC)
  1632. case 'G':
  1633. case 'GG':
  1634. case 'GGG':
  1635. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Abbreviated);
  1636. break;
  1637. case 'GGGG':
  1638. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Wide);
  1639. break;
  1640. case 'GGGGG':
  1641. formatter = dateStrGetter(TranslationType.Eras, TranslationWidth.Narrow);
  1642. break;
  1643. // 1 digit representation of the year, e.g. (AD 1 => 1, AD 199 => 199)
  1644. case 'y':
  1645. formatter = dateGetter(DateType.FullYear, 1, 0, false, true);
  1646. break;
  1647. // 2 digit representation of the year, padded (00-99). (e.g. AD 2001 => 01, AD 2010 => 10)
  1648. case 'yy':
  1649. formatter = dateGetter(DateType.FullYear, 2, 0, true, true);
  1650. break;
  1651. // 3 digit representation of the year, padded (000-999). (e.g. AD 2001 => 01, AD 2010 => 10)
  1652. case 'yyy':
  1653. formatter = dateGetter(DateType.FullYear, 3, 0, false, true);
  1654. break;
  1655. // 4 digit representation of the year (e.g. AD 1 => 0001, AD 2010 => 2010)
  1656. case 'yyyy':
  1657. formatter = dateGetter(DateType.FullYear, 4, 0, false, true);
  1658. break;
  1659. // Month of the year (1-12), numeric
  1660. case 'M':
  1661. case 'L':
  1662. formatter = dateGetter(DateType.Month, 1, 1);
  1663. break;
  1664. case 'MM':
  1665. case 'LL':
  1666. formatter = dateGetter(DateType.Month, 2, 1);
  1667. break;
  1668. // Month of the year (January, ...), string, format
  1669. case 'MMM':
  1670. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated);
  1671. break;
  1672. case 'MMMM':
  1673. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Wide);
  1674. break;
  1675. case 'MMMMM':
  1676. formatter = dateStrGetter(TranslationType.Months, TranslationWidth.Narrow);
  1677. break;
  1678. // Month of the year (January, ...), string, standalone
  1679. case 'LLL':
  1680. formatter =
  1681. dateStrGetter(TranslationType.Months, TranslationWidth.Abbreviated, FormStyle.Standalone);
  1682. break;
  1683. case 'LLLL':
  1684. formatter =
  1685. dateStrGetter(TranslationType.Months, TranslationWidth.Wide, FormStyle.Standalone);
  1686. break;
  1687. case 'LLLLL':
  1688. formatter =
  1689. dateStrGetter(TranslationType.Months, TranslationWidth.Narrow, FormStyle.Standalone);
  1690. break;
  1691. // Week of the year (1, ... 52)
  1692. case 'w':
  1693. formatter = weekGetter(1);
  1694. break;
  1695. case 'ww':
  1696. formatter = weekGetter(2);
  1697. break;
  1698. // Week of the month (1, ...)
  1699. case 'W':
  1700. formatter = weekGetter(1, true);
  1701. break;
  1702. // Day of the month (1-31)
  1703. case 'd':
  1704. formatter = dateGetter(DateType.Date, 1);
  1705. break;
  1706. case 'dd':
  1707. formatter = dateGetter(DateType.Date, 2);
  1708. break;
  1709. // Day of the Week
  1710. case 'E':
  1711. case 'EE':
  1712. case 'EEE':
  1713. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Abbreviated);
  1714. break;
  1715. case 'EEEE':
  1716. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Wide);
  1717. break;
  1718. case 'EEEEE':
  1719. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Narrow);
  1720. break;
  1721. case 'EEEEEE':
  1722. formatter = dateStrGetter(TranslationType.Days, TranslationWidth.Short);
  1723. break;
  1724. // Generic period of the day (am-pm)
  1725. case 'a':
  1726. case 'aa':
  1727. case 'aaa':
  1728. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated);
  1729. break;
  1730. case 'aaaa':
  1731. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide);
  1732. break;
  1733. case 'aaaaa':
  1734. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow);
  1735. break;
  1736. // Extended period of the day (midnight, at night, ...), standalone
  1737. case 'b':
  1738. case 'bb':
  1739. case 'bbb':
  1740. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Standalone, true);
  1741. break;
  1742. case 'bbbb':
  1743. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Standalone, true);
  1744. break;
  1745. case 'bbbbb':
  1746. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Standalone, true);
  1747. break;
  1748. // Extended period of the day (midnight, night, ...), standalone
  1749. case 'B':
  1750. case 'BB':
  1751. case 'BBB':
  1752. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Abbreviated, FormStyle.Format, true);
  1753. break;
  1754. case 'BBBB':
  1755. formatter =
  1756. dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Wide, FormStyle.Format, true);
  1757. break;
  1758. case 'BBBBB':
  1759. formatter = dateStrGetter(TranslationType.DayPeriods, TranslationWidth.Narrow, FormStyle.Format, true);
  1760. break;
  1761. // Hour in AM/PM, (1-12)
  1762. case 'h':
  1763. formatter = dateGetter(DateType.Hours, 1, -12);
  1764. break;
  1765. case 'hh':
  1766. formatter = dateGetter(DateType.Hours, 2, -12);
  1767. break;
  1768. // Hour of the day (0-23)
  1769. case 'H':
  1770. formatter = dateGetter(DateType.Hours, 1);
  1771. break;
  1772. // Hour in day, padded (00-23)
  1773. case 'HH':
  1774. formatter = dateGetter(DateType.Hours, 2);
  1775. break;
  1776. // Minute of the hour (0-59)
  1777. case 'm':
  1778. formatter = dateGetter(DateType.Minutes, 1);
  1779. break;
  1780. case 'mm':
  1781. formatter = dateGetter(DateType.Minutes, 2);
  1782. break;
  1783. // Second of the minute (0-59)
  1784. case 's':
  1785. formatter = dateGetter(DateType.Seconds, 1);
  1786. break;
  1787. case 'ss':
  1788. formatter = dateGetter(DateType.Seconds, 2);
  1789. break;
  1790. // Fractional second
  1791. case 'S':
  1792. formatter = dateGetter(DateType.FractionalSeconds, 1);
  1793. break;
  1794. case 'SS':
  1795. formatter = dateGetter(DateType.FractionalSeconds, 2);
  1796. break;
  1797. case 'SSS':
  1798. formatter = dateGetter(DateType.FractionalSeconds, 3);
  1799. break;
  1800. // Timezone ISO8601 short format (-0430)
  1801. case 'Z':
  1802. case 'ZZ':
  1803. case 'ZZZ':
  1804. formatter = timeZoneGetter(ZoneWidth.Short);
  1805. break;
  1806. // Timezone ISO8601 extended format (-04:30)
  1807. case 'ZZZZZ':
  1808. formatter = timeZoneGetter(ZoneWidth.Extended);
  1809. break;
  1810. // Timezone GMT short format (GMT+4)
  1811. case 'O':
  1812. case 'OO':
  1813. case 'OOO':
  1814. // Should be location, but fallback to format O instead because we don't have the data yet
  1815. case 'z':
  1816. case 'zz':
  1817. case 'zzz':
  1818. formatter = timeZoneGetter(ZoneWidth.ShortGMT);
  1819. break;
  1820. // Timezone GMT long format (GMT+0430)
  1821. case 'OOOO':
  1822. case 'ZZZZ':
  1823. // Should be location, but fallback to format O instead because we don't have the data yet
  1824. case 'zzzz':
  1825. formatter = timeZoneGetter(ZoneWidth.Long);
  1826. break;
  1827. default:
  1828. return null;
  1829. }
  1830. DATE_FORMATS[format] = formatter;
  1831. return formatter;
  1832. }
  1833. function timezoneToOffset(timezone, fallback) {
  1834. // Support: IE 9-11 only, Edge 13-15+
  1835. // IE/Edge do not "understand" colon (`:`) in timezone
  1836. timezone = timezone.replace(/:/g, '');
  1837. var requestedTimezoneOffset = Date.parse('Jan 01, 1970 00:00:00 ' + timezone) / 60000;
  1838. return isNaN(requestedTimezoneOffset) ? fallback : requestedTimezoneOffset;
  1839. }
  1840. function addDateMinutes(date, minutes) {
  1841. date = new Date(date.getTime());
  1842. date.setMinutes(date.getMinutes() + minutes);
  1843. return date;
  1844. }
  1845. function convertTimezoneToLocal(date, timezone, reverse) {
  1846. var reverseValue = reverse ? -1 : 1;
  1847. var dateTimezoneOffset = date.getTimezoneOffset();
  1848. var timezoneOffset = timezoneToOffset(timezone, dateTimezoneOffset);
  1849. return addDateMinutes(date, reverseValue * (timezoneOffset - dateTimezoneOffset));
  1850. }
  1851. /**
  1852. * Converts a value to date.
  1853. *
  1854. * Supported input formats:
  1855. * - `Date`
  1856. * - number: timestamp
  1857. * - string: numeric (e.g. "1234"), ISO and date strings in a format supported by
  1858. * [Date.parse()](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/parse).
  1859. * Note: ISO strings without time return a date without timeoffset.
  1860. *
  1861. * Throws if unable to convert to a date.
  1862. */
  1863. function toDate(value) {
  1864. if (isDate(value)) {
  1865. return value;
  1866. }
  1867. if (typeof value === 'number' && !isNaN(value)) {
  1868. return new Date(value);
  1869. }
  1870. if (typeof value === 'string') {
  1871. value = value.trim();
  1872. var parsedNb = parseFloat(value);
  1873. // any string that only contains numbers, like "1234" but not like "1234hello"
  1874. if (!isNaN(value - parsedNb)) {
  1875. return new Date(parsedNb);
  1876. }
  1877. if (/^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
  1878. /* For ISO Strings without time the day, month and year must be extracted from the ISO String
  1879. before Date creation to avoid time offset and errors in the new Date.
  1880. If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
  1881. date, some browsers (e.g. IE 9) will throw an invalid Date error.
  1882. If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the timeoffset
  1883. is applied.
  1884. Note: ISO months are 0 for January, 1 for February, ... */
  1885. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(value.split('-').map(function (val) { return +val; }), 3), y = _a[0], m = _a[1], d = _a[2];
  1886. return new Date(y, m - 1, d);
  1887. }
  1888. var match = void 0;
  1889. if (match = value.match(ISO8601_DATE_REGEX)) {
  1890. return isoStringToDate(match);
  1891. }
  1892. }
  1893. var date = new Date(value);
  1894. if (!isDate(date)) {
  1895. throw new Error("Unable to convert \"" + value + "\" into a date");
  1896. }
  1897. return date;
  1898. }
  1899. /**
  1900. * Converts a date in ISO8601 to a Date.
  1901. * Used instead of `Date.parse` because of browser discrepancies.
  1902. */
  1903. function isoStringToDate(match) {
  1904. var date = new Date(0);
  1905. var tzHour = 0;
  1906. var tzMin = 0;
  1907. // match[8] means that the string contains "Z" (UTC) or a timezone like "+01:00" or "+0100"
  1908. var dateSetter = match[8] ? date.setUTCFullYear : date.setFullYear;
  1909. var timeSetter = match[8] ? date.setUTCHours : date.setHours;
  1910. // if there is a timezone defined like "+01:00" or "+0100"
  1911. if (match[9]) {
  1912. tzHour = Number(match[9] + match[10]);
  1913. tzMin = Number(match[9] + match[11]);
  1914. }
  1915. dateSetter.call(date, Number(match[1]), Number(match[2]) - 1, Number(match[3]));
  1916. var h = Number(match[4] || 0) - tzHour;
  1917. var m = Number(match[5] || 0) - tzMin;
  1918. var s = Number(match[6] || 0);
  1919. var ms = Math.round(parseFloat('0.' + (match[7] || 0)) * 1000);
  1920. timeSetter.call(date, h, m, s, ms);
  1921. return date;
  1922. }
  1923. function isDate(value) {
  1924. return value instanceof Date && !isNaN(value.valueOf());
  1925. }
  1926. /**
  1927. * @license
  1928. * Copyright Google Inc. All Rights Reserved.
  1929. *
  1930. * Use of this source code is governed by an MIT-style license that can be
  1931. * found in the LICENSE file at https://angular.io/license
  1932. */
  1933. var NUMBER_FORMAT_REGEXP = /^(\d+)?\.((\d+)(-(\d+))?)?$/;
  1934. var MAX_DIGITS = 22;
  1935. var DECIMAL_SEP = '.';
  1936. var ZERO_CHAR = '0';
  1937. var PATTERN_SEP = ';';
  1938. var GROUP_SEP = ',';
  1939. var DIGIT_CHAR = '#';
  1940. var CURRENCY_CHAR = '¤';
  1941. var PERCENT_CHAR = '%';
  1942. /**
  1943. * Transforms a number to a locale string based on a style and a format
  1944. */
  1945. function formatNumberToLocaleString(value, pattern, locale, groupSymbol, decimalSymbol, digitsInfo, isPercent) {
  1946. if (isPercent === void 0) { isPercent = false; }
  1947. var formattedText = '';
  1948. var isZero = false;
  1949. if (!isFinite(value)) {
  1950. formattedText = getLocaleNumberSymbol(locale, NumberSymbol.Infinity);
  1951. }
  1952. else {
  1953. var parsedNumber = parseNumber(value);
  1954. if (isPercent) {
  1955. parsedNumber = toPercent(parsedNumber);
  1956. }
  1957. var minInt = pattern.minInt;
  1958. var minFraction = pattern.minFrac;
  1959. var maxFraction = pattern.maxFrac;
  1960. if (digitsInfo) {
  1961. var parts = digitsInfo.match(NUMBER_FORMAT_REGEXP);
  1962. if (parts === null) {
  1963. throw new Error(digitsInfo + " is not a valid digit info");
  1964. }
  1965. var minIntPart = parts[1];
  1966. var minFractionPart = parts[3];
  1967. var maxFractionPart = parts[5];
  1968. if (minIntPart != null) {
  1969. minInt = parseIntAutoRadix(minIntPart);
  1970. }
  1971. if (minFractionPart != null) {
  1972. minFraction = parseIntAutoRadix(minFractionPart);
  1973. }
  1974. if (maxFractionPart != null) {
  1975. maxFraction = parseIntAutoRadix(maxFractionPart);
  1976. }
  1977. else if (minFractionPart != null && minFraction > maxFraction) {
  1978. maxFraction = minFraction;
  1979. }
  1980. }
  1981. roundNumber(parsedNumber, minFraction, maxFraction);
  1982. var digits = parsedNumber.digits;
  1983. var integerLen = parsedNumber.integerLen;
  1984. var exponent = parsedNumber.exponent;
  1985. var decimals = [];
  1986. isZero = digits.every(function (d) { return !d; });
  1987. // pad zeros for small numbers
  1988. for (; integerLen < minInt; integerLen++) {
  1989. digits.unshift(0);
  1990. }
  1991. // pad zeros for small numbers
  1992. for (; integerLen < 0; integerLen++) {
  1993. digits.unshift(0);
  1994. }
  1995. // extract decimals digits
  1996. if (integerLen > 0) {
  1997. decimals = digits.splice(integerLen, digits.length);
  1998. }
  1999. else {
  2000. decimals = digits;
  2001. digits = [0];
  2002. }
  2003. // format the integer digits with grouping separators
  2004. var groups = [];
  2005. if (digits.length >= pattern.lgSize) {
  2006. groups.unshift(digits.splice(-pattern.lgSize, digits.length).join(''));
  2007. }
  2008. while (digits.length > pattern.gSize) {
  2009. groups.unshift(digits.splice(-pattern.gSize, digits.length).join(''));
  2010. }
  2011. if (digits.length) {
  2012. groups.unshift(digits.join(''));
  2013. }
  2014. formattedText = groups.join(getLocaleNumberSymbol(locale, groupSymbol));
  2015. // append the decimal digits
  2016. if (decimals.length) {
  2017. formattedText += getLocaleNumberSymbol(locale, decimalSymbol) + decimals.join('');
  2018. }
  2019. if (exponent) {
  2020. formattedText += getLocaleNumberSymbol(locale, NumberSymbol.Exponential) + '+' + exponent;
  2021. }
  2022. }
  2023. if (value < 0 && !isZero) {
  2024. formattedText = pattern.negPre + formattedText + pattern.negSuf;
  2025. }
  2026. else {
  2027. formattedText = pattern.posPre + formattedText + pattern.posSuf;
  2028. }
  2029. return formattedText;
  2030. }
  2031. /**
  2032. * @ngModule CommonModule
  2033. * @description
  2034. *
  2035. * Formats a number as currency using locale rules.
  2036. *
  2037. * Use `currency` to format a number as currency.
  2038. *
  2039. * Where:
  2040. * - `value` is a number.
  2041. * - `locale` is a `string` defining the locale to use.
  2042. * - `currency` is the string that represents the currency, it can be its symbol or its name.
  2043. * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
  2044. * as `USD` for the US dollar and `EUR` for the euro.
  2045. * - `digitInfo` See {@link DecimalPipe} for more details.
  2046. *
  2047. *
  2048. */
  2049. function formatCurrency(value, locale, currency, currencyCode, digitsInfo) {
  2050. var format = getLocaleNumberFormat(locale, NumberFormatStyle.Currency);
  2051. var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  2052. pattern.minFrac = getNumberOfCurrencyDigits(currencyCode);
  2053. pattern.maxFrac = pattern.minFrac;
  2054. var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.CurrencyGroup, NumberSymbol.CurrencyDecimal, digitsInfo);
  2055. return res
  2056. .replace(CURRENCY_CHAR, currency)
  2057. // if we have 2 time the currency character, the second one is ignored
  2058. .replace(CURRENCY_CHAR, '');
  2059. }
  2060. /**
  2061. * @ngModule CommonModule
  2062. * @description
  2063. *
  2064. * Formats a number as a percentage according to locale rules.
  2065. *
  2066. * Where:
  2067. * - `value` is a number.
  2068. * - `locale` is a `string` defining the locale to use.
  2069. * - `digitInfo` See {@link DecimalPipe} for more details.
  2070. *
  2071. *
  2072. */
  2073. function formatPercent(value, locale, digitsInfo) {
  2074. var format = getLocaleNumberFormat(locale, NumberFormatStyle.Percent);
  2075. var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  2076. var res = formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo, true);
  2077. return res.replace(new RegExp(PERCENT_CHAR, 'g'), getLocaleNumberSymbol(locale, NumberSymbol.PercentSign));
  2078. }
  2079. /**
  2080. * @ngModule CommonModule
  2081. * @description
  2082. *
  2083. * Formats a number as text. Group sizing and separator and other locale-specific
  2084. * configurations are based on the locale.
  2085. *
  2086. * Where:
  2087. * - `value` is a number.
  2088. * - `locale` is a `string` defining the locale to use.
  2089. * - `digitInfo` See {@link DecimalPipe} for more details.
  2090. *
  2091. *
  2092. */
  2093. function formatNumber(value, locale, digitsInfo) {
  2094. var format = getLocaleNumberFormat(locale, NumberFormatStyle.Decimal);
  2095. var pattern = parseNumberFormat(format, getLocaleNumberSymbol(locale, NumberSymbol.MinusSign));
  2096. return formatNumberToLocaleString(value, pattern, locale, NumberSymbol.Group, NumberSymbol.Decimal, digitsInfo);
  2097. }
  2098. function parseNumberFormat(format, minusSign) {
  2099. if (minusSign === void 0) { minusSign = '-'; }
  2100. var p = {
  2101. minInt: 1,
  2102. minFrac: 0,
  2103. maxFrac: 0,
  2104. posPre: '',
  2105. posSuf: '',
  2106. negPre: '',
  2107. negSuf: '',
  2108. gSize: 0,
  2109. lgSize: 0
  2110. };
  2111. var patternParts = format.split(PATTERN_SEP);
  2112. var positive = patternParts[0];
  2113. var negative = patternParts[1];
  2114. var positiveParts = positive.indexOf(DECIMAL_SEP) !== -1 ?
  2115. positive.split(DECIMAL_SEP) :
  2116. [
  2117. positive.substring(0, positive.lastIndexOf(ZERO_CHAR) + 1),
  2118. positive.substring(positive.lastIndexOf(ZERO_CHAR) + 1)
  2119. ], integer = positiveParts[0], fraction = positiveParts[1] || '';
  2120. p.posPre = integer.substr(0, integer.indexOf(DIGIT_CHAR));
  2121. for (var i = 0; i < fraction.length; i++) {
  2122. var ch = fraction.charAt(i);
  2123. if (ch === ZERO_CHAR) {
  2124. p.minFrac = p.maxFrac = i + 1;
  2125. }
  2126. else if (ch === DIGIT_CHAR) {
  2127. p.maxFrac = i + 1;
  2128. }
  2129. else {
  2130. p.posSuf += ch;
  2131. }
  2132. }
  2133. var groups = integer.split(GROUP_SEP);
  2134. p.gSize = groups[1] ? groups[1].length : 0;
  2135. p.lgSize = (groups[2] || groups[1]) ? (groups[2] || groups[1]).length : 0;
  2136. if (negative) {
  2137. var trunkLen = positive.length - p.posPre.length - p.posSuf.length, pos = negative.indexOf(DIGIT_CHAR);
  2138. p.negPre = negative.substr(0, pos).replace(/'/g, '');
  2139. p.negSuf = negative.substr(pos + trunkLen).replace(/'/g, '');
  2140. }
  2141. else {
  2142. p.negPre = minusSign + p.posPre;
  2143. p.negSuf = p.posSuf;
  2144. }
  2145. return p;
  2146. }
  2147. // Transforms a parsed number into a percentage by multiplying it by 100
  2148. function toPercent(parsedNumber) {
  2149. // if the number is 0, don't do anything
  2150. if (parsedNumber.digits[0] === 0) {
  2151. return parsedNumber;
  2152. }
  2153. // Getting the current number of decimals
  2154. var fractionLen = parsedNumber.digits.length - parsedNumber.integerLen;
  2155. if (parsedNumber.exponent) {
  2156. parsedNumber.exponent += 2;
  2157. }
  2158. else {
  2159. if (fractionLen === 0) {
  2160. parsedNumber.digits.push(0, 0);
  2161. }
  2162. else if (fractionLen === 1) {
  2163. parsedNumber.digits.push(0);
  2164. }
  2165. parsedNumber.integerLen += 2;
  2166. }
  2167. return parsedNumber;
  2168. }
  2169. /**
  2170. * Parses a number.
  2171. * Significant bits of this parse algorithm came from https://github.com/MikeMcl/big.js/
  2172. */
  2173. function parseNumber(num) {
  2174. var numStr = Math.abs(num) + '';
  2175. var exponent = 0, digits, integerLen;
  2176. var i, j, zeros;
  2177. // Decimal point?
  2178. if ((integerLen = numStr.indexOf(DECIMAL_SEP)) > -1) {
  2179. numStr = numStr.replace(DECIMAL_SEP, '');
  2180. }
  2181. // Exponential form?
  2182. if ((i = numStr.search(/e/i)) > 0) {
  2183. // Work out the exponent.
  2184. if (integerLen < 0)
  2185. integerLen = i;
  2186. integerLen += +numStr.slice(i + 1);
  2187. numStr = numStr.substring(0, i);
  2188. }
  2189. else if (integerLen < 0) {
  2190. // There was no decimal point or exponent so it is an integer.
  2191. integerLen = numStr.length;
  2192. }
  2193. // Count the number of leading zeros.
  2194. for (i = 0; numStr.charAt(i) === ZERO_CHAR; i++) { /* empty */
  2195. }
  2196. if (i === (zeros = numStr.length)) {
  2197. // The digits are all zero.
  2198. digits = [0];
  2199. integerLen = 1;
  2200. }
  2201. else {
  2202. // Count the number of trailing zeros
  2203. zeros--;
  2204. while (numStr.charAt(zeros) === ZERO_CHAR)
  2205. zeros--;
  2206. // Trailing zeros are insignificant so ignore them
  2207. integerLen -= i;
  2208. digits = [];
  2209. // Convert string to array of digits without leading/trailing zeros.
  2210. for (j = 0; i <= zeros; i++, j++) {
  2211. digits[j] = Number(numStr.charAt(i));
  2212. }
  2213. }
  2214. // If the number overflows the maximum allowed digits then use an exponent.
  2215. if (integerLen > MAX_DIGITS) {
  2216. digits = digits.splice(0, MAX_DIGITS - 1);
  2217. exponent = integerLen - 1;
  2218. integerLen = 1;
  2219. }
  2220. return { digits: digits, exponent: exponent, integerLen: integerLen };
  2221. }
  2222. /**
  2223. * Round the parsed number to the specified number of decimal places
  2224. * This function changes the parsedNumber in-place
  2225. */
  2226. function roundNumber(parsedNumber, minFrac, maxFrac) {
  2227. if (minFrac > maxFrac) {
  2228. throw new Error("The minimum number of digits after fraction (" + minFrac + ") is higher than the maximum (" + maxFrac + ").");
  2229. }
  2230. var digits = parsedNumber.digits;
  2231. var fractionLen = digits.length - parsedNumber.integerLen;
  2232. var fractionSize = Math.min(Math.max(minFrac, fractionLen), maxFrac);
  2233. // The index of the digit to where rounding is to occur
  2234. var roundAt = fractionSize + parsedNumber.integerLen;
  2235. var digit = digits[roundAt];
  2236. if (roundAt > 0) {
  2237. // Drop fractional digits beyond `roundAt`
  2238. digits.splice(Math.max(parsedNumber.integerLen, roundAt));
  2239. // Set non-fractional digits beyond `roundAt` to 0
  2240. for (var j = roundAt; j < digits.length; j++) {
  2241. digits[j] = 0;
  2242. }
  2243. }
  2244. else {
  2245. // We rounded to zero so reset the parsedNumber
  2246. fractionLen = Math.max(0, fractionLen);
  2247. parsedNumber.integerLen = 1;
  2248. digits.length = Math.max(1, roundAt = fractionSize + 1);
  2249. digits[0] = 0;
  2250. for (var i = 1; i < roundAt; i++)
  2251. digits[i] = 0;
  2252. }
  2253. if (digit >= 5) {
  2254. if (roundAt - 1 < 0) {
  2255. for (var k = 0; k > roundAt; k--) {
  2256. digits.unshift(0);
  2257. parsedNumber.integerLen++;
  2258. }
  2259. digits.unshift(1);
  2260. parsedNumber.integerLen++;
  2261. }
  2262. else {
  2263. digits[roundAt - 1]++;
  2264. }
  2265. }
  2266. // Pad out with zeros to get the required fraction length
  2267. for (; fractionLen < Math.max(0, fractionSize); fractionLen++)
  2268. digits.push(0);
  2269. var dropTrailingZeros = fractionSize !== 0;
  2270. // Minimal length = nb of decimals required + current nb of integers
  2271. // Any number besides that is optional and can be removed if it's a trailing 0
  2272. var minLen = minFrac + parsedNumber.integerLen;
  2273. // Do any carrying, e.g. a digit was rounded up to 10
  2274. var carry = digits.reduceRight(function (carry, d, i, digits) {
  2275. d = d + carry;
  2276. digits[i] = d < 10 ? d : d - 10; // d % 10
  2277. if (dropTrailingZeros) {
  2278. // Do not keep meaningless fractional trailing zeros (e.g. 15.52000 --> 15.52)
  2279. if (digits[i] === 0 && i >= minLen) {
  2280. digits.pop();
  2281. }
  2282. else {
  2283. dropTrailingZeros = false;
  2284. }
  2285. }
  2286. return d >= 10 ? 1 : 0; // Math.floor(d / 10);
  2287. }, 0);
  2288. if (carry) {
  2289. digits.unshift(carry);
  2290. parsedNumber.integerLen++;
  2291. }
  2292. }
  2293. function parseIntAutoRadix(text) {
  2294. var result = parseInt(text);
  2295. if (isNaN(result)) {
  2296. throw new Error('Invalid integer literal when parsing ' + text);
  2297. }
  2298. return result;
  2299. }
  2300. /**
  2301. * @license
  2302. * Copyright Google Inc. All Rights Reserved.
  2303. *
  2304. * Use of this source code is governed by an MIT-style license that can be
  2305. * found in the LICENSE file at https://angular.io/license
  2306. */
  2307. /**
  2308. * @deprecated from v5
  2309. */
  2310. var DEPRECATED_PLURAL_FN = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('UseV4Plurals');
  2311. /**
  2312. * @experimental
  2313. */
  2314. var NgLocalization = /** @class */ (function () {
  2315. function NgLocalization() {
  2316. }
  2317. return NgLocalization;
  2318. }());
  2319. /**
  2320. * Returns the plural category for a given value.
  2321. * - "=value" when the case exists,
  2322. * - the plural category otherwise
  2323. */
  2324. function getPluralCategory(value, cases, ngLocalization, locale) {
  2325. var key = "=" + value;
  2326. if (cases.indexOf(key) > -1) {
  2327. return key;
  2328. }
  2329. key = ngLocalization.getPluralCategory(value, locale);
  2330. if (cases.indexOf(key) > -1) {
  2331. return key;
  2332. }
  2333. if (cases.indexOf('other') > -1) {
  2334. return 'other';
  2335. }
  2336. throw new Error("No plural message found for value \"" + value + "\"");
  2337. }
  2338. /**
  2339. * Returns the plural case based on the locale
  2340. *
  2341. * @experimental
  2342. */
  2343. var NgLocaleLocalization = /** @class */ (function (_super) {
  2344. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__extends"])(NgLocaleLocalization, _super);
  2345. function NgLocaleLocalization(locale,
  2346. /** @deprecated from v5 */
  2347. deprecatedPluralFn) {
  2348. var _this = _super.call(this) || this;
  2349. _this.locale = locale;
  2350. _this.deprecatedPluralFn = deprecatedPluralFn;
  2351. return _this;
  2352. }
  2353. NgLocaleLocalization.prototype.getPluralCategory = function (value, locale) {
  2354. var plural = this.deprecatedPluralFn ? this.deprecatedPluralFn(locale || this.locale, value) :
  2355. getLocalePluralCase(locale || this.locale)(value);
  2356. switch (plural) {
  2357. case Plural.Zero:
  2358. return 'zero';
  2359. case Plural.One:
  2360. return 'one';
  2361. case Plural.Two:
  2362. return 'two';
  2363. case Plural.Few:
  2364. return 'few';
  2365. case Plural.Many:
  2366. return 'many';
  2367. default:
  2368. return 'other';
  2369. }
  2370. };
  2371. NgLocaleLocalization = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  2372. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Injectable"])(),
  2373. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  2374. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(DEPRECATED_PLURAL_FN)),
  2375. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String, Object])
  2376. ], NgLocaleLocalization);
  2377. return NgLocaleLocalization;
  2378. }(NgLocalization));
  2379. /**
  2380. * Returns the plural case based on the locale
  2381. *
  2382. * @deprecated from v5 the plural case function is in locale data files common/locales/*.ts
  2383. * @experimental
  2384. */
  2385. function getPluralCase(locale, nLike) {
  2386. // TODO(vicb): lazy compute
  2387. if (typeof nLike === 'string') {
  2388. nLike = parseInt(nLike, 10);
  2389. }
  2390. var n = nLike;
  2391. var nDecimal = n.toString().replace(/^[^.]*\.?/, '');
  2392. var i = Math.floor(Math.abs(n));
  2393. var v = nDecimal.length;
  2394. var f = parseInt(nDecimal, 10);
  2395. var t = parseInt(n.toString().replace(/^[^.]*\.?|0+$/g, ''), 10) || 0;
  2396. var lang = locale.split('-')[0].toLowerCase();
  2397. switch (lang) {
  2398. case 'af':
  2399. case 'asa':
  2400. case 'az':
  2401. case 'bem':
  2402. case 'bez':
  2403. case 'bg':
  2404. case 'brx':
  2405. case 'ce':
  2406. case 'cgg':
  2407. case 'chr':
  2408. case 'ckb':
  2409. case 'ee':
  2410. case 'el':
  2411. case 'eo':
  2412. case 'es':
  2413. case 'eu':
  2414. case 'fo':
  2415. case 'fur':
  2416. case 'gsw':
  2417. case 'ha':
  2418. case 'haw':
  2419. case 'hu':
  2420. case 'jgo':
  2421. case 'jmc':
  2422. case 'ka':
  2423. case 'kk':
  2424. case 'kkj':
  2425. case 'kl':
  2426. case 'ks':
  2427. case 'ksb':
  2428. case 'ky':
  2429. case 'lb':
  2430. case 'lg':
  2431. case 'mas':
  2432. case 'mgo':
  2433. case 'ml':
  2434. case 'mn':
  2435. case 'nb':
  2436. case 'nd':
  2437. case 'ne':
  2438. case 'nn':
  2439. case 'nnh':
  2440. case 'nyn':
  2441. case 'om':
  2442. case 'or':
  2443. case 'os':
  2444. case 'ps':
  2445. case 'rm':
  2446. case 'rof':
  2447. case 'rwk':
  2448. case 'saq':
  2449. case 'seh':
  2450. case 'sn':
  2451. case 'so':
  2452. case 'sq':
  2453. case 'ta':
  2454. case 'te':
  2455. case 'teo':
  2456. case 'tk':
  2457. case 'tr':
  2458. case 'ug':
  2459. case 'uz':
  2460. case 'vo':
  2461. case 'vun':
  2462. case 'wae':
  2463. case 'xog':
  2464. if (n === 1)
  2465. return Plural.One;
  2466. return Plural.Other;
  2467. case 'ak':
  2468. case 'ln':
  2469. case 'mg':
  2470. case 'pa':
  2471. case 'ti':
  2472. if (n === Math.floor(n) && n >= 0 && n <= 1)
  2473. return Plural.One;
  2474. return Plural.Other;
  2475. case 'am':
  2476. case 'as':
  2477. case 'bn':
  2478. case 'fa':
  2479. case 'gu':
  2480. case 'hi':
  2481. case 'kn':
  2482. case 'mr':
  2483. case 'zu':
  2484. if (i === 0 || n === 1)
  2485. return Plural.One;
  2486. return Plural.Other;
  2487. case 'ar':
  2488. if (n === 0)
  2489. return Plural.Zero;
  2490. if (n === 1)
  2491. return Plural.One;
  2492. if (n === 2)
  2493. return Plural.Two;
  2494. if (n % 100 === Math.floor(n % 100) && n % 100 >= 3 && n % 100 <= 10)
  2495. return Plural.Few;
  2496. if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 99)
  2497. return Plural.Many;
  2498. return Plural.Other;
  2499. case 'ast':
  2500. case 'ca':
  2501. case 'de':
  2502. case 'en':
  2503. case 'et':
  2504. case 'fi':
  2505. case 'fy':
  2506. case 'gl':
  2507. case 'it':
  2508. case 'nl':
  2509. case 'sv':
  2510. case 'sw':
  2511. case 'ur':
  2512. case 'yi':
  2513. if (i === 1 && v === 0)
  2514. return Plural.One;
  2515. return Plural.Other;
  2516. case 'be':
  2517. if (n % 10 === 1 && !(n % 100 === 11))
  2518. return Plural.One;
  2519. if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 4 &&
  2520. !(n % 100 >= 12 && n % 100 <= 14))
  2521. return Plural.Few;
  2522. if (n % 10 === 0 || n % 10 === Math.floor(n % 10) && n % 10 >= 5 && n % 10 <= 9 ||
  2523. n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 14)
  2524. return Plural.Many;
  2525. return Plural.Other;
  2526. case 'br':
  2527. if (n % 10 === 1 && !(n % 100 === 11 || n % 100 === 71 || n % 100 === 91))
  2528. return Plural.One;
  2529. if (n % 10 === 2 && !(n % 100 === 12 || n % 100 === 72 || n % 100 === 92))
  2530. return Plural.Two;
  2531. if (n % 10 === Math.floor(n % 10) && (n % 10 >= 3 && n % 10 <= 4 || n % 10 === 9) &&
  2532. !(n % 100 >= 10 && n % 100 <= 19 || n % 100 >= 70 && n % 100 <= 79 ||
  2533. n % 100 >= 90 && n % 100 <= 99))
  2534. return Plural.Few;
  2535. if (!(n === 0) && n % 1e6 === 0)
  2536. return Plural.Many;
  2537. return Plural.Other;
  2538. case 'bs':
  2539. case 'hr':
  2540. case 'sr':
  2541. if (v === 0 && i % 10 === 1 && !(i % 100 === 11) || f % 10 === 1 && !(f % 100 === 11))
  2542. return Plural.One;
  2543. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  2544. !(i % 100 >= 12 && i % 100 <= 14) ||
  2545. f % 10 === Math.floor(f % 10) && f % 10 >= 2 && f % 10 <= 4 &&
  2546. !(f % 100 >= 12 && f % 100 <= 14))
  2547. return Plural.Few;
  2548. return Plural.Other;
  2549. case 'cs':
  2550. case 'sk':
  2551. if (i === 1 && v === 0)
  2552. return Plural.One;
  2553. if (i === Math.floor(i) && i >= 2 && i <= 4 && v === 0)
  2554. return Plural.Few;
  2555. if (!(v === 0))
  2556. return Plural.Many;
  2557. return Plural.Other;
  2558. case 'cy':
  2559. if (n === 0)
  2560. return Plural.Zero;
  2561. if (n === 1)
  2562. return Plural.One;
  2563. if (n === 2)
  2564. return Plural.Two;
  2565. if (n === 3)
  2566. return Plural.Few;
  2567. if (n === 6)
  2568. return Plural.Many;
  2569. return Plural.Other;
  2570. case 'da':
  2571. if (n === 1 || !(t === 0) && (i === 0 || i === 1))
  2572. return Plural.One;
  2573. return Plural.Other;
  2574. case 'dsb':
  2575. case 'hsb':
  2576. if (v === 0 && i % 100 === 1 || f % 100 === 1)
  2577. return Plural.One;
  2578. if (v === 0 && i % 100 === 2 || f % 100 === 2)
  2579. return Plural.Two;
  2580. if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 ||
  2581. f % 100 === Math.floor(f % 100) && f % 100 >= 3 && f % 100 <= 4)
  2582. return Plural.Few;
  2583. return Plural.Other;
  2584. case 'ff':
  2585. case 'fr':
  2586. case 'hy':
  2587. case 'kab':
  2588. if (i === 0 || i === 1)
  2589. return Plural.One;
  2590. return Plural.Other;
  2591. case 'fil':
  2592. if (v === 0 && (i === 1 || i === 2 || i === 3) ||
  2593. v === 0 && !(i % 10 === 4 || i % 10 === 6 || i % 10 === 9) ||
  2594. !(v === 0) && !(f % 10 === 4 || f % 10 === 6 || f % 10 === 9))
  2595. return Plural.One;
  2596. return Plural.Other;
  2597. case 'ga':
  2598. if (n === 1)
  2599. return Plural.One;
  2600. if (n === 2)
  2601. return Plural.Two;
  2602. if (n === Math.floor(n) && n >= 3 && n <= 6)
  2603. return Plural.Few;
  2604. if (n === Math.floor(n) && n >= 7 && n <= 10)
  2605. return Plural.Many;
  2606. return Plural.Other;
  2607. case 'gd':
  2608. if (n === 1 || n === 11)
  2609. return Plural.One;
  2610. if (n === 2 || n === 12)
  2611. return Plural.Two;
  2612. if (n === Math.floor(n) && (n >= 3 && n <= 10 || n >= 13 && n <= 19))
  2613. return Plural.Few;
  2614. return Plural.Other;
  2615. case 'gv':
  2616. if (v === 0 && i % 10 === 1)
  2617. return Plural.One;
  2618. if (v === 0 && i % 10 === 2)
  2619. return Plural.Two;
  2620. if (v === 0 &&
  2621. (i % 100 === 0 || i % 100 === 20 || i % 100 === 40 || i % 100 === 60 || i % 100 === 80))
  2622. return Plural.Few;
  2623. if (!(v === 0))
  2624. return Plural.Many;
  2625. return Plural.Other;
  2626. case 'he':
  2627. if (i === 1 && v === 0)
  2628. return Plural.One;
  2629. if (i === 2 && v === 0)
  2630. return Plural.Two;
  2631. if (v === 0 && !(n >= 0 && n <= 10) && n % 10 === 0)
  2632. return Plural.Many;
  2633. return Plural.Other;
  2634. case 'is':
  2635. if (t === 0 && i % 10 === 1 && !(i % 100 === 11) || !(t === 0))
  2636. return Plural.One;
  2637. return Plural.Other;
  2638. case 'ksh':
  2639. if (n === 0)
  2640. return Plural.Zero;
  2641. if (n === 1)
  2642. return Plural.One;
  2643. return Plural.Other;
  2644. case 'kw':
  2645. case 'naq':
  2646. case 'se':
  2647. case 'smn':
  2648. if (n === 1)
  2649. return Plural.One;
  2650. if (n === 2)
  2651. return Plural.Two;
  2652. return Plural.Other;
  2653. case 'lag':
  2654. if (n === 0)
  2655. return Plural.Zero;
  2656. if ((i === 0 || i === 1) && !(n === 0))
  2657. return Plural.One;
  2658. return Plural.Other;
  2659. case 'lt':
  2660. if (n % 10 === 1 && !(n % 100 >= 11 && n % 100 <= 19))
  2661. return Plural.One;
  2662. if (n % 10 === Math.floor(n % 10) && n % 10 >= 2 && n % 10 <= 9 &&
  2663. !(n % 100 >= 11 && n % 100 <= 19))
  2664. return Plural.Few;
  2665. if (!(f === 0))
  2666. return Plural.Many;
  2667. return Plural.Other;
  2668. case 'lv':
  2669. case 'prg':
  2670. if (n % 10 === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19 ||
  2671. v === 2 && f % 100 === Math.floor(f % 100) && f % 100 >= 11 && f % 100 <= 19)
  2672. return Plural.Zero;
  2673. if (n % 10 === 1 && !(n % 100 === 11) || v === 2 && f % 10 === 1 && !(f % 100 === 11) ||
  2674. !(v === 2) && f % 10 === 1)
  2675. return Plural.One;
  2676. return Plural.Other;
  2677. case 'mk':
  2678. if (v === 0 && i % 10 === 1 || f % 10 === 1)
  2679. return Plural.One;
  2680. return Plural.Other;
  2681. case 'mt':
  2682. if (n === 1)
  2683. return Plural.One;
  2684. if (n === 0 || n % 100 === Math.floor(n % 100) && n % 100 >= 2 && n % 100 <= 10)
  2685. return Plural.Few;
  2686. if (n % 100 === Math.floor(n % 100) && n % 100 >= 11 && n % 100 <= 19)
  2687. return Plural.Many;
  2688. return Plural.Other;
  2689. case 'pl':
  2690. if (i === 1 && v === 0)
  2691. return Plural.One;
  2692. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  2693. !(i % 100 >= 12 && i % 100 <= 14))
  2694. return Plural.Few;
  2695. if (v === 0 && !(i === 1) && i % 10 === Math.floor(i % 10) && i % 10 >= 0 && i % 10 <= 1 ||
  2696. v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
  2697. v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 12 && i % 100 <= 14)
  2698. return Plural.Many;
  2699. return Plural.Other;
  2700. case 'pt':
  2701. if (n === Math.floor(n) && n >= 0 && n <= 2 && !(n === 2))
  2702. return Plural.One;
  2703. return Plural.Other;
  2704. case 'ro':
  2705. if (i === 1 && v === 0)
  2706. return Plural.One;
  2707. if (!(v === 0) || n === 0 ||
  2708. !(n === 1) && n % 100 === Math.floor(n % 100) && n % 100 >= 1 && n % 100 <= 19)
  2709. return Plural.Few;
  2710. return Plural.Other;
  2711. case 'ru':
  2712. case 'uk':
  2713. if (v === 0 && i % 10 === 1 && !(i % 100 === 11))
  2714. return Plural.One;
  2715. if (v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 2 && i % 10 <= 4 &&
  2716. !(i % 100 >= 12 && i % 100 <= 14))
  2717. return Plural.Few;
  2718. if (v === 0 && i % 10 === 0 ||
  2719. v === 0 && i % 10 === Math.floor(i % 10) && i % 10 >= 5 && i % 10 <= 9 ||
  2720. v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 11 && i % 100 <= 14)
  2721. return Plural.Many;
  2722. return Plural.Other;
  2723. case 'shi':
  2724. if (i === 0 || n === 1)
  2725. return Plural.One;
  2726. if (n === Math.floor(n) && n >= 2 && n <= 10)
  2727. return Plural.Few;
  2728. return Plural.Other;
  2729. case 'si':
  2730. if (n === 0 || n === 1 || i === 0 && f === 1)
  2731. return Plural.One;
  2732. return Plural.Other;
  2733. case 'sl':
  2734. if (v === 0 && i % 100 === 1)
  2735. return Plural.One;
  2736. if (v === 0 && i % 100 === 2)
  2737. return Plural.Two;
  2738. if (v === 0 && i % 100 === Math.floor(i % 100) && i % 100 >= 3 && i % 100 <= 4 || !(v === 0))
  2739. return Plural.Few;
  2740. return Plural.Other;
  2741. case 'tzm':
  2742. if (n === Math.floor(n) && n >= 0 && n <= 1 || n === Math.floor(n) && n >= 11 && n <= 99)
  2743. return Plural.One;
  2744. return Plural.Other;
  2745. // When there is no specification, the default is always "other"
  2746. // Spec: http://cldr.unicode.org/index/cldr-spec/plural-rules
  2747. // > other (required—general plural form — also used if the language only has a single form)
  2748. default:
  2749. return Plural.Other;
  2750. }
  2751. }
  2752. /**
  2753. * @license
  2754. * Copyright Google Inc. All Rights Reserved.
  2755. *
  2756. * Use of this source code is governed by an MIT-style license that can be
  2757. * found in the LICENSE file at https://angular.io/license
  2758. */
  2759. function parseCookieValue(cookieStr, name) {
  2760. var e_1, _a;
  2761. name = encodeURIComponent(name);
  2762. try {
  2763. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(cookieStr.split(';')), _c = _b.next(); !_c.done; _c = _b.next()) {
  2764. var cookie = _c.value;
  2765. var eqIndex = cookie.indexOf('=');
  2766. var _d = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(eqIndex == -1 ? [cookie, ''] : [cookie.slice(0, eqIndex), cookie.slice(eqIndex + 1)], 2), cookieName = _d[0], cookieValue = _d[1];
  2767. if (cookieName.trim() === name) {
  2768. return decodeURIComponent(cookieValue);
  2769. }
  2770. }
  2771. }
  2772. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  2773. finally {
  2774. try {
  2775. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  2776. }
  2777. finally { if (e_1) throw e_1.error; }
  2778. }
  2779. return null;
  2780. }
  2781. /**
  2782. * @license
  2783. * Copyright Google Inc. All Rights Reserved.
  2784. *
  2785. * Use of this source code is governed by an MIT-style license that can be
  2786. * found in the LICENSE file at https://angular.io/license
  2787. */
  2788. /**
  2789. * @ngModule CommonModule
  2790. *
  2791. * @usageNotes
  2792. * ```
  2793. * <some-element [ngClass]="'first second'">...</some-element>
  2794. *
  2795. * <some-element [ngClass]="['first', 'second']">...</some-element>
  2796. *
  2797. * <some-element [ngClass]="{'first': true, 'second': true, 'third': false}">...</some-element>
  2798. *
  2799. * <some-element [ngClass]="stringExp|arrayExp|objExp">...</some-element>
  2800. *
  2801. * <some-element [ngClass]="{'class1 class2 class3' : true}">...</some-element>
  2802. * ```
  2803. *
  2804. * @description
  2805. *
  2806. * Adds and removes CSS classes on an HTML element.
  2807. *
  2808. * The CSS classes are updated as follows, depending on the type of the expression evaluation:
  2809. * - `string` - the CSS classes listed in the string (space delimited) are added,
  2810. * - `Array` - the CSS classes declared as Array elements are added,
  2811. * - `Object` - keys are CSS classes that get added when the expression given in the value
  2812. * evaluates to a truthy value, otherwise they are removed.
  2813. *
  2814. *
  2815. */
  2816. var NgClass = /** @class */ (function () {
  2817. function NgClass(_iterableDiffers, _keyValueDiffers, _ngEl, _renderer) {
  2818. this._iterableDiffers = _iterableDiffers;
  2819. this._keyValueDiffers = _keyValueDiffers;
  2820. this._ngEl = _ngEl;
  2821. this._renderer = _renderer;
  2822. this._initialClasses = [];
  2823. }
  2824. Object.defineProperty(NgClass.prototype, "klass", {
  2825. set: function (value) {
  2826. this._removeClasses(this._initialClasses);
  2827. this._initialClasses = typeof value === 'string' ? value.split(/\s+/) : [];
  2828. this._applyClasses(this._initialClasses);
  2829. this._applyClasses(this._rawClass);
  2830. },
  2831. enumerable: true,
  2832. configurable: true
  2833. });
  2834. Object.defineProperty(NgClass.prototype, "ngClass", {
  2835. set: function (value) {
  2836. this._removeClasses(this._rawClass);
  2837. this._applyClasses(this._initialClasses);
  2838. this._iterableDiffer = null;
  2839. this._keyValueDiffer = null;
  2840. this._rawClass = typeof value === 'string' ? value.split(/\s+/) : value;
  2841. if (this._rawClass) {
  2842. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisListLikeIterable"])(this._rawClass)) {
  2843. this._iterableDiffer = this._iterableDiffers.find(this._rawClass).create();
  2844. }
  2845. else {
  2846. this._keyValueDiffer = this._keyValueDiffers.find(this._rawClass).create();
  2847. }
  2848. }
  2849. },
  2850. enumerable: true,
  2851. configurable: true
  2852. });
  2853. NgClass.prototype.ngDoCheck = function () {
  2854. if (this._iterableDiffer) {
  2855. var iterableChanges = this._iterableDiffer.diff(this._rawClass);
  2856. if (iterableChanges) {
  2857. this._applyIterableChanges(iterableChanges);
  2858. }
  2859. }
  2860. else if (this._keyValueDiffer) {
  2861. var keyValueChanges = this._keyValueDiffer.diff(this._rawClass);
  2862. if (keyValueChanges) {
  2863. this._applyKeyValueChanges(keyValueChanges);
  2864. }
  2865. }
  2866. };
  2867. NgClass.prototype._applyKeyValueChanges = function (changes) {
  2868. var _this = this;
  2869. changes.forEachAddedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
  2870. changes.forEachChangedItem(function (record) { return _this._toggleClass(record.key, record.currentValue); });
  2871. changes.forEachRemovedItem(function (record) {
  2872. if (record.previousValue) {
  2873. _this._toggleClass(record.key, false);
  2874. }
  2875. });
  2876. };
  2877. NgClass.prototype._applyIterableChanges = function (changes) {
  2878. var _this = this;
  2879. changes.forEachAddedItem(function (record) {
  2880. if (typeof record.item === 'string') {
  2881. _this._toggleClass(record.item, true);
  2882. }
  2883. else {
  2884. throw new Error("NgClass can only toggle CSS classes expressed as strings, got " + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(record.item));
  2885. }
  2886. });
  2887. changes.forEachRemovedItem(function (record) { return _this._toggleClass(record.item, false); });
  2888. };
  2889. /**
  2890. * Applies a collection of CSS classes to the DOM element.
  2891. *
  2892. * For argument of type Set and Array CSS class names contained in those collections are always
  2893. * added.
  2894. * For argument of type Map CSS class name in the map's key is toggled based on the value (added
  2895. * for truthy and removed for falsy).
  2896. */
  2897. NgClass.prototype._applyClasses = function (rawClassVal) {
  2898. var _this = this;
  2899. if (rawClassVal) {
  2900. if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
  2901. rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, true); });
  2902. }
  2903. else {
  2904. Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, !!rawClassVal[klass]); });
  2905. }
  2906. }
  2907. };
  2908. /**
  2909. * Removes a collection of CSS classes from the DOM element. This is mostly useful for cleanup
  2910. * purposes.
  2911. */
  2912. NgClass.prototype._removeClasses = function (rawClassVal) {
  2913. var _this = this;
  2914. if (rawClassVal) {
  2915. if (Array.isArray(rawClassVal) || rawClassVal instanceof Set) {
  2916. rawClassVal.forEach(function (klass) { return _this._toggleClass(klass, false); });
  2917. }
  2918. else {
  2919. Object.keys(rawClassVal).forEach(function (klass) { return _this._toggleClass(klass, false); });
  2920. }
  2921. }
  2922. };
  2923. NgClass.prototype._toggleClass = function (klass, enabled) {
  2924. var _this = this;
  2925. klass = klass.trim();
  2926. if (klass) {
  2927. klass.split(/\s+/g).forEach(function (klass) {
  2928. if (enabled) {
  2929. _this._renderer.addClass(_this._ngEl.nativeElement, klass);
  2930. }
  2931. else {
  2932. _this._renderer.removeClass(_this._ngEl.nativeElement, klass);
  2933. }
  2934. });
  2935. }
  2936. };
  2937. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  2938. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])('class'),
  2939. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", String),
  2940. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  2941. ], NgClass.prototype, "klass", null);
  2942. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  2943. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  2944. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  2945. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  2946. ], NgClass.prototype, "ngClass", null);
  2947. NgClass = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  2948. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngClass]' }),
  2949. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"],
  2950. _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"]])
  2951. ], NgClass);
  2952. return NgClass;
  2953. }());
  2954. /**
  2955. * @license
  2956. * Copyright Google Inc. All Rights Reserved.
  2957. *
  2958. * Use of this source code is governed by an MIT-style license that can be
  2959. * found in the LICENSE file at https://angular.io/license
  2960. */
  2961. /**
  2962. * Instantiates a single {@link Component} type and inserts its Host View into current View.
  2963. * `NgComponentOutlet` provides a declarative approach for dynamic component creation.
  2964. *
  2965. * `NgComponentOutlet` requires a component type, if a falsy value is set the view will clear and
  2966. * any existing component will get destroyed.
  2967. *
  2968. * @usageNotes
  2969. *
  2970. * ### Fine tune control
  2971. *
  2972. * You can control the component creation process by using the following optional attributes:
  2973. *
  2974. * * `ngComponentOutletInjector`: Optional custom {@link Injector} that will be used as parent for
  2975. * the Component. Defaults to the injector of the current view container.
  2976. *
  2977. * * `ngComponentOutletContent`: Optional list of projectable nodes to insert into the content
  2978. * section of the component, if exists.
  2979. *
  2980. * * `ngComponentOutletNgModuleFactory`: Optional module factory to allow dynamically loading other
  2981. * module, then load a component from that module.
  2982. *
  2983. * ### Syntax
  2984. *
  2985. * Simple
  2986. * ```
  2987. * <ng-container *ngComponentOutlet="componentTypeExpression"></ng-container>
  2988. * ```
  2989. *
  2990. * Customized injector/content
  2991. * ```
  2992. * <ng-container *ngComponentOutlet="componentTypeExpression;
  2993. * injector: injectorExpression;
  2994. * content: contentNodesExpression;">
  2995. * </ng-container>
  2996. * ```
  2997. *
  2998. * Customized ngModuleFactory
  2999. * ```
  3000. * <ng-container *ngComponentOutlet="componentTypeExpression;
  3001. * ngModuleFactory: moduleFactory;">
  3002. * </ng-container>
  3003. * ```
  3004. *
  3005. * ### A simple example
  3006. *
  3007. * {@example common/ngComponentOutlet/ts/module.ts region='SimpleExample'}
  3008. *
  3009. * A more complete example with additional options:
  3010. *
  3011. * {@example common/ngComponentOutlet/ts/module.ts region='CompleteExample'}
  3012. * A more complete example with ngModuleFactory:
  3013. *
  3014. * {@example common/ngComponentOutlet/ts/module.ts region='NgModuleFactoryExample'}
  3015. *
  3016. * @experimental
  3017. * @ngModule CommonModule
  3018. */
  3019. var NgComponentOutlet = /** @class */ (function () {
  3020. function NgComponentOutlet(_viewContainerRef) {
  3021. this._viewContainerRef = _viewContainerRef;
  3022. this._componentRef = null;
  3023. this._moduleRef = null;
  3024. }
  3025. NgComponentOutlet.prototype.ngOnChanges = function (changes) {
  3026. this._viewContainerRef.clear();
  3027. this._componentRef = null;
  3028. if (this.ngComponentOutlet) {
  3029. var elInjector = this.ngComponentOutletInjector || this._viewContainerRef.parentInjector;
  3030. if (changes['ngComponentOutletNgModuleFactory']) {
  3031. if (this._moduleRef)
  3032. this._moduleRef.destroy();
  3033. if (this.ngComponentOutletNgModuleFactory) {
  3034. var parentModule = elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModuleRef"]);
  3035. this._moduleRef = this.ngComponentOutletNgModuleFactory.create(parentModule.injector);
  3036. }
  3037. else {
  3038. this._moduleRef = null;
  3039. }
  3040. }
  3041. var componentFactoryResolver = this._moduleRef ? this._moduleRef.componentFactoryResolver :
  3042. elInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ComponentFactoryResolver"]);
  3043. var componentFactory = componentFactoryResolver.resolveComponentFactory(this.ngComponentOutlet);
  3044. this._componentRef = this._viewContainerRef.createComponent(componentFactory, this._viewContainerRef.length, elInjector, this.ngComponentOutletContent);
  3045. }
  3046. };
  3047. NgComponentOutlet.prototype.ngOnDestroy = function () {
  3048. if (this._moduleRef)
  3049. this._moduleRef.destroy();
  3050. };
  3051. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3052. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3053. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["Type"])
  3054. ], NgComponentOutlet.prototype, "ngComponentOutlet", void 0);
  3055. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3056. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3057. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["Injector"])
  3058. ], NgComponentOutlet.prototype, "ngComponentOutletInjector", void 0);
  3059. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3060. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3061. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Array)
  3062. ], NgComponentOutlet.prototype, "ngComponentOutletContent", void 0);
  3063. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3064. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3065. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModuleFactory"])
  3066. ], NgComponentOutlet.prototype, "ngComponentOutletNgModuleFactory", void 0);
  3067. NgComponentOutlet = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3068. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngComponentOutlet]' }),
  3069. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]])
  3070. ], NgComponentOutlet);
  3071. return NgComponentOutlet;
  3072. }());
  3073. /**
  3074. * @license
  3075. * Copyright Google Inc. All Rights Reserved.
  3076. *
  3077. * Use of this source code is governed by an MIT-style license that can be
  3078. * found in the LICENSE file at https://angular.io/license
  3079. */
  3080. var NgForOfContext = /** @class */ (function () {
  3081. function NgForOfContext($implicit, ngForOf, index, count) {
  3082. this.$implicit = $implicit;
  3083. this.ngForOf = ngForOf;
  3084. this.index = index;
  3085. this.count = count;
  3086. }
  3087. Object.defineProperty(NgForOfContext.prototype, "first", {
  3088. get: function () { return this.index === 0; },
  3089. enumerable: true,
  3090. configurable: true
  3091. });
  3092. Object.defineProperty(NgForOfContext.prototype, "last", {
  3093. get: function () { return this.index === this.count - 1; },
  3094. enumerable: true,
  3095. configurable: true
  3096. });
  3097. Object.defineProperty(NgForOfContext.prototype, "even", {
  3098. get: function () { return this.index % 2 === 0; },
  3099. enumerable: true,
  3100. configurable: true
  3101. });
  3102. Object.defineProperty(NgForOfContext.prototype, "odd", {
  3103. get: function () { return !this.even; },
  3104. enumerable: true,
  3105. configurable: true
  3106. });
  3107. return NgForOfContext;
  3108. }());
  3109. /**
  3110. * The `NgForOf` directive instantiates a template once per item from an iterable. The context
  3111. * for each instantiated template inherits from the outer context with the given loop variable
  3112. * set to the current item from the iterable.
  3113. *
  3114. * @usageNotes
  3115. *
  3116. * ### Local Variables
  3117. *
  3118. * `NgForOf` provides several exported values that can be aliased to local variables:
  3119. *
  3120. * - `$implicit: T`: The value of the individual items in the iterable (`ngForOf`).
  3121. * - `ngForOf: NgIterable<T>`: The value of the iterable expression. Useful when the expression is
  3122. * more complex then a property access, for example when using the async pipe (`userStreams |
  3123. * async`).
  3124. * - `index: number`: The index of the current item in the iterable.
  3125. * - `first: boolean`: True when the item is the first item in the iterable.
  3126. * - `last: boolean`: True when the item is the last item in the iterable.
  3127. * - `even: boolean`: True when the item has an even index in the iterable.
  3128. * - `odd: boolean`: True when the item has an odd index in the iterable.
  3129. *
  3130. * ```
  3131. * <li *ngFor="let user of userObservable | async as users; index as i; first as isFirst">
  3132. * {{i}}/{{users.length}}. {{user}} <span *ngIf="isFirst">default</span>
  3133. * </li>
  3134. * ```
  3135. *
  3136. * ### Change Propagation
  3137. *
  3138. * When the contents of the iterator changes, `NgForOf` makes the corresponding changes to the DOM:
  3139. *
  3140. * * When an item is added, a new instance of the template is added to the DOM.
  3141. * * When an item is removed, its template instance is removed from the DOM.
  3142. * * When items are reordered, their respective templates are reordered in the DOM.
  3143. * * Otherwise, the DOM element for that item will remain the same.
  3144. *
  3145. * Angular uses object identity to track insertions and deletions within the iterator and reproduce
  3146. * those changes in the DOM. This has important implications for animations and any stateful
  3147. * controls (such as `<input>` elements which accept user input) that are present. Inserted rows can
  3148. * be animated in, deleted rows can be animated out, and unchanged rows retain any unsaved state
  3149. * such as user input.
  3150. *
  3151. * It is possible for the identities of elements in the iterator to change while the data does not.
  3152. * This can happen, for example, if the iterator produced from an RPC to the server, and that
  3153. * RPC is re-run. Even if the data hasn't changed, the second response will produce objects with
  3154. * different identities, and Angular will tear down the entire DOM and rebuild it (as if all old
  3155. * elements were deleted and all new elements inserted). This is an expensive operation and should
  3156. * be avoided if possible.
  3157. *
  3158. * To customize the default tracking algorithm, `NgForOf` supports `trackBy` option.
  3159. * `trackBy` takes a function which has two arguments: `index` and `item`.
  3160. * If `trackBy` is given, Angular tracks changes by the return value of the function.
  3161. *
  3162. * ### Syntax
  3163. *
  3164. * - `<li *ngFor="let item of items; index as i; trackBy: trackByFn">...</li>`
  3165. *
  3166. * With `<ng-template>` element:
  3167. *
  3168. * ```
  3169. * <ng-template ngFor let-item [ngForOf]="items" let-i="index" [ngForTrackBy]="trackByFn">
  3170. * <li>...</li>
  3171. * </ng-template>
  3172. * ```
  3173. *
  3174. * ### Example
  3175. *
  3176. * See a [live demo](http://plnkr.co/edit/KVuXxDp0qinGDyo307QW?p=preview) for a more detailed
  3177. * example.
  3178. *
  3179. * @ngModule CommonModule
  3180. */
  3181. var NgForOf = /** @class */ (function () {
  3182. function NgForOf(_viewContainer, _template, _differs) {
  3183. this._viewContainer = _viewContainer;
  3184. this._template = _template;
  3185. this._differs = _differs;
  3186. this._ngForOfDirty = true;
  3187. this._differ = null;
  3188. }
  3189. Object.defineProperty(NgForOf.prototype, "ngForOf", {
  3190. set: function (ngForOf) {
  3191. this._ngForOf = ngForOf;
  3192. this._ngForOfDirty = true;
  3193. },
  3194. enumerable: true,
  3195. configurable: true
  3196. });
  3197. Object.defineProperty(NgForOf.prototype, "ngForTrackBy", {
  3198. get: function () { return this._trackByFn; },
  3199. set: function (fn) {
  3200. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["isDevMode"])() && fn != null && typeof fn !== 'function') {
  3201. // TODO(vicb): use a log service once there is a public one available
  3202. if (console && console.warn) {
  3203. console.warn("trackBy must be a function, but received " + JSON.stringify(fn) + ". " +
  3204. "See https://angular.io/docs/ts/latest/api/common/index/NgFor-directive.html#!#change-propagation for more information.");
  3205. }
  3206. }
  3207. this._trackByFn = fn;
  3208. },
  3209. enumerable: true,
  3210. configurable: true
  3211. });
  3212. Object.defineProperty(NgForOf.prototype, "ngForTemplate", {
  3213. set: function (value) {
  3214. // TODO(TS2.1): make TemplateRef<Partial<NgForRowOf<T>>> once we move to TS v2.1
  3215. // The current type is too restrictive; a template that just uses index, for example,
  3216. // should be acceptable.
  3217. if (value) {
  3218. this._template = value;
  3219. }
  3220. },
  3221. enumerable: true,
  3222. configurable: true
  3223. });
  3224. NgForOf.prototype.ngDoCheck = function () {
  3225. if (this._ngForOfDirty) {
  3226. this._ngForOfDirty = false;
  3227. // React on ngForOf changes only once all inputs have been initialized
  3228. var value = this._ngForOf;
  3229. if (!this._differ && value) {
  3230. try {
  3231. this._differ = this._differs.find(value).create(this.ngForTrackBy);
  3232. }
  3233. catch (e) {
  3234. throw new Error("Cannot find a differ supporting object '" + value + "' of type '" + getTypeNameForDebugging(value) + "'. NgFor only supports binding to Iterables such as Arrays.");
  3235. }
  3236. }
  3237. }
  3238. if (this._differ) {
  3239. var changes = this._differ.diff(this._ngForOf);
  3240. if (changes)
  3241. this._applyChanges(changes);
  3242. }
  3243. };
  3244. NgForOf.prototype._applyChanges = function (changes) {
  3245. var _this = this;
  3246. var insertTuples = [];
  3247. changes.forEachOperation(function (item, adjustedPreviousIndex, currentIndex) {
  3248. if (item.previousIndex == null) {
  3249. var view = _this._viewContainer.createEmbeddedView(_this._template, new NgForOfContext(null, _this._ngForOf, -1, -1), currentIndex);
  3250. var tuple = new RecordViewTuple(item, view);
  3251. insertTuples.push(tuple);
  3252. }
  3253. else if (currentIndex == null) {
  3254. _this._viewContainer.remove(adjustedPreviousIndex);
  3255. }
  3256. else {
  3257. var view = _this._viewContainer.get(adjustedPreviousIndex);
  3258. _this._viewContainer.move(view, currentIndex);
  3259. var tuple = new RecordViewTuple(item, view);
  3260. insertTuples.push(tuple);
  3261. }
  3262. });
  3263. for (var i = 0; i < insertTuples.length; i++) {
  3264. this._perViewChange(insertTuples[i].view, insertTuples[i].record);
  3265. }
  3266. for (var i = 0, ilen = this._viewContainer.length; i < ilen; i++) {
  3267. var viewRef = this._viewContainer.get(i);
  3268. viewRef.context.index = i;
  3269. viewRef.context.count = ilen;
  3270. viewRef.context.ngForOf = this._ngForOf;
  3271. }
  3272. changes.forEachIdentityChange(function (record) {
  3273. var viewRef = _this._viewContainer.get(record.currentIndex);
  3274. viewRef.context.$implicit = record.item;
  3275. });
  3276. };
  3277. NgForOf.prototype._perViewChange = function (view, record) {
  3278. view.context.$implicit = record.item;
  3279. };
  3280. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3281. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3282. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  3283. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  3284. ], NgForOf.prototype, "ngForOf", null);
  3285. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3286. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3287. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Function),
  3288. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Function])
  3289. ], NgForOf.prototype, "ngForTrackBy", null);
  3290. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3291. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3292. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]),
  3293. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]])
  3294. ], NgForOf.prototype, "ngForTemplate", null);
  3295. NgForOf = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3296. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngFor][ngForOf]' }),
  3297. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"],
  3298. _angular_core__WEBPACK_IMPORTED_MODULE_0__["IterableDiffers"]])
  3299. ], NgForOf);
  3300. return NgForOf;
  3301. }());
  3302. var RecordViewTuple = /** @class */ (function () {
  3303. function RecordViewTuple(record, view) {
  3304. this.record = record;
  3305. this.view = view;
  3306. }
  3307. return RecordViewTuple;
  3308. }());
  3309. function getTypeNameForDebugging(type) {
  3310. return type['name'] || typeof type;
  3311. }
  3312. /**
  3313. * @license
  3314. * Copyright Google Inc. All Rights Reserved.
  3315. *
  3316. * Use of this source code is governed by an MIT-style license that can be
  3317. * found in the LICENSE file at https://angular.io/license
  3318. */
  3319. /**
  3320. * Conditionally includes a template based on the value of an `expression`.
  3321. *
  3322. * `ngIf` evaluates the `expression` and then renders the `then` or `else` template in its place
  3323. * when expression is truthy or falsy respectively. Typically the:
  3324. * - `then` template is the inline template of `ngIf` unless bound to a different value.
  3325. * - `else` template is blank unless it is bound.
  3326. *
  3327. *
  3328. * @usageNotes
  3329. *
  3330. * ### Most common usage
  3331. *
  3332. * The most common usage of the `ngIf` directive is to conditionally show the inline template as
  3333. * seen in this example:
  3334. * {@example common/ngIf/ts/module.ts region='NgIfSimple'}
  3335. *
  3336. * ### Showing an alternative template using `else`
  3337. *
  3338. * If it is necessary to display a template when the `expression` is falsy use the `else` template
  3339. * binding as shown. Note that the `else` binding points to a `<ng-template>` labeled `#elseBlock`.
  3340. * The template can be defined anywhere in the component view but is typically placed right after
  3341. * `ngIf` for readability.
  3342. *
  3343. * {@example common/ngIf/ts/module.ts region='NgIfElse'}
  3344. *
  3345. * ### Using non-inlined `then` template
  3346. *
  3347. * Usually the `then` template is the inlined template of the `ngIf`, but it can be changed using
  3348. * a binding (just like `else`). Because `then` and `else` are bindings, the template references can
  3349. * change at runtime as shown in this example.
  3350. *
  3351. * {@example common/ngIf/ts/module.ts region='NgIfThenElse'}
  3352. *
  3353. * ### Storing conditional result in a variable
  3354. *
  3355. * A common pattern is that we need to show a set of properties from the same object. If the
  3356. * object is undefined, then we have to use the safe-traversal-operator `?.` to guard against
  3357. * dereferencing a `null` value. This is especially the case when waiting on async data such as
  3358. * when using the `async` pipe as shown in following example:
  3359. *
  3360. * ```
  3361. * Hello {{ (userStream|async)?.last }}, {{ (userStream|async)?.first }}!
  3362. * ```
  3363. *
  3364. * There are several inefficiencies in the above example:
  3365. * - We create multiple subscriptions on `userStream`. One for each `async` pipe, or two in the
  3366. * example above.
  3367. * - We cannot display an alternative screen while waiting for the data to arrive asynchronously.
  3368. * - We have to use the safe-traversal-operator `?.` to access properties, which is cumbersome.
  3369. * - We have to place the `async` pipe in parenthesis.
  3370. *
  3371. * A better way to do this is to use `ngIf` and store the result of the condition in a local
  3372. * variable as shown in the the example below:
  3373. *
  3374. * {@example common/ngIf/ts/module.ts region='NgIfAs'}
  3375. *
  3376. * Notice that:
  3377. * - We use only one `async` pipe and hence only one subscription gets created.
  3378. * - `ngIf` stores the result of the `userStream|async` in the local variable `user`.
  3379. * - The local `user` can then be bound repeatedly in a more efficient way.
  3380. * - No need to use the safe-traversal-operator `?.` to access properties as `ngIf` will only
  3381. * display the data if `userStream` returns a value.
  3382. * - We can display an alternative template while waiting for the data.
  3383. *
  3384. * ### Syntax
  3385. *
  3386. * Simple form:
  3387. * - `<div *ngIf="condition">...</div>`
  3388. * - `<ng-template [ngIf]="condition"><div>...</div></ng-template>`
  3389. *
  3390. * Form with an else block:
  3391. * ```
  3392. * <div *ngIf="condition; else elseBlock">...</div>
  3393. * <ng-template #elseBlock>...</ng-template>
  3394. * ```
  3395. *
  3396. * Form with a `then` and `else` block:
  3397. * ```
  3398. * <div *ngIf="condition; then thenBlock else elseBlock"></div>
  3399. * <ng-template #thenBlock>...</ng-template>
  3400. * <ng-template #elseBlock>...</ng-template>
  3401. * ```
  3402. *
  3403. * Form with storing the value locally:
  3404. * ```
  3405. * <div *ngIf="condition as value; else elseBlock">{{value}}</div>
  3406. * <ng-template #elseBlock>...</ng-template>
  3407. * ```
  3408. *
  3409. * @ngModule CommonModule
  3410. */
  3411. var NgIf = /** @class */ (function () {
  3412. function NgIf(_viewContainer, templateRef) {
  3413. this._viewContainer = _viewContainer;
  3414. this._context = new NgIfContext();
  3415. this._thenTemplateRef = null;
  3416. this._elseTemplateRef = null;
  3417. this._thenViewRef = null;
  3418. this._elseViewRef = null;
  3419. this._thenTemplateRef = templateRef;
  3420. }
  3421. Object.defineProperty(NgIf.prototype, "ngIf", {
  3422. set: function (condition) {
  3423. this._context.$implicit = this._context.ngIf = condition;
  3424. this._updateView();
  3425. },
  3426. enumerable: true,
  3427. configurable: true
  3428. });
  3429. Object.defineProperty(NgIf.prototype, "ngIfThen", {
  3430. set: function (templateRef) {
  3431. assertTemplate('ngIfThen', templateRef);
  3432. this._thenTemplateRef = templateRef;
  3433. this._thenViewRef = null; // clear previous view if any.
  3434. this._updateView();
  3435. },
  3436. enumerable: true,
  3437. configurable: true
  3438. });
  3439. Object.defineProperty(NgIf.prototype, "ngIfElse", {
  3440. set: function (templateRef) {
  3441. assertTemplate('ngIfElse', templateRef);
  3442. this._elseTemplateRef = templateRef;
  3443. this._elseViewRef = null; // clear previous view if any.
  3444. this._updateView();
  3445. },
  3446. enumerable: true,
  3447. configurable: true
  3448. });
  3449. NgIf.prototype._updateView = function () {
  3450. if (this._context.$implicit) {
  3451. if (!this._thenViewRef) {
  3452. this._viewContainer.clear();
  3453. this._elseViewRef = null;
  3454. if (this._thenTemplateRef) {
  3455. this._thenViewRef =
  3456. this._viewContainer.createEmbeddedView(this._thenTemplateRef, this._context);
  3457. }
  3458. }
  3459. }
  3460. else {
  3461. if (!this._elseViewRef) {
  3462. this._viewContainer.clear();
  3463. this._thenViewRef = null;
  3464. if (this._elseTemplateRef) {
  3465. this._elseViewRef =
  3466. this._viewContainer.createEmbeddedView(this._elseTemplateRef, this._context);
  3467. }
  3468. }
  3469. }
  3470. };
  3471. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3472. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3473. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  3474. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  3475. ], NgIf.prototype, "ngIf", null);
  3476. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3477. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3478. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  3479. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  3480. ], NgIf.prototype, "ngIfThen", null);
  3481. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3482. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3483. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  3484. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  3485. ], NgIf.prototype, "ngIfElse", null);
  3486. NgIf = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3487. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngIf]' }),
  3488. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"]])
  3489. ], NgIf);
  3490. return NgIf;
  3491. }());
  3492. var NgIfContext = /** @class */ (function () {
  3493. function NgIfContext() {
  3494. this.$implicit = null;
  3495. this.ngIf = null;
  3496. }
  3497. return NgIfContext;
  3498. }());
  3499. function assertTemplate(property, templateRef) {
  3500. var isTemplateRefOrNull = !!(!templateRef || templateRef.createEmbeddedView);
  3501. if (!isTemplateRefOrNull) {
  3502. throw new Error(property + " must be a TemplateRef, but received '" + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(templateRef) + "'.");
  3503. }
  3504. }
  3505. /**
  3506. * @license
  3507. * Copyright Google Inc. All Rights Reserved.
  3508. *
  3509. * Use of this source code is governed by an MIT-style license that can be
  3510. * found in the LICENSE file at https://angular.io/license
  3511. */
  3512. var SwitchView = /** @class */ (function () {
  3513. function SwitchView(_viewContainerRef, _templateRef) {
  3514. this._viewContainerRef = _viewContainerRef;
  3515. this._templateRef = _templateRef;
  3516. this._created = false;
  3517. }
  3518. SwitchView.prototype.create = function () {
  3519. this._created = true;
  3520. this._viewContainerRef.createEmbeddedView(this._templateRef);
  3521. };
  3522. SwitchView.prototype.destroy = function () {
  3523. this._created = false;
  3524. this._viewContainerRef.clear();
  3525. };
  3526. SwitchView.prototype.enforceState = function (created) {
  3527. if (created && !this._created) {
  3528. this.create();
  3529. }
  3530. else if (!created && this._created) {
  3531. this.destroy();
  3532. }
  3533. };
  3534. return SwitchView;
  3535. }());
  3536. /**
  3537. * @ngModule CommonModule
  3538. *
  3539. * @usageNotes
  3540. * ```
  3541. * <container-element [ngSwitch]="switch_expression">
  3542. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3543. * <some-element *ngSwitchCase="match_expression_2">...</some-element>
  3544. * <some-other-element *ngSwitchCase="match_expression_3">...</some-other-element>
  3545. * <ng-container *ngSwitchCase="match_expression_3">
  3546. * <!-- use a ng-container to group multiple root nodes -->
  3547. * <inner-element></inner-element>
  3548. * <inner-other-element></inner-other-element>
  3549. * </ng-container>
  3550. * <some-element *ngSwitchDefault>...</some-element>
  3551. * </container-element>
  3552. * ```
  3553. * @description
  3554. *
  3555. * Adds / removes DOM sub-trees when the nest match expressions matches the switch expression.
  3556. *
  3557. * `NgSwitch` stamps out nested views when their match expression value matches the value of the
  3558. * switch expression.
  3559. *
  3560. * In other words:
  3561. * - you define a container element (where you place the directive with a switch expression on the
  3562. * `[ngSwitch]="..."` attribute)
  3563. * - you define inner views inside the `NgSwitch` and place a `*ngSwitchCase` attribute on the view
  3564. * root elements.
  3565. *
  3566. * Elements within `NgSwitch` but outside of a `NgSwitchCase` or `NgSwitchDefault` directives will
  3567. * be preserved at the location.
  3568. *
  3569. * The `ngSwitchCase` directive informs the parent `NgSwitch` of which view to display when the
  3570. * expression is evaluated.
  3571. * When no matching expression is found on a `ngSwitchCase` view, the `ngSwitchDefault` view is
  3572. * stamped out.
  3573. *
  3574. *
  3575. */
  3576. var NgSwitch = /** @class */ (function () {
  3577. function NgSwitch() {
  3578. this._defaultUsed = false;
  3579. this._caseCount = 0;
  3580. this._lastCaseCheckIndex = 0;
  3581. this._lastCasesMatched = false;
  3582. }
  3583. Object.defineProperty(NgSwitch.prototype, "ngSwitch", {
  3584. set: function (newValue) {
  3585. this._ngSwitch = newValue;
  3586. if (this._caseCount === 0) {
  3587. this._updateDefaultCases(true);
  3588. }
  3589. },
  3590. enumerable: true,
  3591. configurable: true
  3592. });
  3593. /** @internal */
  3594. NgSwitch.prototype._addCase = function () { return this._caseCount++; };
  3595. /** @internal */
  3596. NgSwitch.prototype._addDefault = function (view) {
  3597. if (!this._defaultViews) {
  3598. this._defaultViews = [];
  3599. }
  3600. this._defaultViews.push(view);
  3601. };
  3602. /** @internal */
  3603. NgSwitch.prototype._matchCase = function (value) {
  3604. var matched = value == this._ngSwitch;
  3605. this._lastCasesMatched = this._lastCasesMatched || matched;
  3606. this._lastCaseCheckIndex++;
  3607. if (this._lastCaseCheckIndex === this._caseCount) {
  3608. this._updateDefaultCases(!this._lastCasesMatched);
  3609. this._lastCaseCheckIndex = 0;
  3610. this._lastCasesMatched = false;
  3611. }
  3612. return matched;
  3613. };
  3614. NgSwitch.prototype._updateDefaultCases = function (useDefault) {
  3615. if (this._defaultViews && useDefault !== this._defaultUsed) {
  3616. this._defaultUsed = useDefault;
  3617. for (var i = 0; i < this._defaultViews.length; i++) {
  3618. var defaultView = this._defaultViews[i];
  3619. defaultView.enforceState(useDefault);
  3620. }
  3621. }
  3622. };
  3623. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3624. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3625. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  3626. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  3627. ], NgSwitch.prototype, "ngSwitch", null);
  3628. NgSwitch = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3629. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngSwitch]' })
  3630. ], NgSwitch);
  3631. return NgSwitch;
  3632. }());
  3633. /**
  3634. * @ngModule CommonModule
  3635. *
  3636. * @usageNotes
  3637. * ```
  3638. * <container-element [ngSwitch]="switch_expression">
  3639. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3640. * </container-element>
  3641. *```
  3642. * @description
  3643. *
  3644. * Creates a view that will be added/removed from the parent {@link NgSwitch} when the
  3645. * given expression evaluate to respectively the same/different value as the switch
  3646. * expression.
  3647. *
  3648. * Insert the sub-tree when the expression evaluates to the same value as the enclosing switch
  3649. * expression.
  3650. *
  3651. * If multiple match expressions match the switch expression value, all of them are displayed.
  3652. *
  3653. * See {@link NgSwitch} for more details and example.
  3654. *
  3655. *
  3656. */
  3657. var NgSwitchCase = /** @class */ (function () {
  3658. function NgSwitchCase(viewContainer, templateRef, ngSwitch) {
  3659. this.ngSwitch = ngSwitch;
  3660. ngSwitch._addCase();
  3661. this._view = new SwitchView(viewContainer, templateRef);
  3662. }
  3663. NgSwitchCase.prototype.ngDoCheck = function () { this._view.enforceState(this.ngSwitch._matchCase(this.ngSwitchCase)); };
  3664. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3665. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3666. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object)
  3667. ], NgSwitchCase.prototype, "ngSwitchCase", void 0);
  3668. NgSwitchCase = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3669. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngSwitchCase]' }),
  3670. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"])()),
  3671. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"],
  3672. NgSwitch])
  3673. ], NgSwitchCase);
  3674. return NgSwitchCase;
  3675. }());
  3676. /**
  3677. * @ngModule CommonModule
  3678. * @usageNotes
  3679. * ```
  3680. * <container-element [ngSwitch]="switch_expression">
  3681. * <some-element *ngSwitchCase="match_expression_1">...</some-element>
  3682. * <some-other-element *ngSwitchDefault>...</some-other-element>
  3683. * </container-element>
  3684. * ```
  3685. *
  3686. * @description
  3687. *
  3688. * Creates a view that is added to the parent {@link NgSwitch} when no case expressions
  3689. * match the switch expression.
  3690. *
  3691. * Insert the sub-tree when no case expressions evaluate to the same value as the enclosing switch
  3692. * expression.
  3693. *
  3694. * See {@link NgSwitch} for more details and example.
  3695. *
  3696. *
  3697. */
  3698. var NgSwitchDefault = /** @class */ (function () {
  3699. function NgSwitchDefault(viewContainer, templateRef, ngSwitch) {
  3700. ngSwitch._addDefault(new SwitchView(viewContainer, templateRef));
  3701. }
  3702. NgSwitchDefault = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3703. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngSwitchDefault]' }),
  3704. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"])()),
  3705. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"],
  3706. NgSwitch])
  3707. ], NgSwitchDefault);
  3708. return NgSwitchDefault;
  3709. }());
  3710. /**
  3711. * @license
  3712. * Copyright Google Inc. All Rights Reserved.
  3713. *
  3714. * Use of this source code is governed by an MIT-style license that can be
  3715. * found in the LICENSE file at https://angular.io/license
  3716. */
  3717. /**
  3718. * @ngModule CommonModule
  3719. *
  3720. * @usageNotes
  3721. * ```
  3722. * <some-element [ngPlural]="value">
  3723. * <ng-template ngPluralCase="=0">there is nothing</ng-template>
  3724. * <ng-template ngPluralCase="=1">there is one</ng-template>
  3725. * <ng-template ngPluralCase="few">there are a few</ng-template>
  3726. * </some-element>
  3727. * ```
  3728. *
  3729. * @description
  3730. *
  3731. * Adds / removes DOM sub-trees based on a numeric value. Tailored for pluralization.
  3732. *
  3733. * Displays DOM sub-trees that match the switch expression value, or failing that, DOM sub-trees
  3734. * that match the switch expression's pluralization category.
  3735. *
  3736. * To use this directive you must provide a container element that sets the `[ngPlural]` attribute
  3737. * to a switch expression. Inner elements with a `[ngPluralCase]` will display based on their
  3738. * expression:
  3739. * - if `[ngPluralCase]` is set to a value starting with `=`, it will only display if the value
  3740. * matches the switch expression exactly,
  3741. * - otherwise, the view will be treated as a "category match", and will only display if exact
  3742. * value matches aren't found and the value maps to its category for the defined locale.
  3743. *
  3744. * See http://cldr.unicode.org/index/cldr-spec/plural-rules
  3745. *
  3746. * @experimental
  3747. */
  3748. var NgPlural = /** @class */ (function () {
  3749. function NgPlural(_localization) {
  3750. this._localization = _localization;
  3751. this._caseViews = {};
  3752. }
  3753. Object.defineProperty(NgPlural.prototype, "ngPlural", {
  3754. set: function (value) {
  3755. this._switchValue = value;
  3756. this._updateView();
  3757. },
  3758. enumerable: true,
  3759. configurable: true
  3760. });
  3761. NgPlural.prototype.addCase = function (value, switchView) { this._caseViews[value] = switchView; };
  3762. NgPlural.prototype._updateView = function () {
  3763. this._clearViews();
  3764. var cases = Object.keys(this._caseViews);
  3765. var key = getPluralCategory(this._switchValue, cases, this._localization);
  3766. this._activateView(this._caseViews[key]);
  3767. };
  3768. NgPlural.prototype._clearViews = function () {
  3769. if (this._activeView)
  3770. this._activeView.destroy();
  3771. };
  3772. NgPlural.prototype._activateView = function (view) {
  3773. if (view) {
  3774. this._activeView = view;
  3775. this._activeView.create();
  3776. }
  3777. };
  3778. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3779. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3780. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Number),
  3781. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Number])
  3782. ], NgPlural.prototype, "ngPlural", null);
  3783. NgPlural = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3784. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngPlural]' }),
  3785. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [NgLocalization])
  3786. ], NgPlural);
  3787. return NgPlural;
  3788. }());
  3789. /**
  3790. * @ngModule CommonModule
  3791. *
  3792. * @description
  3793. *
  3794. * Creates a view that will be added/removed from the parent {@link NgPlural} when the
  3795. * given expression matches the plural expression according to CLDR rules.
  3796. *
  3797. * @usageNotes
  3798. * ```
  3799. * <some-element [ngPlural]="value">
  3800. * <ng-template ngPluralCase="=0">...</ng-template>
  3801. * <ng-template ngPluralCase="other">...</ng-template>
  3802. * </some-element>
  3803. *```
  3804. *
  3805. * See {@link NgPlural} for more details and example.
  3806. *
  3807. * @experimental
  3808. */
  3809. var NgPluralCase = /** @class */ (function () {
  3810. function NgPluralCase(value, template, viewContainer, ngPlural) {
  3811. this.value = value;
  3812. var isANumber = !isNaN(Number(value));
  3813. ngPlural.addCase(isANumber ? "=" + value : value, new SwitchView(viewContainer, template));
  3814. }
  3815. NgPluralCase = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3816. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngPluralCase]' }),
  3817. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Attribute"])('ngPluralCase')),
  3818. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Host"])()),
  3819. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String, _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"],
  3820. _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"], NgPlural])
  3821. ], NgPluralCase);
  3822. return NgPluralCase;
  3823. }());
  3824. /**
  3825. * @license
  3826. * Copyright Google Inc. All Rights Reserved.
  3827. *
  3828. * Use of this source code is governed by an MIT-style license that can be
  3829. * found in the LICENSE file at https://angular.io/license
  3830. */
  3831. /**
  3832. * @ngModule CommonModule
  3833. *
  3834. * @usageNotes
  3835. * ```
  3836. * <some-element [ngStyle]="{'font-style': styleExp}">...</some-element>
  3837. *
  3838. * <some-element [ngStyle]="{'max-width.px': widthExp}">...</some-element>
  3839. *
  3840. * <some-element [ngStyle]="objExp">...</some-element>
  3841. * ```
  3842. *
  3843. * @description
  3844. *
  3845. * Update an HTML element styles.
  3846. *
  3847. * The styles are updated according to the value of the expression evaluation:
  3848. * - keys are style names with an optional `.<unit>` suffix (ie 'top.px', 'font-style.em'),
  3849. * - values are the values assigned to those properties (expressed in the given unit).
  3850. *
  3851. *
  3852. */
  3853. var NgStyle = /** @class */ (function () {
  3854. function NgStyle(_differs, _ngEl, _renderer) {
  3855. this._differs = _differs;
  3856. this._ngEl = _ngEl;
  3857. this._renderer = _renderer;
  3858. }
  3859. Object.defineProperty(NgStyle.prototype, "ngStyle", {
  3860. set: function (values) {
  3861. this._ngStyle = values;
  3862. if (!this._differ && values) {
  3863. this._differ = this._differs.find(values).create();
  3864. }
  3865. },
  3866. enumerable: true,
  3867. configurable: true
  3868. });
  3869. NgStyle.prototype.ngDoCheck = function () {
  3870. if (this._differ) {
  3871. var changes = this._differ.diff(this._ngStyle);
  3872. if (changes) {
  3873. this._applyChanges(changes);
  3874. }
  3875. }
  3876. };
  3877. NgStyle.prototype._applyChanges = function (changes) {
  3878. var _this = this;
  3879. changes.forEachRemovedItem(function (record) { return _this._setStyle(record.key, null); });
  3880. changes.forEachAddedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
  3881. changes.forEachChangedItem(function (record) { return _this._setStyle(record.key, record.currentValue); });
  3882. };
  3883. NgStyle.prototype._setStyle = function (nameAndUnit, value) {
  3884. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(nameAndUnit.split('.'), 2), name = _a[0], unit = _a[1];
  3885. value = value != null && unit ? "" + value + unit : value;
  3886. if (value != null) {
  3887. this._renderer.setStyle(this._ngEl.nativeElement, name, value);
  3888. }
  3889. else {
  3890. this._renderer.removeStyle(this._ngEl.nativeElement, name);
  3891. }
  3892. };
  3893. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3894. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  3895. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object),
  3896. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [Object])
  3897. ], NgStyle.prototype, "ngStyle", null);
  3898. NgStyle = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  3899. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngStyle]' }),
  3900. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_0__["Renderer2"]])
  3901. ], NgStyle);
  3902. return NgStyle;
  3903. }());
  3904. /**
  3905. * @license
  3906. * Copyright Google Inc. All Rights Reserved.
  3907. *
  3908. * Use of this source code is governed by an MIT-style license that can be
  3909. * found in the LICENSE file at https://angular.io/license
  3910. */
  3911. /**
  3912. * @ngModule CommonModule
  3913. *
  3914. * @description
  3915. *
  3916. * Inserts an embedded view from a prepared `TemplateRef`.
  3917. *
  3918. * You can attach a context object to the `EmbeddedViewRef` by setting `[ngTemplateOutletContext]`.
  3919. * `[ngTemplateOutletContext]` should be an object, the object's keys will be available for binding
  3920. * by the local template `let` declarations.
  3921. *
  3922. * @usageNotes
  3923. * ```
  3924. * <ng-container *ngTemplateOutlet="templateRefExp; context: contextExp"></ng-container>
  3925. * ```
  3926. *
  3927. * Using the key `$implicit` in the context object will set its value as default.
  3928. *
  3929. * ### Example
  3930. *
  3931. * {@example common/ngTemplateOutlet/ts/module.ts region='NgTemplateOutlet'}
  3932. *
  3933. */
  3934. var NgTemplateOutlet = /** @class */ (function () {
  3935. function NgTemplateOutlet(_viewContainerRef) {
  3936. this._viewContainerRef = _viewContainerRef;
  3937. }
  3938. NgTemplateOutlet.prototype.ngOnChanges = function (changes) {
  3939. var recreateView = this._shouldRecreateView(changes);
  3940. if (recreateView) {
  3941. if (this._viewRef) {
  3942. this._viewContainerRef.remove(this._viewContainerRef.indexOf(this._viewRef));
  3943. }
  3944. if (this.ngTemplateOutlet) {
  3945. this._viewRef = this._viewContainerRef.createEmbeddedView(this.ngTemplateOutlet, this.ngTemplateOutletContext);
  3946. }
  3947. }
  3948. else {
  3949. if (this._viewRef && this.ngTemplateOutletContext) {
  3950. this._updateExistingContext(this.ngTemplateOutletContext);
  3951. }
  3952. }
  3953. };
  3954. /**
  3955. * We need to re-create existing embedded view if:
  3956. * - templateRef has changed
  3957. * - context has changes
  3958. *
  3959. * We mark context object as changed when the corresponding object
  3960. * shape changes (new properties are added or existing properties are removed).
  3961. * In other words we consider context with the same properties as "the same" even
  3962. * if object reference changes (see https://github.com/angular/angular/issues/13407).
  3963. */
  3964. NgTemplateOutlet.prototype._shouldRecreateView = function (changes) {
  3965. var ctxChange = changes['ngTemplateOutletContext'];
  3966. return !!changes['ngTemplateOutlet'] || (ctxChange && this._hasContextShapeChanged(ctxChange));
  3967. };
  3968. NgTemplateOutlet.prototype._hasContextShapeChanged = function (ctxChange) {
  3969. var e_1, _a;
  3970. var prevCtxKeys = Object.keys(ctxChange.previousValue || {});
  3971. var currCtxKeys = Object.keys(ctxChange.currentValue || {});
  3972. if (prevCtxKeys.length === currCtxKeys.length) {
  3973. try {
  3974. for (var currCtxKeys_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(currCtxKeys), currCtxKeys_1_1 = currCtxKeys_1.next(); !currCtxKeys_1_1.done; currCtxKeys_1_1 = currCtxKeys_1.next()) {
  3975. var propName = currCtxKeys_1_1.value;
  3976. if (prevCtxKeys.indexOf(propName) === -1) {
  3977. return true;
  3978. }
  3979. }
  3980. }
  3981. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  3982. finally {
  3983. try {
  3984. if (currCtxKeys_1_1 && !currCtxKeys_1_1.done && (_a = currCtxKeys_1.return)) _a.call(currCtxKeys_1);
  3985. }
  3986. finally { if (e_1) throw e_1.error; }
  3987. }
  3988. return false;
  3989. }
  3990. else {
  3991. return true;
  3992. }
  3993. };
  3994. NgTemplateOutlet.prototype._updateExistingContext = function (ctx) {
  3995. var e_2, _a;
  3996. try {
  3997. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__values"])(Object.keys(ctx)), _c = _b.next(); !_c.done; _c = _b.next()) {
  3998. var propName = _c.value;
  3999. this._viewRef.context[propName] = this.ngTemplateOutletContext[propName];
  4000. }
  4001. }
  4002. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  4003. finally {
  4004. try {
  4005. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  4006. }
  4007. finally { if (e_2) throw e_2.error; }
  4008. }
  4009. };
  4010. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4011. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  4012. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", Object)
  4013. ], NgTemplateOutlet.prototype, "ngTemplateOutletContext", void 0);
  4014. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4015. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"])(),
  4016. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_0__["TemplateRef"])
  4017. ], NgTemplateOutlet.prototype, "ngTemplateOutlet", void 0);
  4018. NgTemplateOutlet = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4019. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"])({ selector: '[ngTemplateOutlet]' }),
  4020. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewContainerRef"]])
  4021. ], NgTemplateOutlet);
  4022. return NgTemplateOutlet;
  4023. }());
  4024. /**
  4025. * @license
  4026. * Copyright Google Inc. All Rights Reserved.
  4027. *
  4028. * Use of this source code is governed by an MIT-style license that can be
  4029. * found in the LICENSE file at https://angular.io/license
  4030. */
  4031. /**
  4032. * A collection of Angular directives that are likely to be used in each and every Angular
  4033. * application.
  4034. */
  4035. var COMMON_DIRECTIVES = [
  4036. NgClass,
  4037. NgComponentOutlet,
  4038. NgForOf,
  4039. NgIf,
  4040. NgTemplateOutlet,
  4041. NgStyle,
  4042. NgSwitch,
  4043. NgSwitchCase,
  4044. NgSwitchDefault,
  4045. NgPlural,
  4046. NgPluralCase,
  4047. ];
  4048. /**
  4049. * @license
  4050. * Copyright Google Inc. All Rights Reserved.
  4051. *
  4052. * Use of this source code is governed by an MIT-style license that can be
  4053. * found in the LICENSE file at https://angular.io/license
  4054. */
  4055. function invalidPipeArgumentError(type, value) {
  4056. return Error("InvalidPipeArgument: '" + value + "' for pipe '" + Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵstringify"])(type) + "'");
  4057. }
  4058. var NumberFormatter = /** @class */ (function () {
  4059. function NumberFormatter() {
  4060. }
  4061. NumberFormatter.format = function (num, locale, style, opts) {
  4062. if (opts === void 0) { opts = {}; }
  4063. var minimumIntegerDigits = opts.minimumIntegerDigits, minimumFractionDigits = opts.minimumFractionDigits, maximumFractionDigits = opts.maximumFractionDigits, currency = opts.currency, _a = opts.currencyAsSymbol, currencyAsSymbol = _a === void 0 ? false : _a;
  4064. var options = {
  4065. minimumIntegerDigits: minimumIntegerDigits,
  4066. minimumFractionDigits: minimumFractionDigits,
  4067. maximumFractionDigits: maximumFractionDigits,
  4068. style: NumberFormatStyle[style].toLowerCase()
  4069. };
  4070. if (style == NumberFormatStyle.Currency) {
  4071. options.currency = typeof currency == 'string' ? currency : undefined;
  4072. options.currencyDisplay = currencyAsSymbol ? 'symbol' : 'code';
  4073. }
  4074. return new Intl.NumberFormat(locale, options).format(num);
  4075. };
  4076. return NumberFormatter;
  4077. }());
  4078. var DATE_FORMATS_SPLIT$1 = /((?:[^yMLdHhmsazZEwGjJ']+)|(?:'(?:[^']|'')*')|(?:E+|y+|M+|L+|d+|H+|h+|J+|j+|m+|s+|a|z|Z|G+|w+))(.*)/;
  4079. var PATTERN_ALIASES = {
  4080. // Keys are quoted so they do not get renamed during closure compilation.
  4081. 'yMMMdjms': datePartGetterFactory(combine([
  4082. digitCondition('year', 1),
  4083. nameCondition('month', 3),
  4084. digitCondition('day', 1),
  4085. digitCondition('hour', 1),
  4086. digitCondition('minute', 1),
  4087. digitCondition('second', 1),
  4088. ])),
  4089. 'yMdjm': datePartGetterFactory(combine([
  4090. digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1),
  4091. digitCondition('hour', 1), digitCondition('minute', 1)
  4092. ])),
  4093. 'yMMMMEEEEd': datePartGetterFactory(combine([
  4094. digitCondition('year', 1), nameCondition('month', 4), nameCondition('weekday', 4),
  4095. digitCondition('day', 1)
  4096. ])),
  4097. 'yMMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 4), digitCondition('day', 1)])),
  4098. 'yMMMd': datePartGetterFactory(combine([digitCondition('year', 1), nameCondition('month', 3), digitCondition('day', 1)])),
  4099. 'yMd': datePartGetterFactory(combine([digitCondition('year', 1), digitCondition('month', 1), digitCondition('day', 1)])),
  4100. 'jms': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('second', 1), digitCondition('minute', 1)])),
  4101. 'jm': datePartGetterFactory(combine([digitCondition('hour', 1), digitCondition('minute', 1)]))
  4102. };
  4103. var DATE_FORMATS$1 = {
  4104. // Keys are quoted so they do not get renamed.
  4105. 'yyyy': datePartGetterFactory(digitCondition('year', 4)),
  4106. 'yy': datePartGetterFactory(digitCondition('year', 2)),
  4107. 'y': datePartGetterFactory(digitCondition('year', 1)),
  4108. 'MMMM': datePartGetterFactory(nameCondition('month', 4)),
  4109. 'MMM': datePartGetterFactory(nameCondition('month', 3)),
  4110. 'MM': datePartGetterFactory(digitCondition('month', 2)),
  4111. 'M': datePartGetterFactory(digitCondition('month', 1)),
  4112. 'LLLL': datePartGetterFactory(nameCondition('month', 4)),
  4113. 'L': datePartGetterFactory(nameCondition('month', 1)),
  4114. 'dd': datePartGetterFactory(digitCondition('day', 2)),
  4115. 'd': datePartGetterFactory(digitCondition('day', 1)),
  4116. 'HH': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), false)))),
  4117. 'H': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), false))),
  4118. 'hh': digitModifier(hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 2), true)))),
  4119. 'h': hourExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
  4120. 'jj': datePartGetterFactory(digitCondition('hour', 2)),
  4121. 'j': datePartGetterFactory(digitCondition('hour', 1)),
  4122. 'mm': digitModifier(datePartGetterFactory(digitCondition('minute', 2))),
  4123. 'm': datePartGetterFactory(digitCondition('minute', 1)),
  4124. 'ss': digitModifier(datePartGetterFactory(digitCondition('second', 2))),
  4125. 's': datePartGetterFactory(digitCondition('second', 1)),
  4126. // while ISO 8601 requires fractions to be prefixed with `.` or `,`
  4127. // we can be just safely rely on using `sss` since we currently don't support single or two digit
  4128. // fractions
  4129. 'sss': datePartGetterFactory(digitCondition('second', 3)),
  4130. 'EEEE': datePartGetterFactory(nameCondition('weekday', 4)),
  4131. 'EEE': datePartGetterFactory(nameCondition('weekday', 3)),
  4132. 'EE': datePartGetterFactory(nameCondition('weekday', 2)),
  4133. 'E': datePartGetterFactory(nameCondition('weekday', 1)),
  4134. 'a': hourClockExtractor(datePartGetterFactory(hour12Modify(digitCondition('hour', 1), true))),
  4135. 'Z': timeZoneGetter$1('short'),
  4136. 'z': timeZoneGetter$1('long'),
  4137. 'ww': datePartGetterFactory({}),
  4138. // first Thursday of the year. not support ?
  4139. 'w': datePartGetterFactory({}),
  4140. // of the year not support ?
  4141. 'G': datePartGetterFactory(nameCondition('era', 1)),
  4142. 'GG': datePartGetterFactory(nameCondition('era', 2)),
  4143. 'GGG': datePartGetterFactory(nameCondition('era', 3)),
  4144. 'GGGG': datePartGetterFactory(nameCondition('era', 4))
  4145. };
  4146. function digitModifier(inner) {
  4147. return function (date, locale) {
  4148. var result = inner(date, locale);
  4149. return result.length == 1 ? '0' + result : result;
  4150. };
  4151. }
  4152. function hourClockExtractor(inner) {
  4153. return function (date, locale) { return inner(date, locale).split(' ')[1]; };
  4154. }
  4155. function hourExtractor(inner) {
  4156. return function (date, locale) { return inner(date, locale).split(' ')[0]; };
  4157. }
  4158. function intlDateFormat(date, locale, options) {
  4159. return new Intl.DateTimeFormat(locale, options).format(date).replace(/[\u200e\u200f]/g, '');
  4160. }
  4161. function timeZoneGetter$1(timezone) {
  4162. // To workaround `Intl` API restriction for single timezone let format with 24 hours
  4163. var options = { hour: '2-digit', hour12: false, timeZoneName: timezone };
  4164. return function (date, locale) {
  4165. var result = intlDateFormat(date, locale, options);
  4166. // Then extract first 3 letters that related to hours
  4167. return result ? result.substring(3) : '';
  4168. };
  4169. }
  4170. function hour12Modify(options, value) {
  4171. options.hour12 = value;
  4172. return options;
  4173. }
  4174. function digitCondition(prop, len) {
  4175. var result = {};
  4176. result[prop] = len === 2 ? '2-digit' : 'numeric';
  4177. return result;
  4178. }
  4179. function nameCondition(prop, len) {
  4180. var result = {};
  4181. if (len < 4) {
  4182. result[prop] = len > 1 ? 'short' : 'narrow';
  4183. }
  4184. else {
  4185. result[prop] = 'long';
  4186. }
  4187. return result;
  4188. }
  4189. function combine(options) {
  4190. return options.reduce(function (merged, opt) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, merged, opt)); }, {});
  4191. }
  4192. function datePartGetterFactory(ret) {
  4193. return function (date, locale) { return intlDateFormat(date, locale, ret); };
  4194. }
  4195. var DATE_FORMATTER_CACHE = new Map();
  4196. function dateFormatter(format, date, locale) {
  4197. var fn = PATTERN_ALIASES[format];
  4198. if (fn)
  4199. return fn(date, locale);
  4200. var cacheKey = format;
  4201. var parts = DATE_FORMATTER_CACHE.get(cacheKey);
  4202. if (!parts) {
  4203. parts = [];
  4204. var match = void 0;
  4205. DATE_FORMATS_SPLIT$1.exec(format);
  4206. var _format = format;
  4207. while (_format) {
  4208. match = DATE_FORMATS_SPLIT$1.exec(_format);
  4209. if (match) {
  4210. parts = parts.concat(match.slice(1));
  4211. _format = parts.pop();
  4212. }
  4213. else {
  4214. parts.push(_format);
  4215. _format = null;
  4216. }
  4217. }
  4218. DATE_FORMATTER_CACHE.set(cacheKey, parts);
  4219. }
  4220. return parts.reduce(function (text, part) {
  4221. var fn = DATE_FORMATS$1[part];
  4222. return text + (fn ? fn(date, locale) : partToTime(part));
  4223. }, '');
  4224. }
  4225. function partToTime(part) {
  4226. return part === '\'\'' ? '\'' : part.replace(/(^'|'$)/g, '').replace(/''/g, '\'');
  4227. }
  4228. var DateFormatter = /** @class */ (function () {
  4229. function DateFormatter() {
  4230. }
  4231. DateFormatter.format = function (date, locale, pattern) {
  4232. return dateFormatter(pattern, date, locale);
  4233. };
  4234. return DateFormatter;
  4235. }());
  4236. /**
  4237. * @license
  4238. * Copyright Google Inc. All Rights Reserved.
  4239. *
  4240. * Use of this source code is governed by an MIT-style license that can be
  4241. * found in the LICENSE file at https://angular.io/license
  4242. */
  4243. /**
  4244. * @ngModule CommonModule
  4245. * @description
  4246. *
  4247. * Formats a date according to locale rules.
  4248. *
  4249. * Where:
  4250. * - `expression` is a date object or a number (milliseconds since UTC epoch) or an ISO string
  4251. * (https://www.w3.org/TR/NOTE-datetime).
  4252. * - `format` indicates which date/time components to include. The format can be predefined as
  4253. * shown below or custom as shown in the table.
  4254. * - `'medium'`: equivalent to `'yMMMdjms'` (e.g. `Sep 3, 2010, 12:05:08 PM` for `en-US`)
  4255. * - `'short'`: equivalent to `'yMdjm'` (e.g. `9/3/2010, 12:05 PM` for `en-US`)
  4256. * - `'fullDate'`: equivalent to `'yMMMMEEEEd'` (e.g. `Friday, September 3, 2010` for `en-US`)
  4257. * - `'longDate'`: equivalent to `'yMMMMd'` (e.g. `September 3, 2010` for `en-US`)
  4258. * - `'mediumDate'`: equivalent to `'yMMMd'` (e.g. `Sep 3, 2010` for `en-US`)
  4259. * - `'shortDate'`: equivalent to `'yMd'` (e.g. `9/3/2010` for `en-US`)
  4260. * - `'mediumTime'`: equivalent to `'jms'` (e.g. `12:05:08 PM` for `en-US`)
  4261. * - `'shortTime'`: equivalent to `'jm'` (e.g. `12:05 PM` for `en-US`)
  4262. *
  4263. *
  4264. * | Component | Symbol | Narrow | Short Form | Long Form | Numeric | 2-digit |
  4265. * |-----------|:------:|--------|--------------|-------------------|-----------|-----------|
  4266. * | era | G | G (A) | GGG (AD) | GGGG (Anno Domini)| - | - |
  4267. * | year | y | - | - | - | y (2015) | yy (15) |
  4268. * | month | M | L (S) | MMM (Sep) | MMMM (September) | M (9) | MM (09) |
  4269. * | day | d | - | - | - | d (3) | dd (03) |
  4270. * | weekday | E | E (S) | EEE (Sun) | EEEE (Sunday) | - | - |
  4271. * | hour | j | - | - | - | j (13) | jj (13) |
  4272. * | hour12 | h | - | - | - | h (1 PM) | hh (01 PM)|
  4273. * | hour24 | H | - | - | - | H (13) | HH (13) |
  4274. * | minute | m | - | - | - | m (5) | mm (05) |
  4275. * | second | s | - | - | - | s (9) | ss (09) |
  4276. * | timezone | z | - | - | z (Pacific Standard Time)| - | - |
  4277. * | timezone | Z | - | Z (GMT-8:00) | - | - | - |
  4278. * | timezone | a | - | a (PM) | - | - | - |
  4279. *
  4280. * In javascript, only the components specified will be respected (not the ordering,
  4281. * punctuations, ...) and details of the formatting will be dependent on the locale.
  4282. *
  4283. * Timezone of the formatted text will be the local system timezone of the end-user's machine.
  4284. *
  4285. * When the expression is a ISO string without time (e.g. 2016-09-19) the time zone offset is not
  4286. * applied and the formatted text will have the same day, month and year of the expression.
  4287. *
  4288. * WARNINGS:
  4289. * - this pipe is marked as pure hence it will not be re-evaluated when the input is mutated.
  4290. * Instead users should treat the date as an immutable object and change the reference when the
  4291. * pipe needs to re-run (this is to avoid reformatting the date on every change detection run
  4292. * which would be an expensive operation).
  4293. * - this pipe uses the Internationalization API. Therefore it is only reliable in Chrome and Opera
  4294. * browsers.
  4295. *
  4296. * @usageNotes
  4297. *
  4298. * ### Examples
  4299. *
  4300. * Assuming `dateObj` is (year: 2010, month: 9, day: 3, hour: 12 PM, minute: 05, second: 08)
  4301. * in the _local_ time and locale is 'en-US':
  4302. *
  4303. * {@example common/pipes/ts/date_pipe.ts region='DeprecatedDatePipe'}
  4304. *
  4305. *
  4306. */
  4307. var DeprecatedDatePipe = /** @class */ (function () {
  4308. function DeprecatedDatePipe(_locale) {
  4309. this._locale = _locale;
  4310. }
  4311. DeprecatedDatePipe_1 = DeprecatedDatePipe;
  4312. DeprecatedDatePipe.prototype.transform = function (value, pattern) {
  4313. if (pattern === void 0) { pattern = 'mediumDate'; }
  4314. if (value == null || value === '' || value !== value)
  4315. return null;
  4316. var date;
  4317. if (typeof value === 'string') {
  4318. value = value.trim();
  4319. }
  4320. if (isDate$1(value)) {
  4321. date = value;
  4322. }
  4323. else if (!isNaN(value - parseFloat(value))) {
  4324. date = new Date(parseFloat(value));
  4325. }
  4326. else if (typeof value === 'string' && /^(\d{4}-\d{1,2}-\d{1,2})$/.test(value)) {
  4327. /**
  4328. * For ISO Strings without time the day, month and year must be extracted from the ISO String
  4329. * before Date creation to avoid time offset and errors in the new Date.
  4330. * If we only replace '-' with ',' in the ISO String ("2015,01,01"), and try to create a new
  4331. * date, some browsers (e.g. IE 9) will throw an invalid Date error
  4332. * If we leave the '-' ("2015-01-01") and try to create a new Date("2015-01-01") the
  4333. * timeoffset
  4334. * is applied
  4335. * Note: ISO months are 0 for January, 1 for February, ...
  4336. */
  4337. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__read"])(value.split('-').map(function (val) { return parseInt(val, 10); }), 3), y = _a[0], m = _a[1], d = _a[2];
  4338. date = new Date(y, m - 1, d);
  4339. }
  4340. else {
  4341. date = new Date(value);
  4342. }
  4343. if (!isDate$1(date)) {
  4344. var match = void 0;
  4345. if ((typeof value === 'string') && (match = value.match(ISO8601_DATE_REGEX))) {
  4346. date = isoStringToDate(match);
  4347. }
  4348. else {
  4349. throw invalidPipeArgumentError(DeprecatedDatePipe_1, value);
  4350. }
  4351. }
  4352. return DateFormatter.format(date, this._locale, DeprecatedDatePipe_1._ALIASES[pattern] || pattern);
  4353. };
  4354. var DeprecatedDatePipe_1;
  4355. /** @internal */
  4356. DeprecatedDatePipe._ALIASES = {
  4357. 'medium': 'yMMMdjms',
  4358. 'short': 'yMdjm',
  4359. 'fullDate': 'yMMMMEEEEd',
  4360. 'longDate': 'yMMMMd',
  4361. 'mediumDate': 'yMMMd',
  4362. 'shortDate': 'yMd',
  4363. 'mediumTime': 'jms',
  4364. 'shortTime': 'jm'
  4365. };
  4366. DeprecatedDatePipe = DeprecatedDatePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4367. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'date', pure: true }),
  4368. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  4369. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  4370. ], DeprecatedDatePipe);
  4371. return DeprecatedDatePipe;
  4372. }());
  4373. function isDate$1(value) {
  4374. return value instanceof Date && !isNaN(value.valueOf());
  4375. }
  4376. /**
  4377. * @license
  4378. * Copyright Google Inc. All Rights Reserved.
  4379. *
  4380. * Use of this source code is governed by an MIT-style license that can be
  4381. * found in the LICENSE file at https://angular.io/license
  4382. */
  4383. function formatNumber$1(pipe, locale, value, style, digits, currency, currencyAsSymbol) {
  4384. if (currency === void 0) { currency = null; }
  4385. if (currencyAsSymbol === void 0) { currencyAsSymbol = false; }
  4386. if (value == null)
  4387. return null;
  4388. // Convert strings to numbers
  4389. value = typeof value === 'string' && !isNaN(+value - parseFloat(value)) ? +value : value;
  4390. if (typeof value !== 'number') {
  4391. throw invalidPipeArgumentError(pipe, value);
  4392. }
  4393. var minInt;
  4394. var minFraction;
  4395. var maxFraction;
  4396. if (style !== NumberFormatStyle.Currency) {
  4397. // rely on Intl default for currency
  4398. minInt = 1;
  4399. minFraction = 0;
  4400. maxFraction = 3;
  4401. }
  4402. if (digits) {
  4403. var parts = digits.match(NUMBER_FORMAT_REGEXP);
  4404. if (parts === null) {
  4405. throw new Error(digits + " is not a valid digit info for number pipes");
  4406. }
  4407. if (parts[1] != null) { // min integer digits
  4408. minInt = parseIntAutoRadix(parts[1]);
  4409. }
  4410. if (parts[3] != null) { // min fraction digits
  4411. minFraction = parseIntAutoRadix(parts[3]);
  4412. }
  4413. if (parts[5] != null) { // max fraction digits
  4414. maxFraction = parseIntAutoRadix(parts[5]);
  4415. }
  4416. }
  4417. return NumberFormatter.format(value, locale, style, {
  4418. minimumIntegerDigits: minInt,
  4419. minimumFractionDigits: minFraction,
  4420. maximumFractionDigits: maxFraction,
  4421. currency: currency,
  4422. currencyAsSymbol: currencyAsSymbol,
  4423. });
  4424. }
  4425. /**
  4426. * Formats a number as text. Group sizing and separator and other locale-specific
  4427. * configurations are based on the active locale.
  4428. *
  4429. * where `expression` is a number:
  4430. * - `digitInfo` is a `string` which has a following format: <br>
  4431. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>
  4432. * - `minIntegerDigits` is the minimum number of integer digits to use. Defaults to `1`.
  4433. * - `minFractionDigits` is the minimum number of digits after fraction. Defaults to `0`.
  4434. * - `maxFractionDigits` is the maximum number of digits after fraction. Defaults to `3`.
  4435. *
  4436. * For more information on the acceptable range for each of these numbers and other
  4437. * details see your native internationalization library.
  4438. *
  4439. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  4440. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  4441. *
  4442. * @usageNotes
  4443. *
  4444. * ### Example
  4445. *
  4446. * {@example common/pipes/ts/number_pipe.ts region='DeprecatedNumberPipe'}
  4447. *
  4448. * @ngModule CommonModule
  4449. */
  4450. var DeprecatedDecimalPipe = /** @class */ (function () {
  4451. function DeprecatedDecimalPipe(_locale) {
  4452. this._locale = _locale;
  4453. }
  4454. DeprecatedDecimalPipe_1 = DeprecatedDecimalPipe;
  4455. DeprecatedDecimalPipe.prototype.transform = function (value, digits) {
  4456. return formatNumber$1(DeprecatedDecimalPipe_1, this._locale, value, NumberFormatStyle.Decimal, digits);
  4457. };
  4458. var DeprecatedDecimalPipe_1;
  4459. DeprecatedDecimalPipe = DeprecatedDecimalPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4460. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'number' }),
  4461. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  4462. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  4463. ], DeprecatedDecimalPipe);
  4464. return DeprecatedDecimalPipe;
  4465. }());
  4466. /**
  4467. * @ngModule CommonModule
  4468. *
  4469. * @description
  4470. *
  4471. * Formats a number as percentage according to locale rules.
  4472. *
  4473. * - `digitInfo` See {@link DecimalPipe} for detailed description.
  4474. *
  4475. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  4476. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  4477. *
  4478. * @usageNotes
  4479. *
  4480. * ### Example
  4481. *
  4482. * {@example common/pipes/ts/percent_pipe.ts region='DeprecatedPercentPipe'}
  4483. *
  4484. *
  4485. */
  4486. var DeprecatedPercentPipe = /** @class */ (function () {
  4487. function DeprecatedPercentPipe(_locale) {
  4488. this._locale = _locale;
  4489. }
  4490. DeprecatedPercentPipe_1 = DeprecatedPercentPipe;
  4491. DeprecatedPercentPipe.prototype.transform = function (value, digits) {
  4492. return formatNumber$1(DeprecatedPercentPipe_1, this._locale, value, NumberFormatStyle.Percent, digits);
  4493. };
  4494. var DeprecatedPercentPipe_1;
  4495. DeprecatedPercentPipe = DeprecatedPercentPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4496. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'percent' }),
  4497. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  4498. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  4499. ], DeprecatedPercentPipe);
  4500. return DeprecatedPercentPipe;
  4501. }());
  4502. /**
  4503. * @ngModule CommonModule
  4504. * @description
  4505. *
  4506. * Formats a number as currency using locale rules.
  4507. *
  4508. * Use `currency` to format a number as currency.
  4509. *
  4510. * - `currencyCode` is the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code, such
  4511. * as `USD` for the US dollar and `EUR` for the euro.
  4512. * - `symbolDisplay` is a boolean indicating whether to use the currency symbol or code.
  4513. * - `true`: use symbol (e.g. `$`).
  4514. * - `false`(default): use code (e.g. `USD`).
  4515. * - `digitInfo` See {@link DecimalPipe} for detailed description.
  4516. *
  4517. * WARNING: this pipe uses the Internationalization API which is not yet available in all browsers
  4518. * and may require a polyfill. See [Browser Support](guide/browser-support) for details.
  4519. *
  4520. * @usageNotes
  4521. *
  4522. * ### Example
  4523. *
  4524. * {@example common/pipes/ts/currency_pipe.ts region='DeprecatedCurrencyPipe'}
  4525. *
  4526. *
  4527. */
  4528. var DeprecatedCurrencyPipe = /** @class */ (function () {
  4529. function DeprecatedCurrencyPipe(_locale) {
  4530. this._locale = _locale;
  4531. }
  4532. DeprecatedCurrencyPipe_1 = DeprecatedCurrencyPipe;
  4533. DeprecatedCurrencyPipe.prototype.transform = function (value, currencyCode, symbolDisplay, digits) {
  4534. if (currencyCode === void 0) { currencyCode = 'USD'; }
  4535. if (symbolDisplay === void 0) { symbolDisplay = false; }
  4536. return formatNumber$1(DeprecatedCurrencyPipe_1, this._locale, value, NumberFormatStyle.Currency, digits, currencyCode, symbolDisplay);
  4537. };
  4538. var DeprecatedCurrencyPipe_1;
  4539. DeprecatedCurrencyPipe = DeprecatedCurrencyPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4540. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'currency' }),
  4541. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  4542. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  4543. ], DeprecatedCurrencyPipe);
  4544. return DeprecatedCurrencyPipe;
  4545. }());
  4546. /**
  4547. * @license
  4548. * Copyright Google Inc. All Rights Reserved.
  4549. *
  4550. * Use of this source code is governed by an MIT-style license that can be
  4551. * found in the LICENSE file at https://angular.io/license
  4552. */
  4553. /**
  4554. * A collection of deprecated i18n pipes that require intl api
  4555. *
  4556. * @deprecated from v5
  4557. */
  4558. var COMMON_DEPRECATED_I18N_PIPES = [DeprecatedDecimalPipe, DeprecatedPercentPipe, DeprecatedCurrencyPipe, DeprecatedDatePipe];
  4559. /**
  4560. * @license
  4561. * Copyright Google Inc. All Rights Reserved.
  4562. *
  4563. * Use of this source code is governed by an MIT-style license that can be
  4564. * found in the LICENSE file at https://angular.io/license
  4565. */
  4566. var ObservableStrategy = /** @class */ (function () {
  4567. function ObservableStrategy() {
  4568. }
  4569. ObservableStrategy.prototype.createSubscription = function (async, updateLatestValue) {
  4570. return async.subscribe({ next: updateLatestValue, error: function (e) { throw e; } });
  4571. };
  4572. ObservableStrategy.prototype.dispose = function (subscription) { subscription.unsubscribe(); };
  4573. ObservableStrategy.prototype.onDestroy = function (subscription) { subscription.unsubscribe(); };
  4574. return ObservableStrategy;
  4575. }());
  4576. var PromiseStrategy = /** @class */ (function () {
  4577. function PromiseStrategy() {
  4578. }
  4579. PromiseStrategy.prototype.createSubscription = function (async, updateLatestValue) {
  4580. return async.then(updateLatestValue, function (e) { throw e; });
  4581. };
  4582. PromiseStrategy.prototype.dispose = function (subscription) { };
  4583. PromiseStrategy.prototype.onDestroy = function (subscription) { };
  4584. return PromiseStrategy;
  4585. }());
  4586. var _promiseStrategy = new PromiseStrategy();
  4587. var _observableStrategy = new ObservableStrategy();
  4588. /**
  4589. * @ngModule CommonModule
  4590. * @description
  4591. *
  4592. * Unwraps a value from an asynchronous primitive.
  4593. *
  4594. * The `async` pipe subscribes to an `Observable` or `Promise` and returns the latest value it has
  4595. * emitted. When a new value is emitted, the `async` pipe marks the component to be checked for
  4596. * changes. When the component gets destroyed, the `async` pipe unsubscribes automatically to avoid
  4597. * potential memory leaks.
  4598. *
  4599. * @usageNotes
  4600. *
  4601. * ### Examples
  4602. *
  4603. * This example binds a `Promise` to the view. Clicking the `Resolve` button resolves the
  4604. * promise.
  4605. *
  4606. * {@example common/pipes/ts/async_pipe.ts region='AsyncPipePromise'}
  4607. *
  4608. * It's also possible to use `async` with Observables. The example below binds the `time` Observable
  4609. * to the view. The Observable continuously updates the view with the current time.
  4610. *
  4611. * {@example common/pipes/ts/async_pipe.ts region='AsyncPipeObservable'}
  4612. *
  4613. */
  4614. var AsyncPipe = /** @class */ (function () {
  4615. function AsyncPipe(_ref) {
  4616. this._ref = _ref;
  4617. this._latestValue = null;
  4618. this._latestReturnedValue = null;
  4619. this._subscription = null;
  4620. this._obj = null;
  4621. this._strategy = null;
  4622. }
  4623. AsyncPipe_1 = AsyncPipe;
  4624. AsyncPipe.prototype.ngOnDestroy = function () {
  4625. if (this._subscription) {
  4626. this._dispose();
  4627. }
  4628. };
  4629. AsyncPipe.prototype.transform = function (obj) {
  4630. if (!this._obj) {
  4631. if (obj) {
  4632. this._subscribe(obj);
  4633. }
  4634. this._latestReturnedValue = this._latestValue;
  4635. return this._latestValue;
  4636. }
  4637. if (obj !== this._obj) {
  4638. this._dispose();
  4639. return this.transform(obj);
  4640. }
  4641. if (this._latestValue === this._latestReturnedValue) {
  4642. return this._latestReturnedValue;
  4643. }
  4644. this._latestReturnedValue = this._latestValue;
  4645. return _angular_core__WEBPACK_IMPORTED_MODULE_0__["WrappedValue"].wrap(this._latestValue);
  4646. };
  4647. AsyncPipe.prototype._subscribe = function (obj) {
  4648. var _this = this;
  4649. this._obj = obj;
  4650. this._strategy = this._selectStrategy(obj);
  4651. this._subscription = this._strategy.createSubscription(obj, function (value) { return _this._updateLatestValue(obj, value); });
  4652. };
  4653. AsyncPipe.prototype._selectStrategy = function (obj) {
  4654. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisPromise"])(obj)) {
  4655. return _promiseStrategy;
  4656. }
  4657. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["ɵisObservable"])(obj)) {
  4658. return _observableStrategy;
  4659. }
  4660. throw invalidPipeArgumentError(AsyncPipe_1, obj);
  4661. };
  4662. AsyncPipe.prototype._dispose = function () {
  4663. this._strategy.dispose(this._subscription);
  4664. this._latestValue = null;
  4665. this._latestReturnedValue = null;
  4666. this._subscription = null;
  4667. this._obj = null;
  4668. };
  4669. AsyncPipe.prototype._updateLatestValue = function (async, value) {
  4670. if (async === this._obj) {
  4671. this._latestValue = value;
  4672. this._ref.markForCheck();
  4673. }
  4674. };
  4675. var AsyncPipe_1;
  4676. AsyncPipe = AsyncPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4677. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'async', pure: false }),
  4678. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"]])
  4679. ], AsyncPipe);
  4680. return AsyncPipe;
  4681. }());
  4682. /**
  4683. * @license
  4684. * Copyright Google Inc. All Rights Reserved.
  4685. *
  4686. * Use of this source code is governed by an MIT-style license that can be
  4687. * found in the LICENSE file at https://angular.io/license
  4688. */
  4689. /**
  4690. * Transforms text to all lower case.
  4691. *
  4692. * @see `UpperCasePipe`
  4693. * @see `TitleCasePipe`
  4694. * @usageNotes
  4695. *
  4696. * The following example defines a view that allows the user to enter
  4697. * text, and then uses the pipe to convert the input text to all lower case.
  4698. *
  4699. * <code-example path="common/pipes/ts/lowerupper_pipe.ts" region='LowerUpperPipe'></code-example>
  4700. *
  4701. * @ngModule CommonModule
  4702. */
  4703. var LowerCasePipe = /** @class */ (function () {
  4704. function LowerCasePipe() {
  4705. }
  4706. LowerCasePipe_1 = LowerCasePipe;
  4707. /**
  4708. * @param value The string to transform to lower case.
  4709. */
  4710. LowerCasePipe.prototype.transform = function (value) {
  4711. if (!value)
  4712. return value;
  4713. if (typeof value !== 'string') {
  4714. throw invalidPipeArgumentError(LowerCasePipe_1, value);
  4715. }
  4716. return value.toLowerCase();
  4717. };
  4718. var LowerCasePipe_1;
  4719. LowerCasePipe = LowerCasePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4720. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'lowercase' })
  4721. ], LowerCasePipe);
  4722. return LowerCasePipe;
  4723. }());
  4724. //
  4725. // Regex below matches any Unicode word and compatible with ES5. In ES2018 the same result
  4726. // can be achieved by using /\p{L}\S*/gu and also known as Unicode Property Escapes
  4727. // (http://2ality.com/2017/07/regexp-unicode-property-escapes.html). Since there is no
  4728. // transpilation of this functionality down to ES5 without external tool, the only solution is
  4729. // to use already transpiled form. Example can be found here -
  4730. // https://mothereff.in/regexpu#input=var+regex+%3D+/%5Cp%7BL%7D/u%3B&unicodePropertyEscape=1
  4731. //
  4732. var unicodeWordMatch = /(?:[A-Za-z\xAA\xB5\xBA\xC0-\xD6\xD8-\xF6\xF8-\u02C1\u02C6-\u02D1\u02E0-\u02E4\u02EC\u02EE\u0370-\u0374\u0376\u0377\u037A-\u037D\u037F\u0386\u0388-\u038A\u038C\u038E-\u03A1\u03A3-\u03F5\u03F7-\u0481\u048A-\u052F\u0531-\u0556\u0559\u0561-\u0587\u05D0-\u05EA\u05F0-\u05F2\u0620-\u064A\u066E\u066F\u0671-\u06D3\u06D5\u06E5\u06E6\u06EE\u06EF\u06FA-\u06FC\u06FF\u0710\u0712-\u072F\u074D-\u07A5\u07B1\u07CA-\u07EA\u07F4\u07F5\u07FA\u0800-\u0815\u081A\u0824\u0828\u0840-\u0858\u0860-\u086A\u08A0-\u08B4\u08B6-\u08BD\u0904-\u0939\u093D\u0950\u0958-\u0961\u0971-\u0980\u0985-\u098C\u098F\u0990\u0993-\u09A8\u09AA-\u09B0\u09B2\u09B6-\u09B9\u09BD\u09CE\u09DC\u09DD\u09DF-\u09E1\u09F0\u09F1\u09FC\u0A05-\u0A0A\u0A0F\u0A10\u0A13-\u0A28\u0A2A-\u0A30\u0A32\u0A33\u0A35\u0A36\u0A38\u0A39\u0A59-\u0A5C\u0A5E\u0A72-\u0A74\u0A85-\u0A8D\u0A8F-\u0A91\u0A93-\u0AA8\u0AAA-\u0AB0\u0AB2\u0AB3\u0AB5-\u0AB9\u0ABD\u0AD0\u0AE0\u0AE1\u0AF9\u0B05-\u0B0C\u0B0F\u0B10\u0B13-\u0B28\u0B2A-\u0B30\u0B32\u0B33\u0B35-\u0B39\u0B3D\u0B5C\u0B5D\u0B5F-\u0B61\u0B71\u0B83\u0B85-\u0B8A\u0B8E-\u0B90\u0B92-\u0B95\u0B99\u0B9A\u0B9C\u0B9E\u0B9F\u0BA3\u0BA4\u0BA8-\u0BAA\u0BAE-\u0BB9\u0BD0\u0C05-\u0C0C\u0C0E-\u0C10\u0C12-\u0C28\u0C2A-\u0C39\u0C3D\u0C58-\u0C5A\u0C60\u0C61\u0C80\u0C85-\u0C8C\u0C8E-\u0C90\u0C92-\u0CA8\u0CAA-\u0CB3\u0CB5-\u0CB9\u0CBD\u0CDE\u0CE0\u0CE1\u0CF1\u0CF2\u0D05-\u0D0C\u0D0E-\u0D10\u0D12-\u0D3A\u0D3D\u0D4E\u0D54-\u0D56\u0D5F-\u0D61\u0D7A-\u0D7F\u0D85-\u0D96\u0D9A-\u0DB1\u0DB3-\u0DBB\u0DBD\u0DC0-\u0DC6\u0E01-\u0E30\u0E32\u0E33\u0E40-\u0E46\u0E81\u0E82\u0E84\u0E87\u0E88\u0E8A\u0E8D\u0E94-\u0E97\u0E99-\u0E9F\u0EA1-\u0EA3\u0EA5\u0EA7\u0EAA\u0EAB\u0EAD-\u0EB0\u0EB2\u0EB3\u0EBD\u0EC0-\u0EC4\u0EC6\u0EDC-\u0EDF\u0F00\u0F40-\u0F47\u0F49-\u0F6C\u0F88-\u0F8C\u1000-\u102A\u103F\u1050-\u1055\u105A-\u105D\u1061\u1065\u1066\u106E-\u1070\u1075-\u1081\u108E\u10A0-\u10C5\u10C7\u10CD\u10D0-\u10FA\u10FC-\u1248\u124A-\u124D\u1250-\u1256\u1258\u125A-\u125D\u1260-\u1288\u128A-\u128D\u1290-\u12B0\u12B2-\u12B5\u12B8-\u12BE\u12C0\u12C2-\u12C5\u12C8-\u12D6\u12D8-\u1310\u1312-\u1315\u1318-\u135A\u1380-\u138F\u13A0-\u13F5\u13F8-\u13FD\u1401-\u166C\u166F-\u167F\u1681-\u169A\u16A0-\u16EA\u16F1-\u16F8\u1700-\u170C\u170E-\u1711\u1720-\u1731\u1740-\u1751\u1760-\u176C\u176E-\u1770\u1780-\u17B3\u17D7\u17DC\u1820-\u1877\u1880-\u1884\u1887-\u18A8\u18AA\u18B0-\u18F5\u1900-\u191E\u1950-\u196D\u1970-\u1974\u1980-\u19AB\u19B0-\u19C9\u1A00-\u1A16\u1A20-\u1A54\u1AA7\u1B05-\u1B33\u1B45-\u1B4B\u1B83-\u1BA0\u1BAE\u1BAF\u1BBA-\u1BE5\u1C00-\u1C23\u1C4D-\u1C4F\u1C5A-\u1C7D\u1C80-\u1C88\u1CE9-\u1CEC\u1CEE-\u1CF1\u1CF5\u1CF6\u1D00-\u1DBF\u1E00-\u1F15\u1F18-\u1F1D\u1F20-\u1F45\u1F48-\u1F4D\u1F50-\u1F57\u1F59\u1F5B\u1F5D\u1F5F-\u1F7D\u1F80-\u1FB4\u1FB6-\u1FBC\u1FBE\u1FC2-\u1FC4\u1FC6-\u1FCC\u1FD0-\u1FD3\u1FD6-\u1FDB\u1FE0-\u1FEC\u1FF2-\u1FF4\u1FF6-\u1FFC\u2071\u207F\u2090-\u209C\u2102\u2107\u210A-\u2113\u2115\u2119-\u211D\u2124\u2126\u2128\u212A-\u212D\u212F-\u2139\u213C-\u213F\u2145-\u2149\u214E\u2183\u2184\u2C00-\u2C2E\u2C30-\u2C5E\u2C60-\u2CE4\u2CEB-\u2CEE\u2CF2\u2CF3\u2D00-\u2D25\u2D27\u2D2D\u2D30-\u2D67\u2D6F\u2D80-\u2D96\u2DA0-\u2DA6\u2DA8-\u2DAE\u2DB0-\u2DB6\u2DB8-\u2DBE\u2DC0-\u2DC6\u2DC8-\u2DCE\u2DD0-\u2DD6\u2DD8-\u2DDE\u2E2F\u3005\u3006\u3031-\u3035\u303B\u303C\u3041-\u3096\u309D-\u309F\u30A1-\u30FA\u30FC-\u30FF\u3105-\u312E\u3131-\u318E\u31A0-\u31BA\u31F0-\u31FF\u3400-\u4DB5\u4E00-\u9FEA\uA000-\uA48C\uA4D0-\uA4FD\uA500-\uA60C\uA610-\uA61F\uA62A\uA62B\uA640-\uA66E\uA67F-\uA69D\uA6A0-\uA6E5\uA717-\uA71F\uA722-\uA788\uA78B-\uA7AE\uA7B0-\uA7B7\uA7F7-\uA801\uA803-\uA805\uA807-\uA80A\uA80C-\uA822\uA840-\uA873\uA882-\uA8B3\uA8F2-\uA8F7\uA8FB\uA8FD\uA90A-\uA925\uA930-\uA946\uA960-\uA97C\uA984-\uA9B2\uA9CF\uA9E0-\uA9E4\uA9E6-\uA9EF\uA9FA-\uA9FE\uAA00-\uAA28\uAA40-\uAA42\uAA44-\uAA4B\uAA60-\uAA76\uAA7A\uAA7E-\uAAAF\uAAB1\uAAB5\uAAB6\uAAB9-\uAABD\uAAC0\uAAC2\uAADB-\uAADD\uAAE0-\uAAEA\uAAF2-\uAAF4\uAB01-\uAB06\uAB09-\uAB0E\uAB11-\uAB16\uAB20-\uAB26\uAB28-\uAB2E\uAB30-\uAB5A\uAB5C-\uAB65\uAB70-\uABE2\uAC00-\uD7A3\uD7B0-\uD7C6\uD7CB-\uD7FB\uF900-\uFA6D\uFA70-\uFAD9\uFB00-\uFB06\uFB13-\uFB17\uFB1D\uFB1F-\uFB28\uFB2A-\uFB36\uFB38-\uFB3C\uFB3E\uFB40\uFB41\uFB43\uFB44\uFB46-\uFBB1\uFBD3-\uFD3D\uFD50-\uFD8F\uFD92-\uFDC7\uFDF0-\uFDFB\uFE70-\uFE74\uFE76-\uFEFC\uFF21-\uFF3A\uFF41-\uFF5A\uFF66-\uFFBE\uFFC2-\uFFC7\uFFCA-\uFFCF\uFFD2-\uFFD7\uFFDA-\uFFDC]|\uD800[\uDC00-\uDC0B\uDC0D-\uDC26\uDC28-\uDC3A\uDC3C\uDC3D\uDC3F-\uDC4D\uDC50-\uDC5D\uDC80-\uDCFA\uDE80-\uDE9C\uDEA0-\uDED0\uDF00-\uDF1F\uDF2D-\uDF40\uDF42-\uDF49\uDF50-\uDF75\uDF80-\uDF9D\uDFA0-\uDFC3\uDFC8-\uDFCF]|\uD801[\uDC00-\uDC9D\uDCB0-\uDCD3\uDCD8-\uDCFB\uDD00-\uDD27\uDD30-\uDD63\uDE00-\uDF36\uDF40-\uDF55\uDF60-\uDF67]|\uD802[\uDC00-\uDC05\uDC08\uDC0A-\uDC35\uDC37\uDC38\uDC3C\uDC3F-\uDC55\uDC60-\uDC76\uDC80-\uDC9E\uDCE0-\uDCF2\uDCF4\uDCF5\uDD00-\uDD15\uDD20-\uDD39\uDD80-\uDDB7\uDDBE\uDDBF\uDE00\uDE10-\uDE13\uDE15-\uDE17\uDE19-\uDE33\uDE60-\uDE7C\uDE80-\uDE9C\uDEC0-\uDEC7\uDEC9-\uDEE4\uDF00-\uDF35\uDF40-\uDF55\uDF60-\uDF72\uDF80-\uDF91]|\uD803[\uDC00-\uDC48\uDC80-\uDCB2\uDCC0-\uDCF2]|\uD804[\uDC03-\uDC37\uDC83-\uDCAF\uDCD0-\uDCE8\uDD03-\uDD26\uDD50-\uDD72\uDD76\uDD83-\uDDB2\uDDC1-\uDDC4\uDDDA\uDDDC\uDE00-\uDE11\uDE13-\uDE2B\uDE80-\uDE86\uDE88\uDE8A-\uDE8D\uDE8F-\uDE9D\uDE9F-\uDEA8\uDEB0-\uDEDE\uDF05-\uDF0C\uDF0F\uDF10\uDF13-\uDF28\uDF2A-\uDF30\uDF32\uDF33\uDF35-\uDF39\uDF3D\uDF50\uDF5D-\uDF61]|\uD805[\uDC00-\uDC34\uDC47-\uDC4A\uDC80-\uDCAF\uDCC4\uDCC5\uDCC7\uDD80-\uDDAE\uDDD8-\uDDDB\uDE00-\uDE2F\uDE44\uDE80-\uDEAA\uDF00-\uDF19]|\uD806[\uDCA0-\uDCDF\uDCFF\uDE00\uDE0B-\uDE32\uDE3A\uDE50\uDE5C-\uDE83\uDE86-\uDE89\uDEC0-\uDEF8]|\uD807[\uDC00-\uDC08\uDC0A-\uDC2E\uDC40\uDC72-\uDC8F\uDD00-\uDD06\uDD08\uDD09\uDD0B-\uDD30\uDD46]|\uD808[\uDC00-\uDF99]|\uD809[\uDC80-\uDD43]|[\uD80C\uD81C-\uD820\uD840-\uD868\uD86A-\uD86C\uD86F-\uD872\uD874-\uD879][\uDC00-\uDFFF]|\uD80D[\uDC00-\uDC2E]|\uD811[\uDC00-\uDE46]|\uD81A[\uDC00-\uDE38\uDE40-\uDE5E\uDED0-\uDEED\uDF00-\uDF2F\uDF40-\uDF43\uDF63-\uDF77\uDF7D-\uDF8F]|\uD81B[\uDF00-\uDF44\uDF50\uDF93-\uDF9F\uDFE0\uDFE1]|\uD821[\uDC00-\uDFEC]|\uD822[\uDC00-\uDEF2]|\uD82C[\uDC00-\uDD1E\uDD70-\uDEFB]|\uD82F[\uDC00-\uDC6A\uDC70-\uDC7C\uDC80-\uDC88\uDC90-\uDC99]|\uD835[\uDC00-\uDC54\uDC56-\uDC9C\uDC9E\uDC9F\uDCA2\uDCA5\uDCA6\uDCA9-\uDCAC\uDCAE-\uDCB9\uDCBB\uDCBD-\uDCC3\uDCC5-\uDD05\uDD07-\uDD0A\uDD0D-\uDD14\uDD16-\uDD1C\uDD1E-\uDD39\uDD3B-\uDD3E\uDD40-\uDD44\uDD46\uDD4A-\uDD50\uDD52-\uDEA5\uDEA8-\uDEC0\uDEC2-\uDEDA\uDEDC-\uDEFA\uDEFC-\uDF14\uDF16-\uDF34\uDF36-\uDF4E\uDF50-\uDF6E\uDF70-\uDF88\uDF8A-\uDFA8\uDFAA-\uDFC2\uDFC4-\uDFCB]|\uD83A[\uDC00-\uDCC4\uDD00-\uDD43]|\uD83B[\uDE00-\uDE03\uDE05-\uDE1F\uDE21\uDE22\uDE24\uDE27\uDE29-\uDE32\uDE34-\uDE37\uDE39\uDE3B\uDE42\uDE47\uDE49\uDE4B\uDE4D-\uDE4F\uDE51\uDE52\uDE54\uDE57\uDE59\uDE5B\uDE5D\uDE5F\uDE61\uDE62\uDE64\uDE67-\uDE6A\uDE6C-\uDE72\uDE74-\uDE77\uDE79-\uDE7C\uDE7E\uDE80-\uDE89\uDE8B-\uDE9B\uDEA1-\uDEA3\uDEA5-\uDEA9\uDEAB-\uDEBB]|\uD869[\uDC00-\uDED6\uDF00-\uDFFF]|\uD86D[\uDC00-\uDF34\uDF40-\uDFFF]|\uD86E[\uDC00-\uDC1D\uDC20-\uDFFF]|\uD873[\uDC00-\uDEA1\uDEB0-\uDFFF]|\uD87A[\uDC00-\uDFE0]|\uD87E[\uDC00-\uDE1D])\S*/g;
  4733. /**
  4734. * Transforms text to title case.
  4735. * Capitalizes the first letter of each word, and transforms the
  4736. * rest of the word to lower case.
  4737. * Words are delimited by any whitespace character, such as a space, tab, or line-feed character.
  4738. *
  4739. * @see `LowerCasePipe`
  4740. * @see `UpperCasePipe`
  4741. *
  4742. * @usageNotes
  4743. * The following example shows the result of transforming various strings into title case.
  4744. *
  4745. * <code-example path="common/pipes/ts/titlecase_pipe.ts" region='TitleCasePipe'></code-example>
  4746. *
  4747. * @ngModule CommonModule
  4748. */
  4749. var TitleCasePipe = /** @class */ (function () {
  4750. function TitleCasePipe() {
  4751. }
  4752. TitleCasePipe_1 = TitleCasePipe;
  4753. /**
  4754. * @param value The string to transform to title case.
  4755. */
  4756. TitleCasePipe.prototype.transform = function (value) {
  4757. if (!value)
  4758. return value;
  4759. if (typeof value !== 'string') {
  4760. throw invalidPipeArgumentError(TitleCasePipe_1, value);
  4761. }
  4762. return value.replace(unicodeWordMatch, (function (txt) { return txt[0].toUpperCase() + txt.substr(1).toLowerCase(); }));
  4763. };
  4764. var TitleCasePipe_1;
  4765. TitleCasePipe = TitleCasePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4766. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'titlecase' })
  4767. ], TitleCasePipe);
  4768. return TitleCasePipe;
  4769. }());
  4770. /**
  4771. * Transforms text to all upper case.
  4772. * @see `LowerCasePipe`
  4773. * @see `TitleCasePipe`
  4774. *
  4775. * @ngModule CommonModule
  4776. */
  4777. var UpperCasePipe = /** @class */ (function () {
  4778. function UpperCasePipe() {
  4779. }
  4780. UpperCasePipe_1 = UpperCasePipe;
  4781. /**
  4782. * @param value The string to transform to upper case.
  4783. */
  4784. UpperCasePipe.prototype.transform = function (value) {
  4785. if (!value)
  4786. return value;
  4787. if (typeof value !== 'string') {
  4788. throw invalidPipeArgumentError(UpperCasePipe_1, value);
  4789. }
  4790. return value.toUpperCase();
  4791. };
  4792. var UpperCasePipe_1;
  4793. UpperCasePipe = UpperCasePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4794. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'uppercase' })
  4795. ], UpperCasePipe);
  4796. return UpperCasePipe;
  4797. }());
  4798. /**
  4799. * @license
  4800. * Copyright Google Inc. All Rights Reserved.
  4801. *
  4802. * Use of this source code is governed by an MIT-style license that can be
  4803. * found in the LICENSE file at https://angular.io/license
  4804. */
  4805. // clang-format off
  4806. /**
  4807. * @ngModule CommonModule
  4808. * @description
  4809. *
  4810. * Formats a date value according to locale rules.
  4811. *
  4812. * Only the `en-US` locale data comes with Angular. To localize dates
  4813. * in another language, you must import the corresponding locale data.
  4814. * See the [I18n guide](guide/i18n#i18n-pipes) for more information.
  4815. *
  4816. * @see `formatDate()`
  4817. *
  4818. *
  4819. * @usageNotes
  4820. *
  4821. * The result of this pipe is not reevaluated when the input is mutated. To avoid the need to
  4822. * reformat the date on every change-detection cycle, treat the date as an immutable object
  4823. * and change the reference when the pipe needs to run again.
  4824. *
  4825. * ### Pre-defined format options
  4826. *
  4827. * Examples are given in `en-US` locale.
  4828. *
  4829. * - `'short'`: equivalent to `'M/d/yy, h:mm a'` (`6/15/15, 9:03 AM`).
  4830. * - `'medium'`: equivalent to `'MMM d, y, h:mm:ss a'` (`Jun 15, 2015, 9:03:01 AM`).
  4831. * - `'long'`: equivalent to `'MMMM d, y, h:mm:ss a z'` (`June 15, 2015 at 9:03:01 AM
  4832. * GMT+1`).
  4833. * - `'full'`: equivalent to `'EEEE, MMMM d, y, h:mm:ss a zzzz'` (`Monday, June 15, 2015 at
  4834. * 9:03:01 AM GMT+01:00`).
  4835. * - `'shortDate'`: equivalent to `'M/d/yy'` (`6/15/15`).
  4836. * - `'mediumDate'`: equivalent to `'MMM d, y'` (`Jun 15, 2015`).
  4837. * - `'longDate'`: equivalent to `'MMMM d, y'` (`June 15, 2015`).
  4838. * - `'fullDate'`: equivalent to `'EEEE, MMMM d, y'` (`Monday, June 15, 2015`).
  4839. * - `'shortTime'`: equivalent to `'h:mm a'` (`9:03 AM`).
  4840. * - `'mediumTime'`: equivalent to `'h:mm:ss a'` (`9:03:01 AM`).
  4841. * - `'longTime'`: equivalent to `'h:mm:ss a z'` (`9:03:01 AM GMT+1`).
  4842. * - `'fullTime'`: equivalent to `'h:mm:ss a zzzz'` (`9:03:01 AM GMT+01:00`).
  4843. *
  4844. * ### Custom format options
  4845. *
  4846. * You can construct a format string using symbols to specify the components
  4847. * of a date-time value, as described in the following table.
  4848. * Format details depend on the locale.
  4849. * Fields marked with (*) are only available in the extra data set for the given locale.
  4850. *
  4851. * | Field type | Format | Description | Example Value |
  4852. * |--------------------|-------------|---------------------------------------------------------------|------------------------------------------------------------|
  4853. * | Era | G, GG & GGG | Abbreviated | AD |
  4854. * | | GGGG | Wide | Anno Domini |
  4855. * | | GGGGG | Narrow | A |
  4856. * | Year | y | Numeric: minimum digits | 2, 20, 201, 2017, 20173 |
  4857. * | | yy | Numeric: 2 digits + zero padded | 02, 20, 01, 17, 73 |
  4858. * | | yyy | Numeric: 3 digits + zero padded | 002, 020, 201, 2017, 20173 |
  4859. * | | yyyy | Numeric: 4 digits or more + zero padded | 0002, 0020, 0201, 2017, 20173 |
  4860. * | Month | M | Numeric: 1 digit | 9, 12 |
  4861. * | | MM | Numeric: 2 digits + zero padded | 09, 12 |
  4862. * | | MMM | Abbreviated | Sep |
  4863. * | | MMMM | Wide | September |
  4864. * | | MMMMM | Narrow | S |
  4865. * | Month standalone | L | Numeric: 1 digit | 9, 12 |
  4866. * | | LL | Numeric: 2 digits + zero padded | 09, 12 |
  4867. * | | LLL | Abbreviated | Sep |
  4868. * | | LLLL | Wide | September |
  4869. * | | LLLLL | Narrow | S |
  4870. * | Week of year | w | Numeric: minimum digits | 1... 53 |
  4871. * | | ww | Numeric: 2 digits + zero padded | 01... 53 |
  4872. * | Week of month | W | Numeric: 1 digit | 1... 5 |
  4873. * | Day of month | d | Numeric: minimum digits | 1 |
  4874. * | | dd | Numeric: 2 digits + zero padded | 01 |
  4875. * | Week day | E, EE & EEE | Abbreviated | Tue |
  4876. * | | EEEE | Wide | Tuesday |
  4877. * | | EEEEE | Narrow | T |
  4878. * | | EEEEEE | Short | Tu |
  4879. * | Period | a, aa & aaa | Abbreviated | am/pm or AM/PM |
  4880. * | | aaaa | Wide (fallback to `a` when missing) | ante meridiem/post meridiem |
  4881. * | | aaaaa | Narrow | a/p |
  4882. * | Period* | B, BB & BBB | Abbreviated | mid. |
  4883. * | | BBBB | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  4884. * | | BBBBB | Narrow | md |
  4885. * | Period standalone* | b, bb & bbb | Abbreviated | mid. |
  4886. * | | bbbb | Wide | am, pm, midnight, noon, morning, afternoon, evening, night |
  4887. * | | bbbbb | Narrow | md |
  4888. * | Hour 1-12 | h | Numeric: minimum digits | 1, 12 |
  4889. * | | hh | Numeric: 2 digits + zero padded | 01, 12 |
  4890. * | Hour 0-23 | H | Numeric: minimum digits | 0, 23 |
  4891. * | | HH | Numeric: 2 digits + zero padded | 00, 23 |
  4892. * | Minute | m | Numeric: minimum digits | 8, 59 |
  4893. * | | mm | Numeric: 2 digits + zero padded | 08, 59 |
  4894. * | Second | s | Numeric: minimum digits | 0... 59 |
  4895. * | | ss | Numeric: 2 digits + zero padded | 00... 59 |
  4896. * | Fractional seconds | S | Numeric: 1 digit | 0... 9 |
  4897. * | | SS | Numeric: 2 digits + zero padded | 00... 99 |
  4898. * | | SSS | Numeric: 3 digits + zero padded (= milliseconds) | 000... 999 |
  4899. * | Zone | z, zz & zzz | Short specific non location format (fallback to O) | GMT-8 |
  4900. * | | zzzz | Long specific non location format (fallback to OOOO) | GMT-08:00 |
  4901. * | | Z, ZZ & ZZZ | ISO8601 basic format | -0800 |
  4902. * | | ZZZZ | Long localized GMT format | GMT-8:00 |
  4903. * | | ZZZZZ | ISO8601 extended format + Z indicator for offset 0 (= XXXXX) | -08:00 |
  4904. * | | O, OO & OOO | Short localized GMT format | GMT-8 |
  4905. * | | OOOO | Long localized GMT format | GMT-08:00 |
  4906. *
  4907. * Note that timezone correction is not applied to an ISO string that has no time component, such as "2016-09-19"
  4908. *
  4909. * ### Format examples
  4910. *
  4911. * These examples transform a date into various formats,
  4912. * assuming that `dateObj` is a JavaScript `Date` object for
  4913. * year: 2015, month: 6, day: 15, hour: 21, minute: 43, second: 11,
  4914. * given in the local time for the `en-US` locale.
  4915. *
  4916. * ```
  4917. * {{ dateObj | date }} // output is 'Jun 15, 2015'
  4918. * {{ dateObj | date:'medium' }} // output is 'Jun 15, 2015, 9:43:11 PM'
  4919. * {{ dateObj | date:'shortTime' }} // output is '9:43 PM'
  4920. * {{ dateObj | date:'mmss' }} // output is '43:11'
  4921. * ```
  4922. *
  4923. * ### Usage example
  4924. *
  4925. * The following component uses a date pipe to display the current date in different formats.
  4926. *
  4927. * ```
  4928. * @Component({
  4929. * selector: 'date-pipe',
  4930. * template: `<div>
  4931. * <p>Today is {{today | date}}</p>
  4932. * <p>Or if you prefer, {{today | date:'fullDate'}}</p>
  4933. * <p>The time is {{today | date:'h:mm a z'}}</p>
  4934. * </div>`
  4935. * })
  4936. * // Get the current date and time as a date-time value.
  4937. * export class DatePipeComponent {
  4938. * today: number = Date.now();
  4939. * }
  4940. * ```
  4941. *
  4942. */
  4943. // clang-format on
  4944. var DatePipe = /** @class */ (function () {
  4945. function DatePipe(locale) {
  4946. this.locale = locale;
  4947. }
  4948. DatePipe_1 = DatePipe;
  4949. /**
  4950. * @param value The date expression: a `Date` object, a number
  4951. * (milliseconds since UTC epoch), or an ISO string (https://www.w3.org/TR/NOTE-datetime).
  4952. * @param format The date/time components to include, using predefined options or a
  4953. * custom format string.
  4954. * @param timezone A timezone offset (such as `'+0430'`), or a standard
  4955. * UTC/GMT or continental US timezone abbreviation. Default is
  4956. * the local system timezone of the end-user's machine.
  4957. * @param locale A locale code for the locale format rules to use.
  4958. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  4959. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
  4960. * @returns A date string in the desired format.
  4961. */
  4962. DatePipe.prototype.transform = function (value, format, timezone, locale) {
  4963. if (format === void 0) { format = 'mediumDate'; }
  4964. if (value == null || value === '' || value !== value)
  4965. return null;
  4966. try {
  4967. return formatDate(value, format, locale || this.locale, timezone);
  4968. }
  4969. catch (error) {
  4970. throw invalidPipeArgumentError(DatePipe_1, error.message);
  4971. }
  4972. };
  4973. var DatePipe_1;
  4974. DatePipe = DatePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  4975. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'date', pure: true }),
  4976. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  4977. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  4978. ], DatePipe);
  4979. return DatePipe;
  4980. }());
  4981. /**
  4982. * @license
  4983. * Copyright Google Inc. All Rights Reserved.
  4984. *
  4985. * Use of this source code is governed by an MIT-style license that can be
  4986. * found in the LICENSE file at https://angular.io/license
  4987. */
  4988. var _INTERPOLATION_REGEXP = /#/g;
  4989. /**
  4990. * @ngModule CommonModule
  4991. * @description
  4992. *
  4993. * Maps a value to a string that pluralizes the value according to locale rules.
  4994. *
  4995. * @usageNotes
  4996. *
  4997. * ### Example
  4998. *
  4999. * {@example common/pipes/ts/i18n_pipe.ts region='I18nPluralPipeComponent'}
  5000. *
  5001. * @experimental
  5002. */
  5003. var I18nPluralPipe = /** @class */ (function () {
  5004. function I18nPluralPipe(_localization) {
  5005. this._localization = _localization;
  5006. }
  5007. I18nPluralPipe_1 = I18nPluralPipe;
  5008. /**
  5009. * @param value the number to be formatted
  5010. * @param pluralMap an object that mimics the ICU format, see
  5011. * http://userguide.icu-project.org/formatparse/messages.
  5012. * @param locale a `string` defining the locale to use (uses the current {@link LOCALE_ID} by
  5013. * default).
  5014. */
  5015. I18nPluralPipe.prototype.transform = function (value, pluralMap, locale) {
  5016. if (value == null)
  5017. return '';
  5018. if (typeof pluralMap !== 'object' || pluralMap === null) {
  5019. throw invalidPipeArgumentError(I18nPluralPipe_1, pluralMap);
  5020. }
  5021. var key = getPluralCategory(value, Object.keys(pluralMap), this._localization, locale);
  5022. return pluralMap[key].replace(_INTERPOLATION_REGEXP, value.toString());
  5023. };
  5024. var I18nPluralPipe_1;
  5025. I18nPluralPipe = I18nPluralPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5026. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'i18nPlural', pure: true }),
  5027. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [NgLocalization])
  5028. ], I18nPluralPipe);
  5029. return I18nPluralPipe;
  5030. }());
  5031. /**
  5032. * @license
  5033. * Copyright Google Inc. All Rights Reserved.
  5034. *
  5035. * Use of this source code is governed by an MIT-style license that can be
  5036. * found in the LICENSE file at https://angular.io/license
  5037. */
  5038. /**
  5039. * @ngModule CommonModule
  5040. * @description
  5041. *
  5042. * Generic selector that displays the string that matches the current value.
  5043. *
  5044. * If none of the keys of the `mapping` match the `value`, then the content
  5045. * of the `other` key is returned when present, otherwise an empty string is returned.
  5046. *
  5047. * @usageNotes
  5048. *
  5049. * ### Example
  5050. *
  5051. * {@example common/pipes/ts/i18n_pipe.ts region='I18nSelectPipeComponent'}
  5052. *
  5053. * @experimental
  5054. */
  5055. var I18nSelectPipe = /** @class */ (function () {
  5056. function I18nSelectPipe() {
  5057. }
  5058. I18nSelectPipe_1 = I18nSelectPipe;
  5059. /**
  5060. * @param value a string to be internationalized.
  5061. * @param mapping an object that indicates the text that should be displayed
  5062. * for different values of the provided `value`.
  5063. */
  5064. I18nSelectPipe.prototype.transform = function (value, mapping) {
  5065. if (value == null)
  5066. return '';
  5067. if (typeof mapping !== 'object' || typeof value !== 'string') {
  5068. throw invalidPipeArgumentError(I18nSelectPipe_1, mapping);
  5069. }
  5070. if (mapping.hasOwnProperty(value)) {
  5071. return mapping[value];
  5072. }
  5073. if (mapping.hasOwnProperty('other')) {
  5074. return mapping['other'];
  5075. }
  5076. return '';
  5077. };
  5078. var I18nSelectPipe_1;
  5079. I18nSelectPipe = I18nSelectPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5080. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'i18nSelect', pure: true })
  5081. ], I18nSelectPipe);
  5082. return I18nSelectPipe;
  5083. }());
  5084. /**
  5085. * @license
  5086. * Copyright Google Inc. All Rights Reserved.
  5087. *
  5088. * Use of this source code is governed by an MIT-style license that can be
  5089. * found in the LICENSE file at https://angular.io/license
  5090. */
  5091. /**
  5092. * @ngModule CommonModule
  5093. * @description
  5094. *
  5095. * Converts a value into its JSON-format representation. Useful for debugging.
  5096. *
  5097. * @usageNotes
  5098. *
  5099. * The following component uses a JSON pipe to convert an object
  5100. * to JSON format, and displays the string in both formats for comparison.
  5101. *
  5102. * {@example common/pipes/ts/json_pipe.ts region='JsonPipe'}
  5103. *
  5104. */
  5105. var JsonPipe = /** @class */ (function () {
  5106. function JsonPipe() {
  5107. }
  5108. /**
  5109. * @param value A value of any type to convert into a JSON-format string.
  5110. */
  5111. JsonPipe.prototype.transform = function (value) { return JSON.stringify(value, null, 2); };
  5112. JsonPipe = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5113. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'json', pure: false })
  5114. ], JsonPipe);
  5115. return JsonPipe;
  5116. }());
  5117. /**
  5118. * @license
  5119. * Copyright Google Inc. All Rights Reserved.
  5120. *
  5121. * Use of this source code is governed by an MIT-style license that can be
  5122. * found in the LICENSE file at https://angular.io/license
  5123. */
  5124. function makeKeyValuePair(key, value) {
  5125. return { key: key, value: value };
  5126. }
  5127. /**
  5128. * @ngModule CommonModule
  5129. * @description
  5130. *
  5131. * Transforms Object or Map into an array of key value pairs.
  5132. *
  5133. * The output array will be ordered by keys.
  5134. * By default the comparator will be by Unicode point value.
  5135. * You can optionally pass a compareFn if your keys are complex types.
  5136. *
  5137. * @usageNotes
  5138. * ### Examples
  5139. *
  5140. * This examples show how an Object or a Map and be iterated by ngFor with the use of this keyvalue
  5141. * pipe.
  5142. *
  5143. * {@example common/pipes/ts/keyvalue_pipe.ts region='KeyValuePipe'}
  5144. */
  5145. var KeyValuePipe = /** @class */ (function () {
  5146. function KeyValuePipe(differs) {
  5147. this.differs = differs;
  5148. }
  5149. KeyValuePipe.prototype.transform = function (input, compareFn) {
  5150. var _this = this;
  5151. if (compareFn === void 0) { compareFn = defaultComparator; }
  5152. if (!input || (!(input instanceof Map) && typeof input !== 'object')) {
  5153. return null;
  5154. }
  5155. if (!this.differ) {
  5156. // make a differ for whatever type we've been passed in
  5157. this.differ = this.differs.find(input).create();
  5158. }
  5159. var differChanges = this.differ.diff(input);
  5160. if (differChanges) {
  5161. this.keyValues = [];
  5162. differChanges.forEachItem(function (r) {
  5163. _this.keyValues.push(makeKeyValuePair(r.key, r.currentValue));
  5164. });
  5165. this.keyValues.sort(compareFn);
  5166. }
  5167. return this.keyValues;
  5168. };
  5169. KeyValuePipe = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5170. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'keyvalue', pure: false }),
  5171. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_0__["KeyValueDiffers"]])
  5172. ], KeyValuePipe);
  5173. return KeyValuePipe;
  5174. }());
  5175. function defaultComparator(keyValueA, keyValueB) {
  5176. var a = keyValueA.key;
  5177. var b = keyValueB.key;
  5178. // if same exit with 0;
  5179. if (a === b)
  5180. return 0;
  5181. // make sure that undefined are at the end of the sort.
  5182. if (a === undefined)
  5183. return 1;
  5184. if (b === undefined)
  5185. return -1;
  5186. // make sure that nulls are at the end of the sort.
  5187. if (a === null)
  5188. return 1;
  5189. if (b === null)
  5190. return -1;
  5191. if (typeof a == 'string' && typeof b == 'string') {
  5192. return a < b ? -1 : 1;
  5193. }
  5194. if (typeof a == 'number' && typeof b == 'number') {
  5195. return a - b;
  5196. }
  5197. if (typeof a == 'boolean' && typeof b == 'boolean') {
  5198. return a < b ? -1 : 1;
  5199. }
  5200. // `a` and `b` are of different types. Compare their string values.
  5201. var aString = String(a);
  5202. var bString = String(b);
  5203. return aString == bString ? 0 : aString < bString ? -1 : 1;
  5204. }
  5205. /**
  5206. * @license
  5207. * Copyright Google Inc. All Rights Reserved.
  5208. *
  5209. * Use of this source code is governed by an MIT-style license that can be
  5210. * found in the LICENSE file at https://angular.io/license
  5211. */
  5212. /**
  5213. * @ngModule CommonModule
  5214. * @description
  5215. *
  5216. * Transforms a number into a string,
  5217. * formatted according to locale rules that determine group sizing and
  5218. * separator, decimal-point character, and other locale-specific
  5219. * configurations.
  5220. *
  5221. * If no parameters are specified, the function rounds off to the nearest value using this
  5222. * [rounding method](https://en.wikibooks.org/wiki/Arithmetic/Rounding).
  5223. * The behavior differs from that of the JavaScript ```Math.round()``` function.
  5224. * In the following case for example, the pipe rounds down where
  5225. * ```Math.round()``` rounds up:
  5226. *
  5227. * ```html
  5228. * -2.5 | number:'1.0-0'
  5229. * > -3
  5230. * Math.round(-2.5)
  5231. * > -2
  5232. * ```
  5233. *
  5234. * @see `formatNumber()`
  5235. *
  5236. * @usageNotes
  5237. * The following code shows how the pipe transforms numbers
  5238. * into text strings, according to various format specifications,
  5239. * where the caller's default locale is `en-US`.
  5240. *
  5241. * ### Example
  5242. *
  5243. * <code-example path="common/pipes/ts/number_pipe.ts" region='NumberPipe'></code-example>
  5244. *
  5245. */
  5246. var DecimalPipe = /** @class */ (function () {
  5247. function DecimalPipe(_locale) {
  5248. this._locale = _locale;
  5249. }
  5250. DecimalPipe_1 = DecimalPipe;
  5251. /**
  5252. * @param value The number to be formatted.
  5253. * @param digitsInfo Decimal representation options, specified by a string
  5254. * in the following format:<br>
  5255. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
  5256. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
  5257. * Default is `1`.
  5258. * - `minFractionDigits`: The minimum number of digits after the decimal point.
  5259. * Default is `0`.
  5260. * - `maxFractionDigits`: The maximum number of digits after the decimal point.
  5261. * Default is `3`.
  5262. * @param locale A locale code for the locale format rules to use.
  5263. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  5264. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
  5265. */
  5266. DecimalPipe.prototype.transform = function (value, digitsInfo, locale) {
  5267. if (isEmpty(value))
  5268. return null;
  5269. locale = locale || this._locale;
  5270. try {
  5271. var num = strToNumber(value);
  5272. return formatNumber(num, locale, digitsInfo);
  5273. }
  5274. catch (error) {
  5275. throw invalidPipeArgumentError(DecimalPipe_1, error.message);
  5276. }
  5277. };
  5278. var DecimalPipe_1;
  5279. DecimalPipe = DecimalPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5280. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'number' }),
  5281. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  5282. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  5283. ], DecimalPipe);
  5284. return DecimalPipe;
  5285. }());
  5286. /**
  5287. * @ngModule CommonModule
  5288. * @description
  5289. *
  5290. * Transforms a number to a percentage
  5291. * string, formatted according to locale rules that determine group sizing and
  5292. * separator, decimal-point character, and other locale-specific
  5293. * configurations.
  5294. *
  5295. * @see `formatPercent()`
  5296. *
  5297. * @usageNotes
  5298. * The following code shows how the pipe transforms numbers
  5299. * into text strings, according to various format specifications,
  5300. * where the caller's default locale is `en-US`.
  5301. *
  5302. * <code-example path="common/pipes/ts/percent_pipe.ts" region='PercentPipe'></code-example>
  5303. *
  5304. *
  5305. */
  5306. var PercentPipe = /** @class */ (function () {
  5307. function PercentPipe(_locale) {
  5308. this._locale = _locale;
  5309. }
  5310. PercentPipe_1 = PercentPipe;
  5311. /**
  5312. *
  5313. * @param value The number to be formatted as a percentage.
  5314. * @param digitsInfo Decimal representation options, specified by a string
  5315. * in the following format:<br>
  5316. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
  5317. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
  5318. * Default is `1`.
  5319. * - `minFractionDigits`: The minimum number of digits after the decimal point.
  5320. * Default is `0`.
  5321. * - `maxFractionDigits`: The maximum number of digits after the decimal point.
  5322. * Default is `3`.
  5323. * @param locale A locale code for the locale format rules to use.
  5324. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  5325. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
  5326. */
  5327. PercentPipe.prototype.transform = function (value, digitsInfo, locale) {
  5328. if (isEmpty(value))
  5329. return null;
  5330. locale = locale || this._locale;
  5331. try {
  5332. var num = strToNumber(value);
  5333. return formatPercent(num, locale, digitsInfo);
  5334. }
  5335. catch (error) {
  5336. throw invalidPipeArgumentError(PercentPipe_1, error.message);
  5337. }
  5338. };
  5339. var PercentPipe_1;
  5340. PercentPipe = PercentPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5341. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'percent' }),
  5342. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  5343. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  5344. ], PercentPipe);
  5345. return PercentPipe;
  5346. }());
  5347. /**
  5348. * @ngModule CommonModule
  5349. * @description
  5350. *
  5351. * Transforms a number to a currency string, formatted according to locale rules
  5352. * that determine group sizing and separator, decimal-point character,
  5353. * and other locale-specific configurations.
  5354. *
  5355. * @see `getCurrencySymbol()`
  5356. * @see `formatCurrency()`
  5357. *
  5358. * @usageNotes
  5359. * The following code shows how the pipe transforms numbers
  5360. * into text strings, according to various format specifications,
  5361. * where the caller's default locale is `en-US`.
  5362. *
  5363. * <code-example path="common/pipes/ts/currency_pipe.ts" region='CurrencyPipe'></code-example>
  5364. *
  5365. *
  5366. */
  5367. var CurrencyPipe = /** @class */ (function () {
  5368. function CurrencyPipe(_locale) {
  5369. this._locale = _locale;
  5370. }
  5371. CurrencyPipe_1 = CurrencyPipe;
  5372. /**
  5373. *
  5374. * @param value The number to be formatted as currency.
  5375. * @param currencyCode The [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) currency code,
  5376. * such as `USD` for the US dollar and `EUR` for the euro.
  5377. * @param display The format for the currency indicator. One of the following:
  5378. * - `code`: Show the code (such as `USD`).
  5379. * - `symbol`(default): Show the symbol (such as `$`).
  5380. * - `symbol-narrow`: Use the narrow symbol for locales that have two symbols for their
  5381. * currency.
  5382. * For example, the Canadian dollar CAD has the symbol `CA$` and the symbol-narrow `$`. If the
  5383. * locale has no narrow symbol, uses the standard symbol for the locale.
  5384. * - String: Use the given string value instead of a code or a symbol.
  5385. * For example, an empty string will suppress the currency & symbol.
  5386. * - Boolean (marked deprecated in v5): `true` for symbol and false for `code`.
  5387. *
  5388. * @param digitsInfo Decimal representation options, specified by a string
  5389. * in the following format:<br>
  5390. * <code>{minIntegerDigits}.{minFractionDigits}-{maxFractionDigits}</code>.
  5391. * - `minIntegerDigits`: The minimum number of integer digits before the decimal point.
  5392. * Default is `1`.
  5393. * - `minFractionDigits`: The minimum number of digits after the decimal point.
  5394. * Default is `0`.
  5395. * - `maxFractionDigits`: The maximum number of digits after the decimal point.
  5396. * Default is `3`.
  5397. * If not provided, the number will be formatted with the proper amount of digits,
  5398. * depending on what the [ISO 4217](https://en.wikipedia.org/wiki/ISO_4217) specifies.
  5399. * For example, the Canadian dollar has 2 digits, whereas the Chilean peso has none.
  5400. * @param locale A locale code for the locale format rules to use.
  5401. * When not supplied, uses the value of `LOCALE_ID`, which is `en-US` by default.
  5402. * See [Setting your app locale](guide/i18n#setting-up-the-locale-of-your-app).
  5403. */
  5404. CurrencyPipe.prototype.transform = function (value, currencyCode, display, digitsInfo, locale) {
  5405. if (display === void 0) { display = 'symbol'; }
  5406. if (isEmpty(value))
  5407. return null;
  5408. locale = locale || this._locale;
  5409. if (typeof display === 'boolean') {
  5410. if (console && console.warn) {
  5411. 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\".");
  5412. }
  5413. display = display ? 'symbol' : 'code';
  5414. }
  5415. var currency = currencyCode || 'USD';
  5416. if (display !== 'code') {
  5417. if (display === 'symbol' || display === 'symbol-narrow') {
  5418. currency = getCurrencySymbol(currency, display === 'symbol' ? 'wide' : 'narrow', locale);
  5419. }
  5420. else {
  5421. currency = display;
  5422. }
  5423. }
  5424. try {
  5425. var num = strToNumber(value);
  5426. return formatCurrency(num, locale, currency, currencyCode, digitsInfo);
  5427. }
  5428. catch (error) {
  5429. throw invalidPipeArgumentError(CurrencyPipe_1, error.message);
  5430. }
  5431. };
  5432. var CurrencyPipe_1;
  5433. CurrencyPipe = CurrencyPipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5434. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'currency' }),
  5435. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_0__["LOCALE_ID"])),
  5436. Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__metadata"])("design:paramtypes", [String])
  5437. ], CurrencyPipe);
  5438. return CurrencyPipe;
  5439. }());
  5440. function isEmpty(value) {
  5441. return value == null || value === '' || value !== value;
  5442. }
  5443. /**
  5444. * Transforms a string into a number (if needed).
  5445. */
  5446. function strToNumber(value) {
  5447. // Convert strings to numbers
  5448. if (typeof value === 'string' && !isNaN(Number(value) - parseFloat(value))) {
  5449. return Number(value);
  5450. }
  5451. if (typeof value !== 'number') {
  5452. throw new Error(value + " is not a number");
  5453. }
  5454. return value;
  5455. }
  5456. /**
  5457. * @license
  5458. * Copyright Google Inc. All Rights Reserved.
  5459. *
  5460. * Use of this source code is governed by an MIT-style license that can be
  5461. * found in the LICENSE file at https://angular.io/license
  5462. */
  5463. /**
  5464. * @ngModule CommonModule
  5465. * @description
  5466. *
  5467. * Creates a new `Array` or `String` containing a subset (slice) of the elements.
  5468. *
  5469. * @usageNotes
  5470. *
  5471. * All behavior is based on the expected behavior of the JavaScript API `Array.prototype.slice()`
  5472. * and `String.prototype.slice()`.
  5473. *
  5474. * When operating on an `Array`, the returned `Array` is always a copy even when all
  5475. * the elements are being returned.
  5476. *
  5477. * When operating on a blank value, the pipe returns the blank value.
  5478. *
  5479. * ### List Example
  5480. *
  5481. * This `ngFor` example:
  5482. *
  5483. * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_list'}
  5484. *
  5485. * produces the following:
  5486. *
  5487. * ```html
  5488. * <li>b</li>
  5489. * <li>c</li>
  5490. * ```
  5491. *
  5492. * ### String Examples
  5493. *
  5494. * {@example common/pipes/ts/slice_pipe.ts region='SlicePipe_string'}
  5495. *
  5496. */
  5497. var SlicePipe = /** @class */ (function () {
  5498. function SlicePipe() {
  5499. }
  5500. SlicePipe_1 = SlicePipe;
  5501. /**
  5502. * @param value a list or a string to be sliced.
  5503. * @param start the starting index of the subset to return:
  5504. * - **a positive integer**: return the item at `start` index and all items after
  5505. * in the list or string expression.
  5506. * - **a negative integer**: return the item at `start` index from the end and all items after
  5507. * in the list or string expression.
  5508. * - **if positive and greater than the size of the expression**: return an empty list or
  5509. * string.
  5510. * - **if negative and greater than the size of the expression**: return entire list or string.
  5511. * @param end the ending index of the subset to return:
  5512. * - **omitted**: return all items until the end.
  5513. * - **if positive**: return all items before `end` index of the list or string.
  5514. * - **if negative**: return all items before `end` index from the end of the list or string.
  5515. */
  5516. SlicePipe.prototype.transform = function (value, start, end) {
  5517. if (value == null)
  5518. return value;
  5519. if (!this.supports(value)) {
  5520. throw invalidPipeArgumentError(SlicePipe_1, value);
  5521. }
  5522. return value.slice(start, end);
  5523. };
  5524. SlicePipe.prototype.supports = function (obj) { return typeof obj === 'string' || Array.isArray(obj); };
  5525. var SlicePipe_1;
  5526. SlicePipe = SlicePipe_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5527. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"])({ name: 'slice', pure: false })
  5528. ], SlicePipe);
  5529. return SlicePipe;
  5530. }());
  5531. /**
  5532. * @license
  5533. * Copyright Google Inc. All Rights Reserved.
  5534. *
  5535. * Use of this source code is governed by an MIT-style license that can be
  5536. * found in the LICENSE file at https://angular.io/license
  5537. */
  5538. /**
  5539. * A collection of Angular pipes that are likely to be used in each and every application.
  5540. */
  5541. var COMMON_PIPES = [
  5542. AsyncPipe,
  5543. UpperCasePipe,
  5544. LowerCasePipe,
  5545. JsonPipe,
  5546. SlicePipe,
  5547. DecimalPipe,
  5548. PercentPipe,
  5549. TitleCasePipe,
  5550. CurrencyPipe,
  5551. DatePipe,
  5552. I18nPluralPipe,
  5553. I18nSelectPipe,
  5554. KeyValuePipe,
  5555. ];
  5556. /**
  5557. * @license
  5558. * Copyright Google Inc. All Rights Reserved.
  5559. *
  5560. * Use of this source code is governed by an MIT-style license that can be
  5561. * found in the LICENSE file at https://angular.io/license
  5562. */
  5563. // Note: This does not contain the location providers,
  5564. // as they need some platform specific implementations to work.
  5565. /**
  5566. * Exports all the basic Angular directives and pipes,
  5567. * such as `NgIf`, `NgForOf`, `DecimalPipe`, and so on.
  5568. * Re-exported by `BrowserModule`, which is included automatically in the root
  5569. * `AppModule` when you create a new app with the CLI `new` command.
  5570. *
  5571. * * The `providers` options configure the NgModule's injector to provide
  5572. * localization dependencies to members.
  5573. * * The `exports` options make the declared directives and pipes available for import
  5574. * by other NgModules.
  5575. *
  5576. */
  5577. var CommonModule = /** @class */ (function () {
  5578. function CommonModule() {
  5579. }
  5580. CommonModule = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5581. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"])({
  5582. declarations: [COMMON_DIRECTIVES, COMMON_PIPES],
  5583. exports: [COMMON_DIRECTIVES, COMMON_PIPES],
  5584. providers: [
  5585. { provide: NgLocalization, useClass: NgLocaleLocalization },
  5586. ],
  5587. })
  5588. ], CommonModule);
  5589. return CommonModule;
  5590. }());
  5591. var ɵ0 = getPluralCase;
  5592. /**
  5593. * A module that contains the deprecated i18n pipes.
  5594. *
  5595. * @deprecated from v5
  5596. */
  5597. var DeprecatedI18NPipesModule = /** @class */ (function () {
  5598. function DeprecatedI18NPipesModule() {
  5599. }
  5600. DeprecatedI18NPipesModule = Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__decorate"])([
  5601. Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"])({
  5602. declarations: [COMMON_DEPRECATED_I18N_PIPES],
  5603. exports: [COMMON_DEPRECATED_I18N_PIPES],
  5604. providers: [{ provide: DEPRECATED_PLURAL_FN, useValue: ɵ0 }],
  5605. })
  5606. ], DeprecatedI18NPipesModule);
  5607. return DeprecatedI18NPipesModule;
  5608. }());
  5609. /**
  5610. * @license
  5611. * Copyright Google Inc. All Rights Reserved.
  5612. *
  5613. * Use of this source code is governed by an MIT-style license that can be
  5614. * found in the LICENSE file at https://angular.io/license
  5615. */
  5616. /**
  5617. * A DI Token representing the main rendering context. In a browser this is the DOM Document.
  5618. *
  5619. * Note: Document might not be available in the Application Context when Application and Rendering
  5620. * Contexts are not the same (e.g. when running the application into a Web Worker).
  5621. *
  5622. *
  5623. */
  5624. var DOCUMENT = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["InjectionToken"]('DocumentToken');
  5625. /**
  5626. * @license
  5627. * Copyright Google Inc. All Rights Reserved.
  5628. *
  5629. * Use of this source code is governed by an MIT-style license that can be
  5630. * found in the LICENSE file at https://angular.io/license
  5631. */
  5632. var PLATFORM_BROWSER_ID = 'browser';
  5633. var PLATFORM_SERVER_ID = 'server';
  5634. var PLATFORM_WORKER_APP_ID = 'browserWorkerApp';
  5635. var PLATFORM_WORKER_UI_ID = 'browserWorkerUi';
  5636. /**
  5637. * Returns whether a platform id represents a browser platform.
  5638. * @experimental
  5639. */
  5640. function isPlatformBrowser(platformId) {
  5641. return platformId === PLATFORM_BROWSER_ID;
  5642. }
  5643. /**
  5644. * Returns whether a platform id represents a server platform.
  5645. * @experimental
  5646. */
  5647. function isPlatformServer(platformId) {
  5648. return platformId === PLATFORM_SERVER_ID;
  5649. }
  5650. /**
  5651. * Returns whether a platform id represents a web worker app platform.
  5652. * @experimental
  5653. */
  5654. function isPlatformWorkerApp(platformId) {
  5655. return platformId === PLATFORM_WORKER_APP_ID;
  5656. }
  5657. /**
  5658. * Returns whether a platform id represents a web worker UI platform.
  5659. * @experimental
  5660. */
  5661. function isPlatformWorkerUi(platformId) {
  5662. return platformId === PLATFORM_WORKER_UI_ID;
  5663. }
  5664. /**
  5665. * @license
  5666. * Copyright Google Inc. All Rights Reserved.
  5667. *
  5668. * Use of this source code is governed by an MIT-style license that can be
  5669. * found in the LICENSE file at https://angular.io/license
  5670. */
  5671. var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["Version"]('6.1.10');
  5672. /**
  5673. * @license
  5674. * Copyright Google Inc. All Rights Reserved.
  5675. *
  5676. * Use of this source code is governed by an MIT-style license that can be
  5677. * found in the LICENSE file at https://angular.io/license
  5678. */
  5679. /**
  5680. * Manages the scroll position.
  5681. */
  5682. var ViewportScroller = /** @class */ (function () {
  5683. function ViewportScroller() {
  5684. }
  5685. // De-sugared tree-shakable injection
  5686. // See #23917
  5687. /** @nocollapse */
  5688. ViewportScroller.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["defineInjectable"])({ providedIn: 'root', factory: function () { return new BrowserViewportScroller(Object(_angular_core__WEBPACK_IMPORTED_MODULE_0__["inject"])(DOCUMENT), window); } });
  5689. return ViewportScroller;
  5690. }());
  5691. /**
  5692. * Manages the scroll position.
  5693. */
  5694. var BrowserViewportScroller = /** @class */ (function () {
  5695. function BrowserViewportScroller(document, window) {
  5696. this.document = document;
  5697. this.window = window;
  5698. this.offset = function () { return [0, 0]; };
  5699. }
  5700. /**
  5701. * Configures the top offset used when scrolling to an anchor.
  5702. *
  5703. * * When given a number, the service will always use the number.
  5704. * * When given a function, the service will invoke the function every time it restores scroll
  5705. * position.
  5706. */
  5707. BrowserViewportScroller.prototype.setOffset = function (offset) {
  5708. if (Array.isArray(offset)) {
  5709. this.offset = function () { return offset; };
  5710. }
  5711. else {
  5712. this.offset = offset;
  5713. }
  5714. };
  5715. /**
  5716. * Returns the current scroll position.
  5717. */
  5718. BrowserViewportScroller.prototype.getScrollPosition = function () {
  5719. if (this.supportScrollRestoration()) {
  5720. return [this.window.scrollX, this.window.scrollY];
  5721. }
  5722. else {
  5723. return [0, 0];
  5724. }
  5725. };
  5726. /**
  5727. * Sets the scroll position.
  5728. */
  5729. BrowserViewportScroller.prototype.scrollToPosition = function (position) {
  5730. if (this.supportScrollRestoration()) {
  5731. this.window.scrollTo(position[0], position[1]);
  5732. }
  5733. };
  5734. /**
  5735. * Scrolls to the provided anchor.
  5736. */
  5737. BrowserViewportScroller.prototype.scrollToAnchor = function (anchor) {
  5738. if (this.supportScrollRestoration()) {
  5739. var elSelectedById = this.document.querySelector("#" + anchor);
  5740. if (elSelectedById) {
  5741. this.scrollToElement(elSelectedById);
  5742. return;
  5743. }
  5744. var elSelectedByName = this.document.querySelector("[name='" + anchor + "']");
  5745. if (elSelectedByName) {
  5746. this.scrollToElement(elSelectedByName);
  5747. return;
  5748. }
  5749. }
  5750. };
  5751. /**
  5752. * Disables automatic scroll restoration provided by the browser.
  5753. */
  5754. BrowserViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) {
  5755. if (this.supportScrollRestoration()) {
  5756. var history_1 = this.window.history;
  5757. if (history_1 && history_1.scrollRestoration) {
  5758. history_1.scrollRestoration = scrollRestoration;
  5759. }
  5760. }
  5761. };
  5762. BrowserViewportScroller.prototype.scrollToElement = function (el) {
  5763. var rect = el.getBoundingClientRect();
  5764. var left = rect.left + this.window.pageXOffset;
  5765. var top = rect.top + this.window.pageYOffset;
  5766. var offset = this.offset();
  5767. this.window.scrollTo(left - offset[0], top - offset[1]);
  5768. };
  5769. /**
  5770. * We only support scroll restoration when we can get a hold of window.
  5771. * This means that we do not support this behavior when running in a web worker.
  5772. *
  5773. * Lifting this restriction right now would require more changes in the dom adapter.
  5774. * Since webworkers aren't widely used, we will lift it once RouterScroller is
  5775. * battle-tested.
  5776. */
  5777. BrowserViewportScroller.prototype.supportScrollRestoration = function () {
  5778. try {
  5779. return !!this.window && !!this.window.scrollTo;
  5780. }
  5781. catch (e) {
  5782. return false;
  5783. }
  5784. };
  5785. return BrowserViewportScroller;
  5786. }());
  5787. /**
  5788. * Provides an empty implementation of the viewport scroller. This will
  5789. * live in @angular/common as it will be used by both platform-server and platform-webworker.
  5790. */
  5791. var NullViewportScroller = /** @class */ (function () {
  5792. function NullViewportScroller() {
  5793. }
  5794. /**
  5795. * Empty implementation
  5796. */
  5797. NullViewportScroller.prototype.setOffset = function (offset) { };
  5798. /**
  5799. * Empty implementation
  5800. */
  5801. NullViewportScroller.prototype.getScrollPosition = function () { return [0, 0]; };
  5802. /**
  5803. * Empty implementation
  5804. */
  5805. NullViewportScroller.prototype.scrollToPosition = function (position) { };
  5806. /**
  5807. * Empty implementation
  5808. */
  5809. NullViewportScroller.prototype.scrollToAnchor = function (anchor) { };
  5810. /**
  5811. * Empty implementation
  5812. */
  5813. NullViewportScroller.prototype.setHistoryScrollRestoration = function (scrollRestoration) { };
  5814. return NullViewportScroller;
  5815. }());
  5816. /**
  5817. * @license
  5818. * Copyright Google Inc. All Rights Reserved.
  5819. *
  5820. * Use of this source code is governed by an MIT-style license that can be
  5821. * found in the LICENSE file at https://angular.io/license
  5822. */
  5823. /**
  5824. * @license
  5825. * Copyright Google Inc. All Rights Reserved.
  5826. *
  5827. * Use of this source code is governed by an MIT-style license that can be
  5828. * found in the LICENSE file at https://angular.io/license
  5829. */
  5830. // This file only reexports content of the `src` folder. Keep it that way.
  5831. /**
  5832. * @license
  5833. * Copyright Google Inc. All Rights Reserved.
  5834. *
  5835. * Use of this source code is governed by an MIT-style license that can be
  5836. * found in the LICENSE file at https://angular.io/license
  5837. */
  5838. /**
  5839. * Generated bundle index. Do not edit.
  5840. */
  5841. //# sourceMappingURL=common.js.map
  5842. /***/ }),
  5843. /***/ "./node_modules/@angular/common/fesm5/http.js":
  5844. /*!****************************************************!*\
  5845. !*** ./node_modules/@angular/common/fesm5/http.js ***!
  5846. \****************************************************/
  5847. /*! exports provided: ɵangular_packages_common_http_http_a, ɵangular_packages_common_http_http_b, ɵangular_packages_common_http_http_c, ɵangular_packages_common_http_http_d, ɵangular_packages_common_http_http_g, ɵangular_packages_common_http_http_h, ɵangular_packages_common_http_http_e, ɵangular_packages_common_http_http_f, HttpBackend, HttpHandler, HttpClient, HttpHeaders, HTTP_INTERCEPTORS, JsonpClientBackend, JsonpInterceptor, HttpClientJsonpModule, HttpClientModule, HttpClientXsrfModule, ɵHttpInterceptingHandler, HttpParams, HttpUrlEncodingCodec, HttpRequest, HttpErrorResponse, HttpEventType, HttpHeaderResponse, HttpResponse, HttpResponseBase, HttpXhrBackend, XhrFactory, HttpXsrfTokenExtractor */
  5848. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  5849. "use strict";
  5850. __webpack_require__.r(__webpack_exports__);
  5851. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_a", function() { return NoopInterceptor; });
  5852. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_b", function() { return JsonpCallbackContext; });
  5853. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_c", function() { return jsonpCallbackContext; });
  5854. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_d", function() { return BrowserXhr; });
  5855. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_g", function() { return HttpXsrfCookieExtractor; });
  5856. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_h", function() { return HttpXsrfInterceptor; });
  5857. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_e", function() { return XSRF_COOKIE_NAME; });
  5858. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_common_http_http_f", function() { return XSRF_HEADER_NAME; });
  5859. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpBackend", function() { return HttpBackend; });
  5860. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHandler", function() { return HttpHandler; });
  5861. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClient", function() { return HttpClient; });
  5862. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHeaders", function() { return HttpHeaders; });
  5863. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HTTP_INTERCEPTORS", function() { return HTTP_INTERCEPTORS; });
  5864. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonpClientBackend", function() { return JsonpClientBackend; });
  5865. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JsonpInterceptor", function() { return JsonpInterceptor; });
  5866. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientJsonpModule", function() { return HttpClientJsonpModule; });
  5867. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientModule", function() { return HttpClientModule; });
  5868. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpClientXsrfModule", function() { return HttpClientXsrfModule; });
  5869. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHttpInterceptingHandler", function() { return HttpInterceptingHandler; });
  5870. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpParams", function() { return HttpParams; });
  5871. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpUrlEncodingCodec", function() { return HttpUrlEncodingCodec; });
  5872. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpRequest", function() { return HttpRequest; });
  5873. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpErrorResponse", function() { return HttpErrorResponse; });
  5874. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpEventType", function() { return HttpEventType; });
  5875. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpHeaderResponse", function() { return HttpHeaderResponse; });
  5876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponse", function() { return HttpResponse; });
  5877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpResponseBase", function() { return HttpResponseBase; });
  5878. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpXhrBackend", function() { return HttpXhrBackend; });
  5879. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "XhrFactory", function() { return XhrFactory; });
  5880. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HttpXsrfTokenExtractor", function() { return HttpXsrfTokenExtractor; });
  5881. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  5882. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  5883. /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  5884. /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  5885. /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js");
  5886. /**
  5887. * @license Angular v6.1.10
  5888. * (c) 2010-2018 Google, Inc. https://angular.io/
  5889. * License: MIT
  5890. */
  5891. /**
  5892. * @license
  5893. * Copyright Google Inc. All Rights Reserved.
  5894. *
  5895. * Use of this source code is governed by an MIT-style license that can be
  5896. * found in the LICENSE file at https://angular.io/license
  5897. */
  5898. /**
  5899. * Transforms an `HttpRequest` into a stream of `HttpEvent`s, one of which will likely be a
  5900. * `HttpResponse`.
  5901. *
  5902. * `HttpHandler` is injectable. When injected, the handler instance dispatches requests to the
  5903. * first interceptor in the chain, which dispatches to the second, etc, eventually reaching the
  5904. * `HttpBackend`.
  5905. *
  5906. * In an `HttpInterceptor`, the `HttpHandler` parameter is the next interceptor in the chain.
  5907. *
  5908. *
  5909. */
  5910. var HttpHandler = /** @class */ (function () {
  5911. function HttpHandler() {
  5912. }
  5913. return HttpHandler;
  5914. }());
  5915. /**
  5916. * A final `HttpHandler` which will dispatch the request via browser HTTP APIs to a backend.
  5917. *
  5918. * Interceptors sit between the `HttpClient` interface and the `HttpBackend`.
  5919. *
  5920. * When injected, `HttpBackend` dispatches requests directly to the backend, without going
  5921. * through the interceptor chain.
  5922. *
  5923. *
  5924. */
  5925. var HttpBackend = /** @class */ (function () {
  5926. function HttpBackend() {
  5927. }
  5928. return HttpBackend;
  5929. }());
  5930. /**
  5931. * @license
  5932. * Copyright Google Inc. All Rights Reserved.
  5933. *
  5934. * Use of this source code is governed by an MIT-style license that can be
  5935. * found in the LICENSE file at https://angular.io/license
  5936. */
  5937. /**
  5938. * Immutable set of Http headers, with lazy parsing.
  5939. *
  5940. */
  5941. var HttpHeaders = /** @class */ (function () {
  5942. function HttpHeaders(headers) {
  5943. var _this = this;
  5944. /**
  5945. * Internal map of lowercased header names to the normalized
  5946. * form of the name (the form seen first).
  5947. */
  5948. this.normalizedNames = new Map();
  5949. /**
  5950. * Queued updates to be materialized the next initialization.
  5951. */
  5952. this.lazyUpdate = null;
  5953. if (!headers) {
  5954. this.headers = new Map();
  5955. }
  5956. else if (typeof headers === 'string') {
  5957. this.lazyInit = function () {
  5958. _this.headers = new Map();
  5959. headers.split('\n').forEach(function (line) {
  5960. var index = line.indexOf(':');
  5961. if (index > 0) {
  5962. var name_1 = line.slice(0, index);
  5963. var key = name_1.toLowerCase();
  5964. var value = line.slice(index + 1).trim();
  5965. _this.maybeSetNormalizedName(name_1, key);
  5966. if (_this.headers.has(key)) {
  5967. _this.headers.get(key).push(value);
  5968. }
  5969. else {
  5970. _this.headers.set(key, [value]);
  5971. }
  5972. }
  5973. });
  5974. };
  5975. }
  5976. else {
  5977. this.lazyInit = function () {
  5978. _this.headers = new Map();
  5979. Object.keys(headers).forEach(function (name) {
  5980. var values = headers[name];
  5981. var key = name.toLowerCase();
  5982. if (typeof values === 'string') {
  5983. values = [values];
  5984. }
  5985. if (values.length > 0) {
  5986. _this.headers.set(key, values);
  5987. _this.maybeSetNormalizedName(name, key);
  5988. }
  5989. });
  5990. };
  5991. }
  5992. }
  5993. /**
  5994. * Checks for existence of header by given name.
  5995. */
  5996. HttpHeaders.prototype.has = function (name) {
  5997. this.init();
  5998. return this.headers.has(name.toLowerCase());
  5999. };
  6000. /**
  6001. * Returns first header that matches given name.
  6002. */
  6003. HttpHeaders.prototype.get = function (name) {
  6004. this.init();
  6005. var values = this.headers.get(name.toLowerCase());
  6006. return values && values.length > 0 ? values[0] : null;
  6007. };
  6008. /**
  6009. * Returns the names of the headers
  6010. */
  6011. HttpHeaders.prototype.keys = function () {
  6012. this.init();
  6013. return Array.from(this.normalizedNames.values());
  6014. };
  6015. /**
  6016. * Returns list of header values for a given name.
  6017. */
  6018. HttpHeaders.prototype.getAll = function (name) {
  6019. this.init();
  6020. return this.headers.get(name.toLowerCase()) || null;
  6021. };
  6022. HttpHeaders.prototype.append = function (name, value) {
  6023. return this.clone({ name: name, value: value, op: 'a' });
  6024. };
  6025. HttpHeaders.prototype.set = function (name, value) {
  6026. return this.clone({ name: name, value: value, op: 's' });
  6027. };
  6028. HttpHeaders.prototype.delete = function (name, value) {
  6029. return this.clone({ name: name, value: value, op: 'd' });
  6030. };
  6031. HttpHeaders.prototype.maybeSetNormalizedName = function (name, lcName) {
  6032. if (!this.normalizedNames.has(lcName)) {
  6033. this.normalizedNames.set(lcName, name);
  6034. }
  6035. };
  6036. HttpHeaders.prototype.init = function () {
  6037. var _this = this;
  6038. if (!!this.lazyInit) {
  6039. if (this.lazyInit instanceof HttpHeaders) {
  6040. this.copyFrom(this.lazyInit);
  6041. }
  6042. else {
  6043. this.lazyInit();
  6044. }
  6045. this.lazyInit = null;
  6046. if (!!this.lazyUpdate) {
  6047. this.lazyUpdate.forEach(function (update) { return _this.applyUpdate(update); });
  6048. this.lazyUpdate = null;
  6049. }
  6050. }
  6051. };
  6052. HttpHeaders.prototype.copyFrom = function (other) {
  6053. var _this = this;
  6054. other.init();
  6055. Array.from(other.headers.keys()).forEach(function (key) {
  6056. _this.headers.set(key, other.headers.get(key));
  6057. _this.normalizedNames.set(key, other.normalizedNames.get(key));
  6058. });
  6059. };
  6060. HttpHeaders.prototype.clone = function (update) {
  6061. var clone = new HttpHeaders();
  6062. clone.lazyInit =
  6063. (!!this.lazyInit && this.lazyInit instanceof HttpHeaders) ? this.lazyInit : this;
  6064. clone.lazyUpdate = (this.lazyUpdate || []).concat([update]);
  6065. return clone;
  6066. };
  6067. HttpHeaders.prototype.applyUpdate = function (update) {
  6068. var key = update.name.toLowerCase();
  6069. switch (update.op) {
  6070. case 'a':
  6071. case 's':
  6072. var value = update.value;
  6073. if (typeof value === 'string') {
  6074. value = [value];
  6075. }
  6076. if (value.length === 0) {
  6077. return;
  6078. }
  6079. this.maybeSetNormalizedName(update.name, key);
  6080. var base = (update.op === 'a' ? this.headers.get(key) : undefined) || [];
  6081. base.push.apply(base, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(value));
  6082. this.headers.set(key, base);
  6083. break;
  6084. case 'd':
  6085. var toDelete_1 = update.value;
  6086. if (!toDelete_1) {
  6087. this.headers.delete(key);
  6088. this.normalizedNames.delete(key);
  6089. }
  6090. else {
  6091. var existing = this.headers.get(key);
  6092. if (!existing) {
  6093. return;
  6094. }
  6095. existing = existing.filter(function (value) { return toDelete_1.indexOf(value) === -1; });
  6096. if (existing.length === 0) {
  6097. this.headers.delete(key);
  6098. this.normalizedNames.delete(key);
  6099. }
  6100. else {
  6101. this.headers.set(key, existing);
  6102. }
  6103. }
  6104. break;
  6105. }
  6106. };
  6107. /**
  6108. * @internal
  6109. */
  6110. HttpHeaders.prototype.forEach = function (fn) {
  6111. var _this = this;
  6112. this.init();
  6113. Array.from(this.normalizedNames.keys())
  6114. .forEach(function (key) { return fn(_this.normalizedNames.get(key), _this.headers.get(key)); });
  6115. };
  6116. return HttpHeaders;
  6117. }());
  6118. /**
  6119. * @license
  6120. * Copyright Google Inc. All Rights Reserved.
  6121. *
  6122. * Use of this source code is governed by an MIT-style license that can be
  6123. * found in the LICENSE file at https://angular.io/license
  6124. */
  6125. /**
  6126. * A `HttpParameterCodec` that uses `encodeURIComponent` and `decodeURIComponent` to
  6127. * serialize and parse URL parameter keys and values.
  6128. *
  6129. *
  6130. */
  6131. var HttpUrlEncodingCodec = /** @class */ (function () {
  6132. function HttpUrlEncodingCodec() {
  6133. }
  6134. HttpUrlEncodingCodec.prototype.encodeKey = function (key) { return standardEncoding(key); };
  6135. HttpUrlEncodingCodec.prototype.encodeValue = function (value) { return standardEncoding(value); };
  6136. HttpUrlEncodingCodec.prototype.decodeKey = function (key) { return decodeURIComponent(key); };
  6137. HttpUrlEncodingCodec.prototype.decodeValue = function (value) { return decodeURIComponent(value); };
  6138. return HttpUrlEncodingCodec;
  6139. }());
  6140. function paramParser(rawParams, codec) {
  6141. var map$$1 = new Map();
  6142. if (rawParams.length > 0) {
  6143. var params = rawParams.split('&');
  6144. params.forEach(function (param) {
  6145. var eqIdx = param.indexOf('=');
  6146. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(eqIdx == -1 ?
  6147. [codec.decodeKey(param), ''] :
  6148. [codec.decodeKey(param.slice(0, eqIdx)), codec.decodeValue(param.slice(eqIdx + 1))], 2), key = _a[0], val = _a[1];
  6149. var list = map$$1.get(key) || [];
  6150. list.push(val);
  6151. map$$1.set(key, list);
  6152. });
  6153. }
  6154. return map$$1;
  6155. }
  6156. function standardEncoding(v) {
  6157. return encodeURIComponent(v)
  6158. .replace(/%40/gi, '@')
  6159. .replace(/%3A/gi, ':')
  6160. .replace(/%24/gi, '$')
  6161. .replace(/%2C/gi, ',')
  6162. .replace(/%3B/gi, ';')
  6163. .replace(/%2B/gi, '+')
  6164. .replace(/%3D/gi, '=')
  6165. .replace(/%3F/gi, '?')
  6166. .replace(/%2F/gi, '/');
  6167. }
  6168. /**
  6169. * An HTTP request/response body that represents serialized parameters,
  6170. * per the MIME type `application/x-www-form-urlencoded`.
  6171. *
  6172. * This class is immutable - all mutation operations return a new instance.
  6173. *
  6174. *
  6175. */
  6176. var HttpParams = /** @class */ (function () {
  6177. function HttpParams(options) {
  6178. if (options === void 0) { options = {}; }
  6179. var _this = this;
  6180. this.updates = null;
  6181. this.cloneFrom = null;
  6182. this.encoder = options.encoder || new HttpUrlEncodingCodec();
  6183. if (!!options.fromString) {
  6184. if (!!options.fromObject) {
  6185. throw new Error("Cannot specify both fromString and fromObject.");
  6186. }
  6187. this.map = paramParser(options.fromString, this.encoder);
  6188. }
  6189. else if (!!options.fromObject) {
  6190. this.map = new Map();
  6191. Object.keys(options.fromObject).forEach(function (key) {
  6192. var value = options.fromObject[key];
  6193. _this.map.set(key, Array.isArray(value) ? value : [value]);
  6194. });
  6195. }
  6196. else {
  6197. this.map = null;
  6198. }
  6199. }
  6200. /**
  6201. * Check whether the body has one or more values for the given parameter name.
  6202. */
  6203. HttpParams.prototype.has = function (param) {
  6204. this.init();
  6205. return this.map.has(param);
  6206. };
  6207. /**
  6208. * Get the first value for the given parameter name, or `null` if it's not present.
  6209. */
  6210. HttpParams.prototype.get = function (param) {
  6211. this.init();
  6212. var res = this.map.get(param);
  6213. return !!res ? res[0] : null;
  6214. };
  6215. /**
  6216. * Get all values for the given parameter name, or `null` if it's not present.
  6217. */
  6218. HttpParams.prototype.getAll = function (param) {
  6219. this.init();
  6220. return this.map.get(param) || null;
  6221. };
  6222. /**
  6223. * Get all the parameter names for this body.
  6224. */
  6225. HttpParams.prototype.keys = function () {
  6226. this.init();
  6227. return Array.from(this.map.keys());
  6228. };
  6229. /**
  6230. * Construct a new body with an appended value for the given parameter name.
  6231. */
  6232. HttpParams.prototype.append = function (param, value) { return this.clone({ param: param, value: value, op: 'a' }); };
  6233. /**
  6234. * Construct a new body with a new value for the given parameter name.
  6235. */
  6236. HttpParams.prototype.set = function (param, value) { return this.clone({ param: param, value: value, op: 's' }); };
  6237. /**
  6238. * Construct a new body with either the given value for the given parameter
  6239. * removed, if a value is given, or all values for the given parameter removed
  6240. * if not.
  6241. */
  6242. HttpParams.prototype.delete = function (param, value) { return this.clone({ param: param, value: value, op: 'd' }); };
  6243. /**
  6244. * Serialize the body to an encoded string, where key-value pairs (separated by `=`) are
  6245. * separated by `&`s.
  6246. */
  6247. HttpParams.prototype.toString = function () {
  6248. var _this = this;
  6249. this.init();
  6250. return this.keys()
  6251. .map(function (key) {
  6252. var eKey = _this.encoder.encodeKey(key);
  6253. return _this.map.get(key).map(function (value) { return eKey + '=' + _this.encoder.encodeValue(value); })
  6254. .join('&');
  6255. })
  6256. .join('&');
  6257. };
  6258. HttpParams.prototype.clone = function (update) {
  6259. var clone = new HttpParams({ encoder: this.encoder });
  6260. clone.cloneFrom = this.cloneFrom || this;
  6261. clone.updates = (this.updates || []).concat([update]);
  6262. return clone;
  6263. };
  6264. HttpParams.prototype.init = function () {
  6265. var _this = this;
  6266. if (this.map === null) {
  6267. this.map = new Map();
  6268. }
  6269. if (this.cloneFrom !== null) {
  6270. this.cloneFrom.init();
  6271. this.cloneFrom.keys().forEach(function (key) { return _this.map.set(key, _this.cloneFrom.map.get(key)); });
  6272. this.updates.forEach(function (update) {
  6273. switch (update.op) {
  6274. case 'a':
  6275. case 's':
  6276. var base = (update.op === 'a' ? _this.map.get(update.param) : undefined) || [];
  6277. base.push(update.value);
  6278. _this.map.set(update.param, base);
  6279. break;
  6280. case 'd':
  6281. if (update.value !== undefined) {
  6282. var base_1 = _this.map.get(update.param) || [];
  6283. var idx = base_1.indexOf(update.value);
  6284. if (idx !== -1) {
  6285. base_1.splice(idx, 1);
  6286. }
  6287. if (base_1.length > 0) {
  6288. _this.map.set(update.param, base_1);
  6289. }
  6290. else {
  6291. _this.map.delete(update.param);
  6292. }
  6293. }
  6294. else {
  6295. _this.map.delete(update.param);
  6296. break;
  6297. }
  6298. }
  6299. });
  6300. this.cloneFrom = null;
  6301. }
  6302. };
  6303. return HttpParams;
  6304. }());
  6305. /**
  6306. * @license
  6307. * Copyright Google Inc. All Rights Reserved.
  6308. *
  6309. * Use of this source code is governed by an MIT-style license that can be
  6310. * found in the LICENSE file at https://angular.io/license
  6311. */
  6312. /**
  6313. * Determine whether the given HTTP method may include a body.
  6314. */
  6315. function mightHaveBody(method) {
  6316. switch (method) {
  6317. case 'DELETE':
  6318. case 'GET':
  6319. case 'HEAD':
  6320. case 'OPTIONS':
  6321. case 'JSONP':
  6322. return false;
  6323. default:
  6324. return true;
  6325. }
  6326. }
  6327. /**
  6328. * Safely assert whether the given value is an ArrayBuffer.
  6329. *
  6330. * In some execution environments ArrayBuffer is not defined.
  6331. */
  6332. function isArrayBuffer(value) {
  6333. return typeof ArrayBuffer !== 'undefined' && value instanceof ArrayBuffer;
  6334. }
  6335. /**
  6336. * Safely assert whether the given value is a Blob.
  6337. *
  6338. * In some execution environments Blob is not defined.
  6339. */
  6340. function isBlob(value) {
  6341. return typeof Blob !== 'undefined' && value instanceof Blob;
  6342. }
  6343. /**
  6344. * Safely assert whether the given value is a FormData instance.
  6345. *
  6346. * In some execution environments FormData is not defined.
  6347. */
  6348. function isFormData(value) {
  6349. return typeof FormData !== 'undefined' && value instanceof FormData;
  6350. }
  6351. /**
  6352. * An outgoing HTTP request with an optional typed body.
  6353. *
  6354. * `HttpRequest` represents an outgoing request, including URL, method,
  6355. * headers, body, and other request configuration options. Instances should be
  6356. * assumed to be immutable. To modify a `HttpRequest`, the `clone`
  6357. * method should be used.
  6358. *
  6359. *
  6360. */
  6361. var HttpRequest = /** @class */ (function () {
  6362. function HttpRequest(method, url, third, fourth) {
  6363. this.url = url;
  6364. /**
  6365. * The request body, or `null` if one isn't set.
  6366. *
  6367. * Bodies are not enforced to be immutable, as they can include a reference to any
  6368. * user-defined data type. However, interceptors should take care to preserve
  6369. * idempotence by treating them as such.
  6370. */
  6371. this.body = null;
  6372. /**
  6373. * Whether this request should be made in a way that exposes progress events.
  6374. *
  6375. * Progress events are expensive (change detection runs on each event) and so
  6376. * they should only be requested if the consumer intends to monitor them.
  6377. */
  6378. this.reportProgress = false;
  6379. /**
  6380. * Whether this request should be sent with outgoing credentials (cookies).
  6381. */
  6382. this.withCredentials = false;
  6383. /**
  6384. * The expected response type of the server.
  6385. *
  6386. * This is used to parse the response appropriately before returning it to
  6387. * the requestee.
  6388. */
  6389. this.responseType = 'json';
  6390. this.method = method.toUpperCase();
  6391. // Next, need to figure out which argument holds the HttpRequestInit
  6392. // options, if any.
  6393. var options;
  6394. // Check whether a body argument is expected. The only valid way to omit
  6395. // the body argument is to use a known no-body method like GET.
  6396. if (mightHaveBody(this.method) || !!fourth) {
  6397. // Body is the third argument, options are the fourth.
  6398. this.body = (third !== undefined) ? third : null;
  6399. options = fourth;
  6400. }
  6401. else {
  6402. // No body required, options are the third argument. The body stays null.
  6403. options = third;
  6404. }
  6405. // If options have been passed, interpret them.
  6406. if (options) {
  6407. // Normalize reportProgress and withCredentials.
  6408. this.reportProgress = !!options.reportProgress;
  6409. this.withCredentials = !!options.withCredentials;
  6410. // Override default response type of 'json' if one is provided.
  6411. if (!!options.responseType) {
  6412. this.responseType = options.responseType;
  6413. }
  6414. // Override headers if they're provided.
  6415. if (!!options.headers) {
  6416. this.headers = options.headers;
  6417. }
  6418. if (!!options.params) {
  6419. this.params = options.params;
  6420. }
  6421. }
  6422. // If no headers have been passed in, construct a new HttpHeaders instance.
  6423. if (!this.headers) {
  6424. this.headers = new HttpHeaders();
  6425. }
  6426. // If no parameters have been passed in, construct a new HttpUrlEncodedParams instance.
  6427. if (!this.params) {
  6428. this.params = new HttpParams();
  6429. this.urlWithParams = url;
  6430. }
  6431. else {
  6432. // Encode the parameters to a string in preparation for inclusion in the URL.
  6433. var params = this.params.toString();
  6434. if (params.length === 0) {
  6435. // No parameters, the visible URL is just the URL given at creation time.
  6436. this.urlWithParams = url;
  6437. }
  6438. else {
  6439. // Does the URL already have query parameters? Look for '?'.
  6440. var qIdx = url.indexOf('?');
  6441. // There are 3 cases to handle:
  6442. // 1) No existing parameters -> append '?' followed by params.
  6443. // 2) '?' exists and is followed by existing query string ->
  6444. // append '&' followed by params.
  6445. // 3) '?' exists at the end of the url -> append params directly.
  6446. // This basically amounts to determining the character, if any, with
  6447. // which to join the URL and parameters.
  6448. var sep = qIdx === -1 ? '?' : (qIdx < url.length - 1 ? '&' : '');
  6449. this.urlWithParams = url + sep + params;
  6450. }
  6451. }
  6452. }
  6453. /**
  6454. * Transform the free-form body into a serialized format suitable for
  6455. * transmission to the server.
  6456. */
  6457. HttpRequest.prototype.serializeBody = function () {
  6458. // If no body is present, no need to serialize it.
  6459. if (this.body === null) {
  6460. return null;
  6461. }
  6462. // Check whether the body is already in a serialized form. If so,
  6463. // it can just be returned directly.
  6464. if (isArrayBuffer(this.body) || isBlob(this.body) || isFormData(this.body) ||
  6465. typeof this.body === 'string') {
  6466. return this.body;
  6467. }
  6468. // Check whether the body is an instance of HttpUrlEncodedParams.
  6469. if (this.body instanceof HttpParams) {
  6470. return this.body.toString();
  6471. }
  6472. // Check whether the body is an object or array, and serialize with JSON if so.
  6473. if (typeof this.body === 'object' || typeof this.body === 'boolean' ||
  6474. Array.isArray(this.body)) {
  6475. return JSON.stringify(this.body);
  6476. }
  6477. // Fall back on toString() for everything else.
  6478. return this.body.toString();
  6479. };
  6480. /**
  6481. * Examine the body and attempt to infer an appropriate MIME type
  6482. * for it.
  6483. *
  6484. * If no such type can be inferred, this method will return `null`.
  6485. */
  6486. HttpRequest.prototype.detectContentTypeHeader = function () {
  6487. // An empty body has no content type.
  6488. if (this.body === null) {
  6489. return null;
  6490. }
  6491. // FormData bodies rely on the browser's content type assignment.
  6492. if (isFormData(this.body)) {
  6493. return null;
  6494. }
  6495. // Blobs usually have their own content type. If it doesn't, then
  6496. // no type can be inferred.
  6497. if (isBlob(this.body)) {
  6498. return this.body.type || null;
  6499. }
  6500. // Array buffers have unknown contents and thus no type can be inferred.
  6501. if (isArrayBuffer(this.body)) {
  6502. return null;
  6503. }
  6504. // Technically, strings could be a form of JSON data, but it's safe enough
  6505. // to assume they're plain strings.
  6506. if (typeof this.body === 'string') {
  6507. return 'text/plain';
  6508. }
  6509. // `HttpUrlEncodedParams` has its own content-type.
  6510. if (this.body instanceof HttpParams) {
  6511. return 'application/x-www-form-urlencoded;charset=UTF-8';
  6512. }
  6513. // Arrays, objects, and numbers will be encoded as JSON.
  6514. if (typeof this.body === 'object' || typeof this.body === 'number' ||
  6515. Array.isArray(this.body)) {
  6516. return 'application/json';
  6517. }
  6518. // No type could be inferred.
  6519. return null;
  6520. };
  6521. HttpRequest.prototype.clone = function (update) {
  6522. if (update === void 0) { update = {}; }
  6523. // For method, url, and responseType, take the current value unless
  6524. // it is overridden in the update hash.
  6525. var method = update.method || this.method;
  6526. var url = update.url || this.url;
  6527. var responseType = update.responseType || this.responseType;
  6528. // The body is somewhat special - a `null` value in update.body means
  6529. // whatever current body is present is being overridden with an empty
  6530. // body, whereas an `undefined` value in update.body implies no
  6531. // override.
  6532. var body = (update.body !== undefined) ? update.body : this.body;
  6533. // Carefully handle the boolean options to differentiate between
  6534. // `false` and `undefined` in the update args.
  6535. var withCredentials = (update.withCredentials !== undefined) ? update.withCredentials : this.withCredentials;
  6536. var reportProgress = (update.reportProgress !== undefined) ? update.reportProgress : this.reportProgress;
  6537. // Headers and params may be appended to if `setHeaders` or
  6538. // `setParams` are used.
  6539. var headers = update.headers || this.headers;
  6540. var params = update.params || this.params;
  6541. // Check whether the caller has asked to add headers.
  6542. if (update.setHeaders !== undefined) {
  6543. // Set every requested header.
  6544. headers =
  6545. Object.keys(update.setHeaders)
  6546. .reduce(function (headers, name) { return headers.set(name, update.setHeaders[name]); }, headers);
  6547. }
  6548. // Check whether the caller has asked to set params.
  6549. if (update.setParams) {
  6550. // Set every requested param.
  6551. params = Object.keys(update.setParams)
  6552. .reduce(function (params, param) { return params.set(param, update.setParams[param]); }, params);
  6553. }
  6554. // Finally, construct the new HttpRequest using the pieces from above.
  6555. return new HttpRequest(method, url, body, {
  6556. params: params, headers: headers, reportProgress: reportProgress, responseType: responseType, withCredentials: withCredentials,
  6557. });
  6558. };
  6559. return HttpRequest;
  6560. }());
  6561. /**
  6562. * @license
  6563. * Copyright Google Inc. All Rights Reserved.
  6564. *
  6565. * Use of this source code is governed by an MIT-style license that can be
  6566. * found in the LICENSE file at https://angular.io/license
  6567. */
  6568. /**
  6569. * Type enumeration for the different kinds of `HttpEvent`.
  6570. *
  6571. *
  6572. */
  6573. var HttpEventType;
  6574. (function (HttpEventType) {
  6575. /**
  6576. * The request was sent out over the wire.
  6577. */
  6578. HttpEventType[HttpEventType["Sent"] = 0] = "Sent";
  6579. /**
  6580. * An upload progress event was received.
  6581. */
  6582. HttpEventType[HttpEventType["UploadProgress"] = 1] = "UploadProgress";
  6583. /**
  6584. * The response status code and headers were received.
  6585. */
  6586. HttpEventType[HttpEventType["ResponseHeader"] = 2] = "ResponseHeader";
  6587. /**
  6588. * A download progress event was received.
  6589. */
  6590. HttpEventType[HttpEventType["DownloadProgress"] = 3] = "DownloadProgress";
  6591. /**
  6592. * The full response including the body was received.
  6593. */
  6594. HttpEventType[HttpEventType["Response"] = 4] = "Response";
  6595. /**
  6596. * A custom event from an interceptor or a backend.
  6597. */
  6598. HttpEventType[HttpEventType["User"] = 5] = "User";
  6599. })(HttpEventType || (HttpEventType = {}));
  6600. /**
  6601. * Base class for both `HttpResponse` and `HttpHeaderResponse`.
  6602. *
  6603. *
  6604. */
  6605. var HttpResponseBase = /** @class */ (function () {
  6606. /**
  6607. * Super-constructor for all responses.
  6608. *
  6609. * The single parameter accepted is an initialization hash. Any properties
  6610. * of the response passed there will override the default values.
  6611. */
  6612. function HttpResponseBase(init, defaultStatus, defaultStatusText) {
  6613. if (defaultStatus === void 0) { defaultStatus = 200; }
  6614. if (defaultStatusText === void 0) { defaultStatusText = 'OK'; }
  6615. // If the hash has values passed, use them to initialize the response.
  6616. // Otherwise use the default values.
  6617. this.headers = init.headers || new HttpHeaders();
  6618. this.status = init.status !== undefined ? init.status : defaultStatus;
  6619. this.statusText = init.statusText || defaultStatusText;
  6620. this.url = init.url || null;
  6621. // Cache the ok value to avoid defining a getter.
  6622. this.ok = this.status >= 200 && this.status < 300;
  6623. }
  6624. return HttpResponseBase;
  6625. }());
  6626. /**
  6627. * A partial HTTP response which only includes the status and header data,
  6628. * but no response body.
  6629. *
  6630. * `HttpHeaderResponse` is a `HttpEvent` available on the response
  6631. * event stream, only when progress events are requested.
  6632. *
  6633. *
  6634. */
  6635. var HttpHeaderResponse = /** @class */ (function (_super) {
  6636. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpHeaderResponse, _super);
  6637. /**
  6638. * Create a new `HttpHeaderResponse` with the given parameters.
  6639. */
  6640. function HttpHeaderResponse(init) {
  6641. if (init === void 0) { init = {}; }
  6642. var _this = _super.call(this, init) || this;
  6643. _this.type = HttpEventType.ResponseHeader;
  6644. return _this;
  6645. }
  6646. /**
  6647. * Copy this `HttpHeaderResponse`, overriding its contents with the
  6648. * given parameter hash.
  6649. */
  6650. HttpHeaderResponse.prototype.clone = function (update) {
  6651. if (update === void 0) { update = {}; }
  6652. // Perform a straightforward initialization of the new HttpHeaderResponse,
  6653. // overriding the current parameters with new ones if given.
  6654. return new HttpHeaderResponse({
  6655. headers: update.headers || this.headers,
  6656. status: update.status !== undefined ? update.status : this.status,
  6657. statusText: update.statusText || this.statusText,
  6658. url: update.url || this.url || undefined,
  6659. });
  6660. };
  6661. return HttpHeaderResponse;
  6662. }(HttpResponseBase));
  6663. /**
  6664. * A full HTTP response, including a typed response body (which may be `null`
  6665. * if one was not returned).
  6666. *
  6667. * `HttpResponse` is a `HttpEvent` available on the response event
  6668. * stream.
  6669. *
  6670. *
  6671. */
  6672. var HttpResponse = /** @class */ (function (_super) {
  6673. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpResponse, _super);
  6674. /**
  6675. * Construct a new `HttpResponse`.
  6676. */
  6677. function HttpResponse(init) {
  6678. if (init === void 0) { init = {}; }
  6679. var _this = _super.call(this, init) || this;
  6680. _this.type = HttpEventType.Response;
  6681. _this.body = init.body !== undefined ? init.body : null;
  6682. return _this;
  6683. }
  6684. HttpResponse.prototype.clone = function (update) {
  6685. if (update === void 0) { update = {}; }
  6686. return new HttpResponse({
  6687. body: (update.body !== undefined) ? update.body : this.body,
  6688. headers: update.headers || this.headers,
  6689. status: (update.status !== undefined) ? update.status : this.status,
  6690. statusText: update.statusText || this.statusText,
  6691. url: update.url || this.url || undefined,
  6692. });
  6693. };
  6694. return HttpResponse;
  6695. }(HttpResponseBase));
  6696. /**
  6697. * A response that represents an error or failure, either from a
  6698. * non-successful HTTP status, an error while executing the request,
  6699. * or some other failure which occurred during the parsing of the response.
  6700. *
  6701. * Any error returned on the `Observable` response stream will be
  6702. * wrapped in an `HttpErrorResponse` to provide additional context about
  6703. * the state of the HTTP layer when the error occurred. The error property
  6704. * will contain either a wrapped Error object or the error response returned
  6705. * from the server.
  6706. *
  6707. *
  6708. */
  6709. var HttpErrorResponse = /** @class */ (function (_super) {
  6710. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HttpErrorResponse, _super);
  6711. function HttpErrorResponse(init) {
  6712. var _this =
  6713. // Initialize with a default status of 0 / Unknown Error.
  6714. _super.call(this, init, 0, 'Unknown Error') || this;
  6715. _this.name = 'HttpErrorResponse';
  6716. /**
  6717. * Errors are never okay, even when the status code is in the 2xx success range.
  6718. */
  6719. _this.ok = false;
  6720. // If the response was successful, then this was a parse error. Otherwise, it was
  6721. // a protocol-level failure of some sort. Either the request failed in transit
  6722. // or the server returned an unsuccessful status code.
  6723. if (_this.status >= 200 && _this.status < 300) {
  6724. _this.message = "Http failure during parsing for " + (init.url || '(unknown url)');
  6725. }
  6726. else {
  6727. _this.message =
  6728. "Http failure response for " + (init.url || '(unknown url)') + ": " + init.status + " " + init.statusText;
  6729. }
  6730. _this.error = init.error || null;
  6731. return _this;
  6732. }
  6733. return HttpErrorResponse;
  6734. }(HttpResponseBase));
  6735. /**
  6736. * @license
  6737. * Copyright Google Inc. All Rights Reserved.
  6738. *
  6739. * Use of this source code is governed by an MIT-style license that can be
  6740. * found in the LICENSE file at https://angular.io/license
  6741. */
  6742. /**
  6743. * Construct an instance of `HttpRequestOptions<T>` from a source `HttpMethodOptions` and
  6744. * the given `body`. Basically, this clones the object and adds the body.
  6745. */
  6746. function addBody(options, body) {
  6747. return {
  6748. body: body,
  6749. headers: options.headers,
  6750. observe: options.observe,
  6751. params: options.params,
  6752. reportProgress: options.reportProgress,
  6753. responseType: options.responseType,
  6754. withCredentials: options.withCredentials,
  6755. };
  6756. }
  6757. /**
  6758. * Perform HTTP requests.
  6759. *
  6760. * `HttpClient` is available as an injectable class, with methods to perform HTTP requests.
  6761. * Each request method has multiple signatures, and the return type varies according to which
  6762. * signature is called (mainly the values of `observe` and `responseType`).
  6763. *
  6764. *
  6765. */
  6766. var HttpClient = /** @class */ (function () {
  6767. function HttpClient(handler) {
  6768. this.handler = handler;
  6769. }
  6770. /**
  6771. * Constructs an `Observable` for a particular HTTP request that, when subscribed,
  6772. * fires the request through the chain of registered interceptors and on to the
  6773. * server.
  6774. *
  6775. * This method can be called in one of two ways. Either an `HttpRequest`
  6776. * instance can be passed directly as the only parameter, or a method can be
  6777. * passed as the first parameter, a string URL as the second, and an
  6778. * options hash as the third.
  6779. *
  6780. * If a `HttpRequest` object is passed directly, an `Observable` of the
  6781. * raw `HttpEvent` stream will be returned.
  6782. *
  6783. * If a request is instead built by providing a URL, the options object
  6784. * determines the return type of `request()`. In addition to configuring
  6785. * request parameters such as the outgoing headers and/or the body, the options
  6786. * hash specifies two key pieces of information about the request: the
  6787. * `responseType` and what to `observe`.
  6788. *
  6789. * The `responseType` value determines how a successful response body will be
  6790. * parsed. If `responseType` is the default `json`, a type interface for the
  6791. * resulting object may be passed as a type parameter to `request()`.
  6792. *
  6793. * The `observe` value determines the return type of `request()`, based on what
  6794. * the consumer is interested in observing. A value of `events` will return an
  6795. * `Observable<HttpEvent>` representing the raw `HttpEvent` stream,
  6796. * including progress events by default. A value of `response` will return an
  6797. * `Observable<HttpResponse<T>>` where the `T` parameter of `HttpResponse`
  6798. * depends on the `responseType` and any optionally provided type parameter.
  6799. * A value of `body` will return an `Observable<T>` with the same `T` body type.
  6800. */
  6801. HttpClient.prototype.request = function (first, url, options) {
  6802. var _this = this;
  6803. if (options === void 0) { options = {}; }
  6804. var req;
  6805. // Firstly, check whether the primary argument is an instance of `HttpRequest`.
  6806. if (first instanceof HttpRequest) {
  6807. // It is. The other arguments must be undefined (per the signatures) and can be
  6808. // ignored.
  6809. req = first;
  6810. }
  6811. else {
  6812. // It's a string, so it represents a URL. Construct a request based on it,
  6813. // and incorporate the remaining arguments (assuming GET unless a method is
  6814. // provided.
  6815. // Figure out the headers.
  6816. var headers = undefined;
  6817. if (options.headers instanceof HttpHeaders) {
  6818. headers = options.headers;
  6819. }
  6820. else {
  6821. headers = new HttpHeaders(options.headers);
  6822. }
  6823. // Sort out parameters.
  6824. var params = undefined;
  6825. if (!!options.params) {
  6826. if (options.params instanceof HttpParams) {
  6827. params = options.params;
  6828. }
  6829. else {
  6830. params = new HttpParams({ fromObject: options.params });
  6831. }
  6832. }
  6833. // Construct the request.
  6834. req = new HttpRequest(first, url, (options.body !== undefined ? options.body : null), {
  6835. headers: headers,
  6836. params: params,
  6837. reportProgress: options.reportProgress,
  6838. // By default, JSON is assumed to be returned for all calls.
  6839. responseType: options.responseType || 'json',
  6840. withCredentials: options.withCredentials,
  6841. });
  6842. }
  6843. // Start with an Observable.of() the initial request, and run the handler (which
  6844. // includes all interceptors) inside a concatMap(). This way, the handler runs
  6845. // inside an Observable chain, which causes interceptors to be re-run on every
  6846. // subscription (this also makes retries re-run the handler, including interceptors).
  6847. var events$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(req).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])(function (req) { return _this.handler.handle(req); }));
  6848. // If coming via the API signature which accepts a previously constructed HttpRequest,
  6849. // the only option is to get the event stream. Otherwise, return the event stream if
  6850. // that is what was requested.
  6851. if (first instanceof HttpRequest || options.observe === 'events') {
  6852. return events$;
  6853. }
  6854. // The requested stream contains either the full response or the body. In either
  6855. // case, the first step is to filter the event stream to extract a stream of
  6856. // responses(s).
  6857. var res$ = events$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])(function (event) { return event instanceof HttpResponse; }));
  6858. // Decide which stream to return.
  6859. switch (options.observe || 'body') {
  6860. case 'body':
  6861. // The requested stream is the body. Map the response stream to the response
  6862. // body. This could be done more simply, but a misbehaving interceptor might
  6863. // transform the response body into a different format and ignore the requested
  6864. // responseType. Guard against this by validating that the response is of the
  6865. // requested type.
  6866. switch (req.responseType) {
  6867. case 'arraybuffer':
  6868. return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) {
  6869. // Validate that the body is an ArrayBuffer.
  6870. if (res.body !== null && !(res.body instanceof ArrayBuffer)) {
  6871. throw new Error('Response is not an ArrayBuffer.');
  6872. }
  6873. return res.body;
  6874. }));
  6875. case 'blob':
  6876. return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) {
  6877. // Validate that the body is a Blob.
  6878. if (res.body !== null && !(res.body instanceof Blob)) {
  6879. throw new Error('Response is not a Blob.');
  6880. }
  6881. return res.body;
  6882. }));
  6883. case 'text':
  6884. return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) {
  6885. // Validate that the body is a string.
  6886. if (res.body !== null && typeof res.body !== 'string') {
  6887. throw new Error('Response is not a string.');
  6888. }
  6889. return res.body;
  6890. }));
  6891. case 'json':
  6892. default:
  6893. // No validation needed for JSON responses, as they can be of any type.
  6894. return res$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (res) { return res.body; }));
  6895. }
  6896. case 'response':
  6897. // The response stream was requested directly, so return it.
  6898. return res$;
  6899. default:
  6900. // Guard against new future observe types being added.
  6901. throw new Error("Unreachable: unhandled observe type " + options.observe + "}");
  6902. }
  6903. };
  6904. /**
  6905. * Constructs an `Observable` which, when subscribed, will cause the configured
  6906. * DELETE request to be executed on the server. See the individual overloads for
  6907. * details of `delete()`'s return type based on the provided options.
  6908. */
  6909. HttpClient.prototype.delete = function (url, options) {
  6910. if (options === void 0) { options = {}; }
  6911. return this.request('DELETE', url, options);
  6912. };
  6913. /**
  6914. * Constructs an `Observable` which, when subscribed, will cause the configured
  6915. * GET request to be executed on the server. See the individual overloads for
  6916. * details of `get()`'s return type based on the provided options.
  6917. */
  6918. HttpClient.prototype.get = function (url, options) {
  6919. if (options === void 0) { options = {}; }
  6920. return this.request('GET', url, options);
  6921. };
  6922. /**
  6923. * Constructs an `Observable` which, when subscribed, will cause the configured
  6924. * HEAD request to be executed on the server. See the individual overloads for
  6925. * details of `head()`'s return type based on the provided options.
  6926. */
  6927. HttpClient.prototype.head = function (url, options) {
  6928. if (options === void 0) { options = {}; }
  6929. return this.request('HEAD', url, options);
  6930. };
  6931. /**
  6932. * Constructs an `Observable` which, when subscribed, will cause a request
  6933. * with the special method `JSONP` to be dispatched via the interceptor pipeline.
  6934. *
  6935. * A suitable interceptor must be installed (e.g. via the `HttpClientJsonpModule`).
  6936. * If no such interceptor is reached, then the `JSONP` request will likely be
  6937. * rejected by the configured backend.
  6938. */
  6939. HttpClient.prototype.jsonp = function (url, callbackParam) {
  6940. return this.request('JSONP', url, {
  6941. params: new HttpParams().append(callbackParam, 'JSONP_CALLBACK'),
  6942. observe: 'body',
  6943. responseType: 'json',
  6944. });
  6945. };
  6946. /**
  6947. * Constructs an `Observable` which, when subscribed, will cause the configured
  6948. * OPTIONS request to be executed on the server. See the individual overloads for
  6949. * details of `options()`'s return type based on the provided options.
  6950. */
  6951. HttpClient.prototype.options = function (url, options) {
  6952. if (options === void 0) { options = {}; }
  6953. return this.request('OPTIONS', url, options);
  6954. };
  6955. /**
  6956. * Constructs an `Observable` which, when subscribed, will cause the configured
  6957. * PATCH request to be executed on the server. See the individual overloads for
  6958. * details of `patch()`'s return type based on the provided options.
  6959. */
  6960. HttpClient.prototype.patch = function (url, body, options) {
  6961. if (options === void 0) { options = {}; }
  6962. return this.request('PATCH', url, addBody(options, body));
  6963. };
  6964. /**
  6965. * Constructs an `Observable` which, when subscribed, will cause the configured
  6966. * POST request to be executed on the server. See the individual overloads for
  6967. * details of `post()`'s return type based on the provided options.
  6968. */
  6969. HttpClient.prototype.post = function (url, body, options) {
  6970. if (options === void 0) { options = {}; }
  6971. return this.request('POST', url, addBody(options, body));
  6972. };
  6973. /**
  6974. * Constructs an `Observable` which, when subscribed, will cause the configured
  6975. * PUT request to be executed on the server. See the individual overloads for
  6976. * details of `put()`'s return type based on the provided options.
  6977. */
  6978. HttpClient.prototype.put = function (url, body, options) {
  6979. if (options === void 0) { options = {}; }
  6980. return this.request('PUT', url, addBody(options, body));
  6981. };
  6982. HttpClient = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  6983. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  6984. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [HttpHandler])
  6985. ], HttpClient);
  6986. return HttpClient;
  6987. }());
  6988. /**
  6989. * @license
  6990. * Copyright Google Inc. All Rights Reserved.
  6991. *
  6992. * Use of this source code is governed by an MIT-style license that can be
  6993. * found in the LICENSE file at https://angular.io/license
  6994. */
  6995. /**
  6996. * `HttpHandler` which applies an `HttpInterceptor` to an `HttpRequest`.
  6997. *
  6998. *
  6999. */
  7000. var HttpInterceptorHandler = /** @class */ (function () {
  7001. function HttpInterceptorHandler(next, interceptor) {
  7002. this.next = next;
  7003. this.interceptor = interceptor;
  7004. }
  7005. HttpInterceptorHandler.prototype.handle = function (req) {
  7006. return this.interceptor.intercept(req, this.next);
  7007. };
  7008. return HttpInterceptorHandler;
  7009. }());
  7010. /**
  7011. * A multi-provider token which represents the array of `HttpInterceptor`s that
  7012. * are registered.
  7013. *
  7014. *
  7015. */
  7016. var HTTP_INTERCEPTORS = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('HTTP_INTERCEPTORS');
  7017. var NoopInterceptor = /** @class */ (function () {
  7018. function NoopInterceptor() {
  7019. }
  7020. NoopInterceptor.prototype.intercept = function (req, next) {
  7021. return next.handle(req);
  7022. };
  7023. NoopInterceptor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7024. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])()
  7025. ], NoopInterceptor);
  7026. return NoopInterceptor;
  7027. }());
  7028. /**
  7029. * @license
  7030. * Copyright Google Inc. All Rights Reserved.
  7031. *
  7032. * Use of this source code is governed by an MIT-style license that can be
  7033. * found in the LICENSE file at https://angular.io/license
  7034. */
  7035. // Every request made through JSONP needs a callback name that's unique across the
  7036. // whole page. Each request is assigned an id and the callback name is constructed
  7037. // from that. The next id to be assigned is tracked in a global variable here that
  7038. // is shared among all applications on the page.
  7039. var nextRequestId = 0;
  7040. // Error text given when a JSONP script is injected, but doesn't invoke the callback
  7041. // passed in its URL.
  7042. var JSONP_ERR_NO_CALLBACK = 'JSONP injected script did not invoke callback.';
  7043. // Error text given when a request is passed to the JsonpClientBackend that doesn't
  7044. // have a request method JSONP.
  7045. var JSONP_ERR_WRONG_METHOD = 'JSONP requests must use JSONP request method.';
  7046. var JSONP_ERR_WRONG_RESPONSE_TYPE = 'JSONP requests must use Json response type.';
  7047. /**
  7048. * DI token/abstract type representing a map of JSONP callbacks.
  7049. *
  7050. * In the browser, this should always be the `window` object.
  7051. *
  7052. *
  7053. */
  7054. var JsonpCallbackContext = /** @class */ (function () {
  7055. function JsonpCallbackContext() {
  7056. }
  7057. return JsonpCallbackContext;
  7058. }());
  7059. /**
  7060. * `HttpBackend` that only processes `HttpRequest` with the JSONP method,
  7061. * by performing JSONP style requests.
  7062. *
  7063. *
  7064. */
  7065. var JsonpClientBackend = /** @class */ (function () {
  7066. function JsonpClientBackend(callbackMap, document) {
  7067. this.callbackMap = callbackMap;
  7068. this.document = document;
  7069. }
  7070. /**
  7071. * Get the name of the next callback method, by incrementing the global `nextRequestId`.
  7072. */
  7073. JsonpClientBackend.prototype.nextCallback = function () { return "ng_jsonp_callback_" + nextRequestId++; };
  7074. /**
  7075. * Process a JSONP request and return an event stream of the results.
  7076. */
  7077. JsonpClientBackend.prototype.handle = function (req) {
  7078. var _this = this;
  7079. // Firstly, check both the method and response type. If either doesn't match
  7080. // then the request was improperly routed here and cannot be handled.
  7081. if (req.method !== 'JSONP') {
  7082. throw new Error(JSONP_ERR_WRONG_METHOD);
  7083. }
  7084. else if (req.responseType !== 'json') {
  7085. throw new Error(JSONP_ERR_WRONG_RESPONSE_TYPE);
  7086. }
  7087. // Everything else happens inside the Observable boundary.
  7088. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (observer) {
  7089. // The first step to make a request is to generate the callback name, and replace the
  7090. // callback placeholder in the URL with the name. Care has to be taken here to ensure
  7091. // a trailing &, if matched, gets inserted back into the URL in the correct place.
  7092. var callback = _this.nextCallback();
  7093. var url = req.urlWithParams.replace(/=JSONP_CALLBACK(&|$)/, "=" + callback + "$1");
  7094. // Construct the <script> tag and point it at the URL.
  7095. var node = _this.document.createElement('script');
  7096. node.src = url;
  7097. // A JSONP request requires waiting for multiple callbacks. These variables
  7098. // are closed over and track state across those callbacks.
  7099. // The response object, if one has been received, or null otherwise.
  7100. var body = null;
  7101. // Whether the response callback has been called.
  7102. var finished = false;
  7103. // Whether the request has been cancelled (and thus any other callbacks)
  7104. // should be ignored.
  7105. var cancelled = false;
  7106. // Set the response callback in this.callbackMap (which will be the window
  7107. // object in the browser. The script being loaded via the <script> tag will
  7108. // eventually call this callback.
  7109. _this.callbackMap[callback] = function (data) {
  7110. // Data has been received from the JSONP script. Firstly, delete this callback.
  7111. delete _this.callbackMap[callback];
  7112. // Next, make sure the request wasn't cancelled in the meantime.
  7113. if (cancelled) {
  7114. return;
  7115. }
  7116. // Set state to indicate data was received.
  7117. body = data;
  7118. finished = true;
  7119. };
  7120. // cleanup() is a utility closure that removes the <script> from the page and
  7121. // the response callback from the window. This logic is used in both the
  7122. // success, error, and cancellation paths, so it's extracted out for convenience.
  7123. var cleanup = function () {
  7124. // Remove the <script> tag if it's still on the page.
  7125. if (node.parentNode) {
  7126. node.parentNode.removeChild(node);
  7127. }
  7128. // Remove the response callback from the callbackMap (window object in the
  7129. // browser).
  7130. delete _this.callbackMap[callback];
  7131. };
  7132. // onLoad() is the success callback which runs after the response callback
  7133. // if the JSONP script loads successfully. The event itself is unimportant.
  7134. // If something went wrong, onLoad() may run without the response callback
  7135. // having been invoked.
  7136. var onLoad = function (event) {
  7137. // Do nothing if the request has been cancelled.
  7138. if (cancelled) {
  7139. return;
  7140. }
  7141. // Cleanup the page.
  7142. cleanup();
  7143. // Check whether the response callback has run.
  7144. if (!finished) {
  7145. // It hasn't, something went wrong with the request. Return an error via
  7146. // the Observable error path. All JSONP errors have status 0.
  7147. observer.error(new HttpErrorResponse({
  7148. url: url,
  7149. status: 0,
  7150. statusText: 'JSONP Error',
  7151. error: new Error(JSONP_ERR_NO_CALLBACK),
  7152. }));
  7153. return;
  7154. }
  7155. // Success. body either contains the response body or null if none was
  7156. // returned.
  7157. observer.next(new HttpResponse({
  7158. body: body,
  7159. status: 200,
  7160. statusText: 'OK', url: url,
  7161. }));
  7162. // Complete the stream, the response is over.
  7163. observer.complete();
  7164. };
  7165. // onError() is the error callback, which runs if the script returned generates
  7166. // a Javascript error. It emits the error via the Observable error channel as
  7167. // a HttpErrorResponse.
  7168. var onError = function (error) {
  7169. // If the request was already cancelled, no need to emit anything.
  7170. if (cancelled) {
  7171. return;
  7172. }
  7173. cleanup();
  7174. // Wrap the error in a HttpErrorResponse.
  7175. observer.error(new HttpErrorResponse({
  7176. error: error,
  7177. status: 0,
  7178. statusText: 'JSONP Error', url: url,
  7179. }));
  7180. };
  7181. // Subscribe to both the success (load) and error events on the <script> tag,
  7182. // and add it to the page.
  7183. node.addEventListener('load', onLoad);
  7184. node.addEventListener('error', onError);
  7185. _this.document.body.appendChild(node);
  7186. // The request has now been successfully sent.
  7187. observer.next({ type: HttpEventType.Sent });
  7188. // Cancellation handler.
  7189. return function () {
  7190. // Track the cancellation so event listeners won't do anything even if already scheduled.
  7191. cancelled = true;
  7192. // Remove the event listeners so they won't run if the events later fire.
  7193. node.removeEventListener('load', onLoad);
  7194. node.removeEventListener('error', onError);
  7195. // And finally, clean up the page.
  7196. cleanup();
  7197. };
  7198. });
  7199. };
  7200. JsonpClientBackend = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7201. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7202. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_4__["DOCUMENT"])),
  7203. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [JsonpCallbackContext, Object])
  7204. ], JsonpClientBackend);
  7205. return JsonpClientBackend;
  7206. }());
  7207. /**
  7208. * An `HttpInterceptor` which identifies requests with the method JSONP and
  7209. * shifts them to the `JsonpClientBackend`.
  7210. *
  7211. *
  7212. */
  7213. var JsonpInterceptor = /** @class */ (function () {
  7214. function JsonpInterceptor(jsonp) {
  7215. this.jsonp = jsonp;
  7216. }
  7217. JsonpInterceptor.prototype.intercept = function (req, next) {
  7218. if (req.method === 'JSONP') {
  7219. return this.jsonp.handle(req);
  7220. }
  7221. // Fall through for normal HTTP requests.
  7222. return next.handle(req);
  7223. };
  7224. JsonpInterceptor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7225. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7226. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [JsonpClientBackend])
  7227. ], JsonpInterceptor);
  7228. return JsonpInterceptor;
  7229. }());
  7230. /**
  7231. * @license
  7232. * Copyright Google Inc. All Rights Reserved.
  7233. *
  7234. * Use of this source code is governed by an MIT-style license that can be
  7235. * found in the LICENSE file at https://angular.io/license
  7236. */
  7237. var XSSI_PREFIX = /^\)\]\}',?\n/;
  7238. /**
  7239. * Determine an appropriate URL for the response, by checking either
  7240. * XMLHttpRequest.responseURL or the X-Request-URL header.
  7241. */
  7242. function getResponseUrl(xhr) {
  7243. if ('responseURL' in xhr && xhr.responseURL) {
  7244. return xhr.responseURL;
  7245. }
  7246. if (/^X-Request-URL:/m.test(xhr.getAllResponseHeaders())) {
  7247. return xhr.getResponseHeader('X-Request-URL');
  7248. }
  7249. return null;
  7250. }
  7251. /**
  7252. * A wrapper around the `XMLHttpRequest` constructor.
  7253. *
  7254. *
  7255. */
  7256. var XhrFactory = /** @class */ (function () {
  7257. function XhrFactory() {
  7258. }
  7259. return XhrFactory;
  7260. }());
  7261. /**
  7262. * A factory for @{link HttpXhrBackend} that uses the `XMLHttpRequest` browser API.
  7263. *
  7264. *
  7265. */
  7266. var BrowserXhr = /** @class */ (function () {
  7267. function BrowserXhr() {
  7268. }
  7269. BrowserXhr.prototype.build = function () { return (new XMLHttpRequest()); };
  7270. BrowserXhr = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7271. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7272. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [])
  7273. ], BrowserXhr);
  7274. return BrowserXhr;
  7275. }());
  7276. /**
  7277. * An `HttpBackend` which uses the XMLHttpRequest API to send
  7278. * requests to a backend server.
  7279. *
  7280. *
  7281. */
  7282. var HttpXhrBackend = /** @class */ (function () {
  7283. function HttpXhrBackend(xhrFactory) {
  7284. this.xhrFactory = xhrFactory;
  7285. }
  7286. /**
  7287. * Process a request and return a stream of response events.
  7288. */
  7289. HttpXhrBackend.prototype.handle = function (req) {
  7290. var _this = this;
  7291. // Quick check to give a better error message when a user attempts to use
  7292. // HttpClient.jsonp() without installing the JsonpClientModule
  7293. if (req.method === 'JSONP') {
  7294. throw new Error("Attempted to construct Jsonp request without JsonpClientModule installed.");
  7295. }
  7296. // Everything happens on Observable subscription.
  7297. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (observer) {
  7298. // Start by setting up the XHR object with request method, URL, and withCredentials flag.
  7299. var xhr = _this.xhrFactory.build();
  7300. xhr.open(req.method, req.urlWithParams);
  7301. if (!!req.withCredentials) {
  7302. xhr.withCredentials = true;
  7303. }
  7304. // Add all the requested headers.
  7305. req.headers.forEach(function (name, values) { return xhr.setRequestHeader(name, values.join(',')); });
  7306. // Add an Accept header if one isn't present already.
  7307. if (!req.headers.has('Accept')) {
  7308. xhr.setRequestHeader('Accept', 'application/json, text/plain, */*');
  7309. }
  7310. // Auto-detect the Content-Type header if one isn't present already.
  7311. if (!req.headers.has('Content-Type')) {
  7312. var detectedType = req.detectContentTypeHeader();
  7313. // Sometimes Content-Type detection fails.
  7314. if (detectedType !== null) {
  7315. xhr.setRequestHeader('Content-Type', detectedType);
  7316. }
  7317. }
  7318. // Set the responseType if one was requested.
  7319. if (req.responseType) {
  7320. var responseType = req.responseType.toLowerCase();
  7321. // JSON responses need to be processed as text. This is because if the server
  7322. // returns an XSSI-prefixed JSON response, the browser will fail to parse it,
  7323. // xhr.response will be null, and xhr.responseText cannot be accessed to
  7324. // retrieve the prefixed JSON data in order to strip the prefix. Thus, all JSON
  7325. // is parsed by first requesting text and then applying JSON.parse.
  7326. xhr.responseType = ((responseType !== 'json') ? responseType : 'text');
  7327. }
  7328. // Serialize the request body if one is present. If not, this will be set to null.
  7329. var reqBody = req.serializeBody();
  7330. // If progress events are enabled, response headers will be delivered
  7331. // in two events - the HttpHeaderResponse event and the full HttpResponse
  7332. // event. However, since response headers don't change in between these
  7333. // two events, it doesn't make sense to parse them twice. So headerResponse
  7334. // caches the data extracted from the response whenever it's first parsed,
  7335. // to ensure parsing isn't duplicated.
  7336. var headerResponse = null;
  7337. // partialFromXhr extracts the HttpHeaderResponse from the current XMLHttpRequest
  7338. // state, and memoizes it into headerResponse.
  7339. var partialFromXhr = function () {
  7340. if (headerResponse !== null) {
  7341. return headerResponse;
  7342. }
  7343. // Read status and normalize an IE9 bug (http://bugs.jquery.com/ticket/1450).
  7344. var status = xhr.status === 1223 ? 204 : xhr.status;
  7345. var statusText = xhr.statusText || 'OK';
  7346. // Parse headers from XMLHttpRequest - this step is lazy.
  7347. var headers = new HttpHeaders(xhr.getAllResponseHeaders());
  7348. // Read the response URL from the XMLHttpResponse instance and fall back on the
  7349. // request URL.
  7350. var url = getResponseUrl(xhr) || req.url;
  7351. // Construct the HttpHeaderResponse and memoize it.
  7352. headerResponse = new HttpHeaderResponse({ headers: headers, status: status, statusText: statusText, url: url });
  7353. return headerResponse;
  7354. };
  7355. // Next, a few closures are defined for the various events which XMLHttpRequest can
  7356. // emit. This allows them to be unregistered as event listeners later.
  7357. // First up is the load event, which represents a response being fully available.
  7358. var onLoad = function () {
  7359. // Read response state from the memoized partial data.
  7360. var _a = partialFromXhr(), headers = _a.headers, status = _a.status, statusText = _a.statusText, url = _a.url;
  7361. // The body will be read out if present.
  7362. var body = null;
  7363. if (status !== 204) {
  7364. // Use XMLHttpRequest.response if set, responseText otherwise.
  7365. body = (typeof xhr.response === 'undefined') ? xhr.responseText : xhr.response;
  7366. }
  7367. // Normalize another potential bug (this one comes from CORS).
  7368. if (status === 0) {
  7369. status = !!body ? 200 : 0;
  7370. }
  7371. // ok determines whether the response will be transmitted on the event or
  7372. // error channel. Unsuccessful status codes (not 2xx) will always be errors,
  7373. // but a successful status code can still result in an error if the user
  7374. // asked for JSON data and the body cannot be parsed as such.
  7375. var ok = status >= 200 && status < 300;
  7376. // Check whether the body needs to be parsed as JSON (in many cases the browser
  7377. // will have done that already).
  7378. if (req.responseType === 'json' && typeof body === 'string') {
  7379. // Save the original body, before attempting XSSI prefix stripping.
  7380. var originalBody = body;
  7381. body = body.replace(XSSI_PREFIX, '');
  7382. try {
  7383. // Attempt the parse. If it fails, a parse error should be delivered to the user.
  7384. body = body !== '' ? JSON.parse(body) : null;
  7385. }
  7386. catch (error) {
  7387. // Since the JSON.parse failed, it's reasonable to assume this might not have been a
  7388. // JSON response. Restore the original body (including any XSSI prefix) to deliver
  7389. // a better error response.
  7390. body = originalBody;
  7391. // If this was an error request to begin with, leave it as a string, it probably
  7392. // just isn't JSON. Otherwise, deliver the parsing error to the user.
  7393. if (ok) {
  7394. // Even though the response status was 2xx, this is still an error.
  7395. ok = false;
  7396. // The parse error contains the text of the body that failed to parse.
  7397. body = { error: error, text: body };
  7398. }
  7399. }
  7400. }
  7401. if (ok) {
  7402. // A successful response is delivered on the event stream.
  7403. observer.next(new HttpResponse({
  7404. body: body,
  7405. headers: headers,
  7406. status: status,
  7407. statusText: statusText,
  7408. url: url || undefined,
  7409. }));
  7410. // The full body has been received and delivered, no further events
  7411. // are possible. This request is complete.
  7412. observer.complete();
  7413. }
  7414. else {
  7415. // An unsuccessful request is delivered on the error channel.
  7416. observer.error(new HttpErrorResponse({
  7417. // The error in this case is the response body (error from the server).
  7418. error: body,
  7419. headers: headers,
  7420. status: status,
  7421. statusText: statusText,
  7422. url: url || undefined,
  7423. }));
  7424. }
  7425. };
  7426. // The onError callback is called when something goes wrong at the network level.
  7427. // Connection timeout, DNS error, offline, etc. These are actual errors, and are
  7428. // transmitted on the error channel.
  7429. var onError = function (error) {
  7430. var res = new HttpErrorResponse({
  7431. error: error,
  7432. status: xhr.status || 0,
  7433. statusText: xhr.statusText || 'Unknown Error',
  7434. });
  7435. observer.error(res);
  7436. };
  7437. // The sentHeaders flag tracks whether the HttpResponseHeaders event
  7438. // has been sent on the stream. This is necessary to track if progress
  7439. // is enabled since the event will be sent on only the first download
  7440. // progerss event.
  7441. var sentHeaders = false;
  7442. // The download progress event handler, which is only registered if
  7443. // progress events are enabled.
  7444. var onDownProgress = function (event) {
  7445. // Send the HttpResponseHeaders event if it hasn't been sent already.
  7446. if (!sentHeaders) {
  7447. observer.next(partialFromXhr());
  7448. sentHeaders = true;
  7449. }
  7450. // Start building the download progress event to deliver on the response
  7451. // event stream.
  7452. var progressEvent = {
  7453. type: HttpEventType.DownloadProgress,
  7454. loaded: event.loaded,
  7455. };
  7456. // Set the total number of bytes in the event if it's available.
  7457. if (event.lengthComputable) {
  7458. progressEvent.total = event.total;
  7459. }
  7460. // If the request was for text content and a partial response is
  7461. // available on XMLHttpRequest, include it in the progress event
  7462. // to allow for streaming reads.
  7463. if (req.responseType === 'text' && !!xhr.responseText) {
  7464. progressEvent.partialText = xhr.responseText;
  7465. }
  7466. // Finally, fire the event.
  7467. observer.next(progressEvent);
  7468. };
  7469. // The upload progress event handler, which is only registered if
  7470. // progress events are enabled.
  7471. var onUpProgress = function (event) {
  7472. // Upload progress events are simpler. Begin building the progress
  7473. // event.
  7474. var progress = {
  7475. type: HttpEventType.UploadProgress,
  7476. loaded: event.loaded,
  7477. };
  7478. // If the total number of bytes being uploaded is available, include
  7479. // it.
  7480. if (event.lengthComputable) {
  7481. progress.total = event.total;
  7482. }
  7483. // Send the event.
  7484. observer.next(progress);
  7485. };
  7486. // By default, register for load and error events.
  7487. xhr.addEventListener('load', onLoad);
  7488. xhr.addEventListener('error', onError);
  7489. // Progress events are only enabled if requested.
  7490. if (req.reportProgress) {
  7491. // Download progress is always enabled if requested.
  7492. xhr.addEventListener('progress', onDownProgress);
  7493. // Upload progress depends on whether there is a body to upload.
  7494. if (reqBody !== null && xhr.upload) {
  7495. xhr.upload.addEventListener('progress', onUpProgress);
  7496. }
  7497. }
  7498. // Fire the request, and notify the event stream that it was fired.
  7499. xhr.send(reqBody);
  7500. observer.next({ type: HttpEventType.Sent });
  7501. // This is the return from the Observable function, which is the
  7502. // request cancellation handler.
  7503. return function () {
  7504. // On a cancellation, remove all registered event listeners.
  7505. xhr.removeEventListener('error', onError);
  7506. xhr.removeEventListener('load', onLoad);
  7507. if (req.reportProgress) {
  7508. xhr.removeEventListener('progress', onDownProgress);
  7509. if (reqBody !== null && xhr.upload) {
  7510. xhr.upload.removeEventListener('progress', onUpProgress);
  7511. }
  7512. }
  7513. // Finally, abort the in-flight request.
  7514. xhr.abort();
  7515. };
  7516. });
  7517. };
  7518. HttpXhrBackend = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7519. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7520. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [XhrFactory])
  7521. ], HttpXhrBackend);
  7522. return HttpXhrBackend;
  7523. }());
  7524. /**
  7525. * @license
  7526. * Copyright Google Inc. All Rights Reserved.
  7527. *
  7528. * Use of this source code is governed by an MIT-style license that can be
  7529. * found in the LICENSE file at https://angular.io/license
  7530. */
  7531. var XSRF_COOKIE_NAME = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('XSRF_COOKIE_NAME');
  7532. var XSRF_HEADER_NAME = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('XSRF_HEADER_NAME');
  7533. /**
  7534. * Retrieves the current XSRF token to use with the next outgoing request.
  7535. *
  7536. *
  7537. */
  7538. var HttpXsrfTokenExtractor = /** @class */ (function () {
  7539. function HttpXsrfTokenExtractor() {
  7540. }
  7541. return HttpXsrfTokenExtractor;
  7542. }());
  7543. /**
  7544. * `HttpXsrfTokenExtractor` which retrieves the token from a cookie.
  7545. */
  7546. var HttpXsrfCookieExtractor = /** @class */ (function () {
  7547. function HttpXsrfCookieExtractor(doc, platform, cookieName) {
  7548. this.doc = doc;
  7549. this.platform = platform;
  7550. this.cookieName = cookieName;
  7551. this.lastCookieString = '';
  7552. this.lastToken = null;
  7553. /**
  7554. * @internal for testing
  7555. */
  7556. this.parseCount = 0;
  7557. }
  7558. HttpXsrfCookieExtractor.prototype.getToken = function () {
  7559. if (this.platform === 'server') {
  7560. return null;
  7561. }
  7562. var cookieString = this.doc.cookie || '';
  7563. if (cookieString !== this.lastCookieString) {
  7564. this.parseCount++;
  7565. this.lastToken = Object(_angular_common__WEBPACK_IMPORTED_MODULE_4__["ɵparseCookieValue"])(cookieString, this.cookieName);
  7566. this.lastCookieString = cookieString;
  7567. }
  7568. return this.lastToken;
  7569. };
  7570. HttpXsrfCookieExtractor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7571. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7572. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(_angular_common__WEBPACK_IMPORTED_MODULE_4__["DOCUMENT"])), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_ID"])),
  7573. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(XSRF_COOKIE_NAME)),
  7574. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object, String, String])
  7575. ], HttpXsrfCookieExtractor);
  7576. return HttpXsrfCookieExtractor;
  7577. }());
  7578. /**
  7579. * `HttpInterceptor` which adds an XSRF token to eligible outgoing requests.
  7580. */
  7581. var HttpXsrfInterceptor = /** @class */ (function () {
  7582. function HttpXsrfInterceptor(tokenService, headerName) {
  7583. this.tokenService = tokenService;
  7584. this.headerName = headerName;
  7585. }
  7586. HttpXsrfInterceptor.prototype.intercept = function (req, next) {
  7587. var lcUrl = req.url.toLowerCase();
  7588. // Skip both non-mutating requests and absolute URLs.
  7589. // Non-mutating requests don't require a token, and absolute URLs require special handling
  7590. // anyway as the cookie set
  7591. // on our origin is not the same as the token expected by another origin.
  7592. if (req.method === 'GET' || req.method === 'HEAD' || lcUrl.startsWith('http://') ||
  7593. lcUrl.startsWith('https://')) {
  7594. return next.handle(req);
  7595. }
  7596. var token = this.tokenService.getToken();
  7597. // Be careful not to overwrite an existing header of the same name.
  7598. if (token !== null && !req.headers.has(this.headerName)) {
  7599. req = req.clone({ headers: req.headers.set(this.headerName, token) });
  7600. }
  7601. return next.handle(req);
  7602. };
  7603. HttpXsrfInterceptor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7604. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7605. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(XSRF_HEADER_NAME)),
  7606. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [HttpXsrfTokenExtractor, String])
  7607. ], HttpXsrfInterceptor);
  7608. return HttpXsrfInterceptor;
  7609. }());
  7610. /**
  7611. * @license
  7612. * Copyright Google Inc. All Rights Reserved.
  7613. *
  7614. * Use of this source code is governed by an MIT-style license that can be
  7615. * found in the LICENSE file at https://angular.io/license
  7616. */
  7617. /**
  7618. * An injectable `HttpHandler` that applies multiple interceptors
  7619. * to a request before passing it to the given `HttpBackend`.
  7620. *
  7621. * The interceptors are loaded lazily from the injector, to allow
  7622. * interceptors to themselves inject classes depending indirectly
  7623. * on `HttpInterceptingHandler` itself.
  7624. * @see `HttpInterceptor`
  7625. */
  7626. var HttpInterceptingHandler = /** @class */ (function () {
  7627. function HttpInterceptingHandler(backend, injector) {
  7628. this.backend = backend;
  7629. this.injector = injector;
  7630. this.chain = null;
  7631. }
  7632. HttpInterceptingHandler.prototype.handle = function (req) {
  7633. if (this.chain === null) {
  7634. var interceptors = this.injector.get(HTTP_INTERCEPTORS, []);
  7635. this.chain = interceptors.reduceRight(function (next, interceptor) { return new HttpInterceptorHandler(next, interceptor); }, this.backend);
  7636. }
  7637. return this.chain.handle(req);
  7638. };
  7639. HttpInterceptingHandler = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7640. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  7641. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [HttpBackend, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"]])
  7642. ], HttpInterceptingHandler);
  7643. return HttpInterceptingHandler;
  7644. }());
  7645. /**
  7646. * Factory function that determines where to store JSONP callbacks.
  7647. *
  7648. * Ordinarily JSONP callbacks are stored on the `window` object, but this may not exist
  7649. * in test environments. In that case, callbacks are stored on an anonymous object instead.
  7650. *
  7651. *
  7652. */
  7653. function jsonpCallbackContext() {
  7654. if (typeof window === 'object') {
  7655. return window;
  7656. }
  7657. return {};
  7658. }
  7659. /**
  7660. * Configures XSRF protection support for outgoing requests.
  7661. *
  7662. * For a server that supports a cookie-based XSRF protection system,
  7663. * use directly to configure XSRF protection with the correct
  7664. * cookie and header names.
  7665. *
  7666. * If no names are supplied, the default cookie name is `XSRF-TOKEN`
  7667. * and the default header name is `X-XSRF-TOKEN`.
  7668. *
  7669. *
  7670. */
  7671. var HttpClientXsrfModule = /** @class */ (function () {
  7672. function HttpClientXsrfModule() {
  7673. }
  7674. HttpClientXsrfModule_1 = HttpClientXsrfModule;
  7675. /**
  7676. * Disable the default XSRF protection.
  7677. */
  7678. HttpClientXsrfModule.disable = function () {
  7679. return {
  7680. ngModule: HttpClientXsrfModule_1,
  7681. providers: [
  7682. { provide: HttpXsrfInterceptor, useClass: NoopInterceptor },
  7683. ],
  7684. };
  7685. };
  7686. /**
  7687. * Configure XSRF protection.
  7688. * @param options An object that can specify either or both
  7689. * cookie name or header name.
  7690. * - Cookie name default is `XSRF-TOKEN`.
  7691. * - Header name default is `X-XSRF-TOKEN`.
  7692. *
  7693. */
  7694. HttpClientXsrfModule.withOptions = function (options) {
  7695. if (options === void 0) { options = {}; }
  7696. return {
  7697. ngModule: HttpClientXsrfModule_1,
  7698. providers: [
  7699. options.cookieName ? { provide: XSRF_COOKIE_NAME, useValue: options.cookieName } : [],
  7700. options.headerName ? { provide: XSRF_HEADER_NAME, useValue: options.headerName } : [],
  7701. ],
  7702. };
  7703. };
  7704. var HttpClientXsrfModule_1;
  7705. HttpClientXsrfModule = HttpClientXsrfModule_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7706. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  7707. providers: [
  7708. HttpXsrfInterceptor,
  7709. { provide: HTTP_INTERCEPTORS, useExisting: HttpXsrfInterceptor, multi: true },
  7710. { provide: HttpXsrfTokenExtractor, useClass: HttpXsrfCookieExtractor },
  7711. { provide: XSRF_COOKIE_NAME, useValue: 'XSRF-TOKEN' },
  7712. { provide: XSRF_HEADER_NAME, useValue: 'X-XSRF-TOKEN' },
  7713. ],
  7714. })
  7715. ], HttpClientXsrfModule);
  7716. return HttpClientXsrfModule;
  7717. }());
  7718. /**
  7719. * Configures the [dependency injector](guide/glossary#injector) for `HttpClient`
  7720. * with supporting services for XSRF. Automatically imported by `HttpClientModule`.
  7721. *
  7722. * You can add interceptors to the chain behind `HttpClient` by binding them to the
  7723. * multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`.
  7724. *
  7725. *
  7726. */
  7727. var HttpClientModule = /** @class */ (function () {
  7728. function HttpClientModule() {
  7729. }
  7730. HttpClientModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7731. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  7732. /**
  7733. * Optional configuration for XSRF protection.
  7734. */
  7735. imports: [
  7736. HttpClientXsrfModule.withOptions({
  7737. cookieName: 'XSRF-TOKEN',
  7738. headerName: 'X-XSRF-TOKEN',
  7739. }),
  7740. ],
  7741. /**
  7742. * Configures the [dependency injector](guide/glossary#injector) where it is imported
  7743. * with supporting services for HTTP communications.
  7744. */
  7745. providers: [
  7746. HttpClient,
  7747. { provide: HttpHandler, useClass: HttpInterceptingHandler },
  7748. HttpXhrBackend,
  7749. { provide: HttpBackend, useExisting: HttpXhrBackend },
  7750. BrowserXhr,
  7751. { provide: XhrFactory, useExisting: BrowserXhr },
  7752. ],
  7753. })
  7754. ], HttpClientModule);
  7755. return HttpClientModule;
  7756. }());
  7757. /**
  7758. * Configures the [dependency injector](guide/glossary#injector) for `HttpClient`
  7759. * with supporting services for JSONP.
  7760. * Without this module, Jsonp requests reach the backend
  7761. * with method JSONP, where they are rejected.
  7762. *
  7763. * You can add interceptors to the chain behind `HttpClient` by binding them to the
  7764. * multiprovider for built-in [DI token](guide/glossary#di-token) `HTTP_INTERCEPTORS`.
  7765. *
  7766. *
  7767. */
  7768. var HttpClientJsonpModule = /** @class */ (function () {
  7769. function HttpClientJsonpModule() {
  7770. }
  7771. HttpClientJsonpModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  7772. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  7773. providers: [
  7774. JsonpClientBackend,
  7775. { provide: JsonpCallbackContext, useFactory: jsonpCallbackContext },
  7776. { provide: HTTP_INTERCEPTORS, useClass: JsonpInterceptor, multi: true },
  7777. ],
  7778. })
  7779. ], HttpClientJsonpModule);
  7780. return HttpClientJsonpModule;
  7781. }());
  7782. /**
  7783. * @license
  7784. * Copyright Google Inc. All Rights Reserved.
  7785. *
  7786. * Use of this source code is governed by an MIT-style license that can be
  7787. * found in the LICENSE file at https://angular.io/license
  7788. */
  7789. /**
  7790. * @license
  7791. * Copyright Google Inc. All Rights Reserved.
  7792. *
  7793. * Use of this source code is governed by an MIT-style license that can be
  7794. * found in the LICENSE file at https://angular.io/license
  7795. */
  7796. /**
  7797. * Generated bundle index. Do not edit.
  7798. */
  7799. //# sourceMappingURL=http.js.map
  7800. /***/ }),
  7801. /***/ "./node_modules/@angular/compiler/fesm5/compiler.js":
  7802. /*!**********************************************************!*\
  7803. !*** ./node_modules/@angular/compiler/fesm5/compiler.js ***!
  7804. \**********************************************************/
  7805. /*! exports provided: core, CompilerConfig, preserveWhitespacesDefault, isLoweredSymbol, createLoweredSymbol, Identifiers, JitCompiler, ConstantPool, DirectiveResolver, PipeResolver, NgModuleResolver, DEFAULT_INTERPOLATION_CONFIG, InterpolationConfig, NgModuleCompiler, ArrayType, AssertNotNull, BinaryOperator, BinaryOperatorExpr, BuiltinMethod, BuiltinType, BuiltinTypeName, BuiltinVar, CastExpr, ClassField, ClassMethod, ClassStmt, CommaExpr, CommentStmt, ConditionalExpr, DeclareFunctionStmt, DeclareVarStmt, Expression, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FunctionExpr, IfStmt, InstantiateExpr, InvokeFunctionExpr, InvokeMethodExpr, JSDocCommentStmt, LiteralArrayExpr, LiteralExpr, LiteralMapExpr, MapType, NotExpr, ReadKeyExpr, ReadPropExpr, ReadVarExpr, ReturnStatement, ThrowStmt, TryCatchStmt, Type, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, StmtModifier, Statement, TypeofExpr, collectExternalReferences, EmitterVisitorContext, ViewCompiler, getParseErrors, isSyntaxError, syntaxError, Version, jitExpression, R3ResolvedDependencyType, compileInjector, compileNgModule, compilePipeFromMetadata, makeBindingParser, parseTemplate, compileComponentFromMetadata, compileDirectiveFromMetadata, parseHostBindings, VERSION, TextAst, BoundTextAst, AttrAst, BoundElementPropertyAst, BoundEventAst, ReferenceAst, VariableAst, ElementAst, EmbeddedTemplateAst, BoundDirectivePropertyAst, DirectiveAst, ProviderAst, ProviderAstType, NgContentAst, NullTemplateVisitor, RecursiveTemplateAstVisitor, templateVisitAll, sanitizeIdentifier, identifierName, identifierModuleUrl, viewClassName, rendererTypeName, hostViewClassName, componentFactoryName, CompileSummaryKind, tokenName, tokenReference, CompileStylesheetMetadata, CompileTemplateMetadata, CompileDirectiveMetadata, CompilePipeMetadata, CompileShallowModuleMetadata, CompileNgModuleMetadata, TransitiveCompileNgModuleMetadata, ProviderMeta, flatten, templateSourceUrl, sharedStylesheetJitUrl, ngModuleJitUrl, templateJitUrl, createAotUrlResolver, createAotCompiler, AotCompiler, analyzeNgModules, analyzeAndValidateNgModules, analyzeFile, analyzeFileForInjectables, mergeAnalyzedFiles, GeneratedFile, toTypeScript, formattedError, isFormattedError, StaticReflector, StaticSymbol, StaticSymbolCache, ResolvedStaticSymbol, StaticSymbolResolver, unescapeIdentifier, unwrapResolvedMetadata, AotSummaryResolver, AstPath, SummaryResolver, JitSummaryResolver, CompileReflector, createUrlResolverWithoutPackagePrefix, createOfflineCompileUrlResolver, UrlResolver, getUrlScheme, ResourceLoader, ElementSchemaRegistry, Extractor, I18NHtmlParser, MessageBundle, Serializer, Xliff, Xliff2, Xmb, Xtb, DirectiveNormalizer, ParserError, ParseSpan, AST, Quote, EmptyExpr, ImplicitReceiver, Chain, Conditional, PropertyRead, PropertyWrite, SafePropertyRead, KeyedRead, KeyedWrite, BindingPipe, LiteralPrimitive, LiteralArray, LiteralMap, Interpolation, Binary, PrefixNot, NonNullAssert, MethodCall, SafeMethodCall, FunctionCall, ASTWithSource, TemplateBinding, NullAstVisitor, RecursiveAstVisitor, AstTransformer, AstMemoryEfficientTransformer, visitAstChildren, ParsedProperty, ParsedPropertyType, ParsedEvent, ParsedVariable, BoundElementProperty, TokenType, Lexer, Token, EOF, isIdentifier, isQuote, SplitInterpolation, TemplateBindingParseResult, Parser, _ParseAST, ERROR_COMPONENT_TYPE, CompileMetadataResolver, Text, Expansion, ExpansionCase, Attribute, Element, Comment, visitAll, RecursiveVisitor, findNode, HtmlParser, ParseTreeResult, TreeError, HtmlTagDefinition, getHtmlTagDefinition, TagContentType, splitNsName, isNgContainer, isNgContent, isNgTemplate, getNsPrefix, mergeNsAndName, NAMED_ENTITIES, NGSP_UNICODE, debugOutputAstAsTypeScript, TypeScriptEmitter, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseErrorLevel, ParseError, typeSourceSpan, DomElementSchemaRegistry, CssSelector, SelectorMatcher, SelectorListContext, SelectorContext, StylesCompileDependency, CompiledStylesheet, StyleCompiler, TemplateParseError, TemplateParseResult, TemplateParser, splitClasses, createElementCssSelector, removeSummaryDuplicates, compileInjectable */
  7806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  7807. "use strict";
  7808. __webpack_require__.r(__webpack_exports__);
  7809. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "core", function() { return core; });
  7810. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilerConfig", function() { return CompilerConfig; });
  7811. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "preserveWhitespacesDefault", function() { return preserveWhitespacesDefault; });
  7812. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isLoweredSymbol", function() { return isLoweredSymbol; });
  7813. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createLoweredSymbol", function() { return createLoweredSymbol; });
  7814. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Identifiers", function() { return Identifiers; });
  7815. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitCompiler", function() { return JitCompiler; });
  7816. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConstantPool", function() { return ConstantPool; });
  7817. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectiveResolver", function() { return DirectiveResolver; });
  7818. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PipeResolver", function() { return PipeResolver; });
  7819. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleResolver", function() { return NgModuleResolver; });
  7820. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DEFAULT_INTERPOLATION_CONFIG", function() { return DEFAULT_INTERPOLATION_CONFIG; });
  7821. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InterpolationConfig", function() { return InterpolationConfig; });
  7822. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleCompiler", function() { return NgModuleCompiler; });
  7823. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArrayType", function() { return ArrayType; });
  7824. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AssertNotNull", function() { return AssertNotNull; });
  7825. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BinaryOperator", function() { return BinaryOperator; });
  7826. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BinaryOperatorExpr", function() { return BinaryOperatorExpr; });
  7827. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinMethod", function() { return BuiltinMethod; });
  7828. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinType", function() { return BuiltinType; });
  7829. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinTypeName", function() { return BuiltinTypeName; });
  7830. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BuiltinVar", function() { return BuiltinVar; });
  7831. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CastExpr", function() { return CastExpr; });
  7832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClassField", function() { return ClassField; });
  7833. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClassMethod", function() { return ClassMethod; });
  7834. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ClassStmt", function() { return ClassStmt; });
  7835. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommaExpr", function() { return CommaExpr; });
  7836. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CommentStmt", function() { return CommentStmt; });
  7837. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConditionalExpr", function() { return ConditionalExpr; });
  7838. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeclareFunctionStmt", function() { return DeclareFunctionStmt; });
  7839. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DeclareVarStmt", function() { return DeclareVarStmt; });
  7840. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expression", function() { return Expression; });
  7841. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionStatement", function() { return ExpressionStatement; });
  7842. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpressionType", function() { return ExpressionType; });
  7843. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExternalExpr", function() { return ExternalExpr; });
  7844. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExternalReference", function() { return ExternalReference; });
  7845. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionExpr", function() { return FunctionExpr; });
  7846. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IfStmt", function() { return IfStmt; });
  7847. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InstantiateExpr", function() { return InstantiateExpr; });
  7848. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvokeFunctionExpr", function() { return InvokeFunctionExpr; });
  7849. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InvokeMethodExpr", function() { return InvokeMethodExpr; });
  7850. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JSDocCommentStmt", function() { return JSDocCommentStmt; });
  7851. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralArrayExpr", function() { return LiteralArrayExpr; });
  7852. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralExpr", function() { return LiteralExpr; });
  7853. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralMapExpr", function() { return LiteralMapExpr; });
  7854. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MapType", function() { return MapType; });
  7855. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NotExpr", function() { return NotExpr; });
  7856. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReadKeyExpr", function() { return ReadKeyExpr; });
  7857. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReadPropExpr", function() { return ReadPropExpr; });
  7858. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReadVarExpr", function() { return ReadVarExpr; });
  7859. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReturnStatement", function() { return ReturnStatement; });
  7860. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ThrowStmt", function() { return ThrowStmt; });
  7861. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TryCatchStmt", function() { return TryCatchStmt; });
  7862. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type$1; });
  7863. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedNodeExpr", function() { return WrappedNodeExpr; });
  7864. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WriteKeyExpr", function() { return WriteKeyExpr; });
  7865. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WritePropExpr", function() { return WritePropExpr; });
  7866. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WriteVarExpr", function() { return WriteVarExpr; });
  7867. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StmtModifier", function() { return StmtModifier; });
  7868. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Statement", function() { return Statement; });
  7869. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TypeofExpr", function() { return TypeofExpr; });
  7870. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "collectExternalReferences", function() { return collectExternalReferences; });
  7871. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmitterVisitorContext", function() { return EmitterVisitorContext; });
  7872. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewCompiler", function() { return ViewCompiler; });
  7873. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getParseErrors", function() { return getParseErrors; });
  7874. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isSyntaxError", function() { return isSyntaxError; });
  7875. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "syntaxError", function() { return syntaxError; });
  7876. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Version", function() { return Version; });
  7877. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "jitExpression", function() { return jitExpression; });
  7878. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "R3ResolvedDependencyType", function() { return R3ResolvedDependencyType; });
  7879. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileInjector", function() { return compileInjector; });
  7880. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileNgModule", function() { return compileNgModule; });
  7881. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compilePipeFromMetadata", function() { return compilePipeFromMetadata; });
  7882. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeBindingParser", function() { return makeBindingParser; });
  7883. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseTemplate", function() { return parseTemplate; });
  7884. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileComponentFromMetadata", function() { return compileComponentFromMetadata; });
  7885. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileDirectiveFromMetadata", function() { return compileDirectiveFromMetadata; });
  7886. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "parseHostBindings", function() { return parseHostBindings; });
  7887. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  7888. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TextAst", function() { return TextAst; });
  7889. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundTextAst", function() { return BoundTextAst; });
  7890. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AttrAst", function() { return AttrAst; });
  7891. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundElementPropertyAst", function() { return BoundElementPropertyAst; });
  7892. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundEventAst", function() { return BoundEventAst; });
  7893. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReferenceAst", function() { return ReferenceAst; });
  7894. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VariableAst", function() { return VariableAst; });
  7895. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementAst", function() { return ElementAst; });
  7896. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedTemplateAst", function() { return EmbeddedTemplateAst; });
  7897. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundDirectivePropertyAst", function() { return BoundDirectivePropertyAst; });
  7898. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectiveAst", function() { return DirectiveAst; });
  7899. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProviderAst", function() { return ProviderAst; });
  7900. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProviderAstType", function() { return ProviderAstType; });
  7901. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgContentAst", function() { return NgContentAst; });
  7902. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NullTemplateVisitor", function() { return NullTemplateVisitor; });
  7903. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecursiveTemplateAstVisitor", function() { return RecursiveTemplateAstVisitor; });
  7904. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "templateVisitAll", function() { return templateVisitAll; });
  7905. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sanitizeIdentifier", function() { return sanitizeIdentifier; });
  7906. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identifierName", function() { return identifierName; });
  7907. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identifierModuleUrl", function() { return identifierModuleUrl; });
  7908. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "viewClassName", function() { return viewClassName; });
  7909. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rendererTypeName", function() { return rendererTypeName; });
  7910. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hostViewClassName", function() { return hostViewClassName; });
  7911. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "componentFactoryName", function() { return componentFactoryName; });
  7912. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileSummaryKind", function() { return CompileSummaryKind; });
  7913. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenName", function() { return tokenName; });
  7914. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tokenReference", function() { return tokenReference; });
  7915. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileStylesheetMetadata", function() { return CompileStylesheetMetadata; });
  7916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileTemplateMetadata", function() { return CompileTemplateMetadata; });
  7917. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileDirectiveMetadata", function() { return CompileDirectiveMetadata; });
  7918. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilePipeMetadata", function() { return CompilePipeMetadata; });
  7919. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileShallowModuleMetadata", function() { return CompileShallowModuleMetadata; });
  7920. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileNgModuleMetadata", function() { return CompileNgModuleMetadata; });
  7921. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransitiveCompileNgModuleMetadata", function() { return TransitiveCompileNgModuleMetadata; });
  7922. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ProviderMeta", function() { return ProviderMeta; });
  7923. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "flatten", function() { return flatten; });
  7924. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "templateSourceUrl", function() { return templateSourceUrl; });
  7925. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sharedStylesheetJitUrl", function() { return sharedStylesheetJitUrl; });
  7926. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ngModuleJitUrl", function() { return ngModuleJitUrl; });
  7927. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "templateJitUrl", function() { return templateJitUrl; });
  7928. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAotUrlResolver", function() { return createAotUrlResolver; });
  7929. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createAotCompiler", function() { return createAotCompiler; });
  7930. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AotCompiler", function() { return AotCompiler; });
  7931. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeNgModules", function() { return analyzeNgModules; });
  7932. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeAndValidateNgModules", function() { return analyzeAndValidateNgModules; });
  7933. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeFile", function() { return analyzeFile; });
  7934. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "analyzeFileForInjectables", function() { return analyzeFileForInjectables; });
  7935. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeAnalyzedFiles", function() { return mergeAnalyzedFiles; });
  7936. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GeneratedFile", function() { return GeneratedFile; });
  7937. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toTypeScript", function() { return toTypeScript; });
  7938. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "formattedError", function() { return formattedError; });
  7939. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFormattedError", function() { return isFormattedError; });
  7940. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticReflector", function() { return StaticReflector; });
  7941. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticSymbol", function() { return StaticSymbol; });
  7942. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticSymbolCache", function() { return StaticSymbolCache; });
  7943. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolvedStaticSymbol", function() { return ResolvedStaticSymbol; });
  7944. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StaticSymbolResolver", function() { return StaticSymbolResolver; });
  7945. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unescapeIdentifier", function() { return unescapeIdentifier; });
  7946. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "unwrapResolvedMetadata", function() { return unwrapResolvedMetadata; });
  7947. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AotSummaryResolver", function() { return AotSummaryResolver; });
  7948. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstPath", function() { return AstPath; });
  7949. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SummaryResolver", function() { return SummaryResolver; });
  7950. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitSummaryResolver", function() { return JitSummaryResolver; });
  7951. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileReflector", function() { return CompileReflector; });
  7952. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createUrlResolverWithoutPackagePrefix", function() { return createUrlResolverWithoutPackagePrefix; });
  7953. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createOfflineCompileUrlResolver", function() { return createOfflineCompileUrlResolver; });
  7954. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlResolver", function() { return UrlResolver; });
  7955. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getUrlScheme", function() { return getUrlScheme; });
  7956. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResourceLoader", function() { return ResourceLoader; });
  7957. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementSchemaRegistry", function() { return ElementSchemaRegistry; });
  7958. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Extractor", function() { return Extractor; });
  7959. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "I18NHtmlParser", function() { return I18NHtmlParser; });
  7960. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MessageBundle", function() { return MessageBundle; });
  7961. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Serializer", function() { return Serializer; });
  7962. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xliff", function() { return Xliff; });
  7963. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xliff2", function() { return Xliff2; });
  7964. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xmb", function() { return Xmb; });
  7965. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Xtb", function() { return Xtb; });
  7966. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DirectiveNormalizer", function() { return DirectiveNormalizer; });
  7967. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParserError", function() { return ParserError; });
  7968. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseSpan", function() { return ParseSpan; });
  7969. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AST", function() { return AST; });
  7970. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Quote", function() { return Quote; });
  7971. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmptyExpr", function() { return EmptyExpr; });
  7972. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ImplicitReceiver", function() { return ImplicitReceiver; });
  7973. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Chain", function() { return Chain; });
  7974. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Conditional", function() { return Conditional; });
  7975. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropertyRead", function() { return PropertyRead; });
  7976. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PropertyWrite", function() { return PropertyWrite; });
  7977. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SafePropertyRead", function() { return SafePropertyRead; });
  7978. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyedRead", function() { return KeyedRead; });
  7979. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyedWrite", function() { return KeyedWrite; });
  7980. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BindingPipe", function() { return BindingPipe; });
  7981. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralPrimitive", function() { return LiteralPrimitive; });
  7982. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralArray", function() { return LiteralArray; });
  7983. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LiteralMap", function() { return LiteralMap; });
  7984. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Interpolation", function() { return Interpolation; });
  7985. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Binary", function() { return Binary; });
  7986. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PrefixNot", function() { return PrefixNot; });
  7987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NonNullAssert", function() { return NonNullAssert; });
  7988. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MethodCall", function() { return MethodCall; });
  7989. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SafeMethodCall", function() { return SafeMethodCall; });
  7990. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FunctionCall", function() { return FunctionCall; });
  7991. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ASTWithSource", function() { return ASTWithSource; });
  7992. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateBinding", function() { return TemplateBinding; });
  7993. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NullAstVisitor", function() { return NullAstVisitor; });
  7994. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecursiveAstVisitor", function() { return RecursiveAstVisitor; });
  7995. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstTransformer", function() { return AstTransformer; });
  7996. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AstMemoryEfficientTransformer", function() { return AstMemoryEfficientTransformer; });
  7997. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "visitAstChildren", function() { return visitAstChildren; });
  7998. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedProperty", function() { return ParsedProperty; });
  7999. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedPropertyType", function() { return ParsedPropertyType; });
  8000. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedEvent", function() { return ParsedEvent; });
  8001. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParsedVariable", function() { return ParsedVariable; });
  8002. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BoundElementProperty", function() { return BoundElementProperty; });
  8003. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TokenType", function() { return TokenType; });
  8004. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Lexer", function() { return Lexer; });
  8005. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Token", function() { return Token; });
  8006. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EOF", function() { return EOF; });
  8007. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIdentifier", function() { return isIdentifier; });
  8008. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isQuote", function() { return isQuote; });
  8009. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SplitInterpolation", function() { return SplitInterpolation; });
  8010. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateBindingParseResult", function() { return TemplateBindingParseResult; });
  8011. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Parser", function() { return Parser; });
  8012. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "_ParseAST", function() { return _ParseAST; });
  8013. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ERROR_COMPONENT_TYPE", function() { return ERROR_COMPONENT_TYPE; });
  8014. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompileMetadataResolver", function() { return CompileMetadataResolver; });
  8015. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Text", function() { return Text; });
  8016. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Expansion", function() { return Expansion; });
  8017. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpansionCase", function() { return ExpansionCase; });
  8018. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribute", function() { return Attribute; });
  8019. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Element", function() { return Element; });
  8020. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Comment", function() { return Comment; });
  8021. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "visitAll", function() { return visitAll; });
  8022. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RecursiveVisitor", function() { return RecursiveVisitor; });
  8023. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findNode", function() { return findNode; });
  8024. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HtmlParser", function() { return HtmlParser; });
  8025. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseTreeResult", function() { return ParseTreeResult; });
  8026. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TreeError", function() { return TreeError; });
  8027. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HtmlTagDefinition", function() { return HtmlTagDefinition; });
  8028. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getHtmlTagDefinition", function() { return getHtmlTagDefinition; });
  8029. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TagContentType", function() { return TagContentType; });
  8030. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitNsName", function() { return splitNsName; });
  8031. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNgContainer", function() { return isNgContainer; });
  8032. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNgContent", function() { return isNgContent; });
  8033. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNgTemplate", function() { return isNgTemplate; });
  8034. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getNsPrefix", function() { return getNsPrefix; });
  8035. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeNsAndName", function() { return mergeNsAndName; });
  8036. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NAMED_ENTITIES", function() { return NAMED_ENTITIES; });
  8037. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NGSP_UNICODE", function() { return NGSP_UNICODE; });
  8038. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debugOutputAstAsTypeScript", function() { return debugOutputAstAsTypeScript; });
  8039. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TypeScriptEmitter", function() { return TypeScriptEmitter; });
  8040. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseLocation", function() { return ParseLocation; });
  8041. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseSourceFile", function() { return ParseSourceFile; });
  8042. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseSourceSpan", function() { return ParseSourceSpan; });
  8043. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseErrorLevel", function() { return ParseErrorLevel; });
  8044. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ParseError", function() { return ParseError; });
  8045. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "typeSourceSpan", function() { return typeSourceSpan; });
  8046. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomElementSchemaRegistry", function() { return DomElementSchemaRegistry; });
  8047. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CssSelector", function() { return CssSelector; });
  8048. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectorMatcher", function() { return SelectorMatcher; });
  8049. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectorListContext", function() { return SelectorListContext; });
  8050. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectorContext", function() { return SelectorContext; });
  8051. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StylesCompileDependency", function() { return StylesCompileDependency; });
  8052. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompiledStylesheet", function() { return CompiledStylesheet; });
  8053. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "StyleCompiler", function() { return StyleCompiler; });
  8054. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateParseError", function() { return TemplateParseError; });
  8055. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateParseResult", function() { return TemplateParseResult; });
  8056. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateParser", function() { return TemplateParser; });
  8057. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "splitClasses", function() { return splitClasses; });
  8058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createElementCssSelector", function() { return createElementCssSelector; });
  8059. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "removeSummaryDuplicates", function() { return removeSummaryDuplicates; });
  8060. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "compileInjectable", function() { return compileInjectable; });
  8061. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  8062. /**
  8063. * @license Angular v6.1.10
  8064. * (c) 2010-2018 Google, Inc. https://angular.io/
  8065. * License: MIT
  8066. */
  8067. /**
  8068. * @license
  8069. * Copyright Google Inc. All Rights Reserved.
  8070. *
  8071. * Use of this source code is governed by an MIT-style license that can be
  8072. * found in the LICENSE file at https://angular.io/license
  8073. */
  8074. var TagContentType;
  8075. (function (TagContentType) {
  8076. TagContentType[TagContentType["RAW_TEXT"] = 0] = "RAW_TEXT";
  8077. TagContentType[TagContentType["ESCAPABLE_RAW_TEXT"] = 1] = "ESCAPABLE_RAW_TEXT";
  8078. TagContentType[TagContentType["PARSABLE_DATA"] = 2] = "PARSABLE_DATA";
  8079. })(TagContentType || (TagContentType = {}));
  8080. function splitNsName(elementName) {
  8081. if (elementName[0] != ':') {
  8082. return [null, elementName];
  8083. }
  8084. var colonIndex = elementName.indexOf(':', 1);
  8085. if (colonIndex == -1) {
  8086. throw new Error("Unsupported format \"" + elementName + "\" expecting \":namespace:name\"");
  8087. }
  8088. return [elementName.slice(1, colonIndex), elementName.slice(colonIndex + 1)];
  8089. }
  8090. // `<ng-container>` tags work the same regardless the namespace
  8091. function isNgContainer(tagName) {
  8092. return splitNsName(tagName)[1] === 'ng-container';
  8093. }
  8094. // `<ng-content>` tags work the same regardless the namespace
  8095. function isNgContent(tagName) {
  8096. return splitNsName(tagName)[1] === 'ng-content';
  8097. }
  8098. // `<ng-template>` tags work the same regardless the namespace
  8099. function isNgTemplate(tagName) {
  8100. return splitNsName(tagName)[1] === 'ng-template';
  8101. }
  8102. function getNsPrefix(fullName) {
  8103. return fullName === null ? null : splitNsName(fullName)[0];
  8104. }
  8105. function mergeNsAndName(prefix, localName) {
  8106. return prefix ? ":" + prefix + ":" + localName : localName;
  8107. }
  8108. // see http://www.w3.org/TR/html51/syntax.html#named-character-references
  8109. // see https://html.spec.whatwg.org/multipage/entities.json
  8110. // This list is not exhaustive to keep the compiler footprint low.
  8111. // The `&#123;` / `&#x1ab;` syntax should be used when the named character reference does not
  8112. // exist.
  8113. var NAMED_ENTITIES = {
  8114. 'Aacute': '\u00C1',
  8115. 'aacute': '\u00E1',
  8116. 'Acirc': '\u00C2',
  8117. 'acirc': '\u00E2',
  8118. 'acute': '\u00B4',
  8119. 'AElig': '\u00C6',
  8120. 'aelig': '\u00E6',
  8121. 'Agrave': '\u00C0',
  8122. 'agrave': '\u00E0',
  8123. 'alefsym': '\u2135',
  8124. 'Alpha': '\u0391',
  8125. 'alpha': '\u03B1',
  8126. 'amp': '&',
  8127. 'and': '\u2227',
  8128. 'ang': '\u2220',
  8129. 'apos': '\u0027',
  8130. 'Aring': '\u00C5',
  8131. 'aring': '\u00E5',
  8132. 'asymp': '\u2248',
  8133. 'Atilde': '\u00C3',
  8134. 'atilde': '\u00E3',
  8135. 'Auml': '\u00C4',
  8136. 'auml': '\u00E4',
  8137. 'bdquo': '\u201E',
  8138. 'Beta': '\u0392',
  8139. 'beta': '\u03B2',
  8140. 'brvbar': '\u00A6',
  8141. 'bull': '\u2022',
  8142. 'cap': '\u2229',
  8143. 'Ccedil': '\u00C7',
  8144. 'ccedil': '\u00E7',
  8145. 'cedil': '\u00B8',
  8146. 'cent': '\u00A2',
  8147. 'Chi': '\u03A7',
  8148. 'chi': '\u03C7',
  8149. 'circ': '\u02C6',
  8150. 'clubs': '\u2663',
  8151. 'cong': '\u2245',
  8152. 'copy': '\u00A9',
  8153. 'crarr': '\u21B5',
  8154. 'cup': '\u222A',
  8155. 'curren': '\u00A4',
  8156. 'dagger': '\u2020',
  8157. 'Dagger': '\u2021',
  8158. 'darr': '\u2193',
  8159. 'dArr': '\u21D3',
  8160. 'deg': '\u00B0',
  8161. 'Delta': '\u0394',
  8162. 'delta': '\u03B4',
  8163. 'diams': '\u2666',
  8164. 'divide': '\u00F7',
  8165. 'Eacute': '\u00C9',
  8166. 'eacute': '\u00E9',
  8167. 'Ecirc': '\u00CA',
  8168. 'ecirc': '\u00EA',
  8169. 'Egrave': '\u00C8',
  8170. 'egrave': '\u00E8',
  8171. 'empty': '\u2205',
  8172. 'emsp': '\u2003',
  8173. 'ensp': '\u2002',
  8174. 'Epsilon': '\u0395',
  8175. 'epsilon': '\u03B5',
  8176. 'equiv': '\u2261',
  8177. 'Eta': '\u0397',
  8178. 'eta': '\u03B7',
  8179. 'ETH': '\u00D0',
  8180. 'eth': '\u00F0',
  8181. 'Euml': '\u00CB',
  8182. 'euml': '\u00EB',
  8183. 'euro': '\u20AC',
  8184. 'exist': '\u2203',
  8185. 'fnof': '\u0192',
  8186. 'forall': '\u2200',
  8187. 'frac12': '\u00BD',
  8188. 'frac14': '\u00BC',
  8189. 'frac34': '\u00BE',
  8190. 'frasl': '\u2044',
  8191. 'Gamma': '\u0393',
  8192. 'gamma': '\u03B3',
  8193. 'ge': '\u2265',
  8194. 'gt': '>',
  8195. 'harr': '\u2194',
  8196. 'hArr': '\u21D4',
  8197. 'hearts': '\u2665',
  8198. 'hellip': '\u2026',
  8199. 'Iacute': '\u00CD',
  8200. 'iacute': '\u00ED',
  8201. 'Icirc': '\u00CE',
  8202. 'icirc': '\u00EE',
  8203. 'iexcl': '\u00A1',
  8204. 'Igrave': '\u00CC',
  8205. 'igrave': '\u00EC',
  8206. 'image': '\u2111',
  8207. 'infin': '\u221E',
  8208. 'int': '\u222B',
  8209. 'Iota': '\u0399',
  8210. 'iota': '\u03B9',
  8211. 'iquest': '\u00BF',
  8212. 'isin': '\u2208',
  8213. 'Iuml': '\u00CF',
  8214. 'iuml': '\u00EF',
  8215. 'Kappa': '\u039A',
  8216. 'kappa': '\u03BA',
  8217. 'Lambda': '\u039B',
  8218. 'lambda': '\u03BB',
  8219. 'lang': '\u27E8',
  8220. 'laquo': '\u00AB',
  8221. 'larr': '\u2190',
  8222. 'lArr': '\u21D0',
  8223. 'lceil': '\u2308',
  8224. 'ldquo': '\u201C',
  8225. 'le': '\u2264',
  8226. 'lfloor': '\u230A',
  8227. 'lowast': '\u2217',
  8228. 'loz': '\u25CA',
  8229. 'lrm': '\u200E',
  8230. 'lsaquo': '\u2039',
  8231. 'lsquo': '\u2018',
  8232. 'lt': '<',
  8233. 'macr': '\u00AF',
  8234. 'mdash': '\u2014',
  8235. 'micro': '\u00B5',
  8236. 'middot': '\u00B7',
  8237. 'minus': '\u2212',
  8238. 'Mu': '\u039C',
  8239. 'mu': '\u03BC',
  8240. 'nabla': '\u2207',
  8241. 'nbsp': '\u00A0',
  8242. 'ndash': '\u2013',
  8243. 'ne': '\u2260',
  8244. 'ni': '\u220B',
  8245. 'not': '\u00AC',
  8246. 'notin': '\u2209',
  8247. 'nsub': '\u2284',
  8248. 'Ntilde': '\u00D1',
  8249. 'ntilde': '\u00F1',
  8250. 'Nu': '\u039D',
  8251. 'nu': '\u03BD',
  8252. 'Oacute': '\u00D3',
  8253. 'oacute': '\u00F3',
  8254. 'Ocirc': '\u00D4',
  8255. 'ocirc': '\u00F4',
  8256. 'OElig': '\u0152',
  8257. 'oelig': '\u0153',
  8258. 'Ograve': '\u00D2',
  8259. 'ograve': '\u00F2',
  8260. 'oline': '\u203E',
  8261. 'Omega': '\u03A9',
  8262. 'omega': '\u03C9',
  8263. 'Omicron': '\u039F',
  8264. 'omicron': '\u03BF',
  8265. 'oplus': '\u2295',
  8266. 'or': '\u2228',
  8267. 'ordf': '\u00AA',
  8268. 'ordm': '\u00BA',
  8269. 'Oslash': '\u00D8',
  8270. 'oslash': '\u00F8',
  8271. 'Otilde': '\u00D5',
  8272. 'otilde': '\u00F5',
  8273. 'otimes': '\u2297',
  8274. 'Ouml': '\u00D6',
  8275. 'ouml': '\u00F6',
  8276. 'para': '\u00B6',
  8277. 'permil': '\u2030',
  8278. 'perp': '\u22A5',
  8279. 'Phi': '\u03A6',
  8280. 'phi': '\u03C6',
  8281. 'Pi': '\u03A0',
  8282. 'pi': '\u03C0',
  8283. 'piv': '\u03D6',
  8284. 'plusmn': '\u00B1',
  8285. 'pound': '\u00A3',
  8286. 'prime': '\u2032',
  8287. 'Prime': '\u2033',
  8288. 'prod': '\u220F',
  8289. 'prop': '\u221D',
  8290. 'Psi': '\u03A8',
  8291. 'psi': '\u03C8',
  8292. 'quot': '\u0022',
  8293. 'radic': '\u221A',
  8294. 'rang': '\u27E9',
  8295. 'raquo': '\u00BB',
  8296. 'rarr': '\u2192',
  8297. 'rArr': '\u21D2',
  8298. 'rceil': '\u2309',
  8299. 'rdquo': '\u201D',
  8300. 'real': '\u211C',
  8301. 'reg': '\u00AE',
  8302. 'rfloor': '\u230B',
  8303. 'Rho': '\u03A1',
  8304. 'rho': '\u03C1',
  8305. 'rlm': '\u200F',
  8306. 'rsaquo': '\u203A',
  8307. 'rsquo': '\u2019',
  8308. 'sbquo': '\u201A',
  8309. 'Scaron': '\u0160',
  8310. 'scaron': '\u0161',
  8311. 'sdot': '\u22C5',
  8312. 'sect': '\u00A7',
  8313. 'shy': '\u00AD',
  8314. 'Sigma': '\u03A3',
  8315. 'sigma': '\u03C3',
  8316. 'sigmaf': '\u03C2',
  8317. 'sim': '\u223C',
  8318. 'spades': '\u2660',
  8319. 'sub': '\u2282',
  8320. 'sube': '\u2286',
  8321. 'sum': '\u2211',
  8322. 'sup': '\u2283',
  8323. 'sup1': '\u00B9',
  8324. 'sup2': '\u00B2',
  8325. 'sup3': '\u00B3',
  8326. 'supe': '\u2287',
  8327. 'szlig': '\u00DF',
  8328. 'Tau': '\u03A4',
  8329. 'tau': '\u03C4',
  8330. 'there4': '\u2234',
  8331. 'Theta': '\u0398',
  8332. 'theta': '\u03B8',
  8333. 'thetasym': '\u03D1',
  8334. 'thinsp': '\u2009',
  8335. 'THORN': '\u00DE',
  8336. 'thorn': '\u00FE',
  8337. 'tilde': '\u02DC',
  8338. 'times': '\u00D7',
  8339. 'trade': '\u2122',
  8340. 'Uacute': '\u00DA',
  8341. 'uacute': '\u00FA',
  8342. 'uarr': '\u2191',
  8343. 'uArr': '\u21D1',
  8344. 'Ucirc': '\u00DB',
  8345. 'ucirc': '\u00FB',
  8346. 'Ugrave': '\u00D9',
  8347. 'ugrave': '\u00F9',
  8348. 'uml': '\u00A8',
  8349. 'upsih': '\u03D2',
  8350. 'Upsilon': '\u03A5',
  8351. 'upsilon': '\u03C5',
  8352. 'Uuml': '\u00DC',
  8353. 'uuml': '\u00FC',
  8354. 'weierp': '\u2118',
  8355. 'Xi': '\u039E',
  8356. 'xi': '\u03BE',
  8357. 'Yacute': '\u00DD',
  8358. 'yacute': '\u00FD',
  8359. 'yen': '\u00A5',
  8360. 'yuml': '\u00FF',
  8361. 'Yuml': '\u0178',
  8362. 'Zeta': '\u0396',
  8363. 'zeta': '\u03B6',
  8364. 'zwj': '\u200D',
  8365. 'zwnj': '\u200C',
  8366. };
  8367. // The &ngsp; pseudo-entity is denoting a space. see:
  8368. // https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart
  8369. var NGSP_UNICODE = '\uE500';
  8370. NAMED_ENTITIES['ngsp'] = NGSP_UNICODE;
  8371. /**
  8372. * @license
  8373. * Copyright Google Inc. All Rights Reserved.
  8374. *
  8375. * Use of this source code is governed by an MIT-style license that can be
  8376. * found in the LICENSE file at https://angular.io/license
  8377. */
  8378. var HtmlTagDefinition = /** @class */ (function () {
  8379. function HtmlTagDefinition(_a) {
  8380. var _b = _a === void 0 ? {} : _a, closedByChildren = _b.closedByChildren, requiredParents = _b.requiredParents, implicitNamespacePrefix = _b.implicitNamespacePrefix, _c = _b.contentType, contentType = _c === void 0 ? TagContentType.PARSABLE_DATA : _c, _d = _b.closedByParent, closedByParent = _d === void 0 ? false : _d, _e = _b.isVoid, isVoid = _e === void 0 ? false : _e, _f = _b.ignoreFirstLf, ignoreFirstLf = _f === void 0 ? false : _f;
  8381. var _this = this;
  8382. this.closedByChildren = {};
  8383. this.closedByParent = false;
  8384. this.canSelfClose = false;
  8385. if (closedByChildren && closedByChildren.length > 0) {
  8386. closedByChildren.forEach(function (tagName) { return _this.closedByChildren[tagName] = true; });
  8387. }
  8388. this.isVoid = isVoid;
  8389. this.closedByParent = closedByParent || isVoid;
  8390. if (requiredParents && requiredParents.length > 0) {
  8391. this.requiredParents = {};
  8392. // The first parent is the list is automatically when none of the listed parents are present
  8393. this.parentToAdd = requiredParents[0];
  8394. requiredParents.forEach(function (tagName) { return _this.requiredParents[tagName] = true; });
  8395. }
  8396. this.implicitNamespacePrefix = implicitNamespacePrefix || null;
  8397. this.contentType = contentType;
  8398. this.ignoreFirstLf = ignoreFirstLf;
  8399. }
  8400. HtmlTagDefinition.prototype.requireExtraParent = function (currentParent) {
  8401. if (!this.requiredParents) {
  8402. return false;
  8403. }
  8404. if (!currentParent) {
  8405. return true;
  8406. }
  8407. var lcParent = currentParent.toLowerCase();
  8408. var isParentTemplate = lcParent === 'template' || currentParent === 'ng-template';
  8409. return !isParentTemplate && this.requiredParents[lcParent] != true;
  8410. };
  8411. HtmlTagDefinition.prototype.isClosedByChild = function (name) {
  8412. return this.isVoid || name.toLowerCase() in this.closedByChildren;
  8413. };
  8414. return HtmlTagDefinition;
  8415. }());
  8416. var _DEFAULT_TAG_DEFINITION;
  8417. // see http://www.w3.org/TR/html51/syntax.html#optional-tags
  8418. // This implementation does not fully conform to the HTML5 spec.
  8419. var TAG_DEFINITIONS;
  8420. function getHtmlTagDefinition(tagName) {
  8421. if (!TAG_DEFINITIONS) {
  8422. _DEFAULT_TAG_DEFINITION = new HtmlTagDefinition();
  8423. TAG_DEFINITIONS = {
  8424. 'base': new HtmlTagDefinition({ isVoid: true }),
  8425. 'meta': new HtmlTagDefinition({ isVoid: true }),
  8426. 'area': new HtmlTagDefinition({ isVoid: true }),
  8427. 'embed': new HtmlTagDefinition({ isVoid: true }),
  8428. 'link': new HtmlTagDefinition({ isVoid: true }),
  8429. 'img': new HtmlTagDefinition({ isVoid: true }),
  8430. 'input': new HtmlTagDefinition({ isVoid: true }),
  8431. 'param': new HtmlTagDefinition({ isVoid: true }),
  8432. 'hr': new HtmlTagDefinition({ isVoid: true }),
  8433. 'br': new HtmlTagDefinition({ isVoid: true }),
  8434. 'source': new HtmlTagDefinition({ isVoid: true }),
  8435. 'track': new HtmlTagDefinition({ isVoid: true }),
  8436. 'wbr': new HtmlTagDefinition({ isVoid: true }),
  8437. 'p': new HtmlTagDefinition({
  8438. closedByChildren: [
  8439. 'address', 'article', 'aside', 'blockquote', 'div', 'dl', 'fieldset',
  8440. 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5',
  8441. 'h6', 'header', 'hgroup', 'hr', 'main', 'nav', 'ol',
  8442. 'p', 'pre', 'section', 'table', 'ul'
  8443. ],
  8444. closedByParent: true
  8445. }),
  8446. 'thead': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'] }),
  8447. 'tbody': new HtmlTagDefinition({ closedByChildren: ['tbody', 'tfoot'], closedByParent: true }),
  8448. 'tfoot': new HtmlTagDefinition({ closedByChildren: ['tbody'], closedByParent: true }),
  8449. 'tr': new HtmlTagDefinition({
  8450. closedByChildren: ['tr'],
  8451. requiredParents: ['tbody', 'tfoot', 'thead'],
  8452. closedByParent: true
  8453. }),
  8454. 'td': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
  8455. 'th': new HtmlTagDefinition({ closedByChildren: ['td', 'th'], closedByParent: true }),
  8456. 'col': new HtmlTagDefinition({ requiredParents: ['colgroup'], isVoid: true }),
  8457. 'svg': new HtmlTagDefinition({ implicitNamespacePrefix: 'svg' }),
  8458. 'math': new HtmlTagDefinition({ implicitNamespacePrefix: 'math' }),
  8459. 'li': new HtmlTagDefinition({ closedByChildren: ['li'], closedByParent: true }),
  8460. 'dt': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'] }),
  8461. 'dd': new HtmlTagDefinition({ closedByChildren: ['dt', 'dd'], closedByParent: true }),
  8462. 'rb': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
  8463. 'rt': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
  8464. 'rtc': new HtmlTagDefinition({ closedByChildren: ['rb', 'rtc', 'rp'], closedByParent: true }),
  8465. 'rp': new HtmlTagDefinition({ closedByChildren: ['rb', 'rt', 'rtc', 'rp'], closedByParent: true }),
  8466. 'optgroup': new HtmlTagDefinition({ closedByChildren: ['optgroup'], closedByParent: true }),
  8467. 'option': new HtmlTagDefinition({ closedByChildren: ['option', 'optgroup'], closedByParent: true }),
  8468. 'pre': new HtmlTagDefinition({ ignoreFirstLf: true }),
  8469. 'listing': new HtmlTagDefinition({ ignoreFirstLf: true }),
  8470. 'style': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
  8471. 'script': new HtmlTagDefinition({ contentType: TagContentType.RAW_TEXT }),
  8472. 'title': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT }),
  8473. 'textarea': new HtmlTagDefinition({ contentType: TagContentType.ESCAPABLE_RAW_TEXT, ignoreFirstLf: true }),
  8474. };
  8475. }
  8476. return TAG_DEFINITIONS[tagName.toLowerCase()] || _DEFAULT_TAG_DEFINITION;
  8477. }
  8478. /**
  8479. * @license
  8480. * Copyright Google Inc. All Rights Reserved.
  8481. *
  8482. * Use of this source code is governed by an MIT-style license that can be
  8483. * found in the LICENSE file at https://angular.io/license
  8484. */
  8485. var _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + //":not("
  8486. '([-\\w]+)|' + // "tag"
  8487. '(?:\\.([-\\w]+))|' + // ".class"
  8488. // "-" should appear first in the regexp below as FF31 parses "[.-\w]" as a range
  8489. '(?:\\[([-.\\w*]+)(?:=([\"\']?)([^\\]\"\']*)\\5)?\\])|' + // "[name]", "[name=value]",
  8490. // "[name="value"]",
  8491. // "[name='value']"
  8492. '(\\))|' + // ")"
  8493. '(\\s*,\\s*)', // ","
  8494. 'g');
  8495. /**
  8496. * A css selector contains an element name,
  8497. * css classes and attribute/value pairs with the purpose
  8498. * of selecting subsets out of them.
  8499. */
  8500. var CssSelector = /** @class */ (function () {
  8501. function CssSelector() {
  8502. this.element = null;
  8503. this.classNames = [];
  8504. /**
  8505. * The selectors are encoded in pairs where:
  8506. * - even locations are attribute names
  8507. * - odd locations are attribute values.
  8508. *
  8509. * Example:
  8510. * Selector: `[key1=value1][key2]` would parse to:
  8511. * ```
  8512. * ['key1', 'value1', 'key2', '']
  8513. * ```
  8514. */
  8515. this.attrs = [];
  8516. this.notSelectors = [];
  8517. }
  8518. CssSelector.parse = function (selector) {
  8519. var results = [];
  8520. var _addResult = function (res, cssSel) {
  8521. if (cssSel.notSelectors.length > 0 && !cssSel.element && cssSel.classNames.length == 0 &&
  8522. cssSel.attrs.length == 0) {
  8523. cssSel.element = '*';
  8524. }
  8525. res.push(cssSel);
  8526. };
  8527. var cssSelector = new CssSelector();
  8528. var match;
  8529. var current = cssSelector;
  8530. var inNot = false;
  8531. _SELECTOR_REGEXP.lastIndex = 0;
  8532. while (match = _SELECTOR_REGEXP.exec(selector)) {
  8533. if (match[1]) {
  8534. if (inNot) {
  8535. throw new Error('Nesting :not is not allowed in a selector');
  8536. }
  8537. inNot = true;
  8538. current = new CssSelector();
  8539. cssSelector.notSelectors.push(current);
  8540. }
  8541. if (match[2]) {
  8542. current.setElement(match[2]);
  8543. }
  8544. if (match[3]) {
  8545. current.addClassName(match[3]);
  8546. }
  8547. if (match[4]) {
  8548. current.addAttribute(match[4], match[6]);
  8549. }
  8550. if (match[7]) {
  8551. inNot = false;
  8552. current = cssSelector;
  8553. }
  8554. if (match[8]) {
  8555. if (inNot) {
  8556. throw new Error('Multiple selectors in :not are not supported');
  8557. }
  8558. _addResult(results, cssSelector);
  8559. cssSelector = current = new CssSelector();
  8560. }
  8561. }
  8562. _addResult(results, cssSelector);
  8563. return results;
  8564. };
  8565. CssSelector.prototype.isElementSelector = function () {
  8566. return this.hasElementSelector() && this.classNames.length == 0 && this.attrs.length == 0 &&
  8567. this.notSelectors.length === 0;
  8568. };
  8569. CssSelector.prototype.hasElementSelector = function () { return !!this.element; };
  8570. CssSelector.prototype.setElement = function (element) {
  8571. if (element === void 0) { element = null; }
  8572. this.element = element;
  8573. };
  8574. /** Gets a template string for an element that matches the selector. */
  8575. CssSelector.prototype.getMatchingElementTemplate = function () {
  8576. var tagName = this.element || 'div';
  8577. var classAttr = this.classNames.length > 0 ? " class=\"" + this.classNames.join(' ') + "\"" : '';
  8578. var attrs = '';
  8579. for (var i = 0; i < this.attrs.length; i += 2) {
  8580. var attrName = this.attrs[i];
  8581. var attrValue = this.attrs[i + 1] !== '' ? "=\"" + this.attrs[i + 1] + "\"" : '';
  8582. attrs += " " + attrName + attrValue;
  8583. }
  8584. return getHtmlTagDefinition(tagName).isVoid ? "<" + tagName + classAttr + attrs + "/>" :
  8585. "<" + tagName + classAttr + attrs + "></" + tagName + ">";
  8586. };
  8587. CssSelector.prototype.getAttrs = function () {
  8588. var result = [];
  8589. if (this.classNames.length > 0) {
  8590. result.push('class', this.classNames.join(' '));
  8591. }
  8592. return result.concat(this.attrs);
  8593. };
  8594. CssSelector.prototype.addAttribute = function (name, value) {
  8595. if (value === void 0) { value = ''; }
  8596. this.attrs.push(name, value && value.toLowerCase() || '');
  8597. };
  8598. CssSelector.prototype.addClassName = function (name) { this.classNames.push(name.toLowerCase()); };
  8599. CssSelector.prototype.toString = function () {
  8600. var res = this.element || '';
  8601. if (this.classNames) {
  8602. this.classNames.forEach(function (klass) { return res += "." + klass; });
  8603. }
  8604. if (this.attrs) {
  8605. for (var i = 0; i < this.attrs.length; i += 2) {
  8606. var name_1 = this.attrs[i];
  8607. var value = this.attrs[i + 1];
  8608. res += "[" + name_1 + (value ? '=' + value : '') + "]";
  8609. }
  8610. }
  8611. this.notSelectors.forEach(function (notSelector) { return res += ":not(" + notSelector + ")"; });
  8612. return res;
  8613. };
  8614. return CssSelector;
  8615. }());
  8616. /**
  8617. * Reads a list of CssSelectors and allows to calculate which ones
  8618. * are contained in a given CssSelector.
  8619. */
  8620. var SelectorMatcher = /** @class */ (function () {
  8621. function SelectorMatcher() {
  8622. this._elementMap = new Map();
  8623. this._elementPartialMap = new Map();
  8624. this._classMap = new Map();
  8625. this._classPartialMap = new Map();
  8626. this._attrValueMap = new Map();
  8627. this._attrValuePartialMap = new Map();
  8628. this._listContexts = [];
  8629. }
  8630. SelectorMatcher.createNotMatcher = function (notSelectors) {
  8631. var notMatcher = new SelectorMatcher();
  8632. notMatcher.addSelectables(notSelectors, null);
  8633. return notMatcher;
  8634. };
  8635. SelectorMatcher.prototype.addSelectables = function (cssSelectors, callbackCtxt) {
  8636. var listContext = null;
  8637. if (cssSelectors.length > 1) {
  8638. listContext = new SelectorListContext(cssSelectors);
  8639. this._listContexts.push(listContext);
  8640. }
  8641. for (var i = 0; i < cssSelectors.length; i++) {
  8642. this._addSelectable(cssSelectors[i], callbackCtxt, listContext);
  8643. }
  8644. };
  8645. /**
  8646. * Add an object that can be found later on by calling `match`.
  8647. * @param cssSelector A css selector
  8648. * @param callbackCtxt An opaque object that will be given to the callback of the `match` function
  8649. */
  8650. SelectorMatcher.prototype._addSelectable = function (cssSelector, callbackCtxt, listContext) {
  8651. var matcher = this;
  8652. var element = cssSelector.element;
  8653. var classNames = cssSelector.classNames;
  8654. var attrs = cssSelector.attrs;
  8655. var selectable = new SelectorContext(cssSelector, callbackCtxt, listContext);
  8656. if (element) {
  8657. var isTerminal = attrs.length === 0 && classNames.length === 0;
  8658. if (isTerminal) {
  8659. this._addTerminal(matcher._elementMap, element, selectable);
  8660. }
  8661. else {
  8662. matcher = this._addPartial(matcher._elementPartialMap, element);
  8663. }
  8664. }
  8665. if (classNames) {
  8666. for (var i = 0; i < classNames.length; i++) {
  8667. var isTerminal = attrs.length === 0 && i === classNames.length - 1;
  8668. var className = classNames[i];
  8669. if (isTerminal) {
  8670. this._addTerminal(matcher._classMap, className, selectable);
  8671. }
  8672. else {
  8673. matcher = this._addPartial(matcher._classPartialMap, className);
  8674. }
  8675. }
  8676. }
  8677. if (attrs) {
  8678. for (var i = 0; i < attrs.length; i += 2) {
  8679. var isTerminal = i === attrs.length - 2;
  8680. var name_2 = attrs[i];
  8681. var value = attrs[i + 1];
  8682. if (isTerminal) {
  8683. var terminalMap = matcher._attrValueMap;
  8684. var terminalValuesMap = terminalMap.get(name_2);
  8685. if (!terminalValuesMap) {
  8686. terminalValuesMap = new Map();
  8687. terminalMap.set(name_2, terminalValuesMap);
  8688. }
  8689. this._addTerminal(terminalValuesMap, value, selectable);
  8690. }
  8691. else {
  8692. var partialMap = matcher._attrValuePartialMap;
  8693. var partialValuesMap = partialMap.get(name_2);
  8694. if (!partialValuesMap) {
  8695. partialValuesMap = new Map();
  8696. partialMap.set(name_2, partialValuesMap);
  8697. }
  8698. matcher = this._addPartial(partialValuesMap, value);
  8699. }
  8700. }
  8701. }
  8702. };
  8703. SelectorMatcher.prototype._addTerminal = function (map, name, selectable) {
  8704. var terminalList = map.get(name);
  8705. if (!terminalList) {
  8706. terminalList = [];
  8707. map.set(name, terminalList);
  8708. }
  8709. terminalList.push(selectable);
  8710. };
  8711. SelectorMatcher.prototype._addPartial = function (map, name) {
  8712. var matcher = map.get(name);
  8713. if (!matcher) {
  8714. matcher = new SelectorMatcher();
  8715. map.set(name, matcher);
  8716. }
  8717. return matcher;
  8718. };
  8719. /**
  8720. * Find the objects that have been added via `addSelectable`
  8721. * whose css selector is contained in the given css selector.
  8722. * @param cssSelector A css selector
  8723. * @param matchedCallback This callback will be called with the object handed into `addSelectable`
  8724. * @return boolean true if a match was found
  8725. */
  8726. SelectorMatcher.prototype.match = function (cssSelector, matchedCallback) {
  8727. var result = false;
  8728. var element = cssSelector.element;
  8729. var classNames = cssSelector.classNames;
  8730. var attrs = cssSelector.attrs;
  8731. for (var i = 0; i < this._listContexts.length; i++) {
  8732. this._listContexts[i].alreadyMatched = false;
  8733. }
  8734. result = this._matchTerminal(this._elementMap, element, cssSelector, matchedCallback) || result;
  8735. result = this._matchPartial(this._elementPartialMap, element, cssSelector, matchedCallback) ||
  8736. result;
  8737. if (classNames) {
  8738. for (var i = 0; i < classNames.length; i++) {
  8739. var className = classNames[i];
  8740. result =
  8741. this._matchTerminal(this._classMap, className, cssSelector, matchedCallback) || result;
  8742. result =
  8743. this._matchPartial(this._classPartialMap, className, cssSelector, matchedCallback) ||
  8744. result;
  8745. }
  8746. }
  8747. if (attrs) {
  8748. for (var i = 0; i < attrs.length; i += 2) {
  8749. var name_3 = attrs[i];
  8750. var value = attrs[i + 1];
  8751. var terminalValuesMap = this._attrValueMap.get(name_3);
  8752. if (value) {
  8753. result =
  8754. this._matchTerminal(terminalValuesMap, '', cssSelector, matchedCallback) || result;
  8755. }
  8756. result =
  8757. this._matchTerminal(terminalValuesMap, value, cssSelector, matchedCallback) || result;
  8758. var partialValuesMap = this._attrValuePartialMap.get(name_3);
  8759. if (value) {
  8760. result = this._matchPartial(partialValuesMap, '', cssSelector, matchedCallback) || result;
  8761. }
  8762. result =
  8763. this._matchPartial(partialValuesMap, value, cssSelector, matchedCallback) || result;
  8764. }
  8765. }
  8766. return result;
  8767. };
  8768. /** @internal */
  8769. SelectorMatcher.prototype._matchTerminal = function (map, name, cssSelector, matchedCallback) {
  8770. if (!map || typeof name !== 'string') {
  8771. return false;
  8772. }
  8773. var selectables = map.get(name) || [];
  8774. var starSelectables = map.get('*');
  8775. if (starSelectables) {
  8776. selectables = selectables.concat(starSelectables);
  8777. }
  8778. if (selectables.length === 0) {
  8779. return false;
  8780. }
  8781. var selectable;
  8782. var result = false;
  8783. for (var i = 0; i < selectables.length; i++) {
  8784. selectable = selectables[i];
  8785. result = selectable.finalize(cssSelector, matchedCallback) || result;
  8786. }
  8787. return result;
  8788. };
  8789. /** @internal */
  8790. SelectorMatcher.prototype._matchPartial = function (map, name, cssSelector, matchedCallback) {
  8791. if (!map || typeof name !== 'string') {
  8792. return false;
  8793. }
  8794. var nestedSelector = map.get(name);
  8795. if (!nestedSelector) {
  8796. return false;
  8797. }
  8798. // TODO(perf): get rid of recursion and measure again
  8799. // TODO(perf): don't pass the whole selector into the recursion,
  8800. // but only the not processed parts
  8801. return nestedSelector.match(cssSelector, matchedCallback);
  8802. };
  8803. return SelectorMatcher;
  8804. }());
  8805. var SelectorListContext = /** @class */ (function () {
  8806. function SelectorListContext(selectors) {
  8807. this.selectors = selectors;
  8808. this.alreadyMatched = false;
  8809. }
  8810. return SelectorListContext;
  8811. }());
  8812. // Store context to pass back selector and context when a selector is matched
  8813. var SelectorContext = /** @class */ (function () {
  8814. function SelectorContext(selector, cbContext, listContext) {
  8815. this.selector = selector;
  8816. this.cbContext = cbContext;
  8817. this.listContext = listContext;
  8818. this.notSelectors = selector.notSelectors;
  8819. }
  8820. SelectorContext.prototype.finalize = function (cssSelector, callback) {
  8821. var result = true;
  8822. if (this.notSelectors.length > 0 && (!this.listContext || !this.listContext.alreadyMatched)) {
  8823. var notMatcher = SelectorMatcher.createNotMatcher(this.notSelectors);
  8824. result = !notMatcher.match(cssSelector, null);
  8825. }
  8826. if (result && callback && (!this.listContext || !this.listContext.alreadyMatched)) {
  8827. if (this.listContext) {
  8828. this.listContext.alreadyMatched = true;
  8829. }
  8830. callback(this.selector, this.cbContext);
  8831. }
  8832. return result;
  8833. };
  8834. return SelectorContext;
  8835. }());
  8836. /**
  8837. * @license
  8838. * Copyright Google Inc. All Rights Reserved.
  8839. *
  8840. * Use of this source code is governed by an MIT-style license that can be
  8841. * found in the LICENSE file at https://angular.io/license
  8842. */
  8843. var createInject = makeMetadataFactory('Inject', function (token) { return ({ token: token }); });
  8844. var createInjectionToken = makeMetadataFactory('InjectionToken', function (desc) { return ({ _desc: desc, ngInjectableDef: undefined }); });
  8845. var createAttribute = makeMetadataFactory('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
  8846. var createContentChildren = makeMetadataFactory('ContentChildren', function (selector, data) {
  8847. if (data === void 0) { data = {}; }
  8848. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
  8849. });
  8850. var createContentChild = makeMetadataFactory('ContentChild', function (selector, data) {
  8851. if (data === void 0) { data = {}; }
  8852. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
  8853. });
  8854. var createViewChildren = makeMetadataFactory('ViewChildren', function (selector, data) {
  8855. if (data === void 0) { data = {}; }
  8856. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
  8857. });
  8858. var createViewChild = makeMetadataFactory('ViewChild', function (selector, data) {
  8859. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
  8860. });
  8861. var createDirective = makeMetadataFactory('Directive', function (dir) {
  8862. if (dir === void 0) { dir = {}; }
  8863. return dir;
  8864. });
  8865. var ViewEncapsulation;
  8866. (function (ViewEncapsulation) {
  8867. ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
  8868. ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native";
  8869. ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
  8870. ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
  8871. })(ViewEncapsulation || (ViewEncapsulation = {}));
  8872. var ChangeDetectionStrategy;
  8873. (function (ChangeDetectionStrategy) {
  8874. ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
  8875. ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
  8876. })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
  8877. var createComponent = makeMetadataFactory('Component', function (c) {
  8878. if (c === void 0) { c = {}; }
  8879. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ changeDetection: ChangeDetectionStrategy.Default }, c));
  8880. });
  8881. var createPipe = makeMetadataFactory('Pipe', function (p) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ pure: true }, p)); });
  8882. var createInput = makeMetadataFactory('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  8883. var createOutput = makeMetadataFactory('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  8884. var createHostBinding = makeMetadataFactory('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
  8885. var createHostListener = makeMetadataFactory('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
  8886. var createNgModule = makeMetadataFactory('NgModule', function (ngModule) { return ngModule; });
  8887. var createInjectable = makeMetadataFactory('Injectable', function (injectable) {
  8888. if (injectable === void 0) { injectable = {}; }
  8889. return injectable;
  8890. });
  8891. var CUSTOM_ELEMENTS_SCHEMA = {
  8892. name: 'custom-elements'
  8893. };
  8894. var NO_ERRORS_SCHEMA = {
  8895. name: 'no-errors-schema'
  8896. };
  8897. var createOptional = makeMetadataFactory('Optional');
  8898. var createSelf = makeMetadataFactory('Self');
  8899. var createSkipSelf = makeMetadataFactory('SkipSelf');
  8900. var createHost = makeMetadataFactory('Host');
  8901. var Type = Function;
  8902. var SecurityContext;
  8903. (function (SecurityContext) {
  8904. SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
  8905. SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
  8906. SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
  8907. SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
  8908. SecurityContext[SecurityContext["URL"] = 4] = "URL";
  8909. SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
  8910. })(SecurityContext || (SecurityContext = {}));
  8911. var MissingTranslationStrategy;
  8912. (function (MissingTranslationStrategy) {
  8913. MissingTranslationStrategy[MissingTranslationStrategy["Error"] = 0] = "Error";
  8914. MissingTranslationStrategy[MissingTranslationStrategy["Warning"] = 1] = "Warning";
  8915. MissingTranslationStrategy[MissingTranslationStrategy["Ignore"] = 2] = "Ignore";
  8916. })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
  8917. function makeMetadataFactory(name, props) {
  8918. var factory = function () {
  8919. var args = [];
  8920. for (var _i = 0; _i < arguments.length; _i++) {
  8921. args[_i] = arguments[_i];
  8922. }
  8923. var values = props ? props.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args)) : {};
  8924. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ ngMetadataName: name }, values);
  8925. };
  8926. factory.isTypeOf = function (obj) { return obj && obj.ngMetadataName === name; };
  8927. factory.ngMetadataName = name;
  8928. return factory;
  8929. }
  8930. function parserSelectorToSimpleSelector(selector) {
  8931. var classes = selector.classNames && selector.classNames.length ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([8 /* CLASS */], selector.classNames) :
  8932. [];
  8933. var elementName = selector.element && selector.element !== '*' ? selector.element : '';
  8934. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([elementName], selector.attrs, classes);
  8935. }
  8936. function parserSelectorToNegativeSelector(selector) {
  8937. var classes = selector.classNames && selector.classNames.length ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([8 /* CLASS */], selector.classNames) :
  8938. [];
  8939. if (selector.element) {
  8940. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([
  8941. 1 /* NOT */ | 4 /* ELEMENT */, selector.element
  8942. ], selector.attrs, classes);
  8943. }
  8944. else if (selector.attrs.length) {
  8945. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([1 /* NOT */ | 2 /* ATTRIBUTE */], selector.attrs, classes);
  8946. }
  8947. else {
  8948. return selector.classNames && selector.classNames.length ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([1 /* NOT */ | 8 /* CLASS */], selector.classNames) :
  8949. [];
  8950. }
  8951. }
  8952. function parserSelectorToR3Selector(selector) {
  8953. var positive = parserSelectorToSimpleSelector(selector);
  8954. var negative = selector.notSelectors && selector.notSelectors.length ?
  8955. selector.notSelectors.map(function (notSelector) { return parserSelectorToNegativeSelector(notSelector); }) :
  8956. [];
  8957. return positive.concat.apply(positive, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(negative));
  8958. }
  8959. function parseSelectorToR3Selector(selector) {
  8960. var selectors = CssSelector.parse(selector);
  8961. return selectors.map(parserSelectorToR3Selector);
  8962. }
  8963. var core = /*#__PURE__*/Object.freeze({
  8964. createInject: createInject,
  8965. createInjectionToken: createInjectionToken,
  8966. createAttribute: createAttribute,
  8967. createContentChildren: createContentChildren,
  8968. createContentChild: createContentChild,
  8969. createViewChildren: createViewChildren,
  8970. createViewChild: createViewChild,
  8971. createDirective: createDirective,
  8972. get ViewEncapsulation () { return ViewEncapsulation; },
  8973. get ChangeDetectionStrategy () { return ChangeDetectionStrategy; },
  8974. createComponent: createComponent,
  8975. createPipe: createPipe,
  8976. createInput: createInput,
  8977. createOutput: createOutput,
  8978. createHostBinding: createHostBinding,
  8979. createHostListener: createHostListener,
  8980. createNgModule: createNgModule,
  8981. createInjectable: createInjectable,
  8982. CUSTOM_ELEMENTS_SCHEMA: CUSTOM_ELEMENTS_SCHEMA,
  8983. NO_ERRORS_SCHEMA: NO_ERRORS_SCHEMA,
  8984. createOptional: createOptional,
  8985. createSelf: createSelf,
  8986. createSkipSelf: createSkipSelf,
  8987. createHost: createHost,
  8988. Type: Type,
  8989. get SecurityContext () { return SecurityContext; },
  8990. get MissingTranslationStrategy () { return MissingTranslationStrategy; },
  8991. parseSelectorToR3Selector: parseSelectorToR3Selector
  8992. });
  8993. /**
  8994. * @license
  8995. * Copyright Google Inc. All Rights Reserved.
  8996. *
  8997. * Use of this source code is governed by an MIT-style license that can be
  8998. * found in the LICENSE file at https://angular.io/license
  8999. */
  9000. var DASH_CASE_REGEXP = /-+([a-z0-9])/g;
  9001. function dashCaseToCamelCase(input) {
  9002. return input.replace(DASH_CASE_REGEXP, function () {
  9003. var m = [];
  9004. for (var _i = 0; _i < arguments.length; _i++) {
  9005. m[_i] = arguments[_i];
  9006. }
  9007. return m[1].toUpperCase();
  9008. });
  9009. }
  9010. function splitAtColon(input, defaultValues) {
  9011. return _splitAt(input, ':', defaultValues);
  9012. }
  9013. function splitAtPeriod(input, defaultValues) {
  9014. return _splitAt(input, '.', defaultValues);
  9015. }
  9016. function _splitAt(input, character, defaultValues) {
  9017. var characterIndex = input.indexOf(character);
  9018. if (characterIndex == -1)
  9019. return defaultValues;
  9020. return [input.slice(0, characterIndex).trim(), input.slice(characterIndex + 1).trim()];
  9021. }
  9022. function visitValue(value, visitor, context) {
  9023. if (Array.isArray(value)) {
  9024. return visitor.visitArray(value, context);
  9025. }
  9026. if (isStrictStringMap(value)) {
  9027. return visitor.visitStringMap(value, context);
  9028. }
  9029. if (value == null || typeof value == 'string' || typeof value == 'number' ||
  9030. typeof value == 'boolean') {
  9031. return visitor.visitPrimitive(value, context);
  9032. }
  9033. return visitor.visitOther(value, context);
  9034. }
  9035. function isDefined(val) {
  9036. return val !== null && val !== undefined;
  9037. }
  9038. function noUndefined(val) {
  9039. return val === undefined ? null : val;
  9040. }
  9041. var ValueTransformer = /** @class */ (function () {
  9042. function ValueTransformer() {
  9043. }
  9044. ValueTransformer.prototype.visitArray = function (arr, context) {
  9045. var _this = this;
  9046. return arr.map(function (value) { return visitValue(value, _this, context); });
  9047. };
  9048. ValueTransformer.prototype.visitStringMap = function (map, context) {
  9049. var _this = this;
  9050. var result = {};
  9051. Object.keys(map).forEach(function (key) { result[key] = visitValue(map[key], _this, context); });
  9052. return result;
  9053. };
  9054. ValueTransformer.prototype.visitPrimitive = function (value, context) { return value; };
  9055. ValueTransformer.prototype.visitOther = function (value, context) { return value; };
  9056. return ValueTransformer;
  9057. }());
  9058. var SyncAsync = {
  9059. assertSync: function (value) {
  9060. if (isPromise(value)) {
  9061. throw new Error("Illegal state: value cannot be a promise");
  9062. }
  9063. return value;
  9064. },
  9065. then: function (value, cb) { return isPromise(value) ? value.then(cb) : cb(value); },
  9066. all: function (syncAsyncValues) {
  9067. return syncAsyncValues.some(isPromise) ? Promise.all(syncAsyncValues) : syncAsyncValues;
  9068. }
  9069. };
  9070. function error(msg) {
  9071. throw new Error("Internal Error: " + msg);
  9072. }
  9073. function syntaxError(msg, parseErrors) {
  9074. var error = Error(msg);
  9075. error[ERROR_SYNTAX_ERROR] = true;
  9076. if (parseErrors)
  9077. error[ERROR_PARSE_ERRORS] = parseErrors;
  9078. return error;
  9079. }
  9080. var ERROR_SYNTAX_ERROR = 'ngSyntaxError';
  9081. var ERROR_PARSE_ERRORS = 'ngParseErrors';
  9082. function isSyntaxError(error) {
  9083. return error[ERROR_SYNTAX_ERROR];
  9084. }
  9085. function getParseErrors(error) {
  9086. return error[ERROR_PARSE_ERRORS] || [];
  9087. }
  9088. // Escape characters that have a special meaning in Regular Expressions
  9089. function escapeRegExp(s) {
  9090. return s.replace(/([.*+?^=!:${}()|[\]\/\\])/g, '\\$1');
  9091. }
  9092. var STRING_MAP_PROTO = Object.getPrototypeOf({});
  9093. function isStrictStringMap(obj) {
  9094. return typeof obj === 'object' && obj !== null && Object.getPrototypeOf(obj) === STRING_MAP_PROTO;
  9095. }
  9096. function utf8Encode(str) {
  9097. var encoded = '';
  9098. for (var index = 0; index < str.length; index++) {
  9099. var codePoint = str.charCodeAt(index);
  9100. // decode surrogate
  9101. // see https://mathiasbynens.be/notes/javascript-encoding#surrogate-formulae
  9102. if (codePoint >= 0xd800 && codePoint <= 0xdbff && str.length > (index + 1)) {
  9103. var low = str.charCodeAt(index + 1);
  9104. if (low >= 0xdc00 && low <= 0xdfff) {
  9105. index++;
  9106. codePoint = ((codePoint - 0xd800) << 10) + low - 0xdc00 + 0x10000;
  9107. }
  9108. }
  9109. if (codePoint <= 0x7f) {
  9110. encoded += String.fromCharCode(codePoint);
  9111. }
  9112. else if (codePoint <= 0x7ff) {
  9113. encoded += String.fromCharCode(((codePoint >> 6) & 0x1F) | 0xc0, (codePoint & 0x3f) | 0x80);
  9114. }
  9115. else if (codePoint <= 0xffff) {
  9116. encoded += String.fromCharCode((codePoint >> 12) | 0xe0, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
  9117. }
  9118. else if (codePoint <= 0x1fffff) {
  9119. encoded += String.fromCharCode(((codePoint >> 18) & 0x07) | 0xf0, ((codePoint >> 12) & 0x3f) | 0x80, ((codePoint >> 6) & 0x3f) | 0x80, (codePoint & 0x3f) | 0x80);
  9120. }
  9121. }
  9122. return encoded;
  9123. }
  9124. function stringify(token) {
  9125. if (typeof token === 'string') {
  9126. return token;
  9127. }
  9128. if (token instanceof Array) {
  9129. return '[' + token.map(stringify).join(', ') + ']';
  9130. }
  9131. if (token == null) {
  9132. return '' + token;
  9133. }
  9134. if (token.overriddenName) {
  9135. return "" + token.overriddenName;
  9136. }
  9137. if (token.name) {
  9138. return "" + token.name;
  9139. }
  9140. // WARNING: do not try to `JSON.stringify(token)` here
  9141. // see https://github.com/angular/angular/issues/23440
  9142. var res = token.toString();
  9143. if (res == null) {
  9144. return '' + res;
  9145. }
  9146. var newLineIndex = res.indexOf('\n');
  9147. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  9148. }
  9149. /**
  9150. * Lazily retrieves the reference value from a forwardRef.
  9151. */
  9152. function resolveForwardRef(type) {
  9153. if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__')) {
  9154. return type();
  9155. }
  9156. else {
  9157. return type;
  9158. }
  9159. }
  9160. /**
  9161. * Determine if the argument is shaped like a Promise
  9162. */
  9163. function isPromise(obj) {
  9164. // allow any Promise/A+ compliant thenable.
  9165. // It's up to the caller to ensure that obj.then conforms to the spec
  9166. return !!obj && typeof obj.then === 'function';
  9167. }
  9168. var Version = /** @class */ (function () {
  9169. function Version(full) {
  9170. this.full = full;
  9171. var splits = full.split('.');
  9172. this.major = splits[0];
  9173. this.minor = splits[1];
  9174. this.patch = splits.slice(2).join('.');
  9175. }
  9176. return Version;
  9177. }());
  9178. /**
  9179. * @license
  9180. * Copyright Google Inc. All Rights Reserved.
  9181. *
  9182. * Use of this source code is governed by an MIT-style license that can be
  9183. * found in the LICENSE file at https://angular.io/license
  9184. */
  9185. var VERSION = new Version('6.1.10');
  9186. /**
  9187. * @license
  9188. * Copyright Google Inc. All Rights Reserved.
  9189. *
  9190. * Use of this source code is governed by an MIT-style license that can be
  9191. * found in the LICENSE file at https://angular.io/license
  9192. */
  9193. var _a;
  9194. /**
  9195. * A segment of text within the template.
  9196. */
  9197. var TextAst = /** @class */ (function () {
  9198. function TextAst(value, ngContentIndex, sourceSpan) {
  9199. this.value = value;
  9200. this.ngContentIndex = ngContentIndex;
  9201. this.sourceSpan = sourceSpan;
  9202. }
  9203. TextAst.prototype.visit = function (visitor, context) { return visitor.visitText(this, context); };
  9204. return TextAst;
  9205. }());
  9206. /**
  9207. * A bound expression within the text of a template.
  9208. */
  9209. var BoundTextAst = /** @class */ (function () {
  9210. function BoundTextAst(value, ngContentIndex, sourceSpan) {
  9211. this.value = value;
  9212. this.ngContentIndex = ngContentIndex;
  9213. this.sourceSpan = sourceSpan;
  9214. }
  9215. BoundTextAst.prototype.visit = function (visitor, context) {
  9216. return visitor.visitBoundText(this, context);
  9217. };
  9218. return BoundTextAst;
  9219. }());
  9220. /**
  9221. * A plain attribute on an element.
  9222. */
  9223. var AttrAst = /** @class */ (function () {
  9224. function AttrAst(name, value, sourceSpan) {
  9225. this.name = name;
  9226. this.value = value;
  9227. this.sourceSpan = sourceSpan;
  9228. }
  9229. AttrAst.prototype.visit = function (visitor, context) { return visitor.visitAttr(this, context); };
  9230. return AttrAst;
  9231. }());
  9232. var BoundPropertyMapping = (_a = {},
  9233. _a[4 /* Animation */] = 4 /* Animation */,
  9234. _a[1 /* Attribute */] = 1 /* Attribute */,
  9235. _a[2 /* Class */] = 2 /* Class */,
  9236. _a[0 /* Property */] = 0 /* Property */,
  9237. _a[3 /* Style */] = 3 /* Style */,
  9238. _a);
  9239. /**
  9240. * A binding for an element property (e.g. `[property]="expression"`) or an animation trigger (e.g.
  9241. * `[@trigger]="stateExp"`)
  9242. */
  9243. var BoundElementPropertyAst = /** @class */ (function () {
  9244. function BoundElementPropertyAst(name, type, securityContext, value, unit, sourceSpan) {
  9245. this.name = name;
  9246. this.type = type;
  9247. this.securityContext = securityContext;
  9248. this.value = value;
  9249. this.unit = unit;
  9250. this.sourceSpan = sourceSpan;
  9251. this.isAnimation = this.type === 4 /* Animation */;
  9252. }
  9253. BoundElementPropertyAst.fromBoundProperty = function (prop) {
  9254. var type = BoundPropertyMapping[prop.type];
  9255. return new BoundElementPropertyAst(prop.name, type, prop.securityContext, prop.value, prop.unit, prop.sourceSpan);
  9256. };
  9257. BoundElementPropertyAst.prototype.visit = function (visitor, context) {
  9258. return visitor.visitElementProperty(this, context);
  9259. };
  9260. return BoundElementPropertyAst;
  9261. }());
  9262. /**
  9263. * A binding for an element event (e.g. `(event)="handler()"`) or an animation trigger event (e.g.
  9264. * `(@trigger.phase)="callback($event)"`).
  9265. */
  9266. var BoundEventAst = /** @class */ (function () {
  9267. function BoundEventAst(name, target, phase, handler, sourceSpan) {
  9268. this.name = name;
  9269. this.target = target;
  9270. this.phase = phase;
  9271. this.handler = handler;
  9272. this.sourceSpan = sourceSpan;
  9273. this.fullName = BoundEventAst.calcFullName(this.name, this.target, this.phase);
  9274. this.isAnimation = !!this.phase;
  9275. }
  9276. BoundEventAst.calcFullName = function (name, target, phase) {
  9277. if (target) {
  9278. return target + ":" + name;
  9279. }
  9280. if (phase) {
  9281. return "@" + name + "." + phase;
  9282. }
  9283. return name;
  9284. };
  9285. BoundEventAst.fromParsedEvent = function (event) {
  9286. var target = event.type === 0 /* Regular */ ? event.targetOrPhase : null;
  9287. var phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null;
  9288. return new BoundEventAst(event.name, target, phase, event.handler, event.sourceSpan);
  9289. };
  9290. BoundEventAst.prototype.visit = function (visitor, context) {
  9291. return visitor.visitEvent(this, context);
  9292. };
  9293. return BoundEventAst;
  9294. }());
  9295. /**
  9296. * A reference declaration on an element (e.g. `let someName="expression"`).
  9297. */
  9298. var ReferenceAst = /** @class */ (function () {
  9299. function ReferenceAst(name, value, originalValue, sourceSpan) {
  9300. this.name = name;
  9301. this.value = value;
  9302. this.originalValue = originalValue;
  9303. this.sourceSpan = sourceSpan;
  9304. }
  9305. ReferenceAst.prototype.visit = function (visitor, context) {
  9306. return visitor.visitReference(this, context);
  9307. };
  9308. return ReferenceAst;
  9309. }());
  9310. /**
  9311. * A variable declaration on a <ng-template> (e.g. `var-someName="someLocalName"`).
  9312. */
  9313. var VariableAst = /** @class */ (function () {
  9314. function VariableAst(name, value, sourceSpan) {
  9315. this.name = name;
  9316. this.value = value;
  9317. this.sourceSpan = sourceSpan;
  9318. }
  9319. VariableAst.fromParsedVariable = function (v) {
  9320. return new VariableAst(v.name, v.value, v.sourceSpan);
  9321. };
  9322. VariableAst.prototype.visit = function (visitor, context) {
  9323. return visitor.visitVariable(this, context);
  9324. };
  9325. return VariableAst;
  9326. }());
  9327. /**
  9328. * An element declaration in a template.
  9329. */
  9330. var ElementAst = /** @class */ (function () {
  9331. function ElementAst(name, attrs, inputs, outputs, references, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan, endSourceSpan) {
  9332. this.name = name;
  9333. this.attrs = attrs;
  9334. this.inputs = inputs;
  9335. this.outputs = outputs;
  9336. this.references = references;
  9337. this.directives = directives;
  9338. this.providers = providers;
  9339. this.hasViewContainer = hasViewContainer;
  9340. this.queryMatches = queryMatches;
  9341. this.children = children;
  9342. this.ngContentIndex = ngContentIndex;
  9343. this.sourceSpan = sourceSpan;
  9344. this.endSourceSpan = endSourceSpan;
  9345. }
  9346. ElementAst.prototype.visit = function (visitor, context) {
  9347. return visitor.visitElement(this, context);
  9348. };
  9349. return ElementAst;
  9350. }());
  9351. /**
  9352. * A `<ng-template>` element included in an Angular template.
  9353. */
  9354. var EmbeddedTemplateAst = /** @class */ (function () {
  9355. function EmbeddedTemplateAst(attrs, outputs, references, variables, directives, providers, hasViewContainer, queryMatches, children, ngContentIndex, sourceSpan) {
  9356. this.attrs = attrs;
  9357. this.outputs = outputs;
  9358. this.references = references;
  9359. this.variables = variables;
  9360. this.directives = directives;
  9361. this.providers = providers;
  9362. this.hasViewContainer = hasViewContainer;
  9363. this.queryMatches = queryMatches;
  9364. this.children = children;
  9365. this.ngContentIndex = ngContentIndex;
  9366. this.sourceSpan = sourceSpan;
  9367. }
  9368. EmbeddedTemplateAst.prototype.visit = function (visitor, context) {
  9369. return visitor.visitEmbeddedTemplate(this, context);
  9370. };
  9371. return EmbeddedTemplateAst;
  9372. }());
  9373. /**
  9374. * A directive property with a bound value (e.g. `*ngIf="condition").
  9375. */
  9376. var BoundDirectivePropertyAst = /** @class */ (function () {
  9377. function BoundDirectivePropertyAst(directiveName, templateName, value, sourceSpan) {
  9378. this.directiveName = directiveName;
  9379. this.templateName = templateName;
  9380. this.value = value;
  9381. this.sourceSpan = sourceSpan;
  9382. }
  9383. BoundDirectivePropertyAst.prototype.visit = function (visitor, context) {
  9384. return visitor.visitDirectiveProperty(this, context);
  9385. };
  9386. return BoundDirectivePropertyAst;
  9387. }());
  9388. /**
  9389. * A directive declared on an element.
  9390. */
  9391. var DirectiveAst = /** @class */ (function () {
  9392. function DirectiveAst(directive, inputs, hostProperties, hostEvents, contentQueryStartId, sourceSpan) {
  9393. this.directive = directive;
  9394. this.inputs = inputs;
  9395. this.hostProperties = hostProperties;
  9396. this.hostEvents = hostEvents;
  9397. this.contentQueryStartId = contentQueryStartId;
  9398. this.sourceSpan = sourceSpan;
  9399. }
  9400. DirectiveAst.prototype.visit = function (visitor, context) {
  9401. return visitor.visitDirective(this, context);
  9402. };
  9403. return DirectiveAst;
  9404. }());
  9405. /**
  9406. * A provider declared on an element
  9407. */
  9408. var ProviderAst = /** @class */ (function () {
  9409. function ProviderAst(token, multiProvider, eager, providers, providerType, lifecycleHooks, sourceSpan, isModule) {
  9410. this.token = token;
  9411. this.multiProvider = multiProvider;
  9412. this.eager = eager;
  9413. this.providers = providers;
  9414. this.providerType = providerType;
  9415. this.lifecycleHooks = lifecycleHooks;
  9416. this.sourceSpan = sourceSpan;
  9417. this.isModule = isModule;
  9418. }
  9419. ProviderAst.prototype.visit = function (visitor, context) {
  9420. // No visit method in the visitor for now...
  9421. return null;
  9422. };
  9423. return ProviderAst;
  9424. }());
  9425. var ProviderAstType;
  9426. (function (ProviderAstType) {
  9427. ProviderAstType[ProviderAstType["PublicService"] = 0] = "PublicService";
  9428. ProviderAstType[ProviderAstType["PrivateService"] = 1] = "PrivateService";
  9429. ProviderAstType[ProviderAstType["Component"] = 2] = "Component";
  9430. ProviderAstType[ProviderAstType["Directive"] = 3] = "Directive";
  9431. ProviderAstType[ProviderAstType["Builtin"] = 4] = "Builtin";
  9432. })(ProviderAstType || (ProviderAstType = {}));
  9433. /**
  9434. * Position where content is to be projected (instance of `<ng-content>` in a template).
  9435. */
  9436. var NgContentAst = /** @class */ (function () {
  9437. function NgContentAst(index, ngContentIndex, sourceSpan) {
  9438. this.index = index;
  9439. this.ngContentIndex = ngContentIndex;
  9440. this.sourceSpan = sourceSpan;
  9441. }
  9442. NgContentAst.prototype.visit = function (visitor, context) {
  9443. return visitor.visitNgContent(this, context);
  9444. };
  9445. return NgContentAst;
  9446. }());
  9447. /**
  9448. * A visitor that accepts each node but doesn't do anything. It is intended to be used
  9449. * as the base class for a visitor that is only interested in a subset of the node types.
  9450. */
  9451. var NullTemplateVisitor = /** @class */ (function () {
  9452. function NullTemplateVisitor() {
  9453. }
  9454. NullTemplateVisitor.prototype.visitNgContent = function (ast, context) { };
  9455. NullTemplateVisitor.prototype.visitEmbeddedTemplate = function (ast, context) { };
  9456. NullTemplateVisitor.prototype.visitElement = function (ast, context) { };
  9457. NullTemplateVisitor.prototype.visitReference = function (ast, context) { };
  9458. NullTemplateVisitor.prototype.visitVariable = function (ast, context) { };
  9459. NullTemplateVisitor.prototype.visitEvent = function (ast, context) { };
  9460. NullTemplateVisitor.prototype.visitElementProperty = function (ast, context) { };
  9461. NullTemplateVisitor.prototype.visitAttr = function (ast, context) { };
  9462. NullTemplateVisitor.prototype.visitBoundText = function (ast, context) { };
  9463. NullTemplateVisitor.prototype.visitText = function (ast, context) { };
  9464. NullTemplateVisitor.prototype.visitDirective = function (ast, context) { };
  9465. NullTemplateVisitor.prototype.visitDirectiveProperty = function (ast, context) { };
  9466. return NullTemplateVisitor;
  9467. }());
  9468. /**
  9469. * Base class that can be used to build a visitor that visits each node
  9470. * in an template ast recursively.
  9471. */
  9472. var RecursiveTemplateAstVisitor = /** @class */ (function (_super) {
  9473. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(RecursiveTemplateAstVisitor, _super);
  9474. function RecursiveTemplateAstVisitor() {
  9475. return _super.call(this) || this;
  9476. }
  9477. // Nodes with children
  9478. RecursiveTemplateAstVisitor.prototype.visitEmbeddedTemplate = function (ast, context) {
  9479. return this.visitChildren(context, function (visit) {
  9480. visit(ast.attrs);
  9481. visit(ast.references);
  9482. visit(ast.variables);
  9483. visit(ast.directives);
  9484. visit(ast.providers);
  9485. visit(ast.children);
  9486. });
  9487. };
  9488. RecursiveTemplateAstVisitor.prototype.visitElement = function (ast, context) {
  9489. return this.visitChildren(context, function (visit) {
  9490. visit(ast.attrs);
  9491. visit(ast.inputs);
  9492. visit(ast.outputs);
  9493. visit(ast.references);
  9494. visit(ast.directives);
  9495. visit(ast.providers);
  9496. visit(ast.children);
  9497. });
  9498. };
  9499. RecursiveTemplateAstVisitor.prototype.visitDirective = function (ast, context) {
  9500. return this.visitChildren(context, function (visit) {
  9501. visit(ast.inputs);
  9502. visit(ast.hostProperties);
  9503. visit(ast.hostEvents);
  9504. });
  9505. };
  9506. RecursiveTemplateAstVisitor.prototype.visitChildren = function (context, cb) {
  9507. var results = [];
  9508. var t = this;
  9509. function visit(children) {
  9510. if (children && children.length)
  9511. results.push(templateVisitAll(t, children, context));
  9512. }
  9513. cb(visit);
  9514. return [].concat.apply([], results);
  9515. };
  9516. return RecursiveTemplateAstVisitor;
  9517. }(NullTemplateVisitor));
  9518. /**
  9519. * Visit every node in a list of {@link TemplateAst}s with the given {@link TemplateAstVisitor}.
  9520. */
  9521. function templateVisitAll(visitor, asts, context) {
  9522. if (context === void 0) { context = null; }
  9523. var result = [];
  9524. var visit = visitor.visit ?
  9525. function (ast) { return visitor.visit(ast, context) || ast.visit(visitor, context); } :
  9526. function (ast) { return ast.visit(visitor, context); };
  9527. asts.forEach(function (ast) {
  9528. var astResult = visit(ast);
  9529. if (astResult) {
  9530. result.push(astResult);
  9531. }
  9532. });
  9533. return result;
  9534. }
  9535. /**
  9536. * @license
  9537. * Copyright Google Inc. All Rights Reserved.
  9538. *
  9539. * Use of this source code is governed by an MIT-style license that can be
  9540. * found in the LICENSE file at https://angular.io/license
  9541. */
  9542. var CompilerConfig = /** @class */ (function () {
  9543. function CompilerConfig(_a) {
  9544. var _b = _a === void 0 ? {} : _a, _c = _b.defaultEncapsulation, defaultEncapsulation = _c === void 0 ? ViewEncapsulation.Emulated : _c, _d = _b.useJit, useJit = _d === void 0 ? true : _d, _e = _b.jitDevMode, jitDevMode = _e === void 0 ? false : _e, _f = _b.missingTranslation, missingTranslation = _f === void 0 ? null : _f, preserveWhitespaces = _b.preserveWhitespaces, strictInjectionParameters = _b.strictInjectionParameters;
  9545. this.defaultEncapsulation = defaultEncapsulation;
  9546. this.useJit = !!useJit;
  9547. this.jitDevMode = !!jitDevMode;
  9548. this.missingTranslation = missingTranslation;
  9549. this.preserveWhitespaces = preserveWhitespacesDefault(noUndefined(preserveWhitespaces));
  9550. this.strictInjectionParameters = strictInjectionParameters === true;
  9551. }
  9552. return CompilerConfig;
  9553. }());
  9554. function preserveWhitespacesDefault(preserveWhitespacesOption, defaultSetting) {
  9555. if (defaultSetting === void 0) { defaultSetting = false; }
  9556. return preserveWhitespacesOption === null ? defaultSetting : preserveWhitespacesOption;
  9557. }
  9558. /**
  9559. * @license
  9560. * Copyright Google Inc. All Rights Reserved.
  9561. *
  9562. * Use of this source code is governed by an MIT-style license that can be
  9563. * found in the LICENSE file at https://angular.io/license
  9564. */
  9565. /**
  9566. * A token representing the a reference to a static type.
  9567. *
  9568. * This token is unique for a filePath and name and can be used as a hash table key.
  9569. */
  9570. var StaticSymbol = /** @class */ (function () {
  9571. function StaticSymbol(filePath, name, members) {
  9572. this.filePath = filePath;
  9573. this.name = name;
  9574. this.members = members;
  9575. }
  9576. StaticSymbol.prototype.assertNoMembers = function () {
  9577. if (this.members.length) {
  9578. throw new Error("Illegal state: symbol without members expected, but got " + JSON.stringify(this) + ".");
  9579. }
  9580. };
  9581. return StaticSymbol;
  9582. }());
  9583. /**
  9584. * A cache of static symbol used by the StaticReflector to return the same symbol for the
  9585. * same symbol values.
  9586. */
  9587. var StaticSymbolCache = /** @class */ (function () {
  9588. function StaticSymbolCache() {
  9589. this.cache = new Map();
  9590. }
  9591. StaticSymbolCache.prototype.get = function (declarationFile, name, members) {
  9592. members = members || [];
  9593. var memberSuffix = members.length ? "." + members.join('.') : '';
  9594. var key = "\"" + declarationFile + "\"." + name + memberSuffix;
  9595. var result = this.cache.get(key);
  9596. if (!result) {
  9597. result = new StaticSymbol(declarationFile, name, members);
  9598. this.cache.set(key, result);
  9599. }
  9600. return result;
  9601. };
  9602. return StaticSymbolCache;
  9603. }());
  9604. /**
  9605. * @license
  9606. * Copyright Google Inc. All Rights Reserved.
  9607. *
  9608. * Use of this source code is governed by an MIT-style license that can be
  9609. * found in the LICENSE file at https://angular.io/license
  9610. */
  9611. // group 0: "[prop] or (event) or @trigger"
  9612. // group 1: "prop" from "[prop]"
  9613. // group 2: "event" from "(event)"
  9614. // group 3: "@trigger" from "@trigger"
  9615. var HOST_REG_EXP = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
  9616. function sanitizeIdentifier(name) {
  9617. return name.replace(/\W/g, '_');
  9618. }
  9619. var _anonymousTypeIndex = 0;
  9620. function identifierName(compileIdentifier) {
  9621. if (!compileIdentifier || !compileIdentifier.reference) {
  9622. return null;
  9623. }
  9624. var ref = compileIdentifier.reference;
  9625. if (ref instanceof StaticSymbol) {
  9626. return ref.name;
  9627. }
  9628. if (ref['__anonymousType']) {
  9629. return ref['__anonymousType'];
  9630. }
  9631. var identifier = stringify(ref);
  9632. if (identifier.indexOf('(') >= 0) {
  9633. // case: anonymous functions!
  9634. identifier = "anonymous_" + _anonymousTypeIndex++;
  9635. ref['__anonymousType'] = identifier;
  9636. }
  9637. else {
  9638. identifier = sanitizeIdentifier(identifier);
  9639. }
  9640. return identifier;
  9641. }
  9642. function identifierModuleUrl(compileIdentifier) {
  9643. var ref = compileIdentifier.reference;
  9644. if (ref instanceof StaticSymbol) {
  9645. return ref.filePath;
  9646. }
  9647. // Runtime type
  9648. return "./" + stringify(ref);
  9649. }
  9650. function viewClassName(compType, embeddedTemplateIndex) {
  9651. return "View_" + identifierName({ reference: compType }) + "_" + embeddedTemplateIndex;
  9652. }
  9653. function rendererTypeName(compType) {
  9654. return "RenderType_" + identifierName({ reference: compType });
  9655. }
  9656. function hostViewClassName(compType) {
  9657. return "HostView_" + identifierName({ reference: compType });
  9658. }
  9659. function componentFactoryName(compType) {
  9660. return identifierName({ reference: compType }) + "NgFactory";
  9661. }
  9662. var CompileSummaryKind;
  9663. (function (CompileSummaryKind) {
  9664. CompileSummaryKind[CompileSummaryKind["Pipe"] = 0] = "Pipe";
  9665. CompileSummaryKind[CompileSummaryKind["Directive"] = 1] = "Directive";
  9666. CompileSummaryKind[CompileSummaryKind["NgModule"] = 2] = "NgModule";
  9667. CompileSummaryKind[CompileSummaryKind["Injectable"] = 3] = "Injectable";
  9668. })(CompileSummaryKind || (CompileSummaryKind = {}));
  9669. function tokenName(token) {
  9670. return token.value != null ? sanitizeIdentifier(token.value) : identifierName(token.identifier);
  9671. }
  9672. function tokenReference(token) {
  9673. if (token.identifier != null) {
  9674. return token.identifier.reference;
  9675. }
  9676. else {
  9677. return token.value;
  9678. }
  9679. }
  9680. /**
  9681. * Metadata about a stylesheet
  9682. */
  9683. var CompileStylesheetMetadata = /** @class */ (function () {
  9684. function CompileStylesheetMetadata(_a) {
  9685. var _b = _a === void 0 ? {} : _a, moduleUrl = _b.moduleUrl, styles = _b.styles, styleUrls = _b.styleUrls;
  9686. this.moduleUrl = moduleUrl || null;
  9687. this.styles = _normalizeArray(styles);
  9688. this.styleUrls = _normalizeArray(styleUrls);
  9689. }
  9690. return CompileStylesheetMetadata;
  9691. }());
  9692. /**
  9693. * Metadata regarding compilation of a template.
  9694. */
  9695. var CompileTemplateMetadata = /** @class */ (function () {
  9696. function CompileTemplateMetadata(_a) {
  9697. var encapsulation = _a.encapsulation, template = _a.template, templateUrl = _a.templateUrl, htmlAst = _a.htmlAst, styles = _a.styles, styleUrls = _a.styleUrls, externalStylesheets = _a.externalStylesheets, animations = _a.animations, ngContentSelectors = _a.ngContentSelectors, interpolation = _a.interpolation, isInline = _a.isInline, preserveWhitespaces = _a.preserveWhitespaces;
  9698. this.encapsulation = encapsulation;
  9699. this.template = template;
  9700. this.templateUrl = templateUrl;
  9701. this.htmlAst = htmlAst;
  9702. this.styles = _normalizeArray(styles);
  9703. this.styleUrls = _normalizeArray(styleUrls);
  9704. this.externalStylesheets = _normalizeArray(externalStylesheets);
  9705. this.animations = animations ? flatten(animations) : [];
  9706. this.ngContentSelectors = ngContentSelectors || [];
  9707. if (interpolation && interpolation.length != 2) {
  9708. throw new Error("'interpolation' should have a start and an end symbol.");
  9709. }
  9710. this.interpolation = interpolation;
  9711. this.isInline = isInline;
  9712. this.preserveWhitespaces = preserveWhitespaces;
  9713. }
  9714. CompileTemplateMetadata.prototype.toSummary = function () {
  9715. return {
  9716. ngContentSelectors: this.ngContentSelectors,
  9717. encapsulation: this.encapsulation,
  9718. };
  9719. };
  9720. return CompileTemplateMetadata;
  9721. }());
  9722. /**
  9723. * Metadata regarding compilation of a directive.
  9724. */
  9725. var CompileDirectiveMetadata = /** @class */ (function () {
  9726. function CompileDirectiveMetadata(_a) {
  9727. var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, hostListeners = _a.hostListeners, hostProperties = _a.hostProperties, hostAttributes = _a.hostAttributes, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, guards = _a.guards, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory;
  9728. this.isHost = !!isHost;
  9729. this.type = type;
  9730. this.isComponent = isComponent;
  9731. this.selector = selector;
  9732. this.exportAs = exportAs;
  9733. this.changeDetection = changeDetection;
  9734. this.inputs = inputs;
  9735. this.outputs = outputs;
  9736. this.hostListeners = hostListeners;
  9737. this.hostProperties = hostProperties;
  9738. this.hostAttributes = hostAttributes;
  9739. this.providers = _normalizeArray(providers);
  9740. this.viewProviders = _normalizeArray(viewProviders);
  9741. this.queries = _normalizeArray(queries);
  9742. this.guards = guards;
  9743. this.viewQueries = _normalizeArray(viewQueries);
  9744. this.entryComponents = _normalizeArray(entryComponents);
  9745. this.template = template;
  9746. this.componentViewType = componentViewType;
  9747. this.rendererType = rendererType;
  9748. this.componentFactory = componentFactory;
  9749. }
  9750. CompileDirectiveMetadata.create = function (_a) {
  9751. var isHost = _a.isHost, type = _a.type, isComponent = _a.isComponent, selector = _a.selector, exportAs = _a.exportAs, changeDetection = _a.changeDetection, inputs = _a.inputs, outputs = _a.outputs, host = _a.host, providers = _a.providers, viewProviders = _a.viewProviders, queries = _a.queries, guards = _a.guards, viewQueries = _a.viewQueries, entryComponents = _a.entryComponents, template = _a.template, componentViewType = _a.componentViewType, rendererType = _a.rendererType, componentFactory = _a.componentFactory;
  9752. var hostListeners = {};
  9753. var hostProperties = {};
  9754. var hostAttributes = {};
  9755. if (host != null) {
  9756. Object.keys(host).forEach(function (key) {
  9757. var value = host[key];
  9758. var matches = key.match(HOST_REG_EXP);
  9759. if (matches === null) {
  9760. hostAttributes[key] = value;
  9761. }
  9762. else if (matches[1] != null) {
  9763. hostProperties[matches[1]] = value;
  9764. }
  9765. else if (matches[2] != null) {
  9766. hostListeners[matches[2]] = value;
  9767. }
  9768. });
  9769. }
  9770. var inputsMap = {};
  9771. if (inputs != null) {
  9772. inputs.forEach(function (bindConfig) {
  9773. // canonical syntax: `dirProp: elProp`
  9774. // if there is no `:`, use dirProp = elProp
  9775. var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
  9776. inputsMap[parts[0]] = parts[1];
  9777. });
  9778. }
  9779. var outputsMap = {};
  9780. if (outputs != null) {
  9781. outputs.forEach(function (bindConfig) {
  9782. // canonical syntax: `dirProp: elProp`
  9783. // if there is no `:`, use dirProp = elProp
  9784. var parts = splitAtColon(bindConfig, [bindConfig, bindConfig]);
  9785. outputsMap[parts[0]] = parts[1];
  9786. });
  9787. }
  9788. return new CompileDirectiveMetadata({
  9789. isHost: isHost,
  9790. type: type,
  9791. isComponent: !!isComponent, selector: selector, exportAs: exportAs, changeDetection: changeDetection,
  9792. inputs: inputsMap,
  9793. outputs: outputsMap,
  9794. hostListeners: hostListeners,
  9795. hostProperties: hostProperties,
  9796. hostAttributes: hostAttributes,
  9797. providers: providers,
  9798. viewProviders: viewProviders,
  9799. queries: queries,
  9800. guards: guards,
  9801. viewQueries: viewQueries,
  9802. entryComponents: entryComponents,
  9803. template: template,
  9804. componentViewType: componentViewType,
  9805. rendererType: rendererType,
  9806. componentFactory: componentFactory,
  9807. });
  9808. };
  9809. CompileDirectiveMetadata.prototype.toSummary = function () {
  9810. return {
  9811. summaryKind: CompileSummaryKind.Directive,
  9812. type: this.type,
  9813. isComponent: this.isComponent,
  9814. selector: this.selector,
  9815. exportAs: this.exportAs,
  9816. inputs: this.inputs,
  9817. outputs: this.outputs,
  9818. hostListeners: this.hostListeners,
  9819. hostProperties: this.hostProperties,
  9820. hostAttributes: this.hostAttributes,
  9821. providers: this.providers,
  9822. viewProviders: this.viewProviders,
  9823. queries: this.queries,
  9824. guards: this.guards,
  9825. viewQueries: this.viewQueries,
  9826. entryComponents: this.entryComponents,
  9827. changeDetection: this.changeDetection,
  9828. template: this.template && this.template.toSummary(),
  9829. componentViewType: this.componentViewType,
  9830. rendererType: this.rendererType,
  9831. componentFactory: this.componentFactory
  9832. };
  9833. };
  9834. return CompileDirectiveMetadata;
  9835. }());
  9836. var CompilePipeMetadata = /** @class */ (function () {
  9837. function CompilePipeMetadata(_a) {
  9838. var type = _a.type, name = _a.name, pure = _a.pure;
  9839. this.type = type;
  9840. this.name = name;
  9841. this.pure = !!pure;
  9842. }
  9843. CompilePipeMetadata.prototype.toSummary = function () {
  9844. return {
  9845. summaryKind: CompileSummaryKind.Pipe,
  9846. type: this.type,
  9847. name: this.name,
  9848. pure: this.pure
  9849. };
  9850. };
  9851. return CompilePipeMetadata;
  9852. }());
  9853. var CompileShallowModuleMetadata = /** @class */ (function () {
  9854. function CompileShallowModuleMetadata() {
  9855. }
  9856. return CompileShallowModuleMetadata;
  9857. }());
  9858. /**
  9859. * Metadata regarding compilation of a module.
  9860. */
  9861. var CompileNgModuleMetadata = /** @class */ (function () {
  9862. function CompileNgModuleMetadata(_a) {
  9863. var type = _a.type, providers = _a.providers, declaredDirectives = _a.declaredDirectives, exportedDirectives = _a.exportedDirectives, declaredPipes = _a.declaredPipes, exportedPipes = _a.exportedPipes, entryComponents = _a.entryComponents, bootstrapComponents = _a.bootstrapComponents, importedModules = _a.importedModules, exportedModules = _a.exportedModules, schemas = _a.schemas, transitiveModule = _a.transitiveModule, id = _a.id;
  9864. this.type = type || null;
  9865. this.declaredDirectives = _normalizeArray(declaredDirectives);
  9866. this.exportedDirectives = _normalizeArray(exportedDirectives);
  9867. this.declaredPipes = _normalizeArray(declaredPipes);
  9868. this.exportedPipes = _normalizeArray(exportedPipes);
  9869. this.providers = _normalizeArray(providers);
  9870. this.entryComponents = _normalizeArray(entryComponents);
  9871. this.bootstrapComponents = _normalizeArray(bootstrapComponents);
  9872. this.importedModules = _normalizeArray(importedModules);
  9873. this.exportedModules = _normalizeArray(exportedModules);
  9874. this.schemas = _normalizeArray(schemas);
  9875. this.id = id || null;
  9876. this.transitiveModule = transitiveModule || null;
  9877. }
  9878. CompileNgModuleMetadata.prototype.toSummary = function () {
  9879. var module = this.transitiveModule;
  9880. return {
  9881. summaryKind: CompileSummaryKind.NgModule,
  9882. type: this.type,
  9883. entryComponents: module.entryComponents,
  9884. providers: module.providers,
  9885. modules: module.modules,
  9886. exportedDirectives: module.exportedDirectives,
  9887. exportedPipes: module.exportedPipes
  9888. };
  9889. };
  9890. return CompileNgModuleMetadata;
  9891. }());
  9892. var TransitiveCompileNgModuleMetadata = /** @class */ (function () {
  9893. function TransitiveCompileNgModuleMetadata() {
  9894. this.directivesSet = new Set();
  9895. this.directives = [];
  9896. this.exportedDirectivesSet = new Set();
  9897. this.exportedDirectives = [];
  9898. this.pipesSet = new Set();
  9899. this.pipes = [];
  9900. this.exportedPipesSet = new Set();
  9901. this.exportedPipes = [];
  9902. this.modulesSet = new Set();
  9903. this.modules = [];
  9904. this.entryComponentsSet = new Set();
  9905. this.entryComponents = [];
  9906. this.providers = [];
  9907. }
  9908. TransitiveCompileNgModuleMetadata.prototype.addProvider = function (provider, module) {
  9909. this.providers.push({ provider: provider, module: module });
  9910. };
  9911. TransitiveCompileNgModuleMetadata.prototype.addDirective = function (id) {
  9912. if (!this.directivesSet.has(id.reference)) {
  9913. this.directivesSet.add(id.reference);
  9914. this.directives.push(id);
  9915. }
  9916. };
  9917. TransitiveCompileNgModuleMetadata.prototype.addExportedDirective = function (id) {
  9918. if (!this.exportedDirectivesSet.has(id.reference)) {
  9919. this.exportedDirectivesSet.add(id.reference);
  9920. this.exportedDirectives.push(id);
  9921. }
  9922. };
  9923. TransitiveCompileNgModuleMetadata.prototype.addPipe = function (id) {
  9924. if (!this.pipesSet.has(id.reference)) {
  9925. this.pipesSet.add(id.reference);
  9926. this.pipes.push(id);
  9927. }
  9928. };
  9929. TransitiveCompileNgModuleMetadata.prototype.addExportedPipe = function (id) {
  9930. if (!this.exportedPipesSet.has(id.reference)) {
  9931. this.exportedPipesSet.add(id.reference);
  9932. this.exportedPipes.push(id);
  9933. }
  9934. };
  9935. TransitiveCompileNgModuleMetadata.prototype.addModule = function (id) {
  9936. if (!this.modulesSet.has(id.reference)) {
  9937. this.modulesSet.add(id.reference);
  9938. this.modules.push(id);
  9939. }
  9940. };
  9941. TransitiveCompileNgModuleMetadata.prototype.addEntryComponent = function (ec) {
  9942. if (!this.entryComponentsSet.has(ec.componentType)) {
  9943. this.entryComponentsSet.add(ec.componentType);
  9944. this.entryComponents.push(ec);
  9945. }
  9946. };
  9947. return TransitiveCompileNgModuleMetadata;
  9948. }());
  9949. function _normalizeArray(obj) {
  9950. return obj || [];
  9951. }
  9952. var ProviderMeta = /** @class */ (function () {
  9953. function ProviderMeta(token, _a) {
  9954. var useClass = _a.useClass, useValue = _a.useValue, useExisting = _a.useExisting, useFactory = _a.useFactory, deps = _a.deps, multi = _a.multi;
  9955. this.token = token;
  9956. this.useClass = useClass || null;
  9957. this.useValue = useValue;
  9958. this.useExisting = useExisting;
  9959. this.useFactory = useFactory || null;
  9960. this.dependencies = deps || null;
  9961. this.multi = !!multi;
  9962. }
  9963. return ProviderMeta;
  9964. }());
  9965. function flatten(list) {
  9966. return list.reduce(function (flat, item) {
  9967. var flatItem = Array.isArray(item) ? flatten(item) : item;
  9968. return flat.concat(flatItem);
  9969. }, []);
  9970. }
  9971. function jitSourceUrl(url) {
  9972. // Note: We need 3 "/" so that ng shows up as a separate domain
  9973. // in the chrome dev tools.
  9974. return url.replace(/(\w+:\/\/[\w:-]+)?(\/+)?/, 'ng:///');
  9975. }
  9976. function templateSourceUrl(ngModuleType, compMeta, templateMeta) {
  9977. var url;
  9978. if (templateMeta.isInline) {
  9979. if (compMeta.type.reference instanceof StaticSymbol) {
  9980. // Note: a .ts file might contain multiple components with inline templates,
  9981. // so we need to give them unique urls, as these will be used for sourcemaps.
  9982. url = compMeta.type.reference.filePath + "." + compMeta.type.reference.name + ".html";
  9983. }
  9984. else {
  9985. url = identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".html";
  9986. }
  9987. }
  9988. else {
  9989. url = templateMeta.templateUrl;
  9990. }
  9991. return compMeta.type.reference instanceof StaticSymbol ? url : jitSourceUrl(url);
  9992. }
  9993. function sharedStylesheetJitUrl(meta, id) {
  9994. var pathParts = meta.moduleUrl.split(/\/\\/g);
  9995. var baseName = pathParts[pathParts.length - 1];
  9996. return jitSourceUrl("css/" + id + baseName + ".ngstyle.js");
  9997. }
  9998. function ngModuleJitUrl(moduleMeta) {
  9999. return jitSourceUrl(identifierName(moduleMeta.type) + "/module.ngfactory.js");
  10000. }
  10001. function templateJitUrl(ngModuleType, compMeta) {
  10002. return jitSourceUrl(identifierName(ngModuleType) + "/" + identifierName(compMeta.type) + ".ngfactory.js");
  10003. }
  10004. /**
  10005. * @license
  10006. * Copyright Google Inc. All Rights Reserved.
  10007. *
  10008. * Use of this source code is governed by an MIT-style license that can be
  10009. * found in the LICENSE file at https://angular.io/license
  10010. */
  10011. /**
  10012. * A path is an ordered set of elements. Typically a path is to a
  10013. * particular offset in a source file. The head of the list is the top
  10014. * most node. The tail is the node that contains the offset directly.
  10015. *
  10016. * For example, the expression `a + b + c` might have an ast that looks
  10017. * like:
  10018. * +
  10019. * / \
  10020. * a +
  10021. * / \
  10022. * b c
  10023. *
  10024. * The path to the node at offset 9 would be `['+' at 1-10, '+' at 7-10,
  10025. * 'c' at 9-10]` and the path the node at offset 1 would be
  10026. * `['+' at 1-10, 'a' at 1-2]`.
  10027. */
  10028. var AstPath = /** @class */ (function () {
  10029. function AstPath(path, position) {
  10030. if (position === void 0) { position = -1; }
  10031. this.path = path;
  10032. this.position = position;
  10033. }
  10034. Object.defineProperty(AstPath.prototype, "empty", {
  10035. get: function () { return !this.path || !this.path.length; },
  10036. enumerable: true,
  10037. configurable: true
  10038. });
  10039. Object.defineProperty(AstPath.prototype, "head", {
  10040. get: function () { return this.path[0]; },
  10041. enumerable: true,
  10042. configurable: true
  10043. });
  10044. Object.defineProperty(AstPath.prototype, "tail", {
  10045. get: function () { return this.path[this.path.length - 1]; },
  10046. enumerable: true,
  10047. configurable: true
  10048. });
  10049. AstPath.prototype.parentOf = function (node) {
  10050. return node && this.path[this.path.indexOf(node) - 1];
  10051. };
  10052. AstPath.prototype.childOf = function (node) { return this.path[this.path.indexOf(node) + 1]; };
  10053. AstPath.prototype.first = function (ctor) {
  10054. for (var i = this.path.length - 1; i >= 0; i--) {
  10055. var item = this.path[i];
  10056. if (item instanceof ctor)
  10057. return item;
  10058. }
  10059. };
  10060. AstPath.prototype.push = function (node) { this.path.push(node); };
  10061. AstPath.prototype.pop = function () { return this.path.pop(); };
  10062. return AstPath;
  10063. }());
  10064. /**
  10065. * @license
  10066. * Copyright Google Inc. All Rights Reserved.
  10067. *
  10068. * Use of this source code is governed by an MIT-style license that can be
  10069. * found in the LICENSE file at https://angular.io/license
  10070. */
  10071. var Text = /** @class */ (function () {
  10072. function Text(value, sourceSpan) {
  10073. this.value = value;
  10074. this.sourceSpan = sourceSpan;
  10075. }
  10076. Text.prototype.visit = function (visitor, context) { return visitor.visitText(this, context); };
  10077. return Text;
  10078. }());
  10079. var Expansion = /** @class */ (function () {
  10080. function Expansion(switchValue, type, cases, sourceSpan, switchValueSourceSpan) {
  10081. this.switchValue = switchValue;
  10082. this.type = type;
  10083. this.cases = cases;
  10084. this.sourceSpan = sourceSpan;
  10085. this.switchValueSourceSpan = switchValueSourceSpan;
  10086. }
  10087. Expansion.prototype.visit = function (visitor, context) { return visitor.visitExpansion(this, context); };
  10088. return Expansion;
  10089. }());
  10090. var ExpansionCase = /** @class */ (function () {
  10091. function ExpansionCase(value, expression, sourceSpan, valueSourceSpan, expSourceSpan) {
  10092. this.value = value;
  10093. this.expression = expression;
  10094. this.sourceSpan = sourceSpan;
  10095. this.valueSourceSpan = valueSourceSpan;
  10096. this.expSourceSpan = expSourceSpan;
  10097. }
  10098. ExpansionCase.prototype.visit = function (visitor, context) { return visitor.visitExpansionCase(this, context); };
  10099. return ExpansionCase;
  10100. }());
  10101. var Attribute = /** @class */ (function () {
  10102. function Attribute(name, value, sourceSpan, valueSpan) {
  10103. this.name = name;
  10104. this.value = value;
  10105. this.sourceSpan = sourceSpan;
  10106. this.valueSpan = valueSpan;
  10107. }
  10108. Attribute.prototype.visit = function (visitor, context) { return visitor.visitAttribute(this, context); };
  10109. return Attribute;
  10110. }());
  10111. var Element = /** @class */ (function () {
  10112. function Element(name, attrs, children, sourceSpan, startSourceSpan, endSourceSpan) {
  10113. if (startSourceSpan === void 0) { startSourceSpan = null; }
  10114. if (endSourceSpan === void 0) { endSourceSpan = null; }
  10115. this.name = name;
  10116. this.attrs = attrs;
  10117. this.children = children;
  10118. this.sourceSpan = sourceSpan;
  10119. this.startSourceSpan = startSourceSpan;
  10120. this.endSourceSpan = endSourceSpan;
  10121. }
  10122. Element.prototype.visit = function (visitor, context) { return visitor.visitElement(this, context); };
  10123. return Element;
  10124. }());
  10125. var Comment = /** @class */ (function () {
  10126. function Comment(value, sourceSpan) {
  10127. this.value = value;
  10128. this.sourceSpan = sourceSpan;
  10129. }
  10130. Comment.prototype.visit = function (visitor, context) { return visitor.visitComment(this, context); };
  10131. return Comment;
  10132. }());
  10133. function visitAll(visitor, nodes, context) {
  10134. if (context === void 0) { context = null; }
  10135. var result = [];
  10136. var visit = visitor.visit ?
  10137. function (ast) { return visitor.visit(ast, context) || ast.visit(visitor, context); } :
  10138. function (ast) { return ast.visit(visitor, context); };
  10139. nodes.forEach(function (ast) {
  10140. var astResult = visit(ast);
  10141. if (astResult) {
  10142. result.push(astResult);
  10143. }
  10144. });
  10145. return result;
  10146. }
  10147. var RecursiveVisitor = /** @class */ (function () {
  10148. function RecursiveVisitor() {
  10149. }
  10150. RecursiveVisitor.prototype.visitElement = function (ast, context) {
  10151. this.visitChildren(context, function (visit) {
  10152. visit(ast.attrs);
  10153. visit(ast.children);
  10154. });
  10155. };
  10156. RecursiveVisitor.prototype.visitAttribute = function (ast, context) { };
  10157. RecursiveVisitor.prototype.visitText = function (ast, context) { };
  10158. RecursiveVisitor.prototype.visitComment = function (ast, context) { };
  10159. RecursiveVisitor.prototype.visitExpansion = function (ast, context) {
  10160. return this.visitChildren(context, function (visit) { visit(ast.cases); });
  10161. };
  10162. RecursiveVisitor.prototype.visitExpansionCase = function (ast, context) { };
  10163. RecursiveVisitor.prototype.visitChildren = function (context, cb) {
  10164. var results = [];
  10165. var t = this;
  10166. function visit(children) {
  10167. if (children)
  10168. results.push(visitAll(t, children, context));
  10169. }
  10170. cb(visit);
  10171. return [].concat.apply([], results);
  10172. };
  10173. return RecursiveVisitor;
  10174. }());
  10175. function spanOf(ast) {
  10176. var start = ast.sourceSpan.start.offset;
  10177. var end = ast.sourceSpan.end.offset;
  10178. if (ast instanceof Element) {
  10179. if (ast.endSourceSpan) {
  10180. end = ast.endSourceSpan.end.offset;
  10181. }
  10182. else if (ast.children && ast.children.length) {
  10183. end = spanOf(ast.children[ast.children.length - 1]).end;
  10184. }
  10185. }
  10186. return { start: start, end: end };
  10187. }
  10188. function findNode(nodes, position) {
  10189. var path = [];
  10190. var visitor = new /** @class */ (function (_super) {
  10191. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(class_1, _super);
  10192. function class_1() {
  10193. return _super !== null && _super.apply(this, arguments) || this;
  10194. }
  10195. class_1.prototype.visit = function (ast, context) {
  10196. var span = spanOf(ast);
  10197. if (span.start <= position && position < span.end) {
  10198. path.push(ast);
  10199. }
  10200. else {
  10201. // Returning a value here will result in the children being skipped.
  10202. return true;
  10203. }
  10204. };
  10205. return class_1;
  10206. }(RecursiveVisitor));
  10207. visitAll(visitor, nodes);
  10208. return new AstPath(path, position);
  10209. }
  10210. /**
  10211. * @license
  10212. * Copyright Google Inc. All Rights Reserved.
  10213. *
  10214. * Use of this source code is governed by an MIT-style license that can be
  10215. * found in the LICENSE file at https://angular.io/license
  10216. */
  10217. function assertArrayOfStrings(identifier, value) {
  10218. if (value == null) {
  10219. return;
  10220. }
  10221. if (!Array.isArray(value)) {
  10222. throw new Error("Expected '" + identifier + "' to be an array of strings.");
  10223. }
  10224. for (var i = 0; i < value.length; i += 1) {
  10225. if (typeof value[i] !== 'string') {
  10226. throw new Error("Expected '" + identifier + "' to be an array of strings.");
  10227. }
  10228. }
  10229. }
  10230. var INTERPOLATION_BLACKLIST_REGEXPS = [
  10231. /^\s*$/,
  10232. /[<>]/,
  10233. /^[{}]$/,
  10234. /&(#|[a-z])/i,
  10235. /^\/\//,
  10236. ];
  10237. function assertInterpolationSymbols(identifier, value) {
  10238. if (value != null && !(Array.isArray(value) && value.length == 2)) {
  10239. throw new Error("Expected '" + identifier + "' to be an array, [start, end].");
  10240. }
  10241. else if (value != null) {
  10242. var start_1 = value[0];
  10243. var end_1 = value[1];
  10244. // black list checking
  10245. INTERPOLATION_BLACKLIST_REGEXPS.forEach(function (regexp) {
  10246. if (regexp.test(start_1) || regexp.test(end_1)) {
  10247. throw new Error("['" + start_1 + "', '" + end_1 + "'] contains unusable interpolation symbol.");
  10248. }
  10249. });
  10250. }
  10251. }
  10252. /**
  10253. * @license
  10254. * Copyright Google Inc. All Rights Reserved.
  10255. *
  10256. * Use of this source code is governed by an MIT-style license that can be
  10257. * found in the LICENSE file at https://angular.io/license
  10258. */
  10259. var InterpolationConfig = /** @class */ (function () {
  10260. function InterpolationConfig(start, end) {
  10261. this.start = start;
  10262. this.end = end;
  10263. }
  10264. InterpolationConfig.fromArray = function (markers) {
  10265. if (!markers) {
  10266. return DEFAULT_INTERPOLATION_CONFIG;
  10267. }
  10268. assertInterpolationSymbols('interpolation', markers);
  10269. return new InterpolationConfig(markers[0], markers[1]);
  10270. };
  10271. return InterpolationConfig;
  10272. }());
  10273. var DEFAULT_INTERPOLATION_CONFIG = new InterpolationConfig('{{', '}}');
  10274. /**
  10275. * @license
  10276. * Copyright Google Inc. All Rights Reserved.
  10277. *
  10278. * Use of this source code is governed by an MIT-style license that can be
  10279. * found in the LICENSE file at https://angular.io/license
  10280. */
  10281. var StyleWithImports = /** @class */ (function () {
  10282. function StyleWithImports(style, styleUrls) {
  10283. this.style = style;
  10284. this.styleUrls = styleUrls;
  10285. }
  10286. return StyleWithImports;
  10287. }());
  10288. function isStyleUrlResolvable(url) {
  10289. if (url == null || url.length === 0 || url[0] == '/')
  10290. return false;
  10291. var schemeMatch = url.match(URL_WITH_SCHEMA_REGEXP);
  10292. return schemeMatch === null || schemeMatch[1] == 'package' || schemeMatch[1] == 'asset';
  10293. }
  10294. /**
  10295. * Rewrites stylesheets by resolving and removing the @import urls that
  10296. * are either relative or don't have a `package:` scheme
  10297. */
  10298. function extractStyleUrls(resolver, baseUrl, cssText) {
  10299. var foundUrls = [];
  10300. var modifiedCssText = cssText.replace(CSS_STRIPPABLE_COMMENT_REGEXP, '')
  10301. .replace(CSS_IMPORT_REGEXP, function () {
  10302. var m = [];
  10303. for (var _i = 0; _i < arguments.length; _i++) {
  10304. m[_i] = arguments[_i];
  10305. }
  10306. var url = m[1] || m[2];
  10307. if (!isStyleUrlResolvable(url)) {
  10308. // Do not attempt to resolve non-package absolute URLs with URI
  10309. // scheme
  10310. return m[0];
  10311. }
  10312. foundUrls.push(resolver.resolve(baseUrl, url));
  10313. return '';
  10314. });
  10315. return new StyleWithImports(modifiedCssText, foundUrls);
  10316. }
  10317. var CSS_IMPORT_REGEXP = /@import\s+(?:url\()?\s*(?:(?:['"]([^'"]*))|([^;\)\s]*))[^;]*;?/g;
  10318. var CSS_STRIPPABLE_COMMENT_REGEXP = /\/\*(?!#\s*(?:sourceURL|sourceMappingURL)=)[\s\S]+?\*\//g;
  10319. var URL_WITH_SCHEMA_REGEXP = /^([^:/?#]+):/;
  10320. /**
  10321. * @license
  10322. * Copyright Google Inc. All Rights Reserved.
  10323. *
  10324. * Use of this source code is governed by an MIT-style license that can be
  10325. * found in the LICENSE file at https://angular.io/license
  10326. */
  10327. var NG_CONTENT_SELECT_ATTR = 'select';
  10328. var LINK_ELEMENT = 'link';
  10329. var LINK_STYLE_REL_ATTR = 'rel';
  10330. var LINK_STYLE_HREF_ATTR = 'href';
  10331. var LINK_STYLE_REL_VALUE = 'stylesheet';
  10332. var STYLE_ELEMENT = 'style';
  10333. var SCRIPT_ELEMENT = 'script';
  10334. var NG_NON_BINDABLE_ATTR = 'ngNonBindable';
  10335. var NG_PROJECT_AS = 'ngProjectAs';
  10336. function preparseElement(ast) {
  10337. var selectAttr = null;
  10338. var hrefAttr = null;
  10339. var relAttr = null;
  10340. var nonBindable = false;
  10341. var projectAs = '';
  10342. ast.attrs.forEach(function (attr) {
  10343. var lcAttrName = attr.name.toLowerCase();
  10344. if (lcAttrName == NG_CONTENT_SELECT_ATTR) {
  10345. selectAttr = attr.value;
  10346. }
  10347. else if (lcAttrName == LINK_STYLE_HREF_ATTR) {
  10348. hrefAttr = attr.value;
  10349. }
  10350. else if (lcAttrName == LINK_STYLE_REL_ATTR) {
  10351. relAttr = attr.value;
  10352. }
  10353. else if (attr.name == NG_NON_BINDABLE_ATTR) {
  10354. nonBindable = true;
  10355. }
  10356. else if (attr.name == NG_PROJECT_AS) {
  10357. if (attr.value.length > 0) {
  10358. projectAs = attr.value;
  10359. }
  10360. }
  10361. });
  10362. selectAttr = normalizeNgContentSelect(selectAttr);
  10363. var nodeName = ast.name.toLowerCase();
  10364. var type = PreparsedElementType.OTHER;
  10365. if (isNgContent(nodeName)) {
  10366. type = PreparsedElementType.NG_CONTENT;
  10367. }
  10368. else if (nodeName == STYLE_ELEMENT) {
  10369. type = PreparsedElementType.STYLE;
  10370. }
  10371. else if (nodeName == SCRIPT_ELEMENT) {
  10372. type = PreparsedElementType.SCRIPT;
  10373. }
  10374. else if (nodeName == LINK_ELEMENT && relAttr == LINK_STYLE_REL_VALUE) {
  10375. type = PreparsedElementType.STYLESHEET;
  10376. }
  10377. return new PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs);
  10378. }
  10379. var PreparsedElementType;
  10380. (function (PreparsedElementType) {
  10381. PreparsedElementType[PreparsedElementType["NG_CONTENT"] = 0] = "NG_CONTENT";
  10382. PreparsedElementType[PreparsedElementType["STYLE"] = 1] = "STYLE";
  10383. PreparsedElementType[PreparsedElementType["STYLESHEET"] = 2] = "STYLESHEET";
  10384. PreparsedElementType[PreparsedElementType["SCRIPT"] = 3] = "SCRIPT";
  10385. PreparsedElementType[PreparsedElementType["OTHER"] = 4] = "OTHER";
  10386. })(PreparsedElementType || (PreparsedElementType = {}));
  10387. var PreparsedElement = /** @class */ (function () {
  10388. function PreparsedElement(type, selectAttr, hrefAttr, nonBindable, projectAs) {
  10389. this.type = type;
  10390. this.selectAttr = selectAttr;
  10391. this.hrefAttr = hrefAttr;
  10392. this.nonBindable = nonBindable;
  10393. this.projectAs = projectAs;
  10394. }
  10395. return PreparsedElement;
  10396. }());
  10397. function normalizeNgContentSelect(selectAttr) {
  10398. if (selectAttr === null || selectAttr.length === 0) {
  10399. return '*';
  10400. }
  10401. return selectAttr;
  10402. }
  10403. /**
  10404. * @license
  10405. * Copyright Google Inc. All Rights Reserved.
  10406. *
  10407. * Use of this source code is governed by an MIT-style license that can be
  10408. * found in the LICENSE file at https://angular.io/license
  10409. */
  10410. var DirectiveNormalizer = /** @class */ (function () {
  10411. function DirectiveNormalizer(_resourceLoader, _urlResolver, _htmlParser, _config) {
  10412. this._resourceLoader = _resourceLoader;
  10413. this._urlResolver = _urlResolver;
  10414. this._htmlParser = _htmlParser;
  10415. this._config = _config;
  10416. this._resourceLoaderCache = new Map();
  10417. }
  10418. DirectiveNormalizer.prototype.clearCache = function () { this._resourceLoaderCache.clear(); };
  10419. DirectiveNormalizer.prototype.clearCacheFor = function (normalizedDirective) {
  10420. var _this = this;
  10421. if (!normalizedDirective.isComponent) {
  10422. return;
  10423. }
  10424. var template = normalizedDirective.template;
  10425. this._resourceLoaderCache.delete(template.templateUrl);
  10426. template.externalStylesheets.forEach(function (stylesheet) { _this._resourceLoaderCache.delete(stylesheet.moduleUrl); });
  10427. };
  10428. DirectiveNormalizer.prototype._fetch = function (url) {
  10429. var result = this._resourceLoaderCache.get(url);
  10430. if (!result) {
  10431. result = this._resourceLoader.get(url);
  10432. this._resourceLoaderCache.set(url, result);
  10433. }
  10434. return result;
  10435. };
  10436. DirectiveNormalizer.prototype.normalizeTemplate = function (prenormData) {
  10437. var _this = this;
  10438. if (isDefined(prenormData.template)) {
  10439. if (isDefined(prenormData.templateUrl)) {
  10440. throw syntaxError("'" + stringify(prenormData.componentType) + "' component cannot define both template and templateUrl");
  10441. }
  10442. if (typeof prenormData.template !== 'string') {
  10443. throw syntaxError("The template specified for component " + stringify(prenormData.componentType) + " is not a string");
  10444. }
  10445. }
  10446. else if (isDefined(prenormData.templateUrl)) {
  10447. if (typeof prenormData.templateUrl !== 'string') {
  10448. throw syntaxError("The templateUrl specified for component " + stringify(prenormData.componentType) + " is not a string");
  10449. }
  10450. }
  10451. else {
  10452. throw syntaxError("No template specified for component " + stringify(prenormData.componentType));
  10453. }
  10454. if (isDefined(prenormData.preserveWhitespaces) &&
  10455. typeof prenormData.preserveWhitespaces !== 'boolean') {
  10456. throw syntaxError("The preserveWhitespaces option for component " + stringify(prenormData.componentType) + " must be a boolean");
  10457. }
  10458. return SyncAsync.then(this._preParseTemplate(prenormData), function (preparsedTemplate) { return _this._normalizeTemplateMetadata(prenormData, preparsedTemplate); });
  10459. };
  10460. DirectiveNormalizer.prototype._preParseTemplate = function (prenomData) {
  10461. var _this = this;
  10462. var template;
  10463. var templateUrl;
  10464. if (prenomData.template != null) {
  10465. template = prenomData.template;
  10466. templateUrl = prenomData.moduleUrl;
  10467. }
  10468. else {
  10469. templateUrl = this._urlResolver.resolve(prenomData.moduleUrl, prenomData.templateUrl);
  10470. template = this._fetch(templateUrl);
  10471. }
  10472. return SyncAsync.then(template, function (template) { return _this._preparseLoadedTemplate(prenomData, template, templateUrl); });
  10473. };
  10474. DirectiveNormalizer.prototype._preparseLoadedTemplate = function (prenormData, template, templateAbsUrl) {
  10475. var isInline = !!prenormData.template;
  10476. var interpolationConfig = InterpolationConfig.fromArray(prenormData.interpolation);
  10477. var rootNodesAndErrors = this._htmlParser.parse(template, templateSourceUrl({ reference: prenormData.ngModuleType }, { type: { reference: prenormData.componentType } }, { isInline: isInline, templateUrl: templateAbsUrl }), true, interpolationConfig);
  10478. if (rootNodesAndErrors.errors.length > 0) {
  10479. var errorString = rootNodesAndErrors.errors.join('\n');
  10480. throw syntaxError("Template parse errors:\n" + errorString);
  10481. }
  10482. var templateMetadataStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: prenormData.styles, moduleUrl: prenormData.moduleUrl }));
  10483. var visitor = new TemplatePreparseVisitor();
  10484. visitAll(visitor, rootNodesAndErrors.rootNodes);
  10485. var templateStyles = this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: visitor.styles, styleUrls: visitor.styleUrls, moduleUrl: templateAbsUrl }));
  10486. var styles = templateMetadataStyles.styles.concat(templateStyles.styles);
  10487. var inlineStyleUrls = templateMetadataStyles.styleUrls.concat(templateStyles.styleUrls);
  10488. var styleUrls = this
  10489. ._normalizeStylesheet(new CompileStylesheetMetadata({ styleUrls: prenormData.styleUrls, moduleUrl: prenormData.moduleUrl }))
  10490. .styleUrls;
  10491. return {
  10492. template: template,
  10493. templateUrl: templateAbsUrl, isInline: isInline,
  10494. htmlAst: rootNodesAndErrors, styles: styles, inlineStyleUrls: inlineStyleUrls, styleUrls: styleUrls,
  10495. ngContentSelectors: visitor.ngContentSelectors,
  10496. };
  10497. };
  10498. DirectiveNormalizer.prototype._normalizeTemplateMetadata = function (prenormData, preparsedTemplate) {
  10499. var _this = this;
  10500. return SyncAsync.then(this._loadMissingExternalStylesheets(preparsedTemplate.styleUrls.concat(preparsedTemplate.inlineStyleUrls)), function (externalStylesheets) { return _this._normalizeLoadedTemplateMetadata(prenormData, preparsedTemplate, externalStylesheets); });
  10501. };
  10502. DirectiveNormalizer.prototype._normalizeLoadedTemplateMetadata = function (prenormData, preparsedTemplate, stylesheets) {
  10503. // Algorithm:
  10504. // - produce exactly 1 entry per original styleUrl in
  10505. // CompileTemplateMetadata.externalStylesheets with all styles inlined
  10506. // - inline all styles that are referenced by the template into CompileTemplateMetadata.styles.
  10507. // Reason: be able to determine how many stylesheets there are even without loading
  10508. // the template nor the stylesheets, so we can create a stub for TypeScript always synchronously
  10509. // (as resource loading may be async)
  10510. var _this = this;
  10511. var styles = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(preparsedTemplate.styles);
  10512. this._inlineStyles(preparsedTemplate.inlineStyleUrls, stylesheets, styles);
  10513. var styleUrls = preparsedTemplate.styleUrls;
  10514. var externalStylesheets = styleUrls.map(function (styleUrl) {
  10515. var stylesheet = stylesheets.get(styleUrl);
  10516. var styles = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(stylesheet.styles);
  10517. _this._inlineStyles(stylesheet.styleUrls, stylesheets, styles);
  10518. return new CompileStylesheetMetadata({ moduleUrl: styleUrl, styles: styles });
  10519. });
  10520. var encapsulation = prenormData.encapsulation;
  10521. if (encapsulation == null) {
  10522. encapsulation = this._config.defaultEncapsulation;
  10523. }
  10524. if (encapsulation === ViewEncapsulation.Emulated && styles.length === 0 &&
  10525. styleUrls.length === 0) {
  10526. encapsulation = ViewEncapsulation.None;
  10527. }
  10528. return new CompileTemplateMetadata({
  10529. encapsulation: encapsulation,
  10530. template: preparsedTemplate.template,
  10531. templateUrl: preparsedTemplate.templateUrl,
  10532. htmlAst: preparsedTemplate.htmlAst, styles: styles, styleUrls: styleUrls,
  10533. ngContentSelectors: preparsedTemplate.ngContentSelectors,
  10534. animations: prenormData.animations,
  10535. interpolation: prenormData.interpolation,
  10536. isInline: preparsedTemplate.isInline, externalStylesheets: externalStylesheets,
  10537. preserveWhitespaces: preserveWhitespacesDefault(prenormData.preserveWhitespaces, this._config.preserveWhitespaces),
  10538. });
  10539. };
  10540. DirectiveNormalizer.prototype._inlineStyles = function (styleUrls, stylesheets, targetStyles) {
  10541. var _this = this;
  10542. styleUrls.forEach(function (styleUrl) {
  10543. var stylesheet = stylesheets.get(styleUrl);
  10544. stylesheet.styles.forEach(function (style) { return targetStyles.push(style); });
  10545. _this._inlineStyles(stylesheet.styleUrls, stylesheets, targetStyles);
  10546. });
  10547. };
  10548. DirectiveNormalizer.prototype._loadMissingExternalStylesheets = function (styleUrls, loadedStylesheets) {
  10549. var _this = this;
  10550. if (loadedStylesheets === void 0) { loadedStylesheets = new Map(); }
  10551. return SyncAsync.then(SyncAsync.all(styleUrls.filter(function (styleUrl) { return !loadedStylesheets.has(styleUrl); })
  10552. .map(function (styleUrl) { return SyncAsync.then(_this._fetch(styleUrl), function (loadedStyle) {
  10553. var stylesheet = _this._normalizeStylesheet(new CompileStylesheetMetadata({ styles: [loadedStyle], moduleUrl: styleUrl }));
  10554. loadedStylesheets.set(styleUrl, stylesheet);
  10555. return _this._loadMissingExternalStylesheets(stylesheet.styleUrls, loadedStylesheets);
  10556. }); })), function (_) { return loadedStylesheets; });
  10557. };
  10558. DirectiveNormalizer.prototype._normalizeStylesheet = function (stylesheet) {
  10559. var _this = this;
  10560. var moduleUrl = stylesheet.moduleUrl;
  10561. var allStyleUrls = stylesheet.styleUrls.filter(isStyleUrlResolvable)
  10562. .map(function (url) { return _this._urlResolver.resolve(moduleUrl, url); });
  10563. var allStyles = stylesheet.styles.map(function (style) {
  10564. var styleWithImports = extractStyleUrls(_this._urlResolver, moduleUrl, style);
  10565. allStyleUrls.push.apply(allStyleUrls, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(styleWithImports.styleUrls));
  10566. return styleWithImports.style;
  10567. });
  10568. return new CompileStylesheetMetadata({ styles: allStyles, styleUrls: allStyleUrls, moduleUrl: moduleUrl });
  10569. };
  10570. return DirectiveNormalizer;
  10571. }());
  10572. var TemplatePreparseVisitor = /** @class */ (function () {
  10573. function TemplatePreparseVisitor() {
  10574. this.ngContentSelectors = [];
  10575. this.styles = [];
  10576. this.styleUrls = [];
  10577. this.ngNonBindableStackCount = 0;
  10578. }
  10579. TemplatePreparseVisitor.prototype.visitElement = function (ast, context) {
  10580. var preparsedElement = preparseElement(ast);
  10581. switch (preparsedElement.type) {
  10582. case PreparsedElementType.NG_CONTENT:
  10583. if (this.ngNonBindableStackCount === 0) {
  10584. this.ngContentSelectors.push(preparsedElement.selectAttr);
  10585. }
  10586. break;
  10587. case PreparsedElementType.STYLE:
  10588. var textContent_1 = '';
  10589. ast.children.forEach(function (child) {
  10590. if (child instanceof Text) {
  10591. textContent_1 += child.value;
  10592. }
  10593. });
  10594. this.styles.push(textContent_1);
  10595. break;
  10596. case PreparsedElementType.STYLESHEET:
  10597. this.styleUrls.push(preparsedElement.hrefAttr);
  10598. break;
  10599. default:
  10600. break;
  10601. }
  10602. if (preparsedElement.nonBindable) {
  10603. this.ngNonBindableStackCount++;
  10604. }
  10605. visitAll(this, ast.children);
  10606. if (preparsedElement.nonBindable) {
  10607. this.ngNonBindableStackCount--;
  10608. }
  10609. return null;
  10610. };
  10611. TemplatePreparseVisitor.prototype.visitExpansion = function (ast, context) { visitAll(this, ast.cases); };
  10612. TemplatePreparseVisitor.prototype.visitExpansionCase = function (ast, context) {
  10613. visitAll(this, ast.expression);
  10614. };
  10615. TemplatePreparseVisitor.prototype.visitComment = function (ast, context) { return null; };
  10616. TemplatePreparseVisitor.prototype.visitAttribute = function (ast, context) { return null; };
  10617. TemplatePreparseVisitor.prototype.visitText = function (ast, context) { return null; };
  10618. return TemplatePreparseVisitor;
  10619. }());
  10620. /**
  10621. * @license
  10622. * Copyright Google Inc. All Rights Reserved.
  10623. *
  10624. * Use of this source code is governed by an MIT-style license that can be
  10625. * found in the LICENSE file at https://angular.io/license
  10626. */
  10627. var QUERY_METADATA_IDENTIFIERS = [
  10628. createViewChild,
  10629. createViewChildren,
  10630. createContentChild,
  10631. createContentChildren,
  10632. ];
  10633. /*
  10634. * Resolve a `Type` for {@link Directive}.
  10635. *
  10636. * This interface can be overridden by the application developer to create custom behavior.
  10637. *
  10638. * See {@link Compiler}
  10639. */
  10640. var DirectiveResolver = /** @class */ (function () {
  10641. function DirectiveResolver(_reflector) {
  10642. this._reflector = _reflector;
  10643. }
  10644. DirectiveResolver.prototype.isDirective = function (type) {
  10645. var typeMetadata = this._reflector.annotations(resolveForwardRef(type));
  10646. return typeMetadata && typeMetadata.some(isDirectiveMetadata);
  10647. };
  10648. DirectiveResolver.prototype.resolve = function (type, throwIfNotFound) {
  10649. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  10650. var typeMetadata = this._reflector.annotations(resolveForwardRef(type));
  10651. if (typeMetadata) {
  10652. var metadata = findLast(typeMetadata, isDirectiveMetadata);
  10653. if (metadata) {
  10654. var propertyMetadata = this._reflector.propMetadata(type);
  10655. var guards = this._reflector.guards(type);
  10656. return this._mergeWithPropertyMetadata(metadata, propertyMetadata, guards, type);
  10657. }
  10658. }
  10659. if (throwIfNotFound) {
  10660. throw new Error("No Directive annotation found on " + stringify(type));
  10661. }
  10662. return null;
  10663. };
  10664. DirectiveResolver.prototype._mergeWithPropertyMetadata = function (dm, propertyMetadata, guards, directiveType) {
  10665. var inputs = [];
  10666. var outputs = [];
  10667. var host = {};
  10668. var queries = {};
  10669. Object.keys(propertyMetadata).forEach(function (propName) {
  10670. var input = findLast(propertyMetadata[propName], function (a) { return createInput.isTypeOf(a); });
  10671. if (input) {
  10672. if (input.bindingPropertyName) {
  10673. inputs.push(propName + ": " + input.bindingPropertyName);
  10674. }
  10675. else {
  10676. inputs.push(propName);
  10677. }
  10678. }
  10679. var output = findLast(propertyMetadata[propName], function (a) { return createOutput.isTypeOf(a); });
  10680. if (output) {
  10681. if (output.bindingPropertyName) {
  10682. outputs.push(propName + ": " + output.bindingPropertyName);
  10683. }
  10684. else {
  10685. outputs.push(propName);
  10686. }
  10687. }
  10688. var hostBindings = propertyMetadata[propName].filter(function (a) { return createHostBinding.isTypeOf(a); });
  10689. hostBindings.forEach(function (hostBinding) {
  10690. if (hostBinding.hostPropertyName) {
  10691. var startWith = hostBinding.hostPropertyName[0];
  10692. if (startWith === '(') {
  10693. throw new Error("@HostBinding can not bind to events. Use @HostListener instead.");
  10694. }
  10695. else if (startWith === '[') {
  10696. throw new Error("@HostBinding parameter should be a property name, 'class.<name>', or 'attr.<name>'.");
  10697. }
  10698. host["[" + hostBinding.hostPropertyName + "]"] = propName;
  10699. }
  10700. else {
  10701. host["[" + propName + "]"] = propName;
  10702. }
  10703. });
  10704. var hostListeners = propertyMetadata[propName].filter(function (a) { return createHostListener.isTypeOf(a); });
  10705. hostListeners.forEach(function (hostListener) {
  10706. var args = hostListener.args || [];
  10707. host["(" + hostListener.eventName + ")"] = propName + "(" + args.join(',') + ")";
  10708. });
  10709. var query = findLast(propertyMetadata[propName], function (a) { return QUERY_METADATA_IDENTIFIERS.some(function (i) { return i.isTypeOf(a); }); });
  10710. if (query) {
  10711. queries[propName] = query;
  10712. }
  10713. });
  10714. return this._merge(dm, inputs, outputs, host, queries, guards, directiveType);
  10715. };
  10716. DirectiveResolver.prototype._extractPublicName = function (def) { return splitAtColon(def, [null, def])[1].trim(); };
  10717. DirectiveResolver.prototype._dedupeBindings = function (bindings) {
  10718. var names = new Set();
  10719. var publicNames = new Set();
  10720. var reversedResult = [];
  10721. // go last to first to allow later entries to overwrite previous entries
  10722. for (var i = bindings.length - 1; i >= 0; i--) {
  10723. var binding = bindings[i];
  10724. var name_1 = this._extractPublicName(binding);
  10725. publicNames.add(name_1);
  10726. if (!names.has(name_1)) {
  10727. names.add(name_1);
  10728. reversedResult.push(binding);
  10729. }
  10730. }
  10731. return reversedResult.reverse();
  10732. };
  10733. DirectiveResolver.prototype._merge = function (directive, inputs, outputs, host, queries, guards, directiveType) {
  10734. var mergedInputs = this._dedupeBindings(directive.inputs ? directive.inputs.concat(inputs) : inputs);
  10735. var mergedOutputs = this._dedupeBindings(directive.outputs ? directive.outputs.concat(outputs) : outputs);
  10736. var mergedHost = directive.host ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, directive.host, host) : host;
  10737. var mergedQueries = directive.queries ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, directive.queries, queries) : queries;
  10738. if (createComponent.isTypeOf(directive)) {
  10739. var comp = directive;
  10740. return createComponent({
  10741. selector: comp.selector,
  10742. inputs: mergedInputs,
  10743. outputs: mergedOutputs,
  10744. host: mergedHost,
  10745. exportAs: comp.exportAs,
  10746. moduleId: comp.moduleId,
  10747. queries: mergedQueries,
  10748. changeDetection: comp.changeDetection,
  10749. providers: comp.providers,
  10750. viewProviders: comp.viewProviders,
  10751. entryComponents: comp.entryComponents,
  10752. template: comp.template,
  10753. templateUrl: comp.templateUrl,
  10754. styles: comp.styles,
  10755. styleUrls: comp.styleUrls,
  10756. encapsulation: comp.encapsulation,
  10757. animations: comp.animations,
  10758. interpolation: comp.interpolation,
  10759. preserveWhitespaces: directive.preserveWhitespaces,
  10760. });
  10761. }
  10762. else {
  10763. return createDirective({
  10764. selector: directive.selector,
  10765. inputs: mergedInputs,
  10766. outputs: mergedOutputs,
  10767. host: mergedHost,
  10768. exportAs: directive.exportAs,
  10769. queries: mergedQueries,
  10770. providers: directive.providers, guards: guards
  10771. });
  10772. }
  10773. };
  10774. return DirectiveResolver;
  10775. }());
  10776. function isDirectiveMetadata(type) {
  10777. return createDirective.isTypeOf(type) || createComponent.isTypeOf(type);
  10778. }
  10779. function findLast(arr, condition) {
  10780. for (var i = arr.length - 1; i >= 0; i--) {
  10781. if (condition(arr[i])) {
  10782. return arr[i];
  10783. }
  10784. }
  10785. return null;
  10786. }
  10787. /**
  10788. * @license
  10789. * Copyright Google Inc. All Rights Reserved.
  10790. *
  10791. * Use of this source code is governed by an MIT-style license that can be
  10792. * found in the LICENSE file at https://angular.io/license
  10793. */
  10794. var $EOF = 0;
  10795. var $TAB = 9;
  10796. var $LF = 10;
  10797. var $VTAB = 11;
  10798. var $FF = 12;
  10799. var $CR = 13;
  10800. var $SPACE = 32;
  10801. var $BANG = 33;
  10802. var $DQ = 34;
  10803. var $HASH = 35;
  10804. var $$ = 36;
  10805. var $PERCENT = 37;
  10806. var $AMPERSAND = 38;
  10807. var $SQ = 39;
  10808. var $LPAREN = 40;
  10809. var $RPAREN = 41;
  10810. var $STAR = 42;
  10811. var $PLUS = 43;
  10812. var $COMMA = 44;
  10813. var $MINUS = 45;
  10814. var $PERIOD = 46;
  10815. var $SLASH = 47;
  10816. var $COLON = 58;
  10817. var $SEMICOLON = 59;
  10818. var $LT = 60;
  10819. var $EQ = 61;
  10820. var $GT = 62;
  10821. var $QUESTION = 63;
  10822. var $0 = 48;
  10823. var $9 = 57;
  10824. var $A = 65;
  10825. var $E = 69;
  10826. var $F = 70;
  10827. var $X = 88;
  10828. var $Z = 90;
  10829. var $LBRACKET = 91;
  10830. var $BACKSLASH = 92;
  10831. var $RBRACKET = 93;
  10832. var $CARET = 94;
  10833. var $_ = 95;
  10834. var $a = 97;
  10835. var $e = 101;
  10836. var $f = 102;
  10837. var $n = 110;
  10838. var $r = 114;
  10839. var $t = 116;
  10840. var $u = 117;
  10841. var $v = 118;
  10842. var $x = 120;
  10843. var $z = 122;
  10844. var $LBRACE = 123;
  10845. var $BAR = 124;
  10846. var $RBRACE = 125;
  10847. var $NBSP = 160;
  10848. var $BT = 96;
  10849. function isWhitespace(code) {
  10850. return (code >= $TAB && code <= $SPACE) || (code == $NBSP);
  10851. }
  10852. function isDigit(code) {
  10853. return $0 <= code && code <= $9;
  10854. }
  10855. function isAsciiLetter(code) {
  10856. return code >= $a && code <= $z || code >= $A && code <= $Z;
  10857. }
  10858. function isAsciiHexDigit(code) {
  10859. return code >= $a && code <= $f || code >= $A && code <= $F || isDigit(code);
  10860. }
  10861. /**
  10862. * @license
  10863. * Copyright Google Inc. All Rights Reserved.
  10864. *
  10865. * Use of this source code is governed by an MIT-style license that can be
  10866. * found in the LICENSE file at https://angular.io/license
  10867. */
  10868. var TokenType;
  10869. (function (TokenType) {
  10870. TokenType[TokenType["Character"] = 0] = "Character";
  10871. TokenType[TokenType["Identifier"] = 1] = "Identifier";
  10872. TokenType[TokenType["Keyword"] = 2] = "Keyword";
  10873. TokenType[TokenType["String"] = 3] = "String";
  10874. TokenType[TokenType["Operator"] = 4] = "Operator";
  10875. TokenType[TokenType["Number"] = 5] = "Number";
  10876. TokenType[TokenType["Error"] = 6] = "Error";
  10877. })(TokenType || (TokenType = {}));
  10878. var KEYWORDS = ['var', 'let', 'as', 'null', 'undefined', 'true', 'false', 'if', 'else', 'this'];
  10879. var Lexer = /** @class */ (function () {
  10880. function Lexer() {
  10881. }
  10882. Lexer.prototype.tokenize = function (text) {
  10883. var scanner = new _Scanner(text);
  10884. var tokens = [];
  10885. var token = scanner.scanToken();
  10886. while (token != null) {
  10887. tokens.push(token);
  10888. token = scanner.scanToken();
  10889. }
  10890. return tokens;
  10891. };
  10892. return Lexer;
  10893. }());
  10894. var Token = /** @class */ (function () {
  10895. function Token(index, type, numValue, strValue) {
  10896. this.index = index;
  10897. this.type = type;
  10898. this.numValue = numValue;
  10899. this.strValue = strValue;
  10900. }
  10901. Token.prototype.isCharacter = function (code) {
  10902. return this.type == TokenType.Character && this.numValue == code;
  10903. };
  10904. Token.prototype.isNumber = function () { return this.type == TokenType.Number; };
  10905. Token.prototype.isString = function () { return this.type == TokenType.String; };
  10906. Token.prototype.isOperator = function (operater) {
  10907. return this.type == TokenType.Operator && this.strValue == operater;
  10908. };
  10909. Token.prototype.isIdentifier = function () { return this.type == TokenType.Identifier; };
  10910. Token.prototype.isKeyword = function () { return this.type == TokenType.Keyword; };
  10911. Token.prototype.isKeywordLet = function () { return this.type == TokenType.Keyword && this.strValue == 'let'; };
  10912. Token.prototype.isKeywordAs = function () { return this.type == TokenType.Keyword && this.strValue == 'as'; };
  10913. Token.prototype.isKeywordNull = function () { return this.type == TokenType.Keyword && this.strValue == 'null'; };
  10914. Token.prototype.isKeywordUndefined = function () {
  10915. return this.type == TokenType.Keyword && this.strValue == 'undefined';
  10916. };
  10917. Token.prototype.isKeywordTrue = function () { return this.type == TokenType.Keyword && this.strValue == 'true'; };
  10918. Token.prototype.isKeywordFalse = function () { return this.type == TokenType.Keyword && this.strValue == 'false'; };
  10919. Token.prototype.isKeywordThis = function () { return this.type == TokenType.Keyword && this.strValue == 'this'; };
  10920. Token.prototype.isError = function () { return this.type == TokenType.Error; };
  10921. Token.prototype.toNumber = function () { return this.type == TokenType.Number ? this.numValue : -1; };
  10922. Token.prototype.toString = function () {
  10923. switch (this.type) {
  10924. case TokenType.Character:
  10925. case TokenType.Identifier:
  10926. case TokenType.Keyword:
  10927. case TokenType.Operator:
  10928. case TokenType.String:
  10929. case TokenType.Error:
  10930. return this.strValue;
  10931. case TokenType.Number:
  10932. return this.numValue.toString();
  10933. default:
  10934. return null;
  10935. }
  10936. };
  10937. return Token;
  10938. }());
  10939. function newCharacterToken(index, code) {
  10940. return new Token(index, TokenType.Character, code, String.fromCharCode(code));
  10941. }
  10942. function newIdentifierToken(index, text) {
  10943. return new Token(index, TokenType.Identifier, 0, text);
  10944. }
  10945. function newKeywordToken(index, text) {
  10946. return new Token(index, TokenType.Keyword, 0, text);
  10947. }
  10948. function newOperatorToken(index, text) {
  10949. return new Token(index, TokenType.Operator, 0, text);
  10950. }
  10951. function newStringToken(index, text) {
  10952. return new Token(index, TokenType.String, 0, text);
  10953. }
  10954. function newNumberToken(index, n) {
  10955. return new Token(index, TokenType.Number, n, '');
  10956. }
  10957. function newErrorToken(index, message) {
  10958. return new Token(index, TokenType.Error, 0, message);
  10959. }
  10960. var EOF = new Token(-1, TokenType.Character, 0, '');
  10961. var _Scanner = /** @class */ (function () {
  10962. function _Scanner(input) {
  10963. this.input = input;
  10964. this.peek = 0;
  10965. this.index = -1;
  10966. this.length = input.length;
  10967. this.advance();
  10968. }
  10969. _Scanner.prototype.advance = function () {
  10970. this.peek = ++this.index >= this.length ? $EOF : this.input.charCodeAt(this.index);
  10971. };
  10972. _Scanner.prototype.scanToken = function () {
  10973. var input = this.input, length = this.length;
  10974. var peek = this.peek, index = this.index;
  10975. // Skip whitespace.
  10976. while (peek <= $SPACE) {
  10977. if (++index >= length) {
  10978. peek = $EOF;
  10979. break;
  10980. }
  10981. else {
  10982. peek = input.charCodeAt(index);
  10983. }
  10984. }
  10985. this.peek = peek;
  10986. this.index = index;
  10987. if (index >= length) {
  10988. return null;
  10989. }
  10990. // Handle identifiers and numbers.
  10991. if (isIdentifierStart(peek))
  10992. return this.scanIdentifier();
  10993. if (isDigit(peek))
  10994. return this.scanNumber(index);
  10995. var start = index;
  10996. switch (peek) {
  10997. case $PERIOD:
  10998. this.advance();
  10999. return isDigit(this.peek) ? this.scanNumber(start) :
  11000. newCharacterToken(start, $PERIOD);
  11001. case $LPAREN:
  11002. case $RPAREN:
  11003. case $LBRACE:
  11004. case $RBRACE:
  11005. case $LBRACKET:
  11006. case $RBRACKET:
  11007. case $COMMA:
  11008. case $COLON:
  11009. case $SEMICOLON:
  11010. return this.scanCharacter(start, peek);
  11011. case $SQ:
  11012. case $DQ:
  11013. return this.scanString();
  11014. case $HASH:
  11015. case $PLUS:
  11016. case $MINUS:
  11017. case $STAR:
  11018. case $SLASH:
  11019. case $PERCENT:
  11020. case $CARET:
  11021. return this.scanOperator(start, String.fromCharCode(peek));
  11022. case $QUESTION:
  11023. return this.scanComplexOperator(start, '?', $PERIOD, '.');
  11024. case $LT:
  11025. case $GT:
  11026. return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=');
  11027. case $BANG:
  11028. case $EQ:
  11029. return this.scanComplexOperator(start, String.fromCharCode(peek), $EQ, '=', $EQ, '=');
  11030. case $AMPERSAND:
  11031. return this.scanComplexOperator(start, '&', $AMPERSAND, '&');
  11032. case $BAR:
  11033. return this.scanComplexOperator(start, '|', $BAR, '|');
  11034. case $NBSP:
  11035. while (isWhitespace(this.peek))
  11036. this.advance();
  11037. return this.scanToken();
  11038. }
  11039. this.advance();
  11040. return this.error("Unexpected character [" + String.fromCharCode(peek) + "]", 0);
  11041. };
  11042. _Scanner.prototype.scanCharacter = function (start, code) {
  11043. this.advance();
  11044. return newCharacterToken(start, code);
  11045. };
  11046. _Scanner.prototype.scanOperator = function (start, str) {
  11047. this.advance();
  11048. return newOperatorToken(start, str);
  11049. };
  11050. /**
  11051. * Tokenize a 2/3 char long operator
  11052. *
  11053. * @param start start index in the expression
  11054. * @param one first symbol (always part of the operator)
  11055. * @param twoCode code point for the second symbol
  11056. * @param two second symbol (part of the operator when the second code point matches)
  11057. * @param threeCode code point for the third symbol
  11058. * @param three third symbol (part of the operator when provided and matches source expression)
  11059. */
  11060. _Scanner.prototype.scanComplexOperator = function (start, one, twoCode, two, threeCode, three) {
  11061. this.advance();
  11062. var str = one;
  11063. if (this.peek == twoCode) {
  11064. this.advance();
  11065. str += two;
  11066. }
  11067. if (threeCode != null && this.peek == threeCode) {
  11068. this.advance();
  11069. str += three;
  11070. }
  11071. return newOperatorToken(start, str);
  11072. };
  11073. _Scanner.prototype.scanIdentifier = function () {
  11074. var start = this.index;
  11075. this.advance();
  11076. while (isIdentifierPart(this.peek))
  11077. this.advance();
  11078. var str = this.input.substring(start, this.index);
  11079. return KEYWORDS.indexOf(str) > -1 ? newKeywordToken(start, str) :
  11080. newIdentifierToken(start, str);
  11081. };
  11082. _Scanner.prototype.scanNumber = function (start) {
  11083. var simple = (this.index === start);
  11084. this.advance(); // Skip initial digit.
  11085. while (true) {
  11086. if (isDigit(this.peek)) ;
  11087. else if (this.peek == $PERIOD) {
  11088. simple = false;
  11089. }
  11090. else if (isExponentStart(this.peek)) {
  11091. this.advance();
  11092. if (isExponentSign(this.peek))
  11093. this.advance();
  11094. if (!isDigit(this.peek))
  11095. return this.error('Invalid exponent', -1);
  11096. simple = false;
  11097. }
  11098. else {
  11099. break;
  11100. }
  11101. this.advance();
  11102. }
  11103. var str = this.input.substring(start, this.index);
  11104. var value = simple ? parseIntAutoRadix(str) : parseFloat(str);
  11105. return newNumberToken(start, value);
  11106. };
  11107. _Scanner.prototype.scanString = function () {
  11108. var start = this.index;
  11109. var quote = this.peek;
  11110. this.advance(); // Skip initial quote.
  11111. var buffer = '';
  11112. var marker = this.index;
  11113. var input = this.input;
  11114. while (this.peek != quote) {
  11115. if (this.peek == $BACKSLASH) {
  11116. buffer += input.substring(marker, this.index);
  11117. this.advance();
  11118. var unescapedCode = void 0;
  11119. // Workaround for TS2.1-introduced type strictness
  11120. this.peek = this.peek;
  11121. if (this.peek == $u) {
  11122. // 4 character hex code for unicode character.
  11123. var hex = input.substring(this.index + 1, this.index + 5);
  11124. if (/^[0-9a-f]+$/i.test(hex)) {
  11125. unescapedCode = parseInt(hex, 16);
  11126. }
  11127. else {
  11128. return this.error("Invalid unicode escape [\\u" + hex + "]", 0);
  11129. }
  11130. for (var i = 0; i < 5; i++) {
  11131. this.advance();
  11132. }
  11133. }
  11134. else {
  11135. unescapedCode = unescape(this.peek);
  11136. this.advance();
  11137. }
  11138. buffer += String.fromCharCode(unescapedCode);
  11139. marker = this.index;
  11140. }
  11141. else if (this.peek == $EOF) {
  11142. return this.error('Unterminated quote', 0);
  11143. }
  11144. else {
  11145. this.advance();
  11146. }
  11147. }
  11148. var last = input.substring(marker, this.index);
  11149. this.advance(); // Skip terminating quote.
  11150. return newStringToken(start, buffer + last);
  11151. };
  11152. _Scanner.prototype.error = function (message, offset) {
  11153. var position = this.index + offset;
  11154. return newErrorToken(position, "Lexer Error: " + message + " at column " + position + " in expression [" + this.input + "]");
  11155. };
  11156. return _Scanner;
  11157. }());
  11158. function isIdentifierStart(code) {
  11159. return ($a <= code && code <= $z) || ($A <= code && code <= $Z) ||
  11160. (code == $_) || (code == $$);
  11161. }
  11162. function isIdentifier(input) {
  11163. if (input.length == 0)
  11164. return false;
  11165. var scanner = new _Scanner(input);
  11166. if (!isIdentifierStart(scanner.peek))
  11167. return false;
  11168. scanner.advance();
  11169. while (scanner.peek !== $EOF) {
  11170. if (!isIdentifierPart(scanner.peek))
  11171. return false;
  11172. scanner.advance();
  11173. }
  11174. return true;
  11175. }
  11176. function isIdentifierPart(code) {
  11177. return isAsciiLetter(code) || isDigit(code) || (code == $_) ||
  11178. (code == $$);
  11179. }
  11180. function isExponentStart(code) {
  11181. return code == $e || code == $E;
  11182. }
  11183. function isExponentSign(code) {
  11184. return code == $MINUS || code == $PLUS;
  11185. }
  11186. function isQuote(code) {
  11187. return code === $SQ || code === $DQ || code === $BT;
  11188. }
  11189. function unescape(code) {
  11190. switch (code) {
  11191. case $n:
  11192. return $LF;
  11193. case $f:
  11194. return $FF;
  11195. case $r:
  11196. return $CR;
  11197. case $t:
  11198. return $TAB;
  11199. case $v:
  11200. return $VTAB;
  11201. default:
  11202. return code;
  11203. }
  11204. }
  11205. function parseIntAutoRadix(text) {
  11206. var result = parseInt(text);
  11207. if (isNaN(result)) {
  11208. throw new Error('Invalid integer literal when parsing ' + text);
  11209. }
  11210. return result;
  11211. }
  11212. /**
  11213. * @license
  11214. * Copyright Google Inc. All Rights Reserved.
  11215. *
  11216. * Use of this source code is governed by an MIT-style license that can be
  11217. * found in the LICENSE file at https://angular.io/license
  11218. */
  11219. var ParserError = /** @class */ (function () {
  11220. function ParserError(message, input, errLocation, ctxLocation) {
  11221. this.input = input;
  11222. this.errLocation = errLocation;
  11223. this.ctxLocation = ctxLocation;
  11224. this.message = "Parser Error: " + message + " " + errLocation + " [" + input + "] in " + ctxLocation;
  11225. }
  11226. return ParserError;
  11227. }());
  11228. var ParseSpan = /** @class */ (function () {
  11229. function ParseSpan(start, end) {
  11230. this.start = start;
  11231. this.end = end;
  11232. }
  11233. return ParseSpan;
  11234. }());
  11235. var AST = /** @class */ (function () {
  11236. function AST(span) {
  11237. this.span = span;
  11238. }
  11239. AST.prototype.visit = function (visitor, context) {
  11240. if (context === void 0) { context = null; }
  11241. return null;
  11242. };
  11243. AST.prototype.toString = function () { return 'AST'; };
  11244. return AST;
  11245. }());
  11246. /**
  11247. * Represents a quoted expression of the form:
  11248. *
  11249. * quote = prefix `:` uninterpretedExpression
  11250. * prefix = identifier
  11251. * uninterpretedExpression = arbitrary string
  11252. *
  11253. * A quoted expression is meant to be pre-processed by an AST transformer that
  11254. * converts it into another AST that no longer contains quoted expressions.
  11255. * It is meant to allow third-party developers to extend Angular template
  11256. * expression language. The `uninterpretedExpression` part of the quote is
  11257. * therefore not interpreted by the Angular's own expression parser.
  11258. */
  11259. var Quote = /** @class */ (function (_super) {
  11260. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Quote, _super);
  11261. function Quote(span, prefix, uninterpretedExpression, location) {
  11262. var _this = _super.call(this, span) || this;
  11263. _this.prefix = prefix;
  11264. _this.uninterpretedExpression = uninterpretedExpression;
  11265. _this.location = location;
  11266. return _this;
  11267. }
  11268. Quote.prototype.visit = function (visitor, context) {
  11269. if (context === void 0) { context = null; }
  11270. return visitor.visitQuote(this, context);
  11271. };
  11272. Quote.prototype.toString = function () { return 'Quote'; };
  11273. return Quote;
  11274. }(AST));
  11275. var EmptyExpr = /** @class */ (function (_super) {
  11276. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(EmptyExpr, _super);
  11277. function EmptyExpr() {
  11278. return _super !== null && _super.apply(this, arguments) || this;
  11279. }
  11280. EmptyExpr.prototype.visit = function (visitor, context) {
  11281. if (context === void 0) { context = null; }
  11282. // do nothing
  11283. };
  11284. return EmptyExpr;
  11285. }(AST));
  11286. var ImplicitReceiver = /** @class */ (function (_super) {
  11287. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ImplicitReceiver, _super);
  11288. function ImplicitReceiver() {
  11289. return _super !== null && _super.apply(this, arguments) || this;
  11290. }
  11291. ImplicitReceiver.prototype.visit = function (visitor, context) {
  11292. if (context === void 0) { context = null; }
  11293. return visitor.visitImplicitReceiver(this, context);
  11294. };
  11295. return ImplicitReceiver;
  11296. }(AST));
  11297. /**
  11298. * Multiple expressions separated by a semicolon.
  11299. */
  11300. var Chain = /** @class */ (function (_super) {
  11301. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Chain, _super);
  11302. function Chain(span, expressions) {
  11303. var _this = _super.call(this, span) || this;
  11304. _this.expressions = expressions;
  11305. return _this;
  11306. }
  11307. Chain.prototype.visit = function (visitor, context) {
  11308. if (context === void 0) { context = null; }
  11309. return visitor.visitChain(this, context);
  11310. };
  11311. return Chain;
  11312. }(AST));
  11313. var Conditional = /** @class */ (function (_super) {
  11314. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Conditional, _super);
  11315. function Conditional(span, condition, trueExp, falseExp) {
  11316. var _this = _super.call(this, span) || this;
  11317. _this.condition = condition;
  11318. _this.trueExp = trueExp;
  11319. _this.falseExp = falseExp;
  11320. return _this;
  11321. }
  11322. Conditional.prototype.visit = function (visitor, context) {
  11323. if (context === void 0) { context = null; }
  11324. return visitor.visitConditional(this, context);
  11325. };
  11326. return Conditional;
  11327. }(AST));
  11328. var PropertyRead = /** @class */ (function (_super) {
  11329. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PropertyRead, _super);
  11330. function PropertyRead(span, receiver, name) {
  11331. var _this = _super.call(this, span) || this;
  11332. _this.receiver = receiver;
  11333. _this.name = name;
  11334. return _this;
  11335. }
  11336. PropertyRead.prototype.visit = function (visitor, context) {
  11337. if (context === void 0) { context = null; }
  11338. return visitor.visitPropertyRead(this, context);
  11339. };
  11340. return PropertyRead;
  11341. }(AST));
  11342. var PropertyWrite = /** @class */ (function (_super) {
  11343. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PropertyWrite, _super);
  11344. function PropertyWrite(span, receiver, name, value) {
  11345. var _this = _super.call(this, span) || this;
  11346. _this.receiver = receiver;
  11347. _this.name = name;
  11348. _this.value = value;
  11349. return _this;
  11350. }
  11351. PropertyWrite.prototype.visit = function (visitor, context) {
  11352. if (context === void 0) { context = null; }
  11353. return visitor.visitPropertyWrite(this, context);
  11354. };
  11355. return PropertyWrite;
  11356. }(AST));
  11357. var SafePropertyRead = /** @class */ (function (_super) {
  11358. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafePropertyRead, _super);
  11359. function SafePropertyRead(span, receiver, name) {
  11360. var _this = _super.call(this, span) || this;
  11361. _this.receiver = receiver;
  11362. _this.name = name;
  11363. return _this;
  11364. }
  11365. SafePropertyRead.prototype.visit = function (visitor, context) {
  11366. if (context === void 0) { context = null; }
  11367. return visitor.visitSafePropertyRead(this, context);
  11368. };
  11369. return SafePropertyRead;
  11370. }(AST));
  11371. var KeyedRead = /** @class */ (function (_super) {
  11372. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(KeyedRead, _super);
  11373. function KeyedRead(span, obj, key) {
  11374. var _this = _super.call(this, span) || this;
  11375. _this.obj = obj;
  11376. _this.key = key;
  11377. return _this;
  11378. }
  11379. KeyedRead.prototype.visit = function (visitor, context) {
  11380. if (context === void 0) { context = null; }
  11381. return visitor.visitKeyedRead(this, context);
  11382. };
  11383. return KeyedRead;
  11384. }(AST));
  11385. var KeyedWrite = /** @class */ (function (_super) {
  11386. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(KeyedWrite, _super);
  11387. function KeyedWrite(span, obj, key, value) {
  11388. var _this = _super.call(this, span) || this;
  11389. _this.obj = obj;
  11390. _this.key = key;
  11391. _this.value = value;
  11392. return _this;
  11393. }
  11394. KeyedWrite.prototype.visit = function (visitor, context) {
  11395. if (context === void 0) { context = null; }
  11396. return visitor.visitKeyedWrite(this, context);
  11397. };
  11398. return KeyedWrite;
  11399. }(AST));
  11400. var BindingPipe = /** @class */ (function (_super) {
  11401. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BindingPipe, _super);
  11402. function BindingPipe(span, exp, name, args) {
  11403. var _this = _super.call(this, span) || this;
  11404. _this.exp = exp;
  11405. _this.name = name;
  11406. _this.args = args;
  11407. return _this;
  11408. }
  11409. BindingPipe.prototype.visit = function (visitor, context) {
  11410. if (context === void 0) { context = null; }
  11411. return visitor.visitPipe(this, context);
  11412. };
  11413. return BindingPipe;
  11414. }(AST));
  11415. var LiteralPrimitive = /** @class */ (function (_super) {
  11416. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LiteralPrimitive, _super);
  11417. function LiteralPrimitive(span, value) {
  11418. var _this = _super.call(this, span) || this;
  11419. _this.value = value;
  11420. return _this;
  11421. }
  11422. LiteralPrimitive.prototype.visit = function (visitor, context) {
  11423. if (context === void 0) { context = null; }
  11424. return visitor.visitLiteralPrimitive(this, context);
  11425. };
  11426. return LiteralPrimitive;
  11427. }(AST));
  11428. var LiteralArray = /** @class */ (function (_super) {
  11429. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LiteralArray, _super);
  11430. function LiteralArray(span, expressions) {
  11431. var _this = _super.call(this, span) || this;
  11432. _this.expressions = expressions;
  11433. return _this;
  11434. }
  11435. LiteralArray.prototype.visit = function (visitor, context) {
  11436. if (context === void 0) { context = null; }
  11437. return visitor.visitLiteralArray(this, context);
  11438. };
  11439. return LiteralArray;
  11440. }(AST));
  11441. var LiteralMap = /** @class */ (function (_super) {
  11442. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LiteralMap, _super);
  11443. function LiteralMap(span, keys, values) {
  11444. var _this = _super.call(this, span) || this;
  11445. _this.keys = keys;
  11446. _this.values = values;
  11447. return _this;
  11448. }
  11449. LiteralMap.prototype.visit = function (visitor, context) {
  11450. if (context === void 0) { context = null; }
  11451. return visitor.visitLiteralMap(this, context);
  11452. };
  11453. return LiteralMap;
  11454. }(AST));
  11455. var Interpolation = /** @class */ (function (_super) {
  11456. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Interpolation, _super);
  11457. function Interpolation(span, strings, expressions) {
  11458. var _this = _super.call(this, span) || this;
  11459. _this.strings = strings;
  11460. _this.expressions = expressions;
  11461. return _this;
  11462. }
  11463. Interpolation.prototype.visit = function (visitor, context) {
  11464. if (context === void 0) { context = null; }
  11465. return visitor.visitInterpolation(this, context);
  11466. };
  11467. return Interpolation;
  11468. }(AST));
  11469. var Binary = /** @class */ (function (_super) {
  11470. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Binary, _super);
  11471. function Binary(span, operation, left, right) {
  11472. var _this = _super.call(this, span) || this;
  11473. _this.operation = operation;
  11474. _this.left = left;
  11475. _this.right = right;
  11476. return _this;
  11477. }
  11478. Binary.prototype.visit = function (visitor, context) {
  11479. if (context === void 0) { context = null; }
  11480. return visitor.visitBinary(this, context);
  11481. };
  11482. return Binary;
  11483. }(AST));
  11484. var PrefixNot = /** @class */ (function (_super) {
  11485. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PrefixNot, _super);
  11486. function PrefixNot(span, expression) {
  11487. var _this = _super.call(this, span) || this;
  11488. _this.expression = expression;
  11489. return _this;
  11490. }
  11491. PrefixNot.prototype.visit = function (visitor, context) {
  11492. if (context === void 0) { context = null; }
  11493. return visitor.visitPrefixNot(this, context);
  11494. };
  11495. return PrefixNot;
  11496. }(AST));
  11497. var NonNullAssert = /** @class */ (function (_super) {
  11498. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NonNullAssert, _super);
  11499. function NonNullAssert(span, expression) {
  11500. var _this = _super.call(this, span) || this;
  11501. _this.expression = expression;
  11502. return _this;
  11503. }
  11504. NonNullAssert.prototype.visit = function (visitor, context) {
  11505. if (context === void 0) { context = null; }
  11506. return visitor.visitNonNullAssert(this, context);
  11507. };
  11508. return NonNullAssert;
  11509. }(AST));
  11510. var MethodCall = /** @class */ (function (_super) {
  11511. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MethodCall, _super);
  11512. function MethodCall(span, receiver, name, args) {
  11513. var _this = _super.call(this, span) || this;
  11514. _this.receiver = receiver;
  11515. _this.name = name;
  11516. _this.args = args;
  11517. return _this;
  11518. }
  11519. MethodCall.prototype.visit = function (visitor, context) {
  11520. if (context === void 0) { context = null; }
  11521. return visitor.visitMethodCall(this, context);
  11522. };
  11523. return MethodCall;
  11524. }(AST));
  11525. var SafeMethodCall = /** @class */ (function (_super) {
  11526. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafeMethodCall, _super);
  11527. function SafeMethodCall(span, receiver, name, args) {
  11528. var _this = _super.call(this, span) || this;
  11529. _this.receiver = receiver;
  11530. _this.name = name;
  11531. _this.args = args;
  11532. return _this;
  11533. }
  11534. SafeMethodCall.prototype.visit = function (visitor, context) {
  11535. if (context === void 0) { context = null; }
  11536. return visitor.visitSafeMethodCall(this, context);
  11537. };
  11538. return SafeMethodCall;
  11539. }(AST));
  11540. var FunctionCall = /** @class */ (function (_super) {
  11541. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FunctionCall, _super);
  11542. function FunctionCall(span, target, args) {
  11543. var _this = _super.call(this, span) || this;
  11544. _this.target = target;
  11545. _this.args = args;
  11546. return _this;
  11547. }
  11548. FunctionCall.prototype.visit = function (visitor, context) {
  11549. if (context === void 0) { context = null; }
  11550. return visitor.visitFunctionCall(this, context);
  11551. };
  11552. return FunctionCall;
  11553. }(AST));
  11554. var ASTWithSource = /** @class */ (function (_super) {
  11555. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ASTWithSource, _super);
  11556. function ASTWithSource(ast, source, location, errors) {
  11557. var _this = _super.call(this, new ParseSpan(0, source == null ? 0 : source.length)) || this;
  11558. _this.ast = ast;
  11559. _this.source = source;
  11560. _this.location = location;
  11561. _this.errors = errors;
  11562. return _this;
  11563. }
  11564. ASTWithSource.prototype.visit = function (visitor, context) {
  11565. if (context === void 0) { context = null; }
  11566. return this.ast.visit(visitor, context);
  11567. };
  11568. ASTWithSource.prototype.toString = function () { return this.source + " in " + this.location; };
  11569. return ASTWithSource;
  11570. }(AST));
  11571. var TemplateBinding = /** @class */ (function () {
  11572. function TemplateBinding(span, key, keyIsVar, name, expression) {
  11573. this.span = span;
  11574. this.key = key;
  11575. this.keyIsVar = keyIsVar;
  11576. this.name = name;
  11577. this.expression = expression;
  11578. }
  11579. return TemplateBinding;
  11580. }());
  11581. var NullAstVisitor = /** @class */ (function () {
  11582. function NullAstVisitor() {
  11583. }
  11584. NullAstVisitor.prototype.visitBinary = function (ast, context) { };
  11585. NullAstVisitor.prototype.visitChain = function (ast, context) { };
  11586. NullAstVisitor.prototype.visitConditional = function (ast, context) { };
  11587. NullAstVisitor.prototype.visitFunctionCall = function (ast, context) { };
  11588. NullAstVisitor.prototype.visitImplicitReceiver = function (ast, context) { };
  11589. NullAstVisitor.prototype.visitInterpolation = function (ast, context) { };
  11590. NullAstVisitor.prototype.visitKeyedRead = function (ast, context) { };
  11591. NullAstVisitor.prototype.visitKeyedWrite = function (ast, context) { };
  11592. NullAstVisitor.prototype.visitLiteralArray = function (ast, context) { };
  11593. NullAstVisitor.prototype.visitLiteralMap = function (ast, context) { };
  11594. NullAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { };
  11595. NullAstVisitor.prototype.visitMethodCall = function (ast, context) { };
  11596. NullAstVisitor.prototype.visitPipe = function (ast, context) { };
  11597. NullAstVisitor.prototype.visitPrefixNot = function (ast, context) { };
  11598. NullAstVisitor.prototype.visitNonNullAssert = function (ast, context) { };
  11599. NullAstVisitor.prototype.visitPropertyRead = function (ast, context) { };
  11600. NullAstVisitor.prototype.visitPropertyWrite = function (ast, context) { };
  11601. NullAstVisitor.prototype.visitQuote = function (ast, context) { };
  11602. NullAstVisitor.prototype.visitSafeMethodCall = function (ast, context) { };
  11603. NullAstVisitor.prototype.visitSafePropertyRead = function (ast, context) { };
  11604. return NullAstVisitor;
  11605. }());
  11606. var RecursiveAstVisitor = /** @class */ (function () {
  11607. function RecursiveAstVisitor() {
  11608. }
  11609. RecursiveAstVisitor.prototype.visitBinary = function (ast, context) {
  11610. ast.left.visit(this);
  11611. ast.right.visit(this);
  11612. return null;
  11613. };
  11614. RecursiveAstVisitor.prototype.visitChain = function (ast, context) { return this.visitAll(ast.expressions, context); };
  11615. RecursiveAstVisitor.prototype.visitConditional = function (ast, context) {
  11616. ast.condition.visit(this);
  11617. ast.trueExp.visit(this);
  11618. ast.falseExp.visit(this);
  11619. return null;
  11620. };
  11621. RecursiveAstVisitor.prototype.visitPipe = function (ast, context) {
  11622. ast.exp.visit(this);
  11623. this.visitAll(ast.args, context);
  11624. return null;
  11625. };
  11626. RecursiveAstVisitor.prototype.visitFunctionCall = function (ast, context) {
  11627. ast.target.visit(this);
  11628. this.visitAll(ast.args, context);
  11629. return null;
  11630. };
  11631. RecursiveAstVisitor.prototype.visitImplicitReceiver = function (ast, context) { return null; };
  11632. RecursiveAstVisitor.prototype.visitInterpolation = function (ast, context) {
  11633. return this.visitAll(ast.expressions, context);
  11634. };
  11635. RecursiveAstVisitor.prototype.visitKeyedRead = function (ast, context) {
  11636. ast.obj.visit(this);
  11637. ast.key.visit(this);
  11638. return null;
  11639. };
  11640. RecursiveAstVisitor.prototype.visitKeyedWrite = function (ast, context) {
  11641. ast.obj.visit(this);
  11642. ast.key.visit(this);
  11643. ast.value.visit(this);
  11644. return null;
  11645. };
  11646. RecursiveAstVisitor.prototype.visitLiteralArray = function (ast, context) {
  11647. return this.visitAll(ast.expressions, context);
  11648. };
  11649. RecursiveAstVisitor.prototype.visitLiteralMap = function (ast, context) { return this.visitAll(ast.values, context); };
  11650. RecursiveAstVisitor.prototype.visitLiteralPrimitive = function (ast, context) { return null; };
  11651. RecursiveAstVisitor.prototype.visitMethodCall = function (ast, context) {
  11652. ast.receiver.visit(this);
  11653. return this.visitAll(ast.args, context);
  11654. };
  11655. RecursiveAstVisitor.prototype.visitPrefixNot = function (ast, context) {
  11656. ast.expression.visit(this);
  11657. return null;
  11658. };
  11659. RecursiveAstVisitor.prototype.visitNonNullAssert = function (ast, context) {
  11660. ast.expression.visit(this);
  11661. return null;
  11662. };
  11663. RecursiveAstVisitor.prototype.visitPropertyRead = function (ast, context) {
  11664. ast.receiver.visit(this);
  11665. return null;
  11666. };
  11667. RecursiveAstVisitor.prototype.visitPropertyWrite = function (ast, context) {
  11668. ast.receiver.visit(this);
  11669. ast.value.visit(this);
  11670. return null;
  11671. };
  11672. RecursiveAstVisitor.prototype.visitSafePropertyRead = function (ast, context) {
  11673. ast.receiver.visit(this);
  11674. return null;
  11675. };
  11676. RecursiveAstVisitor.prototype.visitSafeMethodCall = function (ast, context) {
  11677. ast.receiver.visit(this);
  11678. return this.visitAll(ast.args, context);
  11679. };
  11680. RecursiveAstVisitor.prototype.visitAll = function (asts, context) {
  11681. var _this = this;
  11682. asts.forEach(function (ast) { return ast.visit(_this, context); });
  11683. return null;
  11684. };
  11685. RecursiveAstVisitor.prototype.visitQuote = function (ast, context) { return null; };
  11686. return RecursiveAstVisitor;
  11687. }());
  11688. var AstTransformer = /** @class */ (function () {
  11689. function AstTransformer() {
  11690. }
  11691. AstTransformer.prototype.visitImplicitReceiver = function (ast, context) { return ast; };
  11692. AstTransformer.prototype.visitInterpolation = function (ast, context) {
  11693. return new Interpolation(ast.span, ast.strings, this.visitAll(ast.expressions));
  11694. };
  11695. AstTransformer.prototype.visitLiteralPrimitive = function (ast, context) {
  11696. return new LiteralPrimitive(ast.span, ast.value);
  11697. };
  11698. AstTransformer.prototype.visitPropertyRead = function (ast, context) {
  11699. return new PropertyRead(ast.span, ast.receiver.visit(this), ast.name);
  11700. };
  11701. AstTransformer.prototype.visitPropertyWrite = function (ast, context) {
  11702. return new PropertyWrite(ast.span, ast.receiver.visit(this), ast.name, ast.value.visit(this));
  11703. };
  11704. AstTransformer.prototype.visitSafePropertyRead = function (ast, context) {
  11705. return new SafePropertyRead(ast.span, ast.receiver.visit(this), ast.name);
  11706. };
  11707. AstTransformer.prototype.visitMethodCall = function (ast, context) {
  11708. return new MethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
  11709. };
  11710. AstTransformer.prototype.visitSafeMethodCall = function (ast, context) {
  11711. return new SafeMethodCall(ast.span, ast.receiver.visit(this), ast.name, this.visitAll(ast.args));
  11712. };
  11713. AstTransformer.prototype.visitFunctionCall = function (ast, context) {
  11714. return new FunctionCall(ast.span, ast.target.visit(this), this.visitAll(ast.args));
  11715. };
  11716. AstTransformer.prototype.visitLiteralArray = function (ast, context) {
  11717. return new LiteralArray(ast.span, this.visitAll(ast.expressions));
  11718. };
  11719. AstTransformer.prototype.visitLiteralMap = function (ast, context) {
  11720. return new LiteralMap(ast.span, ast.keys, this.visitAll(ast.values));
  11721. };
  11722. AstTransformer.prototype.visitBinary = function (ast, context) {
  11723. return new Binary(ast.span, ast.operation, ast.left.visit(this), ast.right.visit(this));
  11724. };
  11725. AstTransformer.prototype.visitPrefixNot = function (ast, context) {
  11726. return new PrefixNot(ast.span, ast.expression.visit(this));
  11727. };
  11728. AstTransformer.prototype.visitNonNullAssert = function (ast, context) {
  11729. return new NonNullAssert(ast.span, ast.expression.visit(this));
  11730. };
  11731. AstTransformer.prototype.visitConditional = function (ast, context) {
  11732. return new Conditional(ast.span, ast.condition.visit(this), ast.trueExp.visit(this), ast.falseExp.visit(this));
  11733. };
  11734. AstTransformer.prototype.visitPipe = function (ast, context) {
  11735. return new BindingPipe(ast.span, ast.exp.visit(this), ast.name, this.visitAll(ast.args));
  11736. };
  11737. AstTransformer.prototype.visitKeyedRead = function (ast, context) {
  11738. return new KeyedRead(ast.span, ast.obj.visit(this), ast.key.visit(this));
  11739. };
  11740. AstTransformer.prototype.visitKeyedWrite = function (ast, context) {
  11741. return new KeyedWrite(ast.span, ast.obj.visit(this), ast.key.visit(this), ast.value.visit(this));
  11742. };
  11743. AstTransformer.prototype.visitAll = function (asts) {
  11744. var res = new Array(asts.length);
  11745. for (var i = 0; i < asts.length; ++i) {
  11746. res[i] = asts[i].visit(this);
  11747. }
  11748. return res;
  11749. };
  11750. AstTransformer.prototype.visitChain = function (ast, context) {
  11751. return new Chain(ast.span, this.visitAll(ast.expressions));
  11752. };
  11753. AstTransformer.prototype.visitQuote = function (ast, context) {
  11754. return new Quote(ast.span, ast.prefix, ast.uninterpretedExpression, ast.location);
  11755. };
  11756. return AstTransformer;
  11757. }());
  11758. // A transformer that only creates new nodes if the transformer makes a change or
  11759. // a change is made a child node.
  11760. var AstMemoryEfficientTransformer = /** @class */ (function () {
  11761. function AstMemoryEfficientTransformer() {
  11762. }
  11763. AstMemoryEfficientTransformer.prototype.visitImplicitReceiver = function (ast, context) { return ast; };
  11764. AstMemoryEfficientTransformer.prototype.visitInterpolation = function (ast, context) {
  11765. var expressions = this.visitAll(ast.expressions);
  11766. if (expressions !== ast.expressions)
  11767. return new Interpolation(ast.span, ast.strings, expressions);
  11768. return ast;
  11769. };
  11770. AstMemoryEfficientTransformer.prototype.visitLiteralPrimitive = function (ast, context) { return ast; };
  11771. AstMemoryEfficientTransformer.prototype.visitPropertyRead = function (ast, context) {
  11772. var receiver = ast.receiver.visit(this);
  11773. if (receiver !== ast.receiver) {
  11774. return new PropertyRead(ast.span, receiver, ast.name);
  11775. }
  11776. return ast;
  11777. };
  11778. AstMemoryEfficientTransformer.prototype.visitPropertyWrite = function (ast, context) {
  11779. var receiver = ast.receiver.visit(this);
  11780. var value = ast.value.visit(this);
  11781. if (receiver !== ast.receiver || value !== ast.value) {
  11782. return new PropertyWrite(ast.span, receiver, ast.name, value);
  11783. }
  11784. return ast;
  11785. };
  11786. AstMemoryEfficientTransformer.prototype.visitSafePropertyRead = function (ast, context) {
  11787. var receiver = ast.receiver.visit(this);
  11788. if (receiver !== ast.receiver) {
  11789. return new SafePropertyRead(ast.span, receiver, ast.name);
  11790. }
  11791. return ast;
  11792. };
  11793. AstMemoryEfficientTransformer.prototype.visitMethodCall = function (ast, context) {
  11794. var receiver = ast.receiver.visit(this);
  11795. if (receiver !== ast.receiver) {
  11796. return new MethodCall(ast.span, receiver, ast.name, this.visitAll(ast.args));
  11797. }
  11798. return ast;
  11799. };
  11800. AstMemoryEfficientTransformer.prototype.visitSafeMethodCall = function (ast, context) {
  11801. var receiver = ast.receiver.visit(this);
  11802. var args = this.visitAll(ast.args);
  11803. if (receiver !== ast.receiver || args !== ast.args) {
  11804. return new SafeMethodCall(ast.span, receiver, ast.name, args);
  11805. }
  11806. return ast;
  11807. };
  11808. AstMemoryEfficientTransformer.prototype.visitFunctionCall = function (ast, context) {
  11809. var target = ast.target && ast.target.visit(this);
  11810. var args = this.visitAll(ast.args);
  11811. if (target !== ast.target || args !== ast.args) {
  11812. return new FunctionCall(ast.span, target, args);
  11813. }
  11814. return ast;
  11815. };
  11816. AstMemoryEfficientTransformer.prototype.visitLiteralArray = function (ast, context) {
  11817. var expressions = this.visitAll(ast.expressions);
  11818. if (expressions !== ast.expressions) {
  11819. return new LiteralArray(ast.span, expressions);
  11820. }
  11821. return ast;
  11822. };
  11823. AstMemoryEfficientTransformer.prototype.visitLiteralMap = function (ast, context) {
  11824. var values = this.visitAll(ast.values);
  11825. if (values !== ast.values) {
  11826. return new LiteralMap(ast.span, ast.keys, values);
  11827. }
  11828. return ast;
  11829. };
  11830. AstMemoryEfficientTransformer.prototype.visitBinary = function (ast, context) {
  11831. var left = ast.left.visit(this);
  11832. var right = ast.right.visit(this);
  11833. if (left !== ast.left || right !== ast.right) {
  11834. return new Binary(ast.span, ast.operation, left, right);
  11835. }
  11836. return ast;
  11837. };
  11838. AstMemoryEfficientTransformer.prototype.visitPrefixNot = function (ast, context) {
  11839. var expression = ast.expression.visit(this);
  11840. if (expression !== ast.expression) {
  11841. return new PrefixNot(ast.span, expression);
  11842. }
  11843. return ast;
  11844. };
  11845. AstMemoryEfficientTransformer.prototype.visitNonNullAssert = function (ast, context) {
  11846. var expression = ast.expression.visit(this);
  11847. if (expression !== ast.expression) {
  11848. return new NonNullAssert(ast.span, expression);
  11849. }
  11850. return ast;
  11851. };
  11852. AstMemoryEfficientTransformer.prototype.visitConditional = function (ast, context) {
  11853. var condition = ast.condition.visit(this);
  11854. var trueExp = ast.trueExp.visit(this);
  11855. var falseExp = ast.falseExp.visit(this);
  11856. if (condition !== ast.condition || trueExp !== ast.trueExp || falseExp !== falseExp) {
  11857. return new Conditional(ast.span, condition, trueExp, falseExp);
  11858. }
  11859. return ast;
  11860. };
  11861. AstMemoryEfficientTransformer.prototype.visitPipe = function (ast, context) {
  11862. var exp = ast.exp.visit(this);
  11863. var args = this.visitAll(ast.args);
  11864. if (exp !== ast.exp || args !== ast.args) {
  11865. return new BindingPipe(ast.span, exp, ast.name, args);
  11866. }
  11867. return ast;
  11868. };
  11869. AstMemoryEfficientTransformer.prototype.visitKeyedRead = function (ast, context) {
  11870. var obj = ast.obj.visit(this);
  11871. var key = ast.key.visit(this);
  11872. if (obj !== ast.obj || key !== ast.key) {
  11873. return new KeyedRead(ast.span, obj, key);
  11874. }
  11875. return ast;
  11876. };
  11877. AstMemoryEfficientTransformer.prototype.visitKeyedWrite = function (ast, context) {
  11878. var obj = ast.obj.visit(this);
  11879. var key = ast.key.visit(this);
  11880. var value = ast.value.visit(this);
  11881. if (obj !== ast.obj || key !== ast.key || value !== ast.value) {
  11882. return new KeyedWrite(ast.span, obj, key, value);
  11883. }
  11884. return ast;
  11885. };
  11886. AstMemoryEfficientTransformer.prototype.visitAll = function (asts) {
  11887. var res = new Array(asts.length);
  11888. var modified = false;
  11889. for (var i = 0; i < asts.length; ++i) {
  11890. var original = asts[i];
  11891. var value = original.visit(this);
  11892. res[i] = value;
  11893. modified = modified || value !== original;
  11894. }
  11895. return modified ? res : asts;
  11896. };
  11897. AstMemoryEfficientTransformer.prototype.visitChain = function (ast, context) {
  11898. var expressions = this.visitAll(ast.expressions);
  11899. if (expressions !== ast.expressions) {
  11900. return new Chain(ast.span, expressions);
  11901. }
  11902. return ast;
  11903. };
  11904. AstMemoryEfficientTransformer.prototype.visitQuote = function (ast, context) { return ast; };
  11905. return AstMemoryEfficientTransformer;
  11906. }());
  11907. function visitAstChildren(ast, visitor, context) {
  11908. function visit(ast) {
  11909. visitor.visit && visitor.visit(ast, context) || ast.visit(visitor, context);
  11910. }
  11911. function visitAll(asts) { asts.forEach(visit); }
  11912. ast.visit({
  11913. visitBinary: function (ast) {
  11914. visit(ast.left);
  11915. visit(ast.right);
  11916. },
  11917. visitChain: function (ast) { visitAll(ast.expressions); },
  11918. visitConditional: function (ast) {
  11919. visit(ast.condition);
  11920. visit(ast.trueExp);
  11921. visit(ast.falseExp);
  11922. },
  11923. visitFunctionCall: function (ast) {
  11924. if (ast.target) {
  11925. visit(ast.target);
  11926. }
  11927. visitAll(ast.args);
  11928. },
  11929. visitImplicitReceiver: function (ast) { },
  11930. visitInterpolation: function (ast) { visitAll(ast.expressions); },
  11931. visitKeyedRead: function (ast) {
  11932. visit(ast.obj);
  11933. visit(ast.key);
  11934. },
  11935. visitKeyedWrite: function (ast) {
  11936. visit(ast.obj);
  11937. visit(ast.key);
  11938. visit(ast.obj);
  11939. },
  11940. visitLiteralArray: function (ast) { visitAll(ast.expressions); },
  11941. visitLiteralMap: function (ast) { },
  11942. visitLiteralPrimitive: function (ast) { },
  11943. visitMethodCall: function (ast) {
  11944. visit(ast.receiver);
  11945. visitAll(ast.args);
  11946. },
  11947. visitPipe: function (ast) {
  11948. visit(ast.exp);
  11949. visitAll(ast.args);
  11950. },
  11951. visitPrefixNot: function (ast) { visit(ast.expression); },
  11952. visitNonNullAssert: function (ast) { visit(ast.expression); },
  11953. visitPropertyRead: function (ast) { visit(ast.receiver); },
  11954. visitPropertyWrite: function (ast) {
  11955. visit(ast.receiver);
  11956. visit(ast.value);
  11957. },
  11958. visitQuote: function (ast) { },
  11959. visitSafeMethodCall: function (ast) {
  11960. visit(ast.receiver);
  11961. visitAll(ast.args);
  11962. },
  11963. visitSafePropertyRead: function (ast) { visit(ast.receiver); },
  11964. });
  11965. }
  11966. // Bindings
  11967. var ParsedProperty = /** @class */ (function () {
  11968. function ParsedProperty(name, expression, type, sourceSpan) {
  11969. this.name = name;
  11970. this.expression = expression;
  11971. this.type = type;
  11972. this.sourceSpan = sourceSpan;
  11973. this.isLiteral = this.type === ParsedPropertyType.LITERAL_ATTR;
  11974. this.isAnimation = this.type === ParsedPropertyType.ANIMATION;
  11975. }
  11976. return ParsedProperty;
  11977. }());
  11978. var ParsedPropertyType;
  11979. (function (ParsedPropertyType) {
  11980. ParsedPropertyType[ParsedPropertyType["DEFAULT"] = 0] = "DEFAULT";
  11981. ParsedPropertyType[ParsedPropertyType["LITERAL_ATTR"] = 1] = "LITERAL_ATTR";
  11982. ParsedPropertyType[ParsedPropertyType["ANIMATION"] = 2] = "ANIMATION";
  11983. })(ParsedPropertyType || (ParsedPropertyType = {}));
  11984. var ParsedEvent = /** @class */ (function () {
  11985. // Regular events have a target
  11986. // Animation events have a phase
  11987. function ParsedEvent(name, targetOrPhase, type, handler, sourceSpan) {
  11988. this.name = name;
  11989. this.targetOrPhase = targetOrPhase;
  11990. this.type = type;
  11991. this.handler = handler;
  11992. this.sourceSpan = sourceSpan;
  11993. }
  11994. return ParsedEvent;
  11995. }());
  11996. var ParsedVariable = /** @class */ (function () {
  11997. function ParsedVariable(name, value, sourceSpan) {
  11998. this.name = name;
  11999. this.value = value;
  12000. this.sourceSpan = sourceSpan;
  12001. }
  12002. return ParsedVariable;
  12003. }());
  12004. var BoundElementProperty = /** @class */ (function () {
  12005. function BoundElementProperty(name, type, securityContext, value, unit, sourceSpan) {
  12006. this.name = name;
  12007. this.type = type;
  12008. this.securityContext = securityContext;
  12009. this.value = value;
  12010. this.unit = unit;
  12011. this.sourceSpan = sourceSpan;
  12012. }
  12013. return BoundElementProperty;
  12014. }());
  12015. /**
  12016. * @license
  12017. * Copyright Google Inc. All Rights Reserved.
  12018. *
  12019. * Use of this source code is governed by an MIT-style license that can be
  12020. * found in the LICENSE file at https://angular.io/license
  12021. */
  12022. var SplitInterpolation = /** @class */ (function () {
  12023. function SplitInterpolation(strings, expressions, offsets) {
  12024. this.strings = strings;
  12025. this.expressions = expressions;
  12026. this.offsets = offsets;
  12027. }
  12028. return SplitInterpolation;
  12029. }());
  12030. var TemplateBindingParseResult = /** @class */ (function () {
  12031. function TemplateBindingParseResult(templateBindings, warnings, errors) {
  12032. this.templateBindings = templateBindings;
  12033. this.warnings = warnings;
  12034. this.errors = errors;
  12035. }
  12036. return TemplateBindingParseResult;
  12037. }());
  12038. function _createInterpolateRegExp(config) {
  12039. var pattern = escapeRegExp(config.start) + '([\\s\\S]*?)' + escapeRegExp(config.end);
  12040. return new RegExp(pattern, 'g');
  12041. }
  12042. var Parser = /** @class */ (function () {
  12043. function Parser(_lexer) {
  12044. this._lexer = _lexer;
  12045. this.errors = [];
  12046. }
  12047. Parser.prototype.parseAction = function (input, location, interpolationConfig) {
  12048. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12049. this._checkNoInterpolation(input, location, interpolationConfig);
  12050. var sourceToLex = this._stripComments(input);
  12051. var tokens = this._lexer.tokenize(this._stripComments(input));
  12052. var ast = new _ParseAST(input, location, tokens, sourceToLex.length, true, this.errors, input.length - sourceToLex.length)
  12053. .parseChain();
  12054. return new ASTWithSource(ast, input, location, this.errors);
  12055. };
  12056. Parser.prototype.parseBinding = function (input, location, interpolationConfig) {
  12057. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12058. var ast = this._parseBindingAst(input, location, interpolationConfig);
  12059. return new ASTWithSource(ast, input, location, this.errors);
  12060. };
  12061. Parser.prototype.parseSimpleBinding = function (input, location, interpolationConfig) {
  12062. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12063. var ast = this._parseBindingAst(input, location, interpolationConfig);
  12064. var errors = SimpleExpressionChecker.check(ast);
  12065. if (errors.length > 0) {
  12066. this._reportError("Host binding expression cannot contain " + errors.join(' '), input, location);
  12067. }
  12068. return new ASTWithSource(ast, input, location, this.errors);
  12069. };
  12070. Parser.prototype._reportError = function (message, input, errLocation, ctxLocation) {
  12071. this.errors.push(new ParserError(message, input, errLocation, ctxLocation));
  12072. };
  12073. Parser.prototype._parseBindingAst = function (input, location, interpolationConfig) {
  12074. // Quotes expressions use 3rd-party expression language. We don't want to use
  12075. // our lexer or parser for that, so we check for that ahead of time.
  12076. var quote = this._parseQuote(input, location);
  12077. if (quote != null) {
  12078. return quote;
  12079. }
  12080. this._checkNoInterpolation(input, location, interpolationConfig);
  12081. var sourceToLex = this._stripComments(input);
  12082. var tokens = this._lexer.tokenize(sourceToLex);
  12083. return new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, input.length - sourceToLex.length)
  12084. .parseChain();
  12085. };
  12086. Parser.prototype._parseQuote = function (input, location) {
  12087. if (input == null)
  12088. return null;
  12089. var prefixSeparatorIndex = input.indexOf(':');
  12090. if (prefixSeparatorIndex == -1)
  12091. return null;
  12092. var prefix = input.substring(0, prefixSeparatorIndex).trim();
  12093. if (!isIdentifier(prefix))
  12094. return null;
  12095. var uninterpretedExpression = input.substring(prefixSeparatorIndex + 1);
  12096. return new Quote(new ParseSpan(0, input.length), prefix, uninterpretedExpression, location);
  12097. };
  12098. Parser.prototype.parseTemplateBindings = function (tplKey, tplValue, location) {
  12099. var tokens = this._lexer.tokenize(tplValue);
  12100. return new _ParseAST(tplValue, location, tokens, tplValue.length, false, this.errors, 0)
  12101. .parseTemplateBindings(tplKey);
  12102. };
  12103. Parser.prototype.parseInterpolation = function (input, location, interpolationConfig) {
  12104. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12105. var split = this.splitInterpolation(input, location, interpolationConfig);
  12106. if (split == null)
  12107. return null;
  12108. var expressions = [];
  12109. for (var i = 0; i < split.expressions.length; ++i) {
  12110. var expressionText = split.expressions[i];
  12111. var sourceToLex = this._stripComments(expressionText);
  12112. var tokens = this._lexer.tokenize(sourceToLex);
  12113. var ast = new _ParseAST(input, location, tokens, sourceToLex.length, false, this.errors, split.offsets[i] + (expressionText.length - sourceToLex.length))
  12114. .parseChain();
  12115. expressions.push(ast);
  12116. }
  12117. return new ASTWithSource(new Interpolation(new ParseSpan(0, input == null ? 0 : input.length), split.strings, expressions), input, location, this.errors);
  12118. };
  12119. Parser.prototype.splitInterpolation = function (input, location, interpolationConfig) {
  12120. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12121. var regexp = _createInterpolateRegExp(interpolationConfig);
  12122. var parts = input.split(regexp);
  12123. if (parts.length <= 1) {
  12124. return null;
  12125. }
  12126. var strings = [];
  12127. var expressions = [];
  12128. var offsets = [];
  12129. var offset = 0;
  12130. for (var i = 0; i < parts.length; i++) {
  12131. var part = parts[i];
  12132. if (i % 2 === 0) {
  12133. // fixed string
  12134. strings.push(part);
  12135. offset += part.length;
  12136. }
  12137. else if (part.trim().length > 0) {
  12138. offset += interpolationConfig.start.length;
  12139. expressions.push(part);
  12140. offsets.push(offset);
  12141. offset += part.length + interpolationConfig.end.length;
  12142. }
  12143. else {
  12144. this._reportError('Blank expressions are not allowed in interpolated strings', input, "at column " + this._findInterpolationErrorColumn(parts, i, interpolationConfig) + " in", location);
  12145. expressions.push('$implict');
  12146. offsets.push(offset);
  12147. }
  12148. }
  12149. return new SplitInterpolation(strings, expressions, offsets);
  12150. };
  12151. Parser.prototype.wrapLiteralPrimitive = function (input, location) {
  12152. return new ASTWithSource(new LiteralPrimitive(new ParseSpan(0, input == null ? 0 : input.length), input), input, location, this.errors);
  12153. };
  12154. Parser.prototype._stripComments = function (input) {
  12155. var i = this._commentStart(input);
  12156. return i != null ? input.substring(0, i).trim() : input;
  12157. };
  12158. Parser.prototype._commentStart = function (input) {
  12159. var outerQuote = null;
  12160. for (var i = 0; i < input.length - 1; i++) {
  12161. var char = input.charCodeAt(i);
  12162. var nextChar = input.charCodeAt(i + 1);
  12163. if (char === $SLASH && nextChar == $SLASH && outerQuote == null)
  12164. return i;
  12165. if (outerQuote === char) {
  12166. outerQuote = null;
  12167. }
  12168. else if (outerQuote == null && isQuote(char)) {
  12169. outerQuote = char;
  12170. }
  12171. }
  12172. return null;
  12173. };
  12174. Parser.prototype._checkNoInterpolation = function (input, location, interpolationConfig) {
  12175. var regexp = _createInterpolateRegExp(interpolationConfig);
  12176. var parts = input.split(regexp);
  12177. if (parts.length > 1) {
  12178. this._reportError("Got interpolation (" + interpolationConfig.start + interpolationConfig.end + ") where expression was expected", input, "at column " + this._findInterpolationErrorColumn(parts, 1, interpolationConfig) + " in", location);
  12179. }
  12180. };
  12181. Parser.prototype._findInterpolationErrorColumn = function (parts, partInErrIdx, interpolationConfig) {
  12182. var errLocation = '';
  12183. for (var j = 0; j < partInErrIdx; j++) {
  12184. errLocation += j % 2 === 0 ?
  12185. parts[j] :
  12186. "" + interpolationConfig.start + parts[j] + interpolationConfig.end;
  12187. }
  12188. return errLocation.length;
  12189. };
  12190. return Parser;
  12191. }());
  12192. var _ParseAST = /** @class */ (function () {
  12193. function _ParseAST(input, location, tokens, inputLength, parseAction, errors, offset) {
  12194. this.input = input;
  12195. this.location = location;
  12196. this.tokens = tokens;
  12197. this.inputLength = inputLength;
  12198. this.parseAction = parseAction;
  12199. this.errors = errors;
  12200. this.offset = offset;
  12201. this.rparensExpected = 0;
  12202. this.rbracketsExpected = 0;
  12203. this.rbracesExpected = 0;
  12204. this.index = 0;
  12205. }
  12206. _ParseAST.prototype.peek = function (offset) {
  12207. var i = this.index + offset;
  12208. return i < this.tokens.length ? this.tokens[i] : EOF;
  12209. };
  12210. Object.defineProperty(_ParseAST.prototype, "next", {
  12211. get: function () { return this.peek(0); },
  12212. enumerable: true,
  12213. configurable: true
  12214. });
  12215. Object.defineProperty(_ParseAST.prototype, "inputIndex", {
  12216. get: function () {
  12217. return (this.index < this.tokens.length) ? this.next.index + this.offset :
  12218. this.inputLength + this.offset;
  12219. },
  12220. enumerable: true,
  12221. configurable: true
  12222. });
  12223. _ParseAST.prototype.span = function (start) { return new ParseSpan(start, this.inputIndex); };
  12224. _ParseAST.prototype.advance = function () { this.index++; };
  12225. _ParseAST.prototype.optionalCharacter = function (code) {
  12226. if (this.next.isCharacter(code)) {
  12227. this.advance();
  12228. return true;
  12229. }
  12230. else {
  12231. return false;
  12232. }
  12233. };
  12234. _ParseAST.prototype.peekKeywordLet = function () { return this.next.isKeywordLet(); };
  12235. _ParseAST.prototype.peekKeywordAs = function () { return this.next.isKeywordAs(); };
  12236. _ParseAST.prototype.expectCharacter = function (code) {
  12237. if (this.optionalCharacter(code))
  12238. return;
  12239. this.error("Missing expected " + String.fromCharCode(code));
  12240. };
  12241. _ParseAST.prototype.optionalOperator = function (op) {
  12242. if (this.next.isOperator(op)) {
  12243. this.advance();
  12244. return true;
  12245. }
  12246. else {
  12247. return false;
  12248. }
  12249. };
  12250. _ParseAST.prototype.expectOperator = function (operator) {
  12251. if (this.optionalOperator(operator))
  12252. return;
  12253. this.error("Missing expected operator " + operator);
  12254. };
  12255. _ParseAST.prototype.expectIdentifierOrKeyword = function () {
  12256. var n = this.next;
  12257. if (!n.isIdentifier() && !n.isKeyword()) {
  12258. this.error("Unexpected token " + n + ", expected identifier or keyword");
  12259. return '';
  12260. }
  12261. this.advance();
  12262. return n.toString();
  12263. };
  12264. _ParseAST.prototype.expectIdentifierOrKeywordOrString = function () {
  12265. var n = this.next;
  12266. if (!n.isIdentifier() && !n.isKeyword() && !n.isString()) {
  12267. this.error("Unexpected token " + n + ", expected identifier, keyword, or string");
  12268. return '';
  12269. }
  12270. this.advance();
  12271. return n.toString();
  12272. };
  12273. _ParseAST.prototype.parseChain = function () {
  12274. var exprs = [];
  12275. var start = this.inputIndex;
  12276. while (this.index < this.tokens.length) {
  12277. var expr = this.parsePipe();
  12278. exprs.push(expr);
  12279. if (this.optionalCharacter($SEMICOLON)) {
  12280. if (!this.parseAction) {
  12281. this.error('Binding expression cannot contain chained expression');
  12282. }
  12283. while (this.optionalCharacter($SEMICOLON)) {
  12284. } // read all semicolons
  12285. }
  12286. else if (this.index < this.tokens.length) {
  12287. this.error("Unexpected token '" + this.next + "'");
  12288. }
  12289. }
  12290. if (exprs.length == 0)
  12291. return new EmptyExpr(this.span(start));
  12292. if (exprs.length == 1)
  12293. return exprs[0];
  12294. return new Chain(this.span(start), exprs);
  12295. };
  12296. _ParseAST.prototype.parsePipe = function () {
  12297. var result = this.parseExpression();
  12298. if (this.optionalOperator('|')) {
  12299. if (this.parseAction) {
  12300. this.error('Cannot have a pipe in an action expression');
  12301. }
  12302. do {
  12303. var name_1 = this.expectIdentifierOrKeyword();
  12304. var args = [];
  12305. while (this.optionalCharacter($COLON)) {
  12306. args.push(this.parseExpression());
  12307. }
  12308. result = new BindingPipe(this.span(result.span.start), result, name_1, args);
  12309. } while (this.optionalOperator('|'));
  12310. }
  12311. return result;
  12312. };
  12313. _ParseAST.prototype.parseExpression = function () { return this.parseConditional(); };
  12314. _ParseAST.prototype.parseConditional = function () {
  12315. var start = this.inputIndex;
  12316. var result = this.parseLogicalOr();
  12317. if (this.optionalOperator('?')) {
  12318. var yes = this.parsePipe();
  12319. var no = void 0;
  12320. if (!this.optionalCharacter($COLON)) {
  12321. var end = this.inputIndex;
  12322. var expression = this.input.substring(start, end);
  12323. this.error("Conditional expression " + expression + " requires all 3 expressions");
  12324. no = new EmptyExpr(this.span(start));
  12325. }
  12326. else {
  12327. no = this.parsePipe();
  12328. }
  12329. return new Conditional(this.span(start), result, yes, no);
  12330. }
  12331. else {
  12332. return result;
  12333. }
  12334. };
  12335. _ParseAST.prototype.parseLogicalOr = function () {
  12336. // '||'
  12337. var result = this.parseLogicalAnd();
  12338. while (this.optionalOperator('||')) {
  12339. var right = this.parseLogicalAnd();
  12340. result = new Binary(this.span(result.span.start), '||', result, right);
  12341. }
  12342. return result;
  12343. };
  12344. _ParseAST.prototype.parseLogicalAnd = function () {
  12345. // '&&'
  12346. var result = this.parseEquality();
  12347. while (this.optionalOperator('&&')) {
  12348. var right = this.parseEquality();
  12349. result = new Binary(this.span(result.span.start), '&&', result, right);
  12350. }
  12351. return result;
  12352. };
  12353. _ParseAST.prototype.parseEquality = function () {
  12354. // '==','!=','===','!=='
  12355. var result = this.parseRelational();
  12356. while (this.next.type == TokenType.Operator) {
  12357. var operator = this.next.strValue;
  12358. switch (operator) {
  12359. case '==':
  12360. case '===':
  12361. case '!=':
  12362. case '!==':
  12363. this.advance();
  12364. var right = this.parseRelational();
  12365. result = new Binary(this.span(result.span.start), operator, result, right);
  12366. continue;
  12367. }
  12368. break;
  12369. }
  12370. return result;
  12371. };
  12372. _ParseAST.prototype.parseRelational = function () {
  12373. // '<', '>', '<=', '>='
  12374. var result = this.parseAdditive();
  12375. while (this.next.type == TokenType.Operator) {
  12376. var operator = this.next.strValue;
  12377. switch (operator) {
  12378. case '<':
  12379. case '>':
  12380. case '<=':
  12381. case '>=':
  12382. this.advance();
  12383. var right = this.parseAdditive();
  12384. result = new Binary(this.span(result.span.start), operator, result, right);
  12385. continue;
  12386. }
  12387. break;
  12388. }
  12389. return result;
  12390. };
  12391. _ParseAST.prototype.parseAdditive = function () {
  12392. // '+', '-'
  12393. var result = this.parseMultiplicative();
  12394. while (this.next.type == TokenType.Operator) {
  12395. var operator = this.next.strValue;
  12396. switch (operator) {
  12397. case '+':
  12398. case '-':
  12399. this.advance();
  12400. var right = this.parseMultiplicative();
  12401. result = new Binary(this.span(result.span.start), operator, result, right);
  12402. continue;
  12403. }
  12404. break;
  12405. }
  12406. return result;
  12407. };
  12408. _ParseAST.prototype.parseMultiplicative = function () {
  12409. // '*', '%', '/'
  12410. var result = this.parsePrefix();
  12411. while (this.next.type == TokenType.Operator) {
  12412. var operator = this.next.strValue;
  12413. switch (operator) {
  12414. case '*':
  12415. case '%':
  12416. case '/':
  12417. this.advance();
  12418. var right = this.parsePrefix();
  12419. result = new Binary(this.span(result.span.start), operator, result, right);
  12420. continue;
  12421. }
  12422. break;
  12423. }
  12424. return result;
  12425. };
  12426. _ParseAST.prototype.parsePrefix = function () {
  12427. if (this.next.type == TokenType.Operator) {
  12428. var start = this.inputIndex;
  12429. var operator = this.next.strValue;
  12430. var result = void 0;
  12431. switch (operator) {
  12432. case '+':
  12433. this.advance();
  12434. result = this.parsePrefix();
  12435. return new Binary(this.span(start), '-', result, new LiteralPrimitive(new ParseSpan(start, start), 0));
  12436. case '-':
  12437. this.advance();
  12438. result = this.parsePrefix();
  12439. return new Binary(this.span(start), operator, new LiteralPrimitive(new ParseSpan(start, start), 0), result);
  12440. case '!':
  12441. this.advance();
  12442. result = this.parsePrefix();
  12443. return new PrefixNot(this.span(start), result);
  12444. }
  12445. }
  12446. return this.parseCallChain();
  12447. };
  12448. _ParseAST.prototype.parseCallChain = function () {
  12449. var result = this.parsePrimary();
  12450. while (true) {
  12451. if (this.optionalCharacter($PERIOD)) {
  12452. result = this.parseAccessMemberOrMethodCall(result, false);
  12453. }
  12454. else if (this.optionalOperator('?.')) {
  12455. result = this.parseAccessMemberOrMethodCall(result, true);
  12456. }
  12457. else if (this.optionalCharacter($LBRACKET)) {
  12458. this.rbracketsExpected++;
  12459. var key = this.parsePipe();
  12460. this.rbracketsExpected--;
  12461. this.expectCharacter($RBRACKET);
  12462. if (this.optionalOperator('=')) {
  12463. var value = this.parseConditional();
  12464. result = new KeyedWrite(this.span(result.span.start), result, key, value);
  12465. }
  12466. else {
  12467. result = new KeyedRead(this.span(result.span.start), result, key);
  12468. }
  12469. }
  12470. else if (this.optionalCharacter($LPAREN)) {
  12471. this.rparensExpected++;
  12472. var args = this.parseCallArguments();
  12473. this.rparensExpected--;
  12474. this.expectCharacter($RPAREN);
  12475. result = new FunctionCall(this.span(result.span.start), result, args);
  12476. }
  12477. else if (this.optionalOperator('!')) {
  12478. result = new NonNullAssert(this.span(result.span.start), result);
  12479. }
  12480. else {
  12481. return result;
  12482. }
  12483. }
  12484. };
  12485. _ParseAST.prototype.parsePrimary = function () {
  12486. var start = this.inputIndex;
  12487. if (this.optionalCharacter($LPAREN)) {
  12488. this.rparensExpected++;
  12489. var result = this.parsePipe();
  12490. this.rparensExpected--;
  12491. this.expectCharacter($RPAREN);
  12492. return result;
  12493. }
  12494. else if (this.next.isKeywordNull()) {
  12495. this.advance();
  12496. return new LiteralPrimitive(this.span(start), null);
  12497. }
  12498. else if (this.next.isKeywordUndefined()) {
  12499. this.advance();
  12500. return new LiteralPrimitive(this.span(start), void 0);
  12501. }
  12502. else if (this.next.isKeywordTrue()) {
  12503. this.advance();
  12504. return new LiteralPrimitive(this.span(start), true);
  12505. }
  12506. else if (this.next.isKeywordFalse()) {
  12507. this.advance();
  12508. return new LiteralPrimitive(this.span(start), false);
  12509. }
  12510. else if (this.next.isKeywordThis()) {
  12511. this.advance();
  12512. return new ImplicitReceiver(this.span(start));
  12513. }
  12514. else if (this.optionalCharacter($LBRACKET)) {
  12515. this.rbracketsExpected++;
  12516. var elements = this.parseExpressionList($RBRACKET);
  12517. this.rbracketsExpected--;
  12518. this.expectCharacter($RBRACKET);
  12519. return new LiteralArray(this.span(start), elements);
  12520. }
  12521. else if (this.next.isCharacter($LBRACE)) {
  12522. return this.parseLiteralMap();
  12523. }
  12524. else if (this.next.isIdentifier()) {
  12525. return this.parseAccessMemberOrMethodCall(new ImplicitReceiver(this.span(start)), false);
  12526. }
  12527. else if (this.next.isNumber()) {
  12528. var value = this.next.toNumber();
  12529. this.advance();
  12530. return new LiteralPrimitive(this.span(start), value);
  12531. }
  12532. else if (this.next.isString()) {
  12533. var literalValue = this.next.toString();
  12534. this.advance();
  12535. return new LiteralPrimitive(this.span(start), literalValue);
  12536. }
  12537. else if (this.index >= this.tokens.length) {
  12538. this.error("Unexpected end of expression: " + this.input);
  12539. return new EmptyExpr(this.span(start));
  12540. }
  12541. else {
  12542. this.error("Unexpected token " + this.next);
  12543. return new EmptyExpr(this.span(start));
  12544. }
  12545. };
  12546. _ParseAST.prototype.parseExpressionList = function (terminator) {
  12547. var result = [];
  12548. if (!this.next.isCharacter(terminator)) {
  12549. do {
  12550. result.push(this.parsePipe());
  12551. } while (this.optionalCharacter($COMMA));
  12552. }
  12553. return result;
  12554. };
  12555. _ParseAST.prototype.parseLiteralMap = function () {
  12556. var keys = [];
  12557. var values = [];
  12558. var start = this.inputIndex;
  12559. this.expectCharacter($LBRACE);
  12560. if (!this.optionalCharacter($RBRACE)) {
  12561. this.rbracesExpected++;
  12562. do {
  12563. var quoted = this.next.isString();
  12564. var key = this.expectIdentifierOrKeywordOrString();
  12565. keys.push({ key: key, quoted: quoted });
  12566. this.expectCharacter($COLON);
  12567. values.push(this.parsePipe());
  12568. } while (this.optionalCharacter($COMMA));
  12569. this.rbracesExpected--;
  12570. this.expectCharacter($RBRACE);
  12571. }
  12572. return new LiteralMap(this.span(start), keys, values);
  12573. };
  12574. _ParseAST.prototype.parseAccessMemberOrMethodCall = function (receiver, isSafe) {
  12575. if (isSafe === void 0) { isSafe = false; }
  12576. var start = receiver.span.start;
  12577. var id = this.expectIdentifierOrKeyword();
  12578. if (this.optionalCharacter($LPAREN)) {
  12579. this.rparensExpected++;
  12580. var args = this.parseCallArguments();
  12581. this.expectCharacter($RPAREN);
  12582. this.rparensExpected--;
  12583. var span = this.span(start);
  12584. return isSafe ? new SafeMethodCall(span, receiver, id, args) :
  12585. new MethodCall(span, receiver, id, args);
  12586. }
  12587. else {
  12588. if (isSafe) {
  12589. if (this.optionalOperator('=')) {
  12590. this.error('The \'?.\' operator cannot be used in the assignment');
  12591. return new EmptyExpr(this.span(start));
  12592. }
  12593. else {
  12594. return new SafePropertyRead(this.span(start), receiver, id);
  12595. }
  12596. }
  12597. else {
  12598. if (this.optionalOperator('=')) {
  12599. if (!this.parseAction) {
  12600. this.error('Bindings cannot contain assignments');
  12601. return new EmptyExpr(this.span(start));
  12602. }
  12603. var value = this.parseConditional();
  12604. return new PropertyWrite(this.span(start), receiver, id, value);
  12605. }
  12606. else {
  12607. return new PropertyRead(this.span(start), receiver, id);
  12608. }
  12609. }
  12610. }
  12611. };
  12612. _ParseAST.prototype.parseCallArguments = function () {
  12613. if (this.next.isCharacter($RPAREN))
  12614. return [];
  12615. var positionals = [];
  12616. do {
  12617. positionals.push(this.parsePipe());
  12618. } while (this.optionalCharacter($COMMA));
  12619. return positionals;
  12620. };
  12621. /**
  12622. * An identifier, a keyword, a string with an optional `-` in between.
  12623. */
  12624. _ParseAST.prototype.expectTemplateBindingKey = function () {
  12625. var result = '';
  12626. var operatorFound = false;
  12627. do {
  12628. result += this.expectIdentifierOrKeywordOrString();
  12629. operatorFound = this.optionalOperator('-');
  12630. if (operatorFound) {
  12631. result += '-';
  12632. }
  12633. } while (operatorFound);
  12634. return result.toString();
  12635. };
  12636. // Parses the AST for `<some-tag *tplKey=AST>`
  12637. _ParseAST.prototype.parseTemplateBindings = function (tplKey) {
  12638. var firstBinding = true;
  12639. var bindings = [];
  12640. var warnings = [];
  12641. do {
  12642. var start = this.inputIndex;
  12643. var rawKey = void 0;
  12644. var key = void 0;
  12645. var isVar = false;
  12646. if (firstBinding) {
  12647. rawKey = key = tplKey;
  12648. firstBinding = false;
  12649. }
  12650. else {
  12651. isVar = this.peekKeywordLet();
  12652. if (isVar)
  12653. this.advance();
  12654. rawKey = this.expectTemplateBindingKey();
  12655. key = isVar ? rawKey : tplKey + rawKey[0].toUpperCase() + rawKey.substring(1);
  12656. this.optionalCharacter($COLON);
  12657. }
  12658. var name_2 = null;
  12659. var expression = null;
  12660. if (isVar) {
  12661. if (this.optionalOperator('=')) {
  12662. name_2 = this.expectTemplateBindingKey();
  12663. }
  12664. else {
  12665. name_2 = '\$implicit';
  12666. }
  12667. }
  12668. else if (this.peekKeywordAs()) {
  12669. this.advance(); // consume `as`
  12670. name_2 = rawKey;
  12671. key = this.expectTemplateBindingKey(); // read local var name
  12672. isVar = true;
  12673. }
  12674. else if (this.next !== EOF && !this.peekKeywordLet()) {
  12675. var start_1 = this.inputIndex;
  12676. var ast = this.parsePipe();
  12677. var source = this.input.substring(start_1 - this.offset, this.inputIndex - this.offset);
  12678. expression = new ASTWithSource(ast, source, this.location, this.errors);
  12679. }
  12680. bindings.push(new TemplateBinding(this.span(start), key, isVar, name_2, expression));
  12681. if (this.peekKeywordAs() && !isVar) {
  12682. var letStart = this.inputIndex;
  12683. this.advance(); // consume `as`
  12684. var letName = this.expectTemplateBindingKey(); // read local var name
  12685. bindings.push(new TemplateBinding(this.span(letStart), letName, true, key, null));
  12686. }
  12687. if (!this.optionalCharacter($SEMICOLON)) {
  12688. this.optionalCharacter($COMMA);
  12689. }
  12690. } while (this.index < this.tokens.length);
  12691. return new TemplateBindingParseResult(bindings, warnings, this.errors);
  12692. };
  12693. _ParseAST.prototype.error = function (message, index) {
  12694. if (index === void 0) { index = null; }
  12695. this.errors.push(new ParserError(message, this.input, this.locationText(index), this.location));
  12696. this.skip();
  12697. };
  12698. _ParseAST.prototype.locationText = function (index) {
  12699. if (index === void 0) { index = null; }
  12700. if (index == null)
  12701. index = this.index;
  12702. return (index < this.tokens.length) ? "at column " + (this.tokens[index].index + 1) + " in" :
  12703. "at the end of the expression";
  12704. };
  12705. // Error recovery should skip tokens until it encounters a recovery point. skip() treats
  12706. // the end of input and a ';' as unconditionally a recovery point. It also treats ')',
  12707. // '}' and ']' as conditional recovery points if one of calling productions is expecting
  12708. // one of these symbols. This allows skip() to recover from errors such as '(a.) + 1' allowing
  12709. // more of the AST to be retained (it doesn't skip any tokens as the ')' is retained because
  12710. // of the '(' begins an '(' <expr> ')' production). The recovery points of grouping symbols
  12711. // must be conditional as they must be skipped if none of the calling productions are not
  12712. // expecting the closing token else we will never make progress in the case of an
  12713. // extraneous group closing symbol (such as a stray ')'). This is not the case for ';' because
  12714. // parseChain() is always the root production and it expects a ';'.
  12715. // If a production expects one of these token it increments the corresponding nesting count,
  12716. // and then decrements it just prior to checking if the token is in the input.
  12717. _ParseAST.prototype.skip = function () {
  12718. var n = this.next;
  12719. while (this.index < this.tokens.length && !n.isCharacter($SEMICOLON) &&
  12720. (this.rparensExpected <= 0 || !n.isCharacter($RPAREN)) &&
  12721. (this.rbracesExpected <= 0 || !n.isCharacter($RBRACE)) &&
  12722. (this.rbracketsExpected <= 0 || !n.isCharacter($RBRACKET))) {
  12723. if (this.next.isError()) {
  12724. this.errors.push(new ParserError(this.next.toString(), this.input, this.locationText(), this.location));
  12725. }
  12726. this.advance();
  12727. n = this.next;
  12728. }
  12729. };
  12730. return _ParseAST;
  12731. }());
  12732. var SimpleExpressionChecker = /** @class */ (function () {
  12733. function SimpleExpressionChecker() {
  12734. this.errors = [];
  12735. }
  12736. SimpleExpressionChecker.check = function (ast) {
  12737. var s = new SimpleExpressionChecker();
  12738. ast.visit(s);
  12739. return s.errors;
  12740. };
  12741. SimpleExpressionChecker.prototype.visitImplicitReceiver = function (ast, context) { };
  12742. SimpleExpressionChecker.prototype.visitInterpolation = function (ast, context) { };
  12743. SimpleExpressionChecker.prototype.visitLiteralPrimitive = function (ast, context) { };
  12744. SimpleExpressionChecker.prototype.visitPropertyRead = function (ast, context) { };
  12745. SimpleExpressionChecker.prototype.visitPropertyWrite = function (ast, context) { };
  12746. SimpleExpressionChecker.prototype.visitSafePropertyRead = function (ast, context) { };
  12747. SimpleExpressionChecker.prototype.visitMethodCall = function (ast, context) { };
  12748. SimpleExpressionChecker.prototype.visitSafeMethodCall = function (ast, context) { };
  12749. SimpleExpressionChecker.prototype.visitFunctionCall = function (ast, context) { };
  12750. SimpleExpressionChecker.prototype.visitLiteralArray = function (ast, context) { this.visitAll(ast.expressions); };
  12751. SimpleExpressionChecker.prototype.visitLiteralMap = function (ast, context) { this.visitAll(ast.values); };
  12752. SimpleExpressionChecker.prototype.visitBinary = function (ast, context) { };
  12753. SimpleExpressionChecker.prototype.visitPrefixNot = function (ast, context) { };
  12754. SimpleExpressionChecker.prototype.visitNonNullAssert = function (ast, context) { };
  12755. SimpleExpressionChecker.prototype.visitConditional = function (ast, context) { };
  12756. SimpleExpressionChecker.prototype.visitPipe = function (ast, context) { this.errors.push('pipes'); };
  12757. SimpleExpressionChecker.prototype.visitKeyedRead = function (ast, context) { };
  12758. SimpleExpressionChecker.prototype.visitKeyedWrite = function (ast, context) { };
  12759. SimpleExpressionChecker.prototype.visitAll = function (asts) {
  12760. var _this = this;
  12761. return asts.map(function (node) { return node.visit(_this); });
  12762. };
  12763. SimpleExpressionChecker.prototype.visitChain = function (ast, context) { };
  12764. SimpleExpressionChecker.prototype.visitQuote = function (ast, context) { };
  12765. return SimpleExpressionChecker;
  12766. }());
  12767. /**
  12768. * @license
  12769. * Copyright Google Inc. All Rights Reserved.
  12770. *
  12771. * Use of this source code is governed by an MIT-style license that can be
  12772. * found in the LICENSE file at https://angular.io/license
  12773. */
  12774. var ParseLocation = /** @class */ (function () {
  12775. function ParseLocation(file, offset, line, col) {
  12776. this.file = file;
  12777. this.offset = offset;
  12778. this.line = line;
  12779. this.col = col;
  12780. }
  12781. ParseLocation.prototype.toString = function () {
  12782. return this.offset != null ? this.file.url + "@" + this.line + ":" + this.col : this.file.url;
  12783. };
  12784. ParseLocation.prototype.moveBy = function (delta) {
  12785. var source = this.file.content;
  12786. var len = source.length;
  12787. var offset = this.offset;
  12788. var line = this.line;
  12789. var col = this.col;
  12790. while (offset > 0 && delta < 0) {
  12791. offset--;
  12792. delta++;
  12793. var ch = source.charCodeAt(offset);
  12794. if (ch == $LF) {
  12795. line--;
  12796. var priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
  12797. col = priorLine > 0 ? offset - priorLine : offset;
  12798. }
  12799. else {
  12800. col--;
  12801. }
  12802. }
  12803. while (offset < len && delta > 0) {
  12804. var ch = source.charCodeAt(offset);
  12805. offset++;
  12806. delta--;
  12807. if (ch == $LF) {
  12808. line++;
  12809. col = 0;
  12810. }
  12811. else {
  12812. col++;
  12813. }
  12814. }
  12815. return new ParseLocation(this.file, offset, line, col);
  12816. };
  12817. // Return the source around the location
  12818. // Up to `maxChars` or `maxLines` on each side of the location
  12819. ParseLocation.prototype.getContext = function (maxChars, maxLines) {
  12820. var content = this.file.content;
  12821. var startOffset = this.offset;
  12822. if (startOffset != null) {
  12823. if (startOffset > content.length - 1) {
  12824. startOffset = content.length - 1;
  12825. }
  12826. var endOffset = startOffset;
  12827. var ctxChars = 0;
  12828. var ctxLines = 0;
  12829. while (ctxChars < maxChars && startOffset > 0) {
  12830. startOffset--;
  12831. ctxChars++;
  12832. if (content[startOffset] == '\n') {
  12833. if (++ctxLines == maxLines) {
  12834. break;
  12835. }
  12836. }
  12837. }
  12838. ctxChars = 0;
  12839. ctxLines = 0;
  12840. while (ctxChars < maxChars && endOffset < content.length - 1) {
  12841. endOffset++;
  12842. ctxChars++;
  12843. if (content[endOffset] == '\n') {
  12844. if (++ctxLines == maxLines) {
  12845. break;
  12846. }
  12847. }
  12848. }
  12849. return {
  12850. before: content.substring(startOffset, this.offset),
  12851. after: content.substring(this.offset, endOffset + 1),
  12852. };
  12853. }
  12854. return null;
  12855. };
  12856. return ParseLocation;
  12857. }());
  12858. var ParseSourceFile = /** @class */ (function () {
  12859. function ParseSourceFile(content, url) {
  12860. this.content = content;
  12861. this.url = url;
  12862. }
  12863. return ParseSourceFile;
  12864. }());
  12865. var ParseSourceSpan = /** @class */ (function () {
  12866. function ParseSourceSpan(start, end, details) {
  12867. if (details === void 0) { details = null; }
  12868. this.start = start;
  12869. this.end = end;
  12870. this.details = details;
  12871. }
  12872. ParseSourceSpan.prototype.toString = function () {
  12873. return this.start.file.content.substring(this.start.offset, this.end.offset);
  12874. };
  12875. return ParseSourceSpan;
  12876. }());
  12877. var ParseErrorLevel;
  12878. (function (ParseErrorLevel) {
  12879. ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
  12880. ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
  12881. })(ParseErrorLevel || (ParseErrorLevel = {}));
  12882. var ParseError = /** @class */ (function () {
  12883. function ParseError(span, msg, level) {
  12884. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  12885. this.span = span;
  12886. this.msg = msg;
  12887. this.level = level;
  12888. }
  12889. ParseError.prototype.contextualMessage = function () {
  12890. var ctx = this.span.start.getContext(100, 3);
  12891. return ctx ? this.msg + " (\"" + ctx.before + "[" + ParseErrorLevel[this.level] + " ->]" + ctx.after + "\")" :
  12892. this.msg;
  12893. };
  12894. ParseError.prototype.toString = function () {
  12895. var details = this.span.details ? ", " + this.span.details : '';
  12896. return this.contextualMessage() + ": " + this.span.start + details;
  12897. };
  12898. return ParseError;
  12899. }());
  12900. function typeSourceSpan(kind, type) {
  12901. var moduleUrl = identifierModuleUrl(type);
  12902. var sourceFileName = moduleUrl != null ? "in " + kind + " " + identifierName(type) + " in " + moduleUrl :
  12903. "in " + kind + " " + identifierName(type);
  12904. var sourceFile = new ParseSourceFile('', sourceFileName);
  12905. return new ParseSourceSpan(new ParseLocation(sourceFile, -1, -1, -1), new ParseLocation(sourceFile, -1, -1, -1));
  12906. }
  12907. /**
  12908. * @license
  12909. * Copyright Google Inc. All Rights Reserved.
  12910. *
  12911. * Use of this source code is governed by an MIT-style license that can be
  12912. * found in the LICENSE file at https://angular.io/license
  12913. */
  12914. var TokenType$1;
  12915. (function (TokenType) {
  12916. TokenType[TokenType["TAG_OPEN_START"] = 0] = "TAG_OPEN_START";
  12917. TokenType[TokenType["TAG_OPEN_END"] = 1] = "TAG_OPEN_END";
  12918. TokenType[TokenType["TAG_OPEN_END_VOID"] = 2] = "TAG_OPEN_END_VOID";
  12919. TokenType[TokenType["TAG_CLOSE"] = 3] = "TAG_CLOSE";
  12920. TokenType[TokenType["TEXT"] = 4] = "TEXT";
  12921. TokenType[TokenType["ESCAPABLE_RAW_TEXT"] = 5] = "ESCAPABLE_RAW_TEXT";
  12922. TokenType[TokenType["RAW_TEXT"] = 6] = "RAW_TEXT";
  12923. TokenType[TokenType["COMMENT_START"] = 7] = "COMMENT_START";
  12924. TokenType[TokenType["COMMENT_END"] = 8] = "COMMENT_END";
  12925. TokenType[TokenType["CDATA_START"] = 9] = "CDATA_START";
  12926. TokenType[TokenType["CDATA_END"] = 10] = "CDATA_END";
  12927. TokenType[TokenType["ATTR_NAME"] = 11] = "ATTR_NAME";
  12928. TokenType[TokenType["ATTR_VALUE"] = 12] = "ATTR_VALUE";
  12929. TokenType[TokenType["DOC_TYPE"] = 13] = "DOC_TYPE";
  12930. TokenType[TokenType["EXPANSION_FORM_START"] = 14] = "EXPANSION_FORM_START";
  12931. TokenType[TokenType["EXPANSION_CASE_VALUE"] = 15] = "EXPANSION_CASE_VALUE";
  12932. TokenType[TokenType["EXPANSION_CASE_EXP_START"] = 16] = "EXPANSION_CASE_EXP_START";
  12933. TokenType[TokenType["EXPANSION_CASE_EXP_END"] = 17] = "EXPANSION_CASE_EXP_END";
  12934. TokenType[TokenType["EXPANSION_FORM_END"] = 18] = "EXPANSION_FORM_END";
  12935. TokenType[TokenType["EOF"] = 19] = "EOF";
  12936. })(TokenType$1 || (TokenType$1 = {}));
  12937. var Token$1 = /** @class */ (function () {
  12938. function Token(type, parts, sourceSpan) {
  12939. this.type = type;
  12940. this.parts = parts;
  12941. this.sourceSpan = sourceSpan;
  12942. }
  12943. return Token;
  12944. }());
  12945. var TokenError = /** @class */ (function (_super) {
  12946. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TokenError, _super);
  12947. function TokenError(errorMsg, tokenType, span) {
  12948. var _this = _super.call(this, span, errorMsg) || this;
  12949. _this.tokenType = tokenType;
  12950. return _this;
  12951. }
  12952. return TokenError;
  12953. }(ParseError));
  12954. var TokenizeResult = /** @class */ (function () {
  12955. function TokenizeResult(tokens, errors) {
  12956. this.tokens = tokens;
  12957. this.errors = errors;
  12958. }
  12959. return TokenizeResult;
  12960. }());
  12961. function tokenize(source, url, getTagDefinition, tokenizeExpansionForms, interpolationConfig) {
  12962. if (tokenizeExpansionForms === void 0) { tokenizeExpansionForms = false; }
  12963. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12964. return new _Tokenizer(new ParseSourceFile(source, url), getTagDefinition, tokenizeExpansionForms, interpolationConfig)
  12965. .tokenize();
  12966. }
  12967. var _CR_OR_CRLF_REGEXP = /\r\n?/g;
  12968. function _unexpectedCharacterErrorMsg(charCode) {
  12969. var char = charCode === $EOF ? 'EOF' : String.fromCharCode(charCode);
  12970. return "Unexpected character \"" + char + "\"";
  12971. }
  12972. function _unknownEntityErrorMsg(entitySrc) {
  12973. return "Unknown entity \"" + entitySrc + "\" - use the \"&#<decimal>;\" or \"&#x<hex>;\" syntax";
  12974. }
  12975. var _ControlFlowError = /** @class */ (function () {
  12976. function _ControlFlowError(error) {
  12977. this.error = error;
  12978. }
  12979. return _ControlFlowError;
  12980. }());
  12981. // See http://www.w3.org/TR/html51/syntax.html#writing
  12982. var _Tokenizer = /** @class */ (function () {
  12983. /**
  12984. * @param _file The html source
  12985. * @param _getTagDefinition
  12986. * @param _tokenizeIcu Whether to tokenize ICU messages (considered as text nodes when false)
  12987. * @param _interpolationConfig
  12988. */
  12989. function _Tokenizer(_file, _getTagDefinition, _tokenizeIcu, _interpolationConfig) {
  12990. if (_interpolationConfig === void 0) { _interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  12991. this._file = _file;
  12992. this._getTagDefinition = _getTagDefinition;
  12993. this._tokenizeIcu = _tokenizeIcu;
  12994. this._interpolationConfig = _interpolationConfig;
  12995. // Note: this is always lowercase!
  12996. this._peek = -1;
  12997. this._nextPeek = -1;
  12998. this._index = -1;
  12999. this._line = 0;
  13000. this._column = -1;
  13001. this._expansionCaseStack = [];
  13002. this._inInterpolation = false;
  13003. this.tokens = [];
  13004. this.errors = [];
  13005. this._input = _file.content;
  13006. this._length = _file.content.length;
  13007. this._advance();
  13008. }
  13009. _Tokenizer.prototype._processCarriageReturns = function (content) {
  13010. // http://www.w3.org/TR/html5/syntax.html#preprocessing-the-input-stream
  13011. // In order to keep the original position in the source, we can not
  13012. // pre-process it.
  13013. // Instead CRs are processed right before instantiating the tokens.
  13014. return content.replace(_CR_OR_CRLF_REGEXP, '\n');
  13015. };
  13016. _Tokenizer.prototype.tokenize = function () {
  13017. while (this._peek !== $EOF) {
  13018. var start = this._getLocation();
  13019. try {
  13020. if (this._attemptCharCode($LT)) {
  13021. if (this._attemptCharCode($BANG)) {
  13022. if (this._attemptCharCode($LBRACKET)) {
  13023. this._consumeCdata(start);
  13024. }
  13025. else if (this._attemptCharCode($MINUS)) {
  13026. this._consumeComment(start);
  13027. }
  13028. else {
  13029. this._consumeDocType(start);
  13030. }
  13031. }
  13032. else if (this._attemptCharCode($SLASH)) {
  13033. this._consumeTagClose(start);
  13034. }
  13035. else {
  13036. this._consumeTagOpen(start);
  13037. }
  13038. }
  13039. else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
  13040. this._consumeText();
  13041. }
  13042. }
  13043. catch (e) {
  13044. if (e instanceof _ControlFlowError) {
  13045. this.errors.push(e.error);
  13046. }
  13047. else {
  13048. throw e;
  13049. }
  13050. }
  13051. }
  13052. this._beginToken(TokenType$1.EOF);
  13053. this._endToken([]);
  13054. return new TokenizeResult(mergeTextTokens(this.tokens), this.errors);
  13055. };
  13056. /**
  13057. * @returns whether an ICU token has been created
  13058. * @internal
  13059. */
  13060. _Tokenizer.prototype._tokenizeExpansionForm = function () {
  13061. if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
  13062. this._consumeExpansionFormStart();
  13063. return true;
  13064. }
  13065. if (isExpansionCaseStart(this._peek) && this._isInExpansionForm()) {
  13066. this._consumeExpansionCaseStart();
  13067. return true;
  13068. }
  13069. if (this._peek === $RBRACE) {
  13070. if (this._isInExpansionCase()) {
  13071. this._consumeExpansionCaseEnd();
  13072. return true;
  13073. }
  13074. if (this._isInExpansionForm()) {
  13075. this._consumeExpansionFormEnd();
  13076. return true;
  13077. }
  13078. }
  13079. return false;
  13080. };
  13081. _Tokenizer.prototype._getLocation = function () {
  13082. return new ParseLocation(this._file, this._index, this._line, this._column);
  13083. };
  13084. _Tokenizer.prototype._getSpan = function (start, end) {
  13085. if (start === void 0) { start = this._getLocation(); }
  13086. if (end === void 0) { end = this._getLocation(); }
  13087. return new ParseSourceSpan(start, end);
  13088. };
  13089. _Tokenizer.prototype._beginToken = function (type, start) {
  13090. if (start === void 0) { start = this._getLocation(); }
  13091. this._currentTokenStart = start;
  13092. this._currentTokenType = type;
  13093. };
  13094. _Tokenizer.prototype._endToken = function (parts, end) {
  13095. if (end === void 0) { end = this._getLocation(); }
  13096. var token = new Token$1(this._currentTokenType, parts, new ParseSourceSpan(this._currentTokenStart, end));
  13097. this.tokens.push(token);
  13098. this._currentTokenStart = null;
  13099. this._currentTokenType = null;
  13100. return token;
  13101. };
  13102. _Tokenizer.prototype._createError = function (msg, span) {
  13103. if (this._isInExpansionForm()) {
  13104. msg += " (Do you have an unescaped \"{\" in your template? Use \"{{ '{' }}\") to escape it.)";
  13105. }
  13106. var error = new TokenError(msg, this._currentTokenType, span);
  13107. this._currentTokenStart = null;
  13108. this._currentTokenType = null;
  13109. return new _ControlFlowError(error);
  13110. };
  13111. _Tokenizer.prototype._advance = function () {
  13112. if (this._index >= this._length) {
  13113. throw this._createError(_unexpectedCharacterErrorMsg($EOF), this._getSpan());
  13114. }
  13115. if (this._peek === $LF) {
  13116. this._line++;
  13117. this._column = 0;
  13118. }
  13119. else if (this._peek !== $LF && this._peek !== $CR) {
  13120. this._column++;
  13121. }
  13122. this._index++;
  13123. this._peek = this._index >= this._length ? $EOF : this._input.charCodeAt(this._index);
  13124. this._nextPeek =
  13125. this._index + 1 >= this._length ? $EOF : this._input.charCodeAt(this._index + 1);
  13126. };
  13127. _Tokenizer.prototype._attemptCharCode = function (charCode) {
  13128. if (this._peek === charCode) {
  13129. this._advance();
  13130. return true;
  13131. }
  13132. return false;
  13133. };
  13134. _Tokenizer.prototype._attemptCharCodeCaseInsensitive = function (charCode) {
  13135. if (compareCharCodeCaseInsensitive(this._peek, charCode)) {
  13136. this._advance();
  13137. return true;
  13138. }
  13139. return false;
  13140. };
  13141. _Tokenizer.prototype._requireCharCode = function (charCode) {
  13142. var location = this._getLocation();
  13143. if (!this._attemptCharCode(charCode)) {
  13144. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location, location));
  13145. }
  13146. };
  13147. _Tokenizer.prototype._attemptStr = function (chars) {
  13148. var len = chars.length;
  13149. if (this._index + len > this._length) {
  13150. return false;
  13151. }
  13152. var initialPosition = this._savePosition();
  13153. for (var i = 0; i < len; i++) {
  13154. if (!this._attemptCharCode(chars.charCodeAt(i))) {
  13155. // If attempting to parse the string fails, we want to reset the parser
  13156. // to where it was before the attempt
  13157. this._restorePosition(initialPosition);
  13158. return false;
  13159. }
  13160. }
  13161. return true;
  13162. };
  13163. _Tokenizer.prototype._attemptStrCaseInsensitive = function (chars) {
  13164. for (var i = 0; i < chars.length; i++) {
  13165. if (!this._attemptCharCodeCaseInsensitive(chars.charCodeAt(i))) {
  13166. return false;
  13167. }
  13168. }
  13169. return true;
  13170. };
  13171. _Tokenizer.prototype._requireStr = function (chars) {
  13172. var location = this._getLocation();
  13173. if (!this._attemptStr(chars)) {
  13174. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(location));
  13175. }
  13176. };
  13177. _Tokenizer.prototype._attemptCharCodeUntilFn = function (predicate) {
  13178. while (!predicate(this._peek)) {
  13179. this._advance();
  13180. }
  13181. };
  13182. _Tokenizer.prototype._requireCharCodeUntilFn = function (predicate, len) {
  13183. var start = this._getLocation();
  13184. this._attemptCharCodeUntilFn(predicate);
  13185. if (this._index - start.offset < len) {
  13186. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan(start, start));
  13187. }
  13188. };
  13189. _Tokenizer.prototype._attemptUntilChar = function (char) {
  13190. while (this._peek !== char) {
  13191. this._advance();
  13192. }
  13193. };
  13194. _Tokenizer.prototype._readChar = function (decodeEntities) {
  13195. if (decodeEntities && this._peek === $AMPERSAND) {
  13196. return this._decodeEntity();
  13197. }
  13198. else {
  13199. var index = this._index;
  13200. this._advance();
  13201. return this._input[index];
  13202. }
  13203. };
  13204. _Tokenizer.prototype._decodeEntity = function () {
  13205. var start = this._getLocation();
  13206. this._advance();
  13207. if (this._attemptCharCode($HASH)) {
  13208. var isHex = this._attemptCharCode($x) || this._attemptCharCode($X);
  13209. var numberStart = this._getLocation().offset;
  13210. this._attemptCharCodeUntilFn(isDigitEntityEnd);
  13211. if (this._peek != $SEMICOLON) {
  13212. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
  13213. }
  13214. this._advance();
  13215. var strNum = this._input.substring(numberStart, this._index - 1);
  13216. try {
  13217. var charCode = parseInt(strNum, isHex ? 16 : 10);
  13218. return String.fromCharCode(charCode);
  13219. }
  13220. catch (e) {
  13221. var entity = this._input.substring(start.offset + 1, this._index - 1);
  13222. throw this._createError(_unknownEntityErrorMsg(entity), this._getSpan(start));
  13223. }
  13224. }
  13225. else {
  13226. var startPosition = this._savePosition();
  13227. this._attemptCharCodeUntilFn(isNamedEntityEnd);
  13228. if (this._peek != $SEMICOLON) {
  13229. this._restorePosition(startPosition);
  13230. return '&';
  13231. }
  13232. this._advance();
  13233. var name_1 = this._input.substring(start.offset + 1, this._index - 1);
  13234. var char = NAMED_ENTITIES[name_1];
  13235. if (!char) {
  13236. throw this._createError(_unknownEntityErrorMsg(name_1), this._getSpan(start));
  13237. }
  13238. return char;
  13239. }
  13240. };
  13241. _Tokenizer.prototype._consumeRawText = function (decodeEntities, firstCharOfEnd, attemptEndRest) {
  13242. var tagCloseStart;
  13243. var textStart = this._getLocation();
  13244. this._beginToken(decodeEntities ? TokenType$1.ESCAPABLE_RAW_TEXT : TokenType$1.RAW_TEXT, textStart);
  13245. var parts = [];
  13246. while (true) {
  13247. tagCloseStart = this._getLocation();
  13248. if (this._attemptCharCode(firstCharOfEnd) && attemptEndRest()) {
  13249. break;
  13250. }
  13251. if (this._index > tagCloseStart.offset) {
  13252. // add the characters consumed by the previous if statement to the output
  13253. parts.push(this._input.substring(tagCloseStart.offset, this._index));
  13254. }
  13255. while (this._peek !== firstCharOfEnd) {
  13256. parts.push(this._readChar(decodeEntities));
  13257. }
  13258. }
  13259. return this._endToken([this._processCarriageReturns(parts.join(''))], tagCloseStart);
  13260. };
  13261. _Tokenizer.prototype._consumeComment = function (start) {
  13262. var _this = this;
  13263. this._beginToken(TokenType$1.COMMENT_START, start);
  13264. this._requireCharCode($MINUS);
  13265. this._endToken([]);
  13266. var textToken = this._consumeRawText(false, $MINUS, function () { return _this._attemptStr('->'); });
  13267. this._beginToken(TokenType$1.COMMENT_END, textToken.sourceSpan.end);
  13268. this._endToken([]);
  13269. };
  13270. _Tokenizer.prototype._consumeCdata = function (start) {
  13271. var _this = this;
  13272. this._beginToken(TokenType$1.CDATA_START, start);
  13273. this._requireStr('CDATA[');
  13274. this._endToken([]);
  13275. var textToken = this._consumeRawText(false, $RBRACKET, function () { return _this._attemptStr(']>'); });
  13276. this._beginToken(TokenType$1.CDATA_END, textToken.sourceSpan.end);
  13277. this._endToken([]);
  13278. };
  13279. _Tokenizer.prototype._consumeDocType = function (start) {
  13280. this._beginToken(TokenType$1.DOC_TYPE, start);
  13281. this._attemptUntilChar($GT);
  13282. this._advance();
  13283. this._endToken([this._input.substring(start.offset + 2, this._index - 1)]);
  13284. };
  13285. _Tokenizer.prototype._consumePrefixAndName = function () {
  13286. var nameOrPrefixStart = this._index;
  13287. var prefix = null;
  13288. while (this._peek !== $COLON && !isPrefixEnd(this._peek)) {
  13289. this._advance();
  13290. }
  13291. var nameStart;
  13292. if (this._peek === $COLON) {
  13293. this._advance();
  13294. prefix = this._input.substring(nameOrPrefixStart, this._index - 1);
  13295. nameStart = this._index;
  13296. }
  13297. else {
  13298. nameStart = nameOrPrefixStart;
  13299. }
  13300. this._requireCharCodeUntilFn(isNameEnd, this._index === nameStart ? 1 : 0);
  13301. var name = this._input.substring(nameStart, this._index);
  13302. return [prefix, name];
  13303. };
  13304. _Tokenizer.prototype._consumeTagOpen = function (start) {
  13305. var savedPos = this._savePosition();
  13306. var tagName;
  13307. var lowercaseTagName;
  13308. try {
  13309. if (!isAsciiLetter(this._peek)) {
  13310. throw this._createError(_unexpectedCharacterErrorMsg(this._peek), this._getSpan());
  13311. }
  13312. var nameStart = this._index;
  13313. this._consumeTagOpenStart(start);
  13314. tagName = this._input.substring(nameStart, this._index);
  13315. lowercaseTagName = tagName.toLowerCase();
  13316. this._attemptCharCodeUntilFn(isNotWhitespace);
  13317. while (this._peek !== $SLASH && this._peek !== $GT) {
  13318. this._consumeAttributeName();
  13319. this._attemptCharCodeUntilFn(isNotWhitespace);
  13320. if (this._attemptCharCode($EQ)) {
  13321. this._attemptCharCodeUntilFn(isNotWhitespace);
  13322. this._consumeAttributeValue();
  13323. }
  13324. this._attemptCharCodeUntilFn(isNotWhitespace);
  13325. }
  13326. this._consumeTagOpenEnd();
  13327. }
  13328. catch (e) {
  13329. if (e instanceof _ControlFlowError) {
  13330. // When the start tag is invalid, assume we want a "<"
  13331. this._restorePosition(savedPos);
  13332. // Back to back text tokens are merged at the end
  13333. this._beginToken(TokenType$1.TEXT, start);
  13334. this._endToken(['<']);
  13335. return;
  13336. }
  13337. throw e;
  13338. }
  13339. var contentTokenType = this._getTagDefinition(tagName).contentType;
  13340. if (contentTokenType === TagContentType.RAW_TEXT) {
  13341. this._consumeRawTextWithTagClose(lowercaseTagName, false);
  13342. }
  13343. else if (contentTokenType === TagContentType.ESCAPABLE_RAW_TEXT) {
  13344. this._consumeRawTextWithTagClose(lowercaseTagName, true);
  13345. }
  13346. };
  13347. _Tokenizer.prototype._consumeRawTextWithTagClose = function (lowercaseTagName, decodeEntities) {
  13348. var _this = this;
  13349. var textToken = this._consumeRawText(decodeEntities, $LT, function () {
  13350. if (!_this._attemptCharCode($SLASH))
  13351. return false;
  13352. _this._attemptCharCodeUntilFn(isNotWhitespace);
  13353. if (!_this._attemptStrCaseInsensitive(lowercaseTagName))
  13354. return false;
  13355. _this._attemptCharCodeUntilFn(isNotWhitespace);
  13356. return _this._attemptCharCode($GT);
  13357. });
  13358. this._beginToken(TokenType$1.TAG_CLOSE, textToken.sourceSpan.end);
  13359. this._endToken([null, lowercaseTagName]);
  13360. };
  13361. _Tokenizer.prototype._consumeTagOpenStart = function (start) {
  13362. this._beginToken(TokenType$1.TAG_OPEN_START, start);
  13363. var parts = this._consumePrefixAndName();
  13364. this._endToken(parts);
  13365. };
  13366. _Tokenizer.prototype._consumeAttributeName = function () {
  13367. this._beginToken(TokenType$1.ATTR_NAME);
  13368. var prefixAndName = this._consumePrefixAndName();
  13369. this._endToken(prefixAndName);
  13370. };
  13371. _Tokenizer.prototype._consumeAttributeValue = function () {
  13372. this._beginToken(TokenType$1.ATTR_VALUE);
  13373. var value;
  13374. if (this._peek === $SQ || this._peek === $DQ) {
  13375. var quoteChar = this._peek;
  13376. this._advance();
  13377. var parts = [];
  13378. while (this._peek !== quoteChar) {
  13379. parts.push(this._readChar(true));
  13380. }
  13381. value = parts.join('');
  13382. this._advance();
  13383. }
  13384. else {
  13385. var valueStart = this._index;
  13386. this._requireCharCodeUntilFn(isNameEnd, 1);
  13387. value = this._input.substring(valueStart, this._index);
  13388. }
  13389. this._endToken([this._processCarriageReturns(value)]);
  13390. };
  13391. _Tokenizer.prototype._consumeTagOpenEnd = function () {
  13392. var tokenType = this._attemptCharCode($SLASH) ? TokenType$1.TAG_OPEN_END_VOID : TokenType$1.TAG_OPEN_END;
  13393. this._beginToken(tokenType);
  13394. this._requireCharCode($GT);
  13395. this._endToken([]);
  13396. };
  13397. _Tokenizer.prototype._consumeTagClose = function (start) {
  13398. this._beginToken(TokenType$1.TAG_CLOSE, start);
  13399. this._attemptCharCodeUntilFn(isNotWhitespace);
  13400. var prefixAndName = this._consumePrefixAndName();
  13401. this._attemptCharCodeUntilFn(isNotWhitespace);
  13402. this._requireCharCode($GT);
  13403. this._endToken(prefixAndName);
  13404. };
  13405. _Tokenizer.prototype._consumeExpansionFormStart = function () {
  13406. this._beginToken(TokenType$1.EXPANSION_FORM_START, this._getLocation());
  13407. this._requireCharCode($LBRACE);
  13408. this._endToken([]);
  13409. this._expansionCaseStack.push(TokenType$1.EXPANSION_FORM_START);
  13410. this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
  13411. var condition = this._readUntil($COMMA);
  13412. this._endToken([condition], this._getLocation());
  13413. this._requireCharCode($COMMA);
  13414. this._attemptCharCodeUntilFn(isNotWhitespace);
  13415. this._beginToken(TokenType$1.RAW_TEXT, this._getLocation());
  13416. var type = this._readUntil($COMMA);
  13417. this._endToken([type], this._getLocation());
  13418. this._requireCharCode($COMMA);
  13419. this._attemptCharCodeUntilFn(isNotWhitespace);
  13420. };
  13421. _Tokenizer.prototype._consumeExpansionCaseStart = function () {
  13422. this._beginToken(TokenType$1.EXPANSION_CASE_VALUE, this._getLocation());
  13423. var value = this._readUntil($LBRACE).trim();
  13424. this._endToken([value], this._getLocation());
  13425. this._attemptCharCodeUntilFn(isNotWhitespace);
  13426. this._beginToken(TokenType$1.EXPANSION_CASE_EXP_START, this._getLocation());
  13427. this._requireCharCode($LBRACE);
  13428. this._endToken([], this._getLocation());
  13429. this._attemptCharCodeUntilFn(isNotWhitespace);
  13430. this._expansionCaseStack.push(TokenType$1.EXPANSION_CASE_EXP_START);
  13431. };
  13432. _Tokenizer.prototype._consumeExpansionCaseEnd = function () {
  13433. this._beginToken(TokenType$1.EXPANSION_CASE_EXP_END, this._getLocation());
  13434. this._requireCharCode($RBRACE);
  13435. this._endToken([], this._getLocation());
  13436. this._attemptCharCodeUntilFn(isNotWhitespace);
  13437. this._expansionCaseStack.pop();
  13438. };
  13439. _Tokenizer.prototype._consumeExpansionFormEnd = function () {
  13440. this._beginToken(TokenType$1.EXPANSION_FORM_END, this._getLocation());
  13441. this._requireCharCode($RBRACE);
  13442. this._endToken([]);
  13443. this._expansionCaseStack.pop();
  13444. };
  13445. _Tokenizer.prototype._consumeText = function () {
  13446. var start = this._getLocation();
  13447. this._beginToken(TokenType$1.TEXT, start);
  13448. var parts = [];
  13449. do {
  13450. if (this._interpolationConfig && this._attemptStr(this._interpolationConfig.start)) {
  13451. parts.push(this._interpolationConfig.start);
  13452. this._inInterpolation = true;
  13453. }
  13454. else if (this._interpolationConfig && this._inInterpolation &&
  13455. this._attemptStr(this._interpolationConfig.end)) {
  13456. parts.push(this._interpolationConfig.end);
  13457. this._inInterpolation = false;
  13458. }
  13459. else {
  13460. parts.push(this._readChar(true));
  13461. }
  13462. } while (!this._isTextEnd());
  13463. this._endToken([this._processCarriageReturns(parts.join(''))]);
  13464. };
  13465. _Tokenizer.prototype._isTextEnd = function () {
  13466. if (this._peek === $LT || this._peek === $EOF) {
  13467. return true;
  13468. }
  13469. if (this._tokenizeIcu && !this._inInterpolation) {
  13470. if (isExpansionFormStart(this._input, this._index, this._interpolationConfig)) {
  13471. // start of an expansion form
  13472. return true;
  13473. }
  13474. if (this._peek === $RBRACE && this._isInExpansionCase()) {
  13475. // end of and expansion case
  13476. return true;
  13477. }
  13478. }
  13479. return false;
  13480. };
  13481. _Tokenizer.prototype._savePosition = function () {
  13482. return [this._peek, this._index, this._column, this._line, this.tokens.length];
  13483. };
  13484. _Tokenizer.prototype._readUntil = function (char) {
  13485. var start = this._index;
  13486. this._attemptUntilChar(char);
  13487. return this._input.substring(start, this._index);
  13488. };
  13489. _Tokenizer.prototype._restorePosition = function (position) {
  13490. this._peek = position[0];
  13491. this._index = position[1];
  13492. this._column = position[2];
  13493. this._line = position[3];
  13494. var nbTokens = position[4];
  13495. if (nbTokens < this.tokens.length) {
  13496. // remove any extra tokens
  13497. this.tokens = this.tokens.slice(0, nbTokens);
  13498. }
  13499. };
  13500. _Tokenizer.prototype._isInExpansionCase = function () {
  13501. return this._expansionCaseStack.length > 0 &&
  13502. this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
  13503. TokenType$1.EXPANSION_CASE_EXP_START;
  13504. };
  13505. _Tokenizer.prototype._isInExpansionForm = function () {
  13506. return this._expansionCaseStack.length > 0 &&
  13507. this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
  13508. TokenType$1.EXPANSION_FORM_START;
  13509. };
  13510. return _Tokenizer;
  13511. }());
  13512. function isNotWhitespace(code) {
  13513. return !isWhitespace(code) || code === $EOF;
  13514. }
  13515. function isNameEnd(code) {
  13516. return isWhitespace(code) || code === $GT || code === $SLASH ||
  13517. code === $SQ || code === $DQ || code === $EQ;
  13518. }
  13519. function isPrefixEnd(code) {
  13520. return (code < $a || $z < code) && (code < $A || $Z < code) &&
  13521. (code < $0 || code > $9);
  13522. }
  13523. function isDigitEntityEnd(code) {
  13524. return code == $SEMICOLON || code == $EOF || !isAsciiHexDigit(code);
  13525. }
  13526. function isNamedEntityEnd(code) {
  13527. return code == $SEMICOLON || code == $EOF || !isAsciiLetter(code);
  13528. }
  13529. function isExpansionFormStart(input, offset, interpolationConfig) {
  13530. var isInterpolationStart = interpolationConfig ? input.indexOf(interpolationConfig.start, offset) == offset : false;
  13531. return input.charCodeAt(offset) == $LBRACE && !isInterpolationStart;
  13532. }
  13533. function isExpansionCaseStart(peek) {
  13534. return peek === $EQ || isAsciiLetter(peek) || isDigit(peek);
  13535. }
  13536. function compareCharCodeCaseInsensitive(code1, code2) {
  13537. return toUpperCaseCharCode(code1) == toUpperCaseCharCode(code2);
  13538. }
  13539. function toUpperCaseCharCode(code) {
  13540. return code >= $a && code <= $z ? code - $a + $A : code;
  13541. }
  13542. function mergeTextTokens(srcTokens) {
  13543. var dstTokens = [];
  13544. var lastDstToken = undefined;
  13545. for (var i = 0; i < srcTokens.length; i++) {
  13546. var token = srcTokens[i];
  13547. if (lastDstToken && lastDstToken.type == TokenType$1.TEXT && token.type == TokenType$1.TEXT) {
  13548. lastDstToken.parts[0] += token.parts[0];
  13549. lastDstToken.sourceSpan.end = token.sourceSpan.end;
  13550. }
  13551. else {
  13552. lastDstToken = token;
  13553. dstTokens.push(lastDstToken);
  13554. }
  13555. }
  13556. return dstTokens;
  13557. }
  13558. /**
  13559. * @license
  13560. * Copyright Google Inc. All Rights Reserved.
  13561. *
  13562. * Use of this source code is governed by an MIT-style license that can be
  13563. * found in the LICENSE file at https://angular.io/license
  13564. */
  13565. var TreeError = /** @class */ (function (_super) {
  13566. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TreeError, _super);
  13567. function TreeError(elementName, span, msg) {
  13568. var _this = _super.call(this, span, msg) || this;
  13569. _this.elementName = elementName;
  13570. return _this;
  13571. }
  13572. TreeError.create = function (elementName, span, msg) {
  13573. return new TreeError(elementName, span, msg);
  13574. };
  13575. return TreeError;
  13576. }(ParseError));
  13577. var ParseTreeResult = /** @class */ (function () {
  13578. function ParseTreeResult(rootNodes, errors) {
  13579. this.rootNodes = rootNodes;
  13580. this.errors = errors;
  13581. }
  13582. return ParseTreeResult;
  13583. }());
  13584. var Parser$1 = /** @class */ (function () {
  13585. function Parser(getTagDefinition) {
  13586. this.getTagDefinition = getTagDefinition;
  13587. }
  13588. Parser.prototype.parse = function (source, url, parseExpansionForms, interpolationConfig) {
  13589. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  13590. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  13591. var tokensAndErrors = tokenize(source, url, this.getTagDefinition, parseExpansionForms, interpolationConfig);
  13592. var treeAndErrors = new _TreeBuilder(tokensAndErrors.tokens, this.getTagDefinition).build();
  13593. return new ParseTreeResult(treeAndErrors.rootNodes, tokensAndErrors.errors.concat(treeAndErrors.errors));
  13594. };
  13595. return Parser;
  13596. }());
  13597. var _TreeBuilder = /** @class */ (function () {
  13598. function _TreeBuilder(tokens, getTagDefinition) {
  13599. this.tokens = tokens;
  13600. this.getTagDefinition = getTagDefinition;
  13601. this._index = -1;
  13602. this._rootNodes = [];
  13603. this._errors = [];
  13604. this._elementStack = [];
  13605. this._advance();
  13606. }
  13607. _TreeBuilder.prototype.build = function () {
  13608. while (this._peek.type !== TokenType$1.EOF) {
  13609. if (this._peek.type === TokenType$1.TAG_OPEN_START) {
  13610. this._consumeStartTag(this._advance());
  13611. }
  13612. else if (this._peek.type === TokenType$1.TAG_CLOSE) {
  13613. this._consumeEndTag(this._advance());
  13614. }
  13615. else if (this._peek.type === TokenType$1.CDATA_START) {
  13616. this._closeVoidElement();
  13617. this._consumeCdata(this._advance());
  13618. }
  13619. else if (this._peek.type === TokenType$1.COMMENT_START) {
  13620. this._closeVoidElement();
  13621. this._consumeComment(this._advance());
  13622. }
  13623. else if (this._peek.type === TokenType$1.TEXT || this._peek.type === TokenType$1.RAW_TEXT ||
  13624. this._peek.type === TokenType$1.ESCAPABLE_RAW_TEXT) {
  13625. this._closeVoidElement();
  13626. this._consumeText(this._advance());
  13627. }
  13628. else if (this._peek.type === TokenType$1.EXPANSION_FORM_START) {
  13629. this._consumeExpansion(this._advance());
  13630. }
  13631. else {
  13632. // Skip all other tokens...
  13633. this._advance();
  13634. }
  13635. }
  13636. return new ParseTreeResult(this._rootNodes, this._errors);
  13637. };
  13638. _TreeBuilder.prototype._advance = function () {
  13639. var prev = this._peek;
  13640. if (this._index < this.tokens.length - 1) {
  13641. // Note: there is always an EOF token at the end
  13642. this._index++;
  13643. }
  13644. this._peek = this.tokens[this._index];
  13645. return prev;
  13646. };
  13647. _TreeBuilder.prototype._advanceIf = function (type) {
  13648. if (this._peek.type === type) {
  13649. return this._advance();
  13650. }
  13651. return null;
  13652. };
  13653. _TreeBuilder.prototype._consumeCdata = function (startToken) {
  13654. this._consumeText(this._advance());
  13655. this._advanceIf(TokenType$1.CDATA_END);
  13656. };
  13657. _TreeBuilder.prototype._consumeComment = function (token) {
  13658. var text = this._advanceIf(TokenType$1.RAW_TEXT);
  13659. this._advanceIf(TokenType$1.COMMENT_END);
  13660. var value = text != null ? text.parts[0].trim() : null;
  13661. this._addToParent(new Comment(value, token.sourceSpan));
  13662. };
  13663. _TreeBuilder.prototype._consumeExpansion = function (token) {
  13664. var switchValue = this._advance();
  13665. var type = this._advance();
  13666. var cases = [];
  13667. // read =
  13668. while (this._peek.type === TokenType$1.EXPANSION_CASE_VALUE) {
  13669. var expCase = this._parseExpansionCase();
  13670. if (!expCase)
  13671. return; // error
  13672. cases.push(expCase);
  13673. }
  13674. // read the final }
  13675. if (this._peek.type !== TokenType$1.EXPANSION_FORM_END) {
  13676. this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '}'."));
  13677. return;
  13678. }
  13679. var sourceSpan = new ParseSourceSpan(token.sourceSpan.start, this._peek.sourceSpan.end);
  13680. this._addToParent(new Expansion(switchValue.parts[0], type.parts[0], cases, sourceSpan, switchValue.sourceSpan));
  13681. this._advance();
  13682. };
  13683. _TreeBuilder.prototype._parseExpansionCase = function () {
  13684. var value = this._advance();
  13685. // read {
  13686. if (this._peek.type !== TokenType$1.EXPANSION_CASE_EXP_START) {
  13687. this._errors.push(TreeError.create(null, this._peek.sourceSpan, "Invalid ICU message. Missing '{'."));
  13688. return null;
  13689. }
  13690. // read until }
  13691. var start = this._advance();
  13692. var exp = this._collectExpansionExpTokens(start);
  13693. if (!exp)
  13694. return null;
  13695. var end = this._advance();
  13696. exp.push(new Token$1(TokenType$1.EOF, [], end.sourceSpan));
  13697. // parse everything in between { and }
  13698. var parsedExp = new _TreeBuilder(exp, this.getTagDefinition).build();
  13699. if (parsedExp.errors.length > 0) {
  13700. this._errors = this._errors.concat(parsedExp.errors);
  13701. return null;
  13702. }
  13703. var sourceSpan = new ParseSourceSpan(value.sourceSpan.start, end.sourceSpan.end);
  13704. var expSourceSpan = new ParseSourceSpan(start.sourceSpan.start, end.sourceSpan.end);
  13705. return new ExpansionCase(value.parts[0], parsedExp.rootNodes, sourceSpan, value.sourceSpan, expSourceSpan);
  13706. };
  13707. _TreeBuilder.prototype._collectExpansionExpTokens = function (start) {
  13708. var exp = [];
  13709. var expansionFormStack = [TokenType$1.EXPANSION_CASE_EXP_START];
  13710. while (true) {
  13711. if (this._peek.type === TokenType$1.EXPANSION_FORM_START ||
  13712. this._peek.type === TokenType$1.EXPANSION_CASE_EXP_START) {
  13713. expansionFormStack.push(this._peek.type);
  13714. }
  13715. if (this._peek.type === TokenType$1.EXPANSION_CASE_EXP_END) {
  13716. if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_CASE_EXP_START)) {
  13717. expansionFormStack.pop();
  13718. if (expansionFormStack.length == 0)
  13719. return exp;
  13720. }
  13721. else {
  13722. this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
  13723. return null;
  13724. }
  13725. }
  13726. if (this._peek.type === TokenType$1.EXPANSION_FORM_END) {
  13727. if (lastOnStack(expansionFormStack, TokenType$1.EXPANSION_FORM_START)) {
  13728. expansionFormStack.pop();
  13729. }
  13730. else {
  13731. this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
  13732. return null;
  13733. }
  13734. }
  13735. if (this._peek.type === TokenType$1.EOF) {
  13736. this._errors.push(TreeError.create(null, start.sourceSpan, "Invalid ICU message. Missing '}'."));
  13737. return null;
  13738. }
  13739. exp.push(this._advance());
  13740. }
  13741. };
  13742. _TreeBuilder.prototype._consumeText = function (token) {
  13743. var text = token.parts[0];
  13744. if (text.length > 0 && text[0] == '\n') {
  13745. var parent_1 = this._getParentElement();
  13746. if (parent_1 != null && parent_1.children.length == 0 &&
  13747. this.getTagDefinition(parent_1.name).ignoreFirstLf) {
  13748. text = text.substring(1);
  13749. }
  13750. }
  13751. if (text.length > 0) {
  13752. this._addToParent(new Text(text, token.sourceSpan));
  13753. }
  13754. };
  13755. _TreeBuilder.prototype._closeVoidElement = function () {
  13756. var el = this._getParentElement();
  13757. if (el && this.getTagDefinition(el.name).isVoid) {
  13758. this._elementStack.pop();
  13759. }
  13760. };
  13761. _TreeBuilder.prototype._consumeStartTag = function (startTagToken) {
  13762. var prefix = startTagToken.parts[0];
  13763. var name = startTagToken.parts[1];
  13764. var attrs = [];
  13765. while (this._peek.type === TokenType$1.ATTR_NAME) {
  13766. attrs.push(this._consumeAttr(this._advance()));
  13767. }
  13768. var fullName = this._getElementFullName(prefix, name, this._getParentElement());
  13769. var selfClosing = false;
  13770. // Note: There could have been a tokenizer error
  13771. // so that we don't get a token for the end tag...
  13772. if (this._peek.type === TokenType$1.TAG_OPEN_END_VOID) {
  13773. this._advance();
  13774. selfClosing = true;
  13775. var tagDef = this.getTagDefinition(fullName);
  13776. if (!(tagDef.canSelfClose || getNsPrefix(fullName) !== null || tagDef.isVoid)) {
  13777. this._errors.push(TreeError.create(fullName, startTagToken.sourceSpan, "Only void and foreign elements can be self closed \"" + startTagToken.parts[1] + "\""));
  13778. }
  13779. }
  13780. else if (this._peek.type === TokenType$1.TAG_OPEN_END) {
  13781. this._advance();
  13782. selfClosing = false;
  13783. }
  13784. var end = this._peek.sourceSpan.start;
  13785. var span = new ParseSourceSpan(startTagToken.sourceSpan.start, end);
  13786. var el = new Element(fullName, attrs, [], span, span, undefined);
  13787. this._pushElement(el);
  13788. if (selfClosing) {
  13789. this._popElement(fullName);
  13790. el.endSourceSpan = span;
  13791. }
  13792. };
  13793. _TreeBuilder.prototype._pushElement = function (el) {
  13794. var parentEl = this._getParentElement();
  13795. if (parentEl && this.getTagDefinition(parentEl.name).isClosedByChild(el.name)) {
  13796. this._elementStack.pop();
  13797. }
  13798. var tagDef = this.getTagDefinition(el.name);
  13799. var _a = this._getParentElementSkippingContainers(), parent = _a.parent, container = _a.container;
  13800. if (parent && tagDef.requireExtraParent(parent.name)) {
  13801. var newParent = new Element(tagDef.parentToAdd, [], [], el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
  13802. this._insertBeforeContainer(parent, container, newParent);
  13803. }
  13804. this._addToParent(el);
  13805. this._elementStack.push(el);
  13806. };
  13807. _TreeBuilder.prototype._consumeEndTag = function (endTagToken) {
  13808. var fullName = this._getElementFullName(endTagToken.parts[0], endTagToken.parts[1], this._getParentElement());
  13809. if (this._getParentElement()) {
  13810. this._getParentElement().endSourceSpan = endTagToken.sourceSpan;
  13811. }
  13812. if (this.getTagDefinition(fullName).isVoid) {
  13813. this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, "Void elements do not have end tags \"" + endTagToken.parts[1] + "\""));
  13814. }
  13815. else if (!this._popElement(fullName)) {
  13816. var 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";
  13817. this._errors.push(TreeError.create(fullName, endTagToken.sourceSpan, errMsg));
  13818. }
  13819. };
  13820. _TreeBuilder.prototype._popElement = function (fullName) {
  13821. for (var stackIndex = this._elementStack.length - 1; stackIndex >= 0; stackIndex--) {
  13822. var el = this._elementStack[stackIndex];
  13823. if (el.name == fullName) {
  13824. this._elementStack.splice(stackIndex, this._elementStack.length - stackIndex);
  13825. return true;
  13826. }
  13827. if (!this.getTagDefinition(el.name).closedByParent) {
  13828. return false;
  13829. }
  13830. }
  13831. return false;
  13832. };
  13833. _TreeBuilder.prototype._consumeAttr = function (attrName) {
  13834. var fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
  13835. var end = attrName.sourceSpan.end;
  13836. var value = '';
  13837. var valueSpan = undefined;
  13838. if (this._peek.type === TokenType$1.ATTR_VALUE) {
  13839. var valueToken = this._advance();
  13840. value = valueToken.parts[0];
  13841. end = valueToken.sourceSpan.end;
  13842. valueSpan = valueToken.sourceSpan;
  13843. }
  13844. return new Attribute(fullName, value, new ParseSourceSpan(attrName.sourceSpan.start, end), valueSpan);
  13845. };
  13846. _TreeBuilder.prototype._getParentElement = function () {
  13847. return this._elementStack.length > 0 ? this._elementStack[this._elementStack.length - 1] : null;
  13848. };
  13849. /**
  13850. * Returns the parent in the DOM and the container.
  13851. *
  13852. * `<ng-container>` elements are skipped as they are not rendered as DOM element.
  13853. */
  13854. _TreeBuilder.prototype._getParentElementSkippingContainers = function () {
  13855. var container = null;
  13856. for (var i = this._elementStack.length - 1; i >= 0; i--) {
  13857. if (!isNgContainer(this._elementStack[i].name)) {
  13858. return { parent: this._elementStack[i], container: container };
  13859. }
  13860. container = this._elementStack[i];
  13861. }
  13862. return { parent: null, container: container };
  13863. };
  13864. _TreeBuilder.prototype._addToParent = function (node) {
  13865. var parent = this._getParentElement();
  13866. if (parent != null) {
  13867. parent.children.push(node);
  13868. }
  13869. else {
  13870. this._rootNodes.push(node);
  13871. }
  13872. };
  13873. /**
  13874. * Insert a node between the parent and the container.
  13875. * When no container is given, the node is appended as a child of the parent.
  13876. * Also updates the element stack accordingly.
  13877. *
  13878. * @internal
  13879. */
  13880. _TreeBuilder.prototype._insertBeforeContainer = function (parent, container, node) {
  13881. if (!container) {
  13882. this._addToParent(node);
  13883. this._elementStack.push(node);
  13884. }
  13885. else {
  13886. if (parent) {
  13887. // replace the container with the new node in the children
  13888. var index = parent.children.indexOf(container);
  13889. parent.children[index] = node;
  13890. }
  13891. else {
  13892. this._rootNodes.push(node);
  13893. }
  13894. node.children.push(container);
  13895. this._elementStack.splice(this._elementStack.indexOf(container), 0, node);
  13896. }
  13897. };
  13898. _TreeBuilder.prototype._getElementFullName = function (prefix, localName, parentElement) {
  13899. if (prefix == null) {
  13900. prefix = this.getTagDefinition(localName).implicitNamespacePrefix;
  13901. if (prefix == null && parentElement != null) {
  13902. prefix = getNsPrefix(parentElement.name);
  13903. }
  13904. }
  13905. return mergeNsAndName(prefix, localName);
  13906. };
  13907. return _TreeBuilder;
  13908. }());
  13909. function lastOnStack(stack, element) {
  13910. return stack.length > 0 && stack[stack.length - 1] === element;
  13911. }
  13912. /**
  13913. * @license
  13914. * Copyright Google Inc. All Rights Reserved.
  13915. *
  13916. * Use of this source code is governed by an MIT-style license that can be
  13917. * found in the LICENSE file at https://angular.io/license
  13918. */
  13919. function digest(message) {
  13920. return message.id || sha1(serializeNodes(message.nodes).join('') + ("[" + message.meaning + "]"));
  13921. }
  13922. function decimalDigest(message) {
  13923. if (message.id) {
  13924. return message.id;
  13925. }
  13926. var visitor = new _SerializerIgnoreIcuExpVisitor();
  13927. var parts = message.nodes.map(function (a) { return a.visit(visitor, null); });
  13928. return computeMsgId(parts.join(''), message.meaning);
  13929. }
  13930. /**
  13931. * Serialize the i18n ast to something xml-like in order to generate an UID.
  13932. *
  13933. * The visitor is also used in the i18n parser tests
  13934. *
  13935. * @internal
  13936. */
  13937. var _SerializerVisitor = /** @class */ (function () {
  13938. function _SerializerVisitor() {
  13939. }
  13940. _SerializerVisitor.prototype.visitText = function (text, context) { return text.value; };
  13941. _SerializerVisitor.prototype.visitContainer = function (container, context) {
  13942. var _this = this;
  13943. return "[" + container.children.map(function (child) { return child.visit(_this); }).join(', ') + "]";
  13944. };
  13945. _SerializerVisitor.prototype.visitIcu = function (icu, context) {
  13946. var _this = this;
  13947. var strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
  13948. return "{" + icu.expression + ", " + icu.type + ", " + strCases.join(', ') + "}";
  13949. };
  13950. _SerializerVisitor.prototype.visitTagPlaceholder = function (ph, context) {
  13951. var _this = this;
  13952. return ph.isVoid ?
  13953. "<ph tag name=\"" + ph.startName + "\"/>" :
  13954. "<ph tag name=\"" + ph.startName + "\">" + ph.children.map(function (child) { return child.visit(_this); }).join(', ') + "</ph name=\"" + ph.closeName + "\">";
  13955. };
  13956. _SerializerVisitor.prototype.visitPlaceholder = function (ph, context) {
  13957. return ph.value ? "<ph name=\"" + ph.name + "\">" + ph.value + "</ph>" : "<ph name=\"" + ph.name + "\"/>";
  13958. };
  13959. _SerializerVisitor.prototype.visitIcuPlaceholder = function (ph, context) {
  13960. return "<ph icu name=\"" + ph.name + "\">" + ph.value.visit(this) + "</ph>";
  13961. };
  13962. return _SerializerVisitor;
  13963. }());
  13964. var serializerVisitor = new _SerializerVisitor();
  13965. function serializeNodes(nodes) {
  13966. return nodes.map(function (a) { return a.visit(serializerVisitor, null); });
  13967. }
  13968. /**
  13969. * Serialize the i18n ast to something xml-like in order to generate an UID.
  13970. *
  13971. * Ignore the ICU expressions so that message IDs stays identical if only the expression changes.
  13972. *
  13973. * @internal
  13974. */
  13975. var _SerializerIgnoreIcuExpVisitor = /** @class */ (function (_super) {
  13976. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_SerializerIgnoreIcuExpVisitor, _super);
  13977. function _SerializerIgnoreIcuExpVisitor() {
  13978. return _super !== null && _super.apply(this, arguments) || this;
  13979. }
  13980. _SerializerIgnoreIcuExpVisitor.prototype.visitIcu = function (icu, context) {
  13981. var _this = this;
  13982. var strCases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
  13983. // Do not take the expression into account
  13984. return "{" + icu.type + ", " + strCases.join(', ') + "}";
  13985. };
  13986. return _SerializerIgnoreIcuExpVisitor;
  13987. }(_SerializerVisitor));
  13988. /**
  13989. * Compute the SHA1 of the given string
  13990. *
  13991. * see http://csrc.nist.gov/publications/fips/fips180-4/fips-180-4.pdf
  13992. *
  13993. * WARNING: this function has not been designed not tested with security in mind.
  13994. * DO NOT USE IT IN A SECURITY SENSITIVE CONTEXT.
  13995. */
  13996. function sha1(str) {
  13997. var _a, _b;
  13998. var utf8 = utf8Encode(str);
  13999. var words32 = stringToWords32(utf8, Endian.Big);
  14000. var len = utf8.length * 8;
  14001. var w = new Array(80);
  14002. var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])([0x67452301, 0xefcdab89, 0x98badcfe, 0x10325476, 0xc3d2e1f0], 5), a = _c[0], b = _c[1], c = _c[2], d = _c[3], e = _c[4];
  14003. words32[len >> 5] |= 0x80 << (24 - len % 32);
  14004. words32[((len + 64 >> 9) << 4) + 15] = len;
  14005. for (var i = 0; i < words32.length; i += 16) {
  14006. var _d = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])([a, b, c, d, e], 5), h0 = _d[0], h1 = _d[1], h2 = _d[2], h3 = _d[3], h4 = _d[4];
  14007. for (var j = 0; j < 80; j++) {
  14008. if (j < 16) {
  14009. w[j] = words32[i + j];
  14010. }
  14011. else {
  14012. w[j] = rol32(w[j - 3] ^ w[j - 8] ^ w[j - 14] ^ w[j - 16], 1);
  14013. }
  14014. var _e = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(fk(j, b, c, d), 2), f = _e[0], k = _e[1];
  14015. var temp = [rol32(a, 5), f, e, k, w[j]].reduce(add32);
  14016. _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])([d, c, rol32(b, 30), a, temp], 5), e = _a[0], d = _a[1], c = _a[2], b = _a[3], a = _a[4];
  14017. }
  14018. _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])([add32(a, h0), add32(b, h1), add32(c, h2), add32(d, h3), add32(e, h4)], 5), a = _b[0], b = _b[1], c = _b[2], d = _b[3], e = _b[4];
  14019. }
  14020. return byteStringToHexString(words32ToByteString([a, b, c, d, e]));
  14021. }
  14022. function fk(index, b, c, d) {
  14023. if (index < 20) {
  14024. return [(b & c) | (~b & d), 0x5a827999];
  14025. }
  14026. if (index < 40) {
  14027. return [b ^ c ^ d, 0x6ed9eba1];
  14028. }
  14029. if (index < 60) {
  14030. return [(b & c) | (b & d) | (c & d), 0x8f1bbcdc];
  14031. }
  14032. return [b ^ c ^ d, 0xca62c1d6];
  14033. }
  14034. /**
  14035. * Compute the fingerprint of the given string
  14036. *
  14037. * The output is 64 bit number encoded as a decimal string
  14038. *
  14039. * based on:
  14040. * https://github.com/google/closure-compiler/blob/master/src/com/google/javascript/jscomp/GoogleJsMessageIdGenerator.java
  14041. */
  14042. function fingerprint(str) {
  14043. var utf8 = utf8Encode(str);
  14044. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])([hash32(utf8, 0), hash32(utf8, 102072)], 2), hi = _a[0], lo = _a[1];
  14045. if (hi == 0 && (lo == 0 || lo == 1)) {
  14046. hi = hi ^ 0x130f9bef;
  14047. lo = lo ^ -0x6b5f56d8;
  14048. }
  14049. return [hi, lo];
  14050. }
  14051. function computeMsgId(msg, meaning) {
  14052. var _a;
  14053. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(fingerprint(msg), 2), hi = _b[0], lo = _b[1];
  14054. if (meaning) {
  14055. var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(fingerprint(meaning), 2), him = _c[0], lom = _c[1];
  14056. _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(add64(rol64([hi, lo], 1), [him, lom]), 2), hi = _a[0], lo = _a[1];
  14057. }
  14058. return byteStringToDecString(words32ToByteString([hi & 0x7fffffff, lo]));
  14059. }
  14060. function hash32(str, c) {
  14061. var _a;
  14062. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])([0x9e3779b9, 0x9e3779b9], 2), a = _b[0], b = _b[1];
  14063. var i;
  14064. var len = str.length;
  14065. for (i = 0; i + 12 <= len; i += 12) {
  14066. a = add32(a, wordAt(str, i, Endian.Little));
  14067. b = add32(b, wordAt(str, i + 4, Endian.Little));
  14068. c = add32(c, wordAt(str, i + 8, Endian.Little));
  14069. _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(mix([a, b, c]), 3), a = _a[0], b = _a[1], c = _a[2];
  14070. }
  14071. a = add32(a, wordAt(str, i, Endian.Little));
  14072. b = add32(b, wordAt(str, i + 4, Endian.Little));
  14073. // the first byte of c is reserved for the length
  14074. c = add32(c, len);
  14075. c = add32(c, wordAt(str, i + 8, Endian.Little) << 8);
  14076. return mix([a, b, c])[2];
  14077. }
  14078. // clang-format off
  14079. function mix(_a) {
  14080. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 3), a = _b[0], b = _b[1], c = _b[2];
  14081. a = sub32(a, b);
  14082. a = sub32(a, c);
  14083. a ^= c >>> 13;
  14084. b = sub32(b, c);
  14085. b = sub32(b, a);
  14086. b ^= a << 8;
  14087. c = sub32(c, a);
  14088. c = sub32(c, b);
  14089. c ^= b >>> 13;
  14090. a = sub32(a, b);
  14091. a = sub32(a, c);
  14092. a ^= c >>> 12;
  14093. b = sub32(b, c);
  14094. b = sub32(b, a);
  14095. b ^= a << 16;
  14096. c = sub32(c, a);
  14097. c = sub32(c, b);
  14098. c ^= b >>> 5;
  14099. a = sub32(a, b);
  14100. a = sub32(a, c);
  14101. a ^= c >>> 3;
  14102. b = sub32(b, c);
  14103. b = sub32(b, a);
  14104. b ^= a << 10;
  14105. c = sub32(c, a);
  14106. c = sub32(c, b);
  14107. c ^= b >>> 15;
  14108. return [a, b, c];
  14109. }
  14110. // clang-format on
  14111. // Utils
  14112. var Endian;
  14113. (function (Endian) {
  14114. Endian[Endian["Little"] = 0] = "Little";
  14115. Endian[Endian["Big"] = 1] = "Big";
  14116. })(Endian || (Endian = {}));
  14117. function add32(a, b) {
  14118. return add32to64(a, b)[1];
  14119. }
  14120. function add32to64(a, b) {
  14121. var low = (a & 0xffff) + (b & 0xffff);
  14122. var high = (a >>> 16) + (b >>> 16) + (low >>> 16);
  14123. return [high >>> 16, (high << 16) | (low & 0xffff)];
  14124. }
  14125. function add64(_a, _b) {
  14126. var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), ah = _c[0], al = _c[1];
  14127. var _d = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_b, 2), bh = _d[0], bl = _d[1];
  14128. var _e = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(add32to64(al, bl), 2), carry = _e[0], l = _e[1];
  14129. var h = add32(add32(ah, bh), carry);
  14130. return [h, l];
  14131. }
  14132. function sub32(a, b) {
  14133. var low = (a & 0xffff) - (b & 0xffff);
  14134. var high = (a >> 16) - (b >> 16) + (low >> 16);
  14135. return (high << 16) | (low & 0xffff);
  14136. }
  14137. // Rotate a 32b number left `count` position
  14138. function rol32(a, count) {
  14139. return (a << count) | (a >>> (32 - count));
  14140. }
  14141. // Rotate a 64b number left `count` position
  14142. function rol64(_a, count) {
  14143. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), hi = _b[0], lo = _b[1];
  14144. var h = (hi << count) | (lo >>> (32 - count));
  14145. var l = (lo << count) | (hi >>> (32 - count));
  14146. return [h, l];
  14147. }
  14148. function stringToWords32(str, endian) {
  14149. var words32 = Array((str.length + 3) >>> 2);
  14150. for (var i = 0; i < words32.length; i++) {
  14151. words32[i] = wordAt(str, i * 4, endian);
  14152. }
  14153. return words32;
  14154. }
  14155. function byteAt(str, index) {
  14156. return index >= str.length ? 0 : str.charCodeAt(index) & 0xff;
  14157. }
  14158. function wordAt(str, index, endian) {
  14159. var word = 0;
  14160. if (endian === Endian.Big) {
  14161. for (var i = 0; i < 4; i++) {
  14162. word += byteAt(str, index + i) << (24 - 8 * i);
  14163. }
  14164. }
  14165. else {
  14166. for (var i = 0; i < 4; i++) {
  14167. word += byteAt(str, index + i) << 8 * i;
  14168. }
  14169. }
  14170. return word;
  14171. }
  14172. function words32ToByteString(words32) {
  14173. return words32.reduce(function (str, word) { return str + word32ToByteString(word); }, '');
  14174. }
  14175. function word32ToByteString(word) {
  14176. var str = '';
  14177. for (var i = 0; i < 4; i++) {
  14178. str += String.fromCharCode((word >>> 8 * (3 - i)) & 0xff);
  14179. }
  14180. return str;
  14181. }
  14182. function byteStringToHexString(str) {
  14183. var hex = '';
  14184. for (var i = 0; i < str.length; i++) {
  14185. var b = byteAt(str, i);
  14186. hex += (b >>> 4).toString(16) + (b & 0x0f).toString(16);
  14187. }
  14188. return hex.toLowerCase();
  14189. }
  14190. // based on http://www.danvk.org/hex2dec.html (JS can not handle more than 56b)
  14191. function byteStringToDecString(str) {
  14192. var decimal = '';
  14193. var toThePower = '1';
  14194. for (var i = str.length - 1; i >= 0; i--) {
  14195. decimal = addBigInt(decimal, numberTimesBigInt(byteAt(str, i), toThePower));
  14196. toThePower = numberTimesBigInt(256, toThePower);
  14197. }
  14198. return decimal.split('').reverse().join('');
  14199. }
  14200. // x and y decimal, lowest significant digit first
  14201. function addBigInt(x, y) {
  14202. var sum = '';
  14203. var len = Math.max(x.length, y.length);
  14204. for (var i = 0, carry = 0; i < len || carry; i++) {
  14205. var tmpSum = carry + +(x[i] || 0) + +(y[i] || 0);
  14206. if (tmpSum >= 10) {
  14207. carry = 1;
  14208. sum += tmpSum - 10;
  14209. }
  14210. else {
  14211. carry = 0;
  14212. sum += tmpSum;
  14213. }
  14214. }
  14215. return sum;
  14216. }
  14217. function numberTimesBigInt(num, b) {
  14218. var product = '';
  14219. var bToThePower = b;
  14220. for (; num !== 0; num = num >>> 1) {
  14221. if (num & 1)
  14222. product = addBigInt(product, bToThePower);
  14223. bToThePower = addBigInt(bToThePower, bToThePower);
  14224. }
  14225. return product;
  14226. }
  14227. /**
  14228. * @license
  14229. * Copyright Google Inc. All Rights Reserved.
  14230. *
  14231. * Use of this source code is governed by an MIT-style license that can be
  14232. * found in the LICENSE file at https://angular.io/license
  14233. */
  14234. var Message = /** @class */ (function () {
  14235. /**
  14236. * @param nodes message AST
  14237. * @param placeholders maps placeholder names to static content
  14238. * @param placeholderToMessage maps placeholder names to messages (used for nested ICU messages)
  14239. * @param meaning
  14240. * @param description
  14241. * @param id
  14242. */
  14243. function Message(nodes, placeholders, placeholderToMessage, meaning, description, id) {
  14244. this.nodes = nodes;
  14245. this.placeholders = placeholders;
  14246. this.placeholderToMessage = placeholderToMessage;
  14247. this.meaning = meaning;
  14248. this.description = description;
  14249. this.id = id;
  14250. if (nodes.length) {
  14251. this.sources = [{
  14252. filePath: nodes[0].sourceSpan.start.file.url,
  14253. startLine: nodes[0].sourceSpan.start.line + 1,
  14254. startCol: nodes[0].sourceSpan.start.col + 1,
  14255. endLine: nodes[nodes.length - 1].sourceSpan.end.line + 1,
  14256. endCol: nodes[0].sourceSpan.start.col + 1
  14257. }];
  14258. }
  14259. else {
  14260. this.sources = [];
  14261. }
  14262. }
  14263. return Message;
  14264. }());
  14265. var Text$1 = /** @class */ (function () {
  14266. function Text(value, sourceSpan) {
  14267. this.value = value;
  14268. this.sourceSpan = sourceSpan;
  14269. }
  14270. Text.prototype.visit = function (visitor, context) { return visitor.visitText(this, context); };
  14271. return Text;
  14272. }());
  14273. // TODO(vicb): do we really need this node (vs an array) ?
  14274. var Container = /** @class */ (function () {
  14275. function Container(children, sourceSpan) {
  14276. this.children = children;
  14277. this.sourceSpan = sourceSpan;
  14278. }
  14279. Container.prototype.visit = function (visitor, context) { return visitor.visitContainer(this, context); };
  14280. return Container;
  14281. }());
  14282. var Icu = /** @class */ (function () {
  14283. function Icu(expression, type, cases, sourceSpan) {
  14284. this.expression = expression;
  14285. this.type = type;
  14286. this.cases = cases;
  14287. this.sourceSpan = sourceSpan;
  14288. }
  14289. Icu.prototype.visit = function (visitor, context) { return visitor.visitIcu(this, context); };
  14290. return Icu;
  14291. }());
  14292. var TagPlaceholder = /** @class */ (function () {
  14293. function TagPlaceholder(tag, attrs, startName, closeName, children, isVoid, sourceSpan) {
  14294. this.tag = tag;
  14295. this.attrs = attrs;
  14296. this.startName = startName;
  14297. this.closeName = closeName;
  14298. this.children = children;
  14299. this.isVoid = isVoid;
  14300. this.sourceSpan = sourceSpan;
  14301. }
  14302. TagPlaceholder.prototype.visit = function (visitor, context) { return visitor.visitTagPlaceholder(this, context); };
  14303. return TagPlaceholder;
  14304. }());
  14305. var Placeholder = /** @class */ (function () {
  14306. function Placeholder(value, name, sourceSpan) {
  14307. this.value = value;
  14308. this.name = name;
  14309. this.sourceSpan = sourceSpan;
  14310. }
  14311. Placeholder.prototype.visit = function (visitor, context) { return visitor.visitPlaceholder(this, context); };
  14312. return Placeholder;
  14313. }());
  14314. var IcuPlaceholder = /** @class */ (function () {
  14315. function IcuPlaceholder(value, name, sourceSpan) {
  14316. this.value = value;
  14317. this.name = name;
  14318. this.sourceSpan = sourceSpan;
  14319. }
  14320. IcuPlaceholder.prototype.visit = function (visitor, context) { return visitor.visitIcuPlaceholder(this, context); };
  14321. return IcuPlaceholder;
  14322. }());
  14323. // Clone the AST
  14324. var CloneVisitor = /** @class */ (function () {
  14325. function CloneVisitor() {
  14326. }
  14327. CloneVisitor.prototype.visitText = function (text, context) { return new Text$1(text.value, text.sourceSpan); };
  14328. CloneVisitor.prototype.visitContainer = function (container, context) {
  14329. var _this = this;
  14330. var children = container.children.map(function (n) { return n.visit(_this, context); });
  14331. return new Container(children, container.sourceSpan);
  14332. };
  14333. CloneVisitor.prototype.visitIcu = function (icu, context) {
  14334. var _this = this;
  14335. var cases = {};
  14336. Object.keys(icu.cases).forEach(function (key) { return cases[key] = icu.cases[key].visit(_this, context); });
  14337. var msg = new Icu(icu.expression, icu.type, cases, icu.sourceSpan);
  14338. msg.expressionPlaceholder = icu.expressionPlaceholder;
  14339. return msg;
  14340. };
  14341. CloneVisitor.prototype.visitTagPlaceholder = function (ph, context) {
  14342. var _this = this;
  14343. var children = ph.children.map(function (n) { return n.visit(_this, context); });
  14344. return new TagPlaceholder(ph.tag, ph.attrs, ph.startName, ph.closeName, children, ph.isVoid, ph.sourceSpan);
  14345. };
  14346. CloneVisitor.prototype.visitPlaceholder = function (ph, context) {
  14347. return new Placeholder(ph.value, ph.name, ph.sourceSpan);
  14348. };
  14349. CloneVisitor.prototype.visitIcuPlaceholder = function (ph, context) {
  14350. return new IcuPlaceholder(ph.value, ph.name, ph.sourceSpan);
  14351. };
  14352. return CloneVisitor;
  14353. }());
  14354. // Visit all the nodes recursively
  14355. var RecurseVisitor = /** @class */ (function () {
  14356. function RecurseVisitor() {
  14357. }
  14358. RecurseVisitor.prototype.visitText = function (text, context) { };
  14359. RecurseVisitor.prototype.visitContainer = function (container, context) {
  14360. var _this = this;
  14361. container.children.forEach(function (child) { return child.visit(_this); });
  14362. };
  14363. RecurseVisitor.prototype.visitIcu = function (icu, context) {
  14364. var _this = this;
  14365. Object.keys(icu.cases).forEach(function (k) { icu.cases[k].visit(_this); });
  14366. };
  14367. RecurseVisitor.prototype.visitTagPlaceholder = function (ph, context) {
  14368. var _this = this;
  14369. ph.children.forEach(function (child) { return child.visit(_this); });
  14370. };
  14371. RecurseVisitor.prototype.visitPlaceholder = function (ph, context) { };
  14372. RecurseVisitor.prototype.visitIcuPlaceholder = function (ph, context) { };
  14373. return RecurseVisitor;
  14374. }());
  14375. /**
  14376. * @license
  14377. * Copyright Google Inc. All Rights Reserved.
  14378. *
  14379. * Use of this source code is governed by an MIT-style license that can be
  14380. * found in the LICENSE file at https://angular.io/license
  14381. */
  14382. var TAG_TO_PLACEHOLDER_NAMES = {
  14383. 'A': 'LINK',
  14384. 'B': 'BOLD_TEXT',
  14385. 'BR': 'LINE_BREAK',
  14386. 'EM': 'EMPHASISED_TEXT',
  14387. 'H1': 'HEADING_LEVEL1',
  14388. 'H2': 'HEADING_LEVEL2',
  14389. 'H3': 'HEADING_LEVEL3',
  14390. 'H4': 'HEADING_LEVEL4',
  14391. 'H5': 'HEADING_LEVEL5',
  14392. 'H6': 'HEADING_LEVEL6',
  14393. 'HR': 'HORIZONTAL_RULE',
  14394. 'I': 'ITALIC_TEXT',
  14395. 'LI': 'LIST_ITEM',
  14396. 'LINK': 'MEDIA_LINK',
  14397. 'OL': 'ORDERED_LIST',
  14398. 'P': 'PARAGRAPH',
  14399. 'Q': 'QUOTATION',
  14400. 'S': 'STRIKETHROUGH_TEXT',
  14401. 'SMALL': 'SMALL_TEXT',
  14402. 'SUB': 'SUBSTRIPT',
  14403. 'SUP': 'SUPERSCRIPT',
  14404. 'TBODY': 'TABLE_BODY',
  14405. 'TD': 'TABLE_CELL',
  14406. 'TFOOT': 'TABLE_FOOTER',
  14407. 'TH': 'TABLE_HEADER_CELL',
  14408. 'THEAD': 'TABLE_HEADER',
  14409. 'TR': 'TABLE_ROW',
  14410. 'TT': 'MONOSPACED_TEXT',
  14411. 'U': 'UNDERLINED_TEXT',
  14412. 'UL': 'UNORDERED_LIST',
  14413. };
  14414. /**
  14415. * Creates unique names for placeholder with different content.
  14416. *
  14417. * Returns the same placeholder name when the content is identical.
  14418. */
  14419. var PlaceholderRegistry = /** @class */ (function () {
  14420. function PlaceholderRegistry() {
  14421. // Count the occurrence of the base name top generate a unique name
  14422. this._placeHolderNameCounts = {};
  14423. // Maps signature to placeholder names
  14424. this._signatureToName = {};
  14425. }
  14426. PlaceholderRegistry.prototype.getStartTagPlaceholderName = function (tag, attrs, isVoid) {
  14427. var signature = this._hashTag(tag, attrs, isVoid);
  14428. if (this._signatureToName[signature]) {
  14429. return this._signatureToName[signature];
  14430. }
  14431. var upperTag = tag.toUpperCase();
  14432. var baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
  14433. var name = this._generateUniqueName(isVoid ? baseName : "START_" + baseName);
  14434. this._signatureToName[signature] = name;
  14435. return name;
  14436. };
  14437. PlaceholderRegistry.prototype.getCloseTagPlaceholderName = function (tag) {
  14438. var signature = this._hashClosingTag(tag);
  14439. if (this._signatureToName[signature]) {
  14440. return this._signatureToName[signature];
  14441. }
  14442. var upperTag = tag.toUpperCase();
  14443. var baseName = TAG_TO_PLACEHOLDER_NAMES[upperTag] || "TAG_" + upperTag;
  14444. var name = this._generateUniqueName("CLOSE_" + baseName);
  14445. this._signatureToName[signature] = name;
  14446. return name;
  14447. };
  14448. PlaceholderRegistry.prototype.getPlaceholderName = function (name, content) {
  14449. var upperName = name.toUpperCase();
  14450. var signature = "PH: " + upperName + "=" + content;
  14451. if (this._signatureToName[signature]) {
  14452. return this._signatureToName[signature];
  14453. }
  14454. var uniqueName = this._generateUniqueName(upperName);
  14455. this._signatureToName[signature] = uniqueName;
  14456. return uniqueName;
  14457. };
  14458. PlaceholderRegistry.prototype.getUniquePlaceholder = function (name) {
  14459. return this._generateUniqueName(name.toUpperCase());
  14460. };
  14461. // Generate a hash for a tag - does not take attribute order into account
  14462. PlaceholderRegistry.prototype._hashTag = function (tag, attrs, isVoid) {
  14463. var start = "<" + tag;
  14464. var strAttrs = Object.keys(attrs).sort().map(function (name) { return " " + name + "=" + attrs[name]; }).join('');
  14465. var end = isVoid ? '/>' : "></" + tag + ">";
  14466. return start + strAttrs + end;
  14467. };
  14468. PlaceholderRegistry.prototype._hashClosingTag = function (tag) { return this._hashTag("/" + tag, {}, false); };
  14469. PlaceholderRegistry.prototype._generateUniqueName = function (base) {
  14470. var seen = this._placeHolderNameCounts.hasOwnProperty(base);
  14471. if (!seen) {
  14472. this._placeHolderNameCounts[base] = 1;
  14473. return base;
  14474. }
  14475. var id = this._placeHolderNameCounts[base];
  14476. this._placeHolderNameCounts[base] = id + 1;
  14477. return base + "_" + id;
  14478. };
  14479. return PlaceholderRegistry;
  14480. }());
  14481. /**
  14482. * @license
  14483. * Copyright Google Inc. All Rights Reserved.
  14484. *
  14485. * Use of this source code is governed by an MIT-style license that can be
  14486. * found in the LICENSE file at https://angular.io/license
  14487. */
  14488. var _expParser = new Parser(new Lexer());
  14489. /**
  14490. * Returns a function converting html nodes to an i18n Message given an interpolationConfig
  14491. */
  14492. function createI18nMessageFactory(interpolationConfig) {
  14493. var visitor = new _I18nVisitor(_expParser, interpolationConfig);
  14494. return function (nodes, meaning, description, id) {
  14495. return visitor.toI18nMessage(nodes, meaning, description, id);
  14496. };
  14497. }
  14498. var _I18nVisitor = /** @class */ (function () {
  14499. function _I18nVisitor(_expressionParser, _interpolationConfig) {
  14500. this._expressionParser = _expressionParser;
  14501. this._interpolationConfig = _interpolationConfig;
  14502. }
  14503. _I18nVisitor.prototype.toI18nMessage = function (nodes, meaning, description, id) {
  14504. this._isIcu = nodes.length == 1 && nodes[0] instanceof Expansion;
  14505. this._icuDepth = 0;
  14506. this._placeholderRegistry = new PlaceholderRegistry();
  14507. this._placeholderToContent = {};
  14508. this._placeholderToMessage = {};
  14509. var i18nodes = visitAll(this, nodes, {});
  14510. return new Message(i18nodes, this._placeholderToContent, this._placeholderToMessage, meaning, description, id);
  14511. };
  14512. _I18nVisitor.prototype.visitElement = function (el, context) {
  14513. var children = visitAll(this, el.children);
  14514. var attrs = {};
  14515. el.attrs.forEach(function (attr) {
  14516. // Do not visit the attributes, translatable ones are top-level ASTs
  14517. attrs[attr.name] = attr.value;
  14518. });
  14519. var isVoid = getHtmlTagDefinition(el.name).isVoid;
  14520. var startPhName = this._placeholderRegistry.getStartTagPlaceholderName(el.name, attrs, isVoid);
  14521. this._placeholderToContent[startPhName] = el.sourceSpan.toString();
  14522. var closePhName = '';
  14523. if (!isVoid) {
  14524. closePhName = this._placeholderRegistry.getCloseTagPlaceholderName(el.name);
  14525. this._placeholderToContent[closePhName] = "</" + el.name + ">";
  14526. }
  14527. return new TagPlaceholder(el.name, attrs, startPhName, closePhName, children, isVoid, el.sourceSpan);
  14528. };
  14529. _I18nVisitor.prototype.visitAttribute = function (attribute, context) {
  14530. return this._visitTextWithInterpolation(attribute.value, attribute.sourceSpan);
  14531. };
  14532. _I18nVisitor.prototype.visitText = function (text, context) {
  14533. return this._visitTextWithInterpolation(text.value, text.sourceSpan);
  14534. };
  14535. _I18nVisitor.prototype.visitComment = function (comment, context) { return null; };
  14536. _I18nVisitor.prototype.visitExpansion = function (icu, context) {
  14537. var _this = this;
  14538. this._icuDepth++;
  14539. var i18nIcuCases = {};
  14540. var i18nIcu = new Icu(icu.switchValue, icu.type, i18nIcuCases, icu.sourceSpan);
  14541. icu.cases.forEach(function (caze) {
  14542. i18nIcuCases[caze.value] = new Container(caze.expression.map(function (node) { return node.visit(_this, {}); }), caze.expSourceSpan);
  14543. });
  14544. this._icuDepth--;
  14545. if (this._isIcu || this._icuDepth > 0) {
  14546. // Returns an ICU node when:
  14547. // - the message (vs a part of the message) is an ICU message, or
  14548. // - the ICU message is nested.
  14549. var expPh = this._placeholderRegistry.getUniquePlaceholder("VAR_" + icu.type);
  14550. i18nIcu.expressionPlaceholder = expPh;
  14551. this._placeholderToContent[expPh] = icu.switchValue;
  14552. return i18nIcu;
  14553. }
  14554. // Else returns a placeholder
  14555. // ICU placeholders should not be replaced with their original content but with the their
  14556. // translations. We need to create a new visitor (they are not re-entrant) to compute the
  14557. // message id.
  14558. // TODO(vicb): add a html.Node -> i18n.Message cache to avoid having to re-create the msg
  14559. var phName = this._placeholderRegistry.getPlaceholderName('ICU', icu.sourceSpan.toString());
  14560. var visitor = new _I18nVisitor(this._expressionParser, this._interpolationConfig);
  14561. this._placeholderToMessage[phName] = visitor.toI18nMessage([icu], '', '', '');
  14562. return new IcuPlaceholder(i18nIcu, phName, icu.sourceSpan);
  14563. };
  14564. _I18nVisitor.prototype.visitExpansionCase = function (icuCase, context) {
  14565. throw new Error('Unreachable code');
  14566. };
  14567. _I18nVisitor.prototype._visitTextWithInterpolation = function (text, sourceSpan) {
  14568. var splitInterpolation = this._expressionParser.splitInterpolation(text, sourceSpan.start.toString(), this._interpolationConfig);
  14569. if (!splitInterpolation) {
  14570. // No expression, return a single text
  14571. return new Text$1(text, sourceSpan);
  14572. }
  14573. // Return a group of text + expressions
  14574. var nodes = [];
  14575. var container = new Container(nodes, sourceSpan);
  14576. var _a = this._interpolationConfig, sDelimiter = _a.start, eDelimiter = _a.end;
  14577. for (var i = 0; i < splitInterpolation.strings.length - 1; i++) {
  14578. var expression = splitInterpolation.expressions[i];
  14579. var baseName = _extractPlaceholderName(expression) || 'INTERPOLATION';
  14580. var phName = this._placeholderRegistry.getPlaceholderName(baseName, expression);
  14581. if (splitInterpolation.strings[i].length) {
  14582. // No need to add empty strings
  14583. nodes.push(new Text$1(splitInterpolation.strings[i], sourceSpan));
  14584. }
  14585. nodes.push(new Placeholder(expression, phName, sourceSpan));
  14586. this._placeholderToContent[phName] = sDelimiter + expression + eDelimiter;
  14587. }
  14588. // The last index contains no expression
  14589. var lastStringIdx = splitInterpolation.strings.length - 1;
  14590. if (splitInterpolation.strings[lastStringIdx].length) {
  14591. nodes.push(new Text$1(splitInterpolation.strings[lastStringIdx], sourceSpan));
  14592. }
  14593. return container;
  14594. };
  14595. return _I18nVisitor;
  14596. }());
  14597. var _CUSTOM_PH_EXP = /\/\/[\s\S]*i18n[\s\S]*\([\s\S]*ph[\s\S]*=[\s\S]*("|')([\s\S]*?)\1[\s\S]*\)/g;
  14598. function _extractPlaceholderName(input) {
  14599. return input.split(_CUSTOM_PH_EXP)[2];
  14600. }
  14601. /**
  14602. * @license
  14603. * Copyright Google Inc. All Rights Reserved.
  14604. *
  14605. * Use of this source code is governed by an MIT-style license that can be
  14606. * found in the LICENSE file at https://angular.io/license
  14607. */
  14608. /**
  14609. * An i18n error.
  14610. */
  14611. var I18nError = /** @class */ (function (_super) {
  14612. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(I18nError, _super);
  14613. function I18nError(span, msg) {
  14614. return _super.call(this, span, msg) || this;
  14615. }
  14616. return I18nError;
  14617. }(ParseError));
  14618. /**
  14619. * @license
  14620. * Copyright Google Inc. All Rights Reserved.
  14621. *
  14622. * Use of this source code is governed by an MIT-style license that can be
  14623. * found in the LICENSE file at https://angular.io/license
  14624. */
  14625. var _I18N_ATTR = 'i18n';
  14626. var _I18N_ATTR_PREFIX = 'i18n-';
  14627. var _I18N_COMMENT_PREFIX_REGEXP = /^i18n:?/;
  14628. var MEANING_SEPARATOR = '|';
  14629. var ID_SEPARATOR = '@@';
  14630. var i18nCommentsWarned = false;
  14631. /**
  14632. * Extract translatable messages from an html AST
  14633. */
  14634. function extractMessages(nodes, interpolationConfig, implicitTags, implicitAttrs) {
  14635. var visitor = new _Visitor(implicitTags, implicitAttrs);
  14636. return visitor.extract(nodes, interpolationConfig);
  14637. }
  14638. function mergeTranslations(nodes, translations, interpolationConfig, implicitTags, implicitAttrs) {
  14639. var visitor = new _Visitor(implicitTags, implicitAttrs);
  14640. return visitor.merge(nodes, translations, interpolationConfig);
  14641. }
  14642. var ExtractionResult = /** @class */ (function () {
  14643. function ExtractionResult(messages, errors) {
  14644. this.messages = messages;
  14645. this.errors = errors;
  14646. }
  14647. return ExtractionResult;
  14648. }());
  14649. var _VisitorMode;
  14650. (function (_VisitorMode) {
  14651. _VisitorMode[_VisitorMode["Extract"] = 0] = "Extract";
  14652. _VisitorMode[_VisitorMode["Merge"] = 1] = "Merge";
  14653. })(_VisitorMode || (_VisitorMode = {}));
  14654. /**
  14655. * This Visitor is used:
  14656. * 1. to extract all the translatable strings from an html AST (see `extract()`),
  14657. * 2. to replace the translatable strings with the actual translations (see `merge()`)
  14658. *
  14659. * @internal
  14660. */
  14661. var _Visitor = /** @class */ (function () {
  14662. function _Visitor(_implicitTags, _implicitAttrs) {
  14663. this._implicitTags = _implicitTags;
  14664. this._implicitAttrs = _implicitAttrs;
  14665. }
  14666. /**
  14667. * Extracts the messages from the tree
  14668. */
  14669. _Visitor.prototype.extract = function (nodes, interpolationConfig) {
  14670. var _this = this;
  14671. this._init(_VisitorMode.Extract, interpolationConfig);
  14672. nodes.forEach(function (node) { return node.visit(_this, null); });
  14673. if (this._inI18nBlock) {
  14674. this._reportError(nodes[nodes.length - 1], 'Unclosed block');
  14675. }
  14676. return new ExtractionResult(this._messages, this._errors);
  14677. };
  14678. /**
  14679. * Returns a tree where all translatable nodes are translated
  14680. */
  14681. _Visitor.prototype.merge = function (nodes, translations, interpolationConfig) {
  14682. this._init(_VisitorMode.Merge, interpolationConfig);
  14683. this._translations = translations;
  14684. // Construct a single fake root element
  14685. var wrapper = new Element('wrapper', [], nodes, undefined, undefined, undefined);
  14686. var translatedNode = wrapper.visit(this, null);
  14687. if (this._inI18nBlock) {
  14688. this._reportError(nodes[nodes.length - 1], 'Unclosed block');
  14689. }
  14690. return new ParseTreeResult(translatedNode.children, this._errors);
  14691. };
  14692. _Visitor.prototype.visitExpansionCase = function (icuCase, context) {
  14693. // Parse cases for translatable html attributes
  14694. var expression = visitAll(this, icuCase.expression, context);
  14695. if (this._mode === _VisitorMode.Merge) {
  14696. return new ExpansionCase(icuCase.value, expression, icuCase.sourceSpan, icuCase.valueSourceSpan, icuCase.expSourceSpan);
  14697. }
  14698. };
  14699. _Visitor.prototype.visitExpansion = function (icu, context) {
  14700. this._mayBeAddBlockChildren(icu);
  14701. var wasInIcu = this._inIcu;
  14702. if (!this._inIcu) {
  14703. // nested ICU messages should not be extracted but top-level translated as a whole
  14704. if (this._isInTranslatableSection) {
  14705. this._addMessage([icu]);
  14706. }
  14707. this._inIcu = true;
  14708. }
  14709. var cases = visitAll(this, icu.cases, context);
  14710. if (this._mode === _VisitorMode.Merge) {
  14711. icu = new Expansion(icu.switchValue, icu.type, cases, icu.sourceSpan, icu.switchValueSourceSpan);
  14712. }
  14713. this._inIcu = wasInIcu;
  14714. return icu;
  14715. };
  14716. _Visitor.prototype.visitComment = function (comment, context) {
  14717. var isOpening = _isOpeningComment(comment);
  14718. if (isOpening && this._isInTranslatableSection) {
  14719. this._reportError(comment, 'Could not start a block inside a translatable section');
  14720. return;
  14721. }
  14722. var isClosing = _isClosingComment(comment);
  14723. if (isClosing && !this._inI18nBlock) {
  14724. this._reportError(comment, 'Trying to close an unopened block');
  14725. return;
  14726. }
  14727. if (!this._inI18nNode && !this._inIcu) {
  14728. if (!this._inI18nBlock) {
  14729. if (isOpening) {
  14730. // deprecated from v5 you should use <ng-container i18n> instead of i18n comments
  14731. if (!i18nCommentsWarned && console && console.warn) {
  14732. i18nCommentsWarned = true;
  14733. var details = comment.sourceSpan.details ? ", " + comment.sourceSpan.details : '';
  14734. // TODO(ocombe): use a log service once there is a public one available
  14735. console.warn("I18n comments are deprecated, use an <ng-container> element instead (" + comment.sourceSpan.start + details + ")");
  14736. }
  14737. this._inI18nBlock = true;
  14738. this._blockStartDepth = this._depth;
  14739. this._blockChildren = [];
  14740. this._blockMeaningAndDesc =
  14741. comment.value.replace(_I18N_COMMENT_PREFIX_REGEXP, '').trim();
  14742. this._openTranslatableSection(comment);
  14743. }
  14744. }
  14745. else {
  14746. if (isClosing) {
  14747. if (this._depth == this._blockStartDepth) {
  14748. this._closeTranslatableSection(comment, this._blockChildren);
  14749. this._inI18nBlock = false;
  14750. var message = this._addMessage(this._blockChildren, this._blockMeaningAndDesc);
  14751. // merge attributes in sections
  14752. var nodes = this._translateMessage(comment, message);
  14753. return visitAll(this, nodes);
  14754. }
  14755. else {
  14756. this._reportError(comment, 'I18N blocks should not cross element boundaries');
  14757. return;
  14758. }
  14759. }
  14760. }
  14761. }
  14762. };
  14763. _Visitor.prototype.visitText = function (text, context) {
  14764. if (this._isInTranslatableSection) {
  14765. this._mayBeAddBlockChildren(text);
  14766. }
  14767. return text;
  14768. };
  14769. _Visitor.prototype.visitElement = function (el, context) {
  14770. var _this = this;
  14771. this._mayBeAddBlockChildren(el);
  14772. this._depth++;
  14773. var wasInI18nNode = this._inI18nNode;
  14774. var wasInImplicitNode = this._inImplicitNode;
  14775. var childNodes = [];
  14776. var translatedChildNodes = undefined;
  14777. // Extract:
  14778. // - top level nodes with the (implicit) "i18n" attribute if not already in a section
  14779. // - ICU messages
  14780. var i18nAttr = _getI18nAttr(el);
  14781. var i18nMeta = i18nAttr ? i18nAttr.value : '';
  14782. var isImplicit = this._implicitTags.some(function (tag) { return el.name === tag; }) && !this._inIcu &&
  14783. !this._isInTranslatableSection;
  14784. var isTopLevelImplicit = !wasInImplicitNode && isImplicit;
  14785. this._inImplicitNode = wasInImplicitNode || isImplicit;
  14786. if (!this._isInTranslatableSection && !this._inIcu) {
  14787. if (i18nAttr || isTopLevelImplicit) {
  14788. this._inI18nNode = true;
  14789. var message = this._addMessage(el.children, i18nMeta);
  14790. translatedChildNodes = this._translateMessage(el, message);
  14791. }
  14792. if (this._mode == _VisitorMode.Extract) {
  14793. var isTranslatable = i18nAttr || isTopLevelImplicit;
  14794. if (isTranslatable)
  14795. this._openTranslatableSection(el);
  14796. visitAll(this, el.children);
  14797. if (isTranslatable)
  14798. this._closeTranslatableSection(el, el.children);
  14799. }
  14800. }
  14801. else {
  14802. if (i18nAttr || isTopLevelImplicit) {
  14803. this._reportError(el, 'Could not mark an element as translatable inside a translatable section');
  14804. }
  14805. if (this._mode == _VisitorMode.Extract) {
  14806. // Descend into child nodes for extraction
  14807. visitAll(this, el.children);
  14808. }
  14809. }
  14810. if (this._mode === _VisitorMode.Merge) {
  14811. var visitNodes = translatedChildNodes || el.children;
  14812. visitNodes.forEach(function (child) {
  14813. var visited = child.visit(_this, context);
  14814. if (visited && !_this._isInTranslatableSection) {
  14815. // Do not add the children from translatable sections (= i18n blocks here)
  14816. // They will be added later in this loop when the block closes (i.e. on `<!-- /i18n -->`)
  14817. childNodes = childNodes.concat(visited);
  14818. }
  14819. });
  14820. }
  14821. this._visitAttributesOf(el);
  14822. this._depth--;
  14823. this._inI18nNode = wasInI18nNode;
  14824. this._inImplicitNode = wasInImplicitNode;
  14825. if (this._mode === _VisitorMode.Merge) {
  14826. var translatedAttrs = this._translateAttributes(el);
  14827. return new Element(el.name, translatedAttrs, childNodes, el.sourceSpan, el.startSourceSpan, el.endSourceSpan);
  14828. }
  14829. return null;
  14830. };
  14831. _Visitor.prototype.visitAttribute = function (attribute, context) {
  14832. throw new Error('unreachable code');
  14833. };
  14834. _Visitor.prototype._init = function (mode, interpolationConfig) {
  14835. this._mode = mode;
  14836. this._inI18nBlock = false;
  14837. this._inI18nNode = false;
  14838. this._depth = 0;
  14839. this._inIcu = false;
  14840. this._msgCountAtSectionStart = undefined;
  14841. this._errors = [];
  14842. this._messages = [];
  14843. this._inImplicitNode = false;
  14844. this._createI18nMessage = createI18nMessageFactory(interpolationConfig);
  14845. };
  14846. // looks for translatable attributes
  14847. _Visitor.prototype._visitAttributesOf = function (el) {
  14848. var _this = this;
  14849. var explicitAttrNameToValue = {};
  14850. var implicitAttrNames = this._implicitAttrs[el.name] || [];
  14851. el.attrs.filter(function (attr) { return attr.name.startsWith(_I18N_ATTR_PREFIX); })
  14852. .forEach(function (attr) { return explicitAttrNameToValue[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
  14853. attr.value; });
  14854. el.attrs.forEach(function (attr) {
  14855. if (attr.name in explicitAttrNameToValue) {
  14856. _this._addMessage([attr], explicitAttrNameToValue[attr.name]);
  14857. }
  14858. else if (implicitAttrNames.some(function (name) { return attr.name === name; })) {
  14859. _this._addMessage([attr]);
  14860. }
  14861. });
  14862. };
  14863. // add a translatable message
  14864. _Visitor.prototype._addMessage = function (ast, msgMeta) {
  14865. if (ast.length == 0 ||
  14866. ast.length == 1 && ast[0] instanceof Attribute && !ast[0].value) {
  14867. // Do not create empty messages
  14868. return null;
  14869. }
  14870. var _a = _parseMessageMeta(msgMeta), meaning = _a.meaning, description = _a.description, id = _a.id;
  14871. var message = this._createI18nMessage(ast, meaning, description, id);
  14872. this._messages.push(message);
  14873. return message;
  14874. };
  14875. // Translates the given message given the `TranslationBundle`
  14876. // This is used for translating elements / blocks - see `_translateAttributes` for attributes
  14877. // no-op when called in extraction mode (returns [])
  14878. _Visitor.prototype._translateMessage = function (el, message) {
  14879. if (message && this._mode === _VisitorMode.Merge) {
  14880. var nodes = this._translations.get(message);
  14881. if (nodes) {
  14882. return nodes;
  14883. }
  14884. this._reportError(el, "Translation unavailable for message id=\"" + this._translations.digest(message) + "\"");
  14885. }
  14886. return [];
  14887. };
  14888. // translate the attributes of an element and remove i18n specific attributes
  14889. _Visitor.prototype._translateAttributes = function (el) {
  14890. var _this = this;
  14891. var attributes = el.attrs;
  14892. var i18nParsedMessageMeta = {};
  14893. attributes.forEach(function (attr) {
  14894. if (attr.name.startsWith(_I18N_ATTR_PREFIX)) {
  14895. i18nParsedMessageMeta[attr.name.slice(_I18N_ATTR_PREFIX.length)] =
  14896. _parseMessageMeta(attr.value);
  14897. }
  14898. });
  14899. var translatedAttributes = [];
  14900. attributes.forEach(function (attr) {
  14901. if (attr.name === _I18N_ATTR || attr.name.startsWith(_I18N_ATTR_PREFIX)) {
  14902. // strip i18n specific attributes
  14903. return;
  14904. }
  14905. if (attr.value && attr.value != '' && i18nParsedMessageMeta.hasOwnProperty(attr.name)) {
  14906. var _a = i18nParsedMessageMeta[attr.name], meaning = _a.meaning, description = _a.description, id = _a.id;
  14907. var message = _this._createI18nMessage([attr], meaning, description, id);
  14908. var nodes = _this._translations.get(message);
  14909. if (nodes) {
  14910. if (nodes.length == 0) {
  14911. translatedAttributes.push(new Attribute(attr.name, '', attr.sourceSpan));
  14912. }
  14913. else if (nodes[0] instanceof Text) {
  14914. var value = nodes[0].value;
  14915. translatedAttributes.push(new Attribute(attr.name, value, attr.sourceSpan));
  14916. }
  14917. else {
  14918. _this._reportError(el, "Unexpected translation for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
  14919. }
  14920. }
  14921. else {
  14922. _this._reportError(el, "Translation unavailable for attribute \"" + attr.name + "\" (id=\"" + (id || _this._translations.digest(message)) + "\")");
  14923. }
  14924. }
  14925. else {
  14926. translatedAttributes.push(attr);
  14927. }
  14928. });
  14929. return translatedAttributes;
  14930. };
  14931. /**
  14932. * Add the node as a child of the block when:
  14933. * - we are in a block,
  14934. * - we are not inside a ICU message (those are handled separately),
  14935. * - the node is a "direct child" of the block
  14936. */
  14937. _Visitor.prototype._mayBeAddBlockChildren = function (node) {
  14938. if (this._inI18nBlock && !this._inIcu && this._depth == this._blockStartDepth) {
  14939. this._blockChildren.push(node);
  14940. }
  14941. };
  14942. /**
  14943. * Marks the start of a section, see `_closeTranslatableSection`
  14944. */
  14945. _Visitor.prototype._openTranslatableSection = function (node) {
  14946. if (this._isInTranslatableSection) {
  14947. this._reportError(node, 'Unexpected section start');
  14948. }
  14949. else {
  14950. this._msgCountAtSectionStart = this._messages.length;
  14951. }
  14952. };
  14953. Object.defineProperty(_Visitor.prototype, "_isInTranslatableSection", {
  14954. /**
  14955. * A translatable section could be:
  14956. * - the content of translatable element,
  14957. * - nodes between `<!-- i18n -->` and `<!-- /i18n -->` comments
  14958. */
  14959. get: function () {
  14960. return this._msgCountAtSectionStart !== void 0;
  14961. },
  14962. enumerable: true,
  14963. configurable: true
  14964. });
  14965. /**
  14966. * Terminates a section.
  14967. *
  14968. * If a section has only one significant children (comments not significant) then we should not
  14969. * keep the message from this children:
  14970. *
  14971. * `<p i18n="meaning|description">{ICU message}</p>` would produce two messages:
  14972. * - one for the <p> content with meaning and description,
  14973. * - another one for the ICU message.
  14974. *
  14975. * In this case the last message is discarded as it contains less information (the AST is
  14976. * otherwise identical).
  14977. *
  14978. * Note that we should still keep messages extracted from attributes inside the section (ie in the
  14979. * ICU message here)
  14980. */
  14981. _Visitor.prototype._closeTranslatableSection = function (node, directChildren) {
  14982. if (!this._isInTranslatableSection) {
  14983. this._reportError(node, 'Unexpected section end');
  14984. return;
  14985. }
  14986. var startIndex = this._msgCountAtSectionStart;
  14987. var significantChildren = directChildren.reduce(function (count, node) { return count + (node instanceof Comment ? 0 : 1); }, 0);
  14988. if (significantChildren == 1) {
  14989. for (var i = this._messages.length - 1; i >= startIndex; i--) {
  14990. var ast = this._messages[i].nodes;
  14991. if (!(ast.length == 1 && ast[0] instanceof Text$1)) {
  14992. this._messages.splice(i, 1);
  14993. break;
  14994. }
  14995. }
  14996. }
  14997. this._msgCountAtSectionStart = undefined;
  14998. };
  14999. _Visitor.prototype._reportError = function (node, msg) {
  15000. this._errors.push(new I18nError(node.sourceSpan, msg));
  15001. };
  15002. return _Visitor;
  15003. }());
  15004. function _isOpeningComment(n) {
  15005. return !!(n instanceof Comment && n.value && n.value.startsWith('i18n'));
  15006. }
  15007. function _isClosingComment(n) {
  15008. return !!(n instanceof Comment && n.value && n.value === '/i18n');
  15009. }
  15010. function _getI18nAttr(p) {
  15011. return p.attrs.find(function (attr) { return attr.name === _I18N_ATTR; }) || null;
  15012. }
  15013. function _parseMessageMeta(i18n) {
  15014. if (!i18n)
  15015. return { meaning: '', description: '', id: '' };
  15016. var idIndex = i18n.indexOf(ID_SEPARATOR);
  15017. var descIndex = i18n.indexOf(MEANING_SEPARATOR);
  15018. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])((idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], 2), meaningAndDesc = _a[0], id = _a[1];
  15019. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])((descIndex > -1) ?
  15020. [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] :
  15021. ['', meaningAndDesc], 2), meaning = _b[0], description = _b[1];
  15022. return { meaning: meaning, description: description, id: id };
  15023. }
  15024. /**
  15025. * @license
  15026. * Copyright Google Inc. All Rights Reserved.
  15027. *
  15028. * Use of this source code is governed by an MIT-style license that can be
  15029. * found in the LICENSE file at https://angular.io/license
  15030. */
  15031. var XmlTagDefinition = /** @class */ (function () {
  15032. function XmlTagDefinition() {
  15033. this.closedByParent = false;
  15034. this.contentType = TagContentType.PARSABLE_DATA;
  15035. this.isVoid = false;
  15036. this.ignoreFirstLf = false;
  15037. this.canSelfClose = true;
  15038. }
  15039. XmlTagDefinition.prototype.requireExtraParent = function (currentParent) { return false; };
  15040. XmlTagDefinition.prototype.isClosedByChild = function (name) { return false; };
  15041. return XmlTagDefinition;
  15042. }());
  15043. var _TAG_DEFINITION = new XmlTagDefinition();
  15044. function getXmlTagDefinition(tagName) {
  15045. return _TAG_DEFINITION;
  15046. }
  15047. /**
  15048. * @license
  15049. * Copyright Google Inc. All Rights Reserved.
  15050. *
  15051. * Use of this source code is governed by an MIT-style license that can be
  15052. * found in the LICENSE file at https://angular.io/license
  15053. */
  15054. var XmlParser = /** @class */ (function (_super) {
  15055. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(XmlParser, _super);
  15056. function XmlParser() {
  15057. return _super.call(this, getXmlTagDefinition) || this;
  15058. }
  15059. XmlParser.prototype.parse = function (source, url, parseExpansionForms) {
  15060. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  15061. return _super.prototype.parse.call(this, source, url, parseExpansionForms);
  15062. };
  15063. return XmlParser;
  15064. }(Parser$1));
  15065. /**
  15066. * @license
  15067. * Copyright Google Inc. All Rights Reserved.
  15068. *
  15069. * Use of this source code is governed by an MIT-style license that can be
  15070. * found in the LICENSE file at https://angular.io/license
  15071. */
  15072. var Serializer = /** @class */ (function () {
  15073. function Serializer() {
  15074. }
  15075. // Creates a name mapper, see `PlaceholderMapper`
  15076. // Returning `null` means that no name mapping is used.
  15077. Serializer.prototype.createNameMapper = function (message) { return null; };
  15078. return Serializer;
  15079. }());
  15080. /**
  15081. * A simple mapper that take a function to transform an internal name to a public name
  15082. */
  15083. var SimplePlaceholderMapper = /** @class */ (function (_super) {
  15084. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SimplePlaceholderMapper, _super);
  15085. // create a mapping from the message
  15086. function SimplePlaceholderMapper(message, mapName) {
  15087. var _this = _super.call(this) || this;
  15088. _this.mapName = mapName;
  15089. _this.internalToPublic = {};
  15090. _this.publicToNextId = {};
  15091. _this.publicToInternal = {};
  15092. message.nodes.forEach(function (node) { return node.visit(_this); });
  15093. return _this;
  15094. }
  15095. SimplePlaceholderMapper.prototype.toPublicName = function (internalName) {
  15096. return this.internalToPublic.hasOwnProperty(internalName) ?
  15097. this.internalToPublic[internalName] :
  15098. null;
  15099. };
  15100. SimplePlaceholderMapper.prototype.toInternalName = function (publicName) {
  15101. return this.publicToInternal.hasOwnProperty(publicName) ? this.publicToInternal[publicName] :
  15102. null;
  15103. };
  15104. SimplePlaceholderMapper.prototype.visitText = function (text, context) { return null; };
  15105. SimplePlaceholderMapper.prototype.visitTagPlaceholder = function (ph, context) {
  15106. this.visitPlaceholderName(ph.startName);
  15107. _super.prototype.visitTagPlaceholder.call(this, ph, context);
  15108. this.visitPlaceholderName(ph.closeName);
  15109. };
  15110. SimplePlaceholderMapper.prototype.visitPlaceholder = function (ph, context) { this.visitPlaceholderName(ph.name); };
  15111. SimplePlaceholderMapper.prototype.visitIcuPlaceholder = function (ph, context) {
  15112. this.visitPlaceholderName(ph.name);
  15113. };
  15114. // XMB placeholders could only contains A-Z, 0-9 and _
  15115. SimplePlaceholderMapper.prototype.visitPlaceholderName = function (internalName) {
  15116. if (!internalName || this.internalToPublic.hasOwnProperty(internalName)) {
  15117. return;
  15118. }
  15119. var publicName = this.mapName(internalName);
  15120. if (this.publicToInternal.hasOwnProperty(publicName)) {
  15121. // Create a new XMB when it has already been used
  15122. var nextId = this.publicToNextId[publicName];
  15123. this.publicToNextId[publicName] = nextId + 1;
  15124. publicName = publicName + "_" + nextId;
  15125. }
  15126. else {
  15127. this.publicToNextId[publicName] = 1;
  15128. }
  15129. this.internalToPublic[internalName] = publicName;
  15130. this.publicToInternal[publicName] = internalName;
  15131. };
  15132. return SimplePlaceholderMapper;
  15133. }(RecurseVisitor));
  15134. /**
  15135. * @license
  15136. * Copyright Google Inc. All Rights Reserved.
  15137. *
  15138. * Use of this source code is governed by an MIT-style license that can be
  15139. * found in the LICENSE file at https://angular.io/license
  15140. */
  15141. var _Visitor$1 = /** @class */ (function () {
  15142. function _Visitor() {
  15143. }
  15144. _Visitor.prototype.visitTag = function (tag) {
  15145. var _this = this;
  15146. var strAttrs = this._serializeAttributes(tag.attrs);
  15147. if (tag.children.length == 0) {
  15148. return "<" + tag.name + strAttrs + "/>";
  15149. }
  15150. var strChildren = tag.children.map(function (node) { return node.visit(_this); });
  15151. return "<" + tag.name + strAttrs + ">" + strChildren.join('') + "</" + tag.name + ">";
  15152. };
  15153. _Visitor.prototype.visitText = function (text) { return text.value; };
  15154. _Visitor.prototype.visitDeclaration = function (decl) {
  15155. return "<?xml" + this._serializeAttributes(decl.attrs) + " ?>";
  15156. };
  15157. _Visitor.prototype._serializeAttributes = function (attrs) {
  15158. var strAttrs = Object.keys(attrs).map(function (name) { return name + "=\"" + attrs[name] + "\""; }).join(' ');
  15159. return strAttrs.length > 0 ? ' ' + strAttrs : '';
  15160. };
  15161. _Visitor.prototype.visitDoctype = function (doctype) {
  15162. return "<!DOCTYPE " + doctype.rootTag + " [\n" + doctype.dtd + "\n]>";
  15163. };
  15164. return _Visitor;
  15165. }());
  15166. var _visitor = new _Visitor$1();
  15167. function serialize(nodes) {
  15168. return nodes.map(function (node) { return node.visit(_visitor); }).join('');
  15169. }
  15170. var Declaration = /** @class */ (function () {
  15171. function Declaration(unescapedAttrs) {
  15172. var _this = this;
  15173. this.attrs = {};
  15174. Object.keys(unescapedAttrs).forEach(function (k) {
  15175. _this.attrs[k] = escapeXml(unescapedAttrs[k]);
  15176. });
  15177. }
  15178. Declaration.prototype.visit = function (visitor) { return visitor.visitDeclaration(this); };
  15179. return Declaration;
  15180. }());
  15181. var Doctype = /** @class */ (function () {
  15182. function Doctype(rootTag, dtd) {
  15183. this.rootTag = rootTag;
  15184. this.dtd = dtd;
  15185. }
  15186. Doctype.prototype.visit = function (visitor) { return visitor.visitDoctype(this); };
  15187. return Doctype;
  15188. }());
  15189. var Tag = /** @class */ (function () {
  15190. function Tag(name, unescapedAttrs, children) {
  15191. if (unescapedAttrs === void 0) { unescapedAttrs = {}; }
  15192. if (children === void 0) { children = []; }
  15193. var _this = this;
  15194. this.name = name;
  15195. this.children = children;
  15196. this.attrs = {};
  15197. Object.keys(unescapedAttrs).forEach(function (k) {
  15198. _this.attrs[k] = escapeXml(unescapedAttrs[k]);
  15199. });
  15200. }
  15201. Tag.prototype.visit = function (visitor) { return visitor.visitTag(this); };
  15202. return Tag;
  15203. }());
  15204. var Text$2 = /** @class */ (function () {
  15205. function Text(unescapedValue) {
  15206. this.value = escapeXml(unescapedValue);
  15207. }
  15208. Text.prototype.visit = function (visitor) { return visitor.visitText(this); };
  15209. return Text;
  15210. }());
  15211. var CR = /** @class */ (function (_super) {
  15212. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CR, _super);
  15213. function CR(ws) {
  15214. if (ws === void 0) { ws = 0; }
  15215. return _super.call(this, "\n" + new Array(ws + 1).join(' ')) || this;
  15216. }
  15217. return CR;
  15218. }(Text$2));
  15219. var _ESCAPED_CHARS = [
  15220. [/&/g, '&amp;'],
  15221. [/"/g, '&quot;'],
  15222. [/'/g, '&apos;'],
  15223. [/</g, '&lt;'],
  15224. [/>/g, '&gt;'],
  15225. ];
  15226. // Escape `_ESCAPED_CHARS` characters in the given text with encoded entities
  15227. function escapeXml(text) {
  15228. return _ESCAPED_CHARS.reduce(function (text, entry) { return text.replace(entry[0], entry[1]); }, text);
  15229. }
  15230. /**
  15231. * @license
  15232. * Copyright Google Inc. All Rights Reserved.
  15233. *
  15234. * Use of this source code is governed by an MIT-style license that can be
  15235. * found in the LICENSE file at https://angular.io/license
  15236. */
  15237. var _VERSION = '1.2';
  15238. var _XMLNS = 'urn:oasis:names:tc:xliff:document:1.2';
  15239. // TODO(vicb): make this a param (s/_/-/)
  15240. var _DEFAULT_SOURCE_LANG = 'en';
  15241. var _PLACEHOLDER_TAG = 'x';
  15242. var _MARKER_TAG = 'mrk';
  15243. var _FILE_TAG = 'file';
  15244. var _SOURCE_TAG = 'source';
  15245. var _SEGMENT_SOURCE_TAG = 'seg-source';
  15246. var _TARGET_TAG = 'target';
  15247. var _UNIT_TAG = 'trans-unit';
  15248. var _CONTEXT_GROUP_TAG = 'context-group';
  15249. var _CONTEXT_TAG = 'context';
  15250. // http://docs.oasis-open.org/xliff/v1.2/os/xliff-core.html
  15251. // http://docs.oasis-open.org/xliff/v1.2/xliff-profile-html/xliff-profile-html-1.2.html
  15252. var Xliff = /** @class */ (function (_super) {
  15253. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Xliff, _super);
  15254. function Xliff() {
  15255. return _super !== null && _super.apply(this, arguments) || this;
  15256. }
  15257. Xliff.prototype.write = function (messages, locale) {
  15258. var visitor = new _WriteVisitor();
  15259. var transUnits = [];
  15260. messages.forEach(function (message) {
  15261. var _a;
  15262. var contextTags = [];
  15263. message.sources.forEach(function (source) {
  15264. var contextGroupTag = new Tag(_CONTEXT_GROUP_TAG, { purpose: 'location' });
  15265. 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));
  15266. contextTags.push(new CR(8), contextGroupTag);
  15267. });
  15268. var transUnit = new Tag(_UNIT_TAG, { id: message.id, datatype: 'html' });
  15269. (_a = transUnit.children).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([new CR(8), new Tag(_SOURCE_TAG, {}, visitor.serialize(message.nodes))], contextTags));
  15270. if (message.description) {
  15271. transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'description' }, [new Text$2(message.description)]));
  15272. }
  15273. if (message.meaning) {
  15274. transUnit.children.push(new CR(8), new Tag('note', { priority: '1', from: 'meaning' }, [new Text$2(message.meaning)]));
  15275. }
  15276. transUnit.children.push(new CR(6));
  15277. transUnits.push(new CR(6), transUnit);
  15278. });
  15279. var body = new Tag('body', {}, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(transUnits, [new CR(4)]));
  15280. var file = new Tag('file', {
  15281. 'source-language': locale || _DEFAULT_SOURCE_LANG,
  15282. datatype: 'plaintext',
  15283. original: 'ng2.template',
  15284. }, [new CR(4), body, new CR(2)]);
  15285. var xliff = new Tag('xliff', { version: _VERSION, xmlns: _XMLNS }, [new CR(2), file, new CR()]);
  15286. return serialize([
  15287. new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
  15288. ]);
  15289. };
  15290. Xliff.prototype.load = function (content, url) {
  15291. // xliff to xml nodes
  15292. var xliffParser = new XliffParser();
  15293. var _a = xliffParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
  15294. // xml nodes to i18n nodes
  15295. var i18nNodesByMsgId = {};
  15296. var converter = new XmlToI18n();
  15297. Object.keys(msgIdToHtml).forEach(function (msgId) {
  15298. var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
  15299. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(e));
  15300. i18nNodesByMsgId[msgId] = i18nNodes;
  15301. });
  15302. if (errors.length) {
  15303. throw new Error("xliff parse errors:\n" + errors.join('\n'));
  15304. }
  15305. return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId };
  15306. };
  15307. Xliff.prototype.digest = function (message) { return digest(message); };
  15308. return Xliff;
  15309. }(Serializer));
  15310. var _WriteVisitor = /** @class */ (function () {
  15311. function _WriteVisitor() {
  15312. }
  15313. _WriteVisitor.prototype.visitText = function (text, context) { return [new Text$2(text.value)]; };
  15314. _WriteVisitor.prototype.visitContainer = function (container, context) {
  15315. var _this = this;
  15316. var nodes = [];
  15317. container.children.forEach(function (node) { return nodes.push.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(node.visit(_this))); });
  15318. return nodes;
  15319. };
  15320. _WriteVisitor.prototype.visitIcu = function (icu, context) {
  15321. var _this = this;
  15322. var nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
  15323. Object.keys(icu.cases).forEach(function (c) {
  15324. nodes.push.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([new Text$2(c + " {")], icu.cases[c].visit(_this), [new Text$2("} ")]));
  15325. });
  15326. nodes.push(new Text$2("}"));
  15327. return nodes;
  15328. };
  15329. _WriteVisitor.prototype.visitTagPlaceholder = function (ph, context) {
  15330. var ctype = getCtypeForTag(ph.tag);
  15331. if (ph.isVoid) {
  15332. // void tags have no children nor closing tags
  15333. return [new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + "/>" })];
  15334. }
  15335. var startTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.startName, ctype: ctype, 'equiv-text': "<" + ph.tag + ">" });
  15336. var closeTagPh = new Tag(_PLACEHOLDER_TAG, { id: ph.closeName, ctype: ctype, 'equiv-text': "</" + ph.tag + ">" });
  15337. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([startTagPh], this.serialize(ph.children), [closeTagPh]);
  15338. };
  15339. _WriteVisitor.prototype.visitPlaceholder = function (ph, context) {
  15340. return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': "{{" + ph.value + "}}" })];
  15341. };
  15342. _WriteVisitor.prototype.visitIcuPlaceholder = function (ph, context) {
  15343. var equivText = "{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}";
  15344. return [new Tag(_PLACEHOLDER_TAG, { id: ph.name, 'equiv-text': equivText })];
  15345. };
  15346. _WriteVisitor.prototype.serialize = function (nodes) {
  15347. var _this = this;
  15348. return [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(nodes.map(function (node) { return node.visit(_this); })));
  15349. };
  15350. return _WriteVisitor;
  15351. }());
  15352. // TODO(vicb): add error management (structure)
  15353. // Extract messages as xml nodes from the xliff file
  15354. var XliffParser = /** @class */ (function () {
  15355. function XliffParser() {
  15356. this._locale = null;
  15357. }
  15358. XliffParser.prototype.parse = function (xliff, url) {
  15359. this._unitMlString = null;
  15360. this._msgIdToHtml = {};
  15361. var xml = new XmlParser().parse(xliff, url, false);
  15362. this._errors = xml.errors;
  15363. visitAll(this, xml.rootNodes, null);
  15364. return {
  15365. msgIdToHtml: this._msgIdToHtml,
  15366. errors: this._errors,
  15367. locale: this._locale,
  15368. };
  15369. };
  15370. XliffParser.prototype.visitElement = function (element, context) {
  15371. switch (element.name) {
  15372. case _UNIT_TAG:
  15373. this._unitMlString = null;
  15374. var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
  15375. if (!idAttr) {
  15376. this._addError(element, "<" + _UNIT_TAG + "> misses the \"id\" attribute");
  15377. }
  15378. else {
  15379. var id = idAttr.value;
  15380. if (this._msgIdToHtml.hasOwnProperty(id)) {
  15381. this._addError(element, "Duplicated translations for msg " + id);
  15382. }
  15383. else {
  15384. visitAll(this, element.children, null);
  15385. if (typeof this._unitMlString === 'string') {
  15386. this._msgIdToHtml[id] = this._unitMlString;
  15387. }
  15388. else {
  15389. this._addError(element, "Message " + id + " misses a translation");
  15390. }
  15391. }
  15392. }
  15393. break;
  15394. // ignore those tags
  15395. case _SOURCE_TAG:
  15396. case _SEGMENT_SOURCE_TAG:
  15397. break;
  15398. case _TARGET_TAG:
  15399. var innerTextStart = element.startSourceSpan.end.offset;
  15400. var innerTextEnd = element.endSourceSpan.start.offset;
  15401. var content = element.startSourceSpan.start.file.content;
  15402. var innerText = content.slice(innerTextStart, innerTextEnd);
  15403. this._unitMlString = innerText;
  15404. break;
  15405. case _FILE_TAG:
  15406. var localeAttr = element.attrs.find(function (attr) { return attr.name === 'target-language'; });
  15407. if (localeAttr) {
  15408. this._locale = localeAttr.value;
  15409. }
  15410. visitAll(this, element.children, null);
  15411. break;
  15412. default:
  15413. // TODO(vicb): assert file structure, xliff version
  15414. // For now only recurse on unhandled nodes
  15415. visitAll(this, element.children, null);
  15416. }
  15417. };
  15418. XliffParser.prototype.visitAttribute = function (attribute, context) { };
  15419. XliffParser.prototype.visitText = function (text, context) { };
  15420. XliffParser.prototype.visitComment = function (comment, context) { };
  15421. XliffParser.prototype.visitExpansion = function (expansion, context) { };
  15422. XliffParser.prototype.visitExpansionCase = function (expansionCase, context) { };
  15423. XliffParser.prototype._addError = function (node, message) {
  15424. this._errors.push(new I18nError(node.sourceSpan, message));
  15425. };
  15426. return XliffParser;
  15427. }());
  15428. // Convert ml nodes (xliff syntax) to i18n nodes
  15429. var XmlToI18n = /** @class */ (function () {
  15430. function XmlToI18n() {
  15431. }
  15432. XmlToI18n.prototype.convert = function (message, url) {
  15433. var xmlIcu = new XmlParser().parse(message, url, true);
  15434. this._errors = xmlIcu.errors;
  15435. var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
  15436. [] : [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(visitAll(this, xmlIcu.rootNodes)));
  15437. return {
  15438. i18nNodes: i18nNodes,
  15439. errors: this._errors,
  15440. };
  15441. };
  15442. XmlToI18n.prototype.visitText = function (text, context) { return new Text$1(text.value, text.sourceSpan); };
  15443. XmlToI18n.prototype.visitElement = function (el, context) {
  15444. if (el.name === _PLACEHOLDER_TAG) {
  15445. var nameAttr = el.attrs.find(function (attr) { return attr.name === 'id'; });
  15446. if (nameAttr) {
  15447. return new Placeholder('', nameAttr.value, el.sourceSpan);
  15448. }
  15449. this._addError(el, "<" + _PLACEHOLDER_TAG + "> misses the \"id\" attribute");
  15450. return null;
  15451. }
  15452. if (el.name === _MARKER_TAG) {
  15453. return [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(visitAll(this, el.children)));
  15454. }
  15455. this._addError(el, "Unexpected tag");
  15456. return null;
  15457. };
  15458. XmlToI18n.prototype.visitExpansion = function (icu, context) {
  15459. var caseMap = {};
  15460. visitAll(this, icu.cases).forEach(function (c) {
  15461. caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
  15462. });
  15463. return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
  15464. };
  15465. XmlToI18n.prototype.visitExpansionCase = function (icuCase, context) {
  15466. return {
  15467. value: icuCase.value,
  15468. nodes: visitAll(this, icuCase.expression),
  15469. };
  15470. };
  15471. XmlToI18n.prototype.visitComment = function (comment, context) { };
  15472. XmlToI18n.prototype.visitAttribute = function (attribute, context) { };
  15473. XmlToI18n.prototype._addError = function (node, message) {
  15474. this._errors.push(new I18nError(node.sourceSpan, message));
  15475. };
  15476. return XmlToI18n;
  15477. }());
  15478. function getCtypeForTag(tag) {
  15479. switch (tag.toLowerCase()) {
  15480. case 'br':
  15481. return 'lb';
  15482. case 'img':
  15483. return 'image';
  15484. default:
  15485. return "x-" + tag;
  15486. }
  15487. }
  15488. /**
  15489. * @license
  15490. * Copyright Google Inc. All Rights Reserved.
  15491. *
  15492. * Use of this source code is governed by an MIT-style license that can be
  15493. * found in the LICENSE file at https://angular.io/license
  15494. */
  15495. var _VERSION$1 = '2.0';
  15496. var _XMLNS$1 = 'urn:oasis:names:tc:xliff:document:2.0';
  15497. // TODO(vicb): make this a param (s/_/-/)
  15498. var _DEFAULT_SOURCE_LANG$1 = 'en';
  15499. var _PLACEHOLDER_TAG$1 = 'ph';
  15500. var _PLACEHOLDER_SPANNING_TAG = 'pc';
  15501. var _MARKER_TAG$1 = 'mrk';
  15502. var _XLIFF_TAG = 'xliff';
  15503. var _SOURCE_TAG$1 = 'source';
  15504. var _TARGET_TAG$1 = 'target';
  15505. var _UNIT_TAG$1 = 'unit';
  15506. // http://docs.oasis-open.org/xliff/xliff-core/v2.0/os/xliff-core-v2.0-os.html
  15507. var Xliff2 = /** @class */ (function (_super) {
  15508. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Xliff2, _super);
  15509. function Xliff2() {
  15510. return _super !== null && _super.apply(this, arguments) || this;
  15511. }
  15512. Xliff2.prototype.write = function (messages, locale) {
  15513. var visitor = new _WriteVisitor$1();
  15514. var units = [];
  15515. messages.forEach(function (message) {
  15516. var unit = new Tag(_UNIT_TAG$1, { id: message.id });
  15517. var notes = new Tag('notes');
  15518. if (message.description || message.meaning) {
  15519. if (message.description) {
  15520. notes.children.push(new CR(8), new Tag('note', { category: 'description' }, [new Text$2(message.description)]));
  15521. }
  15522. if (message.meaning) {
  15523. notes.children.push(new CR(8), new Tag('note', { category: 'meaning' }, [new Text$2(message.meaning)]));
  15524. }
  15525. }
  15526. message.sources.forEach(function (source) {
  15527. notes.children.push(new CR(8), new Tag('note', { category: 'location' }, [
  15528. new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
  15529. ]));
  15530. });
  15531. notes.children.push(new CR(6));
  15532. unit.children.push(new CR(6), notes);
  15533. var segment = new Tag('segment');
  15534. segment.children.push(new CR(8), new Tag(_SOURCE_TAG$1, {}, visitor.serialize(message.nodes)), new CR(6));
  15535. unit.children.push(new CR(6), segment, new CR(4));
  15536. units.push(new CR(4), unit);
  15537. });
  15538. var file = new Tag('file', { 'original': 'ng.template', id: 'ngi18n' }, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(units, [new CR(2)]));
  15539. var xliff = new Tag(_XLIFF_TAG, { version: _VERSION$1, xmlns: _XMLNS$1, srcLang: locale || _DEFAULT_SOURCE_LANG$1 }, [new CR(2), file, new CR()]);
  15540. return serialize([
  15541. new Declaration({ version: '1.0', encoding: 'UTF-8' }), new CR(), xliff, new CR()
  15542. ]);
  15543. };
  15544. Xliff2.prototype.load = function (content, url) {
  15545. // xliff to xml nodes
  15546. var xliff2Parser = new Xliff2Parser();
  15547. var _a = xliff2Parser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
  15548. // xml nodes to i18n nodes
  15549. var i18nNodesByMsgId = {};
  15550. var converter = new XmlToI18n$1();
  15551. Object.keys(msgIdToHtml).forEach(function (msgId) {
  15552. var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, e = _a.errors;
  15553. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(e));
  15554. i18nNodesByMsgId[msgId] = i18nNodes;
  15555. });
  15556. if (errors.length) {
  15557. throw new Error("xliff2 parse errors:\n" + errors.join('\n'));
  15558. }
  15559. return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId };
  15560. };
  15561. Xliff2.prototype.digest = function (message) { return decimalDigest(message); };
  15562. return Xliff2;
  15563. }(Serializer));
  15564. var _WriteVisitor$1 = /** @class */ (function () {
  15565. function _WriteVisitor() {
  15566. }
  15567. _WriteVisitor.prototype.visitText = function (text, context) { return [new Text$2(text.value)]; };
  15568. _WriteVisitor.prototype.visitContainer = function (container, context) {
  15569. var _this = this;
  15570. var nodes = [];
  15571. container.children.forEach(function (node) { return nodes.push.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(node.visit(_this))); });
  15572. return nodes;
  15573. };
  15574. _WriteVisitor.prototype.visitIcu = function (icu, context) {
  15575. var _this = this;
  15576. var nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
  15577. Object.keys(icu.cases).forEach(function (c) {
  15578. nodes.push.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([new Text$2(c + " {")], icu.cases[c].visit(_this), [new Text$2("} ")]));
  15579. });
  15580. nodes.push(new Text$2("}"));
  15581. return nodes;
  15582. };
  15583. _WriteVisitor.prototype.visitTagPlaceholder = function (ph, context) {
  15584. var _this = this;
  15585. var type = getTypeForTag(ph.tag);
  15586. if (ph.isVoid) {
  15587. var tagPh = new Tag(_PLACEHOLDER_TAG$1, {
  15588. id: (this._nextPlaceholderId++).toString(),
  15589. equiv: ph.startName,
  15590. type: type,
  15591. disp: "<" + ph.tag + "/>",
  15592. });
  15593. return [tagPh];
  15594. }
  15595. var tagPc = new Tag(_PLACEHOLDER_SPANNING_TAG, {
  15596. id: (this._nextPlaceholderId++).toString(),
  15597. equivStart: ph.startName,
  15598. equivEnd: ph.closeName,
  15599. type: type,
  15600. dispStart: "<" + ph.tag + ">",
  15601. dispEnd: "</" + ph.tag + ">",
  15602. });
  15603. var nodes = [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(ph.children.map(function (node) { return node.visit(_this); })));
  15604. if (nodes.length) {
  15605. nodes.forEach(function (node) { return tagPc.children.push(node); });
  15606. }
  15607. else {
  15608. tagPc.children.push(new Text$2(''));
  15609. }
  15610. return [tagPc];
  15611. };
  15612. _WriteVisitor.prototype.visitPlaceholder = function (ph, context) {
  15613. var idStr = (this._nextPlaceholderId++).toString();
  15614. return [new Tag(_PLACEHOLDER_TAG$1, {
  15615. id: idStr,
  15616. equiv: ph.name,
  15617. disp: "{{" + ph.value + "}}",
  15618. })];
  15619. };
  15620. _WriteVisitor.prototype.visitIcuPlaceholder = function (ph, context) {
  15621. var cases = Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ');
  15622. var idStr = (this._nextPlaceholderId++).toString();
  15623. return [new Tag(_PLACEHOLDER_TAG$1, { id: idStr, equiv: ph.name, disp: "{" + ph.value.expression + ", " + ph.value.type + ", " + cases + "}" })];
  15624. };
  15625. _WriteVisitor.prototype.serialize = function (nodes) {
  15626. var _this = this;
  15627. this._nextPlaceholderId = 0;
  15628. return [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(nodes.map(function (node) { return node.visit(_this); })));
  15629. };
  15630. return _WriteVisitor;
  15631. }());
  15632. // Extract messages as xml nodes from the xliff file
  15633. var Xliff2Parser = /** @class */ (function () {
  15634. function Xliff2Parser() {
  15635. this._locale = null;
  15636. }
  15637. Xliff2Parser.prototype.parse = function (xliff, url) {
  15638. this._unitMlString = null;
  15639. this._msgIdToHtml = {};
  15640. var xml = new XmlParser().parse(xliff, url, false);
  15641. this._errors = xml.errors;
  15642. visitAll(this, xml.rootNodes, null);
  15643. return {
  15644. msgIdToHtml: this._msgIdToHtml,
  15645. errors: this._errors,
  15646. locale: this._locale,
  15647. };
  15648. };
  15649. Xliff2Parser.prototype.visitElement = function (element, context) {
  15650. switch (element.name) {
  15651. case _UNIT_TAG$1:
  15652. this._unitMlString = null;
  15653. var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
  15654. if (!idAttr) {
  15655. this._addError(element, "<" + _UNIT_TAG$1 + "> misses the \"id\" attribute");
  15656. }
  15657. else {
  15658. var id = idAttr.value;
  15659. if (this._msgIdToHtml.hasOwnProperty(id)) {
  15660. this._addError(element, "Duplicated translations for msg " + id);
  15661. }
  15662. else {
  15663. visitAll(this, element.children, null);
  15664. if (typeof this._unitMlString === 'string') {
  15665. this._msgIdToHtml[id] = this._unitMlString;
  15666. }
  15667. else {
  15668. this._addError(element, "Message " + id + " misses a translation");
  15669. }
  15670. }
  15671. }
  15672. break;
  15673. case _SOURCE_TAG$1:
  15674. // ignore source message
  15675. break;
  15676. case _TARGET_TAG$1:
  15677. var innerTextStart = element.startSourceSpan.end.offset;
  15678. var innerTextEnd = element.endSourceSpan.start.offset;
  15679. var content = element.startSourceSpan.start.file.content;
  15680. var innerText = content.slice(innerTextStart, innerTextEnd);
  15681. this._unitMlString = innerText;
  15682. break;
  15683. case _XLIFF_TAG:
  15684. var localeAttr = element.attrs.find(function (attr) { return attr.name === 'trgLang'; });
  15685. if (localeAttr) {
  15686. this._locale = localeAttr.value;
  15687. }
  15688. var versionAttr = element.attrs.find(function (attr) { return attr.name === 'version'; });
  15689. if (versionAttr) {
  15690. var version = versionAttr.value;
  15691. if (version !== '2.0') {
  15692. this._addError(element, "The XLIFF file version " + version + " is not compatible with XLIFF 2.0 serializer");
  15693. }
  15694. else {
  15695. visitAll(this, element.children, null);
  15696. }
  15697. }
  15698. break;
  15699. default:
  15700. visitAll(this, element.children, null);
  15701. }
  15702. };
  15703. Xliff2Parser.prototype.visitAttribute = function (attribute, context) { };
  15704. Xliff2Parser.prototype.visitText = function (text, context) { };
  15705. Xliff2Parser.prototype.visitComment = function (comment, context) { };
  15706. Xliff2Parser.prototype.visitExpansion = function (expansion, context) { };
  15707. Xliff2Parser.prototype.visitExpansionCase = function (expansionCase, context) { };
  15708. Xliff2Parser.prototype._addError = function (node, message) {
  15709. this._errors.push(new I18nError(node.sourceSpan, message));
  15710. };
  15711. return Xliff2Parser;
  15712. }());
  15713. // Convert ml nodes (xliff syntax) to i18n nodes
  15714. var XmlToI18n$1 = /** @class */ (function () {
  15715. function XmlToI18n() {
  15716. }
  15717. XmlToI18n.prototype.convert = function (message, url) {
  15718. var xmlIcu = new XmlParser().parse(message, url, true);
  15719. this._errors = xmlIcu.errors;
  15720. var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
  15721. [] : [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(visitAll(this, xmlIcu.rootNodes)));
  15722. return {
  15723. i18nNodes: i18nNodes,
  15724. errors: this._errors,
  15725. };
  15726. };
  15727. XmlToI18n.prototype.visitText = function (text, context) { return new Text$1(text.value, text.sourceSpan); };
  15728. XmlToI18n.prototype.visitElement = function (el, context) {
  15729. var _this = this;
  15730. switch (el.name) {
  15731. case _PLACEHOLDER_TAG$1:
  15732. var nameAttr = el.attrs.find(function (attr) { return attr.name === 'equiv'; });
  15733. if (nameAttr) {
  15734. return [new Placeholder('', nameAttr.value, el.sourceSpan)];
  15735. }
  15736. this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equiv\" attribute");
  15737. break;
  15738. case _PLACEHOLDER_SPANNING_TAG:
  15739. var startAttr = el.attrs.find(function (attr) { return attr.name === 'equivStart'; });
  15740. var endAttr = el.attrs.find(function (attr) { return attr.name === 'equivEnd'; });
  15741. if (!startAttr) {
  15742. this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivStart\" attribute");
  15743. }
  15744. else if (!endAttr) {
  15745. this._addError(el, "<" + _PLACEHOLDER_TAG$1 + "> misses the \"equivEnd\" attribute");
  15746. }
  15747. else {
  15748. var startId = startAttr.value;
  15749. var endId = endAttr.value;
  15750. var nodes = [];
  15751. return nodes.concat.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([new Placeholder('', startId, el.sourceSpan)], el.children.map(function (node) { return node.visit(_this, null); }), [new Placeholder('', endId, el.sourceSpan)]));
  15752. }
  15753. break;
  15754. case _MARKER_TAG$1:
  15755. return [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(visitAll(this, el.children)));
  15756. default:
  15757. this._addError(el, "Unexpected tag");
  15758. }
  15759. return null;
  15760. };
  15761. XmlToI18n.prototype.visitExpansion = function (icu, context) {
  15762. var caseMap = {};
  15763. visitAll(this, icu.cases).forEach(function (c) {
  15764. caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
  15765. });
  15766. return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
  15767. };
  15768. XmlToI18n.prototype.visitExpansionCase = function (icuCase, context) {
  15769. return {
  15770. value: icuCase.value,
  15771. nodes: [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(visitAll(this, icuCase.expression))),
  15772. };
  15773. };
  15774. XmlToI18n.prototype.visitComment = function (comment, context) { };
  15775. XmlToI18n.prototype.visitAttribute = function (attribute, context) { };
  15776. XmlToI18n.prototype._addError = function (node, message) {
  15777. this._errors.push(new I18nError(node.sourceSpan, message));
  15778. };
  15779. return XmlToI18n;
  15780. }());
  15781. function getTypeForTag(tag) {
  15782. switch (tag.toLowerCase()) {
  15783. case 'br':
  15784. case 'b':
  15785. case 'i':
  15786. case 'u':
  15787. return 'fmt';
  15788. case 'img':
  15789. return 'image';
  15790. case 'a':
  15791. return 'link';
  15792. default:
  15793. return 'other';
  15794. }
  15795. }
  15796. /**
  15797. * @license
  15798. * Copyright Google Inc. All Rights Reserved.
  15799. *
  15800. * Use of this source code is governed by an MIT-style license that can be
  15801. * found in the LICENSE file at https://angular.io/license
  15802. */
  15803. var _MESSAGES_TAG = 'messagebundle';
  15804. var _MESSAGE_TAG = 'msg';
  15805. var _PLACEHOLDER_TAG$2 = 'ph';
  15806. var _EXEMPLE_TAG = 'ex';
  15807. var _SOURCE_TAG$2 = 'source';
  15808. var _DOCTYPE = "<!ELEMENT messagebundle (msg)*>\n<!ATTLIST messagebundle class CDATA #IMPLIED>\n\n<!ELEMENT msg (#PCDATA|ph|source)*>\n<!ATTLIST msg id CDATA #IMPLIED>\n<!ATTLIST msg seq CDATA #IMPLIED>\n<!ATTLIST msg name CDATA #IMPLIED>\n<!ATTLIST msg desc CDATA #IMPLIED>\n<!ATTLIST msg meaning CDATA #IMPLIED>\n<!ATTLIST msg obsolete (obsolete) #IMPLIED>\n<!ATTLIST msg xml:space (default|preserve) \"default\">\n<!ATTLIST msg is_hidden CDATA #IMPLIED>\n\n<!ELEMENT source (#PCDATA)>\n\n<!ELEMENT ph (#PCDATA|ex)*>\n<!ATTLIST ph name CDATA #REQUIRED>\n\n<!ELEMENT ex (#PCDATA)>";
  15809. var Xmb = /** @class */ (function (_super) {
  15810. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Xmb, _super);
  15811. function Xmb() {
  15812. return _super !== null && _super.apply(this, arguments) || this;
  15813. }
  15814. Xmb.prototype.write = function (messages, locale) {
  15815. var exampleVisitor = new ExampleVisitor();
  15816. var visitor = new _Visitor$2();
  15817. var rootNode = new Tag(_MESSAGES_TAG);
  15818. messages.forEach(function (message) {
  15819. var attrs = { id: message.id };
  15820. if (message.description) {
  15821. attrs['desc'] = message.description;
  15822. }
  15823. if (message.meaning) {
  15824. attrs['meaning'] = message.meaning;
  15825. }
  15826. var sourceTags = [];
  15827. message.sources.forEach(function (source) {
  15828. sourceTags.push(new Tag(_SOURCE_TAG$2, {}, [
  15829. new Text$2(source.filePath + ":" + source.startLine + (source.endLine !== source.startLine ? ',' + source.endLine : ''))
  15830. ]));
  15831. });
  15832. rootNode.children.push(new CR(2), new Tag(_MESSAGE_TAG, attrs, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(sourceTags, visitor.serialize(message.nodes))));
  15833. });
  15834. rootNode.children.push(new CR());
  15835. return serialize([
  15836. new Declaration({ version: '1.0', encoding: 'UTF-8' }),
  15837. new CR(),
  15838. new Doctype(_MESSAGES_TAG, _DOCTYPE),
  15839. new CR(),
  15840. exampleVisitor.addDefaultExamples(rootNode),
  15841. new CR(),
  15842. ]);
  15843. };
  15844. Xmb.prototype.load = function (content, url) {
  15845. throw new Error('Unsupported');
  15846. };
  15847. Xmb.prototype.digest = function (message) { return digest$1(message); };
  15848. Xmb.prototype.createNameMapper = function (message) {
  15849. return new SimplePlaceholderMapper(message, toPublicName);
  15850. };
  15851. return Xmb;
  15852. }(Serializer));
  15853. var _Visitor$2 = /** @class */ (function () {
  15854. function _Visitor() {
  15855. }
  15856. _Visitor.prototype.visitText = function (text, context) { return [new Text$2(text.value)]; };
  15857. _Visitor.prototype.visitContainer = function (container, context) {
  15858. var _this = this;
  15859. var nodes = [];
  15860. container.children.forEach(function (node) { return nodes.push.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(node.visit(_this))); });
  15861. return nodes;
  15862. };
  15863. _Visitor.prototype.visitIcu = function (icu, context) {
  15864. var _this = this;
  15865. var nodes = [new Text$2("{" + icu.expressionPlaceholder + ", " + icu.type + ", ")];
  15866. Object.keys(icu.cases).forEach(function (c) {
  15867. nodes.push.apply(nodes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([new Text$2(c + " {")], icu.cases[c].visit(_this), [new Text$2("} ")]));
  15868. });
  15869. nodes.push(new Text$2("}"));
  15870. return nodes;
  15871. };
  15872. _Visitor.prototype.visitTagPlaceholder = function (ph, context) {
  15873. var startEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("<" + ph.tag + ">")]);
  15874. var startTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.startName }, [startEx]);
  15875. if (ph.isVoid) {
  15876. // void tags have no children nor closing tags
  15877. return [startTagPh];
  15878. }
  15879. var closeEx = new Tag(_EXEMPLE_TAG, {}, [new Text$2("</" + ph.tag + ">")]);
  15880. var closeTagPh = new Tag(_PLACEHOLDER_TAG$2, { name: ph.closeName }, [closeEx]);
  15881. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([startTagPh], this.serialize(ph.children), [closeTagPh]);
  15882. };
  15883. _Visitor.prototype.visitPlaceholder = function (ph, context) {
  15884. var exTag = new Tag(_EXEMPLE_TAG, {}, [new Text$2("{{" + ph.value + "}}")]);
  15885. return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
  15886. };
  15887. _Visitor.prototype.visitIcuPlaceholder = function (ph, context) {
  15888. var exTag = new Tag(_EXEMPLE_TAG, {}, [
  15889. new Text$2("{" + ph.value.expression + ", " + ph.value.type + ", " + Object.keys(ph.value.cases).map(function (value) { return value + ' {...}'; }).join(' ') + "}")
  15890. ]);
  15891. return [new Tag(_PLACEHOLDER_TAG$2, { name: ph.name }, [exTag])];
  15892. };
  15893. _Visitor.prototype.serialize = function (nodes) {
  15894. var _this = this;
  15895. return [].concat.apply([], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(nodes.map(function (node) { return node.visit(_this); })));
  15896. };
  15897. return _Visitor;
  15898. }());
  15899. function digest$1(message) {
  15900. return decimalDigest(message);
  15901. }
  15902. // TC requires at least one non-empty example on placeholders
  15903. var ExampleVisitor = /** @class */ (function () {
  15904. function ExampleVisitor() {
  15905. }
  15906. ExampleVisitor.prototype.addDefaultExamples = function (node) {
  15907. node.visit(this);
  15908. return node;
  15909. };
  15910. ExampleVisitor.prototype.visitTag = function (tag) {
  15911. var _this = this;
  15912. if (tag.name === _PLACEHOLDER_TAG$2) {
  15913. if (!tag.children || tag.children.length == 0) {
  15914. var exText = new Text$2(tag.attrs['name'] || '...');
  15915. tag.children = [new Tag(_EXEMPLE_TAG, {}, [exText])];
  15916. }
  15917. }
  15918. else if (tag.children) {
  15919. tag.children.forEach(function (node) { return node.visit(_this); });
  15920. }
  15921. };
  15922. ExampleVisitor.prototype.visitText = function (text) { };
  15923. ExampleVisitor.prototype.visitDeclaration = function (decl) { };
  15924. ExampleVisitor.prototype.visitDoctype = function (doctype) { };
  15925. return ExampleVisitor;
  15926. }());
  15927. // XMB/XTB placeholders can only contain A-Z, 0-9 and _
  15928. function toPublicName(internalName) {
  15929. return internalName.toUpperCase().replace(/[^A-Z0-9_]/g, '_');
  15930. }
  15931. /**
  15932. * @license
  15933. * Copyright Google Inc. All Rights Reserved.
  15934. *
  15935. * Use of this source code is governed by an MIT-style license that can be
  15936. * found in the LICENSE file at https://angular.io/license
  15937. */
  15938. var _TRANSLATIONS_TAG = 'translationbundle';
  15939. var _TRANSLATION_TAG = 'translation';
  15940. var _PLACEHOLDER_TAG$3 = 'ph';
  15941. var Xtb = /** @class */ (function (_super) {
  15942. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(Xtb, _super);
  15943. function Xtb() {
  15944. return _super !== null && _super.apply(this, arguments) || this;
  15945. }
  15946. Xtb.prototype.write = function (messages, locale) { throw new Error('Unsupported'); };
  15947. Xtb.prototype.load = function (content, url) {
  15948. // xtb to xml nodes
  15949. var xtbParser = new XtbParser();
  15950. var _a = xtbParser.parse(content, url), locale = _a.locale, msgIdToHtml = _a.msgIdToHtml, errors = _a.errors;
  15951. // xml nodes to i18n nodes
  15952. var i18nNodesByMsgId = {};
  15953. var converter = new XmlToI18n$2();
  15954. // Because we should be able to load xtb files that rely on features not supported by angular,
  15955. // we need to delay the conversion of html to i18n nodes so that non angular messages are not
  15956. // converted
  15957. Object.keys(msgIdToHtml).forEach(function (msgId) {
  15958. var valueFn = function () {
  15959. var _a = converter.convert(msgIdToHtml[msgId], url), i18nNodes = _a.i18nNodes, errors = _a.errors;
  15960. if (errors.length) {
  15961. throw new Error("xtb parse errors:\n" + errors.join('\n'));
  15962. }
  15963. return i18nNodes;
  15964. };
  15965. createLazyProperty(i18nNodesByMsgId, msgId, valueFn);
  15966. });
  15967. if (errors.length) {
  15968. throw new Error("xtb parse errors:\n" + errors.join('\n'));
  15969. }
  15970. return { locale: locale, i18nNodesByMsgId: i18nNodesByMsgId };
  15971. };
  15972. Xtb.prototype.digest = function (message) { return digest$1(message); };
  15973. Xtb.prototype.createNameMapper = function (message) {
  15974. return new SimplePlaceholderMapper(message, toPublicName);
  15975. };
  15976. return Xtb;
  15977. }(Serializer));
  15978. function createLazyProperty(messages, id, valueFn) {
  15979. Object.defineProperty(messages, id, {
  15980. configurable: true,
  15981. enumerable: true,
  15982. get: function () {
  15983. var value = valueFn();
  15984. Object.defineProperty(messages, id, { enumerable: true, value: value });
  15985. return value;
  15986. },
  15987. set: function (_) { throw new Error('Could not overwrite an XTB translation'); },
  15988. });
  15989. }
  15990. // Extract messages as xml nodes from the xtb file
  15991. var XtbParser = /** @class */ (function () {
  15992. function XtbParser() {
  15993. this._locale = null;
  15994. }
  15995. XtbParser.prototype.parse = function (xtb, url) {
  15996. this._bundleDepth = 0;
  15997. this._msgIdToHtml = {};
  15998. // We can not parse the ICU messages at this point as some messages might not originate
  15999. // from Angular that could not be lex'd.
  16000. var xml = new XmlParser().parse(xtb, url, false);
  16001. this._errors = xml.errors;
  16002. visitAll(this, xml.rootNodes);
  16003. return {
  16004. msgIdToHtml: this._msgIdToHtml,
  16005. errors: this._errors,
  16006. locale: this._locale,
  16007. };
  16008. };
  16009. XtbParser.prototype.visitElement = function (element, context) {
  16010. switch (element.name) {
  16011. case _TRANSLATIONS_TAG:
  16012. this._bundleDepth++;
  16013. if (this._bundleDepth > 1) {
  16014. this._addError(element, "<" + _TRANSLATIONS_TAG + "> elements can not be nested");
  16015. }
  16016. var langAttr = element.attrs.find(function (attr) { return attr.name === 'lang'; });
  16017. if (langAttr) {
  16018. this._locale = langAttr.value;
  16019. }
  16020. visitAll(this, element.children, null);
  16021. this._bundleDepth--;
  16022. break;
  16023. case _TRANSLATION_TAG:
  16024. var idAttr = element.attrs.find(function (attr) { return attr.name === 'id'; });
  16025. if (!idAttr) {
  16026. this._addError(element, "<" + _TRANSLATION_TAG + "> misses the \"id\" attribute");
  16027. }
  16028. else {
  16029. var id = idAttr.value;
  16030. if (this._msgIdToHtml.hasOwnProperty(id)) {
  16031. this._addError(element, "Duplicated translations for msg " + id);
  16032. }
  16033. else {
  16034. var innerTextStart = element.startSourceSpan.end.offset;
  16035. var innerTextEnd = element.endSourceSpan.start.offset;
  16036. var content = element.startSourceSpan.start.file.content;
  16037. var innerText = content.slice(innerTextStart, innerTextEnd);
  16038. this._msgIdToHtml[id] = innerText;
  16039. }
  16040. }
  16041. break;
  16042. default:
  16043. this._addError(element, 'Unexpected tag');
  16044. }
  16045. };
  16046. XtbParser.prototype.visitAttribute = function (attribute, context) { };
  16047. XtbParser.prototype.visitText = function (text, context) { };
  16048. XtbParser.prototype.visitComment = function (comment, context) { };
  16049. XtbParser.prototype.visitExpansion = function (expansion, context) { };
  16050. XtbParser.prototype.visitExpansionCase = function (expansionCase, context) { };
  16051. XtbParser.prototype._addError = function (node, message) {
  16052. this._errors.push(new I18nError(node.sourceSpan, message));
  16053. };
  16054. return XtbParser;
  16055. }());
  16056. // Convert ml nodes (xtb syntax) to i18n nodes
  16057. var XmlToI18n$2 = /** @class */ (function () {
  16058. function XmlToI18n() {
  16059. }
  16060. XmlToI18n.prototype.convert = function (message, url) {
  16061. var xmlIcu = new XmlParser().parse(message, url, true);
  16062. this._errors = xmlIcu.errors;
  16063. var i18nNodes = this._errors.length > 0 || xmlIcu.rootNodes.length == 0 ?
  16064. [] :
  16065. visitAll(this, xmlIcu.rootNodes);
  16066. return {
  16067. i18nNodes: i18nNodes,
  16068. errors: this._errors,
  16069. };
  16070. };
  16071. XmlToI18n.prototype.visitText = function (text, context) { return new Text$1(text.value, text.sourceSpan); };
  16072. XmlToI18n.prototype.visitExpansion = function (icu, context) {
  16073. var caseMap = {};
  16074. visitAll(this, icu.cases).forEach(function (c) {
  16075. caseMap[c.value] = new Container(c.nodes, icu.sourceSpan);
  16076. });
  16077. return new Icu(icu.switchValue, icu.type, caseMap, icu.sourceSpan);
  16078. };
  16079. XmlToI18n.prototype.visitExpansionCase = function (icuCase, context) {
  16080. return {
  16081. value: icuCase.value,
  16082. nodes: visitAll(this, icuCase.expression),
  16083. };
  16084. };
  16085. XmlToI18n.prototype.visitElement = function (el, context) {
  16086. if (el.name === _PLACEHOLDER_TAG$3) {
  16087. var nameAttr = el.attrs.find(function (attr) { return attr.name === 'name'; });
  16088. if (nameAttr) {
  16089. return new Placeholder('', nameAttr.value, el.sourceSpan);
  16090. }
  16091. this._addError(el, "<" + _PLACEHOLDER_TAG$3 + "> misses the \"name\" attribute");
  16092. }
  16093. else {
  16094. this._addError(el, "Unexpected tag");
  16095. }
  16096. return null;
  16097. };
  16098. XmlToI18n.prototype.visitComment = function (comment, context) { };
  16099. XmlToI18n.prototype.visitAttribute = function (attribute, context) { };
  16100. XmlToI18n.prototype._addError = function (node, message) {
  16101. this._errors.push(new I18nError(node.sourceSpan, message));
  16102. };
  16103. return XmlToI18n;
  16104. }());
  16105. /**
  16106. * @license
  16107. * Copyright Google Inc. All Rights Reserved.
  16108. *
  16109. * Use of this source code is governed by an MIT-style license that can be
  16110. * found in the LICENSE file at https://angular.io/license
  16111. */
  16112. var HtmlParser = /** @class */ (function (_super) {
  16113. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HtmlParser, _super);
  16114. function HtmlParser() {
  16115. return _super.call(this, getHtmlTagDefinition) || this;
  16116. }
  16117. HtmlParser.prototype.parse = function (source, url, parseExpansionForms, interpolationConfig) {
  16118. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  16119. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  16120. return _super.prototype.parse.call(this, source, url, parseExpansionForms, interpolationConfig);
  16121. };
  16122. return HtmlParser;
  16123. }(Parser$1));
  16124. /**
  16125. * @license
  16126. * Copyright Google Inc. All Rights Reserved.
  16127. *
  16128. * Use of this source code is governed by an MIT-style license that can be
  16129. * found in the LICENSE file at https://angular.io/license
  16130. */
  16131. /**
  16132. * A container for translated messages
  16133. */
  16134. var TranslationBundle = /** @class */ (function () {
  16135. function TranslationBundle(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console) {
  16136. if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
  16137. if (missingTranslationStrategy === void 0) { missingTranslationStrategy = MissingTranslationStrategy.Warning; }
  16138. this._i18nNodesByMsgId = _i18nNodesByMsgId;
  16139. this.digest = digest;
  16140. this.mapperFactory = mapperFactory;
  16141. this._i18nToHtml = new I18nToHtmlVisitor(_i18nNodesByMsgId, locale, digest, mapperFactory, missingTranslationStrategy, console);
  16142. }
  16143. // Creates a `TranslationBundle` by parsing the given `content` with the `serializer`.
  16144. TranslationBundle.load = function (content, url, serializer, missingTranslationStrategy, console) {
  16145. var _a = serializer.load(content, url), locale = _a.locale, i18nNodesByMsgId = _a.i18nNodesByMsgId;
  16146. var digestFn = function (m) { return serializer.digest(m); };
  16147. var mapperFactory = function (m) { return serializer.createNameMapper(m); };
  16148. return new TranslationBundle(i18nNodesByMsgId, locale, digestFn, mapperFactory, missingTranslationStrategy, console);
  16149. };
  16150. // Returns the translation as HTML nodes from the given source message.
  16151. TranslationBundle.prototype.get = function (srcMsg) {
  16152. var html = this._i18nToHtml.convert(srcMsg);
  16153. if (html.errors.length) {
  16154. throw new Error(html.errors.join('\n'));
  16155. }
  16156. return html.nodes;
  16157. };
  16158. TranslationBundle.prototype.has = function (srcMsg) { return this.digest(srcMsg) in this._i18nNodesByMsgId; };
  16159. return TranslationBundle;
  16160. }());
  16161. var I18nToHtmlVisitor = /** @class */ (function () {
  16162. function I18nToHtmlVisitor(_i18nNodesByMsgId, _locale, _digest, _mapperFactory, _missingTranslationStrategy, _console) {
  16163. if (_i18nNodesByMsgId === void 0) { _i18nNodesByMsgId = {}; }
  16164. this._i18nNodesByMsgId = _i18nNodesByMsgId;
  16165. this._locale = _locale;
  16166. this._digest = _digest;
  16167. this._mapperFactory = _mapperFactory;
  16168. this._missingTranslationStrategy = _missingTranslationStrategy;
  16169. this._console = _console;
  16170. this._contextStack = [];
  16171. this._errors = [];
  16172. }
  16173. I18nToHtmlVisitor.prototype.convert = function (srcMsg) {
  16174. this._contextStack.length = 0;
  16175. this._errors.length = 0;
  16176. // i18n to text
  16177. var text = this._convertToText(srcMsg);
  16178. // text to html
  16179. var url = srcMsg.nodes[0].sourceSpan.start.file.url;
  16180. var html = new HtmlParser().parse(text, url, true);
  16181. return {
  16182. nodes: html.rootNodes,
  16183. errors: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(this._errors, html.errors),
  16184. };
  16185. };
  16186. I18nToHtmlVisitor.prototype.visitText = function (text, context) {
  16187. // `convert()` uses an `HtmlParser` to return `html.Node`s
  16188. // we should then make sure that any special characters are escaped
  16189. return escapeXml(text.value);
  16190. };
  16191. I18nToHtmlVisitor.prototype.visitContainer = function (container, context) {
  16192. var _this = this;
  16193. return container.children.map(function (n) { return n.visit(_this); }).join('');
  16194. };
  16195. I18nToHtmlVisitor.prototype.visitIcu = function (icu, context) {
  16196. var _this = this;
  16197. var cases = Object.keys(icu.cases).map(function (k) { return k + " {" + icu.cases[k].visit(_this) + "}"; });
  16198. // TODO(vicb): Once all format switch to using expression placeholders
  16199. // we should throw when the placeholder is not in the source message
  16200. var exp = this._srcMsg.placeholders.hasOwnProperty(icu.expression) ?
  16201. this._srcMsg.placeholders[icu.expression] :
  16202. icu.expression;
  16203. return "{" + exp + ", " + icu.type + ", " + cases.join(' ') + "}";
  16204. };
  16205. I18nToHtmlVisitor.prototype.visitPlaceholder = function (ph, context) {
  16206. var phName = this._mapper(ph.name);
  16207. if (this._srcMsg.placeholders.hasOwnProperty(phName)) {
  16208. return this._srcMsg.placeholders[phName];
  16209. }
  16210. if (this._srcMsg.placeholderToMessage.hasOwnProperty(phName)) {
  16211. return this._convertToText(this._srcMsg.placeholderToMessage[phName]);
  16212. }
  16213. this._addError(ph, "Unknown placeholder \"" + ph.name + "\"");
  16214. return '';
  16215. };
  16216. // Loaded message contains only placeholders (vs tag and icu placeholders).
  16217. // However when a translation can not be found, we need to serialize the source message
  16218. // which can contain tag placeholders
  16219. I18nToHtmlVisitor.prototype.visitTagPlaceholder = function (ph, context) {
  16220. var _this = this;
  16221. var tag = "" + ph.tag;
  16222. var attrs = Object.keys(ph.attrs).map(function (name) { return name + "=\"" + ph.attrs[name] + "\""; }).join(' ');
  16223. if (ph.isVoid) {
  16224. return "<" + tag + " " + attrs + "/>";
  16225. }
  16226. var children = ph.children.map(function (c) { return c.visit(_this); }).join('');
  16227. return "<" + tag + " " + attrs + ">" + children + "</" + tag + ">";
  16228. };
  16229. // Loaded message contains only placeholders (vs tag and icu placeholders).
  16230. // However when a translation can not be found, we need to serialize the source message
  16231. // which can contain tag placeholders
  16232. I18nToHtmlVisitor.prototype.visitIcuPlaceholder = function (ph, context) {
  16233. // An ICU placeholder references the source message to be serialized
  16234. return this._convertToText(this._srcMsg.placeholderToMessage[ph.name]);
  16235. };
  16236. /**
  16237. * Convert a source message to a translated text string:
  16238. * - text nodes are replaced with their translation,
  16239. * - placeholders are replaced with their content,
  16240. * - ICU nodes are converted to ICU expressions.
  16241. */
  16242. I18nToHtmlVisitor.prototype._convertToText = function (srcMsg) {
  16243. var _this = this;
  16244. var id = this._digest(srcMsg);
  16245. var mapper = this._mapperFactory ? this._mapperFactory(srcMsg) : null;
  16246. var nodes;
  16247. this._contextStack.push({ msg: this._srcMsg, mapper: this._mapper });
  16248. this._srcMsg = srcMsg;
  16249. if (this._i18nNodesByMsgId.hasOwnProperty(id)) {
  16250. // When there is a translation use its nodes as the source
  16251. // And create a mapper to convert serialized placeholder names to internal names
  16252. nodes = this._i18nNodesByMsgId[id];
  16253. this._mapper = function (name) { return mapper ? mapper.toInternalName(name) : name; };
  16254. }
  16255. else {
  16256. // When no translation has been found
  16257. // - report an error / a warning / nothing,
  16258. // - use the nodes from the original message
  16259. // - placeholders are already internal and need no mapper
  16260. if (this._missingTranslationStrategy === MissingTranslationStrategy.Error) {
  16261. var ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
  16262. this._addError(srcMsg.nodes[0], "Missing translation for message \"" + id + "\"" + ctx);
  16263. }
  16264. else if (this._console &&
  16265. this._missingTranslationStrategy === MissingTranslationStrategy.Warning) {
  16266. var ctx = this._locale ? " for locale \"" + this._locale + "\"" : '';
  16267. this._console.warn("Missing translation for message \"" + id + "\"" + ctx);
  16268. }
  16269. nodes = srcMsg.nodes;
  16270. this._mapper = function (name) { return name; };
  16271. }
  16272. var text = nodes.map(function (node) { return node.visit(_this); }).join('');
  16273. var context = this._contextStack.pop();
  16274. this._srcMsg = context.msg;
  16275. this._mapper = context.mapper;
  16276. return text;
  16277. };
  16278. I18nToHtmlVisitor.prototype._addError = function (el, msg) {
  16279. this._errors.push(new I18nError(el.sourceSpan, msg));
  16280. };
  16281. return I18nToHtmlVisitor;
  16282. }());
  16283. /**
  16284. * @license
  16285. * Copyright Google Inc. All Rights Reserved.
  16286. *
  16287. * Use of this source code is governed by an MIT-style license that can be
  16288. * found in the LICENSE file at https://angular.io/license
  16289. */
  16290. var I18NHtmlParser = /** @class */ (function () {
  16291. function I18NHtmlParser(_htmlParser, translations, translationsFormat, missingTranslation, console) {
  16292. if (missingTranslation === void 0) { missingTranslation = MissingTranslationStrategy.Warning; }
  16293. this._htmlParser = _htmlParser;
  16294. if (translations) {
  16295. var serializer = createSerializer(translationsFormat);
  16296. this._translationBundle =
  16297. TranslationBundle.load(translations, 'i18n', serializer, missingTranslation, console);
  16298. }
  16299. else {
  16300. this._translationBundle =
  16301. new TranslationBundle({}, null, digest, undefined, missingTranslation, console);
  16302. }
  16303. }
  16304. I18NHtmlParser.prototype.parse = function (source, url, parseExpansionForms, interpolationConfig) {
  16305. if (parseExpansionForms === void 0) { parseExpansionForms = false; }
  16306. if (interpolationConfig === void 0) { interpolationConfig = DEFAULT_INTERPOLATION_CONFIG; }
  16307. var parseResult = this._htmlParser.parse(source, url, parseExpansionForms, interpolationConfig);
  16308. if (parseResult.errors.length) {
  16309. return new ParseTreeResult(parseResult.rootNodes, parseResult.errors);
  16310. }
  16311. return mergeTranslations(parseResult.rootNodes, this._translationBundle, interpolationConfig, [], {});
  16312. };
  16313. return I18NHtmlParser;
  16314. }());
  16315. function createSerializer(format) {
  16316. format = (format || 'xlf').toLowerCase();
  16317. switch (format) {
  16318. case 'xmb':
  16319. return new Xmb();
  16320. case 'xtb':
  16321. return new Xtb();
  16322. case 'xliff2':
  16323. case 'xlf2':
  16324. return new Xliff2();
  16325. case 'xliff':
  16326. case 'xlf':
  16327. default:
  16328. return new Xliff();
  16329. }
  16330. }
  16331. /**
  16332. * @license
  16333. * Copyright Google Inc. All Rights Reserved.
  16334. *
  16335. * Use of this source code is governed by an MIT-style license that can be
  16336. * found in the LICENSE file at https://angular.io/license
  16337. */
  16338. var CORE = '@angular/core';
  16339. var Identifiers = /** @class */ (function () {
  16340. function Identifiers() {
  16341. }
  16342. Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS = {
  16343. name: 'ANALYZE_FOR_ENTRY_COMPONENTS',
  16344. moduleName: CORE,
  16345. };
  16346. Identifiers.ElementRef = { name: 'ElementRef', moduleName: CORE };
  16347. Identifiers.NgModuleRef = { name: 'NgModuleRef', moduleName: CORE };
  16348. Identifiers.ViewContainerRef = { name: 'ViewContainerRef', moduleName: CORE };
  16349. Identifiers.ChangeDetectorRef = {
  16350. name: 'ChangeDetectorRef',
  16351. moduleName: CORE,
  16352. };
  16353. Identifiers.QueryList = { name: 'QueryList', moduleName: CORE };
  16354. Identifiers.TemplateRef = { name: 'TemplateRef', moduleName: CORE };
  16355. Identifiers.CodegenComponentFactoryResolver = {
  16356. name: 'ɵCodegenComponentFactoryResolver',
  16357. moduleName: CORE,
  16358. };
  16359. Identifiers.ComponentFactoryResolver = {
  16360. name: 'ComponentFactoryResolver',
  16361. moduleName: CORE,
  16362. };
  16363. Identifiers.ComponentFactory = { name: 'ComponentFactory', moduleName: CORE };
  16364. Identifiers.ComponentRef = { name: 'ComponentRef', moduleName: CORE };
  16365. Identifiers.NgModuleFactory = { name: 'NgModuleFactory', moduleName: CORE };
  16366. Identifiers.createModuleFactory = {
  16367. name: 'ɵcmf',
  16368. moduleName: CORE,
  16369. };
  16370. Identifiers.moduleDef = {
  16371. name: 'ɵmod',
  16372. moduleName: CORE,
  16373. };
  16374. Identifiers.moduleProviderDef = {
  16375. name: 'ɵmpd',
  16376. moduleName: CORE,
  16377. };
  16378. Identifiers.RegisterModuleFactoryFn = {
  16379. name: 'ɵregisterModuleFactory',
  16380. moduleName: CORE,
  16381. };
  16382. Identifiers.inject = { name: 'inject', moduleName: CORE };
  16383. Identifiers.INJECTOR = { name: 'INJECTOR', moduleName: CORE };
  16384. Identifiers.Injector = { name: 'Injector', moduleName: CORE };
  16385. Identifiers.defineInjectable = { name: 'defineInjectable', moduleName: CORE };
  16386. Identifiers.InjectableDef = { name: 'ɵInjectableDef', moduleName: CORE };
  16387. Identifiers.ViewEncapsulation = {
  16388. name: 'ViewEncapsulation',
  16389. moduleName: CORE,
  16390. };
  16391. Identifiers.ChangeDetectionStrategy = {
  16392. name: 'ChangeDetectionStrategy',
  16393. moduleName: CORE,
  16394. };
  16395. Identifiers.SecurityContext = {
  16396. name: 'SecurityContext',
  16397. moduleName: CORE,
  16398. };
  16399. Identifiers.LOCALE_ID = { name: 'LOCALE_ID', moduleName: CORE };
  16400. Identifiers.TRANSLATIONS_FORMAT = {
  16401. name: 'TRANSLATIONS_FORMAT',
  16402. moduleName: CORE,
  16403. };
  16404. Identifiers.inlineInterpolate = {
  16405. name: 'ɵinlineInterpolate',
  16406. moduleName: CORE,
  16407. };
  16408. Identifiers.interpolate = { name: 'ɵinterpolate', moduleName: CORE };
  16409. Identifiers.EMPTY_ARRAY = { name: 'ɵEMPTY_ARRAY', moduleName: CORE };
  16410. Identifiers.EMPTY_MAP = { name: 'ɵEMPTY_MAP', moduleName: CORE };
  16411. Identifiers.Renderer = { name: 'Renderer', moduleName: CORE };
  16412. Identifiers.viewDef = { name: 'ɵvid', moduleName: CORE };
  16413. Identifiers.elementDef = { name: 'ɵeld', moduleName: CORE };
  16414. Identifiers.anchorDef = { name: 'ɵand', moduleName: CORE };
  16415. Identifiers.textDef = { name: 'ɵted', moduleName: CORE };
  16416. Identifiers.directiveDef = { name: 'ɵdid', moduleName: CORE };
  16417. Identifiers.providerDef = { name: 'ɵprd', moduleName: CORE };
  16418. Identifiers.queryDef = { name: 'ɵqud', moduleName: CORE };
  16419. Identifiers.pureArrayDef = { name: 'ɵpad', moduleName: CORE };
  16420. Identifiers.pureObjectDef = { name: 'ɵpod', moduleName: CORE };
  16421. Identifiers.purePipeDef = { name: 'ɵppd', moduleName: CORE };
  16422. Identifiers.pipeDef = { name: 'ɵpid', moduleName: CORE };
  16423. Identifiers.nodeValue = { name: 'ɵnov', moduleName: CORE };
  16424. Identifiers.ngContentDef = { name: 'ɵncd', moduleName: CORE };
  16425. Identifiers.unwrapValue = { name: 'ɵunv', moduleName: CORE };
  16426. Identifiers.createRendererType2 = { name: 'ɵcrt', moduleName: CORE };
  16427. // type only
  16428. Identifiers.RendererType2 = {
  16429. name: 'RendererType2',
  16430. moduleName: CORE,
  16431. };
  16432. // type only
  16433. Identifiers.ViewDefinition = {
  16434. name: 'ɵViewDefinition',
  16435. moduleName: CORE,
  16436. };
  16437. Identifiers.createComponentFactory = { name: 'ɵccf', moduleName: CORE };
  16438. return Identifiers;
  16439. }());
  16440. function createTokenForReference(reference) {
  16441. return { identifier: { reference: reference } };
  16442. }
  16443. function createTokenForExternalReference(reflector, reference) {
  16444. return createTokenForReference(reflector.resolveExternalReference(reference));
  16445. }
  16446. /**
  16447. * @license
  16448. * Copyright Google Inc. All Rights Reserved.
  16449. *
  16450. * Use of this source code is governed by an MIT-style license that can be
  16451. * found in the LICENSE file at https://angular.io/license
  16452. */
  16453. //// Types
  16454. var TypeModifier;
  16455. (function (TypeModifier) {
  16456. TypeModifier[TypeModifier["Const"] = 0] = "Const";
  16457. })(TypeModifier || (TypeModifier = {}));
  16458. var Type$1 = /** @class */ (function () {
  16459. function Type(modifiers) {
  16460. if (modifiers === void 0) { modifiers = null; }
  16461. this.modifiers = modifiers;
  16462. if (!modifiers) {
  16463. this.modifiers = [];
  16464. }
  16465. }
  16466. Type.prototype.hasModifier = function (modifier) { return this.modifiers.indexOf(modifier) !== -1; };
  16467. return Type;
  16468. }());
  16469. var BuiltinTypeName;
  16470. (function (BuiltinTypeName) {
  16471. BuiltinTypeName[BuiltinTypeName["Dynamic"] = 0] = "Dynamic";
  16472. BuiltinTypeName[BuiltinTypeName["Bool"] = 1] = "Bool";
  16473. BuiltinTypeName[BuiltinTypeName["String"] = 2] = "String";
  16474. BuiltinTypeName[BuiltinTypeName["Int"] = 3] = "Int";
  16475. BuiltinTypeName[BuiltinTypeName["Number"] = 4] = "Number";
  16476. BuiltinTypeName[BuiltinTypeName["Function"] = 5] = "Function";
  16477. BuiltinTypeName[BuiltinTypeName["Inferred"] = 6] = "Inferred";
  16478. BuiltinTypeName[BuiltinTypeName["None"] = 7] = "None";
  16479. })(BuiltinTypeName || (BuiltinTypeName = {}));
  16480. var BuiltinType = /** @class */ (function (_super) {
  16481. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BuiltinType, _super);
  16482. function BuiltinType(name, modifiers) {
  16483. if (modifiers === void 0) { modifiers = null; }
  16484. var _this = _super.call(this, modifiers) || this;
  16485. _this.name = name;
  16486. return _this;
  16487. }
  16488. BuiltinType.prototype.visitType = function (visitor, context) {
  16489. return visitor.visitBuiltinType(this, context);
  16490. };
  16491. return BuiltinType;
  16492. }(Type$1));
  16493. var ExpressionType = /** @class */ (function (_super) {
  16494. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ExpressionType, _super);
  16495. function ExpressionType(value, modifiers, typeParams) {
  16496. if (modifiers === void 0) { modifiers = null; }
  16497. if (typeParams === void 0) { typeParams = null; }
  16498. var _this = _super.call(this, modifiers) || this;
  16499. _this.value = value;
  16500. _this.typeParams = typeParams;
  16501. return _this;
  16502. }
  16503. ExpressionType.prototype.visitType = function (visitor, context) {
  16504. return visitor.visitExpressionType(this, context);
  16505. };
  16506. return ExpressionType;
  16507. }(Type$1));
  16508. var ArrayType = /** @class */ (function (_super) {
  16509. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ArrayType, _super);
  16510. function ArrayType(of, modifiers) {
  16511. if (modifiers === void 0) { modifiers = null; }
  16512. var _this = _super.call(this, modifiers) || this;
  16513. _this.of = of;
  16514. return _this;
  16515. }
  16516. ArrayType.prototype.visitType = function (visitor, context) {
  16517. return visitor.visitArrayType(this, context);
  16518. };
  16519. return ArrayType;
  16520. }(Type$1));
  16521. var MapType = /** @class */ (function (_super) {
  16522. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MapType, _super);
  16523. function MapType(valueType, modifiers) {
  16524. if (modifiers === void 0) { modifiers = null; }
  16525. var _this = _super.call(this, modifiers) || this;
  16526. _this.valueType = valueType || null;
  16527. return _this;
  16528. }
  16529. MapType.prototype.visitType = function (visitor, context) { return visitor.visitMapType(this, context); };
  16530. return MapType;
  16531. }(Type$1));
  16532. var DYNAMIC_TYPE = new BuiltinType(BuiltinTypeName.Dynamic);
  16533. var INFERRED_TYPE = new BuiltinType(BuiltinTypeName.Inferred);
  16534. var BOOL_TYPE = new BuiltinType(BuiltinTypeName.Bool);
  16535. var INT_TYPE = new BuiltinType(BuiltinTypeName.Int);
  16536. var NUMBER_TYPE = new BuiltinType(BuiltinTypeName.Number);
  16537. var STRING_TYPE = new BuiltinType(BuiltinTypeName.String);
  16538. var FUNCTION_TYPE = new BuiltinType(BuiltinTypeName.Function);
  16539. var NONE_TYPE = new BuiltinType(BuiltinTypeName.None);
  16540. ///// Expressions
  16541. var BinaryOperator;
  16542. (function (BinaryOperator) {
  16543. BinaryOperator[BinaryOperator["Equals"] = 0] = "Equals";
  16544. BinaryOperator[BinaryOperator["NotEquals"] = 1] = "NotEquals";
  16545. BinaryOperator[BinaryOperator["Identical"] = 2] = "Identical";
  16546. BinaryOperator[BinaryOperator["NotIdentical"] = 3] = "NotIdentical";
  16547. BinaryOperator[BinaryOperator["Minus"] = 4] = "Minus";
  16548. BinaryOperator[BinaryOperator["Plus"] = 5] = "Plus";
  16549. BinaryOperator[BinaryOperator["Divide"] = 6] = "Divide";
  16550. BinaryOperator[BinaryOperator["Multiply"] = 7] = "Multiply";
  16551. BinaryOperator[BinaryOperator["Modulo"] = 8] = "Modulo";
  16552. BinaryOperator[BinaryOperator["And"] = 9] = "And";
  16553. BinaryOperator[BinaryOperator["Or"] = 10] = "Or";
  16554. BinaryOperator[BinaryOperator["BitwiseAnd"] = 11] = "BitwiseAnd";
  16555. BinaryOperator[BinaryOperator["Lower"] = 12] = "Lower";
  16556. BinaryOperator[BinaryOperator["LowerEquals"] = 13] = "LowerEquals";
  16557. BinaryOperator[BinaryOperator["Bigger"] = 14] = "Bigger";
  16558. BinaryOperator[BinaryOperator["BiggerEquals"] = 15] = "BiggerEquals";
  16559. })(BinaryOperator || (BinaryOperator = {}));
  16560. function nullSafeIsEquivalent(base, other) {
  16561. if (base == null || other == null) {
  16562. return base == other;
  16563. }
  16564. return base.isEquivalent(other);
  16565. }
  16566. function areAllEquivalent(base, other) {
  16567. var len = base.length;
  16568. if (len !== other.length) {
  16569. return false;
  16570. }
  16571. for (var i = 0; i < len; i++) {
  16572. if (!base[i].isEquivalent(other[i])) {
  16573. return false;
  16574. }
  16575. }
  16576. return true;
  16577. }
  16578. var Expression = /** @class */ (function () {
  16579. function Expression(type, sourceSpan) {
  16580. this.type = type || null;
  16581. this.sourceSpan = sourceSpan || null;
  16582. }
  16583. Expression.prototype.prop = function (name, sourceSpan) {
  16584. return new ReadPropExpr(this, name, null, sourceSpan);
  16585. };
  16586. Expression.prototype.key = function (index, type, sourceSpan) {
  16587. return new ReadKeyExpr(this, index, type, sourceSpan);
  16588. };
  16589. Expression.prototype.callMethod = function (name, params, sourceSpan) {
  16590. return new InvokeMethodExpr(this, name, params, null, sourceSpan);
  16591. };
  16592. Expression.prototype.callFn = function (params, sourceSpan) {
  16593. return new InvokeFunctionExpr(this, params, null, sourceSpan);
  16594. };
  16595. Expression.prototype.instantiate = function (params, type, sourceSpan) {
  16596. return new InstantiateExpr(this, params, type, sourceSpan);
  16597. };
  16598. Expression.prototype.conditional = function (trueCase, falseCase, sourceSpan) {
  16599. if (falseCase === void 0) { falseCase = null; }
  16600. return new ConditionalExpr(this, trueCase, falseCase, null, sourceSpan);
  16601. };
  16602. Expression.prototype.equals = function (rhs, sourceSpan) {
  16603. return new BinaryOperatorExpr(BinaryOperator.Equals, this, rhs, null, sourceSpan);
  16604. };
  16605. Expression.prototype.notEquals = function (rhs, sourceSpan) {
  16606. return new BinaryOperatorExpr(BinaryOperator.NotEquals, this, rhs, null, sourceSpan);
  16607. };
  16608. Expression.prototype.identical = function (rhs, sourceSpan) {
  16609. return new BinaryOperatorExpr(BinaryOperator.Identical, this, rhs, null, sourceSpan);
  16610. };
  16611. Expression.prototype.notIdentical = function (rhs, sourceSpan) {
  16612. return new BinaryOperatorExpr(BinaryOperator.NotIdentical, this, rhs, null, sourceSpan);
  16613. };
  16614. Expression.prototype.minus = function (rhs, sourceSpan) {
  16615. return new BinaryOperatorExpr(BinaryOperator.Minus, this, rhs, null, sourceSpan);
  16616. };
  16617. Expression.prototype.plus = function (rhs, sourceSpan) {
  16618. return new BinaryOperatorExpr(BinaryOperator.Plus, this, rhs, null, sourceSpan);
  16619. };
  16620. Expression.prototype.divide = function (rhs, sourceSpan) {
  16621. return new BinaryOperatorExpr(BinaryOperator.Divide, this, rhs, null, sourceSpan);
  16622. };
  16623. Expression.prototype.multiply = function (rhs, sourceSpan) {
  16624. return new BinaryOperatorExpr(BinaryOperator.Multiply, this, rhs, null, sourceSpan);
  16625. };
  16626. Expression.prototype.modulo = function (rhs, sourceSpan) {
  16627. return new BinaryOperatorExpr(BinaryOperator.Modulo, this, rhs, null, sourceSpan);
  16628. };
  16629. Expression.prototype.and = function (rhs, sourceSpan) {
  16630. return new BinaryOperatorExpr(BinaryOperator.And, this, rhs, null, sourceSpan);
  16631. };
  16632. Expression.prototype.bitwiseAnd = function (rhs, sourceSpan, parens) {
  16633. if (parens === void 0) { parens = true; }
  16634. return new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, this, rhs, null, sourceSpan, parens);
  16635. };
  16636. Expression.prototype.or = function (rhs, sourceSpan) {
  16637. return new BinaryOperatorExpr(BinaryOperator.Or, this, rhs, null, sourceSpan);
  16638. };
  16639. Expression.prototype.lower = function (rhs, sourceSpan) {
  16640. return new BinaryOperatorExpr(BinaryOperator.Lower, this, rhs, null, sourceSpan);
  16641. };
  16642. Expression.prototype.lowerEquals = function (rhs, sourceSpan) {
  16643. return new BinaryOperatorExpr(BinaryOperator.LowerEquals, this, rhs, null, sourceSpan);
  16644. };
  16645. Expression.prototype.bigger = function (rhs, sourceSpan) {
  16646. return new BinaryOperatorExpr(BinaryOperator.Bigger, this, rhs, null, sourceSpan);
  16647. };
  16648. Expression.prototype.biggerEquals = function (rhs, sourceSpan) {
  16649. return new BinaryOperatorExpr(BinaryOperator.BiggerEquals, this, rhs, null, sourceSpan);
  16650. };
  16651. Expression.prototype.isBlank = function (sourceSpan) {
  16652. // Note: We use equals by purpose here to compare to null and undefined in JS.
  16653. // We use the typed null to allow strictNullChecks to narrow types.
  16654. return this.equals(TYPED_NULL_EXPR, sourceSpan);
  16655. };
  16656. Expression.prototype.cast = function (type, sourceSpan) {
  16657. return new CastExpr(this, type, sourceSpan);
  16658. };
  16659. Expression.prototype.toStmt = function () { return new ExpressionStatement(this, null); };
  16660. return Expression;
  16661. }());
  16662. var BuiltinVar;
  16663. (function (BuiltinVar) {
  16664. BuiltinVar[BuiltinVar["This"] = 0] = "This";
  16665. BuiltinVar[BuiltinVar["Super"] = 1] = "Super";
  16666. BuiltinVar[BuiltinVar["CatchError"] = 2] = "CatchError";
  16667. BuiltinVar[BuiltinVar["CatchStack"] = 3] = "CatchStack";
  16668. })(BuiltinVar || (BuiltinVar = {}));
  16669. var ReadVarExpr = /** @class */ (function (_super) {
  16670. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ReadVarExpr, _super);
  16671. function ReadVarExpr(name, type, sourceSpan) {
  16672. var _this = _super.call(this, type, sourceSpan) || this;
  16673. if (typeof name === 'string') {
  16674. _this.name = name;
  16675. _this.builtin = null;
  16676. }
  16677. else {
  16678. _this.name = null;
  16679. _this.builtin = name;
  16680. }
  16681. return _this;
  16682. }
  16683. ReadVarExpr.prototype.isEquivalent = function (e) {
  16684. return e instanceof ReadVarExpr && this.name === e.name && this.builtin === e.builtin;
  16685. };
  16686. ReadVarExpr.prototype.isConstant = function () { return false; };
  16687. ReadVarExpr.prototype.visitExpression = function (visitor, context) {
  16688. return visitor.visitReadVarExpr(this, context);
  16689. };
  16690. ReadVarExpr.prototype.set = function (value) {
  16691. if (!this.name) {
  16692. throw new Error("Built in variable " + this.builtin + " can not be assigned to.");
  16693. }
  16694. return new WriteVarExpr(this.name, value, null, this.sourceSpan);
  16695. };
  16696. return ReadVarExpr;
  16697. }(Expression));
  16698. var TypeofExpr = /** @class */ (function (_super) {
  16699. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TypeofExpr, _super);
  16700. function TypeofExpr(expr, type, sourceSpan) {
  16701. var _this = _super.call(this, type, sourceSpan) || this;
  16702. _this.expr = expr;
  16703. return _this;
  16704. }
  16705. TypeofExpr.prototype.visitExpression = function (visitor, context) {
  16706. return visitor.visitTypeofExpr(this, context);
  16707. };
  16708. TypeofExpr.prototype.isEquivalent = function (e) {
  16709. return e instanceof TypeofExpr && e.expr.isEquivalent(this.expr);
  16710. };
  16711. TypeofExpr.prototype.isConstant = function () { return this.expr.isConstant(); };
  16712. return TypeofExpr;
  16713. }(Expression));
  16714. var WrappedNodeExpr = /** @class */ (function (_super) {
  16715. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WrappedNodeExpr, _super);
  16716. function WrappedNodeExpr(node, type, sourceSpan) {
  16717. var _this = _super.call(this, type, sourceSpan) || this;
  16718. _this.node = node;
  16719. return _this;
  16720. }
  16721. WrappedNodeExpr.prototype.isEquivalent = function (e) {
  16722. return e instanceof WrappedNodeExpr && this.node === e.node;
  16723. };
  16724. WrappedNodeExpr.prototype.isConstant = function () { return false; };
  16725. WrappedNodeExpr.prototype.visitExpression = function (visitor, context) {
  16726. return visitor.visitWrappedNodeExpr(this, context);
  16727. };
  16728. return WrappedNodeExpr;
  16729. }(Expression));
  16730. var WriteVarExpr = /** @class */ (function (_super) {
  16731. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WriteVarExpr, _super);
  16732. function WriteVarExpr(name, value, type, sourceSpan) {
  16733. var _this = _super.call(this, type || value.type, sourceSpan) || this;
  16734. _this.name = name;
  16735. _this.value = value;
  16736. return _this;
  16737. }
  16738. WriteVarExpr.prototype.isEquivalent = function (e) {
  16739. return e instanceof WriteVarExpr && this.name === e.name && this.value.isEquivalent(e.value);
  16740. };
  16741. WriteVarExpr.prototype.isConstant = function () { return false; };
  16742. WriteVarExpr.prototype.visitExpression = function (visitor, context) {
  16743. return visitor.visitWriteVarExpr(this, context);
  16744. };
  16745. WriteVarExpr.prototype.toDeclStmt = function (type, modifiers) {
  16746. return new DeclareVarStmt(this.name, this.value, type, modifiers, this.sourceSpan);
  16747. };
  16748. return WriteVarExpr;
  16749. }(Expression));
  16750. var WriteKeyExpr = /** @class */ (function (_super) {
  16751. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WriteKeyExpr, _super);
  16752. function WriteKeyExpr(receiver, index, value, type, sourceSpan) {
  16753. var _this = _super.call(this, type || value.type, sourceSpan) || this;
  16754. _this.receiver = receiver;
  16755. _this.index = index;
  16756. _this.value = value;
  16757. return _this;
  16758. }
  16759. WriteKeyExpr.prototype.isEquivalent = function (e) {
  16760. return e instanceof WriteKeyExpr && this.receiver.isEquivalent(e.receiver) &&
  16761. this.index.isEquivalent(e.index) && this.value.isEquivalent(e.value);
  16762. };
  16763. WriteKeyExpr.prototype.isConstant = function () { return false; };
  16764. WriteKeyExpr.prototype.visitExpression = function (visitor, context) {
  16765. return visitor.visitWriteKeyExpr(this, context);
  16766. };
  16767. return WriteKeyExpr;
  16768. }(Expression));
  16769. var WritePropExpr = /** @class */ (function (_super) {
  16770. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(WritePropExpr, _super);
  16771. function WritePropExpr(receiver, name, value, type, sourceSpan) {
  16772. var _this = _super.call(this, type || value.type, sourceSpan) || this;
  16773. _this.receiver = receiver;
  16774. _this.name = name;
  16775. _this.value = value;
  16776. return _this;
  16777. }
  16778. WritePropExpr.prototype.isEquivalent = function (e) {
  16779. return e instanceof WritePropExpr && this.receiver.isEquivalent(e.receiver) &&
  16780. this.name === e.name && this.value.isEquivalent(e.value);
  16781. };
  16782. WritePropExpr.prototype.isConstant = function () { return false; };
  16783. WritePropExpr.prototype.visitExpression = function (visitor, context) {
  16784. return visitor.visitWritePropExpr(this, context);
  16785. };
  16786. return WritePropExpr;
  16787. }(Expression));
  16788. var BuiltinMethod;
  16789. (function (BuiltinMethod) {
  16790. BuiltinMethod[BuiltinMethod["ConcatArray"] = 0] = "ConcatArray";
  16791. BuiltinMethod[BuiltinMethod["SubscribeObservable"] = 1] = "SubscribeObservable";
  16792. BuiltinMethod[BuiltinMethod["Bind"] = 2] = "Bind";
  16793. })(BuiltinMethod || (BuiltinMethod = {}));
  16794. var InvokeMethodExpr = /** @class */ (function (_super) {
  16795. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(InvokeMethodExpr, _super);
  16796. function InvokeMethodExpr(receiver, method, args, type, sourceSpan) {
  16797. var _this = _super.call(this, type, sourceSpan) || this;
  16798. _this.receiver = receiver;
  16799. _this.args = args;
  16800. if (typeof method === 'string') {
  16801. _this.name = method;
  16802. _this.builtin = null;
  16803. }
  16804. else {
  16805. _this.name = null;
  16806. _this.builtin = method;
  16807. }
  16808. return _this;
  16809. }
  16810. InvokeMethodExpr.prototype.isEquivalent = function (e) {
  16811. return e instanceof InvokeMethodExpr && this.receiver.isEquivalent(e.receiver) &&
  16812. this.name === e.name && this.builtin === e.builtin && areAllEquivalent(this.args, e.args);
  16813. };
  16814. InvokeMethodExpr.prototype.isConstant = function () { return false; };
  16815. InvokeMethodExpr.prototype.visitExpression = function (visitor, context) {
  16816. return visitor.visitInvokeMethodExpr(this, context);
  16817. };
  16818. return InvokeMethodExpr;
  16819. }(Expression));
  16820. var InvokeFunctionExpr = /** @class */ (function (_super) {
  16821. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(InvokeFunctionExpr, _super);
  16822. function InvokeFunctionExpr(fn, args, type, sourceSpan) {
  16823. var _this = _super.call(this, type, sourceSpan) || this;
  16824. _this.fn = fn;
  16825. _this.args = args;
  16826. return _this;
  16827. }
  16828. InvokeFunctionExpr.prototype.isEquivalent = function (e) {
  16829. return e instanceof InvokeFunctionExpr && this.fn.isEquivalent(e.fn) &&
  16830. areAllEquivalent(this.args, e.args);
  16831. };
  16832. InvokeFunctionExpr.prototype.isConstant = function () { return false; };
  16833. InvokeFunctionExpr.prototype.visitExpression = function (visitor, context) {
  16834. return visitor.visitInvokeFunctionExpr(this, context);
  16835. };
  16836. return InvokeFunctionExpr;
  16837. }(Expression));
  16838. var InstantiateExpr = /** @class */ (function (_super) {
  16839. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(InstantiateExpr, _super);
  16840. function InstantiateExpr(classExpr, args, type, sourceSpan) {
  16841. var _this = _super.call(this, type, sourceSpan) || this;
  16842. _this.classExpr = classExpr;
  16843. _this.args = args;
  16844. return _this;
  16845. }
  16846. InstantiateExpr.prototype.isEquivalent = function (e) {
  16847. return e instanceof InstantiateExpr && this.classExpr.isEquivalent(e.classExpr) &&
  16848. areAllEquivalent(this.args, e.args);
  16849. };
  16850. InstantiateExpr.prototype.isConstant = function () { return false; };
  16851. InstantiateExpr.prototype.visitExpression = function (visitor, context) {
  16852. return visitor.visitInstantiateExpr(this, context);
  16853. };
  16854. return InstantiateExpr;
  16855. }(Expression));
  16856. var LiteralExpr = /** @class */ (function (_super) {
  16857. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LiteralExpr, _super);
  16858. function LiteralExpr(value, type, sourceSpan) {
  16859. var _this = _super.call(this, type, sourceSpan) || this;
  16860. _this.value = value;
  16861. return _this;
  16862. }
  16863. LiteralExpr.prototype.isEquivalent = function (e) {
  16864. return e instanceof LiteralExpr && this.value === e.value;
  16865. };
  16866. LiteralExpr.prototype.isConstant = function () { return true; };
  16867. LiteralExpr.prototype.visitExpression = function (visitor, context) {
  16868. return visitor.visitLiteralExpr(this, context);
  16869. };
  16870. return LiteralExpr;
  16871. }(Expression));
  16872. var ExternalExpr = /** @class */ (function (_super) {
  16873. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ExternalExpr, _super);
  16874. function ExternalExpr(value, type, typeParams, sourceSpan) {
  16875. if (typeParams === void 0) { typeParams = null; }
  16876. var _this = _super.call(this, type, sourceSpan) || this;
  16877. _this.value = value;
  16878. _this.typeParams = typeParams;
  16879. return _this;
  16880. }
  16881. ExternalExpr.prototype.isEquivalent = function (e) {
  16882. return e instanceof ExternalExpr && this.value.name === e.value.name &&
  16883. this.value.moduleName === e.value.moduleName && this.value.runtime === e.value.runtime;
  16884. };
  16885. ExternalExpr.prototype.isConstant = function () { return false; };
  16886. ExternalExpr.prototype.visitExpression = function (visitor, context) {
  16887. return visitor.visitExternalExpr(this, context);
  16888. };
  16889. return ExternalExpr;
  16890. }(Expression));
  16891. var ExternalReference = /** @class */ (function () {
  16892. function ExternalReference(moduleName, name, runtime) {
  16893. this.moduleName = moduleName;
  16894. this.name = name;
  16895. this.runtime = runtime;
  16896. }
  16897. return ExternalReference;
  16898. }());
  16899. var ConditionalExpr = /** @class */ (function (_super) {
  16900. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ConditionalExpr, _super);
  16901. function ConditionalExpr(condition, trueCase, falseCase, type, sourceSpan) {
  16902. if (falseCase === void 0) { falseCase = null; }
  16903. var _this = _super.call(this, type || trueCase.type, sourceSpan) || this;
  16904. _this.condition = condition;
  16905. _this.falseCase = falseCase;
  16906. _this.trueCase = trueCase;
  16907. return _this;
  16908. }
  16909. ConditionalExpr.prototype.isEquivalent = function (e) {
  16910. return e instanceof ConditionalExpr && this.condition.isEquivalent(e.condition) &&
  16911. this.trueCase.isEquivalent(e.trueCase) && nullSafeIsEquivalent(this.falseCase, e.falseCase);
  16912. };
  16913. ConditionalExpr.prototype.isConstant = function () { return false; };
  16914. ConditionalExpr.prototype.visitExpression = function (visitor, context) {
  16915. return visitor.visitConditionalExpr(this, context);
  16916. };
  16917. return ConditionalExpr;
  16918. }(Expression));
  16919. var NotExpr = /** @class */ (function (_super) {
  16920. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NotExpr, _super);
  16921. function NotExpr(condition, sourceSpan) {
  16922. var _this = _super.call(this, BOOL_TYPE, sourceSpan) || this;
  16923. _this.condition = condition;
  16924. return _this;
  16925. }
  16926. NotExpr.prototype.isEquivalent = function (e) {
  16927. return e instanceof NotExpr && this.condition.isEquivalent(e.condition);
  16928. };
  16929. NotExpr.prototype.isConstant = function () { return false; };
  16930. NotExpr.prototype.visitExpression = function (visitor, context) {
  16931. return visitor.visitNotExpr(this, context);
  16932. };
  16933. return NotExpr;
  16934. }(Expression));
  16935. var AssertNotNull = /** @class */ (function (_super) {
  16936. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AssertNotNull, _super);
  16937. function AssertNotNull(condition, sourceSpan) {
  16938. var _this = _super.call(this, condition.type, sourceSpan) || this;
  16939. _this.condition = condition;
  16940. return _this;
  16941. }
  16942. AssertNotNull.prototype.isEquivalent = function (e) {
  16943. return e instanceof AssertNotNull && this.condition.isEquivalent(e.condition);
  16944. };
  16945. AssertNotNull.prototype.isConstant = function () { return false; };
  16946. AssertNotNull.prototype.visitExpression = function (visitor, context) {
  16947. return visitor.visitAssertNotNullExpr(this, context);
  16948. };
  16949. return AssertNotNull;
  16950. }(Expression));
  16951. var CastExpr = /** @class */ (function (_super) {
  16952. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CastExpr, _super);
  16953. function CastExpr(value, type, sourceSpan) {
  16954. var _this = _super.call(this, type, sourceSpan) || this;
  16955. _this.value = value;
  16956. return _this;
  16957. }
  16958. CastExpr.prototype.isEquivalent = function (e) {
  16959. return e instanceof CastExpr && this.value.isEquivalent(e.value);
  16960. };
  16961. CastExpr.prototype.isConstant = function () { return false; };
  16962. CastExpr.prototype.visitExpression = function (visitor, context) {
  16963. return visitor.visitCastExpr(this, context);
  16964. };
  16965. return CastExpr;
  16966. }(Expression));
  16967. var FnParam = /** @class */ (function () {
  16968. function FnParam(name, type) {
  16969. if (type === void 0) { type = null; }
  16970. this.name = name;
  16971. this.type = type;
  16972. }
  16973. FnParam.prototype.isEquivalent = function (param) { return this.name === param.name; };
  16974. return FnParam;
  16975. }());
  16976. var FunctionExpr = /** @class */ (function (_super) {
  16977. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FunctionExpr, _super);
  16978. function FunctionExpr(params, statements, type, sourceSpan, name) {
  16979. var _this = _super.call(this, type, sourceSpan) || this;
  16980. _this.params = params;
  16981. _this.statements = statements;
  16982. _this.name = name;
  16983. return _this;
  16984. }
  16985. FunctionExpr.prototype.isEquivalent = function (e) {
  16986. return e instanceof FunctionExpr && areAllEquivalent(this.params, e.params) &&
  16987. areAllEquivalent(this.statements, e.statements);
  16988. };
  16989. FunctionExpr.prototype.isConstant = function () { return false; };
  16990. FunctionExpr.prototype.visitExpression = function (visitor, context) {
  16991. return visitor.visitFunctionExpr(this, context);
  16992. };
  16993. FunctionExpr.prototype.toDeclStmt = function (name, modifiers) {
  16994. if (modifiers === void 0) { modifiers = null; }
  16995. return new DeclareFunctionStmt(name, this.params, this.statements, this.type, modifiers, this.sourceSpan);
  16996. };
  16997. return FunctionExpr;
  16998. }(Expression));
  16999. var BinaryOperatorExpr = /** @class */ (function (_super) {
  17000. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BinaryOperatorExpr, _super);
  17001. function BinaryOperatorExpr(operator, lhs, rhs, type, sourceSpan, parens) {
  17002. if (parens === void 0) { parens = true; }
  17003. var _this = _super.call(this, type || lhs.type, sourceSpan) || this;
  17004. _this.operator = operator;
  17005. _this.rhs = rhs;
  17006. _this.parens = parens;
  17007. _this.lhs = lhs;
  17008. return _this;
  17009. }
  17010. BinaryOperatorExpr.prototype.isEquivalent = function (e) {
  17011. return e instanceof BinaryOperatorExpr && this.operator === e.operator &&
  17012. this.lhs.isEquivalent(e.lhs) && this.rhs.isEquivalent(e.rhs);
  17013. };
  17014. BinaryOperatorExpr.prototype.isConstant = function () { return false; };
  17015. BinaryOperatorExpr.prototype.visitExpression = function (visitor, context) {
  17016. return visitor.visitBinaryOperatorExpr(this, context);
  17017. };
  17018. return BinaryOperatorExpr;
  17019. }(Expression));
  17020. var ReadPropExpr = /** @class */ (function (_super) {
  17021. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ReadPropExpr, _super);
  17022. function ReadPropExpr(receiver, name, type, sourceSpan) {
  17023. var _this = _super.call(this, type, sourceSpan) || this;
  17024. _this.receiver = receiver;
  17025. _this.name = name;
  17026. return _this;
  17027. }
  17028. ReadPropExpr.prototype.isEquivalent = function (e) {
  17029. return e instanceof ReadPropExpr && this.receiver.isEquivalent(e.receiver) &&
  17030. this.name === e.name;
  17031. };
  17032. ReadPropExpr.prototype.isConstant = function () { return false; };
  17033. ReadPropExpr.prototype.visitExpression = function (visitor, context) {
  17034. return visitor.visitReadPropExpr(this, context);
  17035. };
  17036. ReadPropExpr.prototype.set = function (value) {
  17037. return new WritePropExpr(this.receiver, this.name, value, null, this.sourceSpan);
  17038. };
  17039. return ReadPropExpr;
  17040. }(Expression));
  17041. var ReadKeyExpr = /** @class */ (function (_super) {
  17042. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ReadKeyExpr, _super);
  17043. function ReadKeyExpr(receiver, index, type, sourceSpan) {
  17044. var _this = _super.call(this, type, sourceSpan) || this;
  17045. _this.receiver = receiver;
  17046. _this.index = index;
  17047. return _this;
  17048. }
  17049. ReadKeyExpr.prototype.isEquivalent = function (e) {
  17050. return e instanceof ReadKeyExpr && this.receiver.isEquivalent(e.receiver) &&
  17051. this.index.isEquivalent(e.index);
  17052. };
  17053. ReadKeyExpr.prototype.isConstant = function () { return false; };
  17054. ReadKeyExpr.prototype.visitExpression = function (visitor, context) {
  17055. return visitor.visitReadKeyExpr(this, context);
  17056. };
  17057. ReadKeyExpr.prototype.set = function (value) {
  17058. return new WriteKeyExpr(this.receiver, this.index, value, null, this.sourceSpan);
  17059. };
  17060. return ReadKeyExpr;
  17061. }(Expression));
  17062. var LiteralArrayExpr = /** @class */ (function (_super) {
  17063. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LiteralArrayExpr, _super);
  17064. function LiteralArrayExpr(entries, type, sourceSpan) {
  17065. var _this = _super.call(this, type, sourceSpan) || this;
  17066. _this.entries = entries;
  17067. return _this;
  17068. }
  17069. LiteralArrayExpr.prototype.isConstant = function () { return this.entries.every(function (e) { return e.isConstant(); }); };
  17070. LiteralArrayExpr.prototype.isEquivalent = function (e) {
  17071. return e instanceof LiteralArrayExpr && areAllEquivalent(this.entries, e.entries);
  17072. };
  17073. LiteralArrayExpr.prototype.visitExpression = function (visitor, context) {
  17074. return visitor.visitLiteralArrayExpr(this, context);
  17075. };
  17076. return LiteralArrayExpr;
  17077. }(Expression));
  17078. var LiteralMapEntry = /** @class */ (function () {
  17079. function LiteralMapEntry(key, value, quoted) {
  17080. this.key = key;
  17081. this.value = value;
  17082. this.quoted = quoted;
  17083. }
  17084. LiteralMapEntry.prototype.isEquivalent = function (e) {
  17085. return this.key === e.key && this.value.isEquivalent(e.value);
  17086. };
  17087. return LiteralMapEntry;
  17088. }());
  17089. var LiteralMapExpr = /** @class */ (function (_super) {
  17090. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(LiteralMapExpr, _super);
  17091. function LiteralMapExpr(entries, type, sourceSpan) {
  17092. var _this = _super.call(this, type, sourceSpan) || this;
  17093. _this.entries = entries;
  17094. _this.valueType = null;
  17095. if (type) {
  17096. _this.valueType = type.valueType;
  17097. }
  17098. return _this;
  17099. }
  17100. LiteralMapExpr.prototype.isEquivalent = function (e) {
  17101. return e instanceof LiteralMapExpr && areAllEquivalent(this.entries, e.entries);
  17102. };
  17103. LiteralMapExpr.prototype.isConstant = function () { return this.entries.every(function (e) { return e.value.isConstant(); }); };
  17104. LiteralMapExpr.prototype.visitExpression = function (visitor, context) {
  17105. return visitor.visitLiteralMapExpr(this, context);
  17106. };
  17107. return LiteralMapExpr;
  17108. }(Expression));
  17109. var CommaExpr = /** @class */ (function (_super) {
  17110. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CommaExpr, _super);
  17111. function CommaExpr(parts, sourceSpan) {
  17112. var _this = _super.call(this, parts[parts.length - 1].type, sourceSpan) || this;
  17113. _this.parts = parts;
  17114. return _this;
  17115. }
  17116. CommaExpr.prototype.isEquivalent = function (e) {
  17117. return e instanceof CommaExpr && areAllEquivalent(this.parts, e.parts);
  17118. };
  17119. CommaExpr.prototype.isConstant = function () { return false; };
  17120. CommaExpr.prototype.visitExpression = function (visitor, context) {
  17121. return visitor.visitCommaExpr(this, context);
  17122. };
  17123. return CommaExpr;
  17124. }(Expression));
  17125. var THIS_EXPR = new ReadVarExpr(BuiltinVar.This, null, null);
  17126. var SUPER_EXPR = new ReadVarExpr(BuiltinVar.Super, null, null);
  17127. var CATCH_ERROR_VAR = new ReadVarExpr(BuiltinVar.CatchError, null, null);
  17128. var CATCH_STACK_VAR = new ReadVarExpr(BuiltinVar.CatchStack, null, null);
  17129. var NULL_EXPR = new LiteralExpr(null, null, null);
  17130. var TYPED_NULL_EXPR = new LiteralExpr(null, INFERRED_TYPE, null);
  17131. //// Statements
  17132. var StmtModifier;
  17133. (function (StmtModifier) {
  17134. StmtModifier[StmtModifier["Final"] = 0] = "Final";
  17135. StmtModifier[StmtModifier["Private"] = 1] = "Private";
  17136. StmtModifier[StmtModifier["Exported"] = 2] = "Exported";
  17137. StmtModifier[StmtModifier["Static"] = 3] = "Static";
  17138. })(StmtModifier || (StmtModifier = {}));
  17139. var Statement = /** @class */ (function () {
  17140. function Statement(modifiers, sourceSpan) {
  17141. this.modifiers = modifiers || [];
  17142. this.sourceSpan = sourceSpan || null;
  17143. }
  17144. Statement.prototype.hasModifier = function (modifier) { return this.modifiers.indexOf(modifier) !== -1; };
  17145. return Statement;
  17146. }());
  17147. var DeclareVarStmt = /** @class */ (function (_super) {
  17148. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DeclareVarStmt, _super);
  17149. function DeclareVarStmt(name, value, type, modifiers, sourceSpan) {
  17150. if (modifiers === void 0) { modifiers = null; }
  17151. var _this = _super.call(this, modifiers, sourceSpan) || this;
  17152. _this.name = name;
  17153. _this.value = value;
  17154. _this.type = type || (value && value.type) || null;
  17155. return _this;
  17156. }
  17157. DeclareVarStmt.prototype.isEquivalent = function (stmt) {
  17158. return stmt instanceof DeclareVarStmt && this.name === stmt.name &&
  17159. (this.value ? !!stmt.value && this.value.isEquivalent(stmt.value) : !stmt.value);
  17160. };
  17161. DeclareVarStmt.prototype.visitStatement = function (visitor, context) {
  17162. return visitor.visitDeclareVarStmt(this, context);
  17163. };
  17164. return DeclareVarStmt;
  17165. }(Statement));
  17166. var DeclareFunctionStmt = /** @class */ (function (_super) {
  17167. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DeclareFunctionStmt, _super);
  17168. function DeclareFunctionStmt(name, params, statements, type, modifiers, sourceSpan) {
  17169. if (modifiers === void 0) { modifiers = null; }
  17170. var _this = _super.call(this, modifiers, sourceSpan) || this;
  17171. _this.name = name;
  17172. _this.params = params;
  17173. _this.statements = statements;
  17174. _this.type = type || null;
  17175. return _this;
  17176. }
  17177. DeclareFunctionStmt.prototype.isEquivalent = function (stmt) {
  17178. return stmt instanceof DeclareFunctionStmt && areAllEquivalent(this.params, stmt.params) &&
  17179. areAllEquivalent(this.statements, stmt.statements);
  17180. };
  17181. DeclareFunctionStmt.prototype.visitStatement = function (visitor, context) {
  17182. return visitor.visitDeclareFunctionStmt(this, context);
  17183. };
  17184. return DeclareFunctionStmt;
  17185. }(Statement));
  17186. var ExpressionStatement = /** @class */ (function (_super) {
  17187. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ExpressionStatement, _super);
  17188. function ExpressionStatement(expr, sourceSpan) {
  17189. var _this = _super.call(this, null, sourceSpan) || this;
  17190. _this.expr = expr;
  17191. return _this;
  17192. }
  17193. ExpressionStatement.prototype.isEquivalent = function (stmt) {
  17194. return stmt instanceof ExpressionStatement && this.expr.isEquivalent(stmt.expr);
  17195. };
  17196. ExpressionStatement.prototype.visitStatement = function (visitor, context) {
  17197. return visitor.visitExpressionStmt(this, context);
  17198. };
  17199. return ExpressionStatement;
  17200. }(Statement));
  17201. var ReturnStatement = /** @class */ (function (_super) {
  17202. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ReturnStatement, _super);
  17203. function ReturnStatement(value, sourceSpan) {
  17204. var _this = _super.call(this, null, sourceSpan) || this;
  17205. _this.value = value;
  17206. return _this;
  17207. }
  17208. ReturnStatement.prototype.isEquivalent = function (stmt) {
  17209. return stmt instanceof ReturnStatement && this.value.isEquivalent(stmt.value);
  17210. };
  17211. ReturnStatement.prototype.visitStatement = function (visitor, context) {
  17212. return visitor.visitReturnStmt(this, context);
  17213. };
  17214. return ReturnStatement;
  17215. }(Statement));
  17216. var AbstractClassPart = /** @class */ (function () {
  17217. function AbstractClassPart(type, modifiers) {
  17218. this.modifiers = modifiers;
  17219. if (!modifiers) {
  17220. this.modifiers = [];
  17221. }
  17222. this.type = type || null;
  17223. }
  17224. AbstractClassPart.prototype.hasModifier = function (modifier) { return this.modifiers.indexOf(modifier) !== -1; };
  17225. return AbstractClassPart;
  17226. }());
  17227. var ClassField = /** @class */ (function (_super) {
  17228. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ClassField, _super);
  17229. function ClassField(name, type, modifiers, initializer) {
  17230. if (modifiers === void 0) { modifiers = null; }
  17231. var _this = _super.call(this, type, modifiers) || this;
  17232. _this.name = name;
  17233. _this.initializer = initializer;
  17234. return _this;
  17235. }
  17236. ClassField.prototype.isEquivalent = function (f) { return this.name === f.name; };
  17237. return ClassField;
  17238. }(AbstractClassPart));
  17239. var ClassMethod = /** @class */ (function (_super) {
  17240. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ClassMethod, _super);
  17241. function ClassMethod(name, params, body, type, modifiers) {
  17242. if (modifiers === void 0) { modifiers = null; }
  17243. var _this = _super.call(this, type, modifiers) || this;
  17244. _this.name = name;
  17245. _this.params = params;
  17246. _this.body = body;
  17247. return _this;
  17248. }
  17249. ClassMethod.prototype.isEquivalent = function (m) {
  17250. return this.name === m.name && areAllEquivalent(this.body, m.body);
  17251. };
  17252. return ClassMethod;
  17253. }(AbstractClassPart));
  17254. var ClassGetter = /** @class */ (function (_super) {
  17255. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ClassGetter, _super);
  17256. function ClassGetter(name, body, type, modifiers) {
  17257. if (modifiers === void 0) { modifiers = null; }
  17258. var _this = _super.call(this, type, modifiers) || this;
  17259. _this.name = name;
  17260. _this.body = body;
  17261. return _this;
  17262. }
  17263. ClassGetter.prototype.isEquivalent = function (m) {
  17264. return this.name === m.name && areAllEquivalent(this.body, m.body);
  17265. };
  17266. return ClassGetter;
  17267. }(AbstractClassPart));
  17268. var ClassStmt = /** @class */ (function (_super) {
  17269. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ClassStmt, _super);
  17270. function ClassStmt(name, parent, fields, getters, constructorMethod, methods, modifiers, sourceSpan) {
  17271. if (modifiers === void 0) { modifiers = null; }
  17272. var _this = _super.call(this, modifiers, sourceSpan) || this;
  17273. _this.name = name;
  17274. _this.parent = parent;
  17275. _this.fields = fields;
  17276. _this.getters = getters;
  17277. _this.constructorMethod = constructorMethod;
  17278. _this.methods = methods;
  17279. return _this;
  17280. }
  17281. ClassStmt.prototype.isEquivalent = function (stmt) {
  17282. return stmt instanceof ClassStmt && this.name === stmt.name &&
  17283. nullSafeIsEquivalent(this.parent, stmt.parent) &&
  17284. areAllEquivalent(this.fields, stmt.fields) &&
  17285. areAllEquivalent(this.getters, stmt.getters) &&
  17286. this.constructorMethod.isEquivalent(stmt.constructorMethod) &&
  17287. areAllEquivalent(this.methods, stmt.methods);
  17288. };
  17289. ClassStmt.prototype.visitStatement = function (visitor, context) {
  17290. return visitor.visitDeclareClassStmt(this, context);
  17291. };
  17292. return ClassStmt;
  17293. }(Statement));
  17294. var IfStmt = /** @class */ (function (_super) {
  17295. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(IfStmt, _super);
  17296. function IfStmt(condition, trueCase, falseCase, sourceSpan) {
  17297. if (falseCase === void 0) { falseCase = []; }
  17298. var _this = _super.call(this, null, sourceSpan) || this;
  17299. _this.condition = condition;
  17300. _this.trueCase = trueCase;
  17301. _this.falseCase = falseCase;
  17302. return _this;
  17303. }
  17304. IfStmt.prototype.isEquivalent = function (stmt) {
  17305. return stmt instanceof IfStmt && this.condition.isEquivalent(stmt.condition) &&
  17306. areAllEquivalent(this.trueCase, stmt.trueCase) &&
  17307. areAllEquivalent(this.falseCase, stmt.falseCase);
  17308. };
  17309. IfStmt.prototype.visitStatement = function (visitor, context) {
  17310. return visitor.visitIfStmt(this, context);
  17311. };
  17312. return IfStmt;
  17313. }(Statement));
  17314. var CommentStmt = /** @class */ (function (_super) {
  17315. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CommentStmt, _super);
  17316. function CommentStmt(comment, multiline, sourceSpan) {
  17317. if (multiline === void 0) { multiline = false; }
  17318. var _this = _super.call(this, null, sourceSpan) || this;
  17319. _this.comment = comment;
  17320. _this.multiline = multiline;
  17321. return _this;
  17322. }
  17323. CommentStmt.prototype.isEquivalent = function (stmt) { return stmt instanceof CommentStmt; };
  17324. CommentStmt.prototype.visitStatement = function (visitor, context) {
  17325. return visitor.visitCommentStmt(this, context);
  17326. };
  17327. return CommentStmt;
  17328. }(Statement));
  17329. var JSDocCommentStmt = /** @class */ (function (_super) {
  17330. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(JSDocCommentStmt, _super);
  17331. function JSDocCommentStmt(tags, sourceSpan) {
  17332. if (tags === void 0) { tags = []; }
  17333. var _this = _super.call(this, null, sourceSpan) || this;
  17334. _this.tags = tags;
  17335. return _this;
  17336. }
  17337. JSDocCommentStmt.prototype.isEquivalent = function (stmt) {
  17338. return stmt instanceof JSDocCommentStmt && this.toString() === stmt.toString();
  17339. };
  17340. JSDocCommentStmt.prototype.visitStatement = function (visitor, context) {
  17341. return visitor.visitJSDocCommentStmt(this, context);
  17342. };
  17343. JSDocCommentStmt.prototype.toString = function () { return serializeTags(this.tags); };
  17344. return JSDocCommentStmt;
  17345. }(Statement));
  17346. var TryCatchStmt = /** @class */ (function (_super) {
  17347. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TryCatchStmt, _super);
  17348. function TryCatchStmt(bodyStmts, catchStmts, sourceSpan) {
  17349. var _this = _super.call(this, null, sourceSpan) || this;
  17350. _this.bodyStmts = bodyStmts;
  17351. _this.catchStmts = catchStmts;
  17352. return _this;
  17353. }
  17354. TryCatchStmt.prototype.isEquivalent = function (stmt) {
  17355. return stmt instanceof TryCatchStmt && areAllEquivalent(this.bodyStmts, stmt.bodyStmts) &&
  17356. areAllEquivalent(this.catchStmts, stmt.catchStmts);
  17357. };
  17358. TryCatchStmt.prototype.visitStatement = function (visitor, context) {
  17359. return visitor.visitTryCatchStmt(this, context);
  17360. };
  17361. return TryCatchStmt;
  17362. }(Statement));
  17363. var ThrowStmt = /** @class */ (function (_super) {
  17364. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ThrowStmt, _super);
  17365. function ThrowStmt(error, sourceSpan) {
  17366. var _this = _super.call(this, null, sourceSpan) || this;
  17367. _this.error = error;
  17368. return _this;
  17369. }
  17370. ThrowStmt.prototype.isEquivalent = function (stmt) {
  17371. return stmt instanceof TryCatchStmt && this.error.isEquivalent(stmt.error);
  17372. };
  17373. ThrowStmt.prototype.visitStatement = function (visitor, context) {
  17374. return visitor.visitThrowStmt(this, context);
  17375. };
  17376. return ThrowStmt;
  17377. }(Statement));
  17378. var AstTransformer$1 = /** @class */ (function () {
  17379. function AstTransformer() {
  17380. }
  17381. AstTransformer.prototype.transformExpr = function (expr, context) { return expr; };
  17382. AstTransformer.prototype.transformStmt = function (stmt, context) { return stmt; };
  17383. AstTransformer.prototype.visitReadVarExpr = function (ast, context) { return this.transformExpr(ast, context); };
  17384. AstTransformer.prototype.visitWrappedNodeExpr = function (ast, context) {
  17385. return this.transformExpr(ast, context);
  17386. };
  17387. AstTransformer.prototype.visitTypeofExpr = function (expr, context) {
  17388. return this.transformExpr(new TypeofExpr(expr.expr.visitExpression(this, context), expr.type, expr.sourceSpan), context);
  17389. };
  17390. AstTransformer.prototype.visitWriteVarExpr = function (expr, context) {
  17391. return this.transformExpr(new WriteVarExpr(expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
  17392. };
  17393. AstTransformer.prototype.visitWriteKeyExpr = function (expr, context) {
  17394. 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);
  17395. };
  17396. AstTransformer.prototype.visitWritePropExpr = function (expr, context) {
  17397. return this.transformExpr(new WritePropExpr(expr.receiver.visitExpression(this, context), expr.name, expr.value.visitExpression(this, context), expr.type, expr.sourceSpan), context);
  17398. };
  17399. AstTransformer.prototype.visitInvokeMethodExpr = function (ast, context) {
  17400. var method = ast.builtin || ast.name;
  17401. return this.transformExpr(new InvokeMethodExpr(ast.receiver.visitExpression(this, context), method, this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
  17402. };
  17403. AstTransformer.prototype.visitInvokeFunctionExpr = function (ast, context) {
  17404. return this.transformExpr(new InvokeFunctionExpr(ast.fn.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
  17405. };
  17406. AstTransformer.prototype.visitInstantiateExpr = function (ast, context) {
  17407. return this.transformExpr(new InstantiateExpr(ast.classExpr.visitExpression(this, context), this.visitAllExpressions(ast.args, context), ast.type, ast.sourceSpan), context);
  17408. };
  17409. AstTransformer.prototype.visitLiteralExpr = function (ast, context) { return this.transformExpr(ast, context); };
  17410. AstTransformer.prototype.visitExternalExpr = function (ast, context) {
  17411. return this.transformExpr(ast, context);
  17412. };
  17413. AstTransformer.prototype.visitConditionalExpr = function (ast, context) {
  17414. return this.transformExpr(new ConditionalExpr(ast.condition.visitExpression(this, context), ast.trueCase.visitExpression(this, context), ast.falseCase.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  17415. };
  17416. AstTransformer.prototype.visitNotExpr = function (ast, context) {
  17417. return this.transformExpr(new NotExpr(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
  17418. };
  17419. AstTransformer.prototype.visitAssertNotNullExpr = function (ast, context) {
  17420. return this.transformExpr(new AssertNotNull(ast.condition.visitExpression(this, context), ast.sourceSpan), context);
  17421. };
  17422. AstTransformer.prototype.visitCastExpr = function (ast, context) {
  17423. return this.transformExpr(new CastExpr(ast.value.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  17424. };
  17425. AstTransformer.prototype.visitFunctionExpr = function (ast, context) {
  17426. return this.transformExpr(new FunctionExpr(ast.params, this.visitAllStatements(ast.statements, context), ast.type, ast.sourceSpan), context);
  17427. };
  17428. AstTransformer.prototype.visitBinaryOperatorExpr = function (ast, context) {
  17429. return this.transformExpr(new BinaryOperatorExpr(ast.operator, ast.lhs.visitExpression(this, context), ast.rhs.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  17430. };
  17431. AstTransformer.prototype.visitReadPropExpr = function (ast, context) {
  17432. return this.transformExpr(new ReadPropExpr(ast.receiver.visitExpression(this, context), ast.name, ast.type, ast.sourceSpan), context);
  17433. };
  17434. AstTransformer.prototype.visitReadKeyExpr = function (ast, context) {
  17435. return this.transformExpr(new ReadKeyExpr(ast.receiver.visitExpression(this, context), ast.index.visitExpression(this, context), ast.type, ast.sourceSpan), context);
  17436. };
  17437. AstTransformer.prototype.visitLiteralArrayExpr = function (ast, context) {
  17438. return this.transformExpr(new LiteralArrayExpr(this.visitAllExpressions(ast.entries, context), ast.type, ast.sourceSpan), context);
  17439. };
  17440. AstTransformer.prototype.visitLiteralMapExpr = function (ast, context) {
  17441. var _this = this;
  17442. var entries = ast.entries.map(function (entry) { return new LiteralMapEntry(entry.key, entry.value.visitExpression(_this, context), entry.quoted); });
  17443. var mapType = new MapType(ast.valueType, null);
  17444. return this.transformExpr(new LiteralMapExpr(entries, mapType, ast.sourceSpan), context);
  17445. };
  17446. AstTransformer.prototype.visitCommaExpr = function (ast, context) {
  17447. return this.transformExpr(new CommaExpr(this.visitAllExpressions(ast.parts, context), ast.sourceSpan), context);
  17448. };
  17449. AstTransformer.prototype.visitAllExpressions = function (exprs, context) {
  17450. var _this = this;
  17451. return exprs.map(function (expr) { return expr.visitExpression(_this, context); });
  17452. };
  17453. AstTransformer.prototype.visitDeclareVarStmt = function (stmt, context) {
  17454. var value = stmt.value && stmt.value.visitExpression(this, context);
  17455. return this.transformStmt(new DeclareVarStmt(stmt.name, value, stmt.type, stmt.modifiers, stmt.sourceSpan), context);
  17456. };
  17457. AstTransformer.prototype.visitDeclareFunctionStmt = function (stmt, context) {
  17458. return this.transformStmt(new DeclareFunctionStmt(stmt.name, stmt.params, this.visitAllStatements(stmt.statements, context), stmt.type, stmt.modifiers, stmt.sourceSpan), context);
  17459. };
  17460. AstTransformer.prototype.visitExpressionStmt = function (stmt, context) {
  17461. return this.transformStmt(new ExpressionStatement(stmt.expr.visitExpression(this, context), stmt.sourceSpan), context);
  17462. };
  17463. AstTransformer.prototype.visitReturnStmt = function (stmt, context) {
  17464. return this.transformStmt(new ReturnStatement(stmt.value.visitExpression(this, context), stmt.sourceSpan), context);
  17465. };
  17466. AstTransformer.prototype.visitDeclareClassStmt = function (stmt, context) {
  17467. var _this = this;
  17468. var parent = stmt.parent.visitExpression(this, context);
  17469. var getters = stmt.getters.map(function (getter) { return new ClassGetter(getter.name, _this.visitAllStatements(getter.body, context), getter.type, getter.modifiers); });
  17470. var ctorMethod = stmt.constructorMethod &&
  17471. new ClassMethod(stmt.constructorMethod.name, stmt.constructorMethod.params, this.visitAllStatements(stmt.constructorMethod.body, context), stmt.constructorMethod.type, stmt.constructorMethod.modifiers);
  17472. var methods = stmt.methods.map(function (method) { return new ClassMethod(method.name, method.params, _this.visitAllStatements(method.body, context), method.type, method.modifiers); });
  17473. return this.transformStmt(new ClassStmt(stmt.name, parent, stmt.fields, getters, ctorMethod, methods, stmt.modifiers, stmt.sourceSpan), context);
  17474. };
  17475. AstTransformer.prototype.visitIfStmt = function (stmt, context) {
  17476. return this.transformStmt(new IfStmt(stmt.condition.visitExpression(this, context), this.visitAllStatements(stmt.trueCase, context), this.visitAllStatements(stmt.falseCase, context), stmt.sourceSpan), context);
  17477. };
  17478. AstTransformer.prototype.visitTryCatchStmt = function (stmt, context) {
  17479. return this.transformStmt(new TryCatchStmt(this.visitAllStatements(stmt.bodyStmts, context), this.visitAllStatements(stmt.catchStmts, context), stmt.sourceSpan), context);
  17480. };
  17481. AstTransformer.prototype.visitThrowStmt = function (stmt, context) {
  17482. return this.transformStmt(new ThrowStmt(stmt.error.visitExpression(this, context), stmt.sourceSpan), context);
  17483. };
  17484. AstTransformer.prototype.visitCommentStmt = function (stmt, context) {
  17485. return this.transformStmt(stmt, context);
  17486. };
  17487. AstTransformer.prototype.visitJSDocCommentStmt = function (stmt, context) {
  17488. return this.transformStmt(stmt, context);
  17489. };
  17490. AstTransformer.prototype.visitAllStatements = function (stmts, context) {
  17491. var _this = this;
  17492. return stmts.map(function (stmt) { return stmt.visitStatement(_this, context); });
  17493. };
  17494. return AstTransformer;
  17495. }());
  17496. var RecursiveAstVisitor$1 = /** @class */ (function () {
  17497. function RecursiveAstVisitor() {
  17498. }
  17499. RecursiveAstVisitor.prototype.visitType = function (ast, context) { return ast; };
  17500. RecursiveAstVisitor.prototype.visitExpression = function (ast, context) {
  17501. if (ast.type) {
  17502. ast.type.visitType(this, context);
  17503. }
  17504. return ast;
  17505. };
  17506. RecursiveAstVisitor.prototype.visitBuiltinType = function (type, context) { return this.visitType(type, context); };
  17507. RecursiveAstVisitor.prototype.visitExpressionType = function (type, context) {
  17508. var _this = this;
  17509. type.value.visitExpression(this, context);
  17510. if (type.typeParams !== null) {
  17511. type.typeParams.forEach(function (param) { return _this.visitType(param, context); });
  17512. }
  17513. return this.visitType(type, context);
  17514. };
  17515. RecursiveAstVisitor.prototype.visitArrayType = function (type, context) { return this.visitType(type, context); };
  17516. RecursiveAstVisitor.prototype.visitMapType = function (type, context) { return this.visitType(type, context); };
  17517. RecursiveAstVisitor.prototype.visitWrappedNodeExpr = function (ast, context) { return ast; };
  17518. RecursiveAstVisitor.prototype.visitTypeofExpr = function (ast, context) { return this.visitExpression(ast, context); };
  17519. RecursiveAstVisitor.prototype.visitReadVarExpr = function (ast, context) {
  17520. return this.visitExpression(ast, context);
  17521. };
  17522. RecursiveAstVisitor.prototype.visitWriteVarExpr = function (ast, context) {
  17523. ast.value.visitExpression(this, context);
  17524. return this.visitExpression(ast, context);
  17525. };
  17526. RecursiveAstVisitor.prototype.visitWriteKeyExpr = function (ast, context) {
  17527. ast.receiver.visitExpression(this, context);
  17528. ast.index.visitExpression(this, context);
  17529. ast.value.visitExpression(this, context);
  17530. return this.visitExpression(ast, context);
  17531. };
  17532. RecursiveAstVisitor.prototype.visitWritePropExpr = function (ast, context) {
  17533. ast.receiver.visitExpression(this, context);
  17534. ast.value.visitExpression(this, context);
  17535. return this.visitExpression(ast, context);
  17536. };
  17537. RecursiveAstVisitor.prototype.visitInvokeMethodExpr = function (ast, context) {
  17538. ast.receiver.visitExpression(this, context);
  17539. this.visitAllExpressions(ast.args, context);
  17540. return this.visitExpression(ast, context);
  17541. };
  17542. RecursiveAstVisitor.prototype.visitInvokeFunctionExpr = function (ast, context) {
  17543. ast.fn.visitExpression(this, context);
  17544. this.visitAllExpressions(ast.args, context);
  17545. return this.visitExpression(ast, context);
  17546. };
  17547. RecursiveAstVisitor.prototype.visitInstantiateExpr = function (ast, context) {
  17548. ast.classExpr.visitExpression(this, context);
  17549. this.visitAllExpressions(ast.args, context);
  17550. return this.visitExpression(ast, context);
  17551. };
  17552. RecursiveAstVisitor.prototype.visitLiteralExpr = function (ast, context) {
  17553. return this.visitExpression(ast, context);
  17554. };
  17555. RecursiveAstVisitor.prototype.visitExternalExpr = function (ast, context) {
  17556. var _this = this;
  17557. if (ast.typeParams) {
  17558. ast.typeParams.forEach(function (type) { return type.visitType(_this, context); });
  17559. }
  17560. return this.visitExpression(ast, context);
  17561. };
  17562. RecursiveAstVisitor.prototype.visitConditionalExpr = function (ast, context) {
  17563. ast.condition.visitExpression(this, context);
  17564. ast.trueCase.visitExpression(this, context);
  17565. ast.falseCase.visitExpression(this, context);
  17566. return this.visitExpression(ast, context);
  17567. };
  17568. RecursiveAstVisitor.prototype.visitNotExpr = function (ast, context) {
  17569. ast.condition.visitExpression(this, context);
  17570. return this.visitExpression(ast, context);
  17571. };
  17572. RecursiveAstVisitor.prototype.visitAssertNotNullExpr = function (ast, context) {
  17573. ast.condition.visitExpression(this, context);
  17574. return this.visitExpression(ast, context);
  17575. };
  17576. RecursiveAstVisitor.prototype.visitCastExpr = function (ast, context) {
  17577. ast.value.visitExpression(this, context);
  17578. return this.visitExpression(ast, context);
  17579. };
  17580. RecursiveAstVisitor.prototype.visitFunctionExpr = function (ast, context) {
  17581. this.visitAllStatements(ast.statements, context);
  17582. return this.visitExpression(ast, context);
  17583. };
  17584. RecursiveAstVisitor.prototype.visitBinaryOperatorExpr = function (ast, context) {
  17585. ast.lhs.visitExpression(this, context);
  17586. ast.rhs.visitExpression(this, context);
  17587. return this.visitExpression(ast, context);
  17588. };
  17589. RecursiveAstVisitor.prototype.visitReadPropExpr = function (ast, context) {
  17590. ast.receiver.visitExpression(this, context);
  17591. return this.visitExpression(ast, context);
  17592. };
  17593. RecursiveAstVisitor.prototype.visitReadKeyExpr = function (ast, context) {
  17594. ast.receiver.visitExpression(this, context);
  17595. ast.index.visitExpression(this, context);
  17596. return this.visitExpression(ast, context);
  17597. };
  17598. RecursiveAstVisitor.prototype.visitLiteralArrayExpr = function (ast, context) {
  17599. this.visitAllExpressions(ast.entries, context);
  17600. return this.visitExpression(ast, context);
  17601. };
  17602. RecursiveAstVisitor.prototype.visitLiteralMapExpr = function (ast, context) {
  17603. var _this = this;
  17604. ast.entries.forEach(function (entry) { return entry.value.visitExpression(_this, context); });
  17605. return this.visitExpression(ast, context);
  17606. };
  17607. RecursiveAstVisitor.prototype.visitCommaExpr = function (ast, context) {
  17608. this.visitAllExpressions(ast.parts, context);
  17609. return this.visitExpression(ast, context);
  17610. };
  17611. RecursiveAstVisitor.prototype.visitAllExpressions = function (exprs, context) {
  17612. var _this = this;
  17613. exprs.forEach(function (expr) { return expr.visitExpression(_this, context); });
  17614. };
  17615. RecursiveAstVisitor.prototype.visitDeclareVarStmt = function (stmt, context) {
  17616. if (stmt.value) {
  17617. stmt.value.visitExpression(this, context);
  17618. }
  17619. if (stmt.type) {
  17620. stmt.type.visitType(this, context);
  17621. }
  17622. return stmt;
  17623. };
  17624. RecursiveAstVisitor.prototype.visitDeclareFunctionStmt = function (stmt, context) {
  17625. this.visitAllStatements(stmt.statements, context);
  17626. if (stmt.type) {
  17627. stmt.type.visitType(this, context);
  17628. }
  17629. return stmt;
  17630. };
  17631. RecursiveAstVisitor.prototype.visitExpressionStmt = function (stmt, context) {
  17632. stmt.expr.visitExpression(this, context);
  17633. return stmt;
  17634. };
  17635. RecursiveAstVisitor.prototype.visitReturnStmt = function (stmt, context) {
  17636. stmt.value.visitExpression(this, context);
  17637. return stmt;
  17638. };
  17639. RecursiveAstVisitor.prototype.visitDeclareClassStmt = function (stmt, context) {
  17640. var _this = this;
  17641. stmt.parent.visitExpression(this, context);
  17642. stmt.getters.forEach(function (getter) { return _this.visitAllStatements(getter.body, context); });
  17643. if (stmt.constructorMethod) {
  17644. this.visitAllStatements(stmt.constructorMethod.body, context);
  17645. }
  17646. stmt.methods.forEach(function (method) { return _this.visitAllStatements(method.body, context); });
  17647. return stmt;
  17648. };
  17649. RecursiveAstVisitor.prototype.visitIfStmt = function (stmt, context) {
  17650. stmt.condition.visitExpression(this, context);
  17651. this.visitAllStatements(stmt.trueCase, context);
  17652. this.visitAllStatements(stmt.falseCase, context);
  17653. return stmt;
  17654. };
  17655. RecursiveAstVisitor.prototype.visitTryCatchStmt = function (stmt, context) {
  17656. this.visitAllStatements(stmt.bodyStmts, context);
  17657. this.visitAllStatements(stmt.catchStmts, context);
  17658. return stmt;
  17659. };
  17660. RecursiveAstVisitor.prototype.visitThrowStmt = function (stmt, context) {
  17661. stmt.error.visitExpression(this, context);
  17662. return stmt;
  17663. };
  17664. RecursiveAstVisitor.prototype.visitCommentStmt = function (stmt, context) { return stmt; };
  17665. RecursiveAstVisitor.prototype.visitJSDocCommentStmt = function (stmt, context) { return stmt; };
  17666. RecursiveAstVisitor.prototype.visitAllStatements = function (stmts, context) {
  17667. var _this = this;
  17668. stmts.forEach(function (stmt) { return stmt.visitStatement(_this, context); });
  17669. };
  17670. return RecursiveAstVisitor;
  17671. }());
  17672. function findReadVarNames(stmts) {
  17673. var visitor = new _ReadVarVisitor();
  17674. visitor.visitAllStatements(stmts, null);
  17675. return visitor.varNames;
  17676. }
  17677. var _ReadVarVisitor = /** @class */ (function (_super) {
  17678. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_ReadVarVisitor, _super);
  17679. function _ReadVarVisitor() {
  17680. var _this = _super !== null && _super.apply(this, arguments) || this;
  17681. _this.varNames = new Set();
  17682. return _this;
  17683. }
  17684. _ReadVarVisitor.prototype.visitDeclareFunctionStmt = function (stmt, context) {
  17685. // Don't descend into nested functions
  17686. return stmt;
  17687. };
  17688. _ReadVarVisitor.prototype.visitDeclareClassStmt = function (stmt, context) {
  17689. // Don't descend into nested classes
  17690. return stmt;
  17691. };
  17692. _ReadVarVisitor.prototype.visitReadVarExpr = function (ast, context) {
  17693. if (ast.name) {
  17694. this.varNames.add(ast.name);
  17695. }
  17696. return null;
  17697. };
  17698. return _ReadVarVisitor;
  17699. }(RecursiveAstVisitor$1));
  17700. function collectExternalReferences(stmts) {
  17701. var visitor = new _FindExternalReferencesVisitor();
  17702. visitor.visitAllStatements(stmts, null);
  17703. return visitor.externalReferences;
  17704. }
  17705. var _FindExternalReferencesVisitor = /** @class */ (function (_super) {
  17706. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_FindExternalReferencesVisitor, _super);
  17707. function _FindExternalReferencesVisitor() {
  17708. var _this = _super !== null && _super.apply(this, arguments) || this;
  17709. _this.externalReferences = [];
  17710. return _this;
  17711. }
  17712. _FindExternalReferencesVisitor.prototype.visitExternalExpr = function (e, context) {
  17713. this.externalReferences.push(e.value);
  17714. return _super.prototype.visitExternalExpr.call(this, e, context);
  17715. };
  17716. return _FindExternalReferencesVisitor;
  17717. }(RecursiveAstVisitor$1));
  17718. function applySourceSpanToStatementIfNeeded(stmt, sourceSpan) {
  17719. if (!sourceSpan) {
  17720. return stmt;
  17721. }
  17722. var transformer = new _ApplySourceSpanTransformer(sourceSpan);
  17723. return stmt.visitStatement(transformer, null);
  17724. }
  17725. function applySourceSpanToExpressionIfNeeded(expr, sourceSpan) {
  17726. if (!sourceSpan) {
  17727. return expr;
  17728. }
  17729. var transformer = new _ApplySourceSpanTransformer(sourceSpan);
  17730. return expr.visitExpression(transformer, null);
  17731. }
  17732. var _ApplySourceSpanTransformer = /** @class */ (function (_super) {
  17733. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_ApplySourceSpanTransformer, _super);
  17734. function _ApplySourceSpanTransformer(sourceSpan) {
  17735. var _this = _super.call(this) || this;
  17736. _this.sourceSpan = sourceSpan;
  17737. return _this;
  17738. }
  17739. _ApplySourceSpanTransformer.prototype._clone = function (obj) {
  17740. var clone = Object.create(obj.constructor.prototype);
  17741. for (var prop in obj) {
  17742. clone[prop] = obj[prop];
  17743. }
  17744. return clone;
  17745. };
  17746. _ApplySourceSpanTransformer.prototype.transformExpr = function (expr, context) {
  17747. if (!expr.sourceSpan) {
  17748. expr = this._clone(expr);
  17749. expr.sourceSpan = this.sourceSpan;
  17750. }
  17751. return expr;
  17752. };
  17753. _ApplySourceSpanTransformer.prototype.transformStmt = function (stmt, context) {
  17754. if (!stmt.sourceSpan) {
  17755. stmt = this._clone(stmt);
  17756. stmt.sourceSpan = this.sourceSpan;
  17757. }
  17758. return stmt;
  17759. };
  17760. return _ApplySourceSpanTransformer;
  17761. }(AstTransformer$1));
  17762. function variable(name, type, sourceSpan) {
  17763. return new ReadVarExpr(name, type, sourceSpan);
  17764. }
  17765. function importExpr(id, typeParams, sourceSpan) {
  17766. if (typeParams === void 0) { typeParams = null; }
  17767. return new ExternalExpr(id, null, typeParams, sourceSpan);
  17768. }
  17769. function importType(id, typeParams, typeModifiers) {
  17770. if (typeParams === void 0) { typeParams = null; }
  17771. if (typeModifiers === void 0) { typeModifiers = null; }
  17772. return id != null ? expressionType(importExpr(id, typeParams, null), typeModifiers) : null;
  17773. }
  17774. function expressionType(expr, typeModifiers, typeParams) {
  17775. if (typeModifiers === void 0) { typeModifiers = null; }
  17776. if (typeParams === void 0) { typeParams = null; }
  17777. return new ExpressionType(expr, typeModifiers, typeParams);
  17778. }
  17779. function typeofExpr(expr) {
  17780. return new TypeofExpr(expr);
  17781. }
  17782. function literalArr(values, type, sourceSpan) {
  17783. return new LiteralArrayExpr(values, type, sourceSpan);
  17784. }
  17785. function literalMap(values, type) {
  17786. if (type === void 0) { type = null; }
  17787. return new LiteralMapExpr(values.map(function (e) { return new LiteralMapEntry(e.key, e.value, e.quoted); }), type, null);
  17788. }
  17789. function not(expr, sourceSpan) {
  17790. return new NotExpr(expr, sourceSpan);
  17791. }
  17792. function assertNotNull(expr, sourceSpan) {
  17793. return new AssertNotNull(expr, sourceSpan);
  17794. }
  17795. function fn(params, body, type, sourceSpan, name) {
  17796. return new FunctionExpr(params, body, type, sourceSpan, name);
  17797. }
  17798. function ifStmt(condition, thenClause, elseClause) {
  17799. return new IfStmt(condition, thenClause, elseClause);
  17800. }
  17801. function literal(value, type, sourceSpan) {
  17802. return new LiteralExpr(value, type, sourceSpan);
  17803. }
  17804. function isNull(exp) {
  17805. return exp instanceof LiteralExpr && exp.value === null;
  17806. }
  17807. /*
  17808. * Serializes a `Tag` into a string.
  17809. * Returns a string like " @foo {bar} baz" (note the leading whitespace before `@foo`).
  17810. */
  17811. function tagToString(tag) {
  17812. var out = '';
  17813. if (tag.tagName) {
  17814. out += " @" + tag.tagName;
  17815. }
  17816. if (tag.text) {
  17817. if (tag.text.match(/\/\*|\*\//)) {
  17818. throw new Error('JSDoc text cannot contain "/*" and "*/"');
  17819. }
  17820. out += ' ' + tag.text.replace(/@/g, '\\@');
  17821. }
  17822. return out;
  17823. }
  17824. function serializeTags(tags) {
  17825. var e_1, _a;
  17826. if (tags.length === 0)
  17827. return '';
  17828. var out = '*\n';
  17829. try {
  17830. for (var tags_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(tags), tags_1_1 = tags_1.next(); !tags_1_1.done; tags_1_1 = tags_1.next()) {
  17831. var tag = tags_1_1.value;
  17832. out += ' *';
  17833. // If the tagToString is multi-line, insert " * " prefixes on subsequent lines.
  17834. out += tagToString(tag).replace(/\n/g, '\n * ');
  17835. out += '\n';
  17836. }
  17837. }
  17838. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  17839. finally {
  17840. try {
  17841. if (tags_1_1 && !tags_1_1.done && (_a = tags_1.return)) _a.call(tags_1);
  17842. }
  17843. finally { if (e_1) throw e_1.error; }
  17844. }
  17845. out += ' ';
  17846. return out;
  17847. }
  17848. /**
  17849. * @license
  17850. * Copyright Google Inc. All Rights Reserved.
  17851. *
  17852. * Use of this source code is governed by an MIT-style license that can be
  17853. * found in the LICENSE file at https://angular.io/license
  17854. */
  17855. var QUOTED_KEYS = '$quoted$';
  17856. function convertValueToOutputAst(ctx, value, type) {
  17857. if (type === void 0) { type = null; }
  17858. return visitValue(value, new _ValueOutputAstTransformer(ctx), type);
  17859. }
  17860. var _ValueOutputAstTransformer = /** @class */ (function () {
  17861. function _ValueOutputAstTransformer(ctx) {
  17862. this.ctx = ctx;
  17863. }
  17864. _ValueOutputAstTransformer.prototype.visitArray = function (arr, type) {
  17865. var _this = this;
  17866. return literalArr(arr.map(function (value) { return visitValue(value, _this, null); }), type);
  17867. };
  17868. _ValueOutputAstTransformer.prototype.visitStringMap = function (map, type) {
  17869. var _this = this;
  17870. var entries = [];
  17871. var quotedSet = new Set(map && map[QUOTED_KEYS]);
  17872. Object.keys(map).forEach(function (key) {
  17873. entries.push(new LiteralMapEntry(key, visitValue(map[key], _this, null), quotedSet.has(key)));
  17874. });
  17875. return new LiteralMapExpr(entries, type);
  17876. };
  17877. _ValueOutputAstTransformer.prototype.visitPrimitive = function (value, type) { return literal(value, type); };
  17878. _ValueOutputAstTransformer.prototype.visitOther = function (value, type) {
  17879. if (value instanceof Expression) {
  17880. return value;
  17881. }
  17882. else {
  17883. return this.ctx.importExpr(value);
  17884. }
  17885. };
  17886. return _ValueOutputAstTransformer;
  17887. }());
  17888. /**
  17889. * @license
  17890. * Copyright Google Inc. All Rights Reserved.
  17891. *
  17892. * Use of this source code is governed by an MIT-style license that can be
  17893. * found in the LICENSE file at https://angular.io/license
  17894. */
  17895. function mapEntry(key, value) {
  17896. return { key: key, value: value, quoted: false };
  17897. }
  17898. var InjectableCompiler = /** @class */ (function () {
  17899. function InjectableCompiler(reflector, alwaysGenerateDef) {
  17900. this.reflector = reflector;
  17901. this.alwaysGenerateDef = alwaysGenerateDef;
  17902. this.tokenInjector = reflector.resolveExternalReference(Identifiers.Injector);
  17903. }
  17904. InjectableCompiler.prototype.depsArray = function (deps, ctx) {
  17905. var _this = this;
  17906. return deps.map(function (dep) {
  17907. var token = dep;
  17908. var args = [token];
  17909. var flags = 0 /* Default */;
  17910. if (Array.isArray(dep)) {
  17911. for (var i = 0; i < dep.length; i++) {
  17912. var v = dep[i];
  17913. if (v) {
  17914. if (v.ngMetadataName === 'Optional') {
  17915. flags |= 8 /* Optional */;
  17916. }
  17917. else if (v.ngMetadataName === 'SkipSelf') {
  17918. flags |= 4 /* SkipSelf */;
  17919. }
  17920. else if (v.ngMetadataName === 'Self') {
  17921. flags |= 2 /* Self */;
  17922. }
  17923. else if (v.ngMetadataName === 'Inject') {
  17924. token = v.token;
  17925. }
  17926. else {
  17927. token = v;
  17928. }
  17929. }
  17930. }
  17931. }
  17932. var tokenExpr;
  17933. if (typeof token === 'string') {
  17934. tokenExpr = literal(token);
  17935. }
  17936. else if (token === _this.tokenInjector) {
  17937. tokenExpr = importExpr(Identifiers.INJECTOR);
  17938. }
  17939. else {
  17940. tokenExpr = ctx.importExpr(token);
  17941. }
  17942. if (flags !== 0 /* Default */) {
  17943. args = [tokenExpr, literal(flags)];
  17944. }
  17945. else {
  17946. args = [tokenExpr];
  17947. }
  17948. return importExpr(Identifiers.inject).callFn(args);
  17949. });
  17950. };
  17951. InjectableCompiler.prototype.factoryFor = function (injectable, ctx) {
  17952. var retValue;
  17953. if (injectable.useExisting) {
  17954. retValue = importExpr(Identifiers.inject).callFn([ctx.importExpr(injectable.useExisting)]);
  17955. }
  17956. else if (injectable.useFactory) {
  17957. var deps = injectable.deps || [];
  17958. if (deps.length > 0) {
  17959. retValue = ctx.importExpr(injectable.useFactory).callFn(this.depsArray(deps, ctx));
  17960. }
  17961. else {
  17962. return ctx.importExpr(injectable.useFactory);
  17963. }
  17964. }
  17965. else if (injectable.useValue) {
  17966. retValue = convertValueToOutputAst(ctx, injectable.useValue);
  17967. }
  17968. else {
  17969. var clazz = injectable.useClass || injectable.symbol;
  17970. var depArgs = this.depsArray(this.reflector.parameters(clazz), ctx);
  17971. retValue = new InstantiateExpr(ctx.importExpr(clazz), depArgs);
  17972. }
  17973. return fn([], [new ReturnStatement(retValue)], undefined, undefined, injectable.symbol.name + '_Factory');
  17974. };
  17975. InjectableCompiler.prototype.injectableDef = function (injectable, ctx) {
  17976. var providedIn = NULL_EXPR;
  17977. if (injectable.providedIn !== undefined) {
  17978. if (injectable.providedIn === null) {
  17979. providedIn = NULL_EXPR;
  17980. }
  17981. else if (typeof injectable.providedIn === 'string') {
  17982. providedIn = literal(injectable.providedIn);
  17983. }
  17984. else {
  17985. providedIn = ctx.importExpr(injectable.providedIn);
  17986. }
  17987. }
  17988. var def = [
  17989. mapEntry('factory', this.factoryFor(injectable, ctx)),
  17990. mapEntry('token', ctx.importExpr(injectable.type.reference)),
  17991. mapEntry('providedIn', providedIn),
  17992. ];
  17993. return importExpr(Identifiers.defineInjectable).callFn([literalMap(def)]);
  17994. };
  17995. InjectableCompiler.prototype.compile = function (injectable, ctx) {
  17996. if (this.alwaysGenerateDef || injectable.providedIn !== undefined) {
  17997. var className = identifierName(injectable.type);
  17998. var clazz = new ClassStmt(className, null, [
  17999. new ClassField('ngInjectableDef', INFERRED_TYPE, [StmtModifier.Static], this.injectableDef(injectable, ctx)),
  18000. ], [], new ClassMethod(null, [], []), []);
  18001. ctx.statements.push(clazz);
  18002. }
  18003. };
  18004. return InjectableCompiler;
  18005. }());
  18006. /**
  18007. * @license
  18008. * Copyright Google Inc. All Rights Reserved.
  18009. *
  18010. * Use of this source code is governed by an MIT-style license that can be
  18011. * found in the LICENSE file at https://angular.io/license
  18012. */
  18013. var STRIP_SRC_FILE_SUFFIXES = /(\.ts|\.d\.ts|\.js|\.jsx|\.tsx)$/;
  18014. var GENERATED_FILE = /\.ngfactory\.|\.ngsummary\./;
  18015. var JIT_SUMMARY_FILE = /\.ngsummary\./;
  18016. var JIT_SUMMARY_NAME = /NgSummary$/;
  18017. function ngfactoryFilePath(filePath, forceSourceFile) {
  18018. if (forceSourceFile === void 0) { forceSourceFile = false; }
  18019. var urlWithSuffix = splitTypescriptSuffix(filePath, forceSourceFile);
  18020. return urlWithSuffix[0] + ".ngfactory" + normalizeGenFileSuffix(urlWithSuffix[1]);
  18021. }
  18022. function stripGeneratedFileSuffix(filePath) {
  18023. return filePath.replace(GENERATED_FILE, '.');
  18024. }
  18025. function isGeneratedFile(filePath) {
  18026. return GENERATED_FILE.test(filePath);
  18027. }
  18028. function splitTypescriptSuffix(path, forceSourceFile) {
  18029. if (forceSourceFile === void 0) { forceSourceFile = false; }
  18030. if (path.endsWith('.d.ts')) {
  18031. return [path.slice(0, -5), forceSourceFile ? '.ts' : '.d.ts'];
  18032. }
  18033. var lastDot = path.lastIndexOf('.');
  18034. if (lastDot !== -1) {
  18035. return [path.substring(0, lastDot), path.substring(lastDot)];
  18036. }
  18037. return [path, ''];
  18038. }
  18039. function normalizeGenFileSuffix(srcFileSuffix) {
  18040. return srcFileSuffix === '.tsx' ? '.ts' : srcFileSuffix;
  18041. }
  18042. function summaryFileName(fileName) {
  18043. var fileNameWithoutSuffix = fileName.replace(STRIP_SRC_FILE_SUFFIXES, '');
  18044. return fileNameWithoutSuffix + ".ngsummary.json";
  18045. }
  18046. function summaryForJitFileName(fileName, forceSourceFile) {
  18047. if (forceSourceFile === void 0) { forceSourceFile = false; }
  18048. var urlWithSuffix = splitTypescriptSuffix(stripGeneratedFileSuffix(fileName), forceSourceFile);
  18049. return urlWithSuffix[0] + ".ngsummary" + urlWithSuffix[1];
  18050. }
  18051. function stripSummaryForJitFileSuffix(filePath) {
  18052. return filePath.replace(JIT_SUMMARY_FILE, '.');
  18053. }
  18054. function summaryForJitName(symbolName) {
  18055. return symbolName + "NgSummary";
  18056. }
  18057. function stripSummaryForJitNameSuffix(symbolName) {
  18058. return symbolName.replace(JIT_SUMMARY_NAME, '');
  18059. }
  18060. var LOWERED_SYMBOL = /\u0275\d+/;
  18061. function isLoweredSymbol(name) {
  18062. return LOWERED_SYMBOL.test(name);
  18063. }
  18064. function createLoweredSymbol(id) {
  18065. return "\u0275" + id;
  18066. }
  18067. /**
  18068. * @license
  18069. * Copyright Google Inc. All Rights Reserved.
  18070. *
  18071. * Use of this source code is governed by an MIT-style license that can be
  18072. * found in the LICENSE file at https://angular.io/license
  18073. */
  18074. var LifecycleHooks;
  18075. (function (LifecycleHooks) {
  18076. LifecycleHooks[LifecycleHooks["OnInit"] = 0] = "OnInit";
  18077. LifecycleHooks[LifecycleHooks["OnDestroy"] = 1] = "OnDestroy";
  18078. LifecycleHooks[LifecycleHooks["DoCheck"] = 2] = "DoCheck";
  18079. LifecycleHooks[LifecycleHooks["OnChanges"] = 3] = "OnChanges";
  18080. LifecycleHooks[LifecycleHooks["AfterContentInit"] = 4] = "AfterContentInit";
  18081. LifecycleHooks[LifecycleHooks["AfterContentChecked"] = 5] = "AfterContentChecked";
  18082. LifecycleHooks[LifecycleHooks["AfterViewInit"] = 6] = "AfterViewInit";
  18083. LifecycleHooks[LifecycleHooks["AfterViewChecked"] = 7] = "AfterViewChecked";
  18084. })(LifecycleHooks || (LifecycleHooks = {}));
  18085. var LIFECYCLE_HOOKS_VALUES = [
  18086. LifecycleHooks.OnInit, LifecycleHooks.OnDestroy, LifecycleHooks.DoCheck, LifecycleHooks.OnChanges,
  18087. LifecycleHooks.AfterContentInit, LifecycleHooks.AfterContentChecked, LifecycleHooks.AfterViewInit,
  18088. LifecycleHooks.AfterViewChecked
  18089. ];
  18090. function hasLifecycleHook(reflector, hook, token) {
  18091. return reflector.hasLifecycleHook(token, getHookName(hook));
  18092. }
  18093. function getAllLifecycleHooks(reflector, token) {
  18094. return LIFECYCLE_HOOKS_VALUES.filter(function (hook) { return hasLifecycleHook(reflector, hook, token); });
  18095. }
  18096. function getHookName(hook) {
  18097. switch (hook) {
  18098. case LifecycleHooks.OnInit:
  18099. return 'ngOnInit';
  18100. case LifecycleHooks.OnDestroy:
  18101. return 'ngOnDestroy';
  18102. case LifecycleHooks.DoCheck:
  18103. return 'ngDoCheck';
  18104. case LifecycleHooks.OnChanges:
  18105. return 'ngOnChanges';
  18106. case LifecycleHooks.AfterContentInit:
  18107. return 'ngAfterContentInit';
  18108. case LifecycleHooks.AfterContentChecked:
  18109. return 'ngAfterContentChecked';
  18110. case LifecycleHooks.AfterViewInit:
  18111. return 'ngAfterViewInit';
  18112. case LifecycleHooks.AfterViewChecked:
  18113. return 'ngAfterViewChecked';
  18114. }
  18115. }
  18116. /**
  18117. * @license
  18118. * Copyright Google Inc. All Rights Reserved.
  18119. *
  18120. * Use of this source code is governed by an MIT-style license that can be
  18121. * found in the LICENSE file at https://angular.io/license
  18122. */
  18123. var ERROR_COMPONENT_TYPE = 'ngComponentType';
  18124. // Design notes:
  18125. // - don't lazily create metadata:
  18126. // For some metadata, we need to do async work sometimes,
  18127. // so the user has to kick off this loading.
  18128. // But we want to report errors even when the async work is
  18129. // not required to check that the user would have been able
  18130. // to wait correctly.
  18131. var CompileMetadataResolver = /** @class */ (function () {
  18132. function CompileMetadataResolver(_config, _htmlParser, _ngModuleResolver, _directiveResolver, _pipeResolver, _summaryResolver, _schemaRegistry, _directiveNormalizer, _console, _staticSymbolCache, _reflector, _errorCollector) {
  18133. this._config = _config;
  18134. this._htmlParser = _htmlParser;
  18135. this._ngModuleResolver = _ngModuleResolver;
  18136. this._directiveResolver = _directiveResolver;
  18137. this._pipeResolver = _pipeResolver;
  18138. this._summaryResolver = _summaryResolver;
  18139. this._schemaRegistry = _schemaRegistry;
  18140. this._directiveNormalizer = _directiveNormalizer;
  18141. this._console = _console;
  18142. this._staticSymbolCache = _staticSymbolCache;
  18143. this._reflector = _reflector;
  18144. this._errorCollector = _errorCollector;
  18145. this._nonNormalizedDirectiveCache = new Map();
  18146. this._directiveCache = new Map();
  18147. this._summaryCache = new Map();
  18148. this._pipeCache = new Map();
  18149. this._ngModuleCache = new Map();
  18150. this._ngModuleOfTypes = new Map();
  18151. this._shallowModuleCache = new Map();
  18152. }
  18153. CompileMetadataResolver.prototype.getReflector = function () { return this._reflector; };
  18154. CompileMetadataResolver.prototype.clearCacheFor = function (type) {
  18155. var dirMeta = this._directiveCache.get(type);
  18156. this._directiveCache.delete(type);
  18157. this._nonNormalizedDirectiveCache.delete(type);
  18158. this._summaryCache.delete(type);
  18159. this._pipeCache.delete(type);
  18160. this._ngModuleOfTypes.delete(type);
  18161. // Clear all of the NgModule as they contain transitive information!
  18162. this._ngModuleCache.clear();
  18163. if (dirMeta) {
  18164. this._directiveNormalizer.clearCacheFor(dirMeta);
  18165. }
  18166. };
  18167. CompileMetadataResolver.prototype.clearCache = function () {
  18168. this._directiveCache.clear();
  18169. this._nonNormalizedDirectiveCache.clear();
  18170. this._summaryCache.clear();
  18171. this._pipeCache.clear();
  18172. this._ngModuleCache.clear();
  18173. this._ngModuleOfTypes.clear();
  18174. this._directiveNormalizer.clearCache();
  18175. };
  18176. CompileMetadataResolver.prototype._createProxyClass = function (baseType, name) {
  18177. var delegate = null;
  18178. var proxyClass = function () {
  18179. if (!delegate) {
  18180. throw new Error("Illegal state: Class " + name + " for type " + stringify(baseType) + " is not compiled yet!");
  18181. }
  18182. return delegate.apply(this, arguments);
  18183. };
  18184. proxyClass.setDelegate = function (d) {
  18185. delegate = d;
  18186. proxyClass.prototype = d.prototype;
  18187. };
  18188. // Make stringify work correctly
  18189. proxyClass.overriddenName = name;
  18190. return proxyClass;
  18191. };
  18192. CompileMetadataResolver.prototype.getGeneratedClass = function (dirType, name) {
  18193. if (dirType instanceof StaticSymbol) {
  18194. return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), name);
  18195. }
  18196. else {
  18197. return this._createProxyClass(dirType, name);
  18198. }
  18199. };
  18200. CompileMetadataResolver.prototype.getComponentViewClass = function (dirType) {
  18201. return this.getGeneratedClass(dirType, viewClassName(dirType, 0));
  18202. };
  18203. CompileMetadataResolver.prototype.getHostComponentViewClass = function (dirType) {
  18204. return this.getGeneratedClass(dirType, hostViewClassName(dirType));
  18205. };
  18206. CompileMetadataResolver.prototype.getHostComponentType = function (dirType) {
  18207. var name = identifierName({ reference: dirType }) + "_Host";
  18208. if (dirType instanceof StaticSymbol) {
  18209. return this._staticSymbolCache.get(dirType.filePath, name);
  18210. }
  18211. else {
  18212. var HostClass = function HostClass() { };
  18213. HostClass.overriddenName = name;
  18214. return HostClass;
  18215. }
  18216. };
  18217. CompileMetadataResolver.prototype.getRendererType = function (dirType) {
  18218. if (dirType instanceof StaticSymbol) {
  18219. return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), rendererTypeName(dirType));
  18220. }
  18221. else {
  18222. // returning an object as proxy,
  18223. // that we fill later during runtime compilation.
  18224. return {};
  18225. }
  18226. };
  18227. CompileMetadataResolver.prototype.getComponentFactory = function (selector, dirType, inputs, outputs) {
  18228. if (dirType instanceof StaticSymbol) {
  18229. return this._staticSymbolCache.get(ngfactoryFilePath(dirType.filePath), componentFactoryName(dirType));
  18230. }
  18231. else {
  18232. var hostView = this.getHostComponentViewClass(dirType);
  18233. // Note: ngContentSelectors will be filled later once the template is
  18234. // loaded.
  18235. var createComponentFactory = this._reflector.resolveExternalReference(Identifiers.createComponentFactory);
  18236. return createComponentFactory(selector, dirType, hostView, inputs, outputs, []);
  18237. }
  18238. };
  18239. CompileMetadataResolver.prototype.initComponentFactory = function (factory, ngContentSelectors) {
  18240. var _a;
  18241. if (!(factory instanceof StaticSymbol)) {
  18242. (_a = factory.ngContentSelectors).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(ngContentSelectors));
  18243. }
  18244. };
  18245. CompileMetadataResolver.prototype._loadSummary = function (type, kind) {
  18246. var typeSummary = this._summaryCache.get(type);
  18247. if (!typeSummary) {
  18248. var summary = this._summaryResolver.resolveSummary(type);
  18249. typeSummary = summary ? summary.type : null;
  18250. this._summaryCache.set(type, typeSummary || null);
  18251. }
  18252. return typeSummary && typeSummary.summaryKind === kind ? typeSummary : null;
  18253. };
  18254. CompileMetadataResolver.prototype.getHostComponentMetadata = function (compMeta, hostViewType) {
  18255. var hostType = this.getHostComponentType(compMeta.type.reference);
  18256. if (!hostViewType) {
  18257. hostViewType = this.getHostComponentViewClass(hostType);
  18258. }
  18259. // Note: ! is ok here as this method should only be called with normalized directive
  18260. // metadata, which always fills in the selector.
  18261. var template = CssSelector.parse(compMeta.selector)[0].getMatchingElementTemplate();
  18262. var templateUrl = '';
  18263. var htmlAst = this._htmlParser.parse(template, templateUrl);
  18264. return CompileDirectiveMetadata.create({
  18265. isHost: true,
  18266. type: { reference: hostType, diDeps: [], lifecycleHooks: [] },
  18267. template: new CompileTemplateMetadata({
  18268. encapsulation: ViewEncapsulation.None,
  18269. template: template,
  18270. templateUrl: templateUrl,
  18271. htmlAst: htmlAst,
  18272. styles: [],
  18273. styleUrls: [],
  18274. ngContentSelectors: [],
  18275. animations: [],
  18276. isInline: true,
  18277. externalStylesheets: [],
  18278. interpolation: null,
  18279. preserveWhitespaces: false,
  18280. }),
  18281. exportAs: null,
  18282. changeDetection: ChangeDetectionStrategy.Default,
  18283. inputs: [],
  18284. outputs: [],
  18285. host: {},
  18286. isComponent: true,
  18287. selector: '*',
  18288. providers: [],
  18289. viewProviders: [],
  18290. queries: [],
  18291. guards: {},
  18292. viewQueries: [],
  18293. componentViewType: hostViewType,
  18294. rendererType: { id: '__Host__', encapsulation: ViewEncapsulation.None, styles: [], data: {} },
  18295. entryComponents: [],
  18296. componentFactory: null
  18297. });
  18298. };
  18299. CompileMetadataResolver.prototype.loadDirectiveMetadata = function (ngModuleType, directiveType, isSync) {
  18300. var _this = this;
  18301. if (this._directiveCache.has(directiveType)) {
  18302. return null;
  18303. }
  18304. directiveType = resolveForwardRef(directiveType);
  18305. var _a = this.getNonNormalizedDirectiveMetadata(directiveType), annotation = _a.annotation, metadata = _a.metadata;
  18306. var createDirectiveMetadata = function (templateMetadata) {
  18307. var normalizedDirMeta = new CompileDirectiveMetadata({
  18308. isHost: false,
  18309. type: metadata.type,
  18310. isComponent: metadata.isComponent,
  18311. selector: metadata.selector,
  18312. exportAs: metadata.exportAs,
  18313. changeDetection: metadata.changeDetection,
  18314. inputs: metadata.inputs,
  18315. outputs: metadata.outputs,
  18316. hostListeners: metadata.hostListeners,
  18317. hostProperties: metadata.hostProperties,
  18318. hostAttributes: metadata.hostAttributes,
  18319. providers: metadata.providers,
  18320. viewProviders: metadata.viewProviders,
  18321. queries: metadata.queries,
  18322. guards: metadata.guards,
  18323. viewQueries: metadata.viewQueries,
  18324. entryComponents: metadata.entryComponents,
  18325. componentViewType: metadata.componentViewType,
  18326. rendererType: metadata.rendererType,
  18327. componentFactory: metadata.componentFactory,
  18328. template: templateMetadata
  18329. });
  18330. if (templateMetadata) {
  18331. _this.initComponentFactory(metadata.componentFactory, templateMetadata.ngContentSelectors);
  18332. }
  18333. _this._directiveCache.set(directiveType, normalizedDirMeta);
  18334. _this._summaryCache.set(directiveType, normalizedDirMeta.toSummary());
  18335. return null;
  18336. };
  18337. if (metadata.isComponent) {
  18338. var template = metadata.template;
  18339. var templateMeta = this._directiveNormalizer.normalizeTemplate({
  18340. ngModuleType: ngModuleType,
  18341. componentType: directiveType,
  18342. moduleUrl: this._reflector.componentModuleUrl(directiveType, annotation),
  18343. encapsulation: template.encapsulation,
  18344. template: template.template,
  18345. templateUrl: template.templateUrl,
  18346. styles: template.styles,
  18347. styleUrls: template.styleUrls,
  18348. animations: template.animations,
  18349. interpolation: template.interpolation,
  18350. preserveWhitespaces: template.preserveWhitespaces
  18351. });
  18352. if (isPromise(templateMeta) && isSync) {
  18353. this._reportError(componentStillLoadingError(directiveType), directiveType);
  18354. return null;
  18355. }
  18356. return SyncAsync.then(templateMeta, createDirectiveMetadata);
  18357. }
  18358. else {
  18359. // directive
  18360. createDirectiveMetadata(null);
  18361. return null;
  18362. }
  18363. };
  18364. CompileMetadataResolver.prototype.getNonNormalizedDirectiveMetadata = function (directiveType) {
  18365. var _this = this;
  18366. directiveType = resolveForwardRef(directiveType);
  18367. if (!directiveType) {
  18368. return null;
  18369. }
  18370. var cacheEntry = this._nonNormalizedDirectiveCache.get(directiveType);
  18371. if (cacheEntry) {
  18372. return cacheEntry;
  18373. }
  18374. var dirMeta = this._directiveResolver.resolve(directiveType, false);
  18375. if (!dirMeta) {
  18376. return null;
  18377. }
  18378. var nonNormalizedTemplateMetadata = undefined;
  18379. if (createComponent.isTypeOf(dirMeta)) {
  18380. // component
  18381. var compMeta = dirMeta;
  18382. assertArrayOfStrings('styles', compMeta.styles);
  18383. assertArrayOfStrings('styleUrls', compMeta.styleUrls);
  18384. assertInterpolationSymbols('interpolation', compMeta.interpolation);
  18385. var animations = compMeta.animations;
  18386. nonNormalizedTemplateMetadata = new CompileTemplateMetadata({
  18387. encapsulation: noUndefined(compMeta.encapsulation),
  18388. template: noUndefined(compMeta.template),
  18389. templateUrl: noUndefined(compMeta.templateUrl),
  18390. htmlAst: null,
  18391. styles: compMeta.styles || [],
  18392. styleUrls: compMeta.styleUrls || [],
  18393. animations: animations || [],
  18394. interpolation: noUndefined(compMeta.interpolation),
  18395. isInline: !!compMeta.template,
  18396. externalStylesheets: [],
  18397. ngContentSelectors: [],
  18398. preserveWhitespaces: noUndefined(dirMeta.preserveWhitespaces),
  18399. });
  18400. }
  18401. var changeDetectionStrategy = null;
  18402. var viewProviders = [];
  18403. var entryComponentMetadata = [];
  18404. var selector = dirMeta.selector;
  18405. if (createComponent.isTypeOf(dirMeta)) {
  18406. // Component
  18407. var compMeta = dirMeta;
  18408. changeDetectionStrategy = compMeta.changeDetection;
  18409. if (compMeta.viewProviders) {
  18410. viewProviders = this._getProvidersMetadata(compMeta.viewProviders, entryComponentMetadata, "viewProviders for \"" + stringifyType(directiveType) + "\"", [], directiveType);
  18411. }
  18412. if (compMeta.entryComponents) {
  18413. entryComponentMetadata = flattenAndDedupeArray(compMeta.entryComponents)
  18414. .map(function (type) { return _this._getEntryComponentMetadata(type); })
  18415. .concat(entryComponentMetadata);
  18416. }
  18417. if (!selector) {
  18418. selector = this._schemaRegistry.getDefaultComponentElementName();
  18419. }
  18420. }
  18421. else {
  18422. // Directive
  18423. if (!selector) {
  18424. this._reportError(syntaxError("Directive " + stringifyType(directiveType) + " has no selector, please add it!"), directiveType);
  18425. selector = 'error';
  18426. }
  18427. }
  18428. var providers = [];
  18429. if (dirMeta.providers != null) {
  18430. providers = this._getProvidersMetadata(dirMeta.providers, entryComponentMetadata, "providers for \"" + stringifyType(directiveType) + "\"", [], directiveType);
  18431. }
  18432. var queries = [];
  18433. var viewQueries = [];
  18434. if (dirMeta.queries != null) {
  18435. queries = this._getQueriesMetadata(dirMeta.queries, false, directiveType);
  18436. viewQueries = this._getQueriesMetadata(dirMeta.queries, true, directiveType);
  18437. }
  18438. var metadata = CompileDirectiveMetadata.create({
  18439. isHost: false,
  18440. selector: selector,
  18441. exportAs: noUndefined(dirMeta.exportAs),
  18442. isComponent: !!nonNormalizedTemplateMetadata,
  18443. type: this._getTypeMetadata(directiveType),
  18444. template: nonNormalizedTemplateMetadata,
  18445. changeDetection: changeDetectionStrategy,
  18446. inputs: dirMeta.inputs || [],
  18447. outputs: dirMeta.outputs || [],
  18448. host: dirMeta.host || {},
  18449. providers: providers || [],
  18450. viewProviders: viewProviders || [],
  18451. queries: queries || [],
  18452. guards: dirMeta.guards || {},
  18453. viewQueries: viewQueries || [],
  18454. entryComponents: entryComponentMetadata,
  18455. componentViewType: nonNormalizedTemplateMetadata ? this.getComponentViewClass(directiveType) :
  18456. null,
  18457. rendererType: nonNormalizedTemplateMetadata ? this.getRendererType(directiveType) : null,
  18458. componentFactory: null
  18459. });
  18460. if (nonNormalizedTemplateMetadata) {
  18461. metadata.componentFactory =
  18462. this.getComponentFactory(selector, directiveType, metadata.inputs, metadata.outputs);
  18463. }
  18464. cacheEntry = { metadata: metadata, annotation: dirMeta };
  18465. this._nonNormalizedDirectiveCache.set(directiveType, cacheEntry);
  18466. return cacheEntry;
  18467. };
  18468. /**
  18469. * Gets the metadata for the given directive.
  18470. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  18471. */
  18472. CompileMetadataResolver.prototype.getDirectiveMetadata = function (directiveType) {
  18473. var dirMeta = this._directiveCache.get(directiveType);
  18474. if (!dirMeta) {
  18475. this._reportError(syntaxError("Illegal state: getDirectiveMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Directive " + stringifyType(directiveType) + "."), directiveType);
  18476. }
  18477. return dirMeta;
  18478. };
  18479. CompileMetadataResolver.prototype.getDirectiveSummary = function (dirType) {
  18480. var dirSummary = this._loadSummary(dirType, CompileSummaryKind.Directive);
  18481. if (!dirSummary) {
  18482. this._reportError(syntaxError("Illegal state: Could not load the summary for directive " + stringifyType(dirType) + "."), dirType);
  18483. }
  18484. return dirSummary;
  18485. };
  18486. CompileMetadataResolver.prototype.isDirective = function (type) {
  18487. return !!this._loadSummary(type, CompileSummaryKind.Directive) ||
  18488. this._directiveResolver.isDirective(type);
  18489. };
  18490. CompileMetadataResolver.prototype.isPipe = function (type) {
  18491. return !!this._loadSummary(type, CompileSummaryKind.Pipe) ||
  18492. this._pipeResolver.isPipe(type);
  18493. };
  18494. CompileMetadataResolver.prototype.isNgModule = function (type) {
  18495. return !!this._loadSummary(type, CompileSummaryKind.NgModule) ||
  18496. this._ngModuleResolver.isNgModule(type);
  18497. };
  18498. CompileMetadataResolver.prototype.getNgModuleSummary = function (moduleType, alreadyCollecting) {
  18499. if (alreadyCollecting === void 0) { alreadyCollecting = null; }
  18500. var moduleSummary = this._loadSummary(moduleType, CompileSummaryKind.NgModule);
  18501. if (!moduleSummary) {
  18502. var moduleMeta = this.getNgModuleMetadata(moduleType, false, alreadyCollecting);
  18503. moduleSummary = moduleMeta ? moduleMeta.toSummary() : null;
  18504. if (moduleSummary) {
  18505. this._summaryCache.set(moduleType, moduleSummary);
  18506. }
  18507. }
  18508. return moduleSummary;
  18509. };
  18510. /**
  18511. * Loads the declared directives and pipes of an NgModule.
  18512. */
  18513. CompileMetadataResolver.prototype.loadNgModuleDirectiveAndPipeMetadata = function (moduleType, isSync, throwIfNotFound) {
  18514. var _this = this;
  18515. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  18516. var ngModule = this.getNgModuleMetadata(moduleType, throwIfNotFound);
  18517. var loading = [];
  18518. if (ngModule) {
  18519. ngModule.declaredDirectives.forEach(function (id) {
  18520. var promise = _this.loadDirectiveMetadata(moduleType, id.reference, isSync);
  18521. if (promise) {
  18522. loading.push(promise);
  18523. }
  18524. });
  18525. ngModule.declaredPipes.forEach(function (id) { return _this._loadPipeMetadata(id.reference); });
  18526. }
  18527. return Promise.all(loading);
  18528. };
  18529. CompileMetadataResolver.prototype.getShallowModuleMetadata = function (moduleType) {
  18530. var compileMeta = this._shallowModuleCache.get(moduleType);
  18531. if (compileMeta) {
  18532. return compileMeta;
  18533. }
  18534. var ngModuleMeta = findLast(this._reflector.shallowAnnotations(moduleType), createNgModule.isTypeOf);
  18535. compileMeta = {
  18536. type: this._getTypeMetadata(moduleType),
  18537. rawExports: ngModuleMeta.exports,
  18538. rawImports: ngModuleMeta.imports,
  18539. rawProviders: ngModuleMeta.providers,
  18540. };
  18541. this._shallowModuleCache.set(moduleType, compileMeta);
  18542. return compileMeta;
  18543. };
  18544. CompileMetadataResolver.prototype.getNgModuleMetadata = function (moduleType, throwIfNotFound, alreadyCollecting) {
  18545. var _this = this;
  18546. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  18547. if (alreadyCollecting === void 0) { alreadyCollecting = null; }
  18548. moduleType = resolveForwardRef(moduleType);
  18549. var compileMeta = this._ngModuleCache.get(moduleType);
  18550. if (compileMeta) {
  18551. return compileMeta;
  18552. }
  18553. var meta = this._ngModuleResolver.resolve(moduleType, throwIfNotFound);
  18554. if (!meta) {
  18555. return null;
  18556. }
  18557. var declaredDirectives = [];
  18558. var exportedNonModuleIdentifiers = [];
  18559. var declaredPipes = [];
  18560. var importedModules = [];
  18561. var exportedModules = [];
  18562. var providers = [];
  18563. var entryComponents = [];
  18564. var bootstrapComponents = [];
  18565. var schemas = [];
  18566. if (meta.imports) {
  18567. flattenAndDedupeArray(meta.imports).forEach(function (importedType) {
  18568. var importedModuleType = undefined;
  18569. if (isValidType(importedType)) {
  18570. importedModuleType = importedType;
  18571. }
  18572. else if (importedType && importedType.ngModule) {
  18573. var moduleWithProviders = importedType;
  18574. importedModuleType = moduleWithProviders.ngModule;
  18575. if (moduleWithProviders.providers) {
  18576. providers.push.apply(providers, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(_this._getProvidersMetadata(moduleWithProviders.providers, entryComponents, "provider for the NgModule '" + stringifyType(importedModuleType) + "'", [], importedType)));
  18577. }
  18578. }
  18579. if (importedModuleType) {
  18580. if (_this._checkSelfImport(moduleType, importedModuleType))
  18581. return;
  18582. if (!alreadyCollecting)
  18583. alreadyCollecting = new Set();
  18584. if (alreadyCollecting.has(importedModuleType)) {
  18585. _this._reportError(syntaxError(_this._getTypeDescriptor(importedModuleType) + " '" + stringifyType(importedType) + "' is imported recursively by the module '" + stringifyType(moduleType) + "'."), moduleType);
  18586. return;
  18587. }
  18588. alreadyCollecting.add(importedModuleType);
  18589. var importedModuleSummary = _this.getNgModuleSummary(importedModuleType, alreadyCollecting);
  18590. alreadyCollecting.delete(importedModuleType);
  18591. if (!importedModuleSummary) {
  18592. _this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(importedType) + " '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'. Please add a @NgModule annotation."), moduleType);
  18593. return;
  18594. }
  18595. importedModules.push(importedModuleSummary);
  18596. }
  18597. else {
  18598. _this._reportError(syntaxError("Unexpected value '" + stringifyType(importedType) + "' imported by the module '" + stringifyType(moduleType) + "'"), moduleType);
  18599. return;
  18600. }
  18601. });
  18602. }
  18603. if (meta.exports) {
  18604. flattenAndDedupeArray(meta.exports).forEach(function (exportedType) {
  18605. if (!isValidType(exportedType)) {
  18606. _this._reportError(syntaxError("Unexpected value '" + stringifyType(exportedType) + "' exported by the module '" + stringifyType(moduleType) + "'"), moduleType);
  18607. return;
  18608. }
  18609. if (!alreadyCollecting)
  18610. alreadyCollecting = new Set();
  18611. if (alreadyCollecting.has(exportedType)) {
  18612. _this._reportError(syntaxError(_this._getTypeDescriptor(exportedType) + " '" + stringify(exportedType) + "' is exported recursively by the module '" + stringifyType(moduleType) + "'"), moduleType);
  18613. return;
  18614. }
  18615. alreadyCollecting.add(exportedType);
  18616. var exportedModuleSummary = _this.getNgModuleSummary(exportedType, alreadyCollecting);
  18617. alreadyCollecting.delete(exportedType);
  18618. if (exportedModuleSummary) {
  18619. exportedModules.push(exportedModuleSummary);
  18620. }
  18621. else {
  18622. exportedNonModuleIdentifiers.push(_this._getIdentifierMetadata(exportedType));
  18623. }
  18624. });
  18625. }
  18626. // Note: This will be modified later, so we rely on
  18627. // getting a new instance every time!
  18628. var transitiveModule = this._getTransitiveNgModuleMetadata(importedModules, exportedModules);
  18629. if (meta.declarations) {
  18630. flattenAndDedupeArray(meta.declarations).forEach(function (declaredType) {
  18631. if (!isValidType(declaredType)) {
  18632. _this._reportError(syntaxError("Unexpected value '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'"), moduleType);
  18633. return;
  18634. }
  18635. var declaredIdentifier = _this._getIdentifierMetadata(declaredType);
  18636. if (_this.isDirective(declaredType)) {
  18637. transitiveModule.addDirective(declaredIdentifier);
  18638. declaredDirectives.push(declaredIdentifier);
  18639. _this._addTypeToModule(declaredType, moduleType);
  18640. }
  18641. else if (_this.isPipe(declaredType)) {
  18642. transitiveModule.addPipe(declaredIdentifier);
  18643. transitiveModule.pipes.push(declaredIdentifier);
  18644. declaredPipes.push(declaredIdentifier);
  18645. _this._addTypeToModule(declaredType, moduleType);
  18646. }
  18647. else {
  18648. _this._reportError(syntaxError("Unexpected " + _this._getTypeDescriptor(declaredType) + " '" + stringifyType(declaredType) + "' declared by the module '" + stringifyType(moduleType) + "'. Please add a @Pipe/@Directive/@Component annotation."), moduleType);
  18649. return;
  18650. }
  18651. });
  18652. }
  18653. var exportedDirectives = [];
  18654. var exportedPipes = [];
  18655. exportedNonModuleIdentifiers.forEach(function (exportedId) {
  18656. if (transitiveModule.directivesSet.has(exportedId.reference)) {
  18657. exportedDirectives.push(exportedId);
  18658. transitiveModule.addExportedDirective(exportedId);
  18659. }
  18660. else if (transitiveModule.pipesSet.has(exportedId.reference)) {
  18661. exportedPipes.push(exportedId);
  18662. transitiveModule.addExportedPipe(exportedId);
  18663. }
  18664. else {
  18665. _this._reportError(syntaxError("Can't export " + _this._getTypeDescriptor(exportedId.reference) + " " + stringifyType(exportedId.reference) + " from " + stringifyType(moduleType) + " as it was neither declared nor imported!"), moduleType);
  18666. return;
  18667. }
  18668. });
  18669. // The providers of the module have to go last
  18670. // so that they overwrite any other provider we already added.
  18671. if (meta.providers) {
  18672. providers.push.apply(providers, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(this._getProvidersMetadata(meta.providers, entryComponents, "provider for the NgModule '" + stringifyType(moduleType) + "'", [], moduleType)));
  18673. }
  18674. if (meta.entryComponents) {
  18675. entryComponents.push.apply(entryComponents, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(flattenAndDedupeArray(meta.entryComponents)
  18676. .map(function (type) { return _this._getEntryComponentMetadata(type); })));
  18677. }
  18678. if (meta.bootstrap) {
  18679. flattenAndDedupeArray(meta.bootstrap).forEach(function (type) {
  18680. if (!isValidType(type)) {
  18681. _this._reportError(syntaxError("Unexpected value '" + stringifyType(type) + "' used in the bootstrap property of module '" + stringifyType(moduleType) + "'"), moduleType);
  18682. return;
  18683. }
  18684. bootstrapComponents.push(_this._getIdentifierMetadata(type));
  18685. });
  18686. }
  18687. entryComponents.push.apply(entryComponents, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(bootstrapComponents.map(function (type) { return _this._getEntryComponentMetadata(type.reference); })));
  18688. if (meta.schemas) {
  18689. schemas.push.apply(schemas, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(flattenAndDedupeArray(meta.schemas)));
  18690. }
  18691. compileMeta = new CompileNgModuleMetadata({
  18692. type: this._getTypeMetadata(moduleType),
  18693. providers: providers,
  18694. entryComponents: entryComponents,
  18695. bootstrapComponents: bootstrapComponents,
  18696. schemas: schemas,
  18697. declaredDirectives: declaredDirectives,
  18698. exportedDirectives: exportedDirectives,
  18699. declaredPipes: declaredPipes,
  18700. exportedPipes: exportedPipes,
  18701. importedModules: importedModules,
  18702. exportedModules: exportedModules,
  18703. transitiveModule: transitiveModule,
  18704. id: meta.id || null,
  18705. });
  18706. entryComponents.forEach(function (id) { return transitiveModule.addEntryComponent(id); });
  18707. providers.forEach(function (provider) { return transitiveModule.addProvider(provider, compileMeta.type); });
  18708. transitiveModule.addModule(compileMeta.type);
  18709. this._ngModuleCache.set(moduleType, compileMeta);
  18710. return compileMeta;
  18711. };
  18712. CompileMetadataResolver.prototype._checkSelfImport = function (moduleType, importedModuleType) {
  18713. if (moduleType === importedModuleType) {
  18714. this._reportError(syntaxError("'" + stringifyType(moduleType) + "' module can't import itself"), moduleType);
  18715. return true;
  18716. }
  18717. return false;
  18718. };
  18719. CompileMetadataResolver.prototype._getTypeDescriptor = function (type) {
  18720. if (isValidType(type)) {
  18721. if (this.isDirective(type)) {
  18722. return 'directive';
  18723. }
  18724. if (this.isPipe(type)) {
  18725. return 'pipe';
  18726. }
  18727. if (this.isNgModule(type)) {
  18728. return 'module';
  18729. }
  18730. }
  18731. if (type.provide) {
  18732. return 'provider';
  18733. }
  18734. return 'value';
  18735. };
  18736. CompileMetadataResolver.prototype._addTypeToModule = function (type, moduleType) {
  18737. var oldModule = this._ngModuleOfTypes.get(type);
  18738. if (oldModule && oldModule !== moduleType) {
  18739. this._reportError(syntaxError("Type " + stringifyType(type) + " is part of the declarations of 2 modules: " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + "! " +
  18740. ("Please consider moving " + stringifyType(type) + " to a higher module that imports " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ". ") +
  18741. ("You can also create a new NgModule that exports and includes " + stringifyType(type) + " then import that NgModule in " + stringifyType(oldModule) + " and " + stringifyType(moduleType) + ".")), moduleType);
  18742. return;
  18743. }
  18744. this._ngModuleOfTypes.set(type, moduleType);
  18745. };
  18746. CompileMetadataResolver.prototype._getTransitiveNgModuleMetadata = function (importedModules, exportedModules) {
  18747. // collect `providers` / `entryComponents` from all imported and all exported modules
  18748. var result = new TransitiveCompileNgModuleMetadata();
  18749. var modulesByToken = new Map();
  18750. importedModules.concat(exportedModules).forEach(function (modSummary) {
  18751. modSummary.modules.forEach(function (mod) { return result.addModule(mod); });
  18752. modSummary.entryComponents.forEach(function (comp) { return result.addEntryComponent(comp); });
  18753. var addedTokens = new Set();
  18754. modSummary.providers.forEach(function (entry) {
  18755. var tokenRef = tokenReference(entry.provider.token);
  18756. var prevModules = modulesByToken.get(tokenRef);
  18757. if (!prevModules) {
  18758. prevModules = new Set();
  18759. modulesByToken.set(tokenRef, prevModules);
  18760. }
  18761. var moduleRef = entry.module.reference;
  18762. // Note: the providers of one module may still contain multiple providers
  18763. // per token (e.g. for multi providers), and we need to preserve these.
  18764. if (addedTokens.has(tokenRef) || !prevModules.has(moduleRef)) {
  18765. prevModules.add(moduleRef);
  18766. addedTokens.add(tokenRef);
  18767. result.addProvider(entry.provider, entry.module);
  18768. }
  18769. });
  18770. });
  18771. exportedModules.forEach(function (modSummary) {
  18772. modSummary.exportedDirectives.forEach(function (id) { return result.addExportedDirective(id); });
  18773. modSummary.exportedPipes.forEach(function (id) { return result.addExportedPipe(id); });
  18774. });
  18775. importedModules.forEach(function (modSummary) {
  18776. modSummary.exportedDirectives.forEach(function (id) { return result.addDirective(id); });
  18777. modSummary.exportedPipes.forEach(function (id) { return result.addPipe(id); });
  18778. });
  18779. return result;
  18780. };
  18781. CompileMetadataResolver.prototype._getIdentifierMetadata = function (type) {
  18782. type = resolveForwardRef(type);
  18783. return { reference: type };
  18784. };
  18785. CompileMetadataResolver.prototype.isInjectable = function (type) {
  18786. var annotations = this._reflector.tryAnnotations(type);
  18787. return annotations.some(function (ann) { return createInjectable.isTypeOf(ann); });
  18788. };
  18789. CompileMetadataResolver.prototype.getInjectableSummary = function (type) {
  18790. return {
  18791. summaryKind: CompileSummaryKind.Injectable,
  18792. type: this._getTypeMetadata(type, null, false)
  18793. };
  18794. };
  18795. CompileMetadataResolver.prototype.getInjectableMetadata = function (type, dependencies, throwOnUnknownDeps) {
  18796. if (dependencies === void 0) { dependencies = null; }
  18797. if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
  18798. var typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable);
  18799. var typeMetadata = typeSummary ?
  18800. typeSummary.type :
  18801. this._getTypeMetadata(type, dependencies, throwOnUnknownDeps);
  18802. var annotations = this._reflector.annotations(type).filter(function (ann) { return createInjectable.isTypeOf(ann); });
  18803. if (annotations.length === 0) {
  18804. return null;
  18805. }
  18806. var meta = annotations[annotations.length - 1];
  18807. return {
  18808. symbol: type,
  18809. type: typeMetadata,
  18810. providedIn: meta.providedIn,
  18811. useValue: meta.useValue,
  18812. useClass: meta.useClass,
  18813. useExisting: meta.useExisting,
  18814. useFactory: meta.useFactory,
  18815. deps: meta.deps,
  18816. };
  18817. };
  18818. CompileMetadataResolver.prototype._getTypeMetadata = function (type, dependencies, throwOnUnknownDeps) {
  18819. if (dependencies === void 0) { dependencies = null; }
  18820. if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
  18821. var identifier = this._getIdentifierMetadata(type);
  18822. return {
  18823. reference: identifier.reference,
  18824. diDeps: this._getDependenciesMetadata(identifier.reference, dependencies, throwOnUnknownDeps),
  18825. lifecycleHooks: getAllLifecycleHooks(this._reflector, identifier.reference),
  18826. };
  18827. };
  18828. CompileMetadataResolver.prototype._getFactoryMetadata = function (factory, dependencies) {
  18829. if (dependencies === void 0) { dependencies = null; }
  18830. factory = resolveForwardRef(factory);
  18831. return { reference: factory, diDeps: this._getDependenciesMetadata(factory, dependencies) };
  18832. };
  18833. /**
  18834. * Gets the metadata for the given pipe.
  18835. * This assumes `loadNgModuleDirectiveAndPipeMetadata` has been called first.
  18836. */
  18837. CompileMetadataResolver.prototype.getPipeMetadata = function (pipeType) {
  18838. var pipeMeta = this._pipeCache.get(pipeType);
  18839. if (!pipeMeta) {
  18840. this._reportError(syntaxError("Illegal state: getPipeMetadata can only be called after loadNgModuleDirectiveAndPipeMetadata for a module that declares it. Pipe " + stringifyType(pipeType) + "."), pipeType);
  18841. }
  18842. return pipeMeta || null;
  18843. };
  18844. CompileMetadataResolver.prototype.getPipeSummary = function (pipeType) {
  18845. var pipeSummary = this._loadSummary(pipeType, CompileSummaryKind.Pipe);
  18846. if (!pipeSummary) {
  18847. this._reportError(syntaxError("Illegal state: Could not load the summary for pipe " + stringifyType(pipeType) + "."), pipeType);
  18848. }
  18849. return pipeSummary;
  18850. };
  18851. CompileMetadataResolver.prototype.getOrLoadPipeMetadata = function (pipeType) {
  18852. var pipeMeta = this._pipeCache.get(pipeType);
  18853. if (!pipeMeta) {
  18854. pipeMeta = this._loadPipeMetadata(pipeType);
  18855. }
  18856. return pipeMeta;
  18857. };
  18858. CompileMetadataResolver.prototype._loadPipeMetadata = function (pipeType) {
  18859. pipeType = resolveForwardRef(pipeType);
  18860. var pipeAnnotation = this._pipeResolver.resolve(pipeType);
  18861. var pipeMeta = new CompilePipeMetadata({
  18862. type: this._getTypeMetadata(pipeType),
  18863. name: pipeAnnotation.name,
  18864. pure: !!pipeAnnotation.pure
  18865. });
  18866. this._pipeCache.set(pipeType, pipeMeta);
  18867. this._summaryCache.set(pipeType, pipeMeta.toSummary());
  18868. return pipeMeta;
  18869. };
  18870. CompileMetadataResolver.prototype._getDependenciesMetadata = function (typeOrFunc, dependencies, throwOnUnknownDeps) {
  18871. var _this = this;
  18872. if (throwOnUnknownDeps === void 0) { throwOnUnknownDeps = true; }
  18873. var hasUnknownDeps = false;
  18874. var params = dependencies || this._reflector.parameters(typeOrFunc) || [];
  18875. var dependenciesMetadata = params.map(function (param) {
  18876. var isAttribute = false;
  18877. var isHost = false;
  18878. var isSelf = false;
  18879. var isSkipSelf = false;
  18880. var isOptional = false;
  18881. var token = null;
  18882. if (Array.isArray(param)) {
  18883. param.forEach(function (paramEntry) {
  18884. if (createHost.isTypeOf(paramEntry)) {
  18885. isHost = true;
  18886. }
  18887. else if (createSelf.isTypeOf(paramEntry)) {
  18888. isSelf = true;
  18889. }
  18890. else if (createSkipSelf.isTypeOf(paramEntry)) {
  18891. isSkipSelf = true;
  18892. }
  18893. else if (createOptional.isTypeOf(paramEntry)) {
  18894. isOptional = true;
  18895. }
  18896. else if (createAttribute.isTypeOf(paramEntry)) {
  18897. isAttribute = true;
  18898. token = paramEntry.attributeName;
  18899. }
  18900. else if (createInject.isTypeOf(paramEntry)) {
  18901. token = paramEntry.token;
  18902. }
  18903. else if (createInjectionToken.isTypeOf(paramEntry) || paramEntry instanceof StaticSymbol) {
  18904. token = paramEntry;
  18905. }
  18906. else if (isValidType(paramEntry) && token == null) {
  18907. token = paramEntry;
  18908. }
  18909. });
  18910. }
  18911. else {
  18912. token = param;
  18913. }
  18914. if (token == null) {
  18915. hasUnknownDeps = true;
  18916. return null;
  18917. }
  18918. return {
  18919. isAttribute: isAttribute,
  18920. isHost: isHost,
  18921. isSelf: isSelf,
  18922. isSkipSelf: isSkipSelf,
  18923. isOptional: isOptional,
  18924. token: _this._getTokenMetadata(token)
  18925. };
  18926. });
  18927. if (hasUnknownDeps) {
  18928. var depsTokens = dependenciesMetadata.map(function (dep) { return dep ? stringifyType(dep.token) : '?'; }).join(', ');
  18929. var message = "Can't resolve all parameters for " + stringifyType(typeOrFunc) + ": (" + depsTokens + ").";
  18930. if (throwOnUnknownDeps || this._config.strictInjectionParameters) {
  18931. this._reportError(syntaxError(message), typeOrFunc);
  18932. }
  18933. else {
  18934. this._console.warn("Warning: " + message + " This will become an error in Angular v6.x");
  18935. }
  18936. }
  18937. return dependenciesMetadata;
  18938. };
  18939. CompileMetadataResolver.prototype._getTokenMetadata = function (token) {
  18940. token = resolveForwardRef(token);
  18941. var compileToken;
  18942. if (typeof token === 'string') {
  18943. compileToken = { value: token };
  18944. }
  18945. else {
  18946. compileToken = { identifier: { reference: token } };
  18947. }
  18948. return compileToken;
  18949. };
  18950. CompileMetadataResolver.prototype._getProvidersMetadata = function (providers, targetEntryComponents, debugInfo, compileProviders, type) {
  18951. var _this = this;
  18952. if (compileProviders === void 0) { compileProviders = []; }
  18953. providers.forEach(function (provider, providerIdx) {
  18954. if (Array.isArray(provider)) {
  18955. _this._getProvidersMetadata(provider, targetEntryComponents, debugInfo, compileProviders);
  18956. }
  18957. else {
  18958. provider = resolveForwardRef(provider);
  18959. var providerMeta = undefined;
  18960. if (provider && typeof provider === 'object' && provider.hasOwnProperty('provide')) {
  18961. _this._validateProvider(provider);
  18962. providerMeta = new ProviderMeta(provider.provide, provider);
  18963. }
  18964. else if (isValidType(provider)) {
  18965. providerMeta = new ProviderMeta(provider, { useClass: provider });
  18966. }
  18967. else if (provider === void 0) {
  18968. _this._reportError(syntaxError("Encountered undefined provider! Usually this means you have a circular dependencies. This might be caused by using 'barrel' index.ts files."));
  18969. return;
  18970. }
  18971. else {
  18972. var providersInfo = providers.reduce(function (soFar, seenProvider, seenProviderIdx) {
  18973. if (seenProviderIdx < providerIdx) {
  18974. soFar.push("" + stringifyType(seenProvider));
  18975. }
  18976. else if (seenProviderIdx == providerIdx) {
  18977. soFar.push("?" + stringifyType(seenProvider) + "?");
  18978. }
  18979. else if (seenProviderIdx == providerIdx + 1) {
  18980. soFar.push('...');
  18981. }
  18982. return soFar;
  18983. }, [])
  18984. .join(', ');
  18985. _this._reportError(syntaxError("Invalid " + (debugInfo ? debugInfo : 'provider') + " - only instances of Provider and Type are allowed, got: [" + providersInfo + "]"), type);
  18986. return;
  18987. }
  18988. if (providerMeta.token ===
  18989. _this._reflector.resolveExternalReference(Identifiers.ANALYZE_FOR_ENTRY_COMPONENTS)) {
  18990. targetEntryComponents.push.apply(targetEntryComponents, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(_this._getEntryComponentsFromProvider(providerMeta, type)));
  18991. }
  18992. else {
  18993. compileProviders.push(_this.getProviderMetadata(providerMeta));
  18994. }
  18995. }
  18996. });
  18997. return compileProviders;
  18998. };
  18999. CompileMetadataResolver.prototype._validateProvider = function (provider) {
  19000. if (provider.hasOwnProperty('useClass') && provider.useClass == null) {
  19001. this._reportError(syntaxError("Invalid provider for " + stringifyType(provider.provide) + ". useClass cannot be " + provider.useClass + ".\n Usually it happens when:\n 1. There's a circular dependency (might be caused by using index.ts (barrel) files).\n 2. Class was used before it was declared. Use forwardRef in this case."));
  19002. }
  19003. };
  19004. CompileMetadataResolver.prototype._getEntryComponentsFromProvider = function (provider, type) {
  19005. var _this = this;
  19006. var components = [];
  19007. var collectedIdentifiers = [];
  19008. if (provider.useFactory || provider.useExisting || provider.useClass) {
  19009. this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports useValue!"), type);
  19010. return [];
  19011. }
  19012. if (!provider.multi) {
  19013. this._reportError(syntaxError("The ANALYZE_FOR_ENTRY_COMPONENTS token only supports 'multi = true'!"), type);
  19014. return [];
  19015. }
  19016. extractIdentifiers(provider.useValue, collectedIdentifiers);
  19017. collectedIdentifiers.forEach(function (identifier) {
  19018. var entry = _this._getEntryComponentMetadata(identifier.reference, false);
  19019. if (entry) {
  19020. components.push(entry);
  19021. }
  19022. });
  19023. return components;
  19024. };
  19025. CompileMetadataResolver.prototype._getEntryComponentMetadata = function (dirType, throwIfNotFound) {
  19026. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  19027. var dirMeta = this.getNonNormalizedDirectiveMetadata(dirType);
  19028. if (dirMeta && dirMeta.metadata.isComponent) {
  19029. return { componentType: dirType, componentFactory: dirMeta.metadata.componentFactory };
  19030. }
  19031. var dirSummary = this._loadSummary(dirType, CompileSummaryKind.Directive);
  19032. if (dirSummary && dirSummary.isComponent) {
  19033. return { componentType: dirType, componentFactory: dirSummary.componentFactory };
  19034. }
  19035. if (throwIfNotFound) {
  19036. throw syntaxError(dirType.name + " cannot be used as an entry component.");
  19037. }
  19038. return null;
  19039. };
  19040. CompileMetadataResolver.prototype._getInjectableTypeMetadata = function (type, dependencies) {
  19041. if (dependencies === void 0) { dependencies = null; }
  19042. var typeSummary = this._loadSummary(type, CompileSummaryKind.Injectable);
  19043. if (typeSummary) {
  19044. return typeSummary.type;
  19045. }
  19046. return this._getTypeMetadata(type, dependencies);
  19047. };
  19048. CompileMetadataResolver.prototype.getProviderMetadata = function (provider) {
  19049. var compileDeps = undefined;
  19050. var compileTypeMetadata = null;
  19051. var compileFactoryMetadata = null;
  19052. var token = this._getTokenMetadata(provider.token);
  19053. if (provider.useClass) {
  19054. compileTypeMetadata =
  19055. this._getInjectableTypeMetadata(provider.useClass, provider.dependencies);
  19056. compileDeps = compileTypeMetadata.diDeps;
  19057. if (provider.token === provider.useClass) {
  19058. // use the compileTypeMetadata as it contains information about lifecycleHooks...
  19059. token = { identifier: compileTypeMetadata };
  19060. }
  19061. }
  19062. else if (provider.useFactory) {
  19063. compileFactoryMetadata = this._getFactoryMetadata(provider.useFactory, provider.dependencies);
  19064. compileDeps = compileFactoryMetadata.diDeps;
  19065. }
  19066. return {
  19067. token: token,
  19068. useClass: compileTypeMetadata,
  19069. useValue: provider.useValue,
  19070. useFactory: compileFactoryMetadata,
  19071. useExisting: provider.useExisting ? this._getTokenMetadata(provider.useExisting) : undefined,
  19072. deps: compileDeps,
  19073. multi: provider.multi
  19074. };
  19075. };
  19076. CompileMetadataResolver.prototype._getQueriesMetadata = function (queries, isViewQuery, directiveType) {
  19077. var _this = this;
  19078. var res = [];
  19079. Object.keys(queries).forEach(function (propertyName) {
  19080. var query = queries[propertyName];
  19081. if (query.isViewQuery === isViewQuery) {
  19082. res.push(_this._getQueryMetadata(query, propertyName, directiveType));
  19083. }
  19084. });
  19085. return res;
  19086. };
  19087. CompileMetadataResolver.prototype._queryVarBindings = function (selector) { return selector.split(/\s*,\s*/); };
  19088. CompileMetadataResolver.prototype._getQueryMetadata = function (q, propertyName, typeOrFunc) {
  19089. var _this = this;
  19090. var selectors;
  19091. if (typeof q.selector === 'string') {
  19092. selectors =
  19093. this._queryVarBindings(q.selector).map(function (varName) { return _this._getTokenMetadata(varName); });
  19094. }
  19095. else {
  19096. if (!q.selector) {
  19097. this._reportError(syntaxError("Can't construct a query for the property \"" + propertyName + "\" of \"" + stringifyType(typeOrFunc) + "\" since the query selector wasn't defined."), typeOrFunc);
  19098. selectors = [];
  19099. }
  19100. else {
  19101. selectors = [this._getTokenMetadata(q.selector)];
  19102. }
  19103. }
  19104. return {
  19105. selectors: selectors,
  19106. first: q.first,
  19107. descendants: q.descendants, propertyName: propertyName,
  19108. read: q.read ? this._getTokenMetadata(q.read) : null
  19109. };
  19110. };
  19111. CompileMetadataResolver.prototype._reportError = function (error$$1, type, otherType) {
  19112. if (this._errorCollector) {
  19113. this._errorCollector(error$$1, type);
  19114. if (otherType) {
  19115. this._errorCollector(error$$1, otherType);
  19116. }
  19117. }
  19118. else {
  19119. throw error$$1;
  19120. }
  19121. };
  19122. return CompileMetadataResolver;
  19123. }());
  19124. function flattenArray(tree, out) {
  19125. if (out === void 0) { out = []; }
  19126. if (tree) {
  19127. for (var i = 0; i < tree.length; i++) {
  19128. var item = resolveForwardRef(tree[i]);
  19129. if (Array.isArray(item)) {
  19130. flattenArray(item, out);
  19131. }
  19132. else {
  19133. out.push(item);
  19134. }
  19135. }
  19136. }
  19137. return out;
  19138. }
  19139. function dedupeArray(array) {
  19140. if (array) {
  19141. return Array.from(new Set(array));
  19142. }
  19143. return [];
  19144. }
  19145. function flattenAndDedupeArray(tree) {
  19146. return dedupeArray(flattenArray(tree));
  19147. }
  19148. function isValidType(value) {
  19149. return (value instanceof StaticSymbol) || (value instanceof Type);
  19150. }
  19151. function extractIdentifiers(value, targetIdentifiers) {
  19152. visitValue(value, new _CompileValueConverter(), targetIdentifiers);
  19153. }
  19154. var _CompileValueConverter = /** @class */ (function (_super) {
  19155. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_CompileValueConverter, _super);
  19156. function _CompileValueConverter() {
  19157. return _super !== null && _super.apply(this, arguments) || this;
  19158. }
  19159. _CompileValueConverter.prototype.visitOther = function (value, targetIdentifiers) {
  19160. targetIdentifiers.push({ reference: value });
  19161. };
  19162. return _CompileValueConverter;
  19163. }(ValueTransformer));
  19164. function stringifyType(type) {
  19165. if (type instanceof StaticSymbol) {
  19166. return type.name + " in " + type.filePath;
  19167. }
  19168. else {
  19169. return stringify(type);
  19170. }
  19171. }
  19172. /**
  19173. * Indicates that a component is still being loaded in a synchronous compile.
  19174. */
  19175. function componentStillLoadingError(compType) {
  19176. var error$$1 = Error("Can't compile synchronously as " + stringify(compType) + " is still being loaded!");
  19177. error$$1[ERROR_COMPONENT_TYPE] = compType;
  19178. return error$$1;
  19179. }
  19180. /**
  19181. * @license
  19182. * Copyright Google Inc. All Rights Reserved.
  19183. *
  19184. * Use of this source code is governed by an MIT-style license that can be
  19185. * found in the LICENSE file at https://angular.io/license
  19186. */
  19187. var ProviderError = /** @class */ (function (_super) {
  19188. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ProviderError, _super);
  19189. function ProviderError(message, span) {
  19190. return _super.call(this, span, message) || this;
  19191. }
  19192. return ProviderError;
  19193. }(ParseError));
  19194. var ProviderViewContext = /** @class */ (function () {
  19195. function ProviderViewContext(reflector, component) {
  19196. var _this = this;
  19197. this.reflector = reflector;
  19198. this.component = component;
  19199. this.errors = [];
  19200. this.viewQueries = _getViewQueries(component);
  19201. this.viewProviders = new Map();
  19202. component.viewProviders.forEach(function (provider) {
  19203. if (_this.viewProviders.get(tokenReference(provider.token)) == null) {
  19204. _this.viewProviders.set(tokenReference(provider.token), true);
  19205. }
  19206. });
  19207. }
  19208. return ProviderViewContext;
  19209. }());
  19210. var ProviderElementContext = /** @class */ (function () {
  19211. function ProviderElementContext(viewContext, _parent, _isViewRoot, _directiveAsts, attrs, refs, isTemplate, contentQueryStartId, _sourceSpan) {
  19212. var _this = this;
  19213. this.viewContext = viewContext;
  19214. this._parent = _parent;
  19215. this._isViewRoot = _isViewRoot;
  19216. this._directiveAsts = _directiveAsts;
  19217. this._sourceSpan = _sourceSpan;
  19218. this._transformedProviders = new Map();
  19219. this._seenProviders = new Map();
  19220. this._queriedTokens = new Map();
  19221. this.transformedHasViewContainer = false;
  19222. this._attrs = {};
  19223. attrs.forEach(function (attrAst) { return _this._attrs[attrAst.name] = attrAst.value; });
  19224. var directivesMeta = _directiveAsts.map(function (directiveAst) { return directiveAst.directive; });
  19225. this._allProviders =
  19226. _resolveProvidersFromDirectives(directivesMeta, _sourceSpan, viewContext.errors);
  19227. this._contentQueries = _getContentQueries(contentQueryStartId, directivesMeta);
  19228. Array.from(this._allProviders.values()).forEach(function (provider) {
  19229. _this._addQueryReadsTo(provider.token, provider.token, _this._queriedTokens);
  19230. });
  19231. if (isTemplate) {
  19232. var templateRefId = createTokenForExternalReference(this.viewContext.reflector, Identifiers.TemplateRef);
  19233. this._addQueryReadsTo(templateRefId, templateRefId, this._queriedTokens);
  19234. }
  19235. refs.forEach(function (refAst) {
  19236. var defaultQueryValue = refAst.value ||
  19237. createTokenForExternalReference(_this.viewContext.reflector, Identifiers.ElementRef);
  19238. _this._addQueryReadsTo({ value: refAst.name }, defaultQueryValue, _this._queriedTokens);
  19239. });
  19240. if (this._queriedTokens.get(this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef))) {
  19241. this.transformedHasViewContainer = true;
  19242. }
  19243. // create the providers that we know are eager first
  19244. Array.from(this._allProviders.values()).forEach(function (provider) {
  19245. var eager = provider.eager || _this._queriedTokens.get(tokenReference(provider.token));
  19246. if (eager) {
  19247. _this._getOrCreateLocalProvider(provider.providerType, provider.token, true);
  19248. }
  19249. });
  19250. }
  19251. ProviderElementContext.prototype.afterElement = function () {
  19252. var _this = this;
  19253. // collect lazy providers
  19254. Array.from(this._allProviders.values()).forEach(function (provider) {
  19255. _this._getOrCreateLocalProvider(provider.providerType, provider.token, false);
  19256. });
  19257. };
  19258. Object.defineProperty(ProviderElementContext.prototype, "transformProviders", {
  19259. get: function () {
  19260. // Note: Maps keep their insertion order.
  19261. var lazyProviders = [];
  19262. var eagerProviders = [];
  19263. this._transformedProviders.forEach(function (provider) {
  19264. if (provider.eager) {
  19265. eagerProviders.push(provider);
  19266. }
  19267. else {
  19268. lazyProviders.push(provider);
  19269. }
  19270. });
  19271. return lazyProviders.concat(eagerProviders);
  19272. },
  19273. enumerable: true,
  19274. configurable: true
  19275. });
  19276. Object.defineProperty(ProviderElementContext.prototype, "transformedDirectiveAsts", {
  19277. get: function () {
  19278. var sortedProviderTypes = this.transformProviders.map(function (provider) { return provider.token.identifier; });
  19279. var sortedDirectives = this._directiveAsts.slice();
  19280. sortedDirectives.sort(function (dir1, dir2) { return sortedProviderTypes.indexOf(dir1.directive.type) -
  19281. sortedProviderTypes.indexOf(dir2.directive.type); });
  19282. return sortedDirectives;
  19283. },
  19284. enumerable: true,
  19285. configurable: true
  19286. });
  19287. Object.defineProperty(ProviderElementContext.prototype, "queryMatches", {
  19288. get: function () {
  19289. var allMatches = [];
  19290. this._queriedTokens.forEach(function (matches) { allMatches.push.apply(allMatches, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(matches)); });
  19291. return allMatches;
  19292. },
  19293. enumerable: true,
  19294. configurable: true
  19295. });
  19296. ProviderElementContext.prototype._addQueryReadsTo = function (token, defaultValue, queryReadTokens) {
  19297. this._getQueriesFor(token).forEach(function (query) {
  19298. var queryValue = query.meta.read || defaultValue;
  19299. var tokenRef = tokenReference(queryValue);
  19300. var queryMatches = queryReadTokens.get(tokenRef);
  19301. if (!queryMatches) {
  19302. queryMatches = [];
  19303. queryReadTokens.set(tokenRef, queryMatches);
  19304. }
  19305. queryMatches.push({ queryId: query.queryId, value: queryValue });
  19306. });
  19307. };
  19308. ProviderElementContext.prototype._getQueriesFor = function (token) {
  19309. var result = [];
  19310. var currentEl = this;
  19311. var distance = 0;
  19312. var queries;
  19313. while (currentEl !== null) {
  19314. queries = currentEl._contentQueries.get(tokenReference(token));
  19315. if (queries) {
  19316. result.push.apply(result, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(queries.filter(function (query) { return query.meta.descendants || distance <= 1; })));
  19317. }
  19318. if (currentEl._directiveAsts.length > 0) {
  19319. distance++;
  19320. }
  19321. currentEl = currentEl._parent;
  19322. }
  19323. queries = this.viewContext.viewQueries.get(tokenReference(token));
  19324. if (queries) {
  19325. result.push.apply(result, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(queries));
  19326. }
  19327. return result;
  19328. };
  19329. ProviderElementContext.prototype._getOrCreateLocalProvider = function (requestingProviderType, token, eager) {
  19330. var _this = this;
  19331. var resolvedProvider = this._allProviders.get(tokenReference(token));
  19332. if (!resolvedProvider || ((requestingProviderType === ProviderAstType.Directive ||
  19333. requestingProviderType === ProviderAstType.PublicService) &&
  19334. resolvedProvider.providerType === ProviderAstType.PrivateService) ||
  19335. ((requestingProviderType === ProviderAstType.PrivateService ||
  19336. requestingProviderType === ProviderAstType.PublicService) &&
  19337. resolvedProvider.providerType === ProviderAstType.Builtin)) {
  19338. return null;
  19339. }
  19340. var transformedProviderAst = this._transformedProviders.get(tokenReference(token));
  19341. if (transformedProviderAst) {
  19342. return transformedProviderAst;
  19343. }
  19344. if (this._seenProviders.get(tokenReference(token)) != null) {
  19345. this.viewContext.errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), this._sourceSpan));
  19346. return null;
  19347. }
  19348. this._seenProviders.set(tokenReference(token), true);
  19349. var transformedProviders = resolvedProvider.providers.map(function (provider) {
  19350. var transformedUseValue = provider.useValue;
  19351. var transformedUseExisting = provider.useExisting;
  19352. var transformedDeps = undefined;
  19353. if (provider.useExisting != null) {
  19354. var existingDiDep = _this._getDependency(resolvedProvider.providerType, { token: provider.useExisting }, eager);
  19355. if (existingDiDep.token != null) {
  19356. transformedUseExisting = existingDiDep.token;
  19357. }
  19358. else {
  19359. transformedUseExisting = null;
  19360. transformedUseValue = existingDiDep.value;
  19361. }
  19362. }
  19363. else if (provider.useFactory) {
  19364. var deps = provider.deps || provider.useFactory.diDeps;
  19365. transformedDeps =
  19366. deps.map(function (dep) { return _this._getDependency(resolvedProvider.providerType, dep, eager); });
  19367. }
  19368. else if (provider.useClass) {
  19369. var deps = provider.deps || provider.useClass.diDeps;
  19370. transformedDeps =
  19371. deps.map(function (dep) { return _this._getDependency(resolvedProvider.providerType, dep, eager); });
  19372. }
  19373. return _transformProvider(provider, {
  19374. useExisting: transformedUseExisting,
  19375. useValue: transformedUseValue,
  19376. deps: transformedDeps
  19377. });
  19378. });
  19379. transformedProviderAst =
  19380. _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
  19381. this._transformedProviders.set(tokenReference(token), transformedProviderAst);
  19382. return transformedProviderAst;
  19383. };
  19384. ProviderElementContext.prototype._getLocalDependency = function (requestingProviderType, dep, eager) {
  19385. if (eager === void 0) { eager = false; }
  19386. if (dep.isAttribute) {
  19387. var attrValue = this._attrs[dep.token.value];
  19388. return { isValue: true, value: attrValue == null ? null : attrValue };
  19389. }
  19390. if (dep.token != null) {
  19391. // access builtints
  19392. if ((requestingProviderType === ProviderAstType.Directive ||
  19393. requestingProviderType === ProviderAstType.Component)) {
  19394. if (tokenReference(dep.token) ===
  19395. this.viewContext.reflector.resolveExternalReference(Identifiers.Renderer) ||
  19396. tokenReference(dep.token) ===
  19397. this.viewContext.reflector.resolveExternalReference(Identifiers.ElementRef) ||
  19398. tokenReference(dep.token) ===
  19399. this.viewContext.reflector.resolveExternalReference(Identifiers.ChangeDetectorRef) ||
  19400. tokenReference(dep.token) ===
  19401. this.viewContext.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
  19402. return dep;
  19403. }
  19404. if (tokenReference(dep.token) ===
  19405. this.viewContext.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
  19406. this.transformedHasViewContainer = true;
  19407. }
  19408. }
  19409. // access the injector
  19410. if (tokenReference(dep.token) ===
  19411. this.viewContext.reflector.resolveExternalReference(Identifiers.Injector)) {
  19412. return dep;
  19413. }
  19414. // access providers
  19415. if (this._getOrCreateLocalProvider(requestingProviderType, dep.token, eager) != null) {
  19416. return dep;
  19417. }
  19418. }
  19419. return null;
  19420. };
  19421. ProviderElementContext.prototype._getDependency = function (requestingProviderType, dep, eager) {
  19422. if (eager === void 0) { eager = false; }
  19423. var currElement = this;
  19424. var currEager = eager;
  19425. var result = null;
  19426. if (!dep.isSkipSelf) {
  19427. result = this._getLocalDependency(requestingProviderType, dep, eager);
  19428. }
  19429. if (dep.isSelf) {
  19430. if (!result && dep.isOptional) {
  19431. result = { isValue: true, value: null };
  19432. }
  19433. }
  19434. else {
  19435. // check parent elements
  19436. while (!result && currElement._parent) {
  19437. var prevElement = currElement;
  19438. currElement = currElement._parent;
  19439. if (prevElement._isViewRoot) {
  19440. currEager = false;
  19441. }
  19442. result = currElement._getLocalDependency(ProviderAstType.PublicService, dep, currEager);
  19443. }
  19444. // check @Host restriction
  19445. if (!result) {
  19446. if (!dep.isHost || this.viewContext.component.isHost ||
  19447. this.viewContext.component.type.reference === tokenReference(dep.token) ||
  19448. this.viewContext.viewProviders.get(tokenReference(dep.token)) != null) {
  19449. result = dep;
  19450. }
  19451. else {
  19452. result = dep.isOptional ? { isValue: true, value: null } : null;
  19453. }
  19454. }
  19455. }
  19456. if (!result) {
  19457. this.viewContext.errors.push(new ProviderError("No provider for " + tokenName(dep.token), this._sourceSpan));
  19458. }
  19459. return result;
  19460. };
  19461. return ProviderElementContext;
  19462. }());
  19463. var NgModuleProviderAnalyzer = /** @class */ (function () {
  19464. function NgModuleProviderAnalyzer(reflector, ngModule, extraProviders, sourceSpan) {
  19465. var _this = this;
  19466. this.reflector = reflector;
  19467. this._transformedProviders = new Map();
  19468. this._seenProviders = new Map();
  19469. this._errors = [];
  19470. this._allProviders = new Map();
  19471. ngModule.transitiveModule.modules.forEach(function (ngModuleType) {
  19472. var ngModuleProvider = { token: { identifier: ngModuleType }, useClass: ngModuleType };
  19473. _resolveProviders([ngModuleProvider], ProviderAstType.PublicService, true, sourceSpan, _this._errors, _this._allProviders, /* isModule */ true);
  19474. });
  19475. _resolveProviders(ngModule.transitiveModule.providers.map(function (entry) { return entry.provider; }).concat(extraProviders), ProviderAstType.PublicService, false, sourceSpan, this._errors, this._allProviders,
  19476. /* isModule */ false);
  19477. }
  19478. NgModuleProviderAnalyzer.prototype.parse = function () {
  19479. var _this = this;
  19480. Array.from(this._allProviders.values()).forEach(function (provider) {
  19481. _this._getOrCreateLocalProvider(provider.token, provider.eager);
  19482. });
  19483. if (this._errors.length > 0) {
  19484. var errorString = this._errors.join('\n');
  19485. throw new Error("Provider parse errors:\n" + errorString);
  19486. }
  19487. // Note: Maps keep their insertion order.
  19488. var lazyProviders = [];
  19489. var eagerProviders = [];
  19490. this._transformedProviders.forEach(function (provider) {
  19491. if (provider.eager) {
  19492. eagerProviders.push(provider);
  19493. }
  19494. else {
  19495. lazyProviders.push(provider);
  19496. }
  19497. });
  19498. return lazyProviders.concat(eagerProviders);
  19499. };
  19500. NgModuleProviderAnalyzer.prototype._getOrCreateLocalProvider = function (token, eager) {
  19501. var _this = this;
  19502. var resolvedProvider = this._allProviders.get(tokenReference(token));
  19503. if (!resolvedProvider) {
  19504. return null;
  19505. }
  19506. var transformedProviderAst = this._transformedProviders.get(tokenReference(token));
  19507. if (transformedProviderAst) {
  19508. return transformedProviderAst;
  19509. }
  19510. if (this._seenProviders.get(tokenReference(token)) != null) {
  19511. this._errors.push(new ProviderError("Cannot instantiate cyclic dependency! " + tokenName(token), resolvedProvider.sourceSpan));
  19512. return null;
  19513. }
  19514. this._seenProviders.set(tokenReference(token), true);
  19515. var transformedProviders = resolvedProvider.providers.map(function (provider) {
  19516. var transformedUseValue = provider.useValue;
  19517. var transformedUseExisting = provider.useExisting;
  19518. var transformedDeps = undefined;
  19519. if (provider.useExisting != null) {
  19520. var existingDiDep = _this._getDependency({ token: provider.useExisting }, eager, resolvedProvider.sourceSpan);
  19521. if (existingDiDep.token != null) {
  19522. transformedUseExisting = existingDiDep.token;
  19523. }
  19524. else {
  19525. transformedUseExisting = null;
  19526. transformedUseValue = existingDiDep.value;
  19527. }
  19528. }
  19529. else if (provider.useFactory) {
  19530. var deps = provider.deps || provider.useFactory.diDeps;
  19531. transformedDeps =
  19532. deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
  19533. }
  19534. else if (provider.useClass) {
  19535. var deps = provider.deps || provider.useClass.diDeps;
  19536. transformedDeps =
  19537. deps.map(function (dep) { return _this._getDependency(dep, eager, resolvedProvider.sourceSpan); });
  19538. }
  19539. return _transformProvider(provider, {
  19540. useExisting: transformedUseExisting,
  19541. useValue: transformedUseValue,
  19542. deps: transformedDeps
  19543. });
  19544. });
  19545. transformedProviderAst =
  19546. _transformProviderAst(resolvedProvider, { eager: eager, providers: transformedProviders });
  19547. this._transformedProviders.set(tokenReference(token), transformedProviderAst);
  19548. return transformedProviderAst;
  19549. };
  19550. NgModuleProviderAnalyzer.prototype._getDependency = function (dep, eager, requestorSourceSpan) {
  19551. if (eager === void 0) { eager = false; }
  19552. if (!dep.isSkipSelf && dep.token != null) {
  19553. // access the injector
  19554. if (tokenReference(dep.token) ===
  19555. this.reflector.resolveExternalReference(Identifiers.Injector) ||
  19556. tokenReference(dep.token) ===
  19557. this.reflector.resolveExternalReference(Identifiers.ComponentFactoryResolver)) ;
  19558. else if (this._getOrCreateLocalProvider(dep.token, eager) != null) ;
  19559. }
  19560. return dep;
  19561. };
  19562. return NgModuleProviderAnalyzer;
  19563. }());
  19564. function _transformProvider(provider, _a) {
  19565. var useExisting = _a.useExisting, useValue = _a.useValue, deps = _a.deps;
  19566. return {
  19567. token: provider.token,
  19568. useClass: provider.useClass,
  19569. useExisting: useExisting,
  19570. useFactory: provider.useFactory,
  19571. useValue: useValue,
  19572. deps: deps,
  19573. multi: provider.multi
  19574. };
  19575. }
  19576. function _transformProviderAst(provider, _a) {
  19577. var eager = _a.eager, providers = _a.providers;
  19578. return new ProviderAst(provider.token, provider.multiProvider, provider.eager || eager, providers, provider.providerType, provider.lifecycleHooks, provider.sourceSpan, provider.isModule);
  19579. }
  19580. function _resolveProvidersFromDirectives(directives, sourceSpan, targetErrors) {
  19581. var providersByToken = new Map();
  19582. directives.forEach(function (directive) {
  19583. var dirProvider = { token: { identifier: directive.type }, useClass: directive.type };
  19584. _resolveProviders([dirProvider], directive.isComponent ? ProviderAstType.Component : ProviderAstType.Directive, true, sourceSpan, targetErrors, providersByToken, /* isModule */ false);
  19585. });
  19586. // Note: directives need to be able to overwrite providers of a component!
  19587. var directivesWithComponentFirst = directives.filter(function (dir) { return dir.isComponent; }).concat(directives.filter(function (dir) { return !dir.isComponent; }));
  19588. directivesWithComponentFirst.forEach(function (directive) {
  19589. _resolveProviders(directive.providers, ProviderAstType.PublicService, false, sourceSpan, targetErrors, providersByToken, /* isModule */ false);
  19590. _resolveProviders(directive.viewProviders, ProviderAstType.PrivateService, false, sourceSpan, targetErrors, providersByToken, /* isModule */ false);
  19591. });
  19592. return providersByToken;
  19593. }
  19594. function _resolveProviders(providers, providerType, eager, sourceSpan, targetErrors, targetProvidersByToken, isModule) {
  19595. providers.forEach(function (provider) {
  19596. var resolvedProvider = targetProvidersByToken.get(tokenReference(provider.token));
  19597. if (resolvedProvider != null && !!resolvedProvider.multiProvider !== !!provider.multi) {
  19598. targetErrors.push(new ProviderError("Mixing multi and non multi provider is not possible for token " + tokenName(resolvedProvider.token), sourceSpan));
  19599. }
  19600. if (!resolvedProvider) {
  19601. var lifecycleHooks = provider.token.identifier &&
  19602. provider.token.identifier.lifecycleHooks ?
  19603. provider.token.identifier.lifecycleHooks :
  19604. [];
  19605. var isUseValue = !(provider.useClass || provider.useExisting || provider.useFactory);
  19606. resolvedProvider = new ProviderAst(provider.token, !!provider.multi, eager || isUseValue, [provider], providerType, lifecycleHooks, sourceSpan, isModule);
  19607. targetProvidersByToken.set(tokenReference(provider.token), resolvedProvider);
  19608. }
  19609. else {
  19610. if (!provider.multi) {
  19611. resolvedProvider.providers.length = 0;
  19612. }
  19613. resolvedProvider.providers.push(provider);
  19614. }
  19615. });
  19616. }
  19617. function _getViewQueries(component) {
  19618. // Note: queries start with id 1 so we can use the number in a Bloom filter!
  19619. var viewQueryId = 1;
  19620. var viewQueries = new Map();
  19621. if (component.viewQueries) {
  19622. component.viewQueries.forEach(function (query) { return _addQueryToTokenMap(viewQueries, { meta: query, queryId: viewQueryId++ }); });
  19623. }
  19624. return viewQueries;
  19625. }
  19626. function _getContentQueries(contentQueryStartId, directives) {
  19627. var contentQueryId = contentQueryStartId;
  19628. var contentQueries = new Map();
  19629. directives.forEach(function (directive, directiveIndex) {
  19630. if (directive.queries) {
  19631. directive.queries.forEach(function (query) { return _addQueryToTokenMap(contentQueries, { meta: query, queryId: contentQueryId++ }); });
  19632. }
  19633. });
  19634. return contentQueries;
  19635. }
  19636. function _addQueryToTokenMap(map, query) {
  19637. query.meta.selectors.forEach(function (token) {
  19638. var entry = map.get(tokenReference(token));
  19639. if (!entry) {
  19640. entry = [];
  19641. map.set(tokenReference(token), entry);
  19642. }
  19643. entry.push(query);
  19644. });
  19645. }
  19646. /**
  19647. * @license
  19648. * Copyright Google Inc. All Rights Reserved.
  19649. *
  19650. * Use of this source code is governed by an MIT-style license that can be
  19651. * found in the LICENSE file at https://angular.io/license
  19652. */
  19653. function providerDef(ctx, providerAst) {
  19654. var flags = 0 /* None */;
  19655. if (!providerAst.eager) {
  19656. flags |= 4096 /* LazyProvider */;
  19657. }
  19658. if (providerAst.providerType === ProviderAstType.PrivateService) {
  19659. flags |= 8192 /* PrivateProvider */;
  19660. }
  19661. if (providerAst.isModule) {
  19662. flags |= 1073741824 /* TypeModuleProvider */;
  19663. }
  19664. providerAst.lifecycleHooks.forEach(function (lifecycleHook) {
  19665. // for regular providers, we only support ngOnDestroy
  19666. if (lifecycleHook === LifecycleHooks.OnDestroy ||
  19667. providerAst.providerType === ProviderAstType.Directive ||
  19668. providerAst.providerType === ProviderAstType.Component) {
  19669. flags |= lifecycleHookToNodeFlag(lifecycleHook);
  19670. }
  19671. });
  19672. var _a = providerAst.multiProvider ?
  19673. multiProviderDef(ctx, flags, providerAst.providers) :
  19674. singleProviderDef(ctx, flags, providerAst.providerType, providerAst.providers[0]), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
  19675. return {
  19676. providerExpr: providerExpr,
  19677. flags: providerFlags, depsExpr: depsExpr,
  19678. tokenExpr: tokenExpr(ctx, providerAst.token),
  19679. };
  19680. }
  19681. function multiProviderDef(ctx, flags, providers) {
  19682. var allDepDefs = [];
  19683. var allParams = [];
  19684. var exprs = providers.map(function (provider, providerIndex) {
  19685. var expr;
  19686. if (provider.useClass) {
  19687. var depExprs = convertDeps(providerIndex, provider.deps || provider.useClass.diDeps);
  19688. expr = ctx.importExpr(provider.useClass.reference).instantiate(depExprs);
  19689. }
  19690. else if (provider.useFactory) {
  19691. var depExprs = convertDeps(providerIndex, provider.deps || provider.useFactory.diDeps);
  19692. expr = ctx.importExpr(provider.useFactory.reference).callFn(depExprs);
  19693. }
  19694. else if (provider.useExisting) {
  19695. var depExprs = convertDeps(providerIndex, [{ token: provider.useExisting }]);
  19696. expr = depExprs[0];
  19697. }
  19698. else {
  19699. expr = convertValueToOutputAst(ctx, provider.useValue);
  19700. }
  19701. return expr;
  19702. });
  19703. var providerExpr = fn(allParams, [new ReturnStatement(literalArr(exprs))], INFERRED_TYPE);
  19704. return {
  19705. providerExpr: providerExpr,
  19706. flags: flags | 1024 /* TypeFactoryProvider */,
  19707. depsExpr: literalArr(allDepDefs)
  19708. };
  19709. function convertDeps(providerIndex, deps) {
  19710. return deps.map(function (dep, depIndex) {
  19711. var paramName = "p" + providerIndex + "_" + depIndex;
  19712. allParams.push(new FnParam(paramName, DYNAMIC_TYPE));
  19713. allDepDefs.push(depDef(ctx, dep));
  19714. return variable(paramName);
  19715. });
  19716. }
  19717. }
  19718. function singleProviderDef(ctx, flags, providerType, providerMeta) {
  19719. var providerExpr;
  19720. var deps;
  19721. if (providerType === ProviderAstType.Directive || providerType === ProviderAstType.Component) {
  19722. providerExpr = ctx.importExpr(providerMeta.useClass.reference);
  19723. flags |= 16384 /* TypeDirective */;
  19724. deps = providerMeta.deps || providerMeta.useClass.diDeps;
  19725. }
  19726. else {
  19727. if (providerMeta.useClass) {
  19728. providerExpr = ctx.importExpr(providerMeta.useClass.reference);
  19729. flags |= 512 /* TypeClassProvider */;
  19730. deps = providerMeta.deps || providerMeta.useClass.diDeps;
  19731. }
  19732. else if (providerMeta.useFactory) {
  19733. providerExpr = ctx.importExpr(providerMeta.useFactory.reference);
  19734. flags |= 1024 /* TypeFactoryProvider */;
  19735. deps = providerMeta.deps || providerMeta.useFactory.diDeps;
  19736. }
  19737. else if (providerMeta.useExisting) {
  19738. providerExpr = NULL_EXPR;
  19739. flags |= 2048 /* TypeUseExistingProvider */;
  19740. deps = [{ token: providerMeta.useExisting }];
  19741. }
  19742. else {
  19743. providerExpr = convertValueToOutputAst(ctx, providerMeta.useValue);
  19744. flags |= 256 /* TypeValueProvider */;
  19745. deps = [];
  19746. }
  19747. }
  19748. var depsExpr = literalArr(deps.map(function (dep) { return depDef(ctx, dep); }));
  19749. return { providerExpr: providerExpr, flags: flags, depsExpr: depsExpr };
  19750. }
  19751. function tokenExpr(ctx, tokenMeta) {
  19752. return tokenMeta.identifier ? ctx.importExpr(tokenMeta.identifier.reference) :
  19753. literal(tokenMeta.value);
  19754. }
  19755. function depDef(ctx, dep) {
  19756. // Note: the following fields have already been normalized out by provider_analyzer:
  19757. // - isAttribute, isHost
  19758. var expr = dep.isValue ? convertValueToOutputAst(ctx, dep.value) : tokenExpr(ctx, dep.token);
  19759. var flags = 0 /* None */;
  19760. if (dep.isSkipSelf) {
  19761. flags |= 1 /* SkipSelf */;
  19762. }
  19763. if (dep.isOptional) {
  19764. flags |= 2 /* Optional */;
  19765. }
  19766. if (dep.isSelf) {
  19767. flags |= 4 /* Self */;
  19768. }
  19769. if (dep.isValue) {
  19770. flags |= 8 /* Value */;
  19771. }
  19772. return flags === 0 /* None */ ? expr : literalArr([literal(flags), expr]);
  19773. }
  19774. function lifecycleHookToNodeFlag(lifecycleHook) {
  19775. var nodeFlag = 0 /* None */;
  19776. switch (lifecycleHook) {
  19777. case LifecycleHooks.AfterContentChecked:
  19778. nodeFlag = 2097152 /* AfterContentChecked */;
  19779. break;
  19780. case LifecycleHooks.AfterContentInit:
  19781. nodeFlag = 1048576 /* AfterContentInit */;
  19782. break;
  19783. case LifecycleHooks.AfterViewChecked:
  19784. nodeFlag = 8388608 /* AfterViewChecked */;
  19785. break;
  19786. case LifecycleHooks.AfterViewInit:
  19787. nodeFlag = 4194304 /* AfterViewInit */;
  19788. break;
  19789. case LifecycleHooks.DoCheck:
  19790. nodeFlag = 262144 /* DoCheck */;
  19791. break;
  19792. case LifecycleHooks.OnChanges:
  19793. nodeFlag = 524288 /* OnChanges */;
  19794. break;
  19795. case LifecycleHooks.OnDestroy:
  19796. nodeFlag = 131072 /* OnDestroy */;
  19797. break;
  19798. case LifecycleHooks.OnInit:
  19799. nodeFlag = 65536 /* OnInit */;
  19800. break;
  19801. }
  19802. return nodeFlag;
  19803. }
  19804. function componentFactoryResolverProviderDef(reflector, ctx, flags, entryComponents) {
  19805. var entryComponentFactories = entryComponents.map(function (entryComponent) { return ctx.importExpr(entryComponent.componentFactory); });
  19806. var token = createTokenForExternalReference(reflector, Identifiers.ComponentFactoryResolver);
  19807. var classMeta = {
  19808. diDeps: [
  19809. { isValue: true, value: literalArr(entryComponentFactories) },
  19810. { token: token, isSkipSelf: true, isOptional: true },
  19811. { token: createTokenForExternalReference(reflector, Identifiers.NgModuleRef) },
  19812. ],
  19813. lifecycleHooks: [],
  19814. reference: reflector.resolveExternalReference(Identifiers.CodegenComponentFactoryResolver)
  19815. };
  19816. var _a = singleProviderDef(ctx, flags, ProviderAstType.PrivateService, {
  19817. token: token,
  19818. multi: false,
  19819. useClass: classMeta,
  19820. }), providerExpr = _a.providerExpr, providerFlags = _a.flags, depsExpr = _a.depsExpr;
  19821. return { providerExpr: providerExpr, flags: providerFlags, depsExpr: depsExpr, tokenExpr: tokenExpr(ctx, token) };
  19822. }
  19823. /**
  19824. * @license
  19825. * Copyright Google Inc. All Rights Reserved.
  19826. *
  19827. * Use of this source code is governed by an MIT-style license that can be
  19828. * found in the LICENSE file at https://angular.io/license
  19829. */
  19830. var NgModuleCompileResult = /** @class */ (function () {
  19831. function NgModuleCompileResult(ngModuleFactoryVar) {
  19832. this.ngModuleFactoryVar = ngModuleFactoryVar;
  19833. }
  19834. return NgModuleCompileResult;
  19835. }());
  19836. var LOG_VAR = variable('_l');
  19837. var NgModuleCompiler = /** @class */ (function () {
  19838. function NgModuleCompiler(reflector) {
  19839. this.reflector = reflector;
  19840. }
  19841. NgModuleCompiler.prototype.compile = function (ctx, ngModuleMeta, extraProviders) {
  19842. var sourceSpan = typeSourceSpan('NgModule', ngModuleMeta.type);
  19843. var entryComponentFactories = ngModuleMeta.transitiveModule.entryComponents;
  19844. var bootstrapComponents = ngModuleMeta.bootstrapComponents;
  19845. var providerParser = new NgModuleProviderAnalyzer(this.reflector, ngModuleMeta, extraProviders, sourceSpan);
  19846. var providerDefs = [componentFactoryResolverProviderDef(this.reflector, ctx, 0 /* None */, entryComponentFactories)]
  19847. .concat(providerParser.parse().map(function (provider) { return providerDef(ctx, provider); }))
  19848. .map(function (_a) {
  19849. var providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
  19850. return importExpr(Identifiers.moduleProviderDef).callFn([
  19851. literal(flags), tokenExpr, providerExpr, depsExpr
  19852. ]);
  19853. });
  19854. var ngModuleDef = importExpr(Identifiers.moduleDef).callFn([literalArr(providerDefs)]);
  19855. var ngModuleDefFactory = fn([new FnParam(LOG_VAR.name)], [new ReturnStatement(ngModuleDef)], INFERRED_TYPE);
  19856. var ngModuleFactoryVar = identifierName(ngModuleMeta.type) + "NgFactory";
  19857. this._createNgModuleFactory(ctx, ngModuleMeta.type.reference, importExpr(Identifiers.createModuleFactory).callFn([
  19858. ctx.importExpr(ngModuleMeta.type.reference),
  19859. literalArr(bootstrapComponents.map(function (id) { return ctx.importExpr(id.reference); })),
  19860. ngModuleDefFactory
  19861. ]));
  19862. if (ngModuleMeta.id) {
  19863. var id = typeof ngModuleMeta.id === 'string' ? literal(ngModuleMeta.id) :
  19864. ctx.importExpr(ngModuleMeta.id);
  19865. var registerFactoryStmt = importExpr(Identifiers.RegisterModuleFactoryFn)
  19866. .callFn([id, variable(ngModuleFactoryVar)])
  19867. .toStmt();
  19868. ctx.statements.push(registerFactoryStmt);
  19869. }
  19870. return new NgModuleCompileResult(ngModuleFactoryVar);
  19871. };
  19872. NgModuleCompiler.prototype.createStub = function (ctx, ngModuleReference) {
  19873. this._createNgModuleFactory(ctx, ngModuleReference, NULL_EXPR);
  19874. };
  19875. NgModuleCompiler.prototype._createNgModuleFactory = function (ctx, reference, value) {
  19876. var ngModuleFactoryVar = identifierName({ reference: reference }) + "NgFactory";
  19877. var ngModuleFactoryStmt = variable(ngModuleFactoryVar)
  19878. .set(value)
  19879. .toDeclStmt(importType(Identifiers.NgModuleFactory, [expressionType(ctx.importExpr(reference))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]);
  19880. ctx.statements.push(ngModuleFactoryStmt);
  19881. };
  19882. return NgModuleCompiler;
  19883. }());
  19884. /**
  19885. * @license
  19886. * Copyright Google Inc. All Rights Reserved.
  19887. *
  19888. * Use of this source code is governed by an MIT-style license that can be
  19889. * found in the LICENSE file at https://angular.io/license
  19890. */
  19891. /**
  19892. * Resolves types to {@link NgModule}.
  19893. */
  19894. var NgModuleResolver = /** @class */ (function () {
  19895. function NgModuleResolver(_reflector) {
  19896. this._reflector = _reflector;
  19897. }
  19898. NgModuleResolver.prototype.isNgModule = function (type) { return this._reflector.annotations(type).some(createNgModule.isTypeOf); };
  19899. NgModuleResolver.prototype.resolve = function (type, throwIfNotFound) {
  19900. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  19901. var ngModuleMeta = findLast(this._reflector.annotations(type), createNgModule.isTypeOf);
  19902. if (ngModuleMeta) {
  19903. return ngModuleMeta;
  19904. }
  19905. else {
  19906. if (throwIfNotFound) {
  19907. throw new Error("No NgModule metadata found for '" + stringify(type) + "'.");
  19908. }
  19909. return null;
  19910. }
  19911. };
  19912. return NgModuleResolver;
  19913. }());
  19914. /**
  19915. * @license
  19916. * Copyright Google Inc. All Rights Reserved.
  19917. *
  19918. * Use of this source code is governed by an MIT-style license that can be
  19919. * found in the LICENSE file at https://angular.io/license
  19920. */
  19921. // https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit
  19922. var VERSION$1 = 3;
  19923. var JS_B64_PREFIX = '# sourceMappingURL=data:application/json;base64,';
  19924. var SourceMapGenerator = /** @class */ (function () {
  19925. function SourceMapGenerator(file) {
  19926. if (file === void 0) { file = null; }
  19927. this.file = file;
  19928. this.sourcesContent = new Map();
  19929. this.lines = [];
  19930. this.lastCol0 = 0;
  19931. this.hasMappings = false;
  19932. }
  19933. // The content is `null` when the content is expected to be loaded using the URL
  19934. SourceMapGenerator.prototype.addSource = function (url, content) {
  19935. if (content === void 0) { content = null; }
  19936. if (!this.sourcesContent.has(url)) {
  19937. this.sourcesContent.set(url, content);
  19938. }
  19939. return this;
  19940. };
  19941. SourceMapGenerator.prototype.addLine = function () {
  19942. this.lines.push([]);
  19943. this.lastCol0 = 0;
  19944. return this;
  19945. };
  19946. SourceMapGenerator.prototype.addMapping = function (col0, sourceUrl, sourceLine0, sourceCol0) {
  19947. if (!this.currentLine) {
  19948. throw new Error("A line must be added before mappings can be added");
  19949. }
  19950. if (sourceUrl != null && !this.sourcesContent.has(sourceUrl)) {
  19951. throw new Error("Unknown source file \"" + sourceUrl + "\"");
  19952. }
  19953. if (col0 == null) {
  19954. throw new Error("The column in the generated code must be provided");
  19955. }
  19956. if (col0 < this.lastCol0) {
  19957. throw new Error("Mapping should be added in output order");
  19958. }
  19959. if (sourceUrl && (sourceLine0 == null || sourceCol0 == null)) {
  19960. throw new Error("The source location must be provided when a source url is provided");
  19961. }
  19962. this.hasMappings = true;
  19963. this.lastCol0 = col0;
  19964. this.currentLine.push({ col0: col0, sourceUrl: sourceUrl, sourceLine0: sourceLine0, sourceCol0: sourceCol0 });
  19965. return this;
  19966. };
  19967. Object.defineProperty(SourceMapGenerator.prototype, "currentLine", {
  19968. get: function () { return this.lines.slice(-1)[0]; },
  19969. enumerable: true,
  19970. configurable: true
  19971. });
  19972. SourceMapGenerator.prototype.toJSON = function () {
  19973. var _this = this;
  19974. if (!this.hasMappings) {
  19975. return null;
  19976. }
  19977. var sourcesIndex = new Map();
  19978. var sources = [];
  19979. var sourcesContent = [];
  19980. Array.from(this.sourcesContent.keys()).forEach(function (url, i) {
  19981. sourcesIndex.set(url, i);
  19982. sources.push(url);
  19983. sourcesContent.push(_this.sourcesContent.get(url) || null);
  19984. });
  19985. var mappings = '';
  19986. var lastCol0 = 0;
  19987. var lastSourceIndex = 0;
  19988. var lastSourceLine0 = 0;
  19989. var lastSourceCol0 = 0;
  19990. this.lines.forEach(function (segments) {
  19991. lastCol0 = 0;
  19992. mappings += segments
  19993. .map(function (segment) {
  19994. // zero-based starting column of the line in the generated code
  19995. var segAsStr = toBase64VLQ(segment.col0 - lastCol0);
  19996. lastCol0 = segment.col0;
  19997. if (segment.sourceUrl != null) {
  19998. // zero-based index into the “sources” list
  19999. segAsStr +=
  20000. toBase64VLQ(sourcesIndex.get(segment.sourceUrl) - lastSourceIndex);
  20001. lastSourceIndex = sourcesIndex.get(segment.sourceUrl);
  20002. // the zero-based starting line in the original source
  20003. segAsStr += toBase64VLQ(segment.sourceLine0 - lastSourceLine0);
  20004. lastSourceLine0 = segment.sourceLine0;
  20005. // the zero-based starting column in the original source
  20006. segAsStr += toBase64VLQ(segment.sourceCol0 - lastSourceCol0);
  20007. lastSourceCol0 = segment.sourceCol0;
  20008. }
  20009. return segAsStr;
  20010. })
  20011. .join(',');
  20012. mappings += ';';
  20013. });
  20014. mappings = mappings.slice(0, -1);
  20015. return {
  20016. 'file': this.file || '',
  20017. 'version': VERSION$1,
  20018. 'sourceRoot': '',
  20019. 'sources': sources,
  20020. 'sourcesContent': sourcesContent,
  20021. 'mappings': mappings,
  20022. };
  20023. };
  20024. SourceMapGenerator.prototype.toJsComment = function () {
  20025. return this.hasMappings ? '//' + JS_B64_PREFIX + toBase64String(JSON.stringify(this, null, 0)) :
  20026. '';
  20027. };
  20028. return SourceMapGenerator;
  20029. }());
  20030. function toBase64String(value) {
  20031. var b64 = '';
  20032. value = utf8Encode(value);
  20033. for (var i = 0; i < value.length;) {
  20034. var i1 = value.charCodeAt(i++);
  20035. var i2 = value.charCodeAt(i++);
  20036. var i3 = value.charCodeAt(i++);
  20037. b64 += toBase64Digit(i1 >> 2);
  20038. b64 += toBase64Digit(((i1 & 3) << 4) | (isNaN(i2) ? 0 : i2 >> 4));
  20039. b64 += isNaN(i2) ? '=' : toBase64Digit(((i2 & 15) << 2) | (i3 >> 6));
  20040. b64 += isNaN(i2) || isNaN(i3) ? '=' : toBase64Digit(i3 & 63);
  20041. }
  20042. return b64;
  20043. }
  20044. function toBase64VLQ(value) {
  20045. value = value < 0 ? ((-value) << 1) + 1 : value << 1;
  20046. var out = '';
  20047. do {
  20048. var digit = value & 31;
  20049. value = value >> 5;
  20050. if (value > 0) {
  20051. digit = digit | 32;
  20052. }
  20053. out += toBase64Digit(digit);
  20054. } while (value > 0);
  20055. return out;
  20056. }
  20057. var B64_DIGITS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
  20058. function toBase64Digit(value) {
  20059. if (value < 0 || value >= 64) {
  20060. throw new Error("Can only encode value in the range [0, 63]");
  20061. }
  20062. return B64_DIGITS[value];
  20063. }
  20064. /**
  20065. * @license
  20066. * Copyright Google Inc. All Rights Reserved.
  20067. *
  20068. * Use of this source code is governed by an MIT-style license that can be
  20069. * found in the LICENSE file at https://angular.io/license
  20070. */
  20071. var _SINGLE_QUOTE_ESCAPE_STRING_RE = /'|\\|\n|\r|\$/g;
  20072. var _LEGAL_IDENTIFIER_RE = /^[$A-Z_][0-9A-Z_$]*$/i;
  20073. var _INDENT_WITH = ' ';
  20074. var CATCH_ERROR_VAR$1 = variable('error', null, null);
  20075. var CATCH_STACK_VAR$1 = variable('stack', null, null);
  20076. var _EmittedLine = /** @class */ (function () {
  20077. function _EmittedLine(indent) {
  20078. this.indent = indent;
  20079. this.partsLength = 0;
  20080. this.parts = [];
  20081. this.srcSpans = [];
  20082. }
  20083. return _EmittedLine;
  20084. }());
  20085. var EmitterVisitorContext = /** @class */ (function () {
  20086. function EmitterVisitorContext(_indent) {
  20087. this._indent = _indent;
  20088. this._classes = [];
  20089. this._preambleLineCount = 0;
  20090. this._lines = [new _EmittedLine(_indent)];
  20091. }
  20092. EmitterVisitorContext.createRoot = function () { return new EmitterVisitorContext(0); };
  20093. Object.defineProperty(EmitterVisitorContext.prototype, "_currentLine", {
  20094. get: function () { return this._lines[this._lines.length - 1]; },
  20095. enumerable: true,
  20096. configurable: true
  20097. });
  20098. EmitterVisitorContext.prototype.println = function (from, lastPart) {
  20099. if (lastPart === void 0) { lastPart = ''; }
  20100. this.print(from || null, lastPart, true);
  20101. };
  20102. EmitterVisitorContext.prototype.lineIsEmpty = function () { return this._currentLine.parts.length === 0; };
  20103. EmitterVisitorContext.prototype.lineLength = function () {
  20104. return this._currentLine.indent * _INDENT_WITH.length + this._currentLine.partsLength;
  20105. };
  20106. EmitterVisitorContext.prototype.print = function (from, part, newLine) {
  20107. if (newLine === void 0) { newLine = false; }
  20108. if (part.length > 0) {
  20109. this._currentLine.parts.push(part);
  20110. this._currentLine.partsLength += part.length;
  20111. this._currentLine.srcSpans.push(from && from.sourceSpan || null);
  20112. }
  20113. if (newLine) {
  20114. this._lines.push(new _EmittedLine(this._indent));
  20115. }
  20116. };
  20117. EmitterVisitorContext.prototype.removeEmptyLastLine = function () {
  20118. if (this.lineIsEmpty()) {
  20119. this._lines.pop();
  20120. }
  20121. };
  20122. EmitterVisitorContext.prototype.incIndent = function () {
  20123. this._indent++;
  20124. if (this.lineIsEmpty()) {
  20125. this._currentLine.indent = this._indent;
  20126. }
  20127. };
  20128. EmitterVisitorContext.prototype.decIndent = function () {
  20129. this._indent--;
  20130. if (this.lineIsEmpty()) {
  20131. this._currentLine.indent = this._indent;
  20132. }
  20133. };
  20134. EmitterVisitorContext.prototype.pushClass = function (clazz) { this._classes.push(clazz); };
  20135. EmitterVisitorContext.prototype.popClass = function () { return this._classes.pop(); };
  20136. Object.defineProperty(EmitterVisitorContext.prototype, "currentClass", {
  20137. get: function () {
  20138. return this._classes.length > 0 ? this._classes[this._classes.length - 1] : null;
  20139. },
  20140. enumerable: true,
  20141. configurable: true
  20142. });
  20143. EmitterVisitorContext.prototype.toSource = function () {
  20144. return this.sourceLines
  20145. .map(function (l) { return l.parts.length > 0 ? _createIndent(l.indent) + l.parts.join('') : ''; })
  20146. .join('\n');
  20147. };
  20148. EmitterVisitorContext.prototype.toSourceMapGenerator = function (genFilePath, startsAtLine) {
  20149. if (startsAtLine === void 0) { startsAtLine = 0; }
  20150. var map = new SourceMapGenerator(genFilePath);
  20151. var firstOffsetMapped = false;
  20152. var mapFirstOffsetIfNeeded = function () {
  20153. if (!firstOffsetMapped) {
  20154. // Add a single space so that tools won't try to load the file from disk.
  20155. // Note: We are using virtual urls like `ng:///`, so we have to
  20156. // provide a content here.
  20157. map.addSource(genFilePath, ' ').addMapping(0, genFilePath, 0, 0);
  20158. firstOffsetMapped = true;
  20159. }
  20160. };
  20161. for (var i = 0; i < startsAtLine; i++) {
  20162. map.addLine();
  20163. mapFirstOffsetIfNeeded();
  20164. }
  20165. this.sourceLines.forEach(function (line, lineIdx) {
  20166. map.addLine();
  20167. var spans = line.srcSpans;
  20168. var parts = line.parts;
  20169. var col0 = line.indent * _INDENT_WITH.length;
  20170. var spanIdx = 0;
  20171. // skip leading parts without source spans
  20172. while (spanIdx < spans.length && !spans[spanIdx]) {
  20173. col0 += parts[spanIdx].length;
  20174. spanIdx++;
  20175. }
  20176. if (spanIdx < spans.length && lineIdx === 0 && col0 === 0) {
  20177. firstOffsetMapped = true;
  20178. }
  20179. else {
  20180. mapFirstOffsetIfNeeded();
  20181. }
  20182. while (spanIdx < spans.length) {
  20183. var span = spans[spanIdx];
  20184. var source = span.start.file;
  20185. var sourceLine = span.start.line;
  20186. var sourceCol = span.start.col;
  20187. map.addSource(source.url, source.content)
  20188. .addMapping(col0, source.url, sourceLine, sourceCol);
  20189. col0 += parts[spanIdx].length;
  20190. spanIdx++;
  20191. // assign parts without span or the same span to the previous segment
  20192. while (spanIdx < spans.length && (span === spans[spanIdx] || !spans[spanIdx])) {
  20193. col0 += parts[spanIdx].length;
  20194. spanIdx++;
  20195. }
  20196. }
  20197. });
  20198. return map;
  20199. };
  20200. EmitterVisitorContext.prototype.setPreambleLineCount = function (count) { return this._preambleLineCount = count; };
  20201. EmitterVisitorContext.prototype.spanOf = function (line, column) {
  20202. var emittedLine = this._lines[line - this._preambleLineCount];
  20203. if (emittedLine) {
  20204. var columnsLeft = column - _createIndent(emittedLine.indent).length;
  20205. for (var partIndex = 0; partIndex < emittedLine.parts.length; partIndex++) {
  20206. var part = emittedLine.parts[partIndex];
  20207. if (part.length > columnsLeft) {
  20208. return emittedLine.srcSpans[partIndex];
  20209. }
  20210. columnsLeft -= part.length;
  20211. }
  20212. }
  20213. return null;
  20214. };
  20215. Object.defineProperty(EmitterVisitorContext.prototype, "sourceLines", {
  20216. get: function () {
  20217. if (this._lines.length && this._lines[this._lines.length - 1].parts.length === 0) {
  20218. return this._lines.slice(0, -1);
  20219. }
  20220. return this._lines;
  20221. },
  20222. enumerable: true,
  20223. configurable: true
  20224. });
  20225. return EmitterVisitorContext;
  20226. }());
  20227. var AbstractEmitterVisitor = /** @class */ (function () {
  20228. function AbstractEmitterVisitor(_escapeDollarInStrings) {
  20229. this._escapeDollarInStrings = _escapeDollarInStrings;
  20230. }
  20231. AbstractEmitterVisitor.prototype.visitExpressionStmt = function (stmt, ctx) {
  20232. stmt.expr.visitExpression(this, ctx);
  20233. ctx.println(stmt, ';');
  20234. return null;
  20235. };
  20236. AbstractEmitterVisitor.prototype.visitReturnStmt = function (stmt, ctx) {
  20237. ctx.print(stmt, "return ");
  20238. stmt.value.visitExpression(this, ctx);
  20239. ctx.println(stmt, ';');
  20240. return null;
  20241. };
  20242. AbstractEmitterVisitor.prototype.visitIfStmt = function (stmt, ctx) {
  20243. ctx.print(stmt, "if (");
  20244. stmt.condition.visitExpression(this, ctx);
  20245. ctx.print(stmt, ") {");
  20246. var hasElseCase = stmt.falseCase != null && stmt.falseCase.length > 0;
  20247. if (stmt.trueCase.length <= 1 && !hasElseCase) {
  20248. ctx.print(stmt, " ");
  20249. this.visitAllStatements(stmt.trueCase, ctx);
  20250. ctx.removeEmptyLastLine();
  20251. ctx.print(stmt, " ");
  20252. }
  20253. else {
  20254. ctx.println();
  20255. ctx.incIndent();
  20256. this.visitAllStatements(stmt.trueCase, ctx);
  20257. ctx.decIndent();
  20258. if (hasElseCase) {
  20259. ctx.println(stmt, "} else {");
  20260. ctx.incIndent();
  20261. this.visitAllStatements(stmt.falseCase, ctx);
  20262. ctx.decIndent();
  20263. }
  20264. }
  20265. ctx.println(stmt, "}");
  20266. return null;
  20267. };
  20268. AbstractEmitterVisitor.prototype.visitThrowStmt = function (stmt, ctx) {
  20269. ctx.print(stmt, "throw ");
  20270. stmt.error.visitExpression(this, ctx);
  20271. ctx.println(stmt, ";");
  20272. return null;
  20273. };
  20274. AbstractEmitterVisitor.prototype.visitCommentStmt = function (stmt, ctx) {
  20275. if (stmt.multiline) {
  20276. ctx.println(stmt, "/* " + stmt.comment + " */");
  20277. }
  20278. else {
  20279. stmt.comment.split('\n').forEach(function (line) { ctx.println(stmt, "// " + line); });
  20280. }
  20281. return null;
  20282. };
  20283. AbstractEmitterVisitor.prototype.visitJSDocCommentStmt = function (stmt, ctx) {
  20284. ctx.println(stmt, "/*" + stmt.toString() + "*/");
  20285. return null;
  20286. };
  20287. AbstractEmitterVisitor.prototype.visitWriteVarExpr = function (expr, ctx) {
  20288. var lineWasEmpty = ctx.lineIsEmpty();
  20289. if (!lineWasEmpty) {
  20290. ctx.print(expr, '(');
  20291. }
  20292. ctx.print(expr, expr.name + " = ");
  20293. expr.value.visitExpression(this, ctx);
  20294. if (!lineWasEmpty) {
  20295. ctx.print(expr, ')');
  20296. }
  20297. return null;
  20298. };
  20299. AbstractEmitterVisitor.prototype.visitWriteKeyExpr = function (expr, ctx) {
  20300. var lineWasEmpty = ctx.lineIsEmpty();
  20301. if (!lineWasEmpty) {
  20302. ctx.print(expr, '(');
  20303. }
  20304. expr.receiver.visitExpression(this, ctx);
  20305. ctx.print(expr, "[");
  20306. expr.index.visitExpression(this, ctx);
  20307. ctx.print(expr, "] = ");
  20308. expr.value.visitExpression(this, ctx);
  20309. if (!lineWasEmpty) {
  20310. ctx.print(expr, ')');
  20311. }
  20312. return null;
  20313. };
  20314. AbstractEmitterVisitor.prototype.visitWritePropExpr = function (expr, ctx) {
  20315. var lineWasEmpty = ctx.lineIsEmpty();
  20316. if (!lineWasEmpty) {
  20317. ctx.print(expr, '(');
  20318. }
  20319. expr.receiver.visitExpression(this, ctx);
  20320. ctx.print(expr, "." + expr.name + " = ");
  20321. expr.value.visitExpression(this, ctx);
  20322. if (!lineWasEmpty) {
  20323. ctx.print(expr, ')');
  20324. }
  20325. return null;
  20326. };
  20327. AbstractEmitterVisitor.prototype.visitInvokeMethodExpr = function (expr, ctx) {
  20328. expr.receiver.visitExpression(this, ctx);
  20329. var name = expr.name;
  20330. if (expr.builtin != null) {
  20331. name = this.getBuiltinMethodName(expr.builtin);
  20332. if (name == null) {
  20333. // some builtins just mean to skip the call.
  20334. return null;
  20335. }
  20336. }
  20337. ctx.print(expr, "." + name + "(");
  20338. this.visitAllExpressions(expr.args, ctx, ",");
  20339. ctx.print(expr, ")");
  20340. return null;
  20341. };
  20342. AbstractEmitterVisitor.prototype.visitInvokeFunctionExpr = function (expr, ctx) {
  20343. expr.fn.visitExpression(this, ctx);
  20344. ctx.print(expr, "(");
  20345. this.visitAllExpressions(expr.args, ctx, ',');
  20346. ctx.print(expr, ")");
  20347. return null;
  20348. };
  20349. AbstractEmitterVisitor.prototype.visitWrappedNodeExpr = function (ast, ctx) {
  20350. throw new Error('Abstract emitter cannot visit WrappedNodeExpr.');
  20351. };
  20352. AbstractEmitterVisitor.prototype.visitTypeofExpr = function (expr, ctx) {
  20353. ctx.print(expr, 'typeof ');
  20354. expr.expr.visitExpression(this, ctx);
  20355. };
  20356. AbstractEmitterVisitor.prototype.visitReadVarExpr = function (ast, ctx) {
  20357. var varName = ast.name;
  20358. if (ast.builtin != null) {
  20359. switch (ast.builtin) {
  20360. case BuiltinVar.Super:
  20361. varName = 'super';
  20362. break;
  20363. case BuiltinVar.This:
  20364. varName = 'this';
  20365. break;
  20366. case BuiltinVar.CatchError:
  20367. varName = CATCH_ERROR_VAR$1.name;
  20368. break;
  20369. case BuiltinVar.CatchStack:
  20370. varName = CATCH_STACK_VAR$1.name;
  20371. break;
  20372. default:
  20373. throw new Error("Unknown builtin variable " + ast.builtin);
  20374. }
  20375. }
  20376. ctx.print(ast, varName);
  20377. return null;
  20378. };
  20379. AbstractEmitterVisitor.prototype.visitInstantiateExpr = function (ast, ctx) {
  20380. ctx.print(ast, "new ");
  20381. ast.classExpr.visitExpression(this, ctx);
  20382. ctx.print(ast, "(");
  20383. this.visitAllExpressions(ast.args, ctx, ',');
  20384. ctx.print(ast, ")");
  20385. return null;
  20386. };
  20387. AbstractEmitterVisitor.prototype.visitLiteralExpr = function (ast, ctx) {
  20388. var value = ast.value;
  20389. if (typeof value === 'string') {
  20390. ctx.print(ast, escapeIdentifier(value, this._escapeDollarInStrings));
  20391. }
  20392. else {
  20393. ctx.print(ast, "" + value);
  20394. }
  20395. return null;
  20396. };
  20397. AbstractEmitterVisitor.prototype.visitConditionalExpr = function (ast, ctx) {
  20398. ctx.print(ast, "(");
  20399. ast.condition.visitExpression(this, ctx);
  20400. ctx.print(ast, '? ');
  20401. ast.trueCase.visitExpression(this, ctx);
  20402. ctx.print(ast, ': ');
  20403. ast.falseCase.visitExpression(this, ctx);
  20404. ctx.print(ast, ")");
  20405. return null;
  20406. };
  20407. AbstractEmitterVisitor.prototype.visitNotExpr = function (ast, ctx) {
  20408. ctx.print(ast, '!');
  20409. ast.condition.visitExpression(this, ctx);
  20410. return null;
  20411. };
  20412. AbstractEmitterVisitor.prototype.visitAssertNotNullExpr = function (ast, ctx) {
  20413. ast.condition.visitExpression(this, ctx);
  20414. return null;
  20415. };
  20416. AbstractEmitterVisitor.prototype.visitBinaryOperatorExpr = function (ast, ctx) {
  20417. var opStr;
  20418. switch (ast.operator) {
  20419. case BinaryOperator.Equals:
  20420. opStr = '==';
  20421. break;
  20422. case BinaryOperator.Identical:
  20423. opStr = '===';
  20424. break;
  20425. case BinaryOperator.NotEquals:
  20426. opStr = '!=';
  20427. break;
  20428. case BinaryOperator.NotIdentical:
  20429. opStr = '!==';
  20430. break;
  20431. case BinaryOperator.And:
  20432. opStr = '&&';
  20433. break;
  20434. case BinaryOperator.BitwiseAnd:
  20435. opStr = '&';
  20436. break;
  20437. case BinaryOperator.Or:
  20438. opStr = '||';
  20439. break;
  20440. case BinaryOperator.Plus:
  20441. opStr = '+';
  20442. break;
  20443. case BinaryOperator.Minus:
  20444. opStr = '-';
  20445. break;
  20446. case BinaryOperator.Divide:
  20447. opStr = '/';
  20448. break;
  20449. case BinaryOperator.Multiply:
  20450. opStr = '*';
  20451. break;
  20452. case BinaryOperator.Modulo:
  20453. opStr = '%';
  20454. break;
  20455. case BinaryOperator.Lower:
  20456. opStr = '<';
  20457. break;
  20458. case BinaryOperator.LowerEquals:
  20459. opStr = '<=';
  20460. break;
  20461. case BinaryOperator.Bigger:
  20462. opStr = '>';
  20463. break;
  20464. case BinaryOperator.BiggerEquals:
  20465. opStr = '>=';
  20466. break;
  20467. default:
  20468. throw new Error("Unknown operator " + ast.operator);
  20469. }
  20470. if (ast.parens)
  20471. ctx.print(ast, "(");
  20472. ast.lhs.visitExpression(this, ctx);
  20473. ctx.print(ast, " " + opStr + " ");
  20474. ast.rhs.visitExpression(this, ctx);
  20475. if (ast.parens)
  20476. ctx.print(ast, ")");
  20477. return null;
  20478. };
  20479. AbstractEmitterVisitor.prototype.visitReadPropExpr = function (ast, ctx) {
  20480. ast.receiver.visitExpression(this, ctx);
  20481. ctx.print(ast, ".");
  20482. ctx.print(ast, ast.name);
  20483. return null;
  20484. };
  20485. AbstractEmitterVisitor.prototype.visitReadKeyExpr = function (ast, ctx) {
  20486. ast.receiver.visitExpression(this, ctx);
  20487. ctx.print(ast, "[");
  20488. ast.index.visitExpression(this, ctx);
  20489. ctx.print(ast, "]");
  20490. return null;
  20491. };
  20492. AbstractEmitterVisitor.prototype.visitLiteralArrayExpr = function (ast, ctx) {
  20493. ctx.print(ast, "[");
  20494. this.visitAllExpressions(ast.entries, ctx, ',');
  20495. ctx.print(ast, "]");
  20496. return null;
  20497. };
  20498. AbstractEmitterVisitor.prototype.visitLiteralMapExpr = function (ast, ctx) {
  20499. var _this = this;
  20500. ctx.print(ast, "{");
  20501. this.visitAllObjects(function (entry) {
  20502. ctx.print(ast, escapeIdentifier(entry.key, _this._escapeDollarInStrings, entry.quoted) + ":");
  20503. entry.value.visitExpression(_this, ctx);
  20504. }, ast.entries, ctx, ',');
  20505. ctx.print(ast, "}");
  20506. return null;
  20507. };
  20508. AbstractEmitterVisitor.prototype.visitCommaExpr = function (ast, ctx) {
  20509. ctx.print(ast, '(');
  20510. this.visitAllExpressions(ast.parts, ctx, ',');
  20511. ctx.print(ast, ')');
  20512. return null;
  20513. };
  20514. AbstractEmitterVisitor.prototype.visitAllExpressions = function (expressions, ctx, separator) {
  20515. var _this = this;
  20516. this.visitAllObjects(function (expr) { return expr.visitExpression(_this, ctx); }, expressions, ctx, separator);
  20517. };
  20518. AbstractEmitterVisitor.prototype.visitAllObjects = function (handler, expressions, ctx, separator) {
  20519. var incrementedIndent = false;
  20520. for (var i = 0; i < expressions.length; i++) {
  20521. if (i > 0) {
  20522. if (ctx.lineLength() > 80) {
  20523. ctx.print(null, separator, true);
  20524. if (!incrementedIndent) {
  20525. // continuation are marked with double indent.
  20526. ctx.incIndent();
  20527. ctx.incIndent();
  20528. incrementedIndent = true;
  20529. }
  20530. }
  20531. else {
  20532. ctx.print(null, separator, false);
  20533. }
  20534. }
  20535. handler(expressions[i]);
  20536. }
  20537. if (incrementedIndent) {
  20538. // continuation are marked with double indent.
  20539. ctx.decIndent();
  20540. ctx.decIndent();
  20541. }
  20542. };
  20543. AbstractEmitterVisitor.prototype.visitAllStatements = function (statements, ctx) {
  20544. var _this = this;
  20545. statements.forEach(function (stmt) { return stmt.visitStatement(_this, ctx); });
  20546. };
  20547. return AbstractEmitterVisitor;
  20548. }());
  20549. function escapeIdentifier(input, escapeDollar, alwaysQuote) {
  20550. if (alwaysQuote === void 0) { alwaysQuote = true; }
  20551. if (input == null) {
  20552. return null;
  20553. }
  20554. var body = input.replace(_SINGLE_QUOTE_ESCAPE_STRING_RE, function () {
  20555. var match = [];
  20556. for (var _i = 0; _i < arguments.length; _i++) {
  20557. match[_i] = arguments[_i];
  20558. }
  20559. if (match[0] == '$') {
  20560. return escapeDollar ? '\\$' : '$';
  20561. }
  20562. else if (match[0] == '\n') {
  20563. return '\\n';
  20564. }
  20565. else if (match[0] == '\r') {
  20566. return '\\r';
  20567. }
  20568. else {
  20569. return "\\" + match[0];
  20570. }
  20571. });
  20572. var requiresQuotes = alwaysQuote || !_LEGAL_IDENTIFIER_RE.test(body);
  20573. return requiresQuotes ? "'" + body + "'" : body;
  20574. }
  20575. function _createIndent(count) {
  20576. var res = '';
  20577. for (var i = 0; i < count; i++) {
  20578. res += _INDENT_WITH;
  20579. }
  20580. return res;
  20581. }
  20582. /**
  20583. * @license
  20584. * Copyright Google Inc. All Rights Reserved.
  20585. *
  20586. * Use of this source code is governed by an MIT-style license that can be
  20587. * found in the LICENSE file at https://angular.io/license
  20588. */
  20589. function debugOutputAstAsTypeScript(ast) {
  20590. var converter = new _TsEmitterVisitor();
  20591. var ctx = EmitterVisitorContext.createRoot();
  20592. var asts = Array.isArray(ast) ? ast : [ast];
  20593. asts.forEach(function (ast) {
  20594. if (ast instanceof Statement) {
  20595. ast.visitStatement(converter, ctx);
  20596. }
  20597. else if (ast instanceof Expression) {
  20598. ast.visitExpression(converter, ctx);
  20599. }
  20600. else if (ast instanceof Type$1) {
  20601. ast.visitType(converter, ctx);
  20602. }
  20603. else {
  20604. throw new Error("Don't know how to print debug info for " + ast);
  20605. }
  20606. });
  20607. return ctx.toSource();
  20608. }
  20609. var TypeScriptEmitter = /** @class */ (function () {
  20610. function TypeScriptEmitter() {
  20611. }
  20612. TypeScriptEmitter.prototype.emitStatementsAndContext = function (genFilePath, stmts, preamble, emitSourceMaps, referenceFilter, importFilter) {
  20613. if (preamble === void 0) { preamble = ''; }
  20614. if (emitSourceMaps === void 0) { emitSourceMaps = true; }
  20615. var converter = new _TsEmitterVisitor(referenceFilter, importFilter);
  20616. var ctx = EmitterVisitorContext.createRoot();
  20617. converter.visitAllStatements(stmts, ctx);
  20618. var preambleLines = preamble ? preamble.split('\n') : [];
  20619. converter.reexports.forEach(function (reexports, exportedModuleName) {
  20620. var reexportsCode = reexports.map(function (reexport) { return reexport.name + " as " + reexport.as; }).join(',');
  20621. preambleLines.push("export {" + reexportsCode + "} from '" + exportedModuleName + "';");
  20622. });
  20623. converter.importsWithPrefixes.forEach(function (prefix, importedModuleName) {
  20624. // Note: can't write the real word for import as it screws up system.js auto detection...
  20625. preambleLines.push("imp" +
  20626. ("ort * as " + prefix + " from '" + importedModuleName + "';"));
  20627. });
  20628. var sm = emitSourceMaps ?
  20629. ctx.toSourceMapGenerator(genFilePath, preambleLines.length).toJsComment() :
  20630. '';
  20631. var lines = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(preambleLines, [ctx.toSource(), sm]);
  20632. if (sm) {
  20633. // always add a newline at the end, as some tools have bugs without it.
  20634. lines.push('');
  20635. }
  20636. ctx.setPreambleLineCount(preambleLines.length);
  20637. return { sourceText: lines.join('\n'), context: ctx };
  20638. };
  20639. TypeScriptEmitter.prototype.emitStatements = function (genFilePath, stmts, preamble) {
  20640. if (preamble === void 0) { preamble = ''; }
  20641. return this.emitStatementsAndContext(genFilePath, stmts, preamble).sourceText;
  20642. };
  20643. return TypeScriptEmitter;
  20644. }());
  20645. var _TsEmitterVisitor = /** @class */ (function (_super) {
  20646. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_TsEmitterVisitor, _super);
  20647. function _TsEmitterVisitor(referenceFilter, importFilter) {
  20648. var _this = _super.call(this, false) || this;
  20649. _this.referenceFilter = referenceFilter;
  20650. _this.importFilter = importFilter;
  20651. _this.typeExpression = 0;
  20652. _this.importsWithPrefixes = new Map();
  20653. _this.reexports = new Map();
  20654. return _this;
  20655. }
  20656. _TsEmitterVisitor.prototype.visitType = function (t, ctx, defaultType) {
  20657. if (defaultType === void 0) { defaultType = 'any'; }
  20658. if (t) {
  20659. this.typeExpression++;
  20660. t.visitType(this, ctx);
  20661. this.typeExpression--;
  20662. }
  20663. else {
  20664. ctx.print(null, defaultType);
  20665. }
  20666. };
  20667. _TsEmitterVisitor.prototype.visitLiteralExpr = function (ast, ctx) {
  20668. var value = ast.value;
  20669. if (value == null && ast.type != INFERRED_TYPE) {
  20670. ctx.print(ast, "(" + value + " as any)");
  20671. return null;
  20672. }
  20673. return _super.prototype.visitLiteralExpr.call(this, ast, ctx);
  20674. };
  20675. // Temporary workaround to support strictNullCheck enabled consumers of ngc emit.
  20676. // In SNC mode, [] have the type never[], so we cast here to any[].
  20677. // TODO: narrow the cast to a more explicit type, or use a pattern that does not
  20678. // start with [].concat. see https://github.com/angular/angular/pull/11846
  20679. _TsEmitterVisitor.prototype.visitLiteralArrayExpr = function (ast, ctx) {
  20680. if (ast.entries.length === 0) {
  20681. ctx.print(ast, '(');
  20682. }
  20683. var result = _super.prototype.visitLiteralArrayExpr.call(this, ast, ctx);
  20684. if (ast.entries.length === 0) {
  20685. ctx.print(ast, ' as any[])');
  20686. }
  20687. return result;
  20688. };
  20689. _TsEmitterVisitor.prototype.visitExternalExpr = function (ast, ctx) {
  20690. this._visitIdentifier(ast.value, ast.typeParams, ctx);
  20691. return null;
  20692. };
  20693. _TsEmitterVisitor.prototype.visitAssertNotNullExpr = function (ast, ctx) {
  20694. var result = _super.prototype.visitAssertNotNullExpr.call(this, ast, ctx);
  20695. ctx.print(ast, '!');
  20696. return result;
  20697. };
  20698. _TsEmitterVisitor.prototype.visitDeclareVarStmt = function (stmt, ctx) {
  20699. if (stmt.hasModifier(StmtModifier.Exported) && stmt.value instanceof ExternalExpr &&
  20700. !stmt.type) {
  20701. // check for a reexport
  20702. var _a = stmt.value.value, name_1 = _a.name, moduleName = _a.moduleName;
  20703. if (moduleName) {
  20704. var reexports = this.reexports.get(moduleName);
  20705. if (!reexports) {
  20706. reexports = [];
  20707. this.reexports.set(moduleName, reexports);
  20708. }
  20709. reexports.push({ name: name_1, as: stmt.name });
  20710. return null;
  20711. }
  20712. }
  20713. if (stmt.hasModifier(StmtModifier.Exported)) {
  20714. ctx.print(stmt, "export ");
  20715. }
  20716. if (stmt.hasModifier(StmtModifier.Final)) {
  20717. ctx.print(stmt, "const");
  20718. }
  20719. else {
  20720. ctx.print(stmt, "var");
  20721. }
  20722. ctx.print(stmt, " " + stmt.name);
  20723. this._printColonType(stmt.type, ctx);
  20724. if (stmt.value) {
  20725. ctx.print(stmt, " = ");
  20726. stmt.value.visitExpression(this, ctx);
  20727. }
  20728. ctx.println(stmt, ";");
  20729. return null;
  20730. };
  20731. _TsEmitterVisitor.prototype.visitWrappedNodeExpr = function (ast, ctx) {
  20732. throw new Error('Cannot visit a WrappedNodeExpr when outputting Typescript.');
  20733. };
  20734. _TsEmitterVisitor.prototype.visitCastExpr = function (ast, ctx) {
  20735. ctx.print(ast, "(<");
  20736. ast.type.visitType(this, ctx);
  20737. ctx.print(ast, ">");
  20738. ast.value.visitExpression(this, ctx);
  20739. ctx.print(ast, ")");
  20740. return null;
  20741. };
  20742. _TsEmitterVisitor.prototype.visitInstantiateExpr = function (ast, ctx) {
  20743. ctx.print(ast, "new ");
  20744. this.typeExpression++;
  20745. ast.classExpr.visitExpression(this, ctx);
  20746. this.typeExpression--;
  20747. ctx.print(ast, "(");
  20748. this.visitAllExpressions(ast.args, ctx, ',');
  20749. ctx.print(ast, ")");
  20750. return null;
  20751. };
  20752. _TsEmitterVisitor.prototype.visitDeclareClassStmt = function (stmt, ctx) {
  20753. var _this = this;
  20754. ctx.pushClass(stmt);
  20755. if (stmt.hasModifier(StmtModifier.Exported)) {
  20756. ctx.print(stmt, "export ");
  20757. }
  20758. ctx.print(stmt, "class " + stmt.name);
  20759. if (stmt.parent != null) {
  20760. ctx.print(stmt, " extends ");
  20761. this.typeExpression++;
  20762. stmt.parent.visitExpression(this, ctx);
  20763. this.typeExpression--;
  20764. }
  20765. ctx.println(stmt, " {");
  20766. ctx.incIndent();
  20767. stmt.fields.forEach(function (field) { return _this._visitClassField(field, ctx); });
  20768. if (stmt.constructorMethod != null) {
  20769. this._visitClassConstructor(stmt, ctx);
  20770. }
  20771. stmt.getters.forEach(function (getter) { return _this._visitClassGetter(getter, ctx); });
  20772. stmt.methods.forEach(function (method) { return _this._visitClassMethod(method, ctx); });
  20773. ctx.decIndent();
  20774. ctx.println(stmt, "}");
  20775. ctx.popClass();
  20776. return null;
  20777. };
  20778. _TsEmitterVisitor.prototype._visitClassField = function (field, ctx) {
  20779. if (field.hasModifier(StmtModifier.Private)) {
  20780. // comment out as a workaround for #10967
  20781. ctx.print(null, "/*private*/ ");
  20782. }
  20783. if (field.hasModifier(StmtModifier.Static)) {
  20784. ctx.print(null, 'static ');
  20785. }
  20786. ctx.print(null, field.name);
  20787. this._printColonType(field.type, ctx);
  20788. if (field.initializer) {
  20789. ctx.print(null, ' = ');
  20790. field.initializer.visitExpression(this, ctx);
  20791. }
  20792. ctx.println(null, ";");
  20793. };
  20794. _TsEmitterVisitor.prototype._visitClassGetter = function (getter, ctx) {
  20795. if (getter.hasModifier(StmtModifier.Private)) {
  20796. ctx.print(null, "private ");
  20797. }
  20798. ctx.print(null, "get " + getter.name + "()");
  20799. this._printColonType(getter.type, ctx);
  20800. ctx.println(null, " {");
  20801. ctx.incIndent();
  20802. this.visitAllStatements(getter.body, ctx);
  20803. ctx.decIndent();
  20804. ctx.println(null, "}");
  20805. };
  20806. _TsEmitterVisitor.prototype._visitClassConstructor = function (stmt, ctx) {
  20807. ctx.print(stmt, "constructor(");
  20808. this._visitParams(stmt.constructorMethod.params, ctx);
  20809. ctx.println(stmt, ") {");
  20810. ctx.incIndent();
  20811. this.visitAllStatements(stmt.constructorMethod.body, ctx);
  20812. ctx.decIndent();
  20813. ctx.println(stmt, "}");
  20814. };
  20815. _TsEmitterVisitor.prototype._visitClassMethod = function (method, ctx) {
  20816. if (method.hasModifier(StmtModifier.Private)) {
  20817. ctx.print(null, "private ");
  20818. }
  20819. ctx.print(null, method.name + "(");
  20820. this._visitParams(method.params, ctx);
  20821. ctx.print(null, ")");
  20822. this._printColonType(method.type, ctx, 'void');
  20823. ctx.println(null, " {");
  20824. ctx.incIndent();
  20825. this.visitAllStatements(method.body, ctx);
  20826. ctx.decIndent();
  20827. ctx.println(null, "}");
  20828. };
  20829. _TsEmitterVisitor.prototype.visitFunctionExpr = function (ast, ctx) {
  20830. if (ast.name) {
  20831. ctx.print(ast, 'function ');
  20832. ctx.print(ast, ast.name);
  20833. }
  20834. ctx.print(ast, "(");
  20835. this._visitParams(ast.params, ctx);
  20836. ctx.print(ast, ")");
  20837. this._printColonType(ast.type, ctx, 'void');
  20838. if (!ast.name) {
  20839. ctx.print(ast, " => ");
  20840. }
  20841. ctx.println(ast, '{');
  20842. ctx.incIndent();
  20843. this.visitAllStatements(ast.statements, ctx);
  20844. ctx.decIndent();
  20845. ctx.print(ast, "}");
  20846. return null;
  20847. };
  20848. _TsEmitterVisitor.prototype.visitDeclareFunctionStmt = function (stmt, ctx) {
  20849. if (stmt.hasModifier(StmtModifier.Exported)) {
  20850. ctx.print(stmt, "export ");
  20851. }
  20852. ctx.print(stmt, "function " + stmt.name + "(");
  20853. this._visitParams(stmt.params, ctx);
  20854. ctx.print(stmt, ")");
  20855. this._printColonType(stmt.type, ctx, 'void');
  20856. ctx.println(stmt, " {");
  20857. ctx.incIndent();
  20858. this.visitAllStatements(stmt.statements, ctx);
  20859. ctx.decIndent();
  20860. ctx.println(stmt, "}");
  20861. return null;
  20862. };
  20863. _TsEmitterVisitor.prototype.visitTryCatchStmt = function (stmt, ctx) {
  20864. ctx.println(stmt, "try {");
  20865. ctx.incIndent();
  20866. this.visitAllStatements(stmt.bodyStmts, ctx);
  20867. ctx.decIndent();
  20868. ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
  20869. ctx.incIndent();
  20870. var catchStmts = [CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack', null)).toDeclStmt(null, [
  20871. StmtModifier.Final
  20872. ])].concat(stmt.catchStmts);
  20873. this.visitAllStatements(catchStmts, ctx);
  20874. ctx.decIndent();
  20875. ctx.println(stmt, "}");
  20876. return null;
  20877. };
  20878. _TsEmitterVisitor.prototype.visitBuiltinType = function (type, ctx) {
  20879. var typeStr;
  20880. switch (type.name) {
  20881. case BuiltinTypeName.Bool:
  20882. typeStr = 'boolean';
  20883. break;
  20884. case BuiltinTypeName.Dynamic:
  20885. typeStr = 'any';
  20886. break;
  20887. case BuiltinTypeName.Function:
  20888. typeStr = 'Function';
  20889. break;
  20890. case BuiltinTypeName.Number:
  20891. typeStr = 'number';
  20892. break;
  20893. case BuiltinTypeName.Int:
  20894. typeStr = 'number';
  20895. break;
  20896. case BuiltinTypeName.String:
  20897. typeStr = 'string';
  20898. break;
  20899. case BuiltinTypeName.None:
  20900. typeStr = 'never';
  20901. break;
  20902. default:
  20903. throw new Error("Unsupported builtin type " + type.name);
  20904. }
  20905. ctx.print(null, typeStr);
  20906. return null;
  20907. };
  20908. _TsEmitterVisitor.prototype.visitExpressionType = function (ast, ctx) {
  20909. var _this = this;
  20910. ast.value.visitExpression(this, ctx);
  20911. if (ast.typeParams !== null) {
  20912. ctx.print(null, '<');
  20913. this.visitAllObjects(function (type) { return _this.visitType(type, ctx); }, ast.typeParams, ctx, ',');
  20914. ctx.print(null, '>');
  20915. }
  20916. return null;
  20917. };
  20918. _TsEmitterVisitor.prototype.visitArrayType = function (type, ctx) {
  20919. this.visitType(type.of, ctx);
  20920. ctx.print(null, "[]");
  20921. return null;
  20922. };
  20923. _TsEmitterVisitor.prototype.visitMapType = function (type, ctx) {
  20924. ctx.print(null, "{[key: string]:");
  20925. this.visitType(type.valueType, ctx);
  20926. ctx.print(null, "}");
  20927. return null;
  20928. };
  20929. _TsEmitterVisitor.prototype.getBuiltinMethodName = function (method) {
  20930. var name;
  20931. switch (method) {
  20932. case BuiltinMethod.ConcatArray:
  20933. name = 'concat';
  20934. break;
  20935. case BuiltinMethod.SubscribeObservable:
  20936. name = 'subscribe';
  20937. break;
  20938. case BuiltinMethod.Bind:
  20939. name = 'bind';
  20940. break;
  20941. default:
  20942. throw new Error("Unknown builtin method: " + method);
  20943. }
  20944. return name;
  20945. };
  20946. _TsEmitterVisitor.prototype._visitParams = function (params, ctx) {
  20947. var _this = this;
  20948. this.visitAllObjects(function (param) {
  20949. ctx.print(null, param.name);
  20950. _this._printColonType(param.type, ctx);
  20951. }, params, ctx, ',');
  20952. };
  20953. _TsEmitterVisitor.prototype._visitIdentifier = function (value, typeParams, ctx) {
  20954. var _this = this;
  20955. var name = value.name, moduleName = value.moduleName;
  20956. if (this.referenceFilter && this.referenceFilter(value)) {
  20957. ctx.print(null, '(null as any)');
  20958. return;
  20959. }
  20960. if (moduleName && (!this.importFilter || !this.importFilter(value))) {
  20961. var prefix = this.importsWithPrefixes.get(moduleName);
  20962. if (prefix == null) {
  20963. prefix = "i" + this.importsWithPrefixes.size;
  20964. this.importsWithPrefixes.set(moduleName, prefix);
  20965. }
  20966. ctx.print(null, prefix + ".");
  20967. }
  20968. ctx.print(null, name);
  20969. if (this.typeExpression > 0) {
  20970. // If we are in a type expression that refers to a generic type then supply
  20971. // the required type parameters. If there were not enough type parameters
  20972. // supplied, supply any as the type. Outside a type expression the reference
  20973. // should not supply type parameters and be treated as a simple value reference
  20974. // to the constructor function itself.
  20975. var suppliedParameters = typeParams || [];
  20976. if (suppliedParameters.length > 0) {
  20977. ctx.print(null, "<");
  20978. this.visitAllObjects(function (type) { return type.visitType(_this, ctx); }, typeParams, ctx, ',');
  20979. ctx.print(null, ">");
  20980. }
  20981. }
  20982. };
  20983. _TsEmitterVisitor.prototype._printColonType = function (type, ctx, defaultType) {
  20984. if (type !== INFERRED_TYPE) {
  20985. ctx.print(null, ':');
  20986. this.visitType(type, ctx, defaultType);
  20987. }
  20988. };
  20989. return _TsEmitterVisitor;
  20990. }(AbstractEmitterVisitor));
  20991. /**
  20992. * @license
  20993. * Copyright Google Inc. All Rights Reserved.
  20994. *
  20995. * Use of this source code is governed by an MIT-style license that can be
  20996. * found in the LICENSE file at https://angular.io/license
  20997. */
  20998. /**
  20999. * Resolve a `Type` for {@link Pipe}.
  21000. *
  21001. * This interface can be overridden by the application developer to create custom behavior.
  21002. *
  21003. * See {@link Compiler}
  21004. */
  21005. var PipeResolver = /** @class */ (function () {
  21006. function PipeResolver(_reflector) {
  21007. this._reflector = _reflector;
  21008. }
  21009. PipeResolver.prototype.isPipe = function (type) {
  21010. var typeMetadata = this._reflector.annotations(resolveForwardRef(type));
  21011. return typeMetadata && typeMetadata.some(createPipe.isTypeOf);
  21012. };
  21013. /**
  21014. * Return {@link Pipe} for a given `Type`.
  21015. */
  21016. PipeResolver.prototype.resolve = function (type, throwIfNotFound) {
  21017. if (throwIfNotFound === void 0) { throwIfNotFound = true; }
  21018. var metas = this._reflector.annotations(resolveForwardRef(type));
  21019. if (metas) {
  21020. var annotation = findLast(metas, createPipe.isTypeOf);
  21021. if (annotation) {
  21022. return annotation;
  21023. }
  21024. }
  21025. if (throwIfNotFound) {
  21026. throw new Error("No Pipe decorator found on " + stringify(type));
  21027. }
  21028. return null;
  21029. };
  21030. return PipeResolver;
  21031. }());
  21032. /**
  21033. * @license
  21034. * Copyright Google Inc. All Rights Reserved.
  21035. *
  21036. * Use of this source code is governed by an MIT-style license that can be
  21037. * found in the LICENSE file at https://angular.io/license
  21038. */
  21039. // =================================================================================================
  21040. // =================================================================================================
  21041. // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
  21042. // =================================================================================================
  21043. // =================================================================================================
  21044. //
  21045. // DO NOT EDIT THIS LIST OF SECURITY SENSITIVE PROPERTIES WITHOUT A SECURITY REVIEW!
  21046. // Reach out to mprobst for details.
  21047. //
  21048. // =================================================================================================
  21049. /** Map from tagName|propertyName SecurityContext. Properties applying to all tags use '*'. */
  21050. var _SECURITY_SCHEMA;
  21051. function SECURITY_SCHEMA() {
  21052. if (!_SECURITY_SCHEMA) {
  21053. _SECURITY_SCHEMA = {};
  21054. // Case is insignificant below, all element and attribute names are lower-cased for lookup.
  21055. registerContext(SecurityContext.HTML, [
  21056. 'iframe|srcdoc',
  21057. '*|innerHTML',
  21058. '*|outerHTML',
  21059. ]);
  21060. registerContext(SecurityContext.STYLE, ['*|style']);
  21061. // NB: no SCRIPT contexts here, they are never allowed due to the parser stripping them.
  21062. registerContext(SecurityContext.URL, [
  21063. '*|formAction', 'area|href', 'area|ping', 'audio|src', 'a|href',
  21064. 'a|ping', 'blockquote|cite', 'body|background', 'del|cite', 'form|action',
  21065. 'img|src', 'img|srcset', 'input|src', 'ins|cite', 'q|cite',
  21066. 'source|src', 'source|srcset', 'track|src', 'video|poster', 'video|src',
  21067. ]);
  21068. registerContext(SecurityContext.RESOURCE_URL, [
  21069. 'applet|code',
  21070. 'applet|codebase',
  21071. 'base|href',
  21072. 'embed|src',
  21073. 'frame|src',
  21074. 'head|profile',
  21075. 'html|manifest',
  21076. 'iframe|src',
  21077. 'link|href',
  21078. 'media|src',
  21079. 'object|codebase',
  21080. 'object|data',
  21081. 'script|src',
  21082. ]);
  21083. }
  21084. return _SECURITY_SCHEMA;
  21085. }
  21086. function registerContext(ctx, specs) {
  21087. var e_1, _a;
  21088. try {
  21089. for (var specs_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(specs), specs_1_1 = specs_1.next(); !specs_1_1.done; specs_1_1 = specs_1.next()) {
  21090. var spec = specs_1_1.value;
  21091. _SECURITY_SCHEMA[spec.toLowerCase()] = ctx;
  21092. }
  21093. }
  21094. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  21095. finally {
  21096. try {
  21097. if (specs_1_1 && !specs_1_1.done && (_a = specs_1.return)) _a.call(specs_1);
  21098. }
  21099. finally { if (e_1) throw e_1.error; }
  21100. }
  21101. }
  21102. /**
  21103. * @license
  21104. * Copyright Google Inc. All Rights Reserved.
  21105. *
  21106. * Use of this source code is governed by an MIT-style license that can be
  21107. * found in the LICENSE file at https://angular.io/license
  21108. */
  21109. var ElementSchemaRegistry = /** @class */ (function () {
  21110. function ElementSchemaRegistry() {
  21111. }
  21112. return ElementSchemaRegistry;
  21113. }());
  21114. /**
  21115. * @license
  21116. * Copyright Google Inc. All Rights Reserved.
  21117. *
  21118. * Use of this source code is governed by an MIT-style license that can be
  21119. * found in the LICENSE file at https://angular.io/license
  21120. */
  21121. var BOOLEAN = 'boolean';
  21122. var NUMBER = 'number';
  21123. var STRING = 'string';
  21124. var OBJECT = 'object';
  21125. /**
  21126. * This array represents the DOM schema. It encodes inheritance, properties, and events.
  21127. *
  21128. * ## Overview
  21129. *
  21130. * Each line represents one kind of element. The `element_inheritance` and properties are joined
  21131. * using `element_inheritance|properties` syntax.
  21132. *
  21133. * ## Element Inheritance
  21134. *
  21135. * The `element_inheritance` can be further subdivided as `element1,element2,...^parentElement`.
  21136. * Here the individual elements are separated by `,` (commas). Every element in the list
  21137. * has identical properties.
  21138. *
  21139. * An `element` may inherit additional properties from `parentElement` If no `^parentElement` is
  21140. * specified then `""` (blank) element is assumed.
  21141. *
  21142. * NOTE: The blank element inherits from root `[Element]` element, the super element of all
  21143. * elements.
  21144. *
  21145. * NOTE an element prefix such as `:svg:` has no special meaning to the schema.
  21146. *
  21147. * ## Properties
  21148. *
  21149. * Each element has a set of properties separated by `,` (commas). Each property can be prefixed
  21150. * by a special character designating its type:
  21151. *
  21152. * - (no prefix): property is a string.
  21153. * - `*`: property represents an event.
  21154. * - `!`: property is a boolean.
  21155. * - `#`: property is a number.
  21156. * - `%`: property is an object.
  21157. *
  21158. * ## Query
  21159. *
  21160. * The class creates an internal squas representation which allows to easily answer the query of
  21161. * if a given property exist on a given element.
  21162. *
  21163. * NOTE: We don't yet support querying for types or events.
  21164. * NOTE: This schema is auto extracted from `schema_extractor.ts` located in the test folder,
  21165. * see dom_element_schema_registry_spec.ts
  21166. */
  21167. // =================================================================================================
  21168. // =================================================================================================
  21169. // =========== S T O P - S T O P - S T O P - S T O P - S T O P - S T O P ===========
  21170. // =================================================================================================
  21171. // =================================================================================================
  21172. //
  21173. // DO NOT EDIT THIS DOM SCHEMA WITHOUT A SECURITY REVIEW!
  21174. //
  21175. // Newly added properties must be security reviewed and assigned an appropriate SecurityContext in
  21176. // dom_security_schema.ts. Reach out to mprobst & rjamet for details.
  21177. //
  21178. // =================================================================================================
  21179. var SCHEMA = [
  21180. '[Element]|textContent,%classList,className,id,innerHTML,*beforecopy,*beforecut,*beforepaste,*copy,*cut,*paste,*search,*selectstart,*webkitfullscreenchange,*webkitfullscreenerror,*wheel,outerHTML,#scrollLeft,#scrollTop,slot' +
  21181. /* added manually to avoid breaking changes */
  21182. ',*message,*mozfullscreenchange,*mozfullscreenerror,*mozpointerlockchange,*mozpointerlockerror,*webglcontextcreationerror,*webglcontextlost,*webglcontextrestored',
  21183. '[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',
  21184. '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',
  21185. 'media^[HTMLElement]|!autoplay,!controls,%controlsList,%crossOrigin,#currentTime,!defaultMuted,#defaultPlaybackRate,!disableRemotePlayback,!loop,!muted,*encrypted,*waitingforkey,#playbackRate,preload,src,%srcObject,#volume',
  21186. ':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',
  21187. ':svg:graphics^:svg:|',
  21188. ':svg:animation^:svg:|*begin,*end,*repeat',
  21189. ':svg:geometry^:svg:|',
  21190. ':svg:componentTransferFunction^:svg:|',
  21191. ':svg:gradient^:svg:|',
  21192. ':svg:textContent^:svg:graphics|',
  21193. ':svg:textPositioning^:svg:textContent|',
  21194. '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',
  21195. 'area^[HTMLElement]|alt,coords,download,hash,host,hostname,href,!noHref,password,pathname,ping,port,protocol,referrerPolicy,rel,search,shape,target,username',
  21196. 'audio^media|',
  21197. 'br^[HTMLElement]|clear',
  21198. 'base^[HTMLElement]|href,target',
  21199. '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',
  21200. 'button^[HTMLElement]|!autofocus,!disabled,formAction,formEnctype,formMethod,!formNoValidate,formTarget,name,type,value',
  21201. 'canvas^[HTMLElement]|#height,#width',
  21202. 'content^[HTMLElement]|select',
  21203. 'dl^[HTMLElement]|!compact',
  21204. 'datalist^[HTMLElement]|',
  21205. 'details^[HTMLElement]|!open',
  21206. 'dialog^[HTMLElement]|!open,returnValue',
  21207. 'dir^[HTMLElement]|!compact',
  21208. 'div^[HTMLElement]|align',
  21209. 'embed^[HTMLElement]|align,height,name,src,type,width',
  21210. 'fieldset^[HTMLElement]|!disabled,name',
  21211. 'font^[HTMLElement]|color,face,size',
  21212. 'form^[HTMLElement]|acceptCharset,action,autocomplete,encoding,enctype,method,name,!noValidate,target',
  21213. 'frame^[HTMLElement]|frameBorder,longDesc,marginHeight,marginWidth,name,!noResize,scrolling,src',
  21214. 'frameset^[HTMLElement]|cols,*beforeunload,*blur,*error,*focus,*hashchange,*languagechange,*load,*message,*offline,*online,*pagehide,*pageshow,*popstate,*rejectionhandled,*resize,*scroll,*storage,*unhandledrejection,*unload,rows',
  21215. 'hr^[HTMLElement]|align,color,!noShade,size,width',
  21216. 'head^[HTMLElement]|',
  21217. 'h1,h2,h3,h4,h5,h6^[HTMLElement]|align',
  21218. 'html^[HTMLElement]|version',
  21219. 'iframe^[HTMLElement]|align,!allowFullscreen,frameBorder,height,longDesc,marginHeight,marginWidth,name,referrerPolicy,%sandbox,scrolling,src,srcdoc,width',
  21220. 'img^[HTMLElement]|align,alt,border,%crossOrigin,#height,#hspace,!isMap,longDesc,lowsrc,name,referrerPolicy,sizes,src,srcset,useMap,#vspace,#width',
  21221. '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',
  21222. 'li^[HTMLElement]|type,#value',
  21223. 'label^[HTMLElement]|htmlFor',
  21224. 'legend^[HTMLElement]|align',
  21225. 'link^[HTMLElement]|as,charset,%crossOrigin,!disabled,href,hreflang,integrity,media,referrerPolicy,rel,%relList,rev,%sizes,target,type',
  21226. 'map^[HTMLElement]|name',
  21227. 'marquee^[HTMLElement]|behavior,bgColor,direction,height,#hspace,#loop,#scrollAmount,#scrollDelay,!trueSpeed,#vspace,width',
  21228. 'menu^[HTMLElement]|!compact',
  21229. 'meta^[HTMLElement]|content,httpEquiv,name,scheme',
  21230. 'meter^[HTMLElement]|#high,#low,#max,#min,#optimum,#value',
  21231. 'ins,del^[HTMLElement]|cite,dateTime',
  21232. 'ol^[HTMLElement]|!compact,!reversed,#start,type',
  21233. 'object^[HTMLElement]|align,archive,border,code,codeBase,codeType,data,!declare,height,#hspace,name,standby,type,useMap,#vspace,width',
  21234. 'optgroup^[HTMLElement]|!disabled,label',
  21235. 'option^[HTMLElement]|!defaultSelected,!disabled,label,!selected,text,value',
  21236. 'output^[HTMLElement]|defaultValue,%htmlFor,name,value',
  21237. 'p^[HTMLElement]|align',
  21238. 'param^[HTMLElement]|name,type,value,valueType',
  21239. 'picture^[HTMLElement]|',
  21240. 'pre^[HTMLElement]|#width',
  21241. 'progress^[HTMLElement]|#max,#value',
  21242. 'q,blockquote,cite^[HTMLElement]|',
  21243. 'script^[HTMLElement]|!async,charset,%crossOrigin,!defer,event,htmlFor,integrity,src,text,type',
  21244. 'select^[HTMLElement]|!autofocus,!disabled,#length,!multiple,name,!required,#selectedIndex,#size,value',
  21245. 'shadow^[HTMLElement]|',
  21246. 'slot^[HTMLElement]|name',
  21247. 'source^[HTMLElement]|media,sizes,src,srcset,type',
  21248. 'span^[HTMLElement]|',
  21249. 'style^[HTMLElement]|!disabled,media,type',
  21250. 'caption^[HTMLElement]|align',
  21251. 'th,td^[HTMLElement]|abbr,align,axis,bgColor,ch,chOff,#colSpan,headers,height,!noWrap,#rowSpan,scope,vAlign,width',
  21252. 'col,colgroup^[HTMLElement]|align,ch,chOff,#span,vAlign,width',
  21253. 'table^[HTMLElement]|align,bgColor,border,%caption,cellPadding,cellSpacing,frame,rules,summary,%tFoot,%tHead,width',
  21254. 'tr^[HTMLElement]|align,bgColor,ch,chOff,vAlign',
  21255. 'tfoot,thead,tbody^[HTMLElement]|align,ch,chOff,vAlign',
  21256. 'template^[HTMLElement]|',
  21257. 'textarea^[HTMLElement]|autocapitalize,!autofocus,#cols,defaultValue,dirName,!disabled,#maxLength,#minLength,name,placeholder,!readOnly,!required,#rows,selectionDirection,#selectionEnd,#selectionStart,value,wrap',
  21258. 'title^[HTMLElement]|text',
  21259. 'track^[HTMLElement]|!default,kind,label,src,srclang',
  21260. 'ul^[HTMLElement]|!compact,type',
  21261. 'unknown^[HTMLElement]|',
  21262. 'video^media|#height,poster,#width',
  21263. ':svg:a^:svg:graphics|',
  21264. ':svg:animate^:svg:animation|',
  21265. ':svg:animateMotion^:svg:animation|',
  21266. ':svg:animateTransform^:svg:animation|',
  21267. ':svg:circle^:svg:geometry|',
  21268. ':svg:clipPath^:svg:graphics|',
  21269. ':svg:defs^:svg:graphics|',
  21270. ':svg:desc^:svg:|',
  21271. ':svg:discard^:svg:|',
  21272. ':svg:ellipse^:svg:geometry|',
  21273. ':svg:feBlend^:svg:|',
  21274. ':svg:feColorMatrix^:svg:|',
  21275. ':svg:feComponentTransfer^:svg:|',
  21276. ':svg:feComposite^:svg:|',
  21277. ':svg:feConvolveMatrix^:svg:|',
  21278. ':svg:feDiffuseLighting^:svg:|',
  21279. ':svg:feDisplacementMap^:svg:|',
  21280. ':svg:feDistantLight^:svg:|',
  21281. ':svg:feDropShadow^:svg:|',
  21282. ':svg:feFlood^:svg:|',
  21283. ':svg:feFuncA^:svg:componentTransferFunction|',
  21284. ':svg:feFuncB^:svg:componentTransferFunction|',
  21285. ':svg:feFuncG^:svg:componentTransferFunction|',
  21286. ':svg:feFuncR^:svg:componentTransferFunction|',
  21287. ':svg:feGaussianBlur^:svg:|',
  21288. ':svg:feImage^:svg:|',
  21289. ':svg:feMerge^:svg:|',
  21290. ':svg:feMergeNode^:svg:|',
  21291. ':svg:feMorphology^:svg:|',
  21292. ':svg:feOffset^:svg:|',
  21293. ':svg:fePointLight^:svg:|',
  21294. ':svg:feSpecularLighting^:svg:|',
  21295. ':svg:feSpotLight^:svg:|',
  21296. ':svg:feTile^:svg:|',
  21297. ':svg:feTurbulence^:svg:|',
  21298. ':svg:filter^:svg:|',
  21299. ':svg:foreignObject^:svg:graphics|',
  21300. ':svg:g^:svg:graphics|',
  21301. ':svg:image^:svg:graphics|',
  21302. ':svg:line^:svg:geometry|',
  21303. ':svg:linearGradient^:svg:gradient|',
  21304. ':svg:mpath^:svg:|',
  21305. ':svg:marker^:svg:|',
  21306. ':svg:mask^:svg:|',
  21307. ':svg:metadata^:svg:|',
  21308. ':svg:path^:svg:geometry|',
  21309. ':svg:pattern^:svg:|',
  21310. ':svg:polygon^:svg:geometry|',
  21311. ':svg:polyline^:svg:geometry|',
  21312. ':svg:radialGradient^:svg:gradient|',
  21313. ':svg:rect^:svg:geometry|',
  21314. ':svg:svg^:svg:graphics|#currentScale,#zoomAndPan',
  21315. ':svg:script^:svg:|type',
  21316. ':svg:set^:svg:animation|',
  21317. ':svg:stop^:svg:|',
  21318. ':svg:style^:svg:|!disabled,media,title,type',
  21319. ':svg:switch^:svg:graphics|',
  21320. ':svg:symbol^:svg:|',
  21321. ':svg:tspan^:svg:textPositioning|',
  21322. ':svg:text^:svg:textPositioning|',
  21323. ':svg:textPath^:svg:textContent|',
  21324. ':svg:title^:svg:|',
  21325. ':svg:use^:svg:graphics|',
  21326. ':svg:view^:svg:|#zoomAndPan',
  21327. 'data^[HTMLElement]|value',
  21328. 'keygen^[HTMLElement]|!autofocus,challenge,!disabled,form,keytype,name',
  21329. 'menuitem^[HTMLElement]|type,label,icon,!disabled,!checked,radiogroup,!default',
  21330. 'summary^[HTMLElement]|',
  21331. 'time^[HTMLElement]|dateTime',
  21332. ':svg:cursor^:svg:|',
  21333. ];
  21334. var _ATTR_TO_PROP = {
  21335. 'class': 'className',
  21336. 'for': 'htmlFor',
  21337. 'formaction': 'formAction',
  21338. 'innerHtml': 'innerHTML',
  21339. 'readonly': 'readOnly',
  21340. 'tabindex': 'tabIndex',
  21341. };
  21342. var DomElementSchemaRegistry = /** @class */ (function (_super) {
  21343. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DomElementSchemaRegistry, _super);
  21344. function DomElementSchemaRegistry() {
  21345. var _this = _super.call(this) || this;
  21346. _this._schema = {};
  21347. SCHEMA.forEach(function (encodedType) {
  21348. var type = {};
  21349. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(encodedType.split('|'), 2), strType = _a[0], strProperties = _a[1];
  21350. var properties = strProperties.split(',');
  21351. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(strType.split('^'), 2), typeNames = _b[0], superName = _b[1];
  21352. typeNames.split(',').forEach(function (tag) { return _this._schema[tag.toLowerCase()] = type; });
  21353. var superType = superName && _this._schema[superName.toLowerCase()];
  21354. if (superType) {
  21355. Object.keys(superType).forEach(function (prop) { type[prop] = superType[prop]; });
  21356. }
  21357. properties.forEach(function (property) {
  21358. if (property.length > 0) {
  21359. switch (property[0]) {
  21360. case '*':
  21361. // We don't yet support events.
  21362. // If ever allowing to bind to events, GO THROUGH A SECURITY REVIEW, allowing events
  21363. // will
  21364. // almost certainly introduce bad XSS vulnerabilities.
  21365. // type[property.substring(1)] = EVENT;
  21366. break;
  21367. case '!':
  21368. type[property.substring(1)] = BOOLEAN;
  21369. break;
  21370. case '#':
  21371. type[property.substring(1)] = NUMBER;
  21372. break;
  21373. case '%':
  21374. type[property.substring(1)] = OBJECT;
  21375. break;
  21376. default:
  21377. type[property] = STRING;
  21378. }
  21379. }
  21380. });
  21381. });
  21382. return _this;
  21383. }
  21384. DomElementSchemaRegistry.prototype.hasProperty = function (tagName, propName, schemaMetas) {
  21385. if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
  21386. return true;
  21387. }
  21388. if (tagName.indexOf('-') > -1) {
  21389. if (isNgContainer(tagName) || isNgContent(tagName)) {
  21390. return false;
  21391. }
  21392. if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
  21393. // Can't tell now as we don't know which properties a custom element will get
  21394. // once it is instantiated
  21395. return true;
  21396. }
  21397. }
  21398. var elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown'];
  21399. return !!elementProperties[propName];
  21400. };
  21401. DomElementSchemaRegistry.prototype.hasElement = function (tagName, schemaMetas) {
  21402. if (schemaMetas.some(function (schema) { return schema.name === NO_ERRORS_SCHEMA.name; })) {
  21403. return true;
  21404. }
  21405. if (tagName.indexOf('-') > -1) {
  21406. if (isNgContainer(tagName) || isNgContent(tagName)) {
  21407. return true;
  21408. }
  21409. if (schemaMetas.some(function (schema) { return schema.name === CUSTOM_ELEMENTS_SCHEMA.name; })) {
  21410. // Allow any custom elements
  21411. return true;
  21412. }
  21413. }
  21414. return !!this._schema[tagName.toLowerCase()];
  21415. };
  21416. /**
  21417. * securityContext returns the security context for the given property on the given DOM tag.
  21418. *
  21419. * Tag and property name are statically known and cannot change at runtime, i.e. it is not
  21420. * possible to bind a value into a changing attribute or tag name.
  21421. *
  21422. * The filtering is white list based. All attributes in the schema above are assumed to have the
  21423. * 'NONE' security context, i.e. that they are safe inert string values. Only specific well known
  21424. * attack vectors are assigned their appropriate context.
  21425. */
  21426. DomElementSchemaRegistry.prototype.securityContext = function (tagName, propName, isAttribute) {
  21427. if (isAttribute) {
  21428. // NB: For security purposes, use the mapped property name, not the attribute name.
  21429. propName = this.getMappedPropName(propName);
  21430. }
  21431. // Make sure comparisons are case insensitive, so that case differences between attribute and
  21432. // property names do not have a security impact.
  21433. tagName = tagName.toLowerCase();
  21434. propName = propName.toLowerCase();
  21435. var ctx = SECURITY_SCHEMA()[tagName + '|' + propName];
  21436. if (ctx) {
  21437. return ctx;
  21438. }
  21439. ctx = SECURITY_SCHEMA()['*|' + propName];
  21440. return ctx ? ctx : SecurityContext.NONE;
  21441. };
  21442. DomElementSchemaRegistry.prototype.getMappedPropName = function (propName) { return _ATTR_TO_PROP[propName] || propName; };
  21443. DomElementSchemaRegistry.prototype.getDefaultComponentElementName = function () { return 'ng-component'; };
  21444. DomElementSchemaRegistry.prototype.validateProperty = function (name) {
  21445. if (name.toLowerCase().startsWith('on')) {
  21446. var msg = "Binding to event property '" + name + "' is disallowed for security reasons, " +
  21447. ("please use (" + name.slice(2) + ")=...") +
  21448. ("\nIf '" + name + "' is a directive input, make sure the directive is imported by the") +
  21449. " current module.";
  21450. return { error: true, msg: msg };
  21451. }
  21452. else {
  21453. return { error: false };
  21454. }
  21455. };
  21456. DomElementSchemaRegistry.prototype.validateAttribute = function (name) {
  21457. if (name.toLowerCase().startsWith('on')) {
  21458. var msg = "Binding to event attribute '" + name + "' is disallowed for security reasons, " +
  21459. ("please use (" + name.slice(2) + ")=...");
  21460. return { error: true, msg: msg };
  21461. }
  21462. else {
  21463. return { error: false };
  21464. }
  21465. };
  21466. DomElementSchemaRegistry.prototype.allKnownElementNames = function () { return Object.keys(this._schema); };
  21467. DomElementSchemaRegistry.prototype.normalizeAnimationStyleProperty = function (propName) {
  21468. return dashCaseToCamelCase(propName);
  21469. };
  21470. DomElementSchemaRegistry.prototype.normalizeAnimationStyleValue = function (camelCaseProp, userProvidedProp, val) {
  21471. var unit = '';
  21472. var strVal = val.toString().trim();
  21473. var errorMsg = null;
  21474. if (_isPixelDimensionStyle(camelCaseProp) && val !== 0 && val !== '0') {
  21475. if (typeof val === 'number') {
  21476. unit = 'px';
  21477. }
  21478. else {
  21479. var valAndSuffixMatch = val.match(/^[+-]?[\d\.]+([a-z]*)$/);
  21480. if (valAndSuffixMatch && valAndSuffixMatch[1].length == 0) {
  21481. errorMsg = "Please provide a CSS unit value for " + userProvidedProp + ":" + val;
  21482. }
  21483. }
  21484. }
  21485. return { error: errorMsg, value: strVal + unit };
  21486. };
  21487. return DomElementSchemaRegistry;
  21488. }(ElementSchemaRegistry));
  21489. function _isPixelDimensionStyle(prop) {
  21490. switch (prop) {
  21491. case 'width':
  21492. case 'height':
  21493. case 'minWidth':
  21494. case 'minHeight':
  21495. case 'maxWidth':
  21496. case 'maxHeight':
  21497. case 'left':
  21498. case 'top':
  21499. case 'bottom':
  21500. case 'right':
  21501. case 'fontSize':
  21502. case 'outlineWidth':
  21503. case 'outlineOffset':
  21504. case 'paddingTop':
  21505. case 'paddingLeft':
  21506. case 'paddingBottom':
  21507. case 'paddingRight':
  21508. case 'marginTop':
  21509. case 'marginLeft':
  21510. case 'marginBottom':
  21511. case 'marginRight':
  21512. case 'borderRadius':
  21513. case 'borderWidth':
  21514. case 'borderTopWidth':
  21515. case 'borderLeftWidth':
  21516. case 'borderRightWidth':
  21517. case 'borderBottomWidth':
  21518. case 'textIndent':
  21519. return true;
  21520. default:
  21521. return false;
  21522. }
  21523. }
  21524. /**
  21525. * @license
  21526. * Copyright Google Inc. All Rights Reserved.
  21527. *
  21528. * Use of this source code is governed by an MIT-style license that can be
  21529. * found in the LICENSE file at https://angular.io/license
  21530. */
  21531. /**
  21532. * This file is a port of shadowCSS from webcomponents.js to TypeScript.
  21533. *
  21534. * Please make sure to keep to edits in sync with the source file.
  21535. *
  21536. * Source:
  21537. * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
  21538. *
  21539. * The original file level comment is reproduced below
  21540. */
  21541. /*
  21542. This is a limited shim for ShadowDOM css styling.
  21543. https://dvcs.w3.org/hg/webcomponents/raw-file/tip/spec/shadow/index.html#styles
  21544. The intention here is to support only the styling features which can be
  21545. relatively simply implemented. The goal is to allow users to avoid the
  21546. most obvious pitfalls and do so without compromising performance significantly.
  21547. For ShadowDOM styling that's not covered here, a set of best practices
  21548. can be provided that should allow users to accomplish more complex styling.
  21549. The following is a list of specific ShadowDOM styling features and a brief
  21550. discussion of the approach used to shim.
  21551. Shimmed features:
  21552. * :host, :host-context: ShadowDOM allows styling of the shadowRoot's host
  21553. element using the :host rule. To shim this feature, the :host styles are
  21554. reformatted and prefixed with a given scope name and promoted to a
  21555. document level stylesheet.
  21556. For example, given a scope name of .foo, a rule like this:
  21557. :host {
  21558. background: red;
  21559. }
  21560. }
  21561. becomes:
  21562. .foo {
  21563. background: red;
  21564. }
  21565. * encapsulation: Styles defined within ShadowDOM, apply only to
  21566. dom inside the ShadowDOM. Polymer uses one of two techniques to implement
  21567. this feature.
  21568. By default, rules are prefixed with the host element tag name
  21569. as a descendant selector. This ensures styling does not leak out of the 'top'
  21570. of the element's ShadowDOM. For example,
  21571. div {
  21572. font-weight: bold;
  21573. }
  21574. becomes:
  21575. x-foo div {
  21576. font-weight: bold;
  21577. }
  21578. becomes:
  21579. Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
  21580. selectors are scoped by adding an attribute selector suffix to each
  21581. simple selector that contains the host element tag name. Each element
  21582. in the element's ShadowDOM template is also given the scope attribute.
  21583. Thus, these rules match only elements that have the scope attribute.
  21584. For example, given a scope name of x-foo, a rule like this:
  21585. div {
  21586. font-weight: bold;
  21587. }
  21588. becomes:
  21589. div[x-foo] {
  21590. font-weight: bold;
  21591. }
  21592. Note that elements that are dynamically added to a scope must have the scope
  21593. selector added to them manually.
  21594. * upper/lower bound encapsulation: Styles which are defined outside a
  21595. shadowRoot should not cross the ShadowDOM boundary and should not apply
  21596. inside a shadowRoot.
  21597. This styling behavior is not emulated. Some possible ways to do this that
  21598. were rejected due to complexity and/or performance concerns include: (1) reset
  21599. every possible property for every possible selector for a given scope name;
  21600. (2) re-implement css in javascript.
  21601. As an alternative, users should make sure to use selectors
  21602. specific to the scope in which they are working.
  21603. * ::distributed: This behavior is not emulated. It's often not necessary
  21604. to style the contents of a specific insertion point and instead, descendants
  21605. of the host element can be styled selectively. Users can also create an
  21606. extra node around an insertion point and style that node's contents
  21607. via descendent selectors. For example, with a shadowRoot like this:
  21608. <style>
  21609. ::content(div) {
  21610. background: red;
  21611. }
  21612. </style>
  21613. <content></content>
  21614. could become:
  21615. <style>
  21616. / *@polyfill .content-container div * /
  21617. ::content(div) {
  21618. background: red;
  21619. }
  21620. </style>
  21621. <div class="content-container">
  21622. <content></content>
  21623. </div>
  21624. Note the use of @polyfill in the comment above a ShadowDOM specific style
  21625. declaration. This is a directive to the styling shim to use the selector
  21626. in comments in lieu of the next selector when running under polyfill.
  21627. */
  21628. var ShadowCss = /** @class */ (function () {
  21629. function ShadowCss() {
  21630. this.strictStyling = true;
  21631. }
  21632. /*
  21633. * Shim some cssText with the given selector. Returns cssText that can
  21634. * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
  21635. *
  21636. * When strictStyling is true:
  21637. * - selector is the attribute added to all elements inside the host,
  21638. * - hostSelector is the attribute added to the host itself.
  21639. */
  21640. ShadowCss.prototype.shimCssText = function (cssText, selector, hostSelector) {
  21641. if (hostSelector === void 0) { hostSelector = ''; }
  21642. var commentsWithHash = extractCommentsWithHash(cssText);
  21643. cssText = stripComments(cssText);
  21644. cssText = this._insertDirectives(cssText);
  21645. var scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
  21646. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([scopedCssText], commentsWithHash).join('\n');
  21647. };
  21648. ShadowCss.prototype._insertDirectives = function (cssText) {
  21649. cssText = this._insertPolyfillDirectivesInCssText(cssText);
  21650. return this._insertPolyfillRulesInCssText(cssText);
  21651. };
  21652. /*
  21653. * Process styles to convert native ShadowDOM rules that will trip
  21654. * up the css parser; we rely on decorating the stylesheet with inert rules.
  21655. *
  21656. * For example, we convert this rule:
  21657. *
  21658. * polyfill-next-selector { content: ':host menu-item'; }
  21659. * ::content menu-item {
  21660. *
  21661. * to this:
  21662. *
  21663. * scopeName menu-item {
  21664. *
  21665. **/
  21666. ShadowCss.prototype._insertPolyfillDirectivesInCssText = function (cssText) {
  21667. // Difference with webcomponents.js: does not handle comments
  21668. return cssText.replace(_cssContentNextSelectorRe, function () {
  21669. var m = [];
  21670. for (var _i = 0; _i < arguments.length; _i++) {
  21671. m[_i] = arguments[_i];
  21672. }
  21673. return m[2] + '{';
  21674. });
  21675. };
  21676. /*
  21677. * Process styles to add rules which will only apply under the polyfill
  21678. *
  21679. * For example, we convert this rule:
  21680. *
  21681. * polyfill-rule {
  21682. * content: ':host menu-item';
  21683. * ...
  21684. * }
  21685. *
  21686. * to this:
  21687. *
  21688. * scopeName menu-item {...}
  21689. *
  21690. **/
  21691. ShadowCss.prototype._insertPolyfillRulesInCssText = function (cssText) {
  21692. // Difference with webcomponents.js: does not handle comments
  21693. return cssText.replace(_cssContentRuleRe, function () {
  21694. var m = [];
  21695. for (var _i = 0; _i < arguments.length; _i++) {
  21696. m[_i] = arguments[_i];
  21697. }
  21698. var rule = m[0].replace(m[1], '').replace(m[2], '');
  21699. return m[4] + rule;
  21700. });
  21701. };
  21702. /* Ensure styles are scoped. Pseudo-scoping takes a rule like:
  21703. *
  21704. * .foo {... }
  21705. *
  21706. * and converts this to
  21707. *
  21708. * scopeName .foo { ... }
  21709. */
  21710. ShadowCss.prototype._scopeCssText = function (cssText, scopeSelector, hostSelector) {
  21711. var unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
  21712. // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
  21713. cssText = this._insertPolyfillHostInCssText(cssText);
  21714. cssText = this._convertColonHost(cssText);
  21715. cssText = this._convertColonHostContext(cssText);
  21716. cssText = this._convertShadowDOMSelectors(cssText);
  21717. if (scopeSelector) {
  21718. cssText = this._scopeSelectors(cssText, scopeSelector, hostSelector);
  21719. }
  21720. cssText = cssText + '\n' + unscopedRules;
  21721. return cssText.trim();
  21722. };
  21723. /*
  21724. * Process styles to add rules which will only apply under the polyfill
  21725. * and do not process via CSSOM. (CSSOM is destructive to rules on rare
  21726. * occasions, e.g. -webkit-calc on Safari.)
  21727. * For example, we convert this rule:
  21728. *
  21729. * @polyfill-unscoped-rule {
  21730. * content: 'menu-item';
  21731. * ... }
  21732. *
  21733. * to this:
  21734. *
  21735. * menu-item {...}
  21736. *
  21737. **/
  21738. ShadowCss.prototype._extractUnscopedRulesFromCssText = function (cssText) {
  21739. // Difference with webcomponents.js: does not handle comments
  21740. var r = '';
  21741. var m;
  21742. _cssContentUnscopedRuleRe.lastIndex = 0;
  21743. while ((m = _cssContentUnscopedRuleRe.exec(cssText)) !== null) {
  21744. var rule = m[0].replace(m[2], '').replace(m[1], m[4]);
  21745. r += rule + '\n\n';
  21746. }
  21747. return r;
  21748. };
  21749. /*
  21750. * convert a rule like :host(.foo) > .bar { }
  21751. *
  21752. * to
  21753. *
  21754. * .foo<scopeName> > .bar
  21755. */
  21756. ShadowCss.prototype._convertColonHost = function (cssText) {
  21757. return this._convertColonRule(cssText, _cssColonHostRe, this._colonHostPartReplacer);
  21758. };
  21759. /*
  21760. * convert a rule like :host-context(.foo) > .bar { }
  21761. *
  21762. * to
  21763. *
  21764. * .foo<scopeName> > .bar, .foo scopeName > .bar { }
  21765. *
  21766. * and
  21767. *
  21768. * :host-context(.foo:host) .bar { ... }
  21769. *
  21770. * to
  21771. *
  21772. * .foo<scopeName> .bar { ... }
  21773. */
  21774. ShadowCss.prototype._convertColonHostContext = function (cssText) {
  21775. return this._convertColonRule(cssText, _cssColonHostContextRe, this._colonHostContextPartReplacer);
  21776. };
  21777. ShadowCss.prototype._convertColonRule = function (cssText, regExp, partReplacer) {
  21778. // m[1] = :host(-context), m[2] = contents of (), m[3] rest of rule
  21779. return cssText.replace(regExp, function () {
  21780. var m = [];
  21781. for (var _i = 0; _i < arguments.length; _i++) {
  21782. m[_i] = arguments[_i];
  21783. }
  21784. if (m[2]) {
  21785. var parts = m[2].split(',');
  21786. var r = [];
  21787. for (var i = 0; i < parts.length; i++) {
  21788. var p = parts[i].trim();
  21789. if (!p)
  21790. break;
  21791. r.push(partReplacer(_polyfillHostNoCombinator, p, m[3]));
  21792. }
  21793. return r.join(',');
  21794. }
  21795. else {
  21796. return _polyfillHostNoCombinator + m[3];
  21797. }
  21798. });
  21799. };
  21800. ShadowCss.prototype._colonHostContextPartReplacer = function (host, part, suffix) {
  21801. if (part.indexOf(_polyfillHost) > -1) {
  21802. return this._colonHostPartReplacer(host, part, suffix);
  21803. }
  21804. else {
  21805. return host + part + suffix + ', ' + part + ' ' + host + suffix;
  21806. }
  21807. };
  21808. ShadowCss.prototype._colonHostPartReplacer = function (host, part, suffix) {
  21809. return host + part.replace(_polyfillHost, '') + suffix;
  21810. };
  21811. /*
  21812. * Convert combinators like ::shadow and pseudo-elements like ::content
  21813. * by replacing with space.
  21814. */
  21815. ShadowCss.prototype._convertShadowDOMSelectors = function (cssText) {
  21816. return _shadowDOMSelectorsRe.reduce(function (result, pattern) { return result.replace(pattern, ' '); }, cssText);
  21817. };
  21818. // change a selector like 'div' to 'name div'
  21819. ShadowCss.prototype._scopeSelectors = function (cssText, scopeSelector, hostSelector) {
  21820. var _this = this;
  21821. return processRules(cssText, function (rule) {
  21822. var selector = rule.selector;
  21823. var content = rule.content;
  21824. if (rule.selector[0] != '@') {
  21825. selector =
  21826. _this._scopeSelector(rule.selector, scopeSelector, hostSelector, _this.strictStyling);
  21827. }
  21828. else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
  21829. rule.selector.startsWith('@page') || rule.selector.startsWith('@document')) {
  21830. content = _this._scopeSelectors(rule.content, scopeSelector, hostSelector);
  21831. }
  21832. return new CssRule(selector, content);
  21833. });
  21834. };
  21835. ShadowCss.prototype._scopeSelector = function (selector, scopeSelector, hostSelector, strict) {
  21836. var _this = this;
  21837. return selector.split(',')
  21838. .map(function (part) { return part.trim().split(_shadowDeepSelectors); })
  21839. .map(function (deepParts) {
  21840. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(deepParts), shallowPart = _a[0], otherParts = _a.slice(1);
  21841. var applyScope = function (shallowPart) {
  21842. if (_this._selectorNeedsScoping(shallowPart, scopeSelector)) {
  21843. return strict ?
  21844. _this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
  21845. _this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
  21846. }
  21847. else {
  21848. return shallowPart;
  21849. }
  21850. };
  21851. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([applyScope(shallowPart)], otherParts).join(' ');
  21852. })
  21853. .join(', ');
  21854. };
  21855. ShadowCss.prototype._selectorNeedsScoping = function (selector, scopeSelector) {
  21856. var re = this._makeScopeMatcher(scopeSelector);
  21857. return !re.test(selector);
  21858. };
  21859. ShadowCss.prototype._makeScopeMatcher = function (scopeSelector) {
  21860. var lre = /\[/g;
  21861. var rre = /\]/g;
  21862. scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
  21863. return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
  21864. };
  21865. ShadowCss.prototype._applySelectorScope = function (selector, scopeSelector, hostSelector) {
  21866. // Difference from webcomponents.js: scopeSelector could not be an array
  21867. return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
  21868. };
  21869. // scope via name and [is=name]
  21870. ShadowCss.prototype._applySimpleSelectorScope = function (selector, scopeSelector, hostSelector) {
  21871. // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
  21872. _polyfillHostRe.lastIndex = 0;
  21873. if (_polyfillHostRe.test(selector)) {
  21874. var replaceBy_1 = this.strictStyling ? "[" + hostSelector + "]" : scopeSelector;
  21875. return selector
  21876. .replace(_polyfillHostNoCombinatorRe, function (hnc, selector) {
  21877. return selector.replace(/([^:]*)(:*)(.*)/, function (_, before, colon, after) {
  21878. return before + replaceBy_1 + colon + after;
  21879. });
  21880. })
  21881. .replace(_polyfillHostRe, replaceBy_1 + ' ');
  21882. }
  21883. return scopeSelector + ' ' + selector;
  21884. };
  21885. // return a selector with [name] suffix on each simple selector
  21886. // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
  21887. ShadowCss.prototype._applyStrictSelectorScope = function (selector, scopeSelector, hostSelector) {
  21888. var _this = this;
  21889. var isRe = /\[is=([^\]]*)\]/g;
  21890. scopeSelector = scopeSelector.replace(isRe, function (_) {
  21891. var parts = [];
  21892. for (var _i = 1; _i < arguments.length; _i++) {
  21893. parts[_i - 1] = arguments[_i];
  21894. }
  21895. return parts[0];
  21896. });
  21897. var attrName = '[' + scopeSelector + ']';
  21898. var _scopeSelectorPart = function (p) {
  21899. var scopedP = p.trim();
  21900. if (!scopedP) {
  21901. return '';
  21902. }
  21903. if (p.indexOf(_polyfillHostNoCombinator) > -1) {
  21904. scopedP = _this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
  21905. }
  21906. else {
  21907. // remove :host since it should be unnecessary
  21908. var t = p.replace(_polyfillHostRe, '');
  21909. if (t.length > 0) {
  21910. var matches = t.match(/([^:]*)(:*)(.*)/);
  21911. if (matches) {
  21912. scopedP = matches[1] + attrName + matches[2] + matches[3];
  21913. }
  21914. }
  21915. }
  21916. return scopedP;
  21917. };
  21918. var safeContent = new SafeSelector(selector);
  21919. selector = safeContent.content();
  21920. var scopedSelector = '';
  21921. var startIndex = 0;
  21922. var res;
  21923. var sep = /( |>|\+|~(?!=))\s*/g;
  21924. // If a selector appears before :host it should not be shimmed as it
  21925. // matches on ancestor elements and not on elements in the host's shadow
  21926. // `:host-context(div)` is transformed to
  21927. // `-shadowcsshost-no-combinatordiv, div -shadowcsshost-no-combinator`
  21928. // the `div` is not part of the component in the 2nd selectors and should not be scoped.
  21929. // Historically `component-tag:host` was matching the component so we also want to preserve
  21930. // this behavior to avoid breaking legacy apps (it should not match).
  21931. // The behavior should be:
  21932. // - `tag:host` -> `tag[h]` (this is to avoid breaking legacy apps, should not match anything)
  21933. // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
  21934. // `:host-context(tag)`)
  21935. var hasHost = selector.indexOf(_polyfillHostNoCombinator) > -1;
  21936. // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
  21937. var shouldScope = !hasHost;
  21938. while ((res = sep.exec(selector)) !== null) {
  21939. var separator = res[1];
  21940. var part_1 = selector.slice(startIndex, res.index).trim();
  21941. shouldScope = shouldScope || part_1.indexOf(_polyfillHostNoCombinator) > -1;
  21942. var scopedPart = shouldScope ? _scopeSelectorPart(part_1) : part_1;
  21943. scopedSelector += scopedPart + " " + separator + " ";
  21944. startIndex = sep.lastIndex;
  21945. }
  21946. var part = selector.substring(startIndex);
  21947. shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
  21948. scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
  21949. // replace the placeholders with their original values
  21950. return safeContent.restore(scopedSelector);
  21951. };
  21952. ShadowCss.prototype._insertPolyfillHostInCssText = function (selector) {
  21953. return selector.replace(_colonHostContextRe, _polyfillHostContext)
  21954. .replace(_colonHostRe, _polyfillHost);
  21955. };
  21956. return ShadowCss;
  21957. }());
  21958. var SafeSelector = /** @class */ (function () {
  21959. function SafeSelector(selector) {
  21960. var _this = this;
  21961. this.placeholders = [];
  21962. this.index = 0;
  21963. // Replaces attribute selectors with placeholders.
  21964. // The WS in [attr="va lue"] would otherwise be interpreted as a selector separator.
  21965. selector = selector.replace(/(\[[^\]]*\])/g, function (_, keep) {
  21966. var replaceBy = "__ph-" + _this.index + "__";
  21967. _this.placeholders.push(keep);
  21968. _this.index++;
  21969. return replaceBy;
  21970. });
  21971. // Replaces the expression in `:nth-child(2n + 1)` with a placeholder.
  21972. // WS and "+" would otherwise be interpreted as selector separators.
  21973. this._content = selector.replace(/(:nth-[-\w]+)(\([^)]+\))/g, function (_, pseudo, exp) {
  21974. var replaceBy = "__ph-" + _this.index + "__";
  21975. _this.placeholders.push(exp);
  21976. _this.index++;
  21977. return pseudo + replaceBy;
  21978. });
  21979. }
  21980. SafeSelector.prototype.restore = function (content) {
  21981. var _this = this;
  21982. return content.replace(/__ph-(\d+)__/g, function (ph, index) { return _this.placeholders[+index]; });
  21983. };
  21984. SafeSelector.prototype.content = function () { return this._content; };
  21985. return SafeSelector;
  21986. }());
  21987. var _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
  21988. var _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
  21989. var _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
  21990. var _polyfillHost = '-shadowcsshost';
  21991. // note: :host-context pre-processed to -shadowcsshostcontext.
  21992. var _polyfillHostContext = '-shadowcsscontext';
  21993. var _parenSuffix = ')(?:\\((' +
  21994. '(?:\\([^)(]*\\)|[^)(]*)+?' +
  21995. ')\\))?([^,{]*)';
  21996. var _cssColonHostRe = new RegExp('(' + _polyfillHost + _parenSuffix, 'gim');
  21997. var _cssColonHostContextRe = new RegExp('(' + _polyfillHostContext + _parenSuffix, 'gim');
  21998. var _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
  21999. var _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
  22000. var _shadowDOMSelectorsRe = [
  22001. /::shadow/g,
  22002. /::content/g,
  22003. // Deprecated selectors
  22004. /\/shadow-deep\//g,
  22005. /\/shadow\//g,
  22006. ];
  22007. // The deep combinator is deprecated in the CSS spec
  22008. // Support for `>>>`, `deep`, `::ng-deep` is then also deprecated and will be removed in the future.
  22009. // see https://github.com/angular/angular/pull/17677
  22010. var _shadowDeepSelectors = /(?:>>>)|(?:\/deep\/)|(?:::ng-deep)/g;
  22011. var _selectorReSuffix = '([>\\s~+\[.,{:][\\s\\S]*)?$';
  22012. var _polyfillHostRe = /-shadowcsshost/gim;
  22013. var _colonHostRe = /:host/gim;
  22014. var _colonHostContextRe = /:host-context/gim;
  22015. var _commentRe = /\/\*\s*[\s\S]*?\*\//g;
  22016. function stripComments(input) {
  22017. return input.replace(_commentRe, '');
  22018. }
  22019. var _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
  22020. function extractCommentsWithHash(input) {
  22021. return input.match(_commentWithHashRe) || [];
  22022. }
  22023. var _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
  22024. var _curlyRe = /([{}])/g;
  22025. var OPEN_CURLY = '{';
  22026. var CLOSE_CURLY = '}';
  22027. var BLOCK_PLACEHOLDER = '%BLOCK%';
  22028. var CssRule = /** @class */ (function () {
  22029. function CssRule(selector, content) {
  22030. this.selector = selector;
  22031. this.content = content;
  22032. }
  22033. return CssRule;
  22034. }());
  22035. function processRules(input, ruleCallback) {
  22036. var inputWithEscapedBlocks = escapeBlocks(input);
  22037. var nextBlockIndex = 0;
  22038. return inputWithEscapedBlocks.escapedString.replace(_ruleRe, function () {
  22039. var m = [];
  22040. for (var _i = 0; _i < arguments.length; _i++) {
  22041. m[_i] = arguments[_i];
  22042. }
  22043. var selector = m[2];
  22044. var content = '';
  22045. var suffix = m[4];
  22046. var contentPrefix = '';
  22047. if (suffix && suffix.startsWith('{' + BLOCK_PLACEHOLDER)) {
  22048. content = inputWithEscapedBlocks.blocks[nextBlockIndex++];
  22049. suffix = suffix.substring(BLOCK_PLACEHOLDER.length + 1);
  22050. contentPrefix = '{';
  22051. }
  22052. var rule = ruleCallback(new CssRule(selector, content));
  22053. return "" + m[1] + rule.selector + m[3] + contentPrefix + rule.content + suffix;
  22054. });
  22055. }
  22056. var StringWithEscapedBlocks = /** @class */ (function () {
  22057. function StringWithEscapedBlocks(escapedString, blocks) {
  22058. this.escapedString = escapedString;
  22059. this.blocks = blocks;
  22060. }
  22061. return StringWithEscapedBlocks;
  22062. }());
  22063. function escapeBlocks(input) {
  22064. var inputParts = input.split(_curlyRe);
  22065. var resultParts = [];
  22066. var escapedBlocks = [];
  22067. var bracketCount = 0;
  22068. var currentBlockParts = [];
  22069. for (var partIndex = 0; partIndex < inputParts.length; partIndex++) {
  22070. var part = inputParts[partIndex];
  22071. if (part == CLOSE_CURLY) {
  22072. bracketCount--;
  22073. }
  22074. if (bracketCount > 0) {
  22075. currentBlockParts.push(part);
  22076. }
  22077. else {
  22078. if (currentBlockParts.length > 0) {
  22079. escapedBlocks.push(currentBlockParts.join(''));
  22080. resultParts.push(BLOCK_PLACEHOLDER);
  22081. currentBlockParts = [];
  22082. }
  22083. resultParts.push(part);
  22084. }
  22085. if (part == OPEN_CURLY) {
  22086. bracketCount++;
  22087. }
  22088. }
  22089. if (currentBlockParts.length > 0) {
  22090. escapedBlocks.push(currentBlockParts.join(''));
  22091. resultParts.push(BLOCK_PLACEHOLDER);
  22092. }
  22093. return new StringWithEscapedBlocks(resultParts.join(''), escapedBlocks);
  22094. }
  22095. /**
  22096. * @license
  22097. * Copyright Google Inc. All Rights Reserved.
  22098. *
  22099. * Use of this source code is governed by an MIT-style license that can be
  22100. * found in the LICENSE file at https://angular.io/license
  22101. */
  22102. var COMPONENT_VARIABLE = '%COMP%';
  22103. var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
  22104. var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
  22105. var StylesCompileDependency = /** @class */ (function () {
  22106. function StylesCompileDependency(name, moduleUrl, setValue) {
  22107. this.name = name;
  22108. this.moduleUrl = moduleUrl;
  22109. this.setValue = setValue;
  22110. }
  22111. return StylesCompileDependency;
  22112. }());
  22113. var CompiledStylesheet = /** @class */ (function () {
  22114. function CompiledStylesheet(outputCtx, stylesVar, dependencies, isShimmed, meta) {
  22115. this.outputCtx = outputCtx;
  22116. this.stylesVar = stylesVar;
  22117. this.dependencies = dependencies;
  22118. this.isShimmed = isShimmed;
  22119. this.meta = meta;
  22120. }
  22121. return CompiledStylesheet;
  22122. }());
  22123. var StyleCompiler = /** @class */ (function () {
  22124. function StyleCompiler(_urlResolver) {
  22125. this._urlResolver = _urlResolver;
  22126. this._shadowCss = new ShadowCss();
  22127. }
  22128. StyleCompiler.prototype.compileComponent = function (outputCtx, comp) {
  22129. var template = comp.template;
  22130. return this._compileStyles(outputCtx, comp, new CompileStylesheetMetadata({
  22131. styles: template.styles,
  22132. styleUrls: template.styleUrls,
  22133. moduleUrl: identifierModuleUrl(comp.type)
  22134. }), this.needsStyleShim(comp), true);
  22135. };
  22136. StyleCompiler.prototype.compileStyles = function (outputCtx, comp, stylesheet, shim) {
  22137. if (shim === void 0) { shim = this.needsStyleShim(comp); }
  22138. return this._compileStyles(outputCtx, comp, stylesheet, shim, false);
  22139. };
  22140. StyleCompiler.prototype.needsStyleShim = function (comp) {
  22141. return comp.template.encapsulation === ViewEncapsulation.Emulated;
  22142. };
  22143. StyleCompiler.prototype._compileStyles = function (outputCtx, comp, stylesheet, shim, isComponentStylesheet) {
  22144. var _this = this;
  22145. var styleExpressions = stylesheet.styles.map(function (plainStyle) { return literal(_this._shimIfNeeded(plainStyle, shim)); });
  22146. var dependencies = [];
  22147. stylesheet.styleUrls.forEach(function (styleUrl) {
  22148. var exprIndex = styleExpressions.length;
  22149. // Note: This placeholder will be filled later.
  22150. styleExpressions.push(null);
  22151. dependencies.push(new StylesCompileDependency(getStylesVarName(null), styleUrl, function (value) { return styleExpressions[exprIndex] = outputCtx.importExpr(value); }));
  22152. });
  22153. // styles variable contains plain strings and arrays of other styles arrays (recursive),
  22154. // so we set its type to dynamic.
  22155. var stylesVar = getStylesVarName(isComponentStylesheet ? comp : null);
  22156. var stmt = variable(stylesVar)
  22157. .set(literalArr(styleExpressions, new ArrayType(DYNAMIC_TYPE, [TypeModifier.Const])))
  22158. .toDeclStmt(null, isComponentStylesheet ? [StmtModifier.Final] : [
  22159. StmtModifier.Final, StmtModifier.Exported
  22160. ]);
  22161. outputCtx.statements.push(stmt);
  22162. return new CompiledStylesheet(outputCtx, stylesVar, dependencies, shim, stylesheet);
  22163. };
  22164. StyleCompiler.prototype._shimIfNeeded = function (style, shim) {
  22165. return shim ? this._shadowCss.shimCssText(style, CONTENT_ATTR, HOST_ATTR) : style;
  22166. };
  22167. return StyleCompiler;
  22168. }());
  22169. function getStylesVarName(component) {
  22170. var result = "styles";
  22171. if (component) {
  22172. result += "_" + identifierName(component.type);
  22173. }
  22174. return result;
  22175. }
  22176. /**
  22177. * @license
  22178. * Copyright Google Inc. All Rights Reserved.
  22179. *
  22180. * Use of this source code is governed by an MIT-style license that can be
  22181. * found in the LICENSE file at https://angular.io/license
  22182. */
  22183. var PRESERVE_WS_ATTR_NAME = 'ngPreserveWhitespaces';
  22184. var SKIP_WS_TRIM_TAGS = new Set(['pre', 'template', 'textarea', 'script', 'style']);
  22185. // Equivalent to \s with \u00a0 (non-breaking space) excluded.
  22186. // Based on https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RegExp
  22187. var WS_CHARS = ' \f\n\r\t\v\u1680\u180e\u2000-\u200a\u2028\u2029\u202f\u205f\u3000\ufeff';
  22188. var NO_WS_REGEXP = new RegExp("[^" + WS_CHARS + "]");
  22189. var WS_REPLACE_REGEXP = new RegExp("[" + WS_CHARS + "]{2,}", 'g');
  22190. function hasPreserveWhitespacesAttr(attrs) {
  22191. return attrs.some(function (attr) { return attr.name === PRESERVE_WS_ATTR_NAME; });
  22192. }
  22193. /**
  22194. * Angular Dart introduced &ngsp; as a placeholder for non-removable space, see:
  22195. * https://github.com/dart-lang/angular/blob/0bb611387d29d65b5af7f9d2515ab571fd3fbee4/_tests/test/compiler/preserve_whitespace_test.dart#L25-L32
  22196. * In Angular Dart &ngsp; is converted to the 0xE500 PUA (Private Use Areas) unicode character
  22197. * and later on replaced by a space. We are re-implementing the same idea here.
  22198. */
  22199. function replaceNgsp(value) {
  22200. // lexer is replacing the &ngsp; pseudo-entity with NGSP_UNICODE
  22201. return value.replace(new RegExp(NGSP_UNICODE, 'g'), ' ');
  22202. }
  22203. /**
  22204. * This visitor can walk HTML parse tree and remove / trim text nodes using the following rules:
  22205. * - consider spaces, tabs and new lines as whitespace characters;
  22206. * - drop text nodes consisting of whitespace characters only;
  22207. * - for all other text nodes replace consecutive whitespace characters with one space;
  22208. * - convert &ngsp; pseudo-entity to a single space;
  22209. *
  22210. * Removal and trimming of whitespaces have positive performance impact (less code to generate
  22211. * while compiling templates, faster view creation). At the same time it can be "destructive"
  22212. * in some cases (whitespaces can influence layout). Because of the potential of breaking layout
  22213. * this visitor is not activated by default in Angular 5 and people need to explicitly opt-in for
  22214. * whitespace removal. The default option for whitespace removal will be revisited in Angular 6
  22215. * and might be changed to "on" by default.
  22216. */
  22217. var WhitespaceVisitor = /** @class */ (function () {
  22218. function WhitespaceVisitor() {
  22219. }
  22220. WhitespaceVisitor.prototype.visitElement = function (element, context) {
  22221. if (SKIP_WS_TRIM_TAGS.has(element.name) || hasPreserveWhitespacesAttr(element.attrs)) {
  22222. // don't descent into elements where we need to preserve whitespaces
  22223. // but still visit all attributes to eliminate one used as a market to preserve WS
  22224. return new Element(element.name, visitAll(this, element.attrs), element.children, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  22225. }
  22226. return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  22227. };
  22228. WhitespaceVisitor.prototype.visitAttribute = function (attribute, context) {
  22229. return attribute.name !== PRESERVE_WS_ATTR_NAME ? attribute : null;
  22230. };
  22231. WhitespaceVisitor.prototype.visitText = function (text, context) {
  22232. var isNotBlank = text.value.match(NO_WS_REGEXP);
  22233. if (isNotBlank) {
  22234. return new Text(replaceNgsp(text.value).replace(WS_REPLACE_REGEXP, ' '), text.sourceSpan);
  22235. }
  22236. return null;
  22237. };
  22238. WhitespaceVisitor.prototype.visitComment = function (comment, context) { return comment; };
  22239. WhitespaceVisitor.prototype.visitExpansion = function (expansion, context) { return expansion; };
  22240. WhitespaceVisitor.prototype.visitExpansionCase = function (expansionCase, context) { return expansionCase; };
  22241. return WhitespaceVisitor;
  22242. }());
  22243. function removeWhitespaces(htmlAstWithErrors) {
  22244. return new ParseTreeResult(visitAll(new WhitespaceVisitor(), htmlAstWithErrors.rootNodes), htmlAstWithErrors.errors);
  22245. }
  22246. /**
  22247. * @license
  22248. * Copyright Google Inc. All Rights Reserved.
  22249. *
  22250. * Use of this source code is governed by an MIT-style license that can be
  22251. * found in the LICENSE file at https://angular.io/license
  22252. */
  22253. // http://cldr.unicode.org/index/cldr-spec/plural-rules
  22254. var PLURAL_CASES = ['zero', 'one', 'two', 'few', 'many', 'other'];
  22255. /**
  22256. * Expands special forms into elements.
  22257. *
  22258. * For example,
  22259. *
  22260. * ```
  22261. * { messages.length, plural,
  22262. * =0 {zero}
  22263. * =1 {one}
  22264. * other {more than one}
  22265. * }
  22266. * ```
  22267. *
  22268. * will be expanded into
  22269. *
  22270. * ```
  22271. * <ng-container [ngPlural]="messages.length">
  22272. * <ng-template ngPluralCase="=0">zero</ng-template>
  22273. * <ng-template ngPluralCase="=1">one</ng-template>
  22274. * <ng-template ngPluralCase="other">more than one</ng-template>
  22275. * </ng-container>
  22276. * ```
  22277. */
  22278. function expandNodes(nodes) {
  22279. var expander = new _Expander();
  22280. return new ExpansionResult(visitAll(expander, nodes), expander.isExpanded, expander.errors);
  22281. }
  22282. var ExpansionResult = /** @class */ (function () {
  22283. function ExpansionResult(nodes, expanded, errors) {
  22284. this.nodes = nodes;
  22285. this.expanded = expanded;
  22286. this.errors = errors;
  22287. }
  22288. return ExpansionResult;
  22289. }());
  22290. var ExpansionError = /** @class */ (function (_super) {
  22291. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ExpansionError, _super);
  22292. function ExpansionError(span, errorMsg) {
  22293. return _super.call(this, span, errorMsg) || this;
  22294. }
  22295. return ExpansionError;
  22296. }(ParseError));
  22297. /**
  22298. * Expand expansion forms (plural, select) to directives
  22299. *
  22300. * @internal
  22301. */
  22302. var _Expander = /** @class */ (function () {
  22303. function _Expander() {
  22304. this.isExpanded = false;
  22305. this.errors = [];
  22306. }
  22307. _Expander.prototype.visitElement = function (element, context) {
  22308. return new Element(element.name, element.attrs, visitAll(this, element.children), element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  22309. };
  22310. _Expander.prototype.visitAttribute = function (attribute, context) { return attribute; };
  22311. _Expander.prototype.visitText = function (text, context) { return text; };
  22312. _Expander.prototype.visitComment = function (comment, context) { return comment; };
  22313. _Expander.prototype.visitExpansion = function (icu, context) {
  22314. this.isExpanded = true;
  22315. return icu.type == 'plural' ? _expandPluralForm(icu, this.errors) :
  22316. _expandDefaultForm(icu, this.errors);
  22317. };
  22318. _Expander.prototype.visitExpansionCase = function (icuCase, context) {
  22319. throw new Error('Should not be reached');
  22320. };
  22321. return _Expander;
  22322. }());
  22323. // Plural forms are expanded to `NgPlural` and `NgPluralCase`s
  22324. function _expandPluralForm(ast, errors) {
  22325. var children = ast.cases.map(function (c) {
  22326. if (PLURAL_CASES.indexOf(c.value) == -1 && !c.value.match(/^=\d+$/)) {
  22327. errors.push(new ExpansionError(c.valueSourceSpan, "Plural cases should be \"=<number>\" or one of " + PLURAL_CASES.join(", ")));
  22328. }
  22329. var expansionResult = expandNodes(c.expression);
  22330. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(expansionResult.errors));
  22331. return new Element("ng-template", [new Attribute('ngPluralCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
  22332. });
  22333. var switchAttr = new Attribute('[ngPlural]', ast.switchValue, ast.switchValueSourceSpan);
  22334. return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
  22335. }
  22336. // ICU messages (excluding plural form) are expanded to `NgSwitch` and `NgSwitchCase`s
  22337. function _expandDefaultForm(ast, errors) {
  22338. var children = ast.cases.map(function (c) {
  22339. var expansionResult = expandNodes(c.expression);
  22340. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(expansionResult.errors));
  22341. if (c.value === 'other') {
  22342. // other is the default case when no values match
  22343. return new Element("ng-template", [new Attribute('ngSwitchDefault', '', c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
  22344. }
  22345. return new Element("ng-template", [new Attribute('ngSwitchCase', "" + c.value, c.valueSourceSpan)], expansionResult.nodes, c.sourceSpan, c.sourceSpan, c.sourceSpan);
  22346. });
  22347. var switchAttr = new Attribute('[ngSwitch]', ast.switchValue, ast.switchValueSourceSpan);
  22348. return new Element('ng-container', [switchAttr], children, ast.sourceSpan, ast.sourceSpan, ast.sourceSpan);
  22349. }
  22350. /**
  22351. * @license
  22352. * Copyright Google Inc. All Rights Reserved.
  22353. *
  22354. * Use of this source code is governed by an MIT-style license that can be
  22355. * found in the LICENSE file at https://angular.io/license
  22356. */
  22357. var PROPERTY_PARTS_SEPARATOR = '.';
  22358. var ATTRIBUTE_PREFIX = 'attr';
  22359. var CLASS_PREFIX = 'class';
  22360. var STYLE_PREFIX = 'style';
  22361. var ANIMATE_PROP_PREFIX = 'animate-';
  22362. /**
  22363. * Parses bindings in templates and in the directive host area.
  22364. */
  22365. var BindingParser = /** @class */ (function () {
  22366. function BindingParser(_exprParser, _interpolationConfig, _schemaRegistry, pipes, errors) {
  22367. this._exprParser = _exprParser;
  22368. this._interpolationConfig = _interpolationConfig;
  22369. this._schemaRegistry = _schemaRegistry;
  22370. this.errors = errors;
  22371. this.pipesByName = null;
  22372. this._usedPipes = new Map();
  22373. // When the `pipes` parameter is `null`, do not check for used pipes
  22374. // This is used in IVY when we might not know the available pipes at compile time
  22375. if (pipes) {
  22376. var pipesByName_1 = new Map();
  22377. pipes.forEach(function (pipe) { return pipesByName_1.set(pipe.name, pipe); });
  22378. this.pipesByName = pipesByName_1;
  22379. }
  22380. }
  22381. BindingParser.prototype.getUsedPipes = function () { return Array.from(this._usedPipes.values()); };
  22382. BindingParser.prototype.createBoundHostProperties = function (dirMeta, sourceSpan) {
  22383. var _this = this;
  22384. if (dirMeta.hostProperties) {
  22385. var boundProps_1 = [];
  22386. Object.keys(dirMeta.hostProperties).forEach(function (propName) {
  22387. var expression = dirMeta.hostProperties[propName];
  22388. if (typeof expression === 'string') {
  22389. _this.parsePropertyBinding(propName, expression, true, sourceSpan, [], boundProps_1);
  22390. }
  22391. else {
  22392. _this._reportError("Value of the host property binding \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
  22393. }
  22394. });
  22395. return boundProps_1;
  22396. }
  22397. return null;
  22398. };
  22399. BindingParser.prototype.createDirectiveHostPropertyAsts = function (dirMeta, elementSelector, sourceSpan) {
  22400. var _this = this;
  22401. var boundProps = this.createBoundHostProperties(dirMeta, sourceSpan);
  22402. return boundProps &&
  22403. boundProps.map(function (prop) { return _this.createBoundElementProperty(elementSelector, prop); });
  22404. };
  22405. BindingParser.prototype.createDirectiveHostEventAsts = function (dirMeta, sourceSpan) {
  22406. var _this = this;
  22407. if (dirMeta.hostListeners) {
  22408. var targetEvents_1 = [];
  22409. Object.keys(dirMeta.hostListeners).forEach(function (propName) {
  22410. var expression = dirMeta.hostListeners[propName];
  22411. if (typeof expression === 'string') {
  22412. _this.parseEvent(propName, expression, sourceSpan, [], targetEvents_1);
  22413. }
  22414. else {
  22415. _this._reportError("Value of the host listener \"" + propName + "\" needs to be a string representing an expression but got \"" + expression + "\" (" + typeof expression + ")", sourceSpan);
  22416. }
  22417. });
  22418. return targetEvents_1;
  22419. }
  22420. return null;
  22421. };
  22422. BindingParser.prototype.parseInterpolation = function (value, sourceSpan) {
  22423. var sourceInfo = sourceSpan.start.toString();
  22424. try {
  22425. var ast = this._exprParser.parseInterpolation(value, sourceInfo, this._interpolationConfig);
  22426. if (ast)
  22427. this._reportExpressionParserErrors(ast.errors, sourceSpan);
  22428. this._checkPipes(ast, sourceSpan);
  22429. return ast;
  22430. }
  22431. catch (e) {
  22432. this._reportError("" + e, sourceSpan);
  22433. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  22434. }
  22435. };
  22436. // Parse an inline template binding. ie `<tag *tplKey="<tplValue>">`
  22437. BindingParser.prototype.parseInlineTemplateBinding = function (tplKey, tplValue, sourceSpan, targetMatchableAttrs, targetProps, targetVars) {
  22438. var bindings = this._parseTemplateBindings(tplKey, tplValue, sourceSpan);
  22439. for (var i = 0; i < bindings.length; i++) {
  22440. var binding = bindings[i];
  22441. if (binding.keyIsVar) {
  22442. targetVars.push(new ParsedVariable(binding.key, binding.name, sourceSpan));
  22443. }
  22444. else if (binding.expression) {
  22445. this._parsePropertyAst(binding.key, binding.expression, sourceSpan, targetMatchableAttrs, targetProps);
  22446. }
  22447. else {
  22448. targetMatchableAttrs.push([binding.key, '']);
  22449. this.parseLiteralAttr(binding.key, null, sourceSpan, targetMatchableAttrs, targetProps);
  22450. }
  22451. }
  22452. };
  22453. BindingParser.prototype._parseTemplateBindings = function (tplKey, tplValue, sourceSpan) {
  22454. var _this = this;
  22455. var sourceInfo = sourceSpan.start.toString();
  22456. try {
  22457. var bindingsResult = this._exprParser.parseTemplateBindings(tplKey, tplValue, sourceInfo);
  22458. this._reportExpressionParserErrors(bindingsResult.errors, sourceSpan);
  22459. bindingsResult.templateBindings.forEach(function (binding) {
  22460. if (binding.expression) {
  22461. _this._checkPipes(binding.expression, sourceSpan);
  22462. }
  22463. });
  22464. bindingsResult.warnings.forEach(function (warning) { _this._reportError(warning, sourceSpan, ParseErrorLevel.WARNING); });
  22465. return bindingsResult.templateBindings;
  22466. }
  22467. catch (e) {
  22468. this._reportError("" + e, sourceSpan);
  22469. return [];
  22470. }
  22471. };
  22472. BindingParser.prototype.parseLiteralAttr = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
  22473. if (isAnimationLabel(name)) {
  22474. name = name.substring(1);
  22475. if (value) {
  22476. this._reportError("Assigning animation triggers via @prop=\"exp\" attributes with an expression is invalid." +
  22477. " Use property bindings (e.g. [@prop]=\"exp\") or use an attribute without a value (e.g. @prop) instead.", sourceSpan, ParseErrorLevel.ERROR);
  22478. }
  22479. this._parseAnimation(name, value, sourceSpan, targetMatchableAttrs, targetProps);
  22480. }
  22481. else {
  22482. targetProps.push(new ParsedProperty(name, this._exprParser.wrapLiteralPrimitive(value, ''), ParsedPropertyType.LITERAL_ATTR, sourceSpan));
  22483. }
  22484. };
  22485. BindingParser.prototype.parsePropertyBinding = function (name, expression, isHost, sourceSpan, targetMatchableAttrs, targetProps) {
  22486. var isAnimationProp = false;
  22487. if (name.startsWith(ANIMATE_PROP_PREFIX)) {
  22488. isAnimationProp = true;
  22489. name = name.substring(ANIMATE_PROP_PREFIX.length);
  22490. }
  22491. else if (isAnimationLabel(name)) {
  22492. isAnimationProp = true;
  22493. name = name.substring(1);
  22494. }
  22495. if (isAnimationProp) {
  22496. this._parseAnimation(name, expression, sourceSpan, targetMatchableAttrs, targetProps);
  22497. }
  22498. else {
  22499. this._parsePropertyAst(name, this._parseBinding(expression, isHost, sourceSpan), sourceSpan, targetMatchableAttrs, targetProps);
  22500. }
  22501. };
  22502. BindingParser.prototype.parsePropertyInterpolation = function (name, value, sourceSpan, targetMatchableAttrs, targetProps) {
  22503. var expr = this.parseInterpolation(value, sourceSpan);
  22504. if (expr) {
  22505. this._parsePropertyAst(name, expr, sourceSpan, targetMatchableAttrs, targetProps);
  22506. return true;
  22507. }
  22508. return false;
  22509. };
  22510. BindingParser.prototype._parsePropertyAst = function (name, ast, sourceSpan, targetMatchableAttrs, targetProps) {
  22511. targetMatchableAttrs.push([name, ast.source]);
  22512. targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.DEFAULT, sourceSpan));
  22513. };
  22514. BindingParser.prototype._parseAnimation = function (name, expression, sourceSpan, targetMatchableAttrs, targetProps) {
  22515. // This will occur when a @trigger is not paired with an expression.
  22516. // For animations it is valid to not have an expression since */void
  22517. // states will be applied by angular when the element is attached/detached
  22518. var ast = this._parseBinding(expression || 'undefined', false, sourceSpan);
  22519. targetMatchableAttrs.push([name, ast.source]);
  22520. targetProps.push(new ParsedProperty(name, ast, ParsedPropertyType.ANIMATION, sourceSpan));
  22521. };
  22522. BindingParser.prototype._parseBinding = function (value, isHostBinding, sourceSpan) {
  22523. var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown)').toString();
  22524. try {
  22525. var ast = isHostBinding ?
  22526. this._exprParser.parseSimpleBinding(value, sourceInfo, this._interpolationConfig) :
  22527. this._exprParser.parseBinding(value, sourceInfo, this._interpolationConfig);
  22528. if (ast)
  22529. this._reportExpressionParserErrors(ast.errors, sourceSpan);
  22530. this._checkPipes(ast, sourceSpan);
  22531. return ast;
  22532. }
  22533. catch (e) {
  22534. this._reportError("" + e, sourceSpan);
  22535. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  22536. }
  22537. };
  22538. BindingParser.prototype.createBoundElementProperty = function (elementSelector, boundProp) {
  22539. if (boundProp.isAnimation) {
  22540. return new BoundElementProperty(boundProp.name, 4 /* Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan);
  22541. }
  22542. var unit = null;
  22543. var bindingType = undefined;
  22544. var boundPropertyName = null;
  22545. var parts = boundProp.name.split(PROPERTY_PARTS_SEPARATOR);
  22546. var securityContexts = undefined;
  22547. // Check check for special cases (prefix style, attr, class)
  22548. if (parts.length > 1) {
  22549. if (parts[0] == ATTRIBUTE_PREFIX) {
  22550. boundPropertyName = parts[1];
  22551. this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, true);
  22552. securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, true);
  22553. var nsSeparatorIdx = boundPropertyName.indexOf(':');
  22554. if (nsSeparatorIdx > -1) {
  22555. var ns = boundPropertyName.substring(0, nsSeparatorIdx);
  22556. var name_1 = boundPropertyName.substring(nsSeparatorIdx + 1);
  22557. boundPropertyName = mergeNsAndName(ns, name_1);
  22558. }
  22559. bindingType = 1 /* Attribute */;
  22560. }
  22561. else if (parts[0] == CLASS_PREFIX) {
  22562. boundPropertyName = parts[1];
  22563. bindingType = 2 /* Class */;
  22564. securityContexts = [SecurityContext.NONE];
  22565. }
  22566. else if (parts[0] == STYLE_PREFIX) {
  22567. unit = parts.length > 2 ? parts[2] : null;
  22568. boundPropertyName = parts[1];
  22569. bindingType = 3 /* Style */;
  22570. securityContexts = [SecurityContext.STYLE];
  22571. }
  22572. }
  22573. // If not a special case, use the full property name
  22574. if (boundPropertyName === null) {
  22575. boundPropertyName = this._schemaRegistry.getMappedPropName(boundProp.name);
  22576. securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, boundPropertyName, false);
  22577. bindingType = 0 /* Property */;
  22578. this._validatePropertyOrAttributeName(boundPropertyName, boundProp.sourceSpan, false);
  22579. }
  22580. return new BoundElementProperty(boundPropertyName, bindingType, securityContexts[0], boundProp.expression, unit, boundProp.sourceSpan);
  22581. };
  22582. BindingParser.prototype.parseEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
  22583. if (isAnimationLabel(name)) {
  22584. name = name.substr(1);
  22585. this._parseAnimationEvent(name, expression, sourceSpan, targetEvents);
  22586. }
  22587. else {
  22588. this._parseRegularEvent(name, expression, sourceSpan, targetMatchableAttrs, targetEvents);
  22589. }
  22590. };
  22591. BindingParser.prototype._parseAnimationEvent = function (name, expression, sourceSpan, targetEvents) {
  22592. var matches = splitAtPeriod(name, [name, '']);
  22593. var eventName = matches[0];
  22594. var phase = matches[1].toLowerCase();
  22595. if (phase) {
  22596. switch (phase) {
  22597. case 'start':
  22598. case 'done':
  22599. var ast = this._parseAction(expression, sourceSpan);
  22600. targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan));
  22601. break;
  22602. default:
  22603. this._reportError("The provided animation output phase value \"" + phase + "\" for \"@" + eventName + "\" is not supported (use start or done)", sourceSpan);
  22604. break;
  22605. }
  22606. }
  22607. else {
  22608. this._reportError("The animation trigger output event (@" + eventName + ") is missing its phase value name (start or done are currently supported)", sourceSpan);
  22609. }
  22610. };
  22611. BindingParser.prototype._parseRegularEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
  22612. // long format: 'target: eventName'
  22613. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitAtColon(name, [null, name]), 2), target = _a[0], eventName = _a[1];
  22614. var ast = this._parseAction(expression, sourceSpan);
  22615. targetMatchableAttrs.push([name, ast.source]);
  22616. targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan));
  22617. // Don't detect directives for event names for now,
  22618. // so don't add the event name to the matchableAttrs
  22619. };
  22620. BindingParser.prototype._parseAction = function (value, sourceSpan) {
  22621. var sourceInfo = (sourceSpan && sourceSpan.start || '(unknown').toString();
  22622. try {
  22623. var ast = this._exprParser.parseAction(value, sourceInfo, this._interpolationConfig);
  22624. if (ast) {
  22625. this._reportExpressionParserErrors(ast.errors, sourceSpan);
  22626. }
  22627. if (!ast || ast.ast instanceof EmptyExpr) {
  22628. this._reportError("Empty expressions are not allowed", sourceSpan);
  22629. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  22630. }
  22631. this._checkPipes(ast, sourceSpan);
  22632. return ast;
  22633. }
  22634. catch (e) {
  22635. this._reportError("" + e, sourceSpan);
  22636. return this._exprParser.wrapLiteralPrimitive('ERROR', sourceInfo);
  22637. }
  22638. };
  22639. BindingParser.prototype._reportError = function (message, sourceSpan, level) {
  22640. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  22641. this.errors.push(new ParseError(sourceSpan, message, level));
  22642. };
  22643. BindingParser.prototype._reportExpressionParserErrors = function (errors, sourceSpan) {
  22644. var e_1, _a;
  22645. try {
  22646. for (var errors_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(errors), errors_1_1 = errors_1.next(); !errors_1_1.done; errors_1_1 = errors_1.next()) {
  22647. var error$$1 = errors_1_1.value;
  22648. this._reportError(error$$1.message, sourceSpan);
  22649. }
  22650. }
  22651. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  22652. finally {
  22653. try {
  22654. if (errors_1_1 && !errors_1_1.done && (_a = errors_1.return)) _a.call(errors_1);
  22655. }
  22656. finally { if (e_1) throw e_1.error; }
  22657. }
  22658. };
  22659. // Make sure all the used pipes are known in `this.pipesByName`
  22660. BindingParser.prototype._checkPipes = function (ast, sourceSpan) {
  22661. var _this = this;
  22662. if (ast && this.pipesByName) {
  22663. var collector = new PipeCollector();
  22664. ast.visit(collector);
  22665. collector.pipes.forEach(function (ast, pipeName) {
  22666. var pipeMeta = _this.pipesByName.get(pipeName);
  22667. if (!pipeMeta) {
  22668. _this._reportError("The pipe '" + pipeName + "' could not be found", new ParseSourceSpan(sourceSpan.start.moveBy(ast.span.start), sourceSpan.start.moveBy(ast.span.end)));
  22669. }
  22670. else {
  22671. _this._usedPipes.set(pipeName, pipeMeta);
  22672. }
  22673. });
  22674. }
  22675. };
  22676. /**
  22677. * @param propName the name of the property / attribute
  22678. * @param sourceSpan
  22679. * @param isAttr true when binding to an attribute
  22680. */
  22681. BindingParser.prototype._validatePropertyOrAttributeName = function (propName, sourceSpan, isAttr) {
  22682. var report = isAttr ? this._schemaRegistry.validateAttribute(propName) :
  22683. this._schemaRegistry.validateProperty(propName);
  22684. if (report.error) {
  22685. this._reportError(report.msg, sourceSpan, ParseErrorLevel.ERROR);
  22686. }
  22687. };
  22688. return BindingParser;
  22689. }());
  22690. var PipeCollector = /** @class */ (function (_super) {
  22691. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PipeCollector, _super);
  22692. function PipeCollector() {
  22693. var _this = _super !== null && _super.apply(this, arguments) || this;
  22694. _this.pipes = new Map();
  22695. return _this;
  22696. }
  22697. PipeCollector.prototype.visitPipe = function (ast, context) {
  22698. this.pipes.set(ast.name, ast);
  22699. ast.exp.visit(this);
  22700. this.visitAll(ast.args, context);
  22701. return null;
  22702. };
  22703. return PipeCollector;
  22704. }(RecursiveAstVisitor));
  22705. function isAnimationLabel(name) {
  22706. return name[0] == '@';
  22707. }
  22708. function calcPossibleSecurityContexts(registry, selector, propName, isAttribute) {
  22709. var ctxs = [];
  22710. CssSelector.parse(selector).forEach(function (selector) {
  22711. var elementNames = selector.element ? [selector.element] : registry.allKnownElementNames();
  22712. var notElementNames = new Set(selector.notSelectors.filter(function (selector) { return selector.isElementSelector(); })
  22713. .map(function (selector) { return selector.element; }));
  22714. var possibleElementNames = elementNames.filter(function (elementName) { return !notElementNames.has(elementName); });
  22715. ctxs.push.apply(ctxs, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(possibleElementNames.map(function (elementName) { return registry.securityContext(elementName, propName, isAttribute); })));
  22716. });
  22717. return ctxs.length === 0 ? [SecurityContext.NONE] : Array.from(new Set(ctxs)).sort();
  22718. }
  22719. /**
  22720. * @license
  22721. * Copyright Google Inc. All Rights Reserved.
  22722. *
  22723. * Use of this source code is governed by an MIT-style license that can be
  22724. * found in the LICENSE file at https://angular.io/license
  22725. */
  22726. var BIND_NAME_REGEXP = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/;
  22727. // Group 1 = "bind-"
  22728. var KW_BIND_IDX = 1;
  22729. // Group 2 = "let-"
  22730. var KW_LET_IDX = 2;
  22731. // Group 3 = "ref-/#"
  22732. var KW_REF_IDX = 3;
  22733. // Group 4 = "on-"
  22734. var KW_ON_IDX = 4;
  22735. // Group 5 = "bindon-"
  22736. var KW_BINDON_IDX = 5;
  22737. // Group 6 = "@"
  22738. var KW_AT_IDX = 6;
  22739. // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@"
  22740. var IDENT_KW_IDX = 7;
  22741. // Group 8 = identifier inside [()]
  22742. var IDENT_BANANA_BOX_IDX = 8;
  22743. // Group 9 = identifier inside []
  22744. var IDENT_PROPERTY_IDX = 9;
  22745. // Group 10 = identifier inside ()
  22746. var IDENT_EVENT_IDX = 10;
  22747. var TEMPLATE_ATTR_PREFIX = '*';
  22748. var CLASS_ATTR = 'class';
  22749. var _TEXT_CSS_SELECTOR;
  22750. function TEXT_CSS_SELECTOR() {
  22751. if (!_TEXT_CSS_SELECTOR) {
  22752. _TEXT_CSS_SELECTOR = CssSelector.parse('*')[0];
  22753. }
  22754. return _TEXT_CSS_SELECTOR;
  22755. }
  22756. var TemplateParseError = /** @class */ (function (_super) {
  22757. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TemplateParseError, _super);
  22758. function TemplateParseError(message, span, level) {
  22759. return _super.call(this, span, message, level) || this;
  22760. }
  22761. return TemplateParseError;
  22762. }(ParseError));
  22763. var TemplateParseResult = /** @class */ (function () {
  22764. function TemplateParseResult(templateAst, usedPipes, errors) {
  22765. this.templateAst = templateAst;
  22766. this.usedPipes = usedPipes;
  22767. this.errors = errors;
  22768. }
  22769. return TemplateParseResult;
  22770. }());
  22771. var TemplateParser = /** @class */ (function () {
  22772. function TemplateParser(_config, _reflector, _exprParser, _schemaRegistry, _htmlParser, _console, transforms) {
  22773. this._config = _config;
  22774. this._reflector = _reflector;
  22775. this._exprParser = _exprParser;
  22776. this._schemaRegistry = _schemaRegistry;
  22777. this._htmlParser = _htmlParser;
  22778. this._console = _console;
  22779. this.transforms = transforms;
  22780. }
  22781. Object.defineProperty(TemplateParser.prototype, "expressionParser", {
  22782. get: function () { return this._exprParser; },
  22783. enumerable: true,
  22784. configurable: true
  22785. });
  22786. TemplateParser.prototype.parse = function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
  22787. var result = this.tryParse(component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces);
  22788. var warnings = result.errors.filter(function (error$$1) { return error$$1.level === ParseErrorLevel.WARNING; });
  22789. var errors = result.errors.filter(function (error$$1) { return error$$1.level === ParseErrorLevel.ERROR; });
  22790. if (warnings.length > 0) {
  22791. this._console.warn("Template parse warnings:\n" + warnings.join('\n'));
  22792. }
  22793. if (errors.length > 0) {
  22794. var errorString = errors.join('\n');
  22795. throw syntaxError("Template parse errors:\n" + errorString, errors);
  22796. }
  22797. return { template: result.templateAst, pipes: result.usedPipes };
  22798. };
  22799. TemplateParser.prototype.tryParse = function (component, template, directives, pipes, schemas, templateUrl, preserveWhitespaces) {
  22800. var htmlParseResult = typeof template === 'string' ?
  22801. this._htmlParser.parse(template, templateUrl, true, this.getInterpolationConfig(component)) :
  22802. template;
  22803. if (!preserveWhitespaces) {
  22804. htmlParseResult = removeWhitespaces(htmlParseResult);
  22805. }
  22806. return this.tryParseHtml(this.expandHtml(htmlParseResult), component, directives, pipes, schemas);
  22807. };
  22808. TemplateParser.prototype.tryParseHtml = function (htmlAstWithErrors, component, directives, pipes, schemas) {
  22809. var result;
  22810. var errors = htmlAstWithErrors.errors;
  22811. var usedPipes = [];
  22812. if (htmlAstWithErrors.rootNodes.length > 0) {
  22813. var uniqDirectives = removeSummaryDuplicates(directives);
  22814. var uniqPipes = removeSummaryDuplicates(pipes);
  22815. var providerViewContext = new ProviderViewContext(this._reflector, component);
  22816. var interpolationConfig = undefined;
  22817. if (component.template && component.template.interpolation) {
  22818. interpolationConfig = {
  22819. start: component.template.interpolation[0],
  22820. end: component.template.interpolation[1]
  22821. };
  22822. }
  22823. var bindingParser = new BindingParser(this._exprParser, interpolationConfig, this._schemaRegistry, uniqPipes, errors);
  22824. var parseVisitor = new TemplateParseVisitor(this._reflector, this._config, providerViewContext, uniqDirectives, bindingParser, this._schemaRegistry, schemas, errors);
  22825. result = visitAll(parseVisitor, htmlAstWithErrors.rootNodes, EMPTY_ELEMENT_CONTEXT);
  22826. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(providerViewContext.errors));
  22827. usedPipes.push.apply(usedPipes, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(bindingParser.getUsedPipes()));
  22828. }
  22829. else {
  22830. result = [];
  22831. }
  22832. this._assertNoReferenceDuplicationOnTemplate(result, errors);
  22833. if (errors.length > 0) {
  22834. return new TemplateParseResult(result, usedPipes, errors);
  22835. }
  22836. if (this.transforms) {
  22837. this.transforms.forEach(function (transform) { result = templateVisitAll(transform, result); });
  22838. }
  22839. return new TemplateParseResult(result, usedPipes, errors);
  22840. };
  22841. TemplateParser.prototype.expandHtml = function (htmlAstWithErrors, forced) {
  22842. if (forced === void 0) { forced = false; }
  22843. var errors = htmlAstWithErrors.errors;
  22844. if (errors.length == 0 || forced) {
  22845. // Transform ICU messages to angular directives
  22846. var expandedHtmlAst = expandNodes(htmlAstWithErrors.rootNodes);
  22847. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(expandedHtmlAst.errors));
  22848. htmlAstWithErrors = new ParseTreeResult(expandedHtmlAst.nodes, errors);
  22849. }
  22850. return htmlAstWithErrors;
  22851. };
  22852. TemplateParser.prototype.getInterpolationConfig = function (component) {
  22853. if (component.template) {
  22854. return InterpolationConfig.fromArray(component.template.interpolation);
  22855. }
  22856. return undefined;
  22857. };
  22858. /** @internal */
  22859. TemplateParser.prototype._assertNoReferenceDuplicationOnTemplate = function (result, errors) {
  22860. var existingReferences = [];
  22861. result.filter(function (element) { return !!element.references; })
  22862. .forEach(function (element) { return element.references.forEach(function (reference) {
  22863. var name = reference.name;
  22864. if (existingReferences.indexOf(name) < 0) {
  22865. existingReferences.push(name);
  22866. }
  22867. else {
  22868. var error$$1 = new TemplateParseError("Reference \"#" + name + "\" is defined several times", reference.sourceSpan, ParseErrorLevel.ERROR);
  22869. errors.push(error$$1);
  22870. }
  22871. }); });
  22872. };
  22873. return TemplateParser;
  22874. }());
  22875. var TemplateParseVisitor = /** @class */ (function () {
  22876. function TemplateParseVisitor(reflector, config, providerViewContext, directives, _bindingParser, _schemaRegistry, _schemas, _targetErrors) {
  22877. var _this = this;
  22878. this.reflector = reflector;
  22879. this.config = config;
  22880. this.providerViewContext = providerViewContext;
  22881. this._bindingParser = _bindingParser;
  22882. this._schemaRegistry = _schemaRegistry;
  22883. this._schemas = _schemas;
  22884. this._targetErrors = _targetErrors;
  22885. this.selectorMatcher = new SelectorMatcher();
  22886. this.directivesIndex = new Map();
  22887. this.ngContentCount = 0;
  22888. // Note: queries start with id 1 so we can use the number in a Bloom filter!
  22889. this.contentQueryStartId = providerViewContext.component.viewQueries.length + 1;
  22890. directives.forEach(function (directive, index) {
  22891. var selector = CssSelector.parse(directive.selector);
  22892. _this.selectorMatcher.addSelectables(selector, directive);
  22893. _this.directivesIndex.set(directive, index);
  22894. });
  22895. }
  22896. TemplateParseVisitor.prototype.visitExpansion = function (expansion, context) { return null; };
  22897. TemplateParseVisitor.prototype.visitExpansionCase = function (expansionCase, context) { return null; };
  22898. TemplateParseVisitor.prototype.visitText = function (text, parent) {
  22899. var ngContentIndex = parent.findNgContentIndex(TEXT_CSS_SELECTOR());
  22900. var valueNoNgsp = replaceNgsp(text.value);
  22901. var expr = this._bindingParser.parseInterpolation(valueNoNgsp, text.sourceSpan);
  22902. return expr ? new BoundTextAst(expr, ngContentIndex, text.sourceSpan) :
  22903. new TextAst(valueNoNgsp, ngContentIndex, text.sourceSpan);
  22904. };
  22905. TemplateParseVisitor.prototype.visitAttribute = function (attribute, context) {
  22906. return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
  22907. };
  22908. TemplateParseVisitor.prototype.visitComment = function (comment, context) { return null; };
  22909. TemplateParseVisitor.prototype.visitElement = function (element, parent) {
  22910. var _this = this;
  22911. var queryStartIndex = this.contentQueryStartId;
  22912. var elName = element.name;
  22913. var preparsedElement = preparseElement(element);
  22914. if (preparsedElement.type === PreparsedElementType.SCRIPT ||
  22915. preparsedElement.type === PreparsedElementType.STYLE) {
  22916. // Skipping <script> for security reasons
  22917. // Skipping <style> as we already processed them
  22918. // in the StyleCompiler
  22919. return null;
  22920. }
  22921. if (preparsedElement.type === PreparsedElementType.STYLESHEET &&
  22922. isStyleUrlResolvable(preparsedElement.hrefAttr)) {
  22923. // Skipping stylesheets with either relative urls or package scheme as we already processed
  22924. // them in the StyleCompiler
  22925. return null;
  22926. }
  22927. var matchableAttrs = [];
  22928. var elementOrDirectiveProps = [];
  22929. var elementOrDirectiveRefs = [];
  22930. var elementVars = [];
  22931. var events = [];
  22932. var templateElementOrDirectiveProps = [];
  22933. var templateMatchableAttrs = [];
  22934. var templateElementVars = [];
  22935. var hasInlineTemplates = false;
  22936. var attrs = [];
  22937. var isTemplateElement = isNgTemplate(element.name);
  22938. element.attrs.forEach(function (attr) {
  22939. var parsedVariables = [];
  22940. var hasBinding = _this._parseAttr(isTemplateElement, attr, matchableAttrs, elementOrDirectiveProps, events, elementOrDirectiveRefs, elementVars);
  22941. elementVars.push.apply(elementVars, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(parsedVariables.map(function (v) { return VariableAst.fromParsedVariable(v); })));
  22942. var templateValue;
  22943. var templateKey;
  22944. var normalizedName = _this._normalizeAttributeName(attr.name);
  22945. if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX)) {
  22946. templateValue = attr.value;
  22947. templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX.length);
  22948. }
  22949. var hasTemplateBinding = templateValue != null;
  22950. if (hasTemplateBinding) {
  22951. if (hasInlineTemplates) {
  22952. _this._reportError("Can't have multiple template bindings on one element. Use only one attribute prefixed with *", attr.sourceSpan);
  22953. }
  22954. hasInlineTemplates = true;
  22955. var parsedVariables_1 = [];
  22956. _this._bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attr.sourceSpan, templateMatchableAttrs, templateElementOrDirectiveProps, parsedVariables_1);
  22957. templateElementVars.push.apply(templateElementVars, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(parsedVariables_1.map(function (v) { return VariableAst.fromParsedVariable(v); })));
  22958. }
  22959. if (!hasBinding && !hasTemplateBinding) {
  22960. // don't include the bindings as attributes as well in the AST
  22961. attrs.push(_this.visitAttribute(attr, null));
  22962. matchableAttrs.push([attr.name, attr.value]);
  22963. }
  22964. });
  22965. var elementCssSelector = createElementCssSelector(elName, matchableAttrs);
  22966. var _a = this._parseDirectives(this.selectorMatcher, elementCssSelector), directiveMetas = _a.directives, matchElement = _a.matchElement;
  22967. var references = [];
  22968. var boundDirectivePropNames = new Set();
  22969. var directiveAsts = this._createDirectiveAsts(isTemplateElement, element.name, directiveMetas, elementOrDirectiveProps, elementOrDirectiveRefs, element.sourceSpan, references, boundDirectivePropNames);
  22970. var elementProps = this._createElementPropertyAsts(element.name, elementOrDirectiveProps, boundDirectivePropNames);
  22971. var isViewRoot = parent.isTemplateElement || hasInlineTemplates;
  22972. var providerContext = new ProviderElementContext(this.providerViewContext, parent.providerContext, isViewRoot, directiveAsts, attrs, references, isTemplateElement, queryStartIndex, element.sourceSpan);
  22973. var children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR : this, element.children, ElementContext.create(isTemplateElement, directiveAsts, isTemplateElement ? parent.providerContext : providerContext));
  22974. providerContext.afterElement();
  22975. // Override the actual selector when the `ngProjectAs` attribute is provided
  22976. var projectionSelector = preparsedElement.projectAs != '' ?
  22977. CssSelector.parse(preparsedElement.projectAs)[0] :
  22978. elementCssSelector;
  22979. var ngContentIndex = parent.findNgContentIndex(projectionSelector);
  22980. var parsedElement;
  22981. if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
  22982. // `<ng-content>` element
  22983. if (element.children && !element.children.every(_isEmptyTextNode)) {
  22984. this._reportError("<ng-content> element cannot have content.", element.sourceSpan);
  22985. }
  22986. parsedElement = new NgContentAst(this.ngContentCount++, hasInlineTemplates ? null : ngContentIndex, element.sourceSpan);
  22987. }
  22988. else if (isTemplateElement) {
  22989. // `<ng-template>` element
  22990. this._assertAllEventsPublishedByDirectives(directiveAsts, events);
  22991. this._assertNoComponentsNorElementBindingsOnTemplate(directiveAsts, elementProps, element.sourceSpan);
  22992. parsedElement = new EmbeddedTemplateAst(attrs, events, references, elementVars, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : ngContentIndex, element.sourceSpan);
  22993. }
  22994. else {
  22995. // element other than `<ng-content>` and `<ng-template>`
  22996. this._assertElementExists(matchElement, element);
  22997. this._assertOnlyOneComponent(directiveAsts, element.sourceSpan);
  22998. var ngContentIndex_1 = hasInlineTemplates ? null : parent.findNgContentIndex(projectionSelector);
  22999. parsedElement = new ElementAst(elName, attrs, elementProps, events, references, providerContext.transformedDirectiveAsts, providerContext.transformProviders, providerContext.transformedHasViewContainer, providerContext.queryMatches, children, hasInlineTemplates ? null : ngContentIndex_1, element.sourceSpan, element.endSourceSpan || null);
  23000. }
  23001. if (hasInlineTemplates) {
  23002. // The element as a *-attribute
  23003. var templateQueryStartIndex = this.contentQueryStartId;
  23004. var templateSelector = createElementCssSelector('ng-template', templateMatchableAttrs);
  23005. var directives = this._parseDirectives(this.selectorMatcher, templateSelector).directives;
  23006. var templateBoundDirectivePropNames = new Set();
  23007. var templateDirectiveAsts = this._createDirectiveAsts(true, elName, directives, templateElementOrDirectiveProps, [], element.sourceSpan, [], templateBoundDirectivePropNames);
  23008. var templateElementProps = this._createElementPropertyAsts(elName, templateElementOrDirectiveProps, templateBoundDirectivePropNames);
  23009. this._assertNoComponentsNorElementBindingsOnTemplate(templateDirectiveAsts, templateElementProps, element.sourceSpan);
  23010. var templateProviderContext = new ProviderElementContext(this.providerViewContext, parent.providerContext, parent.isTemplateElement, templateDirectiveAsts, [], [], true, templateQueryStartIndex, element.sourceSpan);
  23011. templateProviderContext.afterElement();
  23012. parsedElement = new EmbeddedTemplateAst([], [], [], templateElementVars, templateProviderContext.transformedDirectiveAsts, templateProviderContext.transformProviders, templateProviderContext.transformedHasViewContainer, templateProviderContext.queryMatches, [parsedElement], ngContentIndex, element.sourceSpan);
  23013. }
  23014. return parsedElement;
  23015. };
  23016. TemplateParseVisitor.prototype._parseAttr = function (isTemplateElement, attr, targetMatchableAttrs, targetProps, targetEvents, targetRefs, targetVars) {
  23017. var name = this._normalizeAttributeName(attr.name);
  23018. var value = attr.value;
  23019. var srcSpan = attr.sourceSpan;
  23020. var boundEvents = [];
  23021. var bindParts = name.match(BIND_NAME_REGEXP);
  23022. var hasBinding = false;
  23023. if (bindParts !== null) {
  23024. hasBinding = true;
  23025. if (bindParts[KW_BIND_IDX] != null) {
  23026. this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  23027. }
  23028. else if (bindParts[KW_LET_IDX]) {
  23029. if (isTemplateElement) {
  23030. var identifier = bindParts[IDENT_KW_IDX];
  23031. this._parseVariable(identifier, value, srcSpan, targetVars);
  23032. }
  23033. else {
  23034. this._reportError("\"let-\" is only supported on ng-template elements.", srcSpan);
  23035. }
  23036. }
  23037. else if (bindParts[KW_REF_IDX]) {
  23038. var identifier = bindParts[IDENT_KW_IDX];
  23039. this._parseReference(identifier, value, srcSpan, targetRefs);
  23040. }
  23041. else if (bindParts[KW_ON_IDX]) {
  23042. this._bindingParser.parseEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, boundEvents);
  23043. }
  23044. else if (bindParts[KW_BINDON_IDX]) {
  23045. this._bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  23046. this._parseAssignmentEvent(bindParts[IDENT_KW_IDX], value, srcSpan, targetMatchableAttrs, boundEvents);
  23047. }
  23048. else if (bindParts[KW_AT_IDX]) {
  23049. this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
  23050. }
  23051. else if (bindParts[IDENT_BANANA_BOX_IDX]) {
  23052. this._bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  23053. this._parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX], value, srcSpan, targetMatchableAttrs, boundEvents);
  23054. }
  23055. else if (bindParts[IDENT_PROPERTY_IDX]) {
  23056. this._bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX], value, false, srcSpan, targetMatchableAttrs, targetProps);
  23057. }
  23058. else if (bindParts[IDENT_EVENT_IDX]) {
  23059. this._bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX], value, srcSpan, targetMatchableAttrs, boundEvents);
  23060. }
  23061. }
  23062. else {
  23063. hasBinding = this._bindingParser.parsePropertyInterpolation(name, value, srcSpan, targetMatchableAttrs, targetProps);
  23064. }
  23065. if (!hasBinding) {
  23066. this._bindingParser.parseLiteralAttr(name, value, srcSpan, targetMatchableAttrs, targetProps);
  23067. }
  23068. targetEvents.push.apply(targetEvents, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(boundEvents.map(function (e) { return BoundEventAst.fromParsedEvent(e); })));
  23069. return hasBinding;
  23070. };
  23071. TemplateParseVisitor.prototype._normalizeAttributeName = function (attrName) {
  23072. return /^data-/i.test(attrName) ? attrName.substring(5) : attrName;
  23073. };
  23074. TemplateParseVisitor.prototype._parseVariable = function (identifier, value, sourceSpan, targetVars) {
  23075. if (identifier.indexOf('-') > -1) {
  23076. this._reportError("\"-\" is not allowed in variable names", sourceSpan);
  23077. }
  23078. targetVars.push(new VariableAst(identifier, value, sourceSpan));
  23079. };
  23080. TemplateParseVisitor.prototype._parseReference = function (identifier, value, sourceSpan, targetRefs) {
  23081. if (identifier.indexOf('-') > -1) {
  23082. this._reportError("\"-\" is not allowed in reference names", sourceSpan);
  23083. }
  23084. targetRefs.push(new ElementOrDirectiveRef(identifier, value, sourceSpan));
  23085. };
  23086. TemplateParseVisitor.prototype._parseAssignmentEvent = function (name, expression, sourceSpan, targetMatchableAttrs, targetEvents) {
  23087. this._bindingParser.parseEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, targetEvents);
  23088. };
  23089. TemplateParseVisitor.prototype._parseDirectives = function (selectorMatcher, elementCssSelector) {
  23090. var _this = this;
  23091. // Need to sort the directives so that we get consistent results throughout,
  23092. // as selectorMatcher uses Maps inside.
  23093. // Also deduplicate directives as they might match more than one time!
  23094. var directives = new Array(this.directivesIndex.size);
  23095. // Whether any directive selector matches on the element name
  23096. var matchElement = false;
  23097. selectorMatcher.match(elementCssSelector, function (selector, directive) {
  23098. directives[_this.directivesIndex.get(directive)] = directive;
  23099. matchElement = matchElement || selector.hasElementSelector();
  23100. });
  23101. return {
  23102. directives: directives.filter(function (dir) { return !!dir; }),
  23103. matchElement: matchElement,
  23104. };
  23105. };
  23106. TemplateParseVisitor.prototype._createDirectiveAsts = function (isTemplateElement, elementName, directives, props, elementOrDirectiveRefs, elementSourceSpan, targetReferences, targetBoundDirectivePropNames) {
  23107. var _this = this;
  23108. var matchedReferences = new Set();
  23109. var component = null;
  23110. var directiveAsts = directives.map(function (directive) {
  23111. var sourceSpan = new ParseSourceSpan(elementSourceSpan.start, elementSourceSpan.end, "Directive " + identifierName(directive.type));
  23112. if (directive.isComponent) {
  23113. component = directive;
  23114. }
  23115. var directiveProperties = [];
  23116. var boundProperties = _this._bindingParser.createDirectiveHostPropertyAsts(directive, elementName, sourceSpan);
  23117. var hostProperties = boundProperties.map(function (prop) { return BoundElementPropertyAst.fromBoundProperty(prop); });
  23118. // Note: We need to check the host properties here as well,
  23119. // as we don't know the element name in the DirectiveWrapperCompiler yet.
  23120. hostProperties = _this._checkPropertiesInSchema(elementName, hostProperties);
  23121. var parsedEvents = _this._bindingParser.createDirectiveHostEventAsts(directive, sourceSpan);
  23122. _this._createDirectivePropertyAsts(directive.inputs, props, directiveProperties, targetBoundDirectivePropNames);
  23123. elementOrDirectiveRefs.forEach(function (elOrDirRef) {
  23124. if ((elOrDirRef.value.length === 0 && directive.isComponent) ||
  23125. (elOrDirRef.isReferenceToDirective(directive))) {
  23126. targetReferences.push(new ReferenceAst(elOrDirRef.name, createTokenForReference(directive.type.reference), elOrDirRef.value, elOrDirRef.sourceSpan));
  23127. matchedReferences.add(elOrDirRef.name);
  23128. }
  23129. });
  23130. var hostEvents = parsedEvents.map(function (e) { return BoundEventAst.fromParsedEvent(e); });
  23131. var contentQueryStartId = _this.contentQueryStartId;
  23132. _this.contentQueryStartId += directive.queries.length;
  23133. return new DirectiveAst(directive, directiveProperties, hostProperties, hostEvents, contentQueryStartId, sourceSpan);
  23134. });
  23135. elementOrDirectiveRefs.forEach(function (elOrDirRef) {
  23136. if (elOrDirRef.value.length > 0) {
  23137. if (!matchedReferences.has(elOrDirRef.name)) {
  23138. _this._reportError("There is no directive with \"exportAs\" set to \"" + elOrDirRef.value + "\"", elOrDirRef.sourceSpan);
  23139. }
  23140. }
  23141. else if (!component) {
  23142. var refToken = null;
  23143. if (isTemplateElement) {
  23144. refToken = createTokenForExternalReference(_this.reflector, Identifiers.TemplateRef);
  23145. }
  23146. targetReferences.push(new ReferenceAst(elOrDirRef.name, refToken, elOrDirRef.value, elOrDirRef.sourceSpan));
  23147. }
  23148. });
  23149. return directiveAsts;
  23150. };
  23151. TemplateParseVisitor.prototype._createDirectivePropertyAsts = function (directiveProperties, boundProps, targetBoundDirectiveProps, targetBoundDirectivePropNames) {
  23152. if (directiveProperties) {
  23153. var boundPropsByName_1 = new Map();
  23154. boundProps.forEach(function (boundProp) {
  23155. var prevValue = boundPropsByName_1.get(boundProp.name);
  23156. if (!prevValue || prevValue.isLiteral) {
  23157. // give [a]="b" a higher precedence than a="b" on the same element
  23158. boundPropsByName_1.set(boundProp.name, boundProp);
  23159. }
  23160. });
  23161. Object.keys(directiveProperties).forEach(function (dirProp) {
  23162. var elProp = directiveProperties[dirProp];
  23163. var boundProp = boundPropsByName_1.get(elProp);
  23164. // Bindings are optional, so this binding only needs to be set up if an expression is given.
  23165. if (boundProp) {
  23166. targetBoundDirectivePropNames.add(boundProp.name);
  23167. if (!isEmptyExpression(boundProp.expression)) {
  23168. targetBoundDirectiveProps.push(new BoundDirectivePropertyAst(dirProp, boundProp.name, boundProp.expression, boundProp.sourceSpan));
  23169. }
  23170. }
  23171. });
  23172. }
  23173. };
  23174. TemplateParseVisitor.prototype._createElementPropertyAsts = function (elementName, props, boundDirectivePropNames) {
  23175. var _this = this;
  23176. var boundElementProps = [];
  23177. props.forEach(function (prop) {
  23178. if (!prop.isLiteral && !boundDirectivePropNames.has(prop.name)) {
  23179. var boundProp = _this._bindingParser.createBoundElementProperty(elementName, prop);
  23180. boundElementProps.push(BoundElementPropertyAst.fromBoundProperty(boundProp));
  23181. }
  23182. });
  23183. return this._checkPropertiesInSchema(elementName, boundElementProps);
  23184. };
  23185. TemplateParseVisitor.prototype._findComponentDirectives = function (directives) {
  23186. return directives.filter(function (directive) { return directive.directive.isComponent; });
  23187. };
  23188. TemplateParseVisitor.prototype._findComponentDirectiveNames = function (directives) {
  23189. return this._findComponentDirectives(directives)
  23190. .map(function (directive) { return identifierName(directive.directive.type); });
  23191. };
  23192. TemplateParseVisitor.prototype._assertOnlyOneComponent = function (directives, sourceSpan) {
  23193. var componentTypeNames = this._findComponentDirectiveNames(directives);
  23194. if (componentTypeNames.length > 1) {
  23195. this._reportError("More than one component matched on this element.\n" +
  23196. "Make sure that only one component's selector can match a given element.\n" +
  23197. ("Conflicting components: " + componentTypeNames.join(',')), sourceSpan);
  23198. }
  23199. };
  23200. /**
  23201. * Make sure that non-angular tags conform to the schemas.
  23202. *
  23203. * Note: An element is considered an angular tag when at least one directive selector matches the
  23204. * tag name.
  23205. *
  23206. * @param matchElement Whether any directive has matched on the tag name
  23207. * @param element the html element
  23208. */
  23209. TemplateParseVisitor.prototype._assertElementExists = function (matchElement, element) {
  23210. var elName = element.name.replace(/^:xhtml:/, '');
  23211. if (!matchElement && !this._schemaRegistry.hasElement(elName, this._schemas)) {
  23212. var errorMsg = "'" + elName + "' is not a known element:\n";
  23213. errorMsg +=
  23214. "1. If '" + elName + "' is an Angular component, then verify that it is part of this module.\n";
  23215. if (elName.indexOf('-') > -1) {
  23216. errorMsg +=
  23217. "2. If '" + elName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.";
  23218. }
  23219. else {
  23220. errorMsg +=
  23221. "2. To allow any element add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
  23222. }
  23223. this._reportError(errorMsg, element.sourceSpan);
  23224. }
  23225. };
  23226. TemplateParseVisitor.prototype._assertNoComponentsNorElementBindingsOnTemplate = function (directives, elementProps, sourceSpan) {
  23227. var _this = this;
  23228. var componentTypeNames = this._findComponentDirectiveNames(directives);
  23229. if (componentTypeNames.length > 0) {
  23230. this._reportError("Components on an embedded template: " + componentTypeNames.join(','), sourceSpan);
  23231. }
  23232. elementProps.forEach(function (prop) {
  23233. _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);
  23234. });
  23235. };
  23236. TemplateParseVisitor.prototype._assertAllEventsPublishedByDirectives = function (directives, events) {
  23237. var _this = this;
  23238. var allDirectiveEvents = new Set();
  23239. directives.forEach(function (directive) {
  23240. Object.keys(directive.directive.outputs).forEach(function (k) {
  23241. var eventName = directive.directive.outputs[k];
  23242. allDirectiveEvents.add(eventName);
  23243. });
  23244. });
  23245. events.forEach(function (event) {
  23246. if (event.target != null || !allDirectiveEvents.has(event.name)) {
  23247. _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);
  23248. }
  23249. });
  23250. };
  23251. TemplateParseVisitor.prototype._checkPropertiesInSchema = function (elementName, boundProps) {
  23252. var _this = this;
  23253. // Note: We can't filter out empty expressions before this method,
  23254. // as we still want to validate them!
  23255. return boundProps.filter(function (boundProp) {
  23256. if (boundProp.type === 0 /* Property */ &&
  23257. !_this._schemaRegistry.hasProperty(elementName, boundProp.name, _this._schemas)) {
  23258. var errorMsg = "Can't bind to '" + boundProp.name + "' since it isn't a known property of '" + elementName + "'.";
  23259. if (elementName.startsWith('ng-')) {
  23260. errorMsg +=
  23261. "\n1. If '" + boundProp.name + "' is an Angular directive, then add 'CommonModule' to the '@NgModule.imports' of this component." +
  23262. "\n2. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
  23263. }
  23264. else if (elementName.indexOf('-') > -1) {
  23265. errorMsg +=
  23266. "\n1. If '" + elementName + "' is an Angular component and it has '" + boundProp.name + "' input, then verify that it is part of this module." +
  23267. ("\n2. If '" + elementName + "' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the '@NgModule.schemas' of this component to suppress this message.") +
  23268. "\n3. To allow any property add 'NO_ERRORS_SCHEMA' to the '@NgModule.schemas' of this component.";
  23269. }
  23270. _this._reportError(errorMsg, boundProp.sourceSpan);
  23271. }
  23272. return !isEmptyExpression(boundProp.value);
  23273. });
  23274. };
  23275. TemplateParseVisitor.prototype._reportError = function (message, sourceSpan, level) {
  23276. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  23277. this._targetErrors.push(new ParseError(sourceSpan, message, level));
  23278. };
  23279. return TemplateParseVisitor;
  23280. }());
  23281. var NonBindableVisitor = /** @class */ (function () {
  23282. function NonBindableVisitor() {
  23283. }
  23284. NonBindableVisitor.prototype.visitElement = function (ast, parent) {
  23285. var preparsedElement = preparseElement(ast);
  23286. if (preparsedElement.type === PreparsedElementType.SCRIPT ||
  23287. preparsedElement.type === PreparsedElementType.STYLE ||
  23288. preparsedElement.type === PreparsedElementType.STYLESHEET) {
  23289. // Skipping <script> for security reasons
  23290. // Skipping <style> and stylesheets as we already processed them
  23291. // in the StyleCompiler
  23292. return null;
  23293. }
  23294. var attrNameAndValues = ast.attrs.map(function (attr) { return [attr.name, attr.value]; });
  23295. var selector = createElementCssSelector(ast.name, attrNameAndValues);
  23296. var ngContentIndex = parent.findNgContentIndex(selector);
  23297. var children = visitAll(this, ast.children, EMPTY_ELEMENT_CONTEXT);
  23298. return new ElementAst(ast.name, visitAll(this, ast.attrs), [], [], [], [], [], false, [], children, ngContentIndex, ast.sourceSpan, ast.endSourceSpan);
  23299. };
  23300. NonBindableVisitor.prototype.visitComment = function (comment, context) { return null; };
  23301. NonBindableVisitor.prototype.visitAttribute = function (attribute, context) {
  23302. return new AttrAst(attribute.name, attribute.value, attribute.sourceSpan);
  23303. };
  23304. NonBindableVisitor.prototype.visitText = function (text, parent) {
  23305. var ngContentIndex = parent.findNgContentIndex(TEXT_CSS_SELECTOR());
  23306. return new TextAst(text.value, ngContentIndex, text.sourceSpan);
  23307. };
  23308. NonBindableVisitor.prototype.visitExpansion = function (expansion, context) { return expansion; };
  23309. NonBindableVisitor.prototype.visitExpansionCase = function (expansionCase, context) { return expansionCase; };
  23310. return NonBindableVisitor;
  23311. }());
  23312. /**
  23313. * A reference to an element or directive in a template. E.g., the reference in this template:
  23314. *
  23315. * <div #myMenu="coolMenu">
  23316. *
  23317. * would be {name: 'myMenu', value: 'coolMenu', sourceSpan: ...}
  23318. */
  23319. var ElementOrDirectiveRef = /** @class */ (function () {
  23320. function ElementOrDirectiveRef(name, value, sourceSpan) {
  23321. this.name = name;
  23322. this.value = value;
  23323. this.sourceSpan = sourceSpan;
  23324. }
  23325. /** Gets whether this is a reference to the given directive. */
  23326. ElementOrDirectiveRef.prototype.isReferenceToDirective = function (directive) {
  23327. return splitExportAs(directive.exportAs).indexOf(this.value) !== -1;
  23328. };
  23329. return ElementOrDirectiveRef;
  23330. }());
  23331. /** Splits a raw, potentially comma-delimited `exportAs` value into an array of names. */
  23332. function splitExportAs(exportAs) {
  23333. return exportAs ? exportAs.split(',').map(function (e) { return e.trim(); }) : [];
  23334. }
  23335. function splitClasses(classAttrValue) {
  23336. return classAttrValue.trim().split(/\s+/g);
  23337. }
  23338. var ElementContext = /** @class */ (function () {
  23339. function ElementContext(isTemplateElement, _ngContentIndexMatcher, _wildcardNgContentIndex, providerContext) {
  23340. this.isTemplateElement = isTemplateElement;
  23341. this._ngContentIndexMatcher = _ngContentIndexMatcher;
  23342. this._wildcardNgContentIndex = _wildcardNgContentIndex;
  23343. this.providerContext = providerContext;
  23344. }
  23345. ElementContext.create = function (isTemplateElement, directives, providerContext) {
  23346. var matcher = new SelectorMatcher();
  23347. var wildcardNgContentIndex = null;
  23348. var component = directives.find(function (directive) { return directive.directive.isComponent; });
  23349. if (component) {
  23350. var ngContentSelectors = component.directive.template.ngContentSelectors;
  23351. for (var i = 0; i < ngContentSelectors.length; i++) {
  23352. var selector = ngContentSelectors[i];
  23353. if (selector === '*') {
  23354. wildcardNgContentIndex = i;
  23355. }
  23356. else {
  23357. matcher.addSelectables(CssSelector.parse(ngContentSelectors[i]), i);
  23358. }
  23359. }
  23360. }
  23361. return new ElementContext(isTemplateElement, matcher, wildcardNgContentIndex, providerContext);
  23362. };
  23363. ElementContext.prototype.findNgContentIndex = function (selector) {
  23364. var ngContentIndices = [];
  23365. this._ngContentIndexMatcher.match(selector, function (selector, ngContentIndex) { ngContentIndices.push(ngContentIndex); });
  23366. ngContentIndices.sort();
  23367. if (this._wildcardNgContentIndex != null) {
  23368. ngContentIndices.push(this._wildcardNgContentIndex);
  23369. }
  23370. return ngContentIndices.length > 0 ? ngContentIndices[0] : null;
  23371. };
  23372. return ElementContext;
  23373. }());
  23374. function createElementCssSelector(elementName, attributes) {
  23375. var cssSelector = new CssSelector();
  23376. var elNameNoNs = splitNsName(elementName)[1];
  23377. cssSelector.setElement(elNameNoNs);
  23378. for (var i = 0; i < attributes.length; i++) {
  23379. var attrName = attributes[i][0];
  23380. var attrNameNoNs = splitNsName(attrName)[1];
  23381. var attrValue = attributes[i][1];
  23382. cssSelector.addAttribute(attrNameNoNs, attrValue);
  23383. if (attrName.toLowerCase() == CLASS_ATTR) {
  23384. var classes = splitClasses(attrValue);
  23385. classes.forEach(function (className) { return cssSelector.addClassName(className); });
  23386. }
  23387. }
  23388. return cssSelector;
  23389. }
  23390. var EMPTY_ELEMENT_CONTEXT = new ElementContext(true, new SelectorMatcher(), null, null);
  23391. var NON_BINDABLE_VISITOR = new NonBindableVisitor();
  23392. function _isEmptyTextNode(node) {
  23393. return node instanceof Text && node.value.trim().length == 0;
  23394. }
  23395. function removeSummaryDuplicates(items) {
  23396. var map = new Map();
  23397. items.forEach(function (item) {
  23398. if (!map.get(item.type.reference)) {
  23399. map.set(item.type.reference, item);
  23400. }
  23401. });
  23402. return Array.from(map.values());
  23403. }
  23404. function isEmptyExpression(ast) {
  23405. if (ast instanceof ASTWithSource) {
  23406. ast = ast.ast;
  23407. }
  23408. return ast instanceof EmptyExpr;
  23409. }
  23410. /**
  23411. * @license
  23412. * Copyright Google Inc. All Rights Reserved.
  23413. *
  23414. * Use of this source code is governed by an MIT-style license that can be
  23415. * found in the LICENSE file at https://angular.io/license
  23416. */
  23417. var EventHandlerVars = /** @class */ (function () {
  23418. function EventHandlerVars() {
  23419. }
  23420. EventHandlerVars.event = variable('$event');
  23421. return EventHandlerVars;
  23422. }());
  23423. var ConvertActionBindingResult = /** @class */ (function () {
  23424. function ConvertActionBindingResult(
  23425. /**
  23426. * Render2 compatible statements,
  23427. */
  23428. stmts,
  23429. /**
  23430. * Variable name used with render2 compatible statements.
  23431. */
  23432. allowDefault) {
  23433. this.stmts = stmts;
  23434. this.allowDefault = allowDefault;
  23435. /**
  23436. * This is bit of a hack. It converts statements which render2 expects to statements which are
  23437. * expected by render3.
  23438. *
  23439. * Example: `<div click="doSomething($event)">` will generate:
  23440. *
  23441. * Render3:
  23442. * ```
  23443. * const pd_b:any = ((<any>ctx.doSomething($event)) !== false);
  23444. * return pd_b;
  23445. * ```
  23446. *
  23447. * but render2 expects:
  23448. * ```
  23449. * return ctx.doSomething($event);
  23450. * ```
  23451. */
  23452. // TODO(misko): remove this hack once we no longer support ViewEngine.
  23453. this.render3Stmts = stmts.map(function (statement) {
  23454. if (statement instanceof DeclareVarStmt && statement.name == allowDefault.name &&
  23455. statement.value instanceof BinaryOperatorExpr) {
  23456. var lhs = statement.value.lhs;
  23457. return new ReturnStatement(lhs.value);
  23458. }
  23459. return statement;
  23460. });
  23461. }
  23462. return ConvertActionBindingResult;
  23463. }());
  23464. /**
  23465. * Converts the given expression AST into an executable output AST, assuming the expression is
  23466. * used in an action binding (e.g. an event handler).
  23467. */
  23468. function convertActionBinding(localResolver, implicitReceiver, action, bindingId, interpolationFunction) {
  23469. if (!localResolver) {
  23470. localResolver = new DefaultLocalResolver();
  23471. }
  23472. var actionWithoutBuiltins = convertPropertyBindingBuiltins({
  23473. createLiteralArrayConverter: function (argCount) {
  23474. // Note: no caching for literal arrays in actions.
  23475. return function (args) { return literalArr(args); };
  23476. },
  23477. createLiteralMapConverter: function (keys) {
  23478. // Note: no caching for literal maps in actions.
  23479. return function (values) {
  23480. var entries = keys.map(function (k, i) { return ({
  23481. key: k.key,
  23482. value: values[i],
  23483. quoted: k.quoted,
  23484. }); });
  23485. return literalMap(entries);
  23486. };
  23487. },
  23488. createPipeConverter: function (name) {
  23489. throw new Error("Illegal State: Actions are not allowed to contain pipes. Pipe: " + name);
  23490. }
  23491. }, action);
  23492. var visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, interpolationFunction);
  23493. var actionStmts = [];
  23494. flattenStatements(actionWithoutBuiltins.visit(visitor, _Mode.Statement), actionStmts);
  23495. prependTemporaryDecls(visitor.temporaryCount, bindingId, actionStmts);
  23496. var lastIndex = actionStmts.length - 1;
  23497. var preventDefaultVar = null;
  23498. if (lastIndex >= 0) {
  23499. var lastStatement = actionStmts[lastIndex];
  23500. var returnExpr = convertStmtIntoExpression(lastStatement);
  23501. if (returnExpr) {
  23502. // Note: We need to cast the result of the method call to dynamic,
  23503. // as it might be a void method!
  23504. preventDefaultVar = createPreventDefaultVar(bindingId);
  23505. actionStmts[lastIndex] =
  23506. preventDefaultVar.set(returnExpr.cast(DYNAMIC_TYPE).notIdentical(literal(false)))
  23507. .toDeclStmt(null, [StmtModifier.Final]);
  23508. }
  23509. }
  23510. return new ConvertActionBindingResult(actionStmts, preventDefaultVar);
  23511. }
  23512. function convertPropertyBindingBuiltins(converterFactory, ast) {
  23513. return convertBuiltins(converterFactory, ast);
  23514. }
  23515. var ConvertPropertyBindingResult = /** @class */ (function () {
  23516. function ConvertPropertyBindingResult(stmts, currValExpr) {
  23517. this.stmts = stmts;
  23518. this.currValExpr = currValExpr;
  23519. }
  23520. return ConvertPropertyBindingResult;
  23521. }());
  23522. var BindingForm;
  23523. (function (BindingForm) {
  23524. // The general form of binding expression, supports all expressions.
  23525. BindingForm[BindingForm["General"] = 0] = "General";
  23526. // Try to generate a simple binding (no temporaries or statements)
  23527. // otherwise generate a general binding
  23528. BindingForm[BindingForm["TrySimple"] = 1] = "TrySimple";
  23529. })(BindingForm || (BindingForm = {}));
  23530. /**
  23531. * Converts the given expression AST into an executable output AST, assuming the expression
  23532. * is used in property binding. The expression has to be preprocessed via
  23533. * `convertPropertyBindingBuiltins`.
  23534. */
  23535. function convertPropertyBinding(localResolver, implicitReceiver, expressionWithoutBuiltins, bindingId, form, interpolationFunction) {
  23536. if (!localResolver) {
  23537. localResolver = new DefaultLocalResolver();
  23538. }
  23539. var currValExpr = createCurrValueExpr(bindingId);
  23540. var stmts = [];
  23541. var visitor = new _AstToIrVisitor(localResolver, implicitReceiver, bindingId, interpolationFunction);
  23542. var outputExpr = expressionWithoutBuiltins.visit(visitor, _Mode.Expression);
  23543. if (visitor.temporaryCount) {
  23544. for (var i = 0; i < visitor.temporaryCount; i++) {
  23545. stmts.push(temporaryDeclaration(bindingId, i));
  23546. }
  23547. }
  23548. else if (form == BindingForm.TrySimple) {
  23549. return new ConvertPropertyBindingResult([], outputExpr);
  23550. }
  23551. stmts.push(currValExpr.set(outputExpr).toDeclStmt(DYNAMIC_TYPE, [StmtModifier.Final]));
  23552. return new ConvertPropertyBindingResult(stmts, currValExpr);
  23553. }
  23554. function convertBuiltins(converterFactory, ast) {
  23555. var visitor = new _BuiltinAstConverter(converterFactory);
  23556. return ast.visit(visitor);
  23557. }
  23558. function temporaryName(bindingId, temporaryNumber) {
  23559. return "tmp_" + bindingId + "_" + temporaryNumber;
  23560. }
  23561. function temporaryDeclaration(bindingId, temporaryNumber) {
  23562. return new DeclareVarStmt(temporaryName(bindingId, temporaryNumber), NULL_EXPR);
  23563. }
  23564. function prependTemporaryDecls(temporaryCount, bindingId, statements) {
  23565. for (var i = temporaryCount - 1; i >= 0; i--) {
  23566. statements.unshift(temporaryDeclaration(bindingId, i));
  23567. }
  23568. }
  23569. var _Mode;
  23570. (function (_Mode) {
  23571. _Mode[_Mode["Statement"] = 0] = "Statement";
  23572. _Mode[_Mode["Expression"] = 1] = "Expression";
  23573. })(_Mode || (_Mode = {}));
  23574. function ensureStatementMode(mode, ast) {
  23575. if (mode !== _Mode.Statement) {
  23576. throw new Error("Expected a statement, but saw " + ast);
  23577. }
  23578. }
  23579. function ensureExpressionMode(mode, ast) {
  23580. if (mode !== _Mode.Expression) {
  23581. throw new Error("Expected an expression, but saw " + ast);
  23582. }
  23583. }
  23584. function convertToStatementIfNeeded(mode, expr) {
  23585. if (mode === _Mode.Statement) {
  23586. return expr.toStmt();
  23587. }
  23588. else {
  23589. return expr;
  23590. }
  23591. }
  23592. var _BuiltinAstConverter = /** @class */ (function (_super) {
  23593. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(_BuiltinAstConverter, _super);
  23594. function _BuiltinAstConverter(_converterFactory) {
  23595. var _this = _super.call(this) || this;
  23596. _this._converterFactory = _converterFactory;
  23597. return _this;
  23598. }
  23599. _BuiltinAstConverter.prototype.visitPipe = function (ast, context) {
  23600. var _this = this;
  23601. var args = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([ast.exp], ast.args).map(function (ast) { return ast.visit(_this, context); });
  23602. return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createPipeConverter(ast.name, args.length));
  23603. };
  23604. _BuiltinAstConverter.prototype.visitLiteralArray = function (ast, context) {
  23605. var _this = this;
  23606. var args = ast.expressions.map(function (ast) { return ast.visit(_this, context); });
  23607. return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralArrayConverter(ast.expressions.length));
  23608. };
  23609. _BuiltinAstConverter.prototype.visitLiteralMap = function (ast, context) {
  23610. var _this = this;
  23611. var args = ast.values.map(function (ast) { return ast.visit(_this, context); });
  23612. return new BuiltinFunctionCall(ast.span, args, this._converterFactory.createLiteralMapConverter(ast.keys));
  23613. };
  23614. return _BuiltinAstConverter;
  23615. }(AstTransformer));
  23616. var _AstToIrVisitor = /** @class */ (function () {
  23617. function _AstToIrVisitor(_localResolver, _implicitReceiver, bindingId, interpolationFunction) {
  23618. this._localResolver = _localResolver;
  23619. this._implicitReceiver = _implicitReceiver;
  23620. this.bindingId = bindingId;
  23621. this.interpolationFunction = interpolationFunction;
  23622. this._nodeMap = new Map();
  23623. this._resultMap = new Map();
  23624. this._currentTemporary = 0;
  23625. this.temporaryCount = 0;
  23626. }
  23627. _AstToIrVisitor.prototype.visitBinary = function (ast, mode) {
  23628. var op;
  23629. switch (ast.operation) {
  23630. case '+':
  23631. op = BinaryOperator.Plus;
  23632. break;
  23633. case '-':
  23634. op = BinaryOperator.Minus;
  23635. break;
  23636. case '*':
  23637. op = BinaryOperator.Multiply;
  23638. break;
  23639. case '/':
  23640. op = BinaryOperator.Divide;
  23641. break;
  23642. case '%':
  23643. op = BinaryOperator.Modulo;
  23644. break;
  23645. case '&&':
  23646. op = BinaryOperator.And;
  23647. break;
  23648. case '||':
  23649. op = BinaryOperator.Or;
  23650. break;
  23651. case '==':
  23652. op = BinaryOperator.Equals;
  23653. break;
  23654. case '!=':
  23655. op = BinaryOperator.NotEquals;
  23656. break;
  23657. case '===':
  23658. op = BinaryOperator.Identical;
  23659. break;
  23660. case '!==':
  23661. op = BinaryOperator.NotIdentical;
  23662. break;
  23663. case '<':
  23664. op = BinaryOperator.Lower;
  23665. break;
  23666. case '>':
  23667. op = BinaryOperator.Bigger;
  23668. break;
  23669. case '<=':
  23670. op = BinaryOperator.LowerEquals;
  23671. break;
  23672. case '>=':
  23673. op = BinaryOperator.BiggerEquals;
  23674. break;
  23675. default:
  23676. throw new Error("Unsupported operation " + ast.operation);
  23677. }
  23678. return convertToStatementIfNeeded(mode, new BinaryOperatorExpr(op, this._visit(ast.left, _Mode.Expression), this._visit(ast.right, _Mode.Expression)));
  23679. };
  23680. _AstToIrVisitor.prototype.visitChain = function (ast, mode) {
  23681. ensureStatementMode(mode, ast);
  23682. return this.visitAll(ast.expressions, mode);
  23683. };
  23684. _AstToIrVisitor.prototype.visitConditional = function (ast, mode) {
  23685. var value = this._visit(ast.condition, _Mode.Expression);
  23686. return convertToStatementIfNeeded(mode, value.conditional(this._visit(ast.trueExp, _Mode.Expression), this._visit(ast.falseExp, _Mode.Expression)));
  23687. };
  23688. _AstToIrVisitor.prototype.visitPipe = function (ast, mode) {
  23689. throw new Error("Illegal state: Pipes should have been converted into functions. Pipe: " + ast.name);
  23690. };
  23691. _AstToIrVisitor.prototype.visitFunctionCall = function (ast, mode) {
  23692. var convertedArgs = this.visitAll(ast.args, _Mode.Expression);
  23693. var fnResult;
  23694. if (ast instanceof BuiltinFunctionCall) {
  23695. fnResult = ast.converter(convertedArgs);
  23696. }
  23697. else {
  23698. fnResult = this._visit(ast.target, _Mode.Expression).callFn(convertedArgs);
  23699. }
  23700. return convertToStatementIfNeeded(mode, fnResult);
  23701. };
  23702. _AstToIrVisitor.prototype.visitImplicitReceiver = function (ast, mode) {
  23703. ensureExpressionMode(mode, ast);
  23704. return this._implicitReceiver;
  23705. };
  23706. _AstToIrVisitor.prototype.visitInterpolation = function (ast, mode) {
  23707. ensureExpressionMode(mode, ast);
  23708. var args = [literal(ast.expressions.length)];
  23709. for (var i = 0; i < ast.strings.length - 1; i++) {
  23710. args.push(literal(ast.strings[i]));
  23711. args.push(this._visit(ast.expressions[i], _Mode.Expression));
  23712. }
  23713. args.push(literal(ast.strings[ast.strings.length - 1]));
  23714. if (this.interpolationFunction) {
  23715. return this.interpolationFunction(args);
  23716. }
  23717. return ast.expressions.length <= 9 ?
  23718. importExpr(Identifiers.inlineInterpolate).callFn(args) :
  23719. importExpr(Identifiers.interpolate).callFn([args[0], literalArr(args.slice(1))]);
  23720. };
  23721. _AstToIrVisitor.prototype.visitKeyedRead = function (ast, mode) {
  23722. var leftMostSafe = this.leftMostSafeNode(ast);
  23723. if (leftMostSafe) {
  23724. return this.convertSafeAccess(ast, leftMostSafe, mode);
  23725. }
  23726. else {
  23727. return convertToStatementIfNeeded(mode, this._visit(ast.obj, _Mode.Expression).key(this._visit(ast.key, _Mode.Expression)));
  23728. }
  23729. };
  23730. _AstToIrVisitor.prototype.visitKeyedWrite = function (ast, mode) {
  23731. var obj = this._visit(ast.obj, _Mode.Expression);
  23732. var key = this._visit(ast.key, _Mode.Expression);
  23733. var value = this._visit(ast.value, _Mode.Expression);
  23734. return convertToStatementIfNeeded(mode, obj.key(key).set(value));
  23735. };
  23736. _AstToIrVisitor.prototype.visitLiteralArray = function (ast, mode) {
  23737. throw new Error("Illegal State: literal arrays should have been converted into functions");
  23738. };
  23739. _AstToIrVisitor.prototype.visitLiteralMap = function (ast, mode) {
  23740. throw new Error("Illegal State: literal maps should have been converted into functions");
  23741. };
  23742. _AstToIrVisitor.prototype.visitLiteralPrimitive = function (ast, mode) {
  23743. // For literal values of null, undefined, true, or false allow type interference
  23744. // to infer the type.
  23745. var type = ast.value === null || ast.value === undefined || ast.value === true || ast.value === true ?
  23746. INFERRED_TYPE :
  23747. undefined;
  23748. return convertToStatementIfNeeded(mode, literal(ast.value, type));
  23749. };
  23750. _AstToIrVisitor.prototype._getLocal = function (name) { return this._localResolver.getLocal(name); };
  23751. _AstToIrVisitor.prototype.visitMethodCall = function (ast, mode) {
  23752. if (ast.receiver instanceof ImplicitReceiver && ast.name == '$any') {
  23753. var args = this.visitAll(ast.args, _Mode.Expression);
  23754. if (args.length != 1) {
  23755. throw new Error("Invalid call to $any, expected 1 argument but received " + (args.length || 'none'));
  23756. }
  23757. return args[0].cast(DYNAMIC_TYPE);
  23758. }
  23759. var leftMostSafe = this.leftMostSafeNode(ast);
  23760. if (leftMostSafe) {
  23761. return this.convertSafeAccess(ast, leftMostSafe, mode);
  23762. }
  23763. else {
  23764. var args = this.visitAll(ast.args, _Mode.Expression);
  23765. var result = null;
  23766. var receiver = this._visit(ast.receiver, _Mode.Expression);
  23767. if (receiver === this._implicitReceiver) {
  23768. var varExpr = this._getLocal(ast.name);
  23769. if (varExpr) {
  23770. result = varExpr.callFn(args);
  23771. }
  23772. }
  23773. if (result == null) {
  23774. result = receiver.callMethod(ast.name, args);
  23775. }
  23776. return convertToStatementIfNeeded(mode, result);
  23777. }
  23778. };
  23779. _AstToIrVisitor.prototype.visitPrefixNot = function (ast, mode) {
  23780. return convertToStatementIfNeeded(mode, not(this._visit(ast.expression, _Mode.Expression)));
  23781. };
  23782. _AstToIrVisitor.prototype.visitNonNullAssert = function (ast, mode) {
  23783. return convertToStatementIfNeeded(mode, assertNotNull(this._visit(ast.expression, _Mode.Expression)));
  23784. };
  23785. _AstToIrVisitor.prototype.visitPropertyRead = function (ast, mode) {
  23786. var leftMostSafe = this.leftMostSafeNode(ast);
  23787. if (leftMostSafe) {
  23788. return this.convertSafeAccess(ast, leftMostSafe, mode);
  23789. }
  23790. else {
  23791. var result = null;
  23792. var receiver = this._visit(ast.receiver, _Mode.Expression);
  23793. if (receiver === this._implicitReceiver) {
  23794. result = this._getLocal(ast.name);
  23795. }
  23796. if (result == null) {
  23797. result = receiver.prop(ast.name);
  23798. }
  23799. return convertToStatementIfNeeded(mode, result);
  23800. }
  23801. };
  23802. _AstToIrVisitor.prototype.visitPropertyWrite = function (ast, mode) {
  23803. var receiver = this._visit(ast.receiver, _Mode.Expression);
  23804. if (receiver === this._implicitReceiver) {
  23805. var varExpr = this._getLocal(ast.name);
  23806. if (varExpr) {
  23807. throw new Error('Cannot assign to a reference or variable!');
  23808. }
  23809. }
  23810. return convertToStatementIfNeeded(mode, receiver.prop(ast.name).set(this._visit(ast.value, _Mode.Expression)));
  23811. };
  23812. _AstToIrVisitor.prototype.visitSafePropertyRead = function (ast, mode) {
  23813. return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
  23814. };
  23815. _AstToIrVisitor.prototype.visitSafeMethodCall = function (ast, mode) {
  23816. return this.convertSafeAccess(ast, this.leftMostSafeNode(ast), mode);
  23817. };
  23818. _AstToIrVisitor.prototype.visitAll = function (asts, mode) {
  23819. var _this = this;
  23820. return asts.map(function (ast) { return _this._visit(ast, mode); });
  23821. };
  23822. _AstToIrVisitor.prototype.visitQuote = function (ast, mode) {
  23823. throw new Error("Quotes are not supported for evaluation!\n Statement: " + ast.uninterpretedExpression + " located at " + ast.location);
  23824. };
  23825. _AstToIrVisitor.prototype._visit = function (ast, mode) {
  23826. var result = this._resultMap.get(ast);
  23827. if (result)
  23828. return result;
  23829. return (this._nodeMap.get(ast) || ast).visit(this, mode);
  23830. };
  23831. _AstToIrVisitor.prototype.convertSafeAccess = function (ast, leftMostSafe, mode) {
  23832. // If the expression contains a safe access node on the left it needs to be converted to
  23833. // an expression that guards the access to the member by checking the receiver for blank. As
  23834. // execution proceeds from left to right, the left most part of the expression must be guarded
  23835. // first but, because member access is left associative, the right side of the expression is at
  23836. // the top of the AST. The desired result requires lifting a copy of the the left part of the
  23837. // expression up to test it for blank before generating the unguarded version.
  23838. // Consider, for example the following expression: a?.b.c?.d.e
  23839. // This results in the ast:
  23840. // .
  23841. // / \
  23842. // ?. e
  23843. // / \
  23844. // . d
  23845. // / \
  23846. // ?. c
  23847. // / \
  23848. // a b
  23849. // The following tree should be generated:
  23850. //
  23851. // /---- ? ----\
  23852. // / | \
  23853. // a /--- ? ---\ null
  23854. // / | \
  23855. // . . null
  23856. // / \ / \
  23857. // . c . e
  23858. // / \ / \
  23859. // a b , d
  23860. // / \
  23861. // . c
  23862. // / \
  23863. // a b
  23864. //
  23865. // Notice that the first guard condition is the left hand of the left most safe access node
  23866. // which comes in as leftMostSafe to this routine.
  23867. var guardedExpression = this._visit(leftMostSafe.receiver, _Mode.Expression);
  23868. var temporary = undefined;
  23869. if (this.needsTemporary(leftMostSafe.receiver)) {
  23870. // If the expression has method calls or pipes then we need to save the result into a
  23871. // temporary variable to avoid calling stateful or impure code more than once.
  23872. temporary = this.allocateTemporary();
  23873. // Preserve the result in the temporary variable
  23874. guardedExpression = temporary.set(guardedExpression);
  23875. // Ensure all further references to the guarded expression refer to the temporary instead.
  23876. this._resultMap.set(leftMostSafe.receiver, temporary);
  23877. }
  23878. var condition = guardedExpression.isBlank();
  23879. // Convert the ast to an unguarded access to the receiver's member. The map will substitute
  23880. // leftMostNode with its unguarded version in the call to `this.visit()`.
  23881. if (leftMostSafe instanceof SafeMethodCall) {
  23882. this._nodeMap.set(leftMostSafe, new MethodCall(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name, leftMostSafe.args));
  23883. }
  23884. else {
  23885. this._nodeMap.set(leftMostSafe, new PropertyRead(leftMostSafe.span, leftMostSafe.receiver, leftMostSafe.name));
  23886. }
  23887. // Recursively convert the node now without the guarded member access.
  23888. var access = this._visit(ast, _Mode.Expression);
  23889. // Remove the mapping. This is not strictly required as the converter only traverses each node
  23890. // once but is safer if the conversion is changed to traverse the nodes more than once.
  23891. this._nodeMap.delete(leftMostSafe);
  23892. // If we allocated a temporary, release it.
  23893. if (temporary) {
  23894. this.releaseTemporary(temporary);
  23895. }
  23896. // Produce the conditional
  23897. return convertToStatementIfNeeded(mode, condition.conditional(literal(null), access));
  23898. };
  23899. // Given a expression of the form a?.b.c?.d.e the the left most safe node is
  23900. // the (a?.b). The . and ?. are left associative thus can be rewritten as:
  23901. // ((((a?.c).b).c)?.d).e. This returns the most deeply nested safe read or
  23902. // safe method call as this needs be transform initially to:
  23903. // a == null ? null : a.c.b.c?.d.e
  23904. // then to:
  23905. // a == null ? null : a.b.c == null ? null : a.b.c.d.e
  23906. _AstToIrVisitor.prototype.leftMostSafeNode = function (ast) {
  23907. var _this = this;
  23908. var visit = function (visitor, ast) {
  23909. return (_this._nodeMap.get(ast) || ast).visit(visitor);
  23910. };
  23911. return ast.visit({
  23912. visitBinary: function (ast) { return null; },
  23913. visitChain: function (ast) { return null; },
  23914. visitConditional: function (ast) { return null; },
  23915. visitFunctionCall: function (ast) { return null; },
  23916. visitImplicitReceiver: function (ast) { return null; },
  23917. visitInterpolation: function (ast) { return null; },
  23918. visitKeyedRead: function (ast) { return visit(this, ast.obj); },
  23919. visitKeyedWrite: function (ast) { return null; },
  23920. visitLiteralArray: function (ast) { return null; },
  23921. visitLiteralMap: function (ast) { return null; },
  23922. visitLiteralPrimitive: function (ast) { return null; },
  23923. visitMethodCall: function (ast) { return visit(this, ast.receiver); },
  23924. visitPipe: function (ast) { return null; },
  23925. visitPrefixNot: function (ast) { return null; },
  23926. visitNonNullAssert: function (ast) { return null; },
  23927. visitPropertyRead: function (ast) { return visit(this, ast.receiver); },
  23928. visitPropertyWrite: function (ast) { return null; },
  23929. visitQuote: function (ast) { return null; },
  23930. visitSafeMethodCall: function (ast) { return visit(this, ast.receiver) || ast; },
  23931. visitSafePropertyRead: function (ast) {
  23932. return visit(this, ast.receiver) || ast;
  23933. }
  23934. });
  23935. };
  23936. // Returns true of the AST includes a method or a pipe indicating that, if the
  23937. // expression is used as the target of a safe property or method access then
  23938. // the expression should be stored into a temporary variable.
  23939. _AstToIrVisitor.prototype.needsTemporary = function (ast) {
  23940. var _this = this;
  23941. var visit = function (visitor, ast) {
  23942. return ast && (_this._nodeMap.get(ast) || ast).visit(visitor);
  23943. };
  23944. var visitSome = function (visitor, ast) {
  23945. return ast.some(function (ast) { return visit(visitor, ast); });
  23946. };
  23947. return ast.visit({
  23948. visitBinary: function (ast) { return visit(this, ast.left) || visit(this, ast.right); },
  23949. visitChain: function (ast) { return false; },
  23950. visitConditional: function (ast) {
  23951. return visit(this, ast.condition) || visit(this, ast.trueExp) ||
  23952. visit(this, ast.falseExp);
  23953. },
  23954. visitFunctionCall: function (ast) { return true; },
  23955. visitImplicitReceiver: function (ast) { return false; },
  23956. visitInterpolation: function (ast) { return visitSome(this, ast.expressions); },
  23957. visitKeyedRead: function (ast) { return false; },
  23958. visitKeyedWrite: function (ast) { return false; },
  23959. visitLiteralArray: function (ast) { return true; },
  23960. visitLiteralMap: function (ast) { return true; },
  23961. visitLiteralPrimitive: function (ast) { return false; },
  23962. visitMethodCall: function (ast) { return true; },
  23963. visitPipe: function (ast) { return true; },
  23964. visitPrefixNot: function (ast) { return visit(this, ast.expression); },
  23965. visitNonNullAssert: function (ast) { return visit(this, ast.expression); },
  23966. visitPropertyRead: function (ast) { return false; },
  23967. visitPropertyWrite: function (ast) { return false; },
  23968. visitQuote: function (ast) { return false; },
  23969. visitSafeMethodCall: function (ast) { return true; },
  23970. visitSafePropertyRead: function (ast) { return false; }
  23971. });
  23972. };
  23973. _AstToIrVisitor.prototype.allocateTemporary = function () {
  23974. var tempNumber = this._currentTemporary++;
  23975. this.temporaryCount = Math.max(this._currentTemporary, this.temporaryCount);
  23976. return new ReadVarExpr(temporaryName(this.bindingId, tempNumber));
  23977. };
  23978. _AstToIrVisitor.prototype.releaseTemporary = function (temporary) {
  23979. this._currentTemporary--;
  23980. if (temporary.name != temporaryName(this.bindingId, this._currentTemporary)) {
  23981. throw new Error("Temporary " + temporary.name + " released out of order");
  23982. }
  23983. };
  23984. return _AstToIrVisitor;
  23985. }());
  23986. function flattenStatements(arg, output) {
  23987. if (Array.isArray(arg)) {
  23988. arg.forEach(function (entry) { return flattenStatements(entry, output); });
  23989. }
  23990. else {
  23991. output.push(arg);
  23992. }
  23993. }
  23994. var DefaultLocalResolver = /** @class */ (function () {
  23995. function DefaultLocalResolver() {
  23996. }
  23997. DefaultLocalResolver.prototype.getLocal = function (name) {
  23998. if (name === EventHandlerVars.event.name) {
  23999. return EventHandlerVars.event;
  24000. }
  24001. return null;
  24002. };
  24003. return DefaultLocalResolver;
  24004. }());
  24005. function createCurrValueExpr(bindingId) {
  24006. return variable("currVal_" + bindingId); // fix syntax highlighting: `
  24007. }
  24008. function createPreventDefaultVar(bindingId) {
  24009. return variable("pd_" + bindingId);
  24010. }
  24011. function convertStmtIntoExpression(stmt) {
  24012. if (stmt instanceof ExpressionStatement) {
  24013. return stmt.expr;
  24014. }
  24015. else if (stmt instanceof ReturnStatement) {
  24016. return stmt.value;
  24017. }
  24018. return null;
  24019. }
  24020. var BuiltinFunctionCall = /** @class */ (function (_super) {
  24021. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BuiltinFunctionCall, _super);
  24022. function BuiltinFunctionCall(span, args, converter) {
  24023. var _this = _super.call(this, span, null, args) || this;
  24024. _this.args = args;
  24025. _this.converter = converter;
  24026. return _this;
  24027. }
  24028. return BuiltinFunctionCall;
  24029. }(FunctionCall));
  24030. /**
  24031. * @license
  24032. * Copyright Google Inc. All Rights Reserved.
  24033. *
  24034. * Use of this source code is governed by an MIT-style license that can be
  24035. * found in the LICENSE file at https://angular.io/license
  24036. */
  24037. /**
  24038. * Generates code that is used to type check templates.
  24039. */
  24040. var TypeCheckCompiler = /** @class */ (function () {
  24041. function TypeCheckCompiler(options, reflector) {
  24042. this.options = options;
  24043. this.reflector = reflector;
  24044. }
  24045. /**
  24046. * Important notes:
  24047. * - This must not produce new `import` statements, but only refer to types outside
  24048. * of the file via the variables provided via externalReferenceVars.
  24049. * This allows Typescript to reuse the old program's structure as no imports have changed.
  24050. * - This must not produce any exports, as this would pollute the .d.ts file
  24051. * and also violate the point above.
  24052. */
  24053. TypeCheckCompiler.prototype.compileComponent = function (componentId, component, template, usedPipes, externalReferenceVars, ctx) {
  24054. var _this = this;
  24055. var pipes = new Map();
  24056. usedPipes.forEach(function (p) { return pipes.set(p.name, p.type.reference); });
  24057. var embeddedViewCount = 0;
  24058. var viewBuilderFactory = function (parent, guards) {
  24059. var embeddedViewIndex = embeddedViewCount++;
  24060. return new ViewBuilder(_this.options, _this.reflector, externalReferenceVars, parent, component.type.reference, component.isHost, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory);
  24061. };
  24062. var visitor = viewBuilderFactory(null, []);
  24063. visitor.visitAll([], template);
  24064. return visitor.build(componentId);
  24065. };
  24066. return TypeCheckCompiler;
  24067. }());
  24068. var DYNAMIC_VAR_NAME = '_any';
  24069. var TypeCheckLocalResolver = /** @class */ (function () {
  24070. function TypeCheckLocalResolver() {
  24071. }
  24072. TypeCheckLocalResolver.prototype.getLocal = function (name) {
  24073. if (name === EventHandlerVars.event.name) {
  24074. // References to the event should not be type-checked.
  24075. // TODO(chuckj): determine a better type for the event.
  24076. return variable(DYNAMIC_VAR_NAME);
  24077. }
  24078. return null;
  24079. };
  24080. return TypeCheckLocalResolver;
  24081. }());
  24082. var defaultResolver = new TypeCheckLocalResolver();
  24083. var ViewBuilder = /** @class */ (function () {
  24084. function ViewBuilder(options, reflector, externalReferenceVars, parent, component, isHostComponent, embeddedViewIndex, pipes, guards, ctx, viewBuilderFactory) {
  24085. this.options = options;
  24086. this.reflector = reflector;
  24087. this.externalReferenceVars = externalReferenceVars;
  24088. this.parent = parent;
  24089. this.component = component;
  24090. this.isHostComponent = isHostComponent;
  24091. this.embeddedViewIndex = embeddedViewIndex;
  24092. this.pipes = pipes;
  24093. this.guards = guards;
  24094. this.ctx = ctx;
  24095. this.viewBuilderFactory = viewBuilderFactory;
  24096. this.refOutputVars = new Map();
  24097. this.variables = [];
  24098. this.children = [];
  24099. this.updates = [];
  24100. this.actions = [];
  24101. }
  24102. ViewBuilder.prototype.getOutputVar = function (type) {
  24103. var varName;
  24104. if (type === this.component && this.isHostComponent) {
  24105. varName = DYNAMIC_VAR_NAME;
  24106. }
  24107. else if (type instanceof StaticSymbol) {
  24108. varName = this.externalReferenceVars.get(type);
  24109. }
  24110. else {
  24111. varName = DYNAMIC_VAR_NAME;
  24112. }
  24113. if (!varName) {
  24114. throw new Error("Illegal State: referring to a type without a variable " + JSON.stringify(type));
  24115. }
  24116. return varName;
  24117. };
  24118. ViewBuilder.prototype.getTypeGuardExpressions = function (ast) {
  24119. var e_1, _a, e_2, _b;
  24120. var result = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(this.guards);
  24121. try {
  24122. for (var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(ast.directives), _d = _c.next(); !_d.done; _d = _c.next()) {
  24123. var directive = _d.value;
  24124. try {
  24125. for (var _e = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(directive.inputs), _f = _e.next(); !_f.done; _f = _e.next()) {
  24126. var input = _f.value;
  24127. var guard = directive.directive.guards[input.directiveName];
  24128. if (guard) {
  24129. var useIf = guard === 'UseIf';
  24130. result.push({
  24131. guard: guard,
  24132. useIf: useIf,
  24133. expression: { context: this.component, value: input.value }
  24134. });
  24135. }
  24136. }
  24137. }
  24138. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  24139. finally {
  24140. try {
  24141. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  24142. }
  24143. finally { if (e_2) throw e_2.error; }
  24144. }
  24145. }
  24146. }
  24147. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  24148. finally {
  24149. try {
  24150. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  24151. }
  24152. finally { if (e_1) throw e_1.error; }
  24153. }
  24154. return result;
  24155. };
  24156. ViewBuilder.prototype.visitAll = function (variables, astNodes) {
  24157. this.variables = variables;
  24158. templateVisitAll(this, astNodes);
  24159. };
  24160. ViewBuilder.prototype.build = function (componentId, targetStatements) {
  24161. var _this = this;
  24162. if (targetStatements === void 0) { targetStatements = []; }
  24163. var e_3, _a;
  24164. this.children.forEach(function (child) { return child.build(componentId, targetStatements); });
  24165. var viewStmts = [variable(DYNAMIC_VAR_NAME).set(NULL_EXPR).toDeclStmt(DYNAMIC_TYPE)];
  24166. var bindingCount = 0;
  24167. this.updates.forEach(function (expression) {
  24168. var _a = _this.preprocessUpdateExpression(expression), sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
  24169. var bindingId = "" + bindingCount++;
  24170. var nameResolver = context === _this.component ? _this : defaultResolver;
  24171. var _b = convertPropertyBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId, BindingForm.General), stmts = _b.stmts, currValExpr = _b.currValExpr;
  24172. stmts.push(new ExpressionStatement(currValExpr));
  24173. viewStmts.push.apply(viewStmts, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); })));
  24174. });
  24175. this.actions.forEach(function (_a) {
  24176. var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
  24177. var bindingId = "" + bindingCount++;
  24178. var nameResolver = context === _this.component ? _this : defaultResolver;
  24179. var stmts = convertActionBinding(nameResolver, variable(_this.getOutputVar(context)), value, bindingId).stmts;
  24180. viewStmts.push.apply(viewStmts, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); })));
  24181. });
  24182. if (this.guards.length) {
  24183. var guardExpression = undefined;
  24184. try {
  24185. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(this.guards), _c = _b.next(); !_c.done; _c = _b.next()) {
  24186. var guard = _c.value;
  24187. var _d = this.preprocessUpdateExpression(guard.expression), context = _d.context, value = _d.value;
  24188. var bindingId = "" + bindingCount++;
  24189. var nameResolver = context === this.component ? this : defaultResolver;
  24190. // We only support support simple expressions and ignore others as they
  24191. // are unlikely to affect type narrowing.
  24192. var _e = convertPropertyBinding(nameResolver, variable(this.getOutputVar(context)), value, bindingId, BindingForm.TrySimple), stmts = _e.stmts, currValExpr = _e.currValExpr;
  24193. if (stmts.length == 0) {
  24194. var guardClause = guard.useIf ? currValExpr : this.ctx.importExpr(guard.guard).callFn([currValExpr]);
  24195. guardExpression = guardExpression ? guardExpression.and(guardClause) : guardClause;
  24196. }
  24197. }
  24198. }
  24199. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  24200. finally {
  24201. try {
  24202. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  24203. }
  24204. finally { if (e_3) throw e_3.error; }
  24205. }
  24206. if (guardExpression) {
  24207. viewStmts = [new IfStmt(guardExpression, viewStmts)];
  24208. }
  24209. }
  24210. var viewName = "_View_" + componentId + "_" + this.embeddedViewIndex;
  24211. var viewFactory = new DeclareFunctionStmt(viewName, [], viewStmts);
  24212. targetStatements.push(viewFactory);
  24213. return targetStatements;
  24214. };
  24215. ViewBuilder.prototype.visitBoundText = function (ast, context) {
  24216. var _this = this;
  24217. var astWithSource = ast.value;
  24218. var inter = astWithSource.ast;
  24219. inter.expressions.forEach(function (expr) {
  24220. return _this.updates.push({ context: _this.component, value: expr, sourceSpan: ast.sourceSpan });
  24221. });
  24222. };
  24223. ViewBuilder.prototype.visitEmbeddedTemplate = function (ast, context) {
  24224. this.visitElementOrTemplate(ast);
  24225. // Note: The old view compiler used to use an `any` type
  24226. // for the context in any embedded view.
  24227. // We keep this behaivor behind a flag for now.
  24228. if (this.options.fullTemplateTypeCheck) {
  24229. // Find any applicable type guards. For example, NgIf has a type guard on ngIf
  24230. // (see NgIf.ngIfTypeGuard) that can be used to indicate that a template is only
  24231. // stamped out if ngIf is truthy so any bindings in the template can assume that,
  24232. // if a nullable type is used for ngIf, that expression is not null or undefined.
  24233. var guards = this.getTypeGuardExpressions(ast);
  24234. var childVisitor = this.viewBuilderFactory(this, guards);
  24235. this.children.push(childVisitor);
  24236. childVisitor.visitAll(ast.variables, ast.children);
  24237. }
  24238. };
  24239. ViewBuilder.prototype.visitElement = function (ast, context) {
  24240. var _this = this;
  24241. this.visitElementOrTemplate(ast);
  24242. ast.inputs.forEach(function (inputAst) {
  24243. _this.updates.push({ context: _this.component, value: inputAst.value, sourceSpan: inputAst.sourceSpan });
  24244. });
  24245. templateVisitAll(this, ast.children);
  24246. };
  24247. ViewBuilder.prototype.visitElementOrTemplate = function (ast) {
  24248. var _this = this;
  24249. ast.directives.forEach(function (dirAst) { _this.visitDirective(dirAst); });
  24250. ast.references.forEach(function (ref) {
  24251. var outputVarType = null;
  24252. // Note: The old view compiler used to use an `any` type
  24253. // for directives exposed via `exportAs`.
  24254. // We keep this behaivor behind a flag for now.
  24255. if (ref.value && ref.value.identifier && _this.options.fullTemplateTypeCheck) {
  24256. outputVarType = ref.value.identifier.reference;
  24257. }
  24258. else {
  24259. outputVarType = BuiltinTypeName.Dynamic;
  24260. }
  24261. _this.refOutputVars.set(ref.name, outputVarType);
  24262. });
  24263. ast.outputs.forEach(function (outputAst) {
  24264. _this.actions.push({ context: _this.component, value: outputAst.handler, sourceSpan: outputAst.sourceSpan });
  24265. });
  24266. };
  24267. ViewBuilder.prototype.visitDirective = function (dirAst) {
  24268. var _this = this;
  24269. var dirType = dirAst.directive.type.reference;
  24270. dirAst.inputs.forEach(function (input) { return _this.updates.push({ context: _this.component, value: input.value, sourceSpan: input.sourceSpan }); });
  24271. // Note: The old view compiler used to use an `any` type
  24272. // for expressions in host properties / events.
  24273. // We keep this behaivor behind a flag for now.
  24274. if (this.options.fullTemplateTypeCheck) {
  24275. dirAst.hostProperties.forEach(function (inputAst) { return _this.updates.push({ context: dirType, value: inputAst.value, sourceSpan: inputAst.sourceSpan }); });
  24276. dirAst.hostEvents.forEach(function (hostEventAst) { return _this.actions.push({
  24277. context: dirType,
  24278. value: hostEventAst.handler,
  24279. sourceSpan: hostEventAst.sourceSpan
  24280. }); });
  24281. }
  24282. };
  24283. ViewBuilder.prototype.getLocal = function (name) {
  24284. if (name == EventHandlerVars.event.name) {
  24285. return variable(this.getOutputVar(BuiltinTypeName.Dynamic));
  24286. }
  24287. for (var currBuilder = this; currBuilder; currBuilder = currBuilder.parent) {
  24288. var outputVarType = void 0;
  24289. // check references
  24290. outputVarType = currBuilder.refOutputVars.get(name);
  24291. if (outputVarType == null) {
  24292. // check variables
  24293. var varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
  24294. if (varAst) {
  24295. outputVarType = BuiltinTypeName.Dynamic;
  24296. }
  24297. }
  24298. if (outputVarType != null) {
  24299. return variable(this.getOutputVar(outputVarType));
  24300. }
  24301. }
  24302. return null;
  24303. };
  24304. ViewBuilder.prototype.pipeOutputVar = function (name) {
  24305. var pipe = this.pipes.get(name);
  24306. if (!pipe) {
  24307. throw new Error("Illegal State: Could not find pipe " + name + " in template of " + this.component);
  24308. }
  24309. return this.getOutputVar(pipe);
  24310. };
  24311. ViewBuilder.prototype.preprocessUpdateExpression = function (expression) {
  24312. var _this = this;
  24313. return {
  24314. sourceSpan: expression.sourceSpan,
  24315. context: expression.context,
  24316. value: convertPropertyBindingBuiltins({
  24317. createLiteralArrayConverter: function (argCount) { return function (args) {
  24318. var arr = literalArr(args);
  24319. // Note: The old view compiler used to use an `any` type
  24320. // for arrays.
  24321. return _this.options.fullTemplateTypeCheck ? arr : arr.cast(DYNAMIC_TYPE);
  24322. }; },
  24323. createLiteralMapConverter: function (keys) { return function (values) {
  24324. var entries = keys.map(function (k, i) { return ({
  24325. key: k.key,
  24326. value: values[i],
  24327. quoted: k.quoted,
  24328. }); });
  24329. var map = literalMap(entries);
  24330. // Note: The old view compiler used to use an `any` type
  24331. // for maps.
  24332. return _this.options.fullTemplateTypeCheck ? map : map.cast(DYNAMIC_TYPE);
  24333. }; },
  24334. createPipeConverter: function (name, argCount) { return function (args) {
  24335. // Note: The old view compiler used to use an `any` type
  24336. // for pipes.
  24337. var pipeExpr = _this.options.fullTemplateTypeCheck ?
  24338. variable(_this.pipeOutputVar(name)) :
  24339. variable(_this.getOutputVar(BuiltinTypeName.Dynamic));
  24340. return pipeExpr.callMethod('transform', args);
  24341. }; },
  24342. }, expression.value)
  24343. };
  24344. };
  24345. ViewBuilder.prototype.visitNgContent = function (ast, context) { };
  24346. ViewBuilder.prototype.visitText = function (ast, context) { };
  24347. ViewBuilder.prototype.visitDirectiveProperty = function (ast, context) { };
  24348. ViewBuilder.prototype.visitReference = function (ast, context) { };
  24349. ViewBuilder.prototype.visitVariable = function (ast, context) { };
  24350. ViewBuilder.prototype.visitEvent = function (ast, context) { };
  24351. ViewBuilder.prototype.visitElementProperty = function (ast, context) { };
  24352. ViewBuilder.prototype.visitAttr = function (ast, context) { };
  24353. return ViewBuilder;
  24354. }());
  24355. /**
  24356. * @license
  24357. * Copyright Google Inc. All Rights Reserved.
  24358. *
  24359. * Use of this source code is governed by an MIT-style license that can be
  24360. * found in the LICENSE file at https://angular.io/license
  24361. */
  24362. var CLASS_ATTR$1 = 'class';
  24363. var STYLE_ATTR = 'style';
  24364. var IMPLICIT_TEMPLATE_VAR = '\$implicit';
  24365. var ViewCompileResult = /** @class */ (function () {
  24366. function ViewCompileResult(viewClassVar, rendererTypeVar) {
  24367. this.viewClassVar = viewClassVar;
  24368. this.rendererTypeVar = rendererTypeVar;
  24369. }
  24370. return ViewCompileResult;
  24371. }());
  24372. var ViewCompiler = /** @class */ (function () {
  24373. function ViewCompiler(_reflector) {
  24374. this._reflector = _reflector;
  24375. }
  24376. ViewCompiler.prototype.compileComponent = function (outputCtx, component, template, styles, usedPipes) {
  24377. var _this = this;
  24378. var _a;
  24379. var embeddedViewCount = 0;
  24380. var staticQueryIds = findStaticQueryIds(template);
  24381. var renderComponentVarName = undefined;
  24382. if (!component.isHost) {
  24383. var template_1 = component.template;
  24384. var customRenderData = [];
  24385. if (template_1.animations && template_1.animations.length) {
  24386. customRenderData.push(new LiteralMapEntry('animation', convertValueToOutputAst(outputCtx, template_1.animations), true));
  24387. }
  24388. var renderComponentVar = variable(rendererTypeName(component.type.reference));
  24389. renderComponentVarName = renderComponentVar.name;
  24390. outputCtx.statements.push(renderComponentVar
  24391. .set(importExpr(Identifiers.createRendererType2).callFn([new LiteralMapExpr([
  24392. new LiteralMapEntry('encapsulation', literal(template_1.encapsulation), false),
  24393. new LiteralMapEntry('styles', styles, false),
  24394. new LiteralMapEntry('data', new LiteralMapExpr(customRenderData), false)
  24395. ])]))
  24396. .toDeclStmt(importType(Identifiers.RendererType2), [StmtModifier.Final, StmtModifier.Exported]));
  24397. }
  24398. var viewBuilderFactory = function (parent) {
  24399. var embeddedViewIndex = embeddedViewCount++;
  24400. return new ViewBuilder$1(_this._reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory);
  24401. };
  24402. var visitor = viewBuilderFactory(null);
  24403. visitor.visitAll([], template);
  24404. (_a = outputCtx.statements).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(visitor.build()));
  24405. return new ViewCompileResult(visitor.viewName, renderComponentVarName);
  24406. };
  24407. return ViewCompiler;
  24408. }());
  24409. var LOG_VAR$1 = variable('_l');
  24410. var VIEW_VAR = variable('_v');
  24411. var CHECK_VAR = variable('_ck');
  24412. var COMP_VAR = variable('_co');
  24413. var EVENT_NAME_VAR = variable('en');
  24414. var ALLOW_DEFAULT_VAR = variable("ad");
  24415. var ViewBuilder$1 = /** @class */ (function () {
  24416. function ViewBuilder(reflector, outputCtx, parent, component, embeddedViewIndex, usedPipes, staticQueryIds, viewBuilderFactory) {
  24417. this.reflector = reflector;
  24418. this.outputCtx = outputCtx;
  24419. this.parent = parent;
  24420. this.component = component;
  24421. this.embeddedViewIndex = embeddedViewIndex;
  24422. this.usedPipes = usedPipes;
  24423. this.staticQueryIds = staticQueryIds;
  24424. this.viewBuilderFactory = viewBuilderFactory;
  24425. this.nodes = [];
  24426. this.purePipeNodeIndices = Object.create(null);
  24427. // Need Object.create so that we don't have builtin values...
  24428. this.refNodeIndices = Object.create(null);
  24429. this.variables = [];
  24430. this.children = [];
  24431. // TODO(tbosch): The old view compiler used to use an `any` type
  24432. // for the context in any embedded view. We keep this behaivor for now
  24433. // to be able to introduce the new view compiler without too many errors.
  24434. this.compType = this.embeddedViewIndex > 0 ?
  24435. DYNAMIC_TYPE :
  24436. expressionType(outputCtx.importExpr(this.component.type.reference));
  24437. this.viewName = viewClassName(this.component.type.reference, this.embeddedViewIndex);
  24438. }
  24439. ViewBuilder.prototype.visitAll = function (variables, astNodes) {
  24440. var _this = this;
  24441. this.variables = variables;
  24442. // create the pipes for the pure pipes immediately, so that we know their indices.
  24443. if (!this.parent) {
  24444. this.usedPipes.forEach(function (pipe) {
  24445. if (pipe.pure) {
  24446. _this.purePipeNodeIndices[pipe.name] = _this._createPipe(null, pipe);
  24447. }
  24448. });
  24449. }
  24450. if (!this.parent) {
  24451. var queryIds_1 = staticViewQueryIds(this.staticQueryIds);
  24452. this.component.viewQueries.forEach(function (query, queryIndex) {
  24453. // Note: queries start with id 1 so we can use the number in a Bloom filter!
  24454. var queryId = queryIndex + 1;
  24455. var bindingType = query.first ? 0 /* First */ : 1 /* All */;
  24456. var flags = 134217728 /* TypeViewQuery */ | calcStaticDynamicQueryFlags(queryIds_1, queryId, query.first);
  24457. _this.nodes.push(function () { return ({
  24458. sourceSpan: null,
  24459. nodeFlags: flags,
  24460. nodeDef: importExpr(Identifiers.queryDef).callFn([
  24461. literal(flags), literal(queryId),
  24462. new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
  24463. ])
  24464. }); });
  24465. });
  24466. }
  24467. templateVisitAll(this, astNodes);
  24468. if (this.parent && (astNodes.length === 0 || needsAdditionalRootNode(astNodes))) {
  24469. // if the view is an embedded view, then we need to add an additional root node in some cases
  24470. this.nodes.push(function () { return ({
  24471. sourceSpan: null,
  24472. nodeFlags: 1 /* TypeElement */,
  24473. nodeDef: importExpr(Identifiers.anchorDef).callFn([
  24474. literal(0 /* None */), NULL_EXPR, NULL_EXPR, literal(0)
  24475. ])
  24476. }); });
  24477. }
  24478. };
  24479. ViewBuilder.prototype.build = function (targetStatements) {
  24480. if (targetStatements === void 0) { targetStatements = []; }
  24481. this.children.forEach(function (child) { return child.build(targetStatements); });
  24482. var _a = this._createNodeExpressions(), updateRendererStmts = _a.updateRendererStmts, updateDirectivesStmts = _a.updateDirectivesStmts, nodeDefExprs = _a.nodeDefExprs;
  24483. var updateRendererFn = this._createUpdateFn(updateRendererStmts);
  24484. var updateDirectivesFn = this._createUpdateFn(updateDirectivesStmts);
  24485. var viewFlags = 0 /* None */;
  24486. if (!this.parent && this.component.changeDetection === ChangeDetectionStrategy.OnPush) {
  24487. viewFlags |= 2 /* OnPush */;
  24488. }
  24489. var viewFactory = new DeclareFunctionStmt(this.viewName, [new FnParam(LOG_VAR$1.name)], [new ReturnStatement(importExpr(Identifiers.viewDef).callFn([
  24490. literal(viewFlags),
  24491. literalArr(nodeDefExprs),
  24492. updateDirectivesFn,
  24493. updateRendererFn,
  24494. ]))], importType(Identifiers.ViewDefinition), this.embeddedViewIndex === 0 ? [StmtModifier.Exported] : []);
  24495. targetStatements.push(viewFactory);
  24496. return targetStatements;
  24497. };
  24498. ViewBuilder.prototype._createUpdateFn = function (updateStmts) {
  24499. var updateFn;
  24500. if (updateStmts.length > 0) {
  24501. var preStmts = [];
  24502. if (!this.component.isHost && findReadVarNames(updateStmts).has(COMP_VAR.name)) {
  24503. preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
  24504. }
  24505. updateFn = fn([
  24506. new FnParam(CHECK_VAR.name, INFERRED_TYPE),
  24507. new FnParam(VIEW_VAR.name, INFERRED_TYPE)
  24508. ], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(preStmts, updateStmts), INFERRED_TYPE);
  24509. }
  24510. else {
  24511. updateFn = NULL_EXPR;
  24512. }
  24513. return updateFn;
  24514. };
  24515. ViewBuilder.prototype.visitNgContent = function (ast, context) {
  24516. // ngContentDef(ngContentIndex: number, index: number): NodeDef;
  24517. this.nodes.push(function () { return ({
  24518. sourceSpan: ast.sourceSpan,
  24519. nodeFlags: 8 /* TypeNgContent */,
  24520. nodeDef: importExpr(Identifiers.ngContentDef).callFn([
  24521. literal(ast.ngContentIndex), literal(ast.index)
  24522. ])
  24523. }); });
  24524. };
  24525. ViewBuilder.prototype.visitText = function (ast, context) {
  24526. // Static text nodes have no check function
  24527. var checkIndex = -1;
  24528. this.nodes.push(function () { return ({
  24529. sourceSpan: ast.sourceSpan,
  24530. nodeFlags: 2 /* TypeText */,
  24531. nodeDef: importExpr(Identifiers.textDef).callFn([
  24532. literal(checkIndex),
  24533. literal(ast.ngContentIndex),
  24534. literalArr([literal(ast.value)]),
  24535. ])
  24536. }); });
  24537. };
  24538. ViewBuilder.prototype.visitBoundText = function (ast, context) {
  24539. var _this = this;
  24540. var nodeIndex = this.nodes.length;
  24541. // reserve the space in the nodeDefs array
  24542. this.nodes.push(null);
  24543. var astWithSource = ast.value;
  24544. var inter = astWithSource.ast;
  24545. var updateRendererExpressions = inter.expressions.map(function (expr, bindingIndex) { return _this._preprocessUpdateExpression({ nodeIndex: nodeIndex, bindingIndex: bindingIndex, sourceSpan: ast.sourceSpan, context: COMP_VAR, value: expr }); });
  24546. // Check index is the same as the node index during compilation
  24547. // They might only differ at runtime
  24548. var checkIndex = nodeIndex;
  24549. this.nodes[nodeIndex] = function () { return ({
  24550. sourceSpan: ast.sourceSpan,
  24551. nodeFlags: 2 /* TypeText */,
  24552. nodeDef: importExpr(Identifiers.textDef).callFn([
  24553. literal(checkIndex),
  24554. literal(ast.ngContentIndex),
  24555. literalArr(inter.strings.map(function (s) { return literal(s); })),
  24556. ]),
  24557. updateRenderer: updateRendererExpressions
  24558. }); };
  24559. };
  24560. ViewBuilder.prototype.visitEmbeddedTemplate = function (ast, context) {
  24561. var _this = this;
  24562. var nodeIndex = this.nodes.length;
  24563. // reserve the space in the nodeDefs array
  24564. this.nodes.push(null);
  24565. var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, queryMatchesExpr = _a.queryMatchesExpr, hostEvents = _a.hostEvents;
  24566. var childVisitor = this.viewBuilderFactory(this);
  24567. this.children.push(childVisitor);
  24568. childVisitor.visitAll(ast.variables, ast.children);
  24569. var childCount = this.nodes.length - nodeIndex - 1;
  24570. // anchorDef(
  24571. // flags: NodeFlags, matchedQueries: [string, QueryValueType][], ngContentIndex: number,
  24572. // childCount: number, handleEventFn?: ElementHandleEventFn, templateFactory?:
  24573. // ViewDefinitionFactory): NodeDef;
  24574. this.nodes[nodeIndex] = function () { return ({
  24575. sourceSpan: ast.sourceSpan,
  24576. nodeFlags: 1 /* TypeElement */ | flags,
  24577. nodeDef: importExpr(Identifiers.anchorDef).callFn([
  24578. literal(flags),
  24579. queryMatchesExpr,
  24580. literal(ast.ngContentIndex),
  24581. literal(childCount),
  24582. _this._createElementHandleEventFn(nodeIndex, hostEvents),
  24583. variable(childVisitor.viewName),
  24584. ])
  24585. }); };
  24586. };
  24587. ViewBuilder.prototype.visitElement = function (ast, context) {
  24588. var _this = this;
  24589. var nodeIndex = this.nodes.length;
  24590. // reserve the space in the nodeDefs array so we can add children
  24591. this.nodes.push(null);
  24592. // Using a null element name creates an anchor.
  24593. var elName = isNgContainer(ast.name) ? null : ast.name;
  24594. var _a = this._visitElementOrTemplate(nodeIndex, ast), flags = _a.flags, usedEvents = _a.usedEvents, queryMatchesExpr = _a.queryMatchesExpr, dirHostBindings = _a.hostBindings, hostEvents = _a.hostEvents;
  24595. var inputDefs = [];
  24596. var updateRendererExpressions = [];
  24597. var outputDefs = [];
  24598. if (elName) {
  24599. var hostBindings = ast.inputs
  24600. .map(function (inputAst) { return ({
  24601. context: COMP_VAR,
  24602. inputAst: inputAst,
  24603. dirAst: null,
  24604. }); })
  24605. .concat(dirHostBindings);
  24606. if (hostBindings.length) {
  24607. updateRendererExpressions =
  24608. hostBindings.map(function (hostBinding, bindingIndex) { return _this._preprocessUpdateExpression({
  24609. context: hostBinding.context,
  24610. nodeIndex: nodeIndex,
  24611. bindingIndex: bindingIndex,
  24612. sourceSpan: hostBinding.inputAst.sourceSpan,
  24613. value: hostBinding.inputAst.value
  24614. }); });
  24615. inputDefs = hostBindings.map(function (hostBinding) { return elementBindingDef(hostBinding.inputAst, hostBinding.dirAst); });
  24616. }
  24617. outputDefs = usedEvents.map(function (_a) {
  24618. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), target = _b[0], eventName = _b[1];
  24619. return literalArr([literal(target), literal(eventName)]);
  24620. });
  24621. }
  24622. templateVisitAll(this, ast.children);
  24623. var childCount = this.nodes.length - nodeIndex - 1;
  24624. var compAst = ast.directives.find(function (dirAst) { return dirAst.directive.isComponent; });
  24625. var compRendererType = NULL_EXPR;
  24626. var compView = NULL_EXPR;
  24627. if (compAst) {
  24628. compView = this.outputCtx.importExpr(compAst.directive.componentViewType);
  24629. compRendererType = this.outputCtx.importExpr(compAst.directive.rendererType);
  24630. }
  24631. // Check index is the same as the node index during compilation
  24632. // They might only differ at runtime
  24633. var checkIndex = nodeIndex;
  24634. this.nodes[nodeIndex] = function () { return ({
  24635. sourceSpan: ast.sourceSpan,
  24636. nodeFlags: 1 /* TypeElement */ | flags,
  24637. nodeDef: importExpr(Identifiers.elementDef).callFn([
  24638. literal(checkIndex),
  24639. literal(flags),
  24640. queryMatchesExpr,
  24641. literal(ast.ngContentIndex),
  24642. literal(childCount),
  24643. literal(elName),
  24644. elName ? fixedAttrsDef(ast) : NULL_EXPR,
  24645. inputDefs.length ? literalArr(inputDefs) : NULL_EXPR,
  24646. outputDefs.length ? literalArr(outputDefs) : NULL_EXPR,
  24647. _this._createElementHandleEventFn(nodeIndex, hostEvents),
  24648. compView,
  24649. compRendererType,
  24650. ]),
  24651. updateRenderer: updateRendererExpressions
  24652. }); };
  24653. };
  24654. ViewBuilder.prototype._visitElementOrTemplate = function (nodeIndex, ast) {
  24655. var _this = this;
  24656. var flags = 0 /* None */;
  24657. if (ast.hasViewContainer) {
  24658. flags |= 16777216 /* EmbeddedViews */;
  24659. }
  24660. var usedEvents = new Map();
  24661. ast.outputs.forEach(function (event) {
  24662. var _a = elementEventNameAndTarget(event, null), name = _a.name, target = _a.target;
  24663. usedEvents.set(elementEventFullName(target, name), [target, name]);
  24664. });
  24665. ast.directives.forEach(function (dirAst) {
  24666. dirAst.hostEvents.forEach(function (event) {
  24667. var _a = elementEventNameAndTarget(event, dirAst), name = _a.name, target = _a.target;
  24668. usedEvents.set(elementEventFullName(target, name), [target, name]);
  24669. });
  24670. });
  24671. var hostBindings = [];
  24672. var hostEvents = [];
  24673. this._visitComponentFactoryResolverProvider(ast.directives);
  24674. ast.providers.forEach(function (providerAst, providerIndex) {
  24675. var dirAst = undefined;
  24676. var dirIndex = undefined;
  24677. ast.directives.forEach(function (localDirAst, i) {
  24678. if (localDirAst.directive.type.reference === tokenReference(providerAst.token)) {
  24679. dirAst = localDirAst;
  24680. dirIndex = i;
  24681. }
  24682. });
  24683. if (dirAst) {
  24684. var _a = _this._visitDirective(providerAst, dirAst, dirIndex, nodeIndex, ast.references, ast.queryMatches, usedEvents, _this.staticQueryIds.get(ast)), dirHostBindings = _a.hostBindings, dirHostEvents = _a.hostEvents;
  24685. hostBindings.push.apply(hostBindings, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(dirHostBindings));
  24686. hostEvents.push.apply(hostEvents, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(dirHostEvents));
  24687. }
  24688. else {
  24689. _this._visitProvider(providerAst, ast.queryMatches);
  24690. }
  24691. });
  24692. var queryMatchExprs = [];
  24693. ast.queryMatches.forEach(function (match) {
  24694. var valueType = undefined;
  24695. if (tokenReference(match.value) ===
  24696. _this.reflector.resolveExternalReference(Identifiers.ElementRef)) {
  24697. valueType = 0 /* ElementRef */;
  24698. }
  24699. else if (tokenReference(match.value) ===
  24700. _this.reflector.resolveExternalReference(Identifiers.ViewContainerRef)) {
  24701. valueType = 3 /* ViewContainerRef */;
  24702. }
  24703. else if (tokenReference(match.value) ===
  24704. _this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
  24705. valueType = 2 /* TemplateRef */;
  24706. }
  24707. if (valueType != null) {
  24708. queryMatchExprs.push(literalArr([literal(match.queryId), literal(valueType)]));
  24709. }
  24710. });
  24711. ast.references.forEach(function (ref) {
  24712. var valueType = undefined;
  24713. if (!ref.value) {
  24714. valueType = 1 /* RenderElement */;
  24715. }
  24716. else if (tokenReference(ref.value) ===
  24717. _this.reflector.resolveExternalReference(Identifiers.TemplateRef)) {
  24718. valueType = 2 /* TemplateRef */;
  24719. }
  24720. if (valueType != null) {
  24721. _this.refNodeIndices[ref.name] = nodeIndex;
  24722. queryMatchExprs.push(literalArr([literal(ref.name), literal(valueType)]));
  24723. }
  24724. });
  24725. ast.outputs.forEach(function (outputAst) {
  24726. hostEvents.push({ context: COMP_VAR, eventAst: outputAst, dirAst: null });
  24727. });
  24728. return {
  24729. flags: flags,
  24730. usedEvents: Array.from(usedEvents.values()),
  24731. queryMatchesExpr: queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
  24732. hostBindings: hostBindings,
  24733. hostEvents: hostEvents
  24734. };
  24735. };
  24736. ViewBuilder.prototype._visitDirective = function (providerAst, dirAst, directiveIndex, elementNodeIndex, refs, queryMatches, usedEvents, queryIds) {
  24737. var _this = this;
  24738. var nodeIndex = this.nodes.length;
  24739. // reserve the space in the nodeDefs array so we can add children
  24740. this.nodes.push(null);
  24741. dirAst.directive.queries.forEach(function (query, queryIndex) {
  24742. var queryId = dirAst.contentQueryStartId + queryIndex;
  24743. var flags = 67108864 /* TypeContentQuery */ | calcStaticDynamicQueryFlags(queryIds, queryId, query.first);
  24744. var bindingType = query.first ? 0 /* First */ : 1 /* All */;
  24745. _this.nodes.push(function () { return ({
  24746. sourceSpan: dirAst.sourceSpan,
  24747. nodeFlags: flags,
  24748. nodeDef: importExpr(Identifiers.queryDef).callFn([
  24749. literal(flags), literal(queryId),
  24750. new LiteralMapExpr([new LiteralMapEntry(query.propertyName, literal(bindingType), false)])
  24751. ]),
  24752. }); });
  24753. });
  24754. // Note: the operation below might also create new nodeDefs,
  24755. // but we don't want them to be a child of a directive,
  24756. // as they might be a provider/pipe on their own.
  24757. // I.e. we only allow queries as children of directives nodes.
  24758. var childCount = this.nodes.length - nodeIndex - 1;
  24759. var _a = this._visitProviderOrDirective(providerAst, queryMatches), flags = _a.flags, queryMatchExprs = _a.queryMatchExprs, providerExpr = _a.providerExpr, depsExpr = _a.depsExpr;
  24760. refs.forEach(function (ref) {
  24761. if (ref.value && tokenReference(ref.value) === tokenReference(providerAst.token)) {
  24762. _this.refNodeIndices[ref.name] = nodeIndex;
  24763. queryMatchExprs.push(literalArr([literal(ref.name), literal(4 /* Provider */)]));
  24764. }
  24765. });
  24766. if (dirAst.directive.isComponent) {
  24767. flags |= 32768 /* Component */;
  24768. }
  24769. var inputDefs = dirAst.inputs.map(function (inputAst, inputIndex) {
  24770. var mapValue = literalArr([literal(inputIndex), literal(inputAst.directiveName)]);
  24771. // Note: it's important to not quote the key so that we can capture renames by minifiers!
  24772. return new LiteralMapEntry(inputAst.directiveName, mapValue, false);
  24773. });
  24774. var outputDefs = [];
  24775. var dirMeta = dirAst.directive;
  24776. Object.keys(dirMeta.outputs).forEach(function (propName) {
  24777. var eventName = dirMeta.outputs[propName];
  24778. if (usedEvents.has(eventName)) {
  24779. // Note: it's important to not quote the key so that we can capture renames by minifiers!
  24780. outputDefs.push(new LiteralMapEntry(propName, literal(eventName), false));
  24781. }
  24782. });
  24783. var updateDirectiveExpressions = [];
  24784. if (dirAst.inputs.length || (flags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0) {
  24785. updateDirectiveExpressions =
  24786. dirAst.inputs.map(function (input, bindingIndex) { return _this._preprocessUpdateExpression({
  24787. nodeIndex: nodeIndex,
  24788. bindingIndex: bindingIndex,
  24789. sourceSpan: input.sourceSpan,
  24790. context: COMP_VAR,
  24791. value: input.value
  24792. }); });
  24793. }
  24794. var dirContextExpr = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
  24795. var hostBindings = dirAst.hostProperties.map(function (inputAst) { return ({
  24796. context: dirContextExpr,
  24797. dirAst: dirAst,
  24798. inputAst: inputAst,
  24799. }); });
  24800. var hostEvents = dirAst.hostEvents.map(function (hostEventAst) { return ({
  24801. context: dirContextExpr,
  24802. eventAst: hostEventAst, dirAst: dirAst,
  24803. }); });
  24804. // Check index is the same as the node index during compilation
  24805. // They might only differ at runtime
  24806. var checkIndex = nodeIndex;
  24807. this.nodes[nodeIndex] = function () { return ({
  24808. sourceSpan: dirAst.sourceSpan,
  24809. nodeFlags: 16384 /* TypeDirective */ | flags,
  24810. nodeDef: importExpr(Identifiers.directiveDef).callFn([
  24811. literal(checkIndex),
  24812. literal(flags),
  24813. queryMatchExprs.length ? literalArr(queryMatchExprs) : NULL_EXPR,
  24814. literal(childCount),
  24815. providerExpr,
  24816. depsExpr,
  24817. inputDefs.length ? new LiteralMapExpr(inputDefs) : NULL_EXPR,
  24818. outputDefs.length ? new LiteralMapExpr(outputDefs) : NULL_EXPR,
  24819. ]),
  24820. updateDirectives: updateDirectiveExpressions,
  24821. directive: dirAst.directive.type,
  24822. }); };
  24823. return { hostBindings: hostBindings, hostEvents: hostEvents };
  24824. };
  24825. ViewBuilder.prototype._visitProvider = function (providerAst, queryMatches) {
  24826. this._addProviderNode(this._visitProviderOrDirective(providerAst, queryMatches));
  24827. };
  24828. ViewBuilder.prototype._visitComponentFactoryResolverProvider = function (directives) {
  24829. var componentDirMeta = directives.find(function (dirAst) { return dirAst.directive.isComponent; });
  24830. if (componentDirMeta && componentDirMeta.directive.entryComponents.length) {
  24831. var _a = componentFactoryResolverProviderDef(this.reflector, this.outputCtx, 8192 /* PrivateProvider */, componentDirMeta.directive.entryComponents), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, flags = _a.flags, tokenExpr = _a.tokenExpr;
  24832. this._addProviderNode({
  24833. providerExpr: providerExpr,
  24834. depsExpr: depsExpr,
  24835. flags: flags,
  24836. tokenExpr: tokenExpr,
  24837. queryMatchExprs: [],
  24838. sourceSpan: componentDirMeta.sourceSpan
  24839. });
  24840. }
  24841. };
  24842. ViewBuilder.prototype._addProviderNode = function (data) {
  24843. var nodeIndex = this.nodes.length;
  24844. // providerDef(
  24845. // flags: NodeFlags, matchedQueries: [string, QueryValueType][], token:any,
  24846. // value: any, deps: ([DepFlags, any] | any)[]): NodeDef;
  24847. this.nodes.push(function () { return ({
  24848. sourceSpan: data.sourceSpan,
  24849. nodeFlags: data.flags,
  24850. nodeDef: importExpr(Identifiers.providerDef).callFn([
  24851. literal(data.flags),
  24852. data.queryMatchExprs.length ? literalArr(data.queryMatchExprs) : NULL_EXPR,
  24853. data.tokenExpr, data.providerExpr, data.depsExpr
  24854. ])
  24855. }); });
  24856. };
  24857. ViewBuilder.prototype._visitProviderOrDirective = function (providerAst, queryMatches) {
  24858. var flags = 0 /* None */;
  24859. var queryMatchExprs = [];
  24860. queryMatches.forEach(function (match) {
  24861. if (tokenReference(match.value) === tokenReference(providerAst.token)) {
  24862. queryMatchExprs.push(literalArr([literal(match.queryId), literal(4 /* Provider */)]));
  24863. }
  24864. });
  24865. var _a = providerDef(this.outputCtx, providerAst), providerExpr = _a.providerExpr, depsExpr = _a.depsExpr, providerFlags = _a.flags, tokenExpr = _a.tokenExpr;
  24866. return {
  24867. flags: flags | providerFlags,
  24868. queryMatchExprs: queryMatchExprs,
  24869. providerExpr: providerExpr,
  24870. depsExpr: depsExpr,
  24871. tokenExpr: tokenExpr,
  24872. sourceSpan: providerAst.sourceSpan
  24873. };
  24874. };
  24875. ViewBuilder.prototype.getLocal = function (name) {
  24876. if (name == EventHandlerVars.event.name) {
  24877. return EventHandlerVars.event;
  24878. }
  24879. var currViewExpr = VIEW_VAR;
  24880. for (var currBuilder = this; currBuilder; currBuilder = currBuilder.parent,
  24881. currViewExpr = currViewExpr.prop('parent').cast(DYNAMIC_TYPE)) {
  24882. // check references
  24883. var refNodeIndex = currBuilder.refNodeIndices[name];
  24884. if (refNodeIndex != null) {
  24885. return importExpr(Identifiers.nodeValue).callFn([currViewExpr, literal(refNodeIndex)]);
  24886. }
  24887. // check variables
  24888. var varAst = currBuilder.variables.find(function (varAst) { return varAst.name === name; });
  24889. if (varAst) {
  24890. var varValue = varAst.value || IMPLICIT_TEMPLATE_VAR;
  24891. return currViewExpr.prop('context').prop(varValue);
  24892. }
  24893. }
  24894. return null;
  24895. };
  24896. ViewBuilder.prototype._createLiteralArrayConverter = function (sourceSpan, argCount) {
  24897. if (argCount === 0) {
  24898. var valueExpr_1 = importExpr(Identifiers.EMPTY_ARRAY);
  24899. return function () { return valueExpr_1; };
  24900. }
  24901. var checkIndex = this.nodes.length;
  24902. this.nodes.push(function () { return ({
  24903. sourceSpan: sourceSpan,
  24904. nodeFlags: 32 /* TypePureArray */,
  24905. nodeDef: importExpr(Identifiers.pureArrayDef).callFn([
  24906. literal(checkIndex),
  24907. literal(argCount),
  24908. ])
  24909. }); });
  24910. return function (args) { return callCheckStmt(checkIndex, args); };
  24911. };
  24912. ViewBuilder.prototype._createLiteralMapConverter = function (sourceSpan, keys) {
  24913. if (keys.length === 0) {
  24914. var valueExpr_2 = importExpr(Identifiers.EMPTY_MAP);
  24915. return function () { return valueExpr_2; };
  24916. }
  24917. var map = literalMap(keys.map(function (e, i) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, e, { value: literal(i) })); }));
  24918. var checkIndex = this.nodes.length;
  24919. this.nodes.push(function () { return ({
  24920. sourceSpan: sourceSpan,
  24921. nodeFlags: 64 /* TypePureObject */,
  24922. nodeDef: importExpr(Identifiers.pureObjectDef).callFn([
  24923. literal(checkIndex),
  24924. map,
  24925. ])
  24926. }); });
  24927. return function (args) { return callCheckStmt(checkIndex, args); };
  24928. };
  24929. ViewBuilder.prototype._createPipeConverter = function (expression, name, argCount) {
  24930. var pipe = this.usedPipes.find(function (pipeSummary) { return pipeSummary.name === name; });
  24931. if (pipe.pure) {
  24932. var checkIndex_1 = this.nodes.length;
  24933. this.nodes.push(function () { return ({
  24934. sourceSpan: expression.sourceSpan,
  24935. nodeFlags: 128 /* TypePurePipe */,
  24936. nodeDef: importExpr(Identifiers.purePipeDef).callFn([
  24937. literal(checkIndex_1),
  24938. literal(argCount),
  24939. ])
  24940. }); });
  24941. // find underlying pipe in the component view
  24942. var compViewExpr = VIEW_VAR;
  24943. var compBuilder = this;
  24944. while (compBuilder.parent) {
  24945. compBuilder = compBuilder.parent;
  24946. compViewExpr = compViewExpr.prop('parent').cast(DYNAMIC_TYPE);
  24947. }
  24948. var pipeNodeIndex = compBuilder.purePipeNodeIndices[name];
  24949. var pipeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([compViewExpr, literal(pipeNodeIndex)]);
  24950. return function (args) { return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, callCheckStmt(checkIndex_1, [pipeValueExpr_1].concat(args))); };
  24951. }
  24952. else {
  24953. var nodeIndex = this._createPipe(expression.sourceSpan, pipe);
  24954. var nodeValueExpr_1 = importExpr(Identifiers.nodeValue).callFn([VIEW_VAR, literal(nodeIndex)]);
  24955. return function (args) { return callUnwrapValue(expression.nodeIndex, expression.bindingIndex, nodeValueExpr_1.callMethod('transform', args)); };
  24956. }
  24957. };
  24958. ViewBuilder.prototype._createPipe = function (sourceSpan, pipe) {
  24959. var _this = this;
  24960. var nodeIndex = this.nodes.length;
  24961. var flags = 0 /* None */;
  24962. pipe.type.lifecycleHooks.forEach(function (lifecycleHook) {
  24963. // for pipes, we only support ngOnDestroy
  24964. if (lifecycleHook === LifecycleHooks.OnDestroy) {
  24965. flags |= lifecycleHookToNodeFlag(lifecycleHook);
  24966. }
  24967. });
  24968. var depExprs = pipe.type.diDeps.map(function (diDep) { return depDef(_this.outputCtx, diDep); });
  24969. // function pipeDef(
  24970. // flags: NodeFlags, ctor: any, deps: ([DepFlags, any] | any)[]): NodeDef
  24971. this.nodes.push(function () { return ({
  24972. sourceSpan: sourceSpan,
  24973. nodeFlags: 16 /* TypePipe */,
  24974. nodeDef: importExpr(Identifiers.pipeDef).callFn([
  24975. literal(flags), _this.outputCtx.importExpr(pipe.type.reference), literalArr(depExprs)
  24976. ])
  24977. }); });
  24978. return nodeIndex;
  24979. };
  24980. /**
  24981. * For the AST in `UpdateExpression.value`:
  24982. * - create nodes for pipes, literal arrays and, literal maps,
  24983. * - update the AST to replace pipes, literal arrays and, literal maps with calls to check fn.
  24984. *
  24985. * WARNING: This might create new nodeDefs (for pipes and literal arrays and literal maps)!
  24986. */
  24987. ViewBuilder.prototype._preprocessUpdateExpression = function (expression) {
  24988. var _this = this;
  24989. return {
  24990. nodeIndex: expression.nodeIndex,
  24991. bindingIndex: expression.bindingIndex,
  24992. sourceSpan: expression.sourceSpan,
  24993. context: expression.context,
  24994. value: convertPropertyBindingBuiltins({
  24995. createLiteralArrayConverter: function (argCount) { return _this._createLiteralArrayConverter(expression.sourceSpan, argCount); },
  24996. createLiteralMapConverter: function (keys) {
  24997. return _this._createLiteralMapConverter(expression.sourceSpan, keys);
  24998. },
  24999. createPipeConverter: function (name, argCount) {
  25000. return _this._createPipeConverter(expression, name, argCount);
  25001. }
  25002. }, expression.value)
  25003. };
  25004. };
  25005. ViewBuilder.prototype._createNodeExpressions = function () {
  25006. var self = this;
  25007. var updateBindingCount = 0;
  25008. var updateRendererStmts = [];
  25009. var updateDirectivesStmts = [];
  25010. var nodeDefExprs = this.nodes.map(function (factory, nodeIndex) {
  25011. var _a = factory(), nodeDef = _a.nodeDef, nodeFlags = _a.nodeFlags, updateDirectives = _a.updateDirectives, updateRenderer = _a.updateRenderer, sourceSpan = _a.sourceSpan;
  25012. if (updateRenderer) {
  25013. updateRendererStmts.push.apply(updateRendererStmts, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(createUpdateStatements(nodeIndex, sourceSpan, updateRenderer, false)));
  25014. }
  25015. if (updateDirectives) {
  25016. updateDirectivesStmts.push.apply(updateDirectivesStmts, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(createUpdateStatements(nodeIndex, sourceSpan, updateDirectives, (nodeFlags & (262144 /* DoCheck */ | 65536 /* OnInit */)) > 0)));
  25017. }
  25018. // We use a comma expression to call the log function before
  25019. // the nodeDef function, but still use the result of the nodeDef function
  25020. // as the value.
  25021. // Note: We only add the logger to elements / text nodes,
  25022. // so we don't generate too much code.
  25023. var logWithNodeDef = nodeFlags & 3 /* CatRenderNode */ ?
  25024. new CommaExpr([LOG_VAR$1.callFn([]).callFn([]), nodeDef]) :
  25025. nodeDef;
  25026. return applySourceSpanToExpressionIfNeeded(logWithNodeDef, sourceSpan);
  25027. });
  25028. return { updateRendererStmts: updateRendererStmts, updateDirectivesStmts: updateDirectivesStmts, nodeDefExprs: nodeDefExprs };
  25029. function createUpdateStatements(nodeIndex, sourceSpan, expressions, allowEmptyExprs) {
  25030. var updateStmts = [];
  25031. var exprs = expressions.map(function (_a) {
  25032. var sourceSpan = _a.sourceSpan, context = _a.context, value = _a.value;
  25033. var bindingId = "" + updateBindingCount++;
  25034. var nameResolver = context === COMP_VAR ? self : null;
  25035. var _b = convertPropertyBinding(nameResolver, context, value, bindingId, BindingForm.General), stmts = _b.stmts, currValExpr = _b.currValExpr;
  25036. updateStmts.push.apply(updateStmts, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(stmts.map(function (stmt) { return applySourceSpanToStatementIfNeeded(stmt, sourceSpan); })));
  25037. return applySourceSpanToExpressionIfNeeded(currValExpr, sourceSpan);
  25038. });
  25039. if (expressions.length || allowEmptyExprs) {
  25040. updateStmts.push(applySourceSpanToStatementIfNeeded(callCheckStmt(nodeIndex, exprs).toStmt(), sourceSpan));
  25041. }
  25042. return updateStmts;
  25043. }
  25044. };
  25045. ViewBuilder.prototype._createElementHandleEventFn = function (nodeIndex, handlers) {
  25046. var _this = this;
  25047. var handleEventStmts = [];
  25048. var handleEventBindingCount = 0;
  25049. handlers.forEach(function (_a) {
  25050. var context = _a.context, eventAst = _a.eventAst, dirAst = _a.dirAst;
  25051. var bindingId = "" + handleEventBindingCount++;
  25052. var nameResolver = context === COMP_VAR ? _this : null;
  25053. var _b = convertActionBinding(nameResolver, context, eventAst.handler, bindingId), stmts = _b.stmts, allowDefault = _b.allowDefault;
  25054. var trueStmts = stmts;
  25055. if (allowDefault) {
  25056. trueStmts.push(ALLOW_DEFAULT_VAR.set(allowDefault.and(ALLOW_DEFAULT_VAR)).toStmt());
  25057. }
  25058. var _c = elementEventNameAndTarget(eventAst, dirAst), eventTarget = _c.target, eventName = _c.name;
  25059. var fullEventName = elementEventFullName(eventTarget, eventName);
  25060. handleEventStmts.push(applySourceSpanToStatementIfNeeded(new IfStmt(literal(fullEventName).identical(EVENT_NAME_VAR), trueStmts), eventAst.sourceSpan));
  25061. });
  25062. var handleEventFn;
  25063. if (handleEventStmts.length > 0) {
  25064. var preStmts = [ALLOW_DEFAULT_VAR.set(literal(true)).toDeclStmt(BOOL_TYPE)];
  25065. if (!this.component.isHost && findReadVarNames(handleEventStmts).has(COMP_VAR.name)) {
  25066. preStmts.push(COMP_VAR.set(VIEW_VAR.prop('component')).toDeclStmt(this.compType));
  25067. }
  25068. handleEventFn = fn([
  25069. new FnParam(VIEW_VAR.name, INFERRED_TYPE),
  25070. new FnParam(EVENT_NAME_VAR.name, INFERRED_TYPE),
  25071. new FnParam(EventHandlerVars.event.name, INFERRED_TYPE)
  25072. ], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(preStmts, handleEventStmts, [new ReturnStatement(ALLOW_DEFAULT_VAR)]), INFERRED_TYPE);
  25073. }
  25074. else {
  25075. handleEventFn = NULL_EXPR;
  25076. }
  25077. return handleEventFn;
  25078. };
  25079. ViewBuilder.prototype.visitDirective = function (ast, context) { };
  25080. ViewBuilder.prototype.visitDirectiveProperty = function (ast, context) { };
  25081. ViewBuilder.prototype.visitReference = function (ast, context) { };
  25082. ViewBuilder.prototype.visitVariable = function (ast, context) { };
  25083. ViewBuilder.prototype.visitEvent = function (ast, context) { };
  25084. ViewBuilder.prototype.visitElementProperty = function (ast, context) { };
  25085. ViewBuilder.prototype.visitAttr = function (ast, context) { };
  25086. return ViewBuilder;
  25087. }());
  25088. function needsAdditionalRootNode(astNodes) {
  25089. var lastAstNode = astNodes[astNodes.length - 1];
  25090. if (lastAstNode instanceof EmbeddedTemplateAst) {
  25091. return lastAstNode.hasViewContainer;
  25092. }
  25093. if (lastAstNode instanceof ElementAst) {
  25094. if (isNgContainer(lastAstNode.name) && lastAstNode.children.length) {
  25095. return needsAdditionalRootNode(lastAstNode.children);
  25096. }
  25097. return lastAstNode.hasViewContainer;
  25098. }
  25099. return lastAstNode instanceof NgContentAst;
  25100. }
  25101. function elementBindingDef(inputAst, dirAst) {
  25102. switch (inputAst.type) {
  25103. case 1 /* Attribute */:
  25104. return literalArr([
  25105. literal(1 /* TypeElementAttribute */), literal(inputAst.name),
  25106. literal(inputAst.securityContext)
  25107. ]);
  25108. case 0 /* Property */:
  25109. return literalArr([
  25110. literal(8 /* TypeProperty */), literal(inputAst.name),
  25111. literal(inputAst.securityContext)
  25112. ]);
  25113. case 4 /* Animation */:
  25114. var bindingType = 8 /* TypeProperty */ |
  25115. (dirAst && dirAst.directive.isComponent ? 32 /* SyntheticHostProperty */ :
  25116. 16 /* SyntheticProperty */);
  25117. return literalArr([
  25118. literal(bindingType), literal('@' + inputAst.name), literal(inputAst.securityContext)
  25119. ]);
  25120. case 2 /* Class */:
  25121. return literalArr([literal(2 /* TypeElementClass */), literal(inputAst.name), NULL_EXPR]);
  25122. case 3 /* Style */:
  25123. return literalArr([
  25124. literal(4 /* TypeElementStyle */), literal(inputAst.name), literal(inputAst.unit)
  25125. ]);
  25126. }
  25127. }
  25128. function fixedAttrsDef(elementAst) {
  25129. var mapResult = Object.create(null);
  25130. elementAst.attrs.forEach(function (attrAst) { mapResult[attrAst.name] = attrAst.value; });
  25131. elementAst.directives.forEach(function (dirAst) {
  25132. Object.keys(dirAst.directive.hostAttributes).forEach(function (name) {
  25133. var value = dirAst.directive.hostAttributes[name];
  25134. var prevValue = mapResult[name];
  25135. mapResult[name] = prevValue != null ? mergeAttributeValue(name, prevValue, value) : value;
  25136. });
  25137. });
  25138. // Note: We need to sort to get a defined output order
  25139. // for tests and for caching generated artifacts...
  25140. return literalArr(Object.keys(mapResult).sort().map(function (attrName) { return literalArr([literal(attrName), literal(mapResult[attrName])]); }));
  25141. }
  25142. function mergeAttributeValue(attrName, attrValue1, attrValue2) {
  25143. if (attrName == CLASS_ATTR$1 || attrName == STYLE_ATTR) {
  25144. return attrValue1 + " " + attrValue2;
  25145. }
  25146. else {
  25147. return attrValue2;
  25148. }
  25149. }
  25150. function callCheckStmt(nodeIndex, exprs) {
  25151. if (exprs.length > 10) {
  25152. return CHECK_VAR.callFn([VIEW_VAR, literal(nodeIndex), literal(1 /* Dynamic */), literalArr(exprs)]);
  25153. }
  25154. else {
  25155. return CHECK_VAR.callFn(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([VIEW_VAR, literal(nodeIndex), literal(0 /* Inline */)], exprs));
  25156. }
  25157. }
  25158. function callUnwrapValue(nodeIndex, bindingIdx, expr) {
  25159. return importExpr(Identifiers.unwrapValue).callFn([
  25160. VIEW_VAR, literal(nodeIndex), literal(bindingIdx), expr
  25161. ]);
  25162. }
  25163. function findStaticQueryIds(nodes, result) {
  25164. if (result === void 0) { result = new Map(); }
  25165. nodes.forEach(function (node) {
  25166. var staticQueryIds = new Set();
  25167. var dynamicQueryIds = new Set();
  25168. var queryMatches = undefined;
  25169. if (node instanceof ElementAst) {
  25170. findStaticQueryIds(node.children, result);
  25171. node.children.forEach(function (child) {
  25172. var childData = result.get(child);
  25173. childData.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
  25174. childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  25175. });
  25176. queryMatches = node.queryMatches;
  25177. }
  25178. else if (node instanceof EmbeddedTemplateAst) {
  25179. findStaticQueryIds(node.children, result);
  25180. node.children.forEach(function (child) {
  25181. var childData = result.get(child);
  25182. childData.staticQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  25183. childData.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  25184. });
  25185. queryMatches = node.queryMatches;
  25186. }
  25187. if (queryMatches) {
  25188. queryMatches.forEach(function (match) { return staticQueryIds.add(match.queryId); });
  25189. }
  25190. dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
  25191. result.set(node, { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds });
  25192. });
  25193. return result;
  25194. }
  25195. function staticViewQueryIds(nodeStaticQueryIds) {
  25196. var staticQueryIds = new Set();
  25197. var dynamicQueryIds = new Set();
  25198. Array.from(nodeStaticQueryIds.values()).forEach(function (entry) {
  25199. entry.staticQueryIds.forEach(function (queryId) { return staticQueryIds.add(queryId); });
  25200. entry.dynamicQueryIds.forEach(function (queryId) { return dynamicQueryIds.add(queryId); });
  25201. });
  25202. dynamicQueryIds.forEach(function (queryId) { return staticQueryIds.delete(queryId); });
  25203. return { staticQueryIds: staticQueryIds, dynamicQueryIds: dynamicQueryIds };
  25204. }
  25205. function elementEventNameAndTarget(eventAst, dirAst) {
  25206. if (eventAst.isAnimation) {
  25207. return {
  25208. name: "@" + eventAst.name + "." + eventAst.phase,
  25209. target: dirAst && dirAst.directive.isComponent ? 'component' : null
  25210. };
  25211. }
  25212. else {
  25213. return eventAst;
  25214. }
  25215. }
  25216. function calcStaticDynamicQueryFlags(queryIds, queryId, isFirst) {
  25217. var flags = 0 /* None */;
  25218. // Note: We only make queries static that query for a single item.
  25219. // This is because of backwards compatibility with the old view compiler...
  25220. if (isFirst && (queryIds.staticQueryIds.has(queryId) || !queryIds.dynamicQueryIds.has(queryId))) {
  25221. flags |= 268435456 /* StaticQuery */;
  25222. }
  25223. else {
  25224. flags |= 536870912 /* DynamicQuery */;
  25225. }
  25226. return flags;
  25227. }
  25228. function elementEventFullName(target, name) {
  25229. return target ? target + ":" + name : name;
  25230. }
  25231. /**
  25232. * @license
  25233. * Copyright Google Inc. All Rights Reserved.
  25234. *
  25235. * Use of this source code is governed by an MIT-style license that can be
  25236. * found in the LICENSE file at https://angular.io/license
  25237. */
  25238. var CONSTANT_PREFIX = '_c';
  25239. // Closure variables holding messages must be named `MSG_[A-Z0-9]+`
  25240. var TRANSLATION_PREFIX = 'MSG_';
  25241. /**
  25242. * Closure uses `goog.getMsg(message)` to lookup translations
  25243. */
  25244. var GOOG_GET_MSG = 'goog.getMsg';
  25245. /**
  25246. * Context to use when producing a key.
  25247. *
  25248. * This ensures we see the constant not the reference variable when producing
  25249. * a key.
  25250. */
  25251. var KEY_CONTEXT = {};
  25252. /**
  25253. * A node that is a place-holder that allows the node to be replaced when the actual
  25254. * node is known.
  25255. *
  25256. * This allows the constant pool to change an expression from a direct reference to
  25257. * a constant to a shared constant. It returns a fix-up node that is later allowed to
  25258. * change the referenced expression.
  25259. */
  25260. var FixupExpression = /** @class */ (function (_super) {
  25261. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FixupExpression, _super);
  25262. function FixupExpression(resolved) {
  25263. var _this = _super.call(this, resolved.type) || this;
  25264. _this.resolved = resolved;
  25265. _this.original = resolved;
  25266. return _this;
  25267. }
  25268. FixupExpression.prototype.visitExpression = function (visitor, context) {
  25269. if (context === KEY_CONTEXT) {
  25270. // When producing a key we want to traverse the constant not the
  25271. // variable used to refer to it.
  25272. return this.original.visitExpression(visitor, context);
  25273. }
  25274. else {
  25275. return this.resolved.visitExpression(visitor, context);
  25276. }
  25277. };
  25278. FixupExpression.prototype.isEquivalent = function (e) {
  25279. return e instanceof FixupExpression && this.resolved.isEquivalent(e.resolved);
  25280. };
  25281. FixupExpression.prototype.isConstant = function () { return true; };
  25282. FixupExpression.prototype.fixup = function (expression) {
  25283. this.resolved = expression;
  25284. this.shared = true;
  25285. };
  25286. return FixupExpression;
  25287. }(Expression));
  25288. /**
  25289. * A constant pool allows a code emitter to share constant in an output context.
  25290. *
  25291. * The constant pool also supports sharing access to ivy definitions references.
  25292. */
  25293. var ConstantPool = /** @class */ (function () {
  25294. function ConstantPool() {
  25295. this.statements = [];
  25296. this.translations = new Map();
  25297. this.literals = new Map();
  25298. this.literalFactories = new Map();
  25299. this.injectorDefinitions = new Map();
  25300. this.directiveDefinitions = new Map();
  25301. this.componentDefinitions = new Map();
  25302. this.pipeDefinitions = new Map();
  25303. this.nextNameIndex = 0;
  25304. }
  25305. ConstantPool.prototype.getConstLiteral = function (literal$$1, forceShared) {
  25306. if (literal$$1 instanceof LiteralExpr || literal$$1 instanceof FixupExpression) {
  25307. // Do no put simple literals into the constant pool or try to produce a constant for a
  25308. // reference to a constant.
  25309. return literal$$1;
  25310. }
  25311. var key = this.keyOf(literal$$1);
  25312. var fixup = this.literals.get(key);
  25313. var newValue = false;
  25314. if (!fixup) {
  25315. fixup = new FixupExpression(literal$$1);
  25316. this.literals.set(key, fixup);
  25317. newValue = true;
  25318. }
  25319. if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
  25320. // Replace the expression with a variable
  25321. var name_1 = this.freshName();
  25322. this.statements.push(variable(name_1).set(literal$$1).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]));
  25323. fixup.fixup(variable(name_1));
  25324. }
  25325. return fixup;
  25326. };
  25327. // Generates closure specific code for translation.
  25328. //
  25329. // ```
  25330. // /**
  25331. // * @desc description?
  25332. // * @meaning meaning?
  25333. // */
  25334. // const MSG_XYZ = goog.getMsg('message');
  25335. // ```
  25336. ConstantPool.prototype.getTranslation = function (message, meta) {
  25337. // The identity of an i18n message depends on the message and its meaning
  25338. var key = meta.meaning ? message + "\0\0" + meta.meaning : message;
  25339. var exp = this.translations.get(key);
  25340. if (exp) {
  25341. return exp;
  25342. }
  25343. var docStmt = i18nMetaToDocStmt(meta);
  25344. if (docStmt) {
  25345. this.statements.push(docStmt);
  25346. }
  25347. // Call closure to get the translation
  25348. var variable$$1 = variable(this.freshTranslationName());
  25349. var fnCall = variable(GOOG_GET_MSG).callFn([literal(message)]);
  25350. var msgStmt = variable$$1.set(fnCall).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]);
  25351. this.statements.push(msgStmt);
  25352. this.translations.set(key, variable$$1);
  25353. return variable$$1;
  25354. };
  25355. ConstantPool.prototype.getDefinition = function (type, kind, ctx, forceShared) {
  25356. if (forceShared === void 0) { forceShared = false; }
  25357. var definitions = this.definitionsOf(kind);
  25358. var fixup = definitions.get(type);
  25359. var newValue = false;
  25360. if (!fixup) {
  25361. var property = this.propertyNameOf(kind);
  25362. fixup = new FixupExpression(ctx.importExpr(type).prop(property));
  25363. definitions.set(type, fixup);
  25364. newValue = true;
  25365. }
  25366. if ((!newValue && !fixup.shared) || (newValue && forceShared)) {
  25367. var name_2 = this.freshName();
  25368. this.statements.push(variable(name_2).set(fixup.resolved).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]));
  25369. fixup.fixup(variable(name_2));
  25370. }
  25371. return fixup;
  25372. };
  25373. ConstantPool.prototype.getLiteralFactory = function (literal$$1) {
  25374. // Create a pure function that builds an array of a mix of constant and variable expressions
  25375. if (literal$$1 instanceof LiteralArrayExpr) {
  25376. var argumentsForKey = literal$$1.entries.map(function (e) { return e.isConstant() ? e : literal(null); });
  25377. var key = this.keyOf(literalArr(argumentsForKey));
  25378. return this._getLiteralFactory(key, literal$$1.entries, function (entries) { return literalArr(entries); });
  25379. }
  25380. else {
  25381. var expressionForKey = literalMap(literal$$1.entries.map(function (e) { return ({
  25382. key: e.key,
  25383. value: e.value.isConstant() ? e.value : literal(null),
  25384. quoted: e.quoted
  25385. }); }));
  25386. var key = this.keyOf(expressionForKey);
  25387. return this._getLiteralFactory(key, literal$$1.entries.map(function (e) { return e.value; }), function (entries) { return literalMap(entries.map(function (value, index) { return ({
  25388. key: literal$$1.entries[index].key,
  25389. value: value,
  25390. quoted: literal$$1.entries[index].quoted
  25391. }); })); });
  25392. }
  25393. };
  25394. ConstantPool.prototype._getLiteralFactory = function (key, values, resultMap) {
  25395. var _this = this;
  25396. var literalFactory = this.literalFactories.get(key);
  25397. var literalFactoryArguments = values.filter((function (e) { return !e.isConstant(); }));
  25398. if (!literalFactory) {
  25399. var resultExpressions = values.map(function (e, index) { return e.isConstant() ? _this.getConstLiteral(e, true) : variable("a" + index); });
  25400. var parameters = resultExpressions.filter(isVariable).map(function (e) { return new FnParam(e.name, DYNAMIC_TYPE); });
  25401. var pureFunctionDeclaration = fn(parameters, [new ReturnStatement(resultMap(resultExpressions))], INFERRED_TYPE);
  25402. var name_3 = this.freshName();
  25403. this.statements.push(variable(name_3).set(pureFunctionDeclaration).toDeclStmt(INFERRED_TYPE, [
  25404. StmtModifier.Final
  25405. ]));
  25406. literalFactory = variable(name_3);
  25407. this.literalFactories.set(key, literalFactory);
  25408. }
  25409. return { literalFactory: literalFactory, literalFactoryArguments: literalFactoryArguments };
  25410. };
  25411. /**
  25412. * Produce a unique name.
  25413. *
  25414. * The name might be unique among different prefixes if any of the prefixes end in
  25415. * a digit so the prefix should be a constant string (not based on user input) and
  25416. * must not end in a digit.
  25417. */
  25418. ConstantPool.prototype.uniqueName = function (prefix) { return "" + prefix + this.nextNameIndex++; };
  25419. ConstantPool.prototype.definitionsOf = function (kind) {
  25420. switch (kind) {
  25421. case 2 /* Component */:
  25422. return this.componentDefinitions;
  25423. case 1 /* Directive */:
  25424. return this.directiveDefinitions;
  25425. case 0 /* Injector */:
  25426. return this.injectorDefinitions;
  25427. case 3 /* Pipe */:
  25428. return this.pipeDefinitions;
  25429. }
  25430. error("Unknown definition kind " + kind);
  25431. return this.componentDefinitions;
  25432. };
  25433. ConstantPool.prototype.propertyNameOf = function (kind) {
  25434. switch (kind) {
  25435. case 2 /* Component */:
  25436. return 'ngComponentDef';
  25437. case 1 /* Directive */:
  25438. return 'ngDirectiveDef';
  25439. case 0 /* Injector */:
  25440. return 'ngInjectorDef';
  25441. case 3 /* Pipe */:
  25442. return 'ngPipeDef';
  25443. }
  25444. error("Unknown definition kind " + kind);
  25445. return '<unknown>';
  25446. };
  25447. ConstantPool.prototype.freshName = function () { return this.uniqueName(CONSTANT_PREFIX); };
  25448. ConstantPool.prototype.freshTranslationName = function () {
  25449. return this.uniqueName(TRANSLATION_PREFIX).toUpperCase();
  25450. };
  25451. ConstantPool.prototype.keyOf = function (expression) {
  25452. return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
  25453. };
  25454. return ConstantPool;
  25455. }());
  25456. /**
  25457. * Visitor used to determine if 2 expressions are equivalent and can be shared in the
  25458. * `ConstantPool`.
  25459. *
  25460. * When the id (string) generated by the visitor is equal, expressions are considered equivalent.
  25461. */
  25462. var KeyVisitor = /** @class */ (function () {
  25463. function KeyVisitor() {
  25464. this.visitWrappedNodeExpr = invalid;
  25465. this.visitWriteVarExpr = invalid;
  25466. this.visitWriteKeyExpr = invalid;
  25467. this.visitWritePropExpr = invalid;
  25468. this.visitInvokeMethodExpr = invalid;
  25469. this.visitInvokeFunctionExpr = invalid;
  25470. this.visitInstantiateExpr = invalid;
  25471. this.visitConditionalExpr = invalid;
  25472. this.visitNotExpr = invalid;
  25473. this.visitAssertNotNullExpr = invalid;
  25474. this.visitCastExpr = invalid;
  25475. this.visitFunctionExpr = invalid;
  25476. this.visitBinaryOperatorExpr = invalid;
  25477. this.visitReadPropExpr = invalid;
  25478. this.visitReadKeyExpr = invalid;
  25479. this.visitCommaExpr = invalid;
  25480. }
  25481. KeyVisitor.prototype.visitLiteralExpr = function (ast) {
  25482. return "" + (typeof ast.value === 'string' ? '"' + ast.value + '"' : ast.value);
  25483. };
  25484. KeyVisitor.prototype.visitLiteralArrayExpr = function (ast, context) {
  25485. var _this = this;
  25486. return "[" + ast.entries.map(function (entry) { return entry.visitExpression(_this, context); }).join(',') + "]";
  25487. };
  25488. KeyVisitor.prototype.visitLiteralMapExpr = function (ast, context) {
  25489. var _this = this;
  25490. var mapKey = function (entry) {
  25491. var quote = entry.quoted ? '"' : '';
  25492. return "" + quote + entry.key + quote;
  25493. };
  25494. var mapEntry = function (entry) {
  25495. return mapKey(entry) + ":" + entry.value.visitExpression(_this, context);
  25496. };
  25497. return "{" + ast.entries.map(mapEntry).join(',');
  25498. };
  25499. KeyVisitor.prototype.visitExternalExpr = function (ast) {
  25500. return ast.value.moduleName ? "EX:" + ast.value.moduleName + ":" + ast.value.name :
  25501. "EX:" + ast.value.runtime.name;
  25502. };
  25503. KeyVisitor.prototype.visitReadVarExpr = function (node) { return "VAR:" + node.name; };
  25504. KeyVisitor.prototype.visitTypeofExpr = function (node, context) {
  25505. return "TYPEOF:" + node.expr.visitExpression(this, context);
  25506. };
  25507. return KeyVisitor;
  25508. }());
  25509. function invalid(arg) {
  25510. throw new Error("Invalid state: Visitor " + this.constructor.name + " doesn't handle " + arg.constructor.name);
  25511. }
  25512. function isVariable(e) {
  25513. return e instanceof ReadVarExpr;
  25514. }
  25515. // Converts i18n meta informations for a message (description, meaning) to a JsDoc statement
  25516. // formatted as expected by the Closure compiler.
  25517. function i18nMetaToDocStmt(meta) {
  25518. var tags = [];
  25519. if (meta.description) {
  25520. tags.push({ tagName: "desc" /* Desc */, text: meta.description });
  25521. }
  25522. if (meta.meaning) {
  25523. tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
  25524. }
  25525. return tags.length == 0 ? null : new JSDocCommentStmt(tags);
  25526. }
  25527. /**
  25528. * @license
  25529. * Copyright Google Inc. All Rights Reserved.
  25530. *
  25531. * Use of this source code is governed by an MIT-style license that can be
  25532. * found in the LICENSE file at https://angular.io/license
  25533. */
  25534. /**
  25535. * A container for message extracted from the templates.
  25536. */
  25537. var MessageBundle = /** @class */ (function () {
  25538. function MessageBundle(_htmlParser, _implicitTags, _implicitAttrs, _locale) {
  25539. if (_locale === void 0) { _locale = null; }
  25540. this._htmlParser = _htmlParser;
  25541. this._implicitTags = _implicitTags;
  25542. this._implicitAttrs = _implicitAttrs;
  25543. this._locale = _locale;
  25544. this._messages = [];
  25545. }
  25546. MessageBundle.prototype.updateFromTemplate = function (html, url, interpolationConfig) {
  25547. var _a;
  25548. var htmlParserResult = this._htmlParser.parse(html, url, true, interpolationConfig);
  25549. if (htmlParserResult.errors.length) {
  25550. return htmlParserResult.errors;
  25551. }
  25552. var i18nParserResult = extractMessages(htmlParserResult.rootNodes, interpolationConfig, this._implicitTags, this._implicitAttrs);
  25553. if (i18nParserResult.errors.length) {
  25554. return i18nParserResult.errors;
  25555. }
  25556. (_a = this._messages).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(i18nParserResult.messages));
  25557. return [];
  25558. };
  25559. // Return the message in the internal format
  25560. // The public (serialized) format might be different, see the `write` method.
  25561. MessageBundle.prototype.getMessages = function () { return this._messages; };
  25562. MessageBundle.prototype.write = function (serializer, filterSources) {
  25563. var messages = {};
  25564. var mapperVisitor = new MapPlaceholderNames();
  25565. // Deduplicate messages based on their ID
  25566. this._messages.forEach(function (message) {
  25567. var _a;
  25568. var id = serializer.digest(message);
  25569. if (!messages.hasOwnProperty(id)) {
  25570. messages[id] = message;
  25571. }
  25572. else {
  25573. (_a = messages[id].sources).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(message.sources));
  25574. }
  25575. });
  25576. // Transform placeholder names using the serializer mapping
  25577. var msgList = Object.keys(messages).map(function (id) {
  25578. var mapper = serializer.createNameMapper(messages[id]);
  25579. var src = messages[id];
  25580. var nodes = mapper ? mapperVisitor.convert(src.nodes, mapper) : src.nodes;
  25581. var transformedMessage = new Message(nodes, {}, {}, src.meaning, src.description, id);
  25582. transformedMessage.sources = src.sources;
  25583. if (filterSources) {
  25584. transformedMessage.sources.forEach(function (source) { return source.filePath = filterSources(source.filePath); });
  25585. }
  25586. return transformedMessage;
  25587. });
  25588. return serializer.write(msgList, this._locale);
  25589. };
  25590. return MessageBundle;
  25591. }());
  25592. // Transform an i18n AST by renaming the placeholder nodes with the given mapper
  25593. var MapPlaceholderNames = /** @class */ (function (_super) {
  25594. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(MapPlaceholderNames, _super);
  25595. function MapPlaceholderNames() {
  25596. return _super !== null && _super.apply(this, arguments) || this;
  25597. }
  25598. MapPlaceholderNames.prototype.convert = function (nodes, mapper) {
  25599. var _this = this;
  25600. return mapper ? nodes.map(function (n) { return n.visit(_this, mapper); }) : nodes;
  25601. };
  25602. MapPlaceholderNames.prototype.visitTagPlaceholder = function (ph, mapper) {
  25603. var _this = this;
  25604. var startName = mapper.toPublicName(ph.startName);
  25605. var closeName = ph.closeName ? mapper.toPublicName(ph.closeName) : ph.closeName;
  25606. var children = ph.children.map(function (n) { return n.visit(_this, mapper); });
  25607. return new TagPlaceholder(ph.tag, ph.attrs, startName, closeName, children, ph.isVoid, ph.sourceSpan);
  25608. };
  25609. MapPlaceholderNames.prototype.visitPlaceholder = function (ph, mapper) {
  25610. return new Placeholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
  25611. };
  25612. MapPlaceholderNames.prototype.visitIcuPlaceholder = function (ph, mapper) {
  25613. return new IcuPlaceholder(ph.value, mapper.toPublicName(ph.name), ph.sourceSpan);
  25614. };
  25615. return MapPlaceholderNames;
  25616. }(CloneVisitor));
  25617. /**
  25618. * @license
  25619. * Copyright Google Inc. All Rights Reserved.
  25620. *
  25621. * Use of this source code is governed by an MIT-style license that can be
  25622. * found in the LICENSE file at https://angular.io/license
  25623. */
  25624. function mapLiteral(obj) {
  25625. return literalMap(Object.keys(obj).map(function (key) { return ({
  25626. key: key,
  25627. quoted: false,
  25628. value: obj[key],
  25629. }); }));
  25630. }
  25631. /**
  25632. * @license
  25633. * Copyright Google Inc. All Rights Reserved.
  25634. *
  25635. * Use of this source code is governed by an MIT-style license that can be
  25636. * found in the LICENSE file at https://angular.io/license
  25637. */
  25638. var CORE$1 = '@angular/core';
  25639. var Identifiers$1 = /** @class */ (function () {
  25640. function Identifiers() {
  25641. }
  25642. /* Methods */
  25643. Identifiers.NEW_METHOD = 'factory';
  25644. Identifiers.TRANSFORM_METHOD = 'transform';
  25645. Identifiers.PATCH_DEPS = 'patchedDeps';
  25646. /* Instructions */
  25647. Identifiers.namespaceHTML = { name: 'ɵNH', moduleName: CORE$1 };
  25648. Identifiers.namespaceMathML = { name: 'ɵNM', moduleName: CORE$1 };
  25649. Identifiers.namespaceSVG = { name: 'ɵNS', moduleName: CORE$1 };
  25650. Identifiers.element = { name: 'ɵEe', moduleName: CORE$1 };
  25651. Identifiers.elementStart = { name: 'ɵE', moduleName: CORE$1 };
  25652. Identifiers.elementEnd = { name: 'ɵe', moduleName: CORE$1 };
  25653. Identifiers.elementProperty = { name: 'ɵp', moduleName: CORE$1 };
  25654. Identifiers.elementAttribute = { name: 'ɵa', moduleName: CORE$1 };
  25655. Identifiers.elementClassProp = { name: 'ɵcp', moduleName: CORE$1 };
  25656. Identifiers.elementStyling = { name: 'ɵs', moduleName: CORE$1 };
  25657. Identifiers.elementStylingMap = { name: 'ɵsm', moduleName: CORE$1 };
  25658. Identifiers.elementStyleProp = { name: 'ɵsp', moduleName: CORE$1 };
  25659. Identifiers.elementStylingApply = { name: 'ɵsa', moduleName: CORE$1 };
  25660. Identifiers.containerCreate = { name: 'ɵC', moduleName: CORE$1 };
  25661. Identifiers.text = { name: 'ɵT', moduleName: CORE$1 };
  25662. Identifiers.textBinding = { name: 'ɵt', moduleName: CORE$1 };
  25663. Identifiers.bind = { name: 'ɵb', moduleName: CORE$1 };
  25664. Identifiers.interpolation1 = { name: 'ɵi1', moduleName: CORE$1 };
  25665. Identifiers.interpolation2 = { name: 'ɵi2', moduleName: CORE$1 };
  25666. Identifiers.interpolation3 = { name: 'ɵi3', moduleName: CORE$1 };
  25667. Identifiers.interpolation4 = { name: 'ɵi4', moduleName: CORE$1 };
  25668. Identifiers.interpolation5 = { name: 'ɵi5', moduleName: CORE$1 };
  25669. Identifiers.interpolation6 = { name: 'ɵi6', moduleName: CORE$1 };
  25670. Identifiers.interpolation7 = { name: 'ɵi7', moduleName: CORE$1 };
  25671. Identifiers.interpolation8 = { name: 'ɵi8', moduleName: CORE$1 };
  25672. Identifiers.interpolationV = { name: 'ɵiV', moduleName: CORE$1 };
  25673. Identifiers.pureFunction0 = { name: 'ɵf0', moduleName: CORE$1 };
  25674. Identifiers.pureFunction1 = { name: 'ɵf1', moduleName: CORE$1 };
  25675. Identifiers.pureFunction2 = { name: 'ɵf2', moduleName: CORE$1 };
  25676. Identifiers.pureFunction3 = { name: 'ɵf3', moduleName: CORE$1 };
  25677. Identifiers.pureFunction4 = { name: 'ɵf4', moduleName: CORE$1 };
  25678. Identifiers.pureFunction5 = { name: 'ɵf5', moduleName: CORE$1 };
  25679. Identifiers.pureFunction6 = { name: 'ɵf6', moduleName: CORE$1 };
  25680. Identifiers.pureFunction7 = { name: 'ɵf7', moduleName: CORE$1 };
  25681. Identifiers.pureFunction8 = { name: 'ɵf8', moduleName: CORE$1 };
  25682. Identifiers.pureFunctionV = { name: 'ɵfV', moduleName: CORE$1 };
  25683. Identifiers.pipeBind1 = { name: 'ɵpb1', moduleName: CORE$1 };
  25684. Identifiers.pipeBind2 = { name: 'ɵpb2', moduleName: CORE$1 };
  25685. Identifiers.pipeBind3 = { name: 'ɵpb3', moduleName: CORE$1 };
  25686. Identifiers.pipeBind4 = { name: 'ɵpb4', moduleName: CORE$1 };
  25687. Identifiers.pipeBindV = { name: 'ɵpbV', moduleName: CORE$1 };
  25688. Identifiers.load = { name: 'ɵld', moduleName: CORE$1 };
  25689. Identifiers.loadDirective = { name: 'ɵd', moduleName: CORE$1 };
  25690. Identifiers.loadQueryList = { name: 'ɵql', moduleName: CORE$1 };
  25691. Identifiers.pipe = { name: 'ɵPp', moduleName: CORE$1 };
  25692. Identifiers.projection = { name: 'ɵP', moduleName: CORE$1 };
  25693. Identifiers.projectionDef = { name: 'ɵpD', moduleName: CORE$1 };
  25694. Identifiers.inject = { name: 'inject', moduleName: CORE$1 };
  25695. Identifiers.injectAttribute = { name: 'ɵinjectAttribute', moduleName: CORE$1 };
  25696. Identifiers.injectElementRef = { name: 'ɵinjectElementRef', moduleName: CORE$1 };
  25697. Identifiers.injectTemplateRef = { name: 'ɵinjectTemplateRef', moduleName: CORE$1 };
  25698. Identifiers.injectViewContainerRef = { name: 'ɵinjectViewContainerRef', moduleName: CORE$1 };
  25699. Identifiers.injectChangeDetectorRef = { name: 'ɵinjectChangeDetectorRef', moduleName: CORE$1 };
  25700. Identifiers.directiveInject = { name: 'ɵdirectiveInject', moduleName: CORE$1 };
  25701. Identifiers.defineComponent = { name: 'ɵdefineComponent', moduleName: CORE$1 };
  25702. Identifiers.ComponentDef = {
  25703. name: 'ɵComponentDef',
  25704. moduleName: CORE$1,
  25705. };
  25706. Identifiers.defineDirective = {
  25707. name: 'ɵdefineDirective',
  25708. moduleName: CORE$1,
  25709. };
  25710. Identifiers.DirectiveDef = {
  25711. name: 'ɵDirectiveDef',
  25712. moduleName: CORE$1,
  25713. };
  25714. Identifiers.InjectorDef = {
  25715. name: 'ɵInjectorDef',
  25716. moduleName: CORE$1,
  25717. };
  25718. Identifiers.defineInjector = {
  25719. name: 'defineInjector',
  25720. moduleName: CORE$1,
  25721. };
  25722. Identifiers.NgModuleDef = {
  25723. name: 'ɵNgModuleDef',
  25724. moduleName: CORE$1,
  25725. };
  25726. Identifiers.defineNgModule = { name: 'ɵdefineNgModule', moduleName: CORE$1 };
  25727. Identifiers.PipeDef = { name: 'ɵPipeDef', moduleName: CORE$1 };
  25728. Identifiers.definePipe = { name: 'ɵdefinePipe', moduleName: CORE$1 };
  25729. Identifiers.query = { name: 'ɵQ', moduleName: CORE$1 };
  25730. Identifiers.queryRefresh = { name: 'ɵqR', moduleName: CORE$1 };
  25731. Identifiers.registerContentQuery = { name: 'ɵQr', moduleName: CORE$1 };
  25732. Identifiers.NgOnChangesFeature = { name: 'ɵNgOnChangesFeature', moduleName: CORE$1 };
  25733. Identifiers.InheritDefinitionFeature = { name: 'ɵInheritDefinitionFeature', moduleName: CORE$1 };
  25734. Identifiers.listener = { name: 'ɵL', moduleName: CORE$1 };
  25735. // Reserve slots for pure functions
  25736. Identifiers.reserveSlots = { name: 'ɵrS', moduleName: CORE$1 };
  25737. // sanitization-related functions
  25738. Identifiers.sanitizeHtml = { name: 'ɵzh', moduleName: CORE$1 };
  25739. Identifiers.sanitizeStyle = { name: 'ɵzs', moduleName: CORE$1 };
  25740. Identifiers.defaultStyleSanitizer = { name: 'ɵzss', moduleName: CORE$1 };
  25741. Identifiers.sanitizeResourceUrl = { name: 'ɵzr', moduleName: CORE$1 };
  25742. Identifiers.sanitizeScript = { name: 'ɵzc', moduleName: CORE$1 };
  25743. Identifiers.sanitizeUrl = { name: 'ɵzu', moduleName: CORE$1 };
  25744. return Identifiers;
  25745. }());
  25746. /**
  25747. * @license
  25748. * Copyright Google Inc. All Rights Reserved.
  25749. *
  25750. * Use of this source code is governed by an MIT-style license that can be
  25751. * found in the LICENSE file at https://angular.io/license
  25752. */
  25753. /** Name of the temporary to use during data binding */
  25754. var TEMPORARY_NAME = '_t';
  25755. /** Name of the context parameter passed into a template function */
  25756. var CONTEXT_NAME = 'ctx';
  25757. /** Name of the RenderFlag passed into a template function */
  25758. var RENDER_FLAGS = 'rf';
  25759. /** The prefix reference variables */
  25760. var REFERENCE_PREFIX = '_r';
  25761. /** The name of the implicit context reference */
  25762. var IMPLICIT_REFERENCE = '$implicit';
  25763. /** Name of the i18n attributes **/
  25764. var I18N_ATTR = 'i18n';
  25765. var I18N_ATTR_PREFIX = 'i18n-';
  25766. /** I18n separators for metadata **/
  25767. var MEANING_SEPARATOR$1 = '|';
  25768. var ID_SEPARATOR$1 = '@@';
  25769. /**
  25770. * Creates an allocator for a temporary variable.
  25771. *
  25772. * A variable declaration is added to the statements the first time the allocator is invoked.
  25773. */
  25774. function temporaryAllocator(statements, name) {
  25775. var temp = null;
  25776. return function () {
  25777. if (!temp) {
  25778. statements.push(new DeclareVarStmt(TEMPORARY_NAME, undefined, DYNAMIC_TYPE));
  25779. temp = variable(name);
  25780. }
  25781. return temp;
  25782. };
  25783. }
  25784. function unsupported(feature) {
  25785. if (this) {
  25786. throw new Error("Builder " + this.constructor.name + " doesn't support " + feature + " yet");
  25787. }
  25788. throw new Error("Feature " + feature + " is not supported yet");
  25789. }
  25790. function invalid$1(arg) {
  25791. throw new Error("Invalid state: Visitor " + this.constructor.name + " doesn't handle " + undefined);
  25792. }
  25793. function asLiteral(value) {
  25794. if (Array.isArray(value)) {
  25795. return literalArr(value.map(asLiteral));
  25796. }
  25797. return literal(value, INFERRED_TYPE);
  25798. }
  25799. function conditionallyCreateMapObjectLiteral(keys) {
  25800. if (Object.getOwnPropertyNames(keys).length > 0) {
  25801. return mapToExpression(keys);
  25802. }
  25803. return null;
  25804. }
  25805. function mapToExpression(map, quoted) {
  25806. if (quoted === void 0) { quoted = false; }
  25807. return literalMap(Object.getOwnPropertyNames(map).map(function (key) { return ({ key: key, quoted: quoted, value: asLiteral(map[key]) }); }));
  25808. }
  25809. /**
  25810. * Remove trailing null nodes as they are implied.
  25811. */
  25812. function trimTrailingNulls(parameters) {
  25813. while (isNull(parameters[parameters.length - 1])) {
  25814. parameters.pop();
  25815. }
  25816. return parameters;
  25817. }
  25818. function getQueryPredicate(query, constantPool) {
  25819. if (Array.isArray(query.predicate)) {
  25820. return constantPool.getConstLiteral(literalArr(query.predicate.map(function (selector) { return literal(selector); })));
  25821. }
  25822. else {
  25823. return query.predicate;
  25824. }
  25825. }
  25826. function noop() { }
  25827. var DefinitionMap = /** @class */ (function () {
  25828. function DefinitionMap() {
  25829. this.values = [];
  25830. }
  25831. DefinitionMap.prototype.set = function (key, value) {
  25832. if (value) {
  25833. this.values.push({ key: key, value: value, quoted: false });
  25834. }
  25835. };
  25836. DefinitionMap.prototype.toLiteralMap = function () { return literalMap(this.values); };
  25837. return DefinitionMap;
  25838. }());
  25839. /**
  25840. * @license
  25841. * Copyright Google Inc. All Rights Reserved.
  25842. *
  25843. * Use of this source code is governed by an MIT-style license that can be
  25844. * found in the LICENSE file at https://angular.io/license
  25845. */
  25846. /**
  25847. * Resolved type of a dependency.
  25848. *
  25849. * Occasionally, dependencies will have special significance which is known statically. In that
  25850. * case the `R3ResolvedDependencyType` informs the factory generator that a particular dependency
  25851. * should be generated specially (usually by calling a special injection function instead of the
  25852. * standard one).
  25853. */
  25854. var R3ResolvedDependencyType;
  25855. (function (R3ResolvedDependencyType) {
  25856. /**
  25857. * A normal token dependency.
  25858. */
  25859. R3ResolvedDependencyType[R3ResolvedDependencyType["Token"] = 0] = "Token";
  25860. /**
  25861. * The dependency is for an attribute.
  25862. *
  25863. * The token expression is a string representing the attribute name.
  25864. */
  25865. R3ResolvedDependencyType[R3ResolvedDependencyType["Attribute"] = 1] = "Attribute";
  25866. /**
  25867. * The dependency is for the `Injector` type itself.
  25868. */
  25869. R3ResolvedDependencyType[R3ResolvedDependencyType["Injector"] = 2] = "Injector";
  25870. /**
  25871. * The dependency is for `ElementRef`.
  25872. */
  25873. R3ResolvedDependencyType[R3ResolvedDependencyType["ElementRef"] = 3] = "ElementRef";
  25874. /**
  25875. * The dependency is for `TemplateRef`.
  25876. */
  25877. R3ResolvedDependencyType[R3ResolvedDependencyType["TemplateRef"] = 4] = "TemplateRef";
  25878. /**
  25879. * The dependency is for `ViewContainerRef`.
  25880. */
  25881. R3ResolvedDependencyType[R3ResolvedDependencyType["ViewContainerRef"] = 5] = "ViewContainerRef";
  25882. /**
  25883. * The dependency is for `ChangeDetectorRef`.
  25884. */
  25885. R3ResolvedDependencyType[R3ResolvedDependencyType["ChangeDetectorRef"] = 6] = "ChangeDetectorRef";
  25886. })(R3ResolvedDependencyType || (R3ResolvedDependencyType = {}));
  25887. /**
  25888. * Construct a factory function expression for the given `R3FactoryMetadata`.
  25889. */
  25890. function compileFactoryFunction(meta) {
  25891. // Each dependency becomes an invocation of an inject*() function.
  25892. var args = meta.deps.map(function (dep) { return compileInjectDependency(dep, meta.injectFn); });
  25893. // The overall result depends on whether this is construction or function invocation.
  25894. var expr = meta.useNew ? new InstantiateExpr(meta.fnOrClass, args) :
  25895. new InvokeFunctionExpr(meta.fnOrClass, args);
  25896. return fn([], [new ReturnStatement(expr)], INFERRED_TYPE, undefined, meta.name + "_Factory");
  25897. }
  25898. function compileInjectDependency(dep, injectFn) {
  25899. // Interpret the dependency according to its resolved type.
  25900. switch (dep.resolved) {
  25901. case R3ResolvedDependencyType.Token:
  25902. case R3ResolvedDependencyType.Injector: {
  25903. // Build up the injection flags according to the metadata.
  25904. var flags = 0 /* Default */ | (dep.self ? 2 /* Self */ : 0) |
  25905. (dep.skipSelf ? 4 /* SkipSelf */ : 0) | (dep.host ? 1 /* Host */ : 0) |
  25906. (dep.optional ? 8 /* Optional */ : 0);
  25907. // Determine the token used for injection. In almost all cases this is the given token, but
  25908. // if the dependency is resolved to the `Injector` then the special `INJECTOR` token is used
  25909. // instead.
  25910. var token = dep.token;
  25911. if (dep.resolved === R3ResolvedDependencyType.Injector) {
  25912. token = importExpr(Identifiers.INJECTOR);
  25913. }
  25914. // Build up the arguments to the injectFn call.
  25915. var injectArgs = [token];
  25916. // If this dependency is optional or otherwise has non-default flags, then additional
  25917. // parameters describing how to inject the dependency must be passed to the inject function
  25918. // that's being used.
  25919. if (flags !== 0 /* Default */ || dep.optional) {
  25920. injectArgs.push(literal(flags));
  25921. }
  25922. return importExpr(injectFn).callFn(injectArgs);
  25923. }
  25924. case R3ResolvedDependencyType.Attribute:
  25925. // In the case of attributes, the attribute name in question is given as the token.
  25926. return importExpr(Identifiers$1.injectAttribute).callFn([dep.token]);
  25927. case R3ResolvedDependencyType.ElementRef:
  25928. return importExpr(Identifiers$1.injectElementRef).callFn([]);
  25929. case R3ResolvedDependencyType.TemplateRef:
  25930. return importExpr(Identifiers$1.injectTemplateRef).callFn([]);
  25931. case R3ResolvedDependencyType.ViewContainerRef:
  25932. return importExpr(Identifiers$1.injectViewContainerRef).callFn([]);
  25933. case R3ResolvedDependencyType.ChangeDetectorRef:
  25934. return importExpr(Identifiers$1.injectChangeDetectorRef).callFn([]);
  25935. default:
  25936. return unsupported("Unknown R3ResolvedDependencyType: " + R3ResolvedDependencyType[dep.resolved]);
  25937. }
  25938. }
  25939. /**
  25940. * A helper function useful for extracting `R3DependencyMetadata` from a Render2
  25941. * `CompileTypeMetadata` instance.
  25942. */
  25943. function dependenciesFromGlobalMetadata(type, outputCtx, reflector) {
  25944. var e_1, _a;
  25945. // Use the `CompileReflector` to look up references to some well-known Angular types. These will
  25946. // be compared with the token to statically determine whether the token has significance to
  25947. // Angular, and set the correct `R3ResolvedDependencyType` as a result.
  25948. var elementRef = reflector.resolveExternalReference(Identifiers.ElementRef);
  25949. var templateRef = reflector.resolveExternalReference(Identifiers.TemplateRef);
  25950. var viewContainerRef = reflector.resolveExternalReference(Identifiers.ViewContainerRef);
  25951. var injectorRef = reflector.resolveExternalReference(Identifiers.Injector);
  25952. // Iterate through the type's DI dependencies and produce `R3DependencyMetadata` for each of them.
  25953. var deps = [];
  25954. try {
  25955. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(type.diDeps), _c = _b.next(); !_c.done; _c = _b.next()) {
  25956. var dependency = _c.value;
  25957. if (dependency.token) {
  25958. var tokenRef = tokenReference(dependency.token);
  25959. var resolved = R3ResolvedDependencyType.Token;
  25960. if (tokenRef === elementRef) {
  25961. resolved = R3ResolvedDependencyType.ElementRef;
  25962. }
  25963. else if (tokenRef === templateRef) {
  25964. resolved = R3ResolvedDependencyType.TemplateRef;
  25965. }
  25966. else if (tokenRef === viewContainerRef) {
  25967. resolved = R3ResolvedDependencyType.ViewContainerRef;
  25968. }
  25969. else if (tokenRef === injectorRef) {
  25970. resolved = R3ResolvedDependencyType.Injector;
  25971. }
  25972. else if (dependency.isAttribute) {
  25973. resolved = R3ResolvedDependencyType.Attribute;
  25974. }
  25975. // In the case of most dependencies, the token will be a reference to a type. Sometimes,
  25976. // however, it can be a string, in the case of older Angular code or @Attribute injection.
  25977. var token = tokenRef instanceof StaticSymbol ? outputCtx.importExpr(tokenRef) : literal(tokenRef);
  25978. // Construct the dependency.
  25979. deps.push({
  25980. token: token,
  25981. resolved: resolved,
  25982. host: !!dependency.isHost,
  25983. optional: !!dependency.isOptional,
  25984. self: !!dependency.isSelf,
  25985. skipSelf: !!dependency.isSkipSelf,
  25986. });
  25987. }
  25988. else {
  25989. unsupported('dependency without a token');
  25990. }
  25991. }
  25992. }
  25993. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  25994. finally {
  25995. try {
  25996. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  25997. }
  25998. finally { if (e_1) throw e_1.error; }
  25999. }
  26000. return deps;
  26001. }
  26002. /**
  26003. * @license
  26004. * Copyright Google Inc. All Rights Reserved.
  26005. *
  26006. * Use of this source code is governed by an MIT-style license that can be
  26007. * found in the LICENSE file at https://angular.io/license
  26008. */
  26009. /**
  26010. * Convert an object map with `Expression` values into a `LiteralMapExpr`.
  26011. */
  26012. function mapToMapExpression(map) {
  26013. var result = Object.keys(map).map(function (key) { return ({ key: key, value: map[key], quoted: false }); });
  26014. return literalMap(result);
  26015. }
  26016. /**
  26017. * Convert metadata into an `Expression` in the given `OutputContext`.
  26018. *
  26019. * This operation will handle arrays, references to symbols, or literal `null` or `undefined`.
  26020. */
  26021. function convertMetaToOutput(meta, ctx) {
  26022. if (Array.isArray(meta)) {
  26023. return literalArr(meta.map(function (entry) { return convertMetaToOutput(entry, ctx); }));
  26024. }
  26025. if (meta instanceof StaticSymbol) {
  26026. return ctx.importExpr(meta);
  26027. }
  26028. if (meta == null) {
  26029. return literal(meta);
  26030. }
  26031. throw new Error("Internal error: Unsupported or unknown metadata: " + meta);
  26032. }
  26033. function typeWithParameters(type, numParams) {
  26034. var params = null;
  26035. if (numParams > 0) {
  26036. params = [];
  26037. for (var i = 0; i < numParams; i++) {
  26038. params.push(DYNAMIC_TYPE);
  26039. }
  26040. }
  26041. return expressionType(type, null, params);
  26042. }
  26043. /**
  26044. * @license
  26045. * Copyright Google Inc. All Rights Reserved.
  26046. *
  26047. * Use of this source code is governed by an MIT-style license that can be
  26048. * found in the LICENSE file at https://angular.io/license
  26049. */
  26050. /**
  26051. * Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
  26052. */
  26053. function compileNgModule(meta) {
  26054. var moduleType = meta.type, bootstrap = meta.bootstrap, declarations = meta.declarations, imports = meta.imports, exports = meta.exports;
  26055. var expression = importExpr(Identifiers$1.defineNgModule).callFn([mapToMapExpression({
  26056. type: moduleType,
  26057. bootstrap: literalArr(bootstrap),
  26058. declarations: literalArr(declarations),
  26059. imports: literalArr(imports),
  26060. exports: literalArr(exports),
  26061. })]);
  26062. var type = new ExpressionType(importExpr(Identifiers$1.NgModuleDef, [
  26063. new ExpressionType(moduleType), tupleTypeOf(declarations), tupleTypeOf(imports),
  26064. tupleTypeOf(exports)
  26065. ]));
  26066. var additionalStatements = [];
  26067. return { expression: expression, type: type, additionalStatements: additionalStatements };
  26068. }
  26069. function compileInjector(meta) {
  26070. var expression = importExpr(Identifiers$1.defineInjector).callFn([mapToMapExpression({
  26071. factory: compileFactoryFunction({
  26072. name: meta.name,
  26073. fnOrClass: meta.type,
  26074. deps: meta.deps,
  26075. useNew: true,
  26076. injectFn: Identifiers$1.inject,
  26077. }),
  26078. providers: meta.providers,
  26079. imports: meta.imports,
  26080. })]);
  26081. var type = new ExpressionType(importExpr(Identifiers$1.InjectorDef, [new ExpressionType(meta.type)]));
  26082. return { expression: expression, type: type };
  26083. }
  26084. // TODO(alxhub): integrate this with `compileNgModule`. Currently the two are separate operations.
  26085. function compileNgModuleFromRender2(ctx, ngModule, injectableCompiler) {
  26086. var className = identifierName(ngModule.type);
  26087. var rawImports = ngModule.rawImports ? [ngModule.rawImports] : [];
  26088. var rawExports = ngModule.rawExports ? [ngModule.rawExports] : [];
  26089. var injectorDefArg = mapLiteral({
  26090. 'factory': injectableCompiler.factoryFor({ type: ngModule.type, symbol: ngModule.type.reference }, ctx),
  26091. 'providers': convertMetaToOutput(ngModule.rawProviders, ctx),
  26092. 'imports': convertMetaToOutput(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(rawImports, rawExports), ctx),
  26093. });
  26094. var injectorDef = importExpr(Identifiers$1.defineInjector).callFn([injectorDefArg]);
  26095. ctx.statements.push(new ClassStmt(
  26096. /* name */ className,
  26097. /* parent */ null,
  26098. /* fields */ [new ClassField(
  26099. /* name */ 'ngInjectorDef',
  26100. /* type */ INFERRED_TYPE,
  26101. /* modifiers */ [StmtModifier.Static],
  26102. /* initializer */ injectorDef)],
  26103. /* getters */ [],
  26104. /* constructorMethod */ new ClassMethod(null, [], []),
  26105. /* methods */ []));
  26106. }
  26107. function tupleTypeOf(exp) {
  26108. var types = exp.map(function (type) { return typeofExpr(type); });
  26109. return exp.length > 0 ? expressionType(literalArr(types)) : NONE_TYPE;
  26110. }
  26111. /**
  26112. * @license
  26113. * Copyright Google Inc. All Rights Reserved.
  26114. *
  26115. * Use of this source code is governed by an MIT-style license that can be
  26116. * found in the LICENSE file at https://angular.io/license
  26117. */
  26118. function compilePipeFromMetadata(metadata) {
  26119. var definitionMapValues = [];
  26120. // e.g. `name: 'myPipe'`
  26121. definitionMapValues.push({ key: 'name', value: literal(metadata.pipeName), quoted: false });
  26122. // e.g. `type: MyPipe`
  26123. definitionMapValues.push({ key: 'type', value: metadata.type, quoted: false });
  26124. var templateFactory = compileFactoryFunction({
  26125. name: metadata.name,
  26126. fnOrClass: metadata.type,
  26127. deps: metadata.deps,
  26128. useNew: true,
  26129. injectFn: Identifiers$1.directiveInject,
  26130. });
  26131. definitionMapValues.push({ key: 'factory', value: templateFactory, quoted: false });
  26132. // e.g. `pure: true`
  26133. definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
  26134. var expression = importExpr(Identifiers$1.definePipe).callFn([literalMap(definitionMapValues)]);
  26135. var type = new ExpressionType(importExpr(Identifiers$1.PipeDef, [
  26136. new ExpressionType(metadata.type),
  26137. new ExpressionType(new LiteralExpr(metadata.pipeName)),
  26138. ]));
  26139. return { expression: expression, type: type };
  26140. }
  26141. /**
  26142. * Write a pipe definition to the output context.
  26143. */
  26144. function compilePipeFromRender2(outputCtx, pipe, reflector) {
  26145. var name = identifierName(pipe.type);
  26146. if (!name) {
  26147. return error("Cannot resolve the name of " + pipe.type);
  26148. }
  26149. var metadata = {
  26150. name: name,
  26151. pipeName: pipe.name,
  26152. type: outputCtx.importExpr(pipe.type.reference),
  26153. deps: dependenciesFromGlobalMetadata(pipe.type, outputCtx, reflector),
  26154. pure: pipe.pure,
  26155. };
  26156. var res = compilePipeFromMetadata(metadata);
  26157. var definitionField = outputCtx.constantPool.propertyNameOf(3 /* Pipe */);
  26158. outputCtx.statements.push(new ClassStmt(
  26159. /* name */ name,
  26160. /* parent */ null,
  26161. /* fields */ [new ClassField(
  26162. /* name */ definitionField,
  26163. /* type */ INFERRED_TYPE,
  26164. /* modifiers */ [StmtModifier.Static],
  26165. /* initializer */ res.expression)],
  26166. /* getters */ [],
  26167. /* constructorMethod */ new ClassMethod(null, [], []),
  26168. /* methods */ []));
  26169. }
  26170. /**
  26171. * @license
  26172. * Copyright Google Inc. All Rights Reserved.
  26173. *
  26174. * Use of this source code is governed by an MIT-style license that can be
  26175. * found in the LICENSE file at https://angular.io/license
  26176. */
  26177. var Text$3 = /** @class */ (function () {
  26178. function Text(value, sourceSpan) {
  26179. this.value = value;
  26180. this.sourceSpan = sourceSpan;
  26181. }
  26182. Text.prototype.visit = function (visitor) { return visitor.visitText(this); };
  26183. return Text;
  26184. }());
  26185. var BoundText = /** @class */ (function () {
  26186. function BoundText(value, sourceSpan) {
  26187. this.value = value;
  26188. this.sourceSpan = sourceSpan;
  26189. }
  26190. BoundText.prototype.visit = function (visitor) { return visitor.visitBoundText(this); };
  26191. return BoundText;
  26192. }());
  26193. var TextAttribute = /** @class */ (function () {
  26194. function TextAttribute(name, value, sourceSpan, valueSpan) {
  26195. this.name = name;
  26196. this.value = value;
  26197. this.sourceSpan = sourceSpan;
  26198. this.valueSpan = valueSpan;
  26199. }
  26200. TextAttribute.prototype.visit = function (visitor) { return visitor.visitTextAttribute(this); };
  26201. return TextAttribute;
  26202. }());
  26203. var BoundAttribute = /** @class */ (function () {
  26204. function BoundAttribute(name, type, securityContext, value, unit, sourceSpan) {
  26205. this.name = name;
  26206. this.type = type;
  26207. this.securityContext = securityContext;
  26208. this.value = value;
  26209. this.unit = unit;
  26210. this.sourceSpan = sourceSpan;
  26211. }
  26212. BoundAttribute.fromBoundElementProperty = function (prop) {
  26213. return new BoundAttribute(prop.name, prop.type, prop.securityContext, prop.value, prop.unit, prop.sourceSpan);
  26214. };
  26215. BoundAttribute.prototype.visit = function (visitor) { return visitor.visitBoundAttribute(this); };
  26216. return BoundAttribute;
  26217. }());
  26218. var BoundEvent = /** @class */ (function () {
  26219. function BoundEvent(name, handler, target, phase, sourceSpan) {
  26220. this.name = name;
  26221. this.handler = handler;
  26222. this.target = target;
  26223. this.phase = phase;
  26224. this.sourceSpan = sourceSpan;
  26225. }
  26226. BoundEvent.fromParsedEvent = function (event) {
  26227. var target = event.type === 0 /* Regular */ ? event.targetOrPhase : null;
  26228. var phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null;
  26229. return new BoundEvent(event.name, event.handler, target, phase, event.sourceSpan);
  26230. };
  26231. BoundEvent.prototype.visit = function (visitor) { return visitor.visitBoundEvent(this); };
  26232. return BoundEvent;
  26233. }());
  26234. var Element$1 = /** @class */ (function () {
  26235. function Element(name, attributes, inputs, outputs, children, references, sourceSpan, startSourceSpan, endSourceSpan) {
  26236. this.name = name;
  26237. this.attributes = attributes;
  26238. this.inputs = inputs;
  26239. this.outputs = outputs;
  26240. this.children = children;
  26241. this.references = references;
  26242. this.sourceSpan = sourceSpan;
  26243. this.startSourceSpan = startSourceSpan;
  26244. this.endSourceSpan = endSourceSpan;
  26245. }
  26246. Element.prototype.visit = function (visitor) { return visitor.visitElement(this); };
  26247. return Element;
  26248. }());
  26249. var Template = /** @class */ (function () {
  26250. function Template(attributes, inputs, children, references, variables, sourceSpan, startSourceSpan, endSourceSpan) {
  26251. this.attributes = attributes;
  26252. this.inputs = inputs;
  26253. this.children = children;
  26254. this.references = references;
  26255. this.variables = variables;
  26256. this.sourceSpan = sourceSpan;
  26257. this.startSourceSpan = startSourceSpan;
  26258. this.endSourceSpan = endSourceSpan;
  26259. }
  26260. Template.prototype.visit = function (visitor) { return visitor.visitTemplate(this); };
  26261. return Template;
  26262. }());
  26263. var Content = /** @class */ (function () {
  26264. function Content(selectorIndex, attributes, sourceSpan) {
  26265. this.selectorIndex = selectorIndex;
  26266. this.attributes = attributes;
  26267. this.sourceSpan = sourceSpan;
  26268. }
  26269. Content.prototype.visit = function (visitor) { return visitor.visitContent(this); };
  26270. return Content;
  26271. }());
  26272. var Variable = /** @class */ (function () {
  26273. function Variable(name, value, sourceSpan) {
  26274. this.name = name;
  26275. this.value = value;
  26276. this.sourceSpan = sourceSpan;
  26277. }
  26278. Variable.prototype.visit = function (visitor) { return visitor.visitVariable(this); };
  26279. return Variable;
  26280. }());
  26281. var Reference = /** @class */ (function () {
  26282. function Reference(name, value, sourceSpan) {
  26283. this.name = name;
  26284. this.value = value;
  26285. this.sourceSpan = sourceSpan;
  26286. }
  26287. Reference.prototype.visit = function (visitor) { return visitor.visitReference(this); };
  26288. return Reference;
  26289. }());
  26290. function visitAll$1(visitor, nodes) {
  26291. var e_1, _a, e_2, _b;
  26292. var result = [];
  26293. if (visitor.visit) {
  26294. try {
  26295. for (var nodes_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(nodes), nodes_1_1 = nodes_1.next(); !nodes_1_1.done; nodes_1_1 = nodes_1.next()) {
  26296. var node = nodes_1_1.value;
  26297. var newNode = visitor.visit(node) || node.visit(visitor);
  26298. }
  26299. }
  26300. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  26301. finally {
  26302. try {
  26303. if (nodes_1_1 && !nodes_1_1.done && (_a = nodes_1.return)) _a.call(nodes_1);
  26304. }
  26305. finally { if (e_1) throw e_1.error; }
  26306. }
  26307. }
  26308. else {
  26309. try {
  26310. for (var nodes_2 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(nodes), nodes_2_1 = nodes_2.next(); !nodes_2_1.done; nodes_2_1 = nodes_2.next()) {
  26311. var node = nodes_2_1.value;
  26312. var newNode = node.visit(visitor);
  26313. if (newNode) {
  26314. result.push(newNode);
  26315. }
  26316. }
  26317. }
  26318. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  26319. finally {
  26320. try {
  26321. if (nodes_2_1 && !nodes_2_1.done && (_b = nodes_2.return)) _b.call(nodes_2);
  26322. }
  26323. finally { if (e_2) throw e_2.error; }
  26324. }
  26325. }
  26326. return result;
  26327. }
  26328. /**
  26329. * @license
  26330. * Copyright Google Inc. All Rights Reserved.
  26331. *
  26332. * Use of this source code is governed by an MIT-style license that can be
  26333. * found in the LICENSE file at https://angular.io/license
  26334. */
  26335. var BIND_NAME_REGEXP$1 = /^(?:(?:(?:(bind-)|(let-)|(ref-|#)|(on-)|(bindon-)|(@))(.+))|\[\(([^\)]+)\)\]|\[([^\]]+)\]|\(([^\)]+)\))$/;
  26336. // Group 1 = "bind-"
  26337. var KW_BIND_IDX$1 = 1;
  26338. // Group 2 = "let-"
  26339. var KW_LET_IDX$1 = 2;
  26340. // Group 3 = "ref-/#"
  26341. var KW_REF_IDX$1 = 3;
  26342. // Group 4 = "on-"
  26343. var KW_ON_IDX$1 = 4;
  26344. // Group 5 = "bindon-"
  26345. var KW_BINDON_IDX$1 = 5;
  26346. // Group 6 = "@"
  26347. var KW_AT_IDX$1 = 6;
  26348. // Group 7 = the identifier after "bind-", "let-", "ref-/#", "on-", "bindon-" or "@"
  26349. var IDENT_KW_IDX$1 = 7;
  26350. // Group 8 = identifier inside [()]
  26351. var IDENT_BANANA_BOX_IDX$1 = 8;
  26352. // Group 9 = identifier inside []
  26353. var IDENT_PROPERTY_IDX$1 = 9;
  26354. // Group 10 = identifier inside ()
  26355. var IDENT_EVENT_IDX$1 = 10;
  26356. var TEMPLATE_ATTR_PREFIX$1 = '*';
  26357. // Default selector used by `<ng-content>` if none specified
  26358. var DEFAULT_CONTENT_SELECTOR = '*';
  26359. function htmlAstToRender3Ast(htmlNodes, bindingParser) {
  26360. var transformer = new HtmlAstToIvyAst(bindingParser);
  26361. var ivyNodes = visitAll(transformer, htmlNodes);
  26362. // Errors might originate in either the binding parser or the html to ivy transformer
  26363. var allErrors = bindingParser.errors.concat(transformer.errors);
  26364. var errors = allErrors.filter(function (e) { return e.level === ParseErrorLevel.ERROR; });
  26365. if (errors.length > 0) {
  26366. var errorString = errors.join('\n');
  26367. throw syntaxError("Template parse errors:\n" + errorString, errors);
  26368. }
  26369. return {
  26370. nodes: ivyNodes,
  26371. errors: allErrors,
  26372. ngContentSelectors: transformer.ngContentSelectors,
  26373. hasNgContent: transformer.hasNgContent,
  26374. };
  26375. }
  26376. var HtmlAstToIvyAst = /** @class */ (function () {
  26377. function HtmlAstToIvyAst(bindingParser) {
  26378. this.bindingParser = bindingParser;
  26379. this.errors = [];
  26380. // Selectors for the `ng-content` tags. Only non `*` selectors are recorded here
  26381. this.ngContentSelectors = [];
  26382. // Any `<ng-content>` in the template ?
  26383. this.hasNgContent = false;
  26384. }
  26385. // HTML visitor
  26386. HtmlAstToIvyAst.prototype.visitElement = function (element) {
  26387. var e_1, _a;
  26388. var preparsedElement = preparseElement(element);
  26389. if (preparsedElement.type === PreparsedElementType.SCRIPT ||
  26390. preparsedElement.type === PreparsedElementType.STYLE) {
  26391. // Skipping <script> for security reasons
  26392. // Skipping <style> as we already processed them
  26393. // in the StyleCompiler
  26394. return null;
  26395. }
  26396. if (preparsedElement.type === PreparsedElementType.STYLESHEET &&
  26397. isStyleUrlResolvable(preparsedElement.hrefAttr)) {
  26398. // Skipping stylesheets with either relative urls or package scheme as we already processed
  26399. // them in the StyleCompiler
  26400. return null;
  26401. }
  26402. // Whether the element is a `<ng-template>`
  26403. var isTemplateElement = isNgTemplate(element.name);
  26404. var matchableAttributes = [];
  26405. var parsedProperties = [];
  26406. var boundEvents = [];
  26407. var variables = [];
  26408. var references = [];
  26409. var attributes = [];
  26410. var templateMatchableAttributes = [];
  26411. var inlineTemplateSourceSpan;
  26412. var templateParsedProperties = [];
  26413. var templateVariables = [];
  26414. // Whether the element has any *-attribute
  26415. var elementHasInlineTemplate = false;
  26416. try {
  26417. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(element.attrs), _c = _b.next(); !_c.done; _c = _b.next()) {
  26418. var attribute = _c.value;
  26419. var hasBinding = false;
  26420. var normalizedName = normalizeAttributeName(attribute.name);
  26421. // `*attr` defines template bindings
  26422. var isTemplateBinding = false;
  26423. if (normalizedName.startsWith(TEMPLATE_ATTR_PREFIX$1)) {
  26424. if (elementHasInlineTemplate) {
  26425. this.reportError("Can't have multiple template bindings on one element. Use only one attribute prefixed with *", attribute.sourceSpan);
  26426. }
  26427. isTemplateBinding = true;
  26428. elementHasInlineTemplate = true;
  26429. var templateValue = attribute.value;
  26430. var templateKey = normalizedName.substring(TEMPLATE_ATTR_PREFIX$1.length);
  26431. inlineTemplateSourceSpan = attribute.valueSpan || attribute.sourceSpan;
  26432. var parsedVariables = [];
  26433. this.bindingParser.parseInlineTemplateBinding(templateKey, templateValue, attribute.sourceSpan, templateMatchableAttributes, templateParsedProperties, parsedVariables);
  26434. templateVariables.push.apply(templateVariables, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(parsedVariables.map(function (v) { return new Variable(v.name, v.value, v.sourceSpan); })));
  26435. }
  26436. else {
  26437. // Check for variables, events, property bindings, interpolation
  26438. hasBinding = this.parseAttribute(isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references);
  26439. }
  26440. if (!hasBinding && !isTemplateBinding) {
  26441. // don't include the bindings as attributes as well in the AST
  26442. attributes.push(this.visitAttribute(attribute));
  26443. matchableAttributes.push([attribute.name, attribute.value]);
  26444. }
  26445. }
  26446. }
  26447. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  26448. finally {
  26449. try {
  26450. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  26451. }
  26452. finally { if (e_1) throw e_1.error; }
  26453. }
  26454. var children = visitAll(preparsedElement.nonBindable ? NON_BINDABLE_VISITOR$1 : this, element.children);
  26455. var parsedElement;
  26456. if (preparsedElement.type === PreparsedElementType.NG_CONTENT) {
  26457. // `<ng-content>`
  26458. this.hasNgContent = true;
  26459. if (element.children && !element.children.every(isEmptyTextNode)) {
  26460. this.reportError("<ng-content> element cannot have content.", element.sourceSpan);
  26461. }
  26462. var selector = preparsedElement.selectAttr;
  26463. var attributes_1 = element.attrs.map(function (attribute) {
  26464. return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.valueSpan);
  26465. });
  26466. var selectorIndex = selector === DEFAULT_CONTENT_SELECTOR ? 0 : this.ngContentSelectors.push(selector);
  26467. parsedElement = new Content(selectorIndex, attributes_1, element.sourceSpan);
  26468. }
  26469. else if (isTemplateElement) {
  26470. // `<ng-template>`
  26471. var boundAttributes = this.createBoundAttributes(element.name, parsedProperties);
  26472. parsedElement = new Template(attributes, boundAttributes, children, references, variables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  26473. }
  26474. else {
  26475. var boundAttributes = this.createBoundAttributes(element.name, parsedProperties);
  26476. parsedElement = new Element$1(element.name, attributes, boundAttributes, boundEvents, children, references, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  26477. }
  26478. if (elementHasInlineTemplate) {
  26479. var attributes_2 = [];
  26480. templateMatchableAttributes.forEach(function (_a) {
  26481. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), name = _b[0], value = _b[1];
  26482. return attributes_2.push(new TextAttribute(name, value, inlineTemplateSourceSpan));
  26483. });
  26484. var boundAttributes = this.createBoundAttributes('ng-template', templateParsedProperties);
  26485. parsedElement = new Template(attributes_2, boundAttributes, [parsedElement], [], templateVariables, element.sourceSpan, element.startSourceSpan, element.endSourceSpan);
  26486. }
  26487. return parsedElement;
  26488. };
  26489. HtmlAstToIvyAst.prototype.visitAttribute = function (attribute) {
  26490. return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.valueSpan);
  26491. };
  26492. HtmlAstToIvyAst.prototype.visitText = function (text) {
  26493. var valueNoNgsp = replaceNgsp(text.value);
  26494. var expr = this.bindingParser.parseInterpolation(valueNoNgsp, text.sourceSpan);
  26495. return expr ? new BoundText(expr, text.sourceSpan) : new Text$3(valueNoNgsp, text.sourceSpan);
  26496. };
  26497. HtmlAstToIvyAst.prototype.visitComment = function (comment) { return null; };
  26498. HtmlAstToIvyAst.prototype.visitExpansion = function (expansion) { return null; };
  26499. HtmlAstToIvyAst.prototype.visitExpansionCase = function (expansionCase) { return null; };
  26500. HtmlAstToIvyAst.prototype.createBoundAttributes = function (elementName, properties) {
  26501. var _this = this;
  26502. return properties.filter(function (prop) { return !prop.isLiteral; })
  26503. .map(function (prop) { return _this.bindingParser.createBoundElementProperty(elementName, prop); })
  26504. .map(function (prop) { return BoundAttribute.fromBoundElementProperty(prop); });
  26505. };
  26506. HtmlAstToIvyAst.prototype.parseAttribute = function (isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references) {
  26507. var name = normalizeAttributeName(attribute.name);
  26508. var value = attribute.value;
  26509. var srcSpan = attribute.sourceSpan;
  26510. var bindParts = name.match(BIND_NAME_REGEXP$1);
  26511. var hasBinding = false;
  26512. if (bindParts) {
  26513. hasBinding = true;
  26514. if (bindParts[KW_BIND_IDX$1] != null) {
  26515. this.bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX$1], value, false, srcSpan, matchableAttributes, parsedProperties);
  26516. }
  26517. else if (bindParts[KW_LET_IDX$1]) {
  26518. if (isTemplateElement) {
  26519. var identifier = bindParts[IDENT_KW_IDX$1];
  26520. this.parseVariable(identifier, value, srcSpan, variables);
  26521. }
  26522. else {
  26523. this.reportError("\"let-\" is only supported on ng-template elements.", srcSpan);
  26524. }
  26525. }
  26526. else if (bindParts[KW_REF_IDX$1]) {
  26527. var identifier = bindParts[IDENT_KW_IDX$1];
  26528. this.parseReference(identifier, value, srcSpan, references);
  26529. }
  26530. else if (bindParts[KW_ON_IDX$1]) {
  26531. var events = [];
  26532. this.bindingParser.parseEvent(bindParts[IDENT_KW_IDX$1], value, srcSpan, matchableAttributes, events);
  26533. addEvents(events, boundEvents);
  26534. }
  26535. else if (bindParts[KW_BINDON_IDX$1]) {
  26536. this.bindingParser.parsePropertyBinding(bindParts[IDENT_KW_IDX$1], value, false, srcSpan, matchableAttributes, parsedProperties);
  26537. this.parseAssignmentEvent(bindParts[IDENT_KW_IDX$1], value, srcSpan, matchableAttributes, boundEvents);
  26538. }
  26539. else if (bindParts[KW_AT_IDX$1]) {
  26540. this.bindingParser.parseLiteralAttr(name, value, srcSpan, matchableAttributes, parsedProperties);
  26541. }
  26542. else if (bindParts[IDENT_BANANA_BOX_IDX$1]) {
  26543. this.bindingParser.parsePropertyBinding(bindParts[IDENT_BANANA_BOX_IDX$1], value, false, srcSpan, matchableAttributes, parsedProperties);
  26544. this.parseAssignmentEvent(bindParts[IDENT_BANANA_BOX_IDX$1], value, srcSpan, matchableAttributes, boundEvents);
  26545. }
  26546. else if (bindParts[IDENT_PROPERTY_IDX$1]) {
  26547. this.bindingParser.parsePropertyBinding(bindParts[IDENT_PROPERTY_IDX$1], value, false, srcSpan, matchableAttributes, parsedProperties);
  26548. }
  26549. else if (bindParts[IDENT_EVENT_IDX$1]) {
  26550. var events = [];
  26551. this.bindingParser.parseEvent(bindParts[IDENT_EVENT_IDX$1], value, srcSpan, matchableAttributes, events);
  26552. addEvents(events, boundEvents);
  26553. }
  26554. }
  26555. else {
  26556. hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, matchableAttributes, parsedProperties);
  26557. }
  26558. return hasBinding;
  26559. };
  26560. HtmlAstToIvyAst.prototype.parseVariable = function (identifier, value, sourceSpan, variables) {
  26561. if (identifier.indexOf('-') > -1) {
  26562. this.reportError("\"-\" is not allowed in variable names", sourceSpan);
  26563. }
  26564. variables.push(new Variable(identifier, value, sourceSpan));
  26565. };
  26566. HtmlAstToIvyAst.prototype.parseReference = function (identifier, value, sourceSpan, references) {
  26567. if (identifier.indexOf('-') > -1) {
  26568. this.reportError("\"-\" is not allowed in reference names", sourceSpan);
  26569. }
  26570. references.push(new Reference(identifier, value, sourceSpan));
  26571. };
  26572. HtmlAstToIvyAst.prototype.parseAssignmentEvent = function (name, expression, sourceSpan, targetMatchableAttrs, boundEvents) {
  26573. var events = [];
  26574. this.bindingParser.parseEvent(name + "Change", expression + "=$event", sourceSpan, targetMatchableAttrs, events);
  26575. addEvents(events, boundEvents);
  26576. };
  26577. HtmlAstToIvyAst.prototype.reportError = function (message, sourceSpan, level) {
  26578. if (level === void 0) { level = ParseErrorLevel.ERROR; }
  26579. this.errors.push(new ParseError(sourceSpan, message, level));
  26580. };
  26581. return HtmlAstToIvyAst;
  26582. }());
  26583. var NonBindableVisitor$1 = /** @class */ (function () {
  26584. function NonBindableVisitor() {
  26585. }
  26586. NonBindableVisitor.prototype.visitElement = function (ast) {
  26587. var preparsedElement = preparseElement(ast);
  26588. if (preparsedElement.type === PreparsedElementType.SCRIPT ||
  26589. preparsedElement.type === PreparsedElementType.STYLE ||
  26590. preparsedElement.type === PreparsedElementType.STYLESHEET) {
  26591. // Skipping <script> for security reasons
  26592. // Skipping <style> and stylesheets as we already processed them
  26593. // in the StyleCompiler
  26594. return null;
  26595. }
  26596. var children = visitAll(this, ast.children, null);
  26597. return new Element$1(ast.name, visitAll(this, ast.attrs),
  26598. /* inputs */ [], /* outputs */ [], children, /* references */ [], ast.sourceSpan, ast.startSourceSpan, ast.endSourceSpan);
  26599. };
  26600. NonBindableVisitor.prototype.visitComment = function (comment) { return null; };
  26601. NonBindableVisitor.prototype.visitAttribute = function (attribute) {
  26602. return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan);
  26603. };
  26604. NonBindableVisitor.prototype.visitText = function (text) { return new Text$3(text.value, text.sourceSpan); };
  26605. NonBindableVisitor.prototype.visitExpansion = function (expansion) { return null; };
  26606. NonBindableVisitor.prototype.visitExpansionCase = function (expansionCase) { return null; };
  26607. return NonBindableVisitor;
  26608. }());
  26609. var NON_BINDABLE_VISITOR$1 = new NonBindableVisitor$1();
  26610. function normalizeAttributeName(attrName) {
  26611. return /^data-/i.test(attrName) ? attrName.substring(5) : attrName;
  26612. }
  26613. function addEvents(events, boundEvents) {
  26614. boundEvents.push.apply(boundEvents, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(events.map(function (e) { return BoundEvent.fromParsedEvent(e); })));
  26615. }
  26616. function isEmptyTextNode(node) {
  26617. return node instanceof Text && node.value.trim().length == 0;
  26618. }
  26619. /**
  26620. * @license
  26621. * Copyright Google Inc. All Rights Reserved.
  26622. *
  26623. * Use of this source code is governed by an MIT-style license that can be
  26624. * found in the LICENSE file at https://angular.io/license
  26625. */
  26626. /**
  26627. * Parses string representation of a style and converts it into object literal.
  26628. *
  26629. * @param value string representation of style as used in the `style` attribute in HTML.
  26630. * Example: `color: red; height: auto`.
  26631. * @returns an object literal. `{ color: 'red', height: 'auto'}`.
  26632. */
  26633. function parseStyle(value) {
  26634. var styles = {};
  26635. var i = 0;
  26636. var parenDepth = 0;
  26637. var quote = 0 /* QuoteNone */;
  26638. var valueStart = 0;
  26639. var propStart = 0;
  26640. var currentProp = null;
  26641. var valueHasQuotes = false;
  26642. while (i < value.length) {
  26643. var token = value.charCodeAt(i++);
  26644. switch (token) {
  26645. case 40 /* OpenParen */:
  26646. parenDepth++;
  26647. break;
  26648. case 41 /* CloseParen */:
  26649. parenDepth--;
  26650. break;
  26651. case 39 /* QuoteSingle */:
  26652. // valueStart needs to be there since prop values don't
  26653. // have quotes in CSS
  26654. valueHasQuotes = valueHasQuotes || valueStart > 0;
  26655. if (quote === 0 /* QuoteNone */) {
  26656. quote = 39 /* QuoteSingle */;
  26657. }
  26658. else if (quote === 39 /* QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
  26659. quote = 0 /* QuoteNone */;
  26660. }
  26661. break;
  26662. case 34 /* QuoteDouble */:
  26663. // same logic as above
  26664. valueHasQuotes = valueHasQuotes || valueStart > 0;
  26665. if (quote === 0 /* QuoteNone */) {
  26666. quote = 34 /* QuoteDouble */;
  26667. }
  26668. else if (quote === 34 /* QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
  26669. quote = 0 /* QuoteNone */;
  26670. }
  26671. break;
  26672. case 58 /* Colon */:
  26673. if (!currentProp && parenDepth === 0 && quote === 0 /* QuoteNone */) {
  26674. currentProp = hyphenate(value.substring(propStart, i - 1).trim());
  26675. valueStart = i;
  26676. }
  26677. break;
  26678. case 59 /* Semicolon */:
  26679. if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* QuoteNone */) {
  26680. var styleVal = value.substring(valueStart, i - 1).trim();
  26681. styles[currentProp] = valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal;
  26682. propStart = i;
  26683. valueStart = 0;
  26684. currentProp = null;
  26685. valueHasQuotes = false;
  26686. }
  26687. break;
  26688. }
  26689. }
  26690. if (currentProp && valueStart) {
  26691. var styleVal = value.substr(valueStart).trim();
  26692. styles[currentProp] = valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal;
  26693. }
  26694. return styles;
  26695. }
  26696. function stripUnnecessaryQuotes(value) {
  26697. var qS = value.charCodeAt(0);
  26698. var qE = value.charCodeAt(value.length - 1);
  26699. if (qS == qE && (qS == 39 /* QuoteSingle */ || qS == 34 /* QuoteDouble */)) {
  26700. var tempValue = value.substring(1, value.length - 1);
  26701. // special case to avoid using a multi-quoted string that was just chomped
  26702. // (e.g. `font-family: "Verdana", "sans-serif"`)
  26703. if (tempValue.indexOf('\'') == -1 && tempValue.indexOf('"') == -1) {
  26704. value = tempValue;
  26705. }
  26706. }
  26707. return value;
  26708. }
  26709. function hyphenate(value) {
  26710. return value.replace(/[a-z][A-Z]/g, function (v) {
  26711. return v.charAt(0) + '-' + v.charAt(1);
  26712. }).toLowerCase();
  26713. }
  26714. /**
  26715. * @license
  26716. * Copyright Google Inc. All Rights Reserved.
  26717. *
  26718. * Use of this source code is governed by an MIT-style license that can be
  26719. * found in the LICENSE file at https://angular.io/license
  26720. */
  26721. function mapBindingToInstruction(type) {
  26722. switch (type) {
  26723. case 0 /* Property */:
  26724. return Identifiers$1.elementProperty;
  26725. case 1 /* Attribute */:
  26726. return Identifiers$1.elementAttribute;
  26727. case 2 /* Class */:
  26728. return Identifiers$1.elementClassProp;
  26729. default:
  26730. return undefined;
  26731. }
  26732. }
  26733. // if (rf & flags) { .. }
  26734. function renderFlagCheckIfStmt(flags, statements) {
  26735. return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null, false), statements);
  26736. }
  26737. var TemplateDefinitionBuilder = /** @class */ (function () {
  26738. function TemplateDefinitionBuilder(constantPool, contextParameter, parentBindingScope, level, contextName, templateName, viewQueries, directiveMatcher, directives, pipeTypeByName, pipes, _namespace) {
  26739. if (level === void 0) { level = 0; }
  26740. var _this = this;
  26741. this.constantPool = constantPool;
  26742. this.contextParameter = contextParameter;
  26743. this.level = level;
  26744. this.contextName = contextName;
  26745. this.templateName = templateName;
  26746. this.viewQueries = viewQueries;
  26747. this.directiveMatcher = directiveMatcher;
  26748. this.directives = directives;
  26749. this.pipeTypeByName = pipeTypeByName;
  26750. this.pipes = pipes;
  26751. this._namespace = _namespace;
  26752. this._dataIndex = 0;
  26753. this._bindingContext = 0;
  26754. this._prefixCode = [];
  26755. this._creationCode = [];
  26756. this._variableCode = [];
  26757. this._bindingCode = [];
  26758. this._postfixCode = [];
  26759. this._unsupported = unsupported;
  26760. // Whether we are inside a translatable element (`<p i18n>... somewhere here ... </p>)
  26761. this._inI18nSection = false;
  26762. this._i18nSectionIndex = -1;
  26763. // Maps of placeholder to node indexes for each of the i18n section
  26764. this._phToNodeIdxes = [{}];
  26765. // Number of slots to reserve for pureFunctions
  26766. this._pureFunctionSlots = 0;
  26767. // These should be handled in the template or element directly.
  26768. this.visitReference = invalid$1;
  26769. this.visitVariable = invalid$1;
  26770. this.visitTextAttribute = invalid$1;
  26771. this.visitBoundAttribute = invalid$1;
  26772. this.visitBoundEvent = invalid$1;
  26773. // view queries can take up space in data and allocation happens earlier (in the "viewQuery"
  26774. // function)
  26775. this._dataIndex = viewQueries.length;
  26776. this._bindingScope =
  26777. parentBindingScope.nestedScope(function (lhsVar, expression) {
  26778. _this._bindingCode.push(lhsVar.set(expression).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]));
  26779. });
  26780. this._valueConverter = new ValueConverter(constantPool, function () { return _this.allocateDataSlot(); }, function (numSlots) { return _this._pureFunctionSlots += numSlots; }, function (name, localName, slot, value) {
  26781. var pipeType = pipeTypeByName.get(name);
  26782. if (pipeType) {
  26783. _this.pipes.add(pipeType);
  26784. }
  26785. _this._bindingScope.set(localName, value);
  26786. _this._creationCode.push(importExpr(Identifiers$1.pipe).callFn([literal(slot), literal(name)]).toStmt());
  26787. });
  26788. }
  26789. TemplateDefinitionBuilder.prototype.buildTemplateFunction = function (nodes, variables, hasNgContent, ngContentSelectors) {
  26790. if (hasNgContent === void 0) { hasNgContent = false; }
  26791. if (ngContentSelectors === void 0) { ngContentSelectors = []; }
  26792. var e_1, _a, e_2, _b;
  26793. if (this._namespace !== Identifiers$1.namespaceHTML) {
  26794. this.instruction(this._creationCode, null, this._namespace);
  26795. }
  26796. try {
  26797. // Create variable bindings
  26798. for (var variables_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(variables), variables_1_1 = variables_1.next(); !variables_1_1.done; variables_1_1 = variables_1.next()) {
  26799. var variable$$1 = variables_1_1.value;
  26800. var variableName = variable$$1.name;
  26801. var expression = variable(this.contextParameter).prop(variable$$1.value || IMPLICIT_REFERENCE);
  26802. var scopedName = this._bindingScope.freshReferenceName();
  26803. // Add the reference to the local scope.
  26804. this._bindingScope.set(variableName, variable(variableName + scopedName), expression);
  26805. }
  26806. }
  26807. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  26808. finally {
  26809. try {
  26810. if (variables_1_1 && !variables_1_1.done && (_a = variables_1.return)) _a.call(variables_1);
  26811. }
  26812. finally { if (e_1) throw e_1.error; }
  26813. }
  26814. // Output a `ProjectionDef` instruction when some `<ng-content>` are present
  26815. if (hasNgContent) {
  26816. var parameters = [];
  26817. // Only selectors with a non-default value are generated
  26818. if (ngContentSelectors.length > 1) {
  26819. var r3Selectors = ngContentSelectors.map(function (s) { return parseSelectorToR3Selector(s); });
  26820. // `projectionDef` needs both the parsed and raw value of the selectors
  26821. var parsed = this.constantPool.getConstLiteral(asLiteral(r3Selectors), true);
  26822. var unParsed = this.constantPool.getConstLiteral(asLiteral(ngContentSelectors), true);
  26823. parameters.push(parsed, unParsed);
  26824. }
  26825. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._creationCode, null, Identifiers$1.projectionDef], parameters));
  26826. }
  26827. visitAll$1(this, nodes);
  26828. if (this._pureFunctionSlots > 0) {
  26829. this.instruction(this._creationCode, null, Identifiers$1.reserveSlots, literal(this._pureFunctionSlots));
  26830. }
  26831. var creationCode = this._creationCode.length > 0 ?
  26832. [renderFlagCheckIfStmt(1 /* Create */, this._creationCode)] :
  26833. [];
  26834. var updateCode = this._bindingCode.length > 0 ?
  26835. [renderFlagCheckIfStmt(2 /* Update */, this._bindingCode)] :
  26836. [];
  26837. try {
  26838. // Generate maps of placeholder name to node indexes
  26839. // TODO(vicb): This is a WIP, not fully supported yet
  26840. for (var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(this._phToNodeIdxes), _d = _c.next(); !_d.done; _d = _c.next()) {
  26841. var phToNodeIdx = _d.value;
  26842. if (Object.keys(phToNodeIdx).length > 0) {
  26843. var scopedName = this._bindingScope.freshReferenceName();
  26844. var phMap = variable(scopedName)
  26845. .set(mapToExpression(phToNodeIdx, true))
  26846. .toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]);
  26847. this._prefixCode.push(phMap);
  26848. }
  26849. }
  26850. }
  26851. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  26852. finally {
  26853. try {
  26854. if (_d && !_d.done && (_b = _c.return)) _b.call(_c);
  26855. }
  26856. finally { if (e_2) throw e_2.error; }
  26857. }
  26858. return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(this.contextParameter, null)], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(this._prefixCode, creationCode, this._variableCode, updateCode, this._postfixCode), INFERRED_TYPE, null, this.templateName);
  26859. };
  26860. // LocalResolver
  26861. TemplateDefinitionBuilder.prototype.getLocal = function (name) { return this._bindingScope.get(name); };
  26862. TemplateDefinitionBuilder.prototype.visitContent = function (ngContent) {
  26863. var slot = this.allocateDataSlot();
  26864. var selectorIndex = ngContent.selectorIndex;
  26865. var parameters = [literal(slot)];
  26866. var attributeAsList = [];
  26867. ngContent.attributes.forEach(function (attribute) {
  26868. var name = attribute.name;
  26869. if (name !== 'select') {
  26870. attributeAsList.push(name, attribute.value);
  26871. }
  26872. });
  26873. if (attributeAsList.length > 0) {
  26874. parameters.push(literal(selectorIndex), asLiteral(attributeAsList));
  26875. }
  26876. else if (selectorIndex !== 0) {
  26877. parameters.push(literal(selectorIndex));
  26878. }
  26879. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._creationCode, ngContent.sourceSpan, Identifiers$1.projection], parameters));
  26880. };
  26881. TemplateDefinitionBuilder.prototype.getNamespaceInstruction = function (namespaceKey) {
  26882. switch (namespaceKey) {
  26883. case 'math':
  26884. return Identifiers$1.namespaceMathML;
  26885. case 'svg':
  26886. return Identifiers$1.namespaceSVG;
  26887. default:
  26888. return Identifiers$1.namespaceHTML;
  26889. }
  26890. };
  26891. TemplateDefinitionBuilder.prototype.addNamespaceInstruction = function (nsInstruction, element) {
  26892. this._namespace = nsInstruction;
  26893. this.instruction(this._creationCode, element.sourceSpan, nsInstruction);
  26894. };
  26895. TemplateDefinitionBuilder.prototype.visitElement = function (element) {
  26896. var _this = this;
  26897. var e_3, _a, _b, _c;
  26898. var elementIndex = this.allocateDataSlot();
  26899. var referenceDataSlots = new Map();
  26900. var wasInI18nSection = this._inI18nSection;
  26901. var outputAttrs = {};
  26902. var attrI18nMetas = {};
  26903. var i18nMeta = '';
  26904. var _d = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitNsName(element.name), 2), namespaceKey = _d[0], elementName = _d[1];
  26905. // Elements inside i18n sections are replaced with placeholders
  26906. // TODO(vicb): nested elements are a WIP in this phase
  26907. if (this._inI18nSection) {
  26908. var phName = element.name.toLowerCase();
  26909. if (!this._phToNodeIdxes[this._i18nSectionIndex][phName]) {
  26910. this._phToNodeIdxes[this._i18nSectionIndex][phName] = [];
  26911. }
  26912. this._phToNodeIdxes[this._i18nSectionIndex][phName].push(elementIndex);
  26913. }
  26914. try {
  26915. // Handle i18n attributes
  26916. for (var _e = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(element.attributes), _f = _e.next(); !_f.done; _f = _e.next()) {
  26917. var attr = _f.value;
  26918. var name_1 = attr.name;
  26919. var value = attr.value;
  26920. if (name_1 === I18N_ATTR) {
  26921. if (this._inI18nSection) {
  26922. throw new Error("Could not mark an element as translatable inside of a translatable section");
  26923. }
  26924. this._inI18nSection = true;
  26925. this._i18nSectionIndex++;
  26926. this._phToNodeIdxes[this._i18nSectionIndex] = {};
  26927. i18nMeta = value;
  26928. }
  26929. else if (name_1.startsWith(I18N_ATTR_PREFIX)) {
  26930. attrI18nMetas[name_1.slice(I18N_ATTR_PREFIX.length)] = value;
  26931. }
  26932. else {
  26933. outputAttrs[name_1] = value;
  26934. }
  26935. }
  26936. }
  26937. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  26938. finally {
  26939. try {
  26940. if (_f && !_f.done && (_a = _e.return)) _a.call(_e);
  26941. }
  26942. finally { if (e_3) throw e_3.error; }
  26943. }
  26944. // Match directives on non i18n attributes
  26945. if (this.directiveMatcher) {
  26946. var selector = createCssSelector(element.name, outputAttrs);
  26947. this.directiveMatcher.match(selector, function (sel, staticType) { _this.directives.add(staticType); });
  26948. }
  26949. // Element creation mode
  26950. var parameters = [
  26951. literal(elementIndex),
  26952. literal(elementName),
  26953. ];
  26954. // Add the attributes
  26955. var i18nMessages = [];
  26956. var attributes = [];
  26957. var initialStyleDeclarations = [];
  26958. var initialClassDeclarations = [];
  26959. var styleInputs = [];
  26960. var classInputs = [];
  26961. var allOtherInputs = [];
  26962. element.inputs.forEach(function (input) {
  26963. switch (input.type) {
  26964. // [attr.style] or [attr.class] should not be treated as styling-based
  26965. // bindings since they are intended to be written directly to the attr
  26966. // and therefore will skip all style/class resolution that is present
  26967. // with style="", [style]="" and [style.prop]="", class="",
  26968. // [class.prop]="". [class]="" assignments
  26969. case 0 /* Property */:
  26970. if (input.name == 'style') {
  26971. // this should always go first in the compilation (for [style])
  26972. styleInputs.splice(0, 0, input);
  26973. }
  26974. else if (isClassBinding(input)) {
  26975. // this should always go first in the compilation (for [class])
  26976. classInputs.splice(0, 0, input);
  26977. }
  26978. else {
  26979. allOtherInputs.push(input);
  26980. }
  26981. break;
  26982. case 3 /* Style */:
  26983. styleInputs.push(input);
  26984. break;
  26985. case 2 /* Class */:
  26986. classInputs.push(input);
  26987. break;
  26988. default:
  26989. allOtherInputs.push(input);
  26990. break;
  26991. }
  26992. });
  26993. var currStyleIndex = 0;
  26994. var currClassIndex = 0;
  26995. var staticStylesMap = null;
  26996. var staticClassesMap = null;
  26997. var stylesIndexMap = {};
  26998. var classesIndexMap = {};
  26999. Object.getOwnPropertyNames(outputAttrs).forEach(function (name) {
  27000. var value = outputAttrs[name];
  27001. if (name == 'style') {
  27002. staticStylesMap = parseStyle(value);
  27003. Object.keys(staticStylesMap).forEach(function (prop) { stylesIndexMap[prop] = currStyleIndex++; });
  27004. }
  27005. else if (name == 'class') {
  27006. staticClassesMap = {};
  27007. value.split(/\s+/g).forEach(function (className) {
  27008. classesIndexMap[className] = currClassIndex++;
  27009. staticClassesMap[className] = true;
  27010. });
  27011. }
  27012. else {
  27013. attributes.push(literal(name));
  27014. if (attrI18nMetas.hasOwnProperty(name)) {
  27015. var meta = parseI18nMeta(attrI18nMetas[name]);
  27016. var variable$$1 = _this.constantPool.getTranslation(value, meta);
  27017. attributes.push(variable$$1);
  27018. }
  27019. else {
  27020. attributes.push(literal(value));
  27021. }
  27022. }
  27023. });
  27024. var hasMapBasedStyling = false;
  27025. for (var i = 0; i < styleInputs.length; i++) {
  27026. var input = styleInputs[i];
  27027. var isMapBasedStyleBinding = i === 0 && input.name === 'style';
  27028. if (isMapBasedStyleBinding) {
  27029. hasMapBasedStyling = true;
  27030. }
  27031. else if (!stylesIndexMap.hasOwnProperty(input.name)) {
  27032. stylesIndexMap[input.name] = currStyleIndex++;
  27033. }
  27034. }
  27035. for (var i = 0; i < classInputs.length; i++) {
  27036. var input = classInputs[i];
  27037. var isMapBasedClassBinding = i === 0 && isClassBinding(input);
  27038. if (!isMapBasedClassBinding && !stylesIndexMap.hasOwnProperty(input.name)) {
  27039. classesIndexMap[input.name] = currClassIndex++;
  27040. }
  27041. }
  27042. // in the event that a [style] binding is used then sanitization will
  27043. // always be imported because it is not possible to know ahead of time
  27044. // whether style bindings will use or not use any sanitizable properties
  27045. // that isStyleSanitizable() will detect
  27046. var useDefaultStyleSanitizer = hasMapBasedStyling;
  27047. // this will build the instructions so that they fall into the following syntax
  27048. // => [prop1, prop2, prop3, 0, prop1, value1, prop2, value2]
  27049. Object.keys(stylesIndexMap).forEach(function (prop) {
  27050. useDefaultStyleSanitizer = useDefaultStyleSanitizer || isStyleSanitizable(prop);
  27051. initialStyleDeclarations.push(literal(prop));
  27052. });
  27053. if (staticStylesMap) {
  27054. initialStyleDeclarations.push(literal(1 /* VALUES_MODE */));
  27055. Object.keys(staticStylesMap).forEach(function (prop) {
  27056. initialStyleDeclarations.push(literal(prop));
  27057. var value = staticStylesMap[prop];
  27058. initialStyleDeclarations.push(literal(value));
  27059. });
  27060. }
  27061. Object.keys(classesIndexMap).forEach(function (prop) {
  27062. initialClassDeclarations.push(literal(prop));
  27063. });
  27064. if (staticClassesMap) {
  27065. initialClassDeclarations.push(literal(1 /* VALUES_MODE */));
  27066. Object.keys(staticClassesMap).forEach(function (className) {
  27067. initialClassDeclarations.push(literal(className));
  27068. initialClassDeclarations.push(literal(true));
  27069. });
  27070. }
  27071. var hasStylingInstructions = initialStyleDeclarations.length || styleInputs.length ||
  27072. initialClassDeclarations.length || classInputs.length;
  27073. var attrArg = attributes.length > 0 ?
  27074. this.constantPool.getConstLiteral(literalArr(attributes), true) :
  27075. TYPED_NULL_EXPR;
  27076. parameters.push(attrArg);
  27077. if (element.references && element.references.length > 0) {
  27078. var references = flatten(element.references.map(function (reference) {
  27079. var slot = _this.allocateDataSlot();
  27080. referenceDataSlots.set(reference.name, slot);
  27081. // Generate the update temporary.
  27082. var variableName = _this._bindingScope.freshReferenceName();
  27083. _this._variableCode.push(variable(variableName, INFERRED_TYPE)
  27084. .set(importExpr(Identifiers$1.load).callFn([literal(slot)]))
  27085. .toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]));
  27086. _this._bindingScope.set(reference.name, variable(variableName));
  27087. return [reference.name, reference.value];
  27088. }));
  27089. parameters.push(this.constantPool.getConstLiteral(asLiteral(references), true));
  27090. }
  27091. else {
  27092. parameters.push(TYPED_NULL_EXPR);
  27093. }
  27094. // Generate the instruction create element instruction
  27095. if (i18nMessages.length > 0) {
  27096. (_b = this._creationCode).push.apply(_b, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(i18nMessages));
  27097. }
  27098. var wasInNamespace = this._namespace;
  27099. var currentNamespace = this.getNamespaceInstruction(namespaceKey);
  27100. // If the namespace is changing now, include an instruction to change it
  27101. // during element creation.
  27102. if (currentNamespace !== wasInNamespace) {
  27103. this.addNamespaceInstruction(currentNamespace, element);
  27104. }
  27105. var implicit = variable(CONTEXT_NAME);
  27106. var createSelfClosingInstruction = !hasStylingInstructions && element.children.length === 0 && element.outputs.length === 0;
  27107. if (createSelfClosingInstruction) {
  27108. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._creationCode, element.sourceSpan, Identifiers$1.element], trimTrailingNulls(parameters)));
  27109. }
  27110. else {
  27111. // Generate the instruction create element instruction
  27112. if (i18nMessages.length > 0) {
  27113. (_c = this._creationCode).push.apply(_c, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(i18nMessages));
  27114. }
  27115. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._creationCode, element.sourceSpan, Identifiers$1.elementStart], trimTrailingNulls(parameters)));
  27116. // initial styling for static style="..." attributes
  27117. if (hasStylingInstructions) {
  27118. var paramsList = [];
  27119. if (initialClassDeclarations.length) {
  27120. // the template compiler handles initial class styling (e.g. class="foo") values
  27121. // in a special command called `elementClass` so that the initial class
  27122. // can be processed during runtime. These initial class values are bound to
  27123. // a constant because the inital class values do not change (since they're static).
  27124. paramsList.push(this.constantPool.getConstLiteral(literalArr(initialClassDeclarations), true));
  27125. }
  27126. else if (initialStyleDeclarations.length || useDefaultStyleSanitizer) {
  27127. // no point in having an extra `null` value unless there are follow-up params
  27128. paramsList.push(NULL_EXPR);
  27129. }
  27130. if (initialStyleDeclarations.length) {
  27131. // the template compiler handles initial style (e.g. style="foo") values
  27132. // in a special command called `elementStyle` so that the initial styles
  27133. // can be processed during runtime. These initial styles values are bound to
  27134. // a constant because the inital style values do not change (since they're static).
  27135. paramsList.push(this.constantPool.getConstLiteral(literalArr(initialStyleDeclarations), true));
  27136. }
  27137. else if (useDefaultStyleSanitizer) {
  27138. // no point in having an extra `null` value unless there are follow-up params
  27139. paramsList.push(NULL_EXPR);
  27140. }
  27141. if (useDefaultStyleSanitizer) {
  27142. paramsList.push(importExpr(Identifiers$1.defaultStyleSanitizer));
  27143. }
  27144. this._creationCode.push(importExpr(Identifiers$1.elementStyling).callFn(paramsList).toStmt());
  27145. }
  27146. // Generate Listeners (outputs)
  27147. element.outputs.forEach(function (outputAst) {
  27148. var elName = sanitizeIdentifier(element.name);
  27149. var evName = sanitizeIdentifier(outputAst.name);
  27150. var functionName = _this.templateName + "_" + elName + "_" + evName + "_listener";
  27151. var localVars = [];
  27152. var bindingScope = _this._bindingScope.nestedScope(function (lhsVar, rhsExpression) {
  27153. localVars.push(lhsVar.set(rhsExpression).toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]));
  27154. });
  27155. var bindingExpr = convertActionBinding(bindingScope, implicit, outputAst.handler, 'b', function () { return error('Unexpected interpolation'); });
  27156. var handler = fn([new FnParam('$event', DYNAMIC_TYPE)], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(localVars, bindingExpr.render3Stmts), INFERRED_TYPE, null, functionName);
  27157. _this.instruction(_this._creationCode, outputAst.sourceSpan, Identifiers$1.listener, literal(outputAst.name), handler);
  27158. });
  27159. }
  27160. if ((styleInputs.length || classInputs.length) && hasStylingInstructions) {
  27161. var indexLiteral = literal(elementIndex);
  27162. var firstStyle = styleInputs[0];
  27163. var mapBasedStyleInput = firstStyle && firstStyle.name == 'style' ? firstStyle : null;
  27164. var firstClass = classInputs[0];
  27165. var mapBasedClassInput = firstClass && isClassBinding(firstClass) ? firstClass : null;
  27166. var stylingInput = mapBasedStyleInput || mapBasedClassInput;
  27167. if (stylingInput) {
  27168. var params = [];
  27169. if (mapBasedClassInput) {
  27170. params.push(this.convertPropertyBinding(implicit, mapBasedClassInput.value, true));
  27171. }
  27172. else if (mapBasedStyleInput) {
  27173. params.push(NULL_EXPR);
  27174. }
  27175. if (mapBasedStyleInput) {
  27176. params.push(this.convertPropertyBinding(implicit, mapBasedStyleInput.value, true));
  27177. }
  27178. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._bindingCode, stylingInput.sourceSpan, Identifiers$1.elementStylingMap, indexLiteral], params));
  27179. }
  27180. var lastInputCommand = null;
  27181. if (styleInputs.length) {
  27182. var i = mapBasedStyleInput ? 1 : 0;
  27183. for (i; i < styleInputs.length; i++) {
  27184. var input = styleInputs[i];
  27185. var convertedBinding = this.convertPropertyBinding(implicit, input.value, true);
  27186. var params = [convertedBinding];
  27187. var sanitizationRef = resolveSanitizationFn(input, input.securityContext);
  27188. if (sanitizationRef) {
  27189. params.push(sanitizationRef);
  27190. }
  27191. var key = input.name;
  27192. var styleIndex = stylesIndexMap[key];
  27193. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._bindingCode, input.sourceSpan, Identifiers$1.elementStyleProp, indexLiteral,
  27194. literal(styleIndex)], params));
  27195. }
  27196. lastInputCommand = styleInputs[styleInputs.length - 1];
  27197. }
  27198. if (classInputs.length) {
  27199. var i = mapBasedClassInput ? 1 : 0;
  27200. for (i; i < classInputs.length; i++) {
  27201. var input = classInputs[i];
  27202. var convertedBinding = this.convertPropertyBinding(implicit, input.value, true);
  27203. var params = [convertedBinding];
  27204. var sanitizationRef = resolveSanitizationFn(input, input.securityContext);
  27205. if (sanitizationRef) {
  27206. params.push(sanitizationRef);
  27207. }
  27208. var key = input.name;
  27209. var classIndex = classesIndexMap[key];
  27210. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._bindingCode, input.sourceSpan, Identifiers$1.elementClassProp, indexLiteral,
  27211. literal(classIndex)], params));
  27212. }
  27213. lastInputCommand = classInputs[classInputs.length - 1];
  27214. }
  27215. this.instruction(this._bindingCode, lastInputCommand.sourceSpan, Identifiers$1.elementStylingApply, indexLiteral);
  27216. }
  27217. // Generate element input bindings
  27218. allOtherInputs.forEach(function (input) {
  27219. if (input.type === 4 /* Animation */) {
  27220. console.error('warning: animation bindings not yet supported');
  27221. return;
  27222. }
  27223. var convertedBinding = _this.convertPropertyBinding(implicit, input.value);
  27224. var instruction = mapBindingToInstruction(input.type);
  27225. if (instruction) {
  27226. var params = [convertedBinding];
  27227. var sanitizationRef = resolveSanitizationFn(input, input.securityContext);
  27228. if (sanitizationRef) {
  27229. params.push(sanitizationRef);
  27230. }
  27231. // TODO(chuckj): runtime: security context?
  27232. _this.instruction.apply(_this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([_this._bindingCode, input.sourceSpan, instruction, literal(elementIndex),
  27233. literal(input.name)], params));
  27234. }
  27235. else {
  27236. _this._unsupported("binding type " + input.type);
  27237. }
  27238. });
  27239. // Traverse element child nodes
  27240. if (this._inI18nSection && element.children.length == 1 &&
  27241. element.children[0] instanceof Text$3) {
  27242. var text = element.children[0];
  27243. this.visitSingleI18nTextChild(text, i18nMeta);
  27244. }
  27245. else {
  27246. visitAll$1(this, element.children);
  27247. }
  27248. if (!createSelfClosingInstruction) {
  27249. // Finish element construction mode.
  27250. this.instruction(this._creationCode, element.endSourceSpan || element.sourceSpan, Identifiers$1.elementEnd);
  27251. }
  27252. // Restore the state before exiting this node
  27253. this._inI18nSection = wasInI18nSection;
  27254. };
  27255. TemplateDefinitionBuilder.prototype.visitTemplate = function (template) {
  27256. var _this = this;
  27257. var templateIndex = this.allocateDataSlot();
  27258. var elName = '';
  27259. if (template.children.length === 1 && template.children[0] instanceof Element$1) {
  27260. // When the template as a single child, derive the context name from the tag
  27261. elName = sanitizeIdentifier(template.children[0].name);
  27262. }
  27263. var contextName = elName ? this.contextName + "_" + elName : '';
  27264. var templateName = contextName ? contextName + "_Template_" + templateIndex : "Template_" + templateIndex;
  27265. var templateContext = "ctx" + this.level;
  27266. var parameters = [
  27267. literal(templateIndex),
  27268. variable(templateName),
  27269. TYPED_NULL_EXPR,
  27270. ];
  27271. var attributeNames = [];
  27272. var attributeMap = {};
  27273. template.attributes.forEach(function (a) {
  27274. attributeNames.push(asLiteral(a.name), asLiteral(''));
  27275. attributeMap[a.name] = a.value;
  27276. });
  27277. // Match directives on template attributes
  27278. if (this.directiveMatcher) {
  27279. var selector = createCssSelector('ng-template', attributeMap);
  27280. this.directiveMatcher.match(selector, function (cssSelector, staticType) { _this.directives.add(staticType); });
  27281. }
  27282. if (attributeNames.length) {
  27283. parameters.push(this.constantPool.getConstLiteral(literalArr(attributeNames), true));
  27284. }
  27285. // e.g. C(1, C1Template)
  27286. this.instruction.apply(this, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this._creationCode, template.sourceSpan, Identifiers$1.containerCreate], trimTrailingNulls(parameters)));
  27287. // e.g. p(1, 'forOf', ɵb(ctx.items));
  27288. var context = variable(CONTEXT_NAME);
  27289. template.inputs.forEach(function (input) {
  27290. var convertedBinding = _this.convertPropertyBinding(context, input.value);
  27291. _this.instruction(_this._bindingCode, template.sourceSpan, Identifiers$1.elementProperty, literal(templateIndex), literal(input.name), convertedBinding);
  27292. });
  27293. // Create the template function
  27294. var templateVisitor = new TemplateDefinitionBuilder(this.constantPool, templateContext, this._bindingScope, this.level + 1, contextName, templateName, [], this.directiveMatcher, this.directives, this.pipeTypeByName, this.pipes, this._namespace);
  27295. var templateFunctionExpr = templateVisitor.buildTemplateFunction(template.children, template.variables);
  27296. this._postfixCode.push(templateFunctionExpr.toDeclStmt(templateName, null));
  27297. };
  27298. TemplateDefinitionBuilder.prototype.visitBoundText = function (text) {
  27299. var nodeIndex = this.allocateDataSlot();
  27300. this.instruction(this._creationCode, text.sourceSpan, Identifiers$1.text, literal(nodeIndex));
  27301. this.instruction(this._bindingCode, text.sourceSpan, Identifiers$1.textBinding, literal(nodeIndex), this.convertPropertyBinding(variable(CONTEXT_NAME), text.value));
  27302. };
  27303. TemplateDefinitionBuilder.prototype.visitText = function (text) {
  27304. this.instruction(this._creationCode, text.sourceSpan, Identifiers$1.text, literal(this.allocateDataSlot()), literal(text.value));
  27305. };
  27306. // When the content of the element is a single text node the translation can be inlined:
  27307. //
  27308. // `<p i18n="desc|mean">some content</p>`
  27309. // compiles to
  27310. // ```
  27311. // /**
  27312. // * @desc desc
  27313. // * @meaning mean
  27314. // */
  27315. // const MSG_XYZ = goog.getMsg('some content');
  27316. // i0.ɵT(1, MSG_XYZ);
  27317. // ```
  27318. TemplateDefinitionBuilder.prototype.visitSingleI18nTextChild = function (text, i18nMeta) {
  27319. var meta = parseI18nMeta(i18nMeta);
  27320. var variable$$1 = this.constantPool.getTranslation(text.value, meta);
  27321. this.instruction(this._creationCode, text.sourceSpan, Identifiers$1.text, literal(this.allocateDataSlot()), variable$$1);
  27322. };
  27323. TemplateDefinitionBuilder.prototype.allocateDataSlot = function () { return this._dataIndex++; };
  27324. TemplateDefinitionBuilder.prototype.bindingContext = function () { return "" + this._bindingContext++; };
  27325. TemplateDefinitionBuilder.prototype.instruction = function (statements, span, reference) {
  27326. var params = [];
  27327. for (var _i = 3; _i < arguments.length; _i++) {
  27328. params[_i - 3] = arguments[_i];
  27329. }
  27330. statements.push(importExpr(reference, null, span).callFn(params, span).toStmt());
  27331. };
  27332. TemplateDefinitionBuilder.prototype.convertPropertyBinding = function (implicit, value, skipBindFn) {
  27333. var _a, _b;
  27334. var pipesConvertedValue = value.visit(this._valueConverter);
  27335. if (pipesConvertedValue instanceof Interpolation) {
  27336. var convertedPropertyBinding = convertPropertyBinding(this, implicit, pipesConvertedValue, this.bindingContext(), BindingForm.TrySimple, interpolate);
  27337. (_a = this._bindingCode).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(convertedPropertyBinding.stmts));
  27338. return convertedPropertyBinding.currValExpr;
  27339. }
  27340. else {
  27341. var convertedPropertyBinding = convertPropertyBinding(this, implicit, pipesConvertedValue, this.bindingContext(), BindingForm.TrySimple, function () { return error('Unexpected interpolation'); });
  27342. (_b = this._bindingCode).push.apply(_b, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(convertedPropertyBinding.stmts));
  27343. var valExpr = convertedPropertyBinding.currValExpr;
  27344. return skipBindFn ? valExpr : importExpr(Identifiers$1.bind).callFn([valExpr]);
  27345. }
  27346. };
  27347. return TemplateDefinitionBuilder;
  27348. }());
  27349. var ValueConverter = /** @class */ (function (_super) {
  27350. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ValueConverter, _super);
  27351. function ValueConverter(constantPool, allocateSlot, allocatePureFunctionSlots, definePipe) {
  27352. var _this = _super.call(this) || this;
  27353. _this.constantPool = constantPool;
  27354. _this.allocateSlot = allocateSlot;
  27355. _this.allocatePureFunctionSlots = allocatePureFunctionSlots;
  27356. _this.definePipe = definePipe;
  27357. return _this;
  27358. }
  27359. // AstMemoryEfficientTransformer
  27360. ValueConverter.prototype.visitPipe = function (pipe, context) {
  27361. // Allocate a slot to create the pipe
  27362. var slot = this.allocateSlot();
  27363. var slotPseudoLocal = "PIPE:" + slot;
  27364. // Allocate one slot for the result plus one slot per pipe argument
  27365. var pureFunctionSlot = this.allocatePureFunctionSlots(2 + pipe.args.length);
  27366. var target = new PropertyRead(pipe.span, new ImplicitReceiver(pipe.span), slotPseudoLocal);
  27367. var _a = pipeBindingCallInfo(pipe.args), identifier = _a.identifier, isVarLength = _a.isVarLength;
  27368. this.definePipe(pipe.name, slotPseudoLocal, slot, importExpr(identifier));
  27369. var args = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([pipe.exp], pipe.args);
  27370. var convertedArgs = isVarLength ? this.visitAll([new LiteralArray(pipe.span, args)]) : this.visitAll(args);
  27371. return new FunctionCall(pipe.span, target, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([
  27372. new LiteralPrimitive(pipe.span, slot),
  27373. new LiteralPrimitive(pipe.span, pureFunctionSlot)
  27374. ], convertedArgs));
  27375. };
  27376. ValueConverter.prototype.visitLiteralArray = function (array, context) {
  27377. var _this = this;
  27378. return new BuiltinFunctionCall(array.span, this.visitAll(array.expressions), function (values) {
  27379. // If the literal has calculated (non-literal) elements transform it into
  27380. // calls to literal factories that compose the literal and will cache intermediate
  27381. // values. Otherwise, just return an literal array that contains the values.
  27382. var literal$$1 = literalArr(values);
  27383. return values.every(function (a) { return a.isConstant(); }) ?
  27384. _this.constantPool.getConstLiteral(literal$$1, true) :
  27385. getLiteralFactory(_this.constantPool, literal$$1, _this.allocatePureFunctionSlots);
  27386. });
  27387. };
  27388. ValueConverter.prototype.visitLiteralMap = function (map, context) {
  27389. var _this = this;
  27390. return new BuiltinFunctionCall(map.span, this.visitAll(map.values), function (values) {
  27391. // If the literal has calculated (non-literal) elements transform it into
  27392. // calls to literal factories that compose the literal and will cache intermediate
  27393. // values. Otherwise, just return an literal array that contains the values.
  27394. var literal$$1 = literalMap(values.map(function (value, index) { return ({ key: map.keys[index].key, value: value, quoted: map.keys[index].quoted }); }));
  27395. return values.every(function (a) { return a.isConstant(); }) ?
  27396. _this.constantPool.getConstLiteral(literal$$1, true) :
  27397. getLiteralFactory(_this.constantPool, literal$$1, _this.allocatePureFunctionSlots);
  27398. });
  27399. };
  27400. return ValueConverter;
  27401. }(AstMemoryEfficientTransformer));
  27402. // Pipes always have at least one parameter, the value they operate on
  27403. var pipeBindingIdentifiers = [Identifiers$1.pipeBind1, Identifiers$1.pipeBind2, Identifiers$1.pipeBind3, Identifiers$1.pipeBind4];
  27404. function pipeBindingCallInfo(args) {
  27405. var identifier = pipeBindingIdentifiers[args.length];
  27406. return {
  27407. identifier: identifier || Identifiers$1.pipeBindV,
  27408. isVarLength: !identifier,
  27409. };
  27410. }
  27411. var pureFunctionIdentifiers = [
  27412. Identifiers$1.pureFunction0, Identifiers$1.pureFunction1, Identifiers$1.pureFunction2, Identifiers$1.pureFunction3, Identifiers$1.pureFunction4,
  27413. Identifiers$1.pureFunction5, Identifiers$1.pureFunction6, Identifiers$1.pureFunction7, Identifiers$1.pureFunction8
  27414. ];
  27415. function pureFunctionCallInfo(args) {
  27416. var identifier = pureFunctionIdentifiers[args.length];
  27417. return {
  27418. identifier: identifier || Identifiers$1.pureFunctionV,
  27419. isVarLength: !identifier,
  27420. };
  27421. }
  27422. function getLiteralFactory(constantPool, literal$$1, allocateSlots) {
  27423. var _a = constantPool.getLiteralFactory(literal$$1), literalFactory = _a.literalFactory, literalFactoryArguments = _a.literalFactoryArguments;
  27424. // Allocate 1 slot for the result plus 1 per argument
  27425. var startSlot = allocateSlots(1 + literalFactoryArguments.length);
  27426. literalFactoryArguments.length > 0 || error("Expected arguments to a literal factory function");
  27427. var _b = pureFunctionCallInfo(literalFactoryArguments), identifier = _b.identifier, isVarLength = _b.isVarLength;
  27428. // Literal factories are pure functions that only need to be re-invoked when the parameters
  27429. // change.
  27430. var args = [
  27431. literal(startSlot),
  27432. literalFactory,
  27433. ];
  27434. if (isVarLength) {
  27435. args.push(literalArr(literalFactoryArguments));
  27436. }
  27437. else {
  27438. args.push.apply(args, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(literalFactoryArguments));
  27439. }
  27440. return importExpr(identifier).callFn(args);
  27441. }
  27442. var BindingScope = /** @class */ (function () {
  27443. function BindingScope(parent, declareLocalVarCallback) {
  27444. if (parent === void 0) { parent = null; }
  27445. if (declareLocalVarCallback === void 0) { declareLocalVarCallback = noop; }
  27446. this.parent = parent;
  27447. this.declareLocalVarCallback = declareLocalVarCallback;
  27448. /**
  27449. * Keeps a map from local variables to their expressions.
  27450. *
  27451. * This is used when one refers to variable such as: 'let abc = a.b.c`.
  27452. * - key to the map is the string literal `"abc"`.
  27453. * - value `lhs` is the left hand side which is an AST representing `abc`.
  27454. * - value `rhs` is the right hand side which is an AST representing `a.b.c`.
  27455. * - value `declared` is true if the `declareLocalVarCallback` has been called for this scope
  27456. * already.
  27457. */
  27458. this.map = new Map();
  27459. this.referenceNameIndex = 0;
  27460. }
  27461. Object.defineProperty(BindingScope, "ROOT_SCOPE", {
  27462. get: function () {
  27463. if (!BindingScope._ROOT_SCOPE) {
  27464. BindingScope._ROOT_SCOPE = new BindingScope().set('$event', variable('$event'));
  27465. }
  27466. return BindingScope._ROOT_SCOPE;
  27467. },
  27468. enumerable: true,
  27469. configurable: true
  27470. });
  27471. BindingScope.prototype.get = function (name) {
  27472. var current = this;
  27473. while (current) {
  27474. var value = current.map.get(name);
  27475. if (value != null) {
  27476. if (current !== this) {
  27477. // make a local copy and reset the `declared` state.
  27478. value = { lhs: value.lhs, rhs: value.rhs, declared: false };
  27479. // Cache the value locally.
  27480. this.map.set(name, value);
  27481. }
  27482. if (value.rhs && !value.declared) {
  27483. // if it is first time we are referencing the variable in the scope
  27484. // than invoke the callback to insert variable declaration.
  27485. this.declareLocalVarCallback(value.lhs, value.rhs);
  27486. value.declared = true;
  27487. }
  27488. return value.lhs;
  27489. }
  27490. current = current.parent;
  27491. }
  27492. return null;
  27493. };
  27494. /**
  27495. * Create a local variable for later reference.
  27496. *
  27497. * @param name Name of the variable.
  27498. * @param lhs AST representing the left hand side of the `let lhs = rhs;`.
  27499. * @param rhs AST representing the right hand side of the `let lhs = rhs;`. The `rhs` can be
  27500. * `undefined` for variable that are ambient such as `$event` and which don't have `rhs`
  27501. * declaration.
  27502. */
  27503. BindingScope.prototype.set = function (name, lhs, rhs) {
  27504. !this.map.has(name) ||
  27505. error("The name " + name + " is already defined in scope to be " + this.map.get(name));
  27506. this.map.set(name, { lhs: lhs, rhs: rhs, declared: false });
  27507. return this;
  27508. };
  27509. BindingScope.prototype.getLocal = function (name) { return this.get(name); };
  27510. BindingScope.prototype.nestedScope = function (declareCallback) {
  27511. return new BindingScope(this, declareCallback);
  27512. };
  27513. BindingScope.prototype.freshReferenceName = function () {
  27514. var current = this;
  27515. // Find the top scope as it maintains the global reference count
  27516. while (current.parent)
  27517. current = current.parent;
  27518. var ref = "" + REFERENCE_PREFIX + current.referenceNameIndex++;
  27519. return ref;
  27520. };
  27521. return BindingScope;
  27522. }());
  27523. /**
  27524. * Creates a `CssSelector` given a tag name and a map of attributes
  27525. */
  27526. function createCssSelector(tag, attributes) {
  27527. var cssSelector = new CssSelector();
  27528. cssSelector.setElement(tag);
  27529. Object.getOwnPropertyNames(attributes).forEach(function (name) {
  27530. var value = attributes[name];
  27531. cssSelector.addAttribute(name, value);
  27532. if (name.toLowerCase() === 'class') {
  27533. var classes = value.trim().split(/\s+/g);
  27534. classes.forEach(function (className) { return cssSelector.addClassName(className); });
  27535. }
  27536. });
  27537. return cssSelector;
  27538. }
  27539. // Parse i18n metas like:
  27540. // - "@@id",
  27541. // - "description[@@id]",
  27542. // - "meaning|description[@@id]"
  27543. function parseI18nMeta(i18n) {
  27544. var _a, _b;
  27545. var meaning;
  27546. var description;
  27547. var id;
  27548. if (i18n) {
  27549. // TODO(vicb): figure out how to force a message ID with closure ?
  27550. var idIndex = i18n.indexOf(ID_SEPARATOR$1);
  27551. var descIndex = i18n.indexOf(MEANING_SEPARATOR$1);
  27552. var meaningAndDesc = void 0;
  27553. _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])((idIndex > -1) ? [i18n.slice(0, idIndex), i18n.slice(idIndex + 2)] : [i18n, ''], 2), meaningAndDesc = _a[0], id = _a[1];
  27554. _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])((descIndex > -1) ?
  27555. [meaningAndDesc.slice(0, descIndex), meaningAndDesc.slice(descIndex + 1)] :
  27556. ['', meaningAndDesc], 2), meaning = _b[0], description = _b[1];
  27557. }
  27558. return { description: description, id: id, meaning: meaning };
  27559. }
  27560. function interpolate(args) {
  27561. args = args.slice(1); // Ignore the length prefix added for render2
  27562. switch (args.length) {
  27563. case 3:
  27564. return importExpr(Identifiers$1.interpolation1).callFn(args);
  27565. case 5:
  27566. return importExpr(Identifiers$1.interpolation2).callFn(args);
  27567. case 7:
  27568. return importExpr(Identifiers$1.interpolation3).callFn(args);
  27569. case 9:
  27570. return importExpr(Identifiers$1.interpolation4).callFn(args);
  27571. case 11:
  27572. return importExpr(Identifiers$1.interpolation5).callFn(args);
  27573. case 13:
  27574. return importExpr(Identifiers$1.interpolation6).callFn(args);
  27575. case 15:
  27576. return importExpr(Identifiers$1.interpolation7).callFn(args);
  27577. case 17:
  27578. return importExpr(Identifiers$1.interpolation8).callFn(args);
  27579. }
  27580. (args.length >= 19 && args.length % 2 == 1) ||
  27581. error("Invalid interpolation argument length " + args.length);
  27582. return importExpr(Identifiers$1.interpolationV).callFn([literalArr(args)]);
  27583. }
  27584. /**
  27585. * Parse a template into render3 `Node`s and additional metadata, with no other dependencies.
  27586. *
  27587. * @param template text of the template to parse
  27588. * @param templateUrl URL to use for source mapping of the parsed template
  27589. */
  27590. function parseTemplate(template, templateUrl, options) {
  27591. if (options === void 0) { options = {}; }
  27592. var bindingParser = makeBindingParser();
  27593. var htmlParser = new HtmlParser();
  27594. var parseResult = htmlParser.parse(template, templateUrl);
  27595. if (parseResult.errors && parseResult.errors.length > 0) {
  27596. return { errors: parseResult.errors, nodes: [], hasNgContent: false, ngContentSelectors: [] };
  27597. }
  27598. var rootNodes = parseResult.rootNodes;
  27599. if (!options.preserveWhitespaces) {
  27600. rootNodes = visitAll(new WhitespaceVisitor(), rootNodes);
  27601. }
  27602. var _a = htmlAstToRender3Ast(rootNodes, bindingParser), nodes = _a.nodes, hasNgContent = _a.hasNgContent, ngContentSelectors = _a.ngContentSelectors, errors = _a.errors;
  27603. if (errors && errors.length > 0) {
  27604. return { errors: errors, nodes: [], hasNgContent: false, ngContentSelectors: [] };
  27605. }
  27606. return { nodes: nodes, hasNgContent: hasNgContent, ngContentSelectors: ngContentSelectors };
  27607. }
  27608. /**
  27609. * Construct a `BindingParser` with a default configuration.
  27610. */
  27611. function makeBindingParser() {
  27612. return new BindingParser(new Parser(new Lexer()), DEFAULT_INTERPOLATION_CONFIG, new DomElementSchemaRegistry(), null, []);
  27613. }
  27614. function isClassBinding(input) {
  27615. return input.name == 'className' || input.name == 'class';
  27616. }
  27617. function resolveSanitizationFn(input, context) {
  27618. switch (context) {
  27619. case SecurityContext.HTML:
  27620. return importExpr(Identifiers$1.sanitizeHtml);
  27621. case SecurityContext.SCRIPT:
  27622. return importExpr(Identifiers$1.sanitizeScript);
  27623. case SecurityContext.STYLE:
  27624. // the compiler does not fill in an instruction for [style.prop?] binding
  27625. // values because the style algorithm knows internally what props are subject
  27626. // to sanitization (only [attr.style] values are explicitly sanitized)
  27627. return input.type === 1 /* Attribute */ ? importExpr(Identifiers$1.sanitizeStyle) : null;
  27628. case SecurityContext.URL:
  27629. return importExpr(Identifiers$1.sanitizeUrl);
  27630. case SecurityContext.RESOURCE_URL:
  27631. return importExpr(Identifiers$1.sanitizeResourceUrl);
  27632. default:
  27633. return null;
  27634. }
  27635. }
  27636. function isStyleSanitizable(prop) {
  27637. switch (prop) {
  27638. case 'background-image':
  27639. case 'background':
  27640. case 'border-image':
  27641. case 'filter':
  27642. case 'list-style':
  27643. case 'list-style-image':
  27644. return true;
  27645. }
  27646. return false;
  27647. }
  27648. /**
  27649. * @license
  27650. * Copyright Google Inc. All Rights Reserved.
  27651. *
  27652. * Use of this source code is governed by an MIT-style license that can be
  27653. * found in the LICENSE file at https://angular.io/license
  27654. */
  27655. function baseDirectiveFields(meta, constantPool, bindingParser) {
  27656. var definitionMap = new DefinitionMap();
  27657. // e.g. `type: MyDirective`
  27658. definitionMap.set('type', meta.type);
  27659. // e.g. `selectors: [['', 'someDir', '']]`
  27660. definitionMap.set('selectors', createDirectiveSelector(meta.selector));
  27661. // e.g. `factory: () => new MyApp(injectElementRef())`
  27662. definitionMap.set('factory', compileFactoryFunction({
  27663. name: meta.name,
  27664. fnOrClass: meta.type,
  27665. deps: meta.deps,
  27666. useNew: true,
  27667. injectFn: Identifiers$1.directiveInject,
  27668. }));
  27669. definitionMap.set('contentQueries', createContentQueriesFunction(meta, constantPool));
  27670. definitionMap.set('contentQueriesRefresh', createContentQueriesRefreshFunction(meta));
  27671. // e.g. `hostBindings: (dirIndex, elIndex) => { ... }
  27672. definitionMap.set('hostBindings', createHostBindingsFunction(meta, bindingParser));
  27673. // e.g. `attributes: ['role', 'listbox']`
  27674. definitionMap.set('attributes', createHostAttributesArray(meta));
  27675. // e.g 'inputs: {a: 'a'}`
  27676. definitionMap.set('inputs', conditionallyCreateMapObjectLiteral(meta.inputs));
  27677. // e.g 'outputs: {a: 'a'}`
  27678. definitionMap.set('outputs', conditionallyCreateMapObjectLiteral(meta.outputs));
  27679. // e.g. `features: [NgOnChangesFeature]`
  27680. var features = [];
  27681. if (meta.usesInheritance) {
  27682. features.push(importExpr(Identifiers$1.InheritDefinitionFeature));
  27683. }
  27684. if (meta.lifecycle.usesOnChanges) {
  27685. features.push(importExpr(Identifiers$1.NgOnChangesFeature));
  27686. }
  27687. if (features.length) {
  27688. definitionMap.set('features', literalArr(features));
  27689. }
  27690. return definitionMap;
  27691. }
  27692. /**
  27693. * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
  27694. */
  27695. function compileDirectiveFromMetadata(meta, constantPool, bindingParser) {
  27696. var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
  27697. var expression = importExpr(Identifiers$1.defineDirective).callFn([definitionMap.toLiteralMap()]);
  27698. // On the type side, remove newlines from the selector as it will need to fit into a TypeScript
  27699. // string literal, which must be on one line.
  27700. var selectorForType = (meta.selector || '').replace(/\n/g, '');
  27701. var type = new ExpressionType(importExpr(Identifiers$1.DirectiveDef, [
  27702. typeWithParameters(meta.type, meta.typeArgumentCount),
  27703. new ExpressionType(literal(selectorForType))
  27704. ]));
  27705. return { expression: expression, type: type };
  27706. }
  27707. /**
  27708. * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
  27709. */
  27710. function compileComponentFromMetadata(meta, constantPool, bindingParser) {
  27711. var definitionMap = baseDirectiveFields(meta, constantPool, bindingParser);
  27712. var selector = meta.selector && CssSelector.parse(meta.selector);
  27713. var firstSelector = selector && selector[0];
  27714. // e.g. `attr: ["class", ".my.app"]`
  27715. // This is optional an only included if the first selector of a component specifies attributes.
  27716. if (firstSelector) {
  27717. var selectorAttributes = firstSelector.getAttrs();
  27718. if (selectorAttributes.length) {
  27719. definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map(function (value) { return value != null ? literal(value) : literal(undefined); })),
  27720. /* forceShared */ true));
  27721. }
  27722. }
  27723. // Generate the CSS matcher that recognize directive
  27724. var directiveMatcher = null;
  27725. if (meta.directives.size) {
  27726. var matcher_1 = new SelectorMatcher();
  27727. meta.directives.forEach(function (expression, selector) {
  27728. matcher_1.addSelectables(CssSelector.parse(selector), expression);
  27729. });
  27730. directiveMatcher = matcher_1;
  27731. }
  27732. if (meta.viewQueries.length) {
  27733. definitionMap.set('viewQuery', createViewQueriesFunction(meta, constantPool));
  27734. }
  27735. // e.g. `template: function MyComponent_Template(_ctx, _cm) {...}`
  27736. var templateTypeName = meta.name;
  27737. var templateName = templateTypeName ? templateTypeName + "_Template" : null;
  27738. var directivesUsed = new Set();
  27739. var pipesUsed = new Set();
  27740. var template = meta.template;
  27741. var templateFunctionExpression = new TemplateDefinitionBuilder(constantPool, CONTEXT_NAME, BindingScope.ROOT_SCOPE, 0, templateTypeName, templateName, meta.viewQueries, directiveMatcher, directivesUsed, meta.pipes, pipesUsed, Identifiers$1.namespaceHTML)
  27742. .buildTemplateFunction(template.nodes, [], template.hasNgContent, template.ngContentSelectors);
  27743. definitionMap.set('template', templateFunctionExpression);
  27744. // e.g. `directives: [MyDirective]`
  27745. if (directivesUsed.size) {
  27746. definitionMap.set('directives', literalArr(Array.from(directivesUsed)));
  27747. }
  27748. // e.g. `pipes: [MyPipe]`
  27749. if (pipesUsed.size) {
  27750. definitionMap.set('pipes', literalArr(Array.from(pipesUsed)));
  27751. }
  27752. // On the type side, remove newlines from the selector as it will need to fit into a TypeScript
  27753. // string literal, which must be on one line.
  27754. var selectorForType = (meta.selector || '').replace(/\n/g, '');
  27755. var expression = importExpr(Identifiers$1.defineComponent).callFn([definitionMap.toLiteralMap()]);
  27756. var type = new ExpressionType(importExpr(Identifiers$1.ComponentDef, [
  27757. typeWithParameters(meta.type, meta.typeArgumentCount),
  27758. new ExpressionType(literal(selectorForType))
  27759. ]));
  27760. return { expression: expression, type: type };
  27761. }
  27762. /**
  27763. * A wrapper around `compileDirective` which depends on render2 global analysis data as its input
  27764. * instead of the `R3DirectiveMetadata`.
  27765. *
  27766. * `R3DirectiveMetadata` is computed from `CompileDirectiveMetadata` and other statically reflected
  27767. * information.
  27768. */
  27769. function compileDirectiveFromRender2(outputCtx, directive, reflector, bindingParser) {
  27770. var name = identifierName(directive.type);
  27771. name || error("Cannot resolver the name of " + directive.type);
  27772. var definitionField = outputCtx.constantPool.propertyNameOf(1 /* Directive */);
  27773. var meta = directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector);
  27774. var res = compileDirectiveFromMetadata(meta, outputCtx.constantPool, bindingParser);
  27775. // Create the partial class to be merged with the actual class.
  27776. outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));
  27777. }
  27778. /**
  27779. * A wrapper around `compileComponent` which depends on render2 global analysis data as its input
  27780. * instead of the `R3DirectiveMetadata`.
  27781. *
  27782. * `R3ComponentMetadata` is computed from `CompileDirectiveMetadata` and other statically reflected
  27783. * information.
  27784. */
  27785. function compileComponentFromRender2(outputCtx, component, render3Ast, reflector, bindingParser, directiveTypeBySel, pipeTypeByName) {
  27786. var name = identifierName(component.type);
  27787. name || error("Cannot resolver the name of " + component.type);
  27788. var definitionField = outputCtx.constantPool.propertyNameOf(2 /* Component */);
  27789. var summary = component.toSummary();
  27790. // Compute the R3ComponentMetadata from the CompileDirectiveMetadata
  27791. var meta = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, directiveMetadataFromGlobalMetadata(component, outputCtx, reflector), { selector: component.selector, template: {
  27792. nodes: render3Ast.nodes,
  27793. hasNgContent: render3Ast.hasNgContent,
  27794. ngContentSelectors: render3Ast.ngContentSelectors,
  27795. }, directives: typeMapToExpressionMap(directiveTypeBySel, outputCtx), pipes: typeMapToExpressionMap(pipeTypeByName, outputCtx), viewQueries: queriesFromGlobalMetadata(component.viewQueries, outputCtx) });
  27796. var res = compileComponentFromMetadata(meta, outputCtx.constantPool, bindingParser);
  27797. // Create the partial class to be merged with the actual class.
  27798. outputCtx.statements.push(new ClassStmt(name, null, [new ClassField(definitionField, INFERRED_TYPE, [StmtModifier.Static], res.expression)], [], new ClassMethod(null, [], []), []));
  27799. }
  27800. /**
  27801. * Compute `R3DirectiveMetadata` given `CompileDirectiveMetadata` and a `CompileReflector`.
  27802. */
  27803. function directiveMetadataFromGlobalMetadata(directive, outputCtx, reflector) {
  27804. var summary = directive.toSummary();
  27805. var name = identifierName(directive.type);
  27806. name || error("Cannot resolver the name of " + directive.type);
  27807. return {
  27808. name: name,
  27809. type: outputCtx.importExpr(directive.type.reference),
  27810. typeArgumentCount: 0,
  27811. typeSourceSpan: typeSourceSpan(directive.isComponent ? 'Component' : 'Directive', directive.type),
  27812. selector: directive.selector,
  27813. deps: dependenciesFromGlobalMetadata(directive.type, outputCtx, reflector),
  27814. queries: queriesFromGlobalMetadata(directive.queries, outputCtx),
  27815. lifecycle: {
  27816. usesOnChanges: directive.type.lifecycleHooks.some(function (lifecycle) { return lifecycle == LifecycleHooks.OnChanges; }),
  27817. },
  27818. host: {
  27819. attributes: directive.hostAttributes,
  27820. listeners: summary.hostListeners,
  27821. properties: summary.hostProperties,
  27822. },
  27823. inputs: directive.inputs,
  27824. outputs: directive.outputs,
  27825. usesInheritance: false,
  27826. };
  27827. }
  27828. /**
  27829. * Convert `CompileQueryMetadata` into `R3QueryMetadata`.
  27830. */
  27831. function queriesFromGlobalMetadata(queries, outputCtx) {
  27832. return queries.map(function (query) {
  27833. var read = null;
  27834. if (query.read && query.read.identifier) {
  27835. read = outputCtx.importExpr(query.read.identifier.reference);
  27836. }
  27837. return {
  27838. propertyName: query.propertyName,
  27839. first: query.first,
  27840. predicate: selectorsFromGlobalMetadata(query.selectors, outputCtx),
  27841. descendants: query.descendants, read: read,
  27842. };
  27843. });
  27844. }
  27845. /**
  27846. * Convert `CompileTokenMetadata` for query selectors into either an expression for a predicate
  27847. * type, or a list of string predicates.
  27848. */
  27849. function selectorsFromGlobalMetadata(selectors, outputCtx) {
  27850. if (selectors.length > 1 || (selectors.length == 1 && selectors[0].value)) {
  27851. var selectorStrings = selectors.map(function (value) { return value.value; });
  27852. selectorStrings.some(function (value) { return !value; }) &&
  27853. error('Found a type among the string selectors expected');
  27854. return outputCtx.constantPool.getConstLiteral(literalArr(selectorStrings.map(function (value) { return literal(value); })));
  27855. }
  27856. if (selectors.length == 1) {
  27857. var first = selectors[0];
  27858. if (first.identifier) {
  27859. return outputCtx.importExpr(first.identifier.reference);
  27860. }
  27861. }
  27862. error('Unexpected query form');
  27863. return NULL_EXPR;
  27864. }
  27865. function createQueryDefinition(query, constantPool, idx) {
  27866. var predicate = getQueryPredicate(query, constantPool);
  27867. // e.g. r3.Q(null, somePredicate, false) or r3.Q(0, ['div'], false)
  27868. var parameters = [
  27869. literal(idx, INFERRED_TYPE),
  27870. predicate,
  27871. literal(query.descendants),
  27872. ];
  27873. if (query.read) {
  27874. parameters.push(query.read);
  27875. }
  27876. return importExpr(Identifiers$1.query).callFn(parameters);
  27877. }
  27878. // Turn a directive selector into an R3-compatible selector for directive def
  27879. function createDirectiveSelector(selector) {
  27880. return asLiteral(parseSelectorToR3Selector(selector));
  27881. }
  27882. function createHostAttributesArray(meta) {
  27883. var e_1, _a;
  27884. var values = [];
  27885. var attributes = meta.host.attributes;
  27886. try {
  27887. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(Object.getOwnPropertyNames(attributes)), _c = _b.next(); !_c.done; _c = _b.next()) {
  27888. var key = _c.value;
  27889. var value = attributes[key];
  27890. values.push(literal(key), literal(value));
  27891. }
  27892. }
  27893. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  27894. finally {
  27895. try {
  27896. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  27897. }
  27898. finally { if (e_1) throw e_1.error; }
  27899. }
  27900. if (values.length > 0) {
  27901. return literalArr(values);
  27902. }
  27903. return null;
  27904. }
  27905. // Return a contentQueries function or null if one is not necessary.
  27906. function createContentQueriesFunction(meta, constantPool) {
  27907. if (meta.queries.length) {
  27908. var statements = meta.queries.map(function (query) {
  27909. var queryDefinition = createQueryDefinition(query, constantPool, null);
  27910. return importExpr(Identifiers$1.registerContentQuery).callFn([queryDefinition]).toStmt();
  27911. });
  27912. var typeName = meta.name;
  27913. return fn([], statements, INFERRED_TYPE, null, typeName ? typeName + "_ContentQueries" : null);
  27914. }
  27915. return null;
  27916. }
  27917. // Return a contentQueriesRefresh function or null if one is not necessary.
  27918. function createContentQueriesRefreshFunction(meta) {
  27919. if (meta.queries.length > 0) {
  27920. var statements_1 = [];
  27921. var typeName = meta.name;
  27922. var parameters = [
  27923. new FnParam('dirIndex', NUMBER_TYPE),
  27924. new FnParam('queryStartIndex', NUMBER_TYPE),
  27925. ];
  27926. var directiveInstanceVar_1 = variable('instance');
  27927. // var $tmp$: any;
  27928. var temporary_1 = temporaryAllocator(statements_1, TEMPORARY_NAME);
  27929. // const $instance$ = $r3$.ɵd(dirIndex);
  27930. statements_1.push(directiveInstanceVar_1.set(importExpr(Identifiers$1.loadDirective).callFn([variable('dirIndex')]))
  27931. .toDeclStmt(INFERRED_TYPE, [StmtModifier.Final]));
  27932. meta.queries.forEach(function (query, idx) {
  27933. var loadQLArg = variable('queryStartIndex');
  27934. var getQueryList = importExpr(Identifiers$1.loadQueryList).callFn([
  27935. idx > 0 ? loadQLArg.plus(literal(idx)) : loadQLArg
  27936. ]);
  27937. var assignToTemporary = temporary_1().set(getQueryList);
  27938. var callQueryRefresh = importExpr(Identifiers$1.queryRefresh).callFn([assignToTemporary]);
  27939. var updateDirective = directiveInstanceVar_1.prop(query.propertyName)
  27940. .set(query.first ? temporary_1().prop('first') : temporary_1());
  27941. var refreshQueryAndUpdateDirective = callQueryRefresh.and(updateDirective);
  27942. statements_1.push(refreshQueryAndUpdateDirective.toStmt());
  27943. });
  27944. return fn(parameters, statements_1, INFERRED_TYPE, null, typeName ? typeName + "_ContentQueriesRefresh" : null);
  27945. }
  27946. return null;
  27947. }
  27948. // Define and update any view queries
  27949. function createViewQueriesFunction(meta, constantPool) {
  27950. var createStatements = [];
  27951. var updateStatements = [];
  27952. var tempAllocator = temporaryAllocator(updateStatements, TEMPORARY_NAME);
  27953. for (var i = 0; i < meta.viewQueries.length; i++) {
  27954. var query = meta.viewQueries[i];
  27955. // creation, e.g. r3.Q(0, somePredicate, true);
  27956. var queryDefinition = createQueryDefinition(query, constantPool, i);
  27957. createStatements.push(queryDefinition.toStmt());
  27958. // update, e.g. (r3.qR(tmp = r3.ɵld(0)) && (ctx.someDir = tmp));
  27959. var temporary = tempAllocator();
  27960. var getQueryList = importExpr(Identifiers$1.load).callFn([literal(i)]);
  27961. var refresh = importExpr(Identifiers$1.queryRefresh).callFn([temporary.set(getQueryList)]);
  27962. var updateDirective = variable(CONTEXT_NAME)
  27963. .prop(query.propertyName)
  27964. .set(query.first ? temporary.prop('first') : temporary);
  27965. updateStatements.push(refresh.and(updateDirective).toStmt());
  27966. }
  27967. var viewQueryFnName = meta.name ? meta.name + "_Query" : null;
  27968. return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], [
  27969. renderFlagCheckIfStmt(1 /* Create */, createStatements),
  27970. renderFlagCheckIfStmt(2 /* Update */, updateStatements)
  27971. ], INFERRED_TYPE, null, viewQueryFnName);
  27972. }
  27973. // Return a host binding function or null if one is not necessary.
  27974. function createHostBindingsFunction(meta, bindingParser) {
  27975. var e_2, _a, e_3, _b;
  27976. var statements = [];
  27977. var hostBindingSourceSpan = meta.typeSourceSpan;
  27978. var directiveSummary = metadataAsSummary(meta);
  27979. // Calculate the host property bindings
  27980. var bindings = bindingParser.createBoundHostProperties(directiveSummary, hostBindingSourceSpan);
  27981. var bindingContext = importExpr(Identifiers$1.loadDirective).callFn([variable('dirIndex')]);
  27982. if (bindings) {
  27983. try {
  27984. for (var bindings_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(bindings), bindings_1_1 = bindings_1.next(); !bindings_1_1.done; bindings_1_1 = bindings_1.next()) {
  27985. var binding = bindings_1_1.value;
  27986. var bindingExpr = convertPropertyBinding(null, bindingContext, binding.expression, 'b', BindingForm.TrySimple, function () { return error('Unexpected interpolation'); });
  27987. statements.push.apply(statements, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(bindingExpr.stmts));
  27988. statements.push(importExpr(Identifiers$1.elementProperty)
  27989. .callFn([
  27990. variable('elIndex'),
  27991. literal(binding.name),
  27992. importExpr(Identifiers$1.bind).callFn([bindingExpr.currValExpr]),
  27993. ])
  27994. .toStmt());
  27995. }
  27996. }
  27997. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  27998. finally {
  27999. try {
  28000. if (bindings_1_1 && !bindings_1_1.done && (_a = bindings_1.return)) _a.call(bindings_1);
  28001. }
  28002. finally { if (e_2) throw e_2.error; }
  28003. }
  28004. }
  28005. // Calculate host event bindings
  28006. var eventBindings = bindingParser.createDirectiveHostEventAsts(directiveSummary, hostBindingSourceSpan);
  28007. if (eventBindings) {
  28008. try {
  28009. for (var eventBindings_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(eventBindings), eventBindings_1_1 = eventBindings_1.next(); !eventBindings_1_1.done; eventBindings_1_1 = eventBindings_1.next()) {
  28010. var binding = eventBindings_1_1.value;
  28011. var bindingExpr = convertActionBinding(null, bindingContext, binding.handler, 'b', function () { return error('Unexpected interpolation'); });
  28012. var bindingName = binding.name && sanitizeIdentifier(binding.name);
  28013. var typeName = meta.name;
  28014. var functionName = typeName && bindingName ? typeName + "_" + bindingName + "_HostBindingHandler" : null;
  28015. var handler = fn([new FnParam('$event', DYNAMIC_TYPE)], Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(bindingExpr.stmts, [new ReturnStatement(bindingExpr.allowDefault)]), INFERRED_TYPE, null, functionName);
  28016. statements.push(importExpr(Identifiers$1.listener).callFn([literal(binding.name), handler]).toStmt());
  28017. }
  28018. }
  28019. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  28020. finally {
  28021. try {
  28022. if (eventBindings_1_1 && !eventBindings_1_1.done && (_b = eventBindings_1.return)) _b.call(eventBindings_1);
  28023. }
  28024. finally { if (e_3) throw e_3.error; }
  28025. }
  28026. }
  28027. if (statements.length > 0) {
  28028. var typeName = meta.name;
  28029. return fn([
  28030. new FnParam('dirIndex', NUMBER_TYPE),
  28031. new FnParam('elIndex', NUMBER_TYPE),
  28032. ], statements, INFERRED_TYPE, null, typeName ? typeName + "_HostBindings" : null);
  28033. }
  28034. return null;
  28035. }
  28036. function metadataAsSummary(meta) {
  28037. // clang-format off
  28038. return {
  28039. hostAttributes: meta.host.attributes,
  28040. hostListeners: meta.host.listeners,
  28041. hostProperties: meta.host.properties,
  28042. };
  28043. // clang-format on
  28044. }
  28045. function typeMapToExpressionMap(map, outputCtx) {
  28046. // Convert each map entry into another entry where the value is an expression importing the type.
  28047. var entries = Array.from(map).map(function (_a) {
  28048. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), key = _b[0], type = _b[1];
  28049. return [key, outputCtx.importExpr(type)];
  28050. });
  28051. return new Map(entries);
  28052. }
  28053. var HOST_REG_EXP$1 = /^(?:(?:\[([^\]]+)\])|(?:\(([^\)]+)\)))|(\@[-\w]+)$/;
  28054. function parseHostBindings(host) {
  28055. var attributes = {};
  28056. var listeners = {};
  28057. var properties = {};
  28058. var animations = {};
  28059. Object.keys(host).forEach(function (key) {
  28060. var value = host[key];
  28061. var matches = key.match(HOST_REG_EXP$1);
  28062. if (matches === null) {
  28063. attributes[key] = value;
  28064. }
  28065. else if (matches[1 /* Property */] != null) {
  28066. properties[matches[1 /* Property */]] = value;
  28067. }
  28068. else if (matches[2 /* Event */] != null) {
  28069. listeners[matches[2 /* Event */]] = value;
  28070. }
  28071. else if (matches[3 /* Animation */] != null) {
  28072. animations[matches[3 /* Animation */]] = value;
  28073. }
  28074. });
  28075. return { attributes: attributes, listeners: listeners, properties: properties, animations: animations };
  28076. }
  28077. /**
  28078. * @license
  28079. * Copyright Google Inc. All Rights Reserved.
  28080. *
  28081. * Use of this source code is governed by an MIT-style license that can be
  28082. * found in the LICENSE file at https://angular.io/license
  28083. */
  28084. var GeneratedFile = /** @class */ (function () {
  28085. function GeneratedFile(srcFileUrl, genFileUrl, sourceOrStmts) {
  28086. this.srcFileUrl = srcFileUrl;
  28087. this.genFileUrl = genFileUrl;
  28088. if (typeof sourceOrStmts === 'string') {
  28089. this.source = sourceOrStmts;
  28090. this.stmts = null;
  28091. }
  28092. else {
  28093. this.source = null;
  28094. this.stmts = sourceOrStmts;
  28095. }
  28096. }
  28097. GeneratedFile.prototype.isEquivalent = function (other) {
  28098. if (this.genFileUrl !== other.genFileUrl) {
  28099. return false;
  28100. }
  28101. if (this.source) {
  28102. return this.source === other.source;
  28103. }
  28104. if (other.stmts == null) {
  28105. return false;
  28106. }
  28107. // Note: the constructor guarantees that if this.source is not filled,
  28108. // then this.stmts is.
  28109. return areAllEquivalent(this.stmts, other.stmts);
  28110. };
  28111. return GeneratedFile;
  28112. }());
  28113. function toTypeScript(file, preamble) {
  28114. if (preamble === void 0) { preamble = ''; }
  28115. if (!file.stmts) {
  28116. throw new Error("Illegal state: No stmts present on GeneratedFile " + file.genFileUrl);
  28117. }
  28118. return new TypeScriptEmitter().emitStatements(file.genFileUrl, file.stmts, preamble);
  28119. }
  28120. /**
  28121. * @license
  28122. * Copyright Google Inc. All Rights Reserved.
  28123. *
  28124. * Use of this source code is governed by an MIT-style license that can be
  28125. * found in the LICENSE file at https://angular.io/license
  28126. */
  28127. function listLazyRoutes(moduleMeta, reflector) {
  28128. var e_1, _a, e_2, _b;
  28129. var allLazyRoutes = [];
  28130. try {
  28131. for (var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(moduleMeta.transitiveModule.providers), _d = _c.next(); !_d.done; _d = _c.next()) {
  28132. var _e = _d.value, provider = _e.provider, module = _e.module;
  28133. if (tokenReference(provider.token) === reflector.ROUTES) {
  28134. var loadChildren = _collectLoadChildren(provider.useValue);
  28135. try {
  28136. for (var loadChildren_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(loadChildren), loadChildren_1_1 = loadChildren_1.next(); !loadChildren_1_1.done; loadChildren_1_1 = loadChildren_1.next()) {
  28137. var route = loadChildren_1_1.value;
  28138. allLazyRoutes.push(parseLazyRoute(route, reflector, module.reference));
  28139. }
  28140. }
  28141. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  28142. finally {
  28143. try {
  28144. if (loadChildren_1_1 && !loadChildren_1_1.done && (_b = loadChildren_1.return)) _b.call(loadChildren_1);
  28145. }
  28146. finally { if (e_2) throw e_2.error; }
  28147. }
  28148. }
  28149. }
  28150. }
  28151. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  28152. finally {
  28153. try {
  28154. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  28155. }
  28156. finally { if (e_1) throw e_1.error; }
  28157. }
  28158. return allLazyRoutes;
  28159. }
  28160. function _collectLoadChildren(routes, target) {
  28161. if (target === void 0) { target = []; }
  28162. var e_3, _a;
  28163. if (typeof routes === 'string') {
  28164. target.push(routes);
  28165. }
  28166. else if (Array.isArray(routes)) {
  28167. try {
  28168. for (var routes_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
  28169. var route = routes_1_1.value;
  28170. _collectLoadChildren(route, target);
  28171. }
  28172. }
  28173. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  28174. finally {
  28175. try {
  28176. if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
  28177. }
  28178. finally { if (e_3) throw e_3.error; }
  28179. }
  28180. }
  28181. else if (routes.loadChildren) {
  28182. _collectLoadChildren(routes.loadChildren, target);
  28183. }
  28184. else if (routes.children) {
  28185. _collectLoadChildren(routes.children, target);
  28186. }
  28187. return target;
  28188. }
  28189. function parseLazyRoute(route, reflector, module) {
  28190. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(route.split('#'), 2), routePath = _a[0], routeName = _a[1];
  28191. var referencedModule = reflector.resolveExternalReference({
  28192. moduleName: routePath,
  28193. name: routeName,
  28194. }, module ? module.filePath : undefined);
  28195. return { route: route, module: module || referencedModule, referencedModule: referencedModule };
  28196. }
  28197. /**
  28198. * @license
  28199. * Copyright Google Inc. All Rights Reserved.
  28200. *
  28201. * Use of this source code is governed by an MIT-style license that can be
  28202. * found in the LICENSE file at https://angular.io/license
  28203. */
  28204. var TS = /^(?!.*\.d\.ts$).*\.ts$/;
  28205. var ResolvedStaticSymbol = /** @class */ (function () {
  28206. function ResolvedStaticSymbol(symbol, metadata) {
  28207. this.symbol = symbol;
  28208. this.metadata = metadata;
  28209. }
  28210. return ResolvedStaticSymbol;
  28211. }());
  28212. var SUPPORTED_SCHEMA_VERSION = 4;
  28213. /**
  28214. * This class is responsible for loading metadata per symbol,
  28215. * and normalizing references between symbols.
  28216. *
  28217. * Internally, it only uses symbols without members,
  28218. * and deduces the values for symbols with members based
  28219. * on these symbols.
  28220. */
  28221. var StaticSymbolResolver = /** @class */ (function () {
  28222. function StaticSymbolResolver(host, staticSymbolCache, summaryResolver, errorRecorder) {
  28223. this.host = host;
  28224. this.staticSymbolCache = staticSymbolCache;
  28225. this.summaryResolver = summaryResolver;
  28226. this.errorRecorder = errorRecorder;
  28227. this.metadataCache = new Map();
  28228. // Note: this will only contain StaticSymbols without members!
  28229. this.resolvedSymbols = new Map();
  28230. this.resolvedFilePaths = new Set();
  28231. // Note: this will only contain StaticSymbols without members!
  28232. this.importAs = new Map();
  28233. this.symbolResourcePaths = new Map();
  28234. this.symbolFromFile = new Map();
  28235. this.knownFileNameToModuleNames = new Map();
  28236. }
  28237. StaticSymbolResolver.prototype.resolveSymbol = function (staticSymbol) {
  28238. if (staticSymbol.members.length > 0) {
  28239. return this._resolveSymbolMembers(staticSymbol);
  28240. }
  28241. // Note: always ask for a summary first,
  28242. // as we might have read shallow metadata via a .d.ts file
  28243. // for the symbol.
  28244. var resultFromSummary = this._resolveSymbolFromSummary(staticSymbol);
  28245. if (resultFromSummary) {
  28246. return resultFromSummary;
  28247. }
  28248. var resultFromCache = this.resolvedSymbols.get(staticSymbol);
  28249. if (resultFromCache) {
  28250. return resultFromCache;
  28251. }
  28252. // Note: Some users use libraries that were not compiled with ngc, i.e. they don't
  28253. // have summaries, only .d.ts files. So we always need to check both, the summary
  28254. // and metadata.
  28255. this._createSymbolsOf(staticSymbol.filePath);
  28256. return this.resolvedSymbols.get(staticSymbol);
  28257. };
  28258. /**
  28259. * getImportAs produces a symbol that can be used to import the given symbol.
  28260. * The import might be different than the symbol if the symbol is exported from
  28261. * a library with a summary; in which case we want to import the symbol from the
  28262. * ngfactory re-export instead of directly to avoid introducing a direct dependency
  28263. * on an otherwise indirect dependency.
  28264. *
  28265. * @param staticSymbol the symbol for which to generate a import symbol
  28266. */
  28267. StaticSymbolResolver.prototype.getImportAs = function (staticSymbol, useSummaries) {
  28268. if (useSummaries === void 0) { useSummaries = true; }
  28269. if (staticSymbol.members.length) {
  28270. var baseSymbol = this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name);
  28271. var baseImportAs = this.getImportAs(baseSymbol, useSummaries);
  28272. return baseImportAs ?
  28273. this.getStaticSymbol(baseImportAs.filePath, baseImportAs.name, staticSymbol.members) :
  28274. null;
  28275. }
  28276. var summarizedFileName = stripSummaryForJitFileSuffix(staticSymbol.filePath);
  28277. if (summarizedFileName !== staticSymbol.filePath) {
  28278. var summarizedName = stripSummaryForJitNameSuffix(staticSymbol.name);
  28279. var baseSymbol = this.getStaticSymbol(summarizedFileName, summarizedName, staticSymbol.members);
  28280. var baseImportAs = this.getImportAs(baseSymbol, useSummaries);
  28281. return baseImportAs ?
  28282. this.getStaticSymbol(summaryForJitFileName(baseImportAs.filePath), summaryForJitName(baseImportAs.name), baseSymbol.members) :
  28283. null;
  28284. }
  28285. var result = (useSummaries && this.summaryResolver.getImportAs(staticSymbol)) || null;
  28286. if (!result) {
  28287. result = this.importAs.get(staticSymbol);
  28288. }
  28289. return result;
  28290. };
  28291. /**
  28292. * getResourcePath produces the path to the original location of the symbol and should
  28293. * be used to determine the relative location of resource references recorded in
  28294. * symbol metadata.
  28295. */
  28296. StaticSymbolResolver.prototype.getResourcePath = function (staticSymbol) {
  28297. return this.symbolResourcePaths.get(staticSymbol) || staticSymbol.filePath;
  28298. };
  28299. /**
  28300. * getTypeArity returns the number of generic type parameters the given symbol
  28301. * has. If the symbol is not a type the result is null.
  28302. */
  28303. StaticSymbolResolver.prototype.getTypeArity = function (staticSymbol) {
  28304. // If the file is a factory/ngsummary file, don't resolve the symbol as doing so would
  28305. // cause the metadata for an factory/ngsummary file to be loaded which doesn't exist.
  28306. // All references to generated classes must include the correct arity whenever
  28307. // generating code.
  28308. if (isGeneratedFile(staticSymbol.filePath)) {
  28309. return null;
  28310. }
  28311. var resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(staticSymbol));
  28312. while (resolvedSymbol && resolvedSymbol.metadata instanceof StaticSymbol) {
  28313. resolvedSymbol = unwrapResolvedMetadata(this.resolveSymbol(resolvedSymbol.metadata));
  28314. }
  28315. return (resolvedSymbol && resolvedSymbol.metadata && resolvedSymbol.metadata.arity) || null;
  28316. };
  28317. StaticSymbolResolver.prototype.getKnownModuleName = function (filePath) {
  28318. return this.knownFileNameToModuleNames.get(filePath) || null;
  28319. };
  28320. StaticSymbolResolver.prototype.recordImportAs = function (sourceSymbol, targetSymbol) {
  28321. sourceSymbol.assertNoMembers();
  28322. targetSymbol.assertNoMembers();
  28323. this.importAs.set(sourceSymbol, targetSymbol);
  28324. };
  28325. StaticSymbolResolver.prototype.recordModuleNameForFileName = function (fileName, moduleName) {
  28326. this.knownFileNameToModuleNames.set(fileName, moduleName);
  28327. };
  28328. /**
  28329. * Invalidate all information derived from the given file.
  28330. *
  28331. * @param fileName the file to invalidate
  28332. */
  28333. StaticSymbolResolver.prototype.invalidateFile = function (fileName) {
  28334. var e_1, _a;
  28335. this.metadataCache.delete(fileName);
  28336. this.resolvedFilePaths.delete(fileName);
  28337. var symbols = this.symbolFromFile.get(fileName);
  28338. if (symbols) {
  28339. this.symbolFromFile.delete(fileName);
  28340. try {
  28341. for (var symbols_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(symbols), symbols_1_1 = symbols_1.next(); !symbols_1_1.done; symbols_1_1 = symbols_1.next()) {
  28342. var symbol = symbols_1_1.value;
  28343. this.resolvedSymbols.delete(symbol);
  28344. this.importAs.delete(symbol);
  28345. this.symbolResourcePaths.delete(symbol);
  28346. }
  28347. }
  28348. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  28349. finally {
  28350. try {
  28351. if (symbols_1_1 && !symbols_1_1.done && (_a = symbols_1.return)) _a.call(symbols_1);
  28352. }
  28353. finally { if (e_1) throw e_1.error; }
  28354. }
  28355. }
  28356. };
  28357. /** @internal */
  28358. StaticSymbolResolver.prototype.ignoreErrorsFor = function (cb) {
  28359. var recorder = this.errorRecorder;
  28360. this.errorRecorder = function () { };
  28361. try {
  28362. return cb();
  28363. }
  28364. finally {
  28365. this.errorRecorder = recorder;
  28366. }
  28367. };
  28368. StaticSymbolResolver.prototype._resolveSymbolMembers = function (staticSymbol) {
  28369. var members = staticSymbol.members;
  28370. var baseResolvedSymbol = this.resolveSymbol(this.getStaticSymbol(staticSymbol.filePath, staticSymbol.name));
  28371. if (!baseResolvedSymbol) {
  28372. return null;
  28373. }
  28374. var baseMetadata = unwrapResolvedMetadata(baseResolvedSymbol.metadata);
  28375. if (baseMetadata instanceof StaticSymbol) {
  28376. return new ResolvedStaticSymbol(staticSymbol, this.getStaticSymbol(baseMetadata.filePath, baseMetadata.name, members));
  28377. }
  28378. else if (baseMetadata && baseMetadata.__symbolic === 'class') {
  28379. if (baseMetadata.statics && members.length === 1) {
  28380. return new ResolvedStaticSymbol(staticSymbol, baseMetadata.statics[members[0]]);
  28381. }
  28382. }
  28383. else {
  28384. var value = baseMetadata;
  28385. for (var i = 0; i < members.length && value; i++) {
  28386. value = value[members[i]];
  28387. }
  28388. return new ResolvedStaticSymbol(staticSymbol, value);
  28389. }
  28390. return null;
  28391. };
  28392. StaticSymbolResolver.prototype._resolveSymbolFromSummary = function (staticSymbol) {
  28393. var summary = this.summaryResolver.resolveSummary(staticSymbol);
  28394. return summary ? new ResolvedStaticSymbol(staticSymbol, summary.metadata) : null;
  28395. };
  28396. /**
  28397. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  28398. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  28399. *
  28400. * @param declarationFile the absolute path of the file where the symbol is declared
  28401. * @param name the name of the type.
  28402. * @param members a symbol for a static member of the named type
  28403. */
  28404. StaticSymbolResolver.prototype.getStaticSymbol = function (declarationFile, name, members) {
  28405. return this.staticSymbolCache.get(declarationFile, name, members);
  28406. };
  28407. /**
  28408. * hasDecorators checks a file's metadata for the presence of decorators without evaluating the
  28409. * metadata.
  28410. *
  28411. * @param filePath the absolute path to examine for decorators.
  28412. * @returns true if any class in the file has a decorator.
  28413. */
  28414. StaticSymbolResolver.prototype.hasDecorators = function (filePath) {
  28415. var metadata = this.getModuleMetadata(filePath);
  28416. if (metadata['metadata']) {
  28417. return Object.keys(metadata['metadata']).some(function (metadataKey) {
  28418. var entry = metadata['metadata'][metadataKey];
  28419. return entry && entry.__symbolic === 'class' && entry.decorators;
  28420. });
  28421. }
  28422. return false;
  28423. };
  28424. StaticSymbolResolver.prototype.getSymbolsOf = function (filePath) {
  28425. var summarySymbols = this.summaryResolver.getSymbolsOf(filePath);
  28426. if (summarySymbols) {
  28427. return summarySymbols;
  28428. }
  28429. // Note: Some users use libraries that were not compiled with ngc, i.e. they don't
  28430. // have summaries, only .d.ts files, but `summaryResolver.isLibraryFile` returns true.
  28431. this._createSymbolsOf(filePath);
  28432. var metadataSymbols = [];
  28433. this.resolvedSymbols.forEach(function (resolvedSymbol) {
  28434. if (resolvedSymbol.symbol.filePath === filePath) {
  28435. metadataSymbols.push(resolvedSymbol.symbol);
  28436. }
  28437. });
  28438. return metadataSymbols;
  28439. };
  28440. StaticSymbolResolver.prototype._createSymbolsOf = function (filePath) {
  28441. var _this = this;
  28442. var e_2, _a;
  28443. if (this.resolvedFilePaths.has(filePath)) {
  28444. return;
  28445. }
  28446. this.resolvedFilePaths.add(filePath);
  28447. var resolvedSymbols = [];
  28448. var metadata = this.getModuleMetadata(filePath);
  28449. if (metadata['importAs']) {
  28450. // Index bundle indices should use the importAs module name defined
  28451. // in the bundle.
  28452. this.knownFileNameToModuleNames.set(filePath, metadata['importAs']);
  28453. }
  28454. // handle the symbols in one of the re-export location
  28455. if (metadata['exports']) {
  28456. var _loop_1 = function (moduleExport) {
  28457. // handle the symbols in the list of explicitly re-exported symbols.
  28458. if (moduleExport.export) {
  28459. moduleExport.export.forEach(function (exportSymbol) {
  28460. var symbolName;
  28461. if (typeof exportSymbol === 'string') {
  28462. symbolName = exportSymbol;
  28463. }
  28464. else {
  28465. symbolName = exportSymbol.as;
  28466. }
  28467. symbolName = unescapeIdentifier(symbolName);
  28468. var symName = symbolName;
  28469. if (typeof exportSymbol !== 'string') {
  28470. symName = unescapeIdentifier(exportSymbol.name);
  28471. }
  28472. var resolvedModule = _this.resolveModule(moduleExport.from, filePath);
  28473. if (resolvedModule) {
  28474. var targetSymbol = _this.getStaticSymbol(resolvedModule, symName);
  28475. var sourceSymbol = _this.getStaticSymbol(filePath, symbolName);
  28476. resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
  28477. }
  28478. });
  28479. }
  28480. else {
  28481. // handle the symbols via export * directives.
  28482. var resolvedModule = this_1.resolveModule(moduleExport.from, filePath);
  28483. if (resolvedModule) {
  28484. var nestedExports = this_1.getSymbolsOf(resolvedModule);
  28485. nestedExports.forEach(function (targetSymbol) {
  28486. var sourceSymbol = _this.getStaticSymbol(filePath, targetSymbol.name);
  28487. resolvedSymbols.push(_this.createExport(sourceSymbol, targetSymbol));
  28488. });
  28489. }
  28490. }
  28491. };
  28492. var this_1 = this;
  28493. try {
  28494. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(metadata['exports']), _c = _b.next(); !_c.done; _c = _b.next()) {
  28495. var moduleExport = _c.value;
  28496. _loop_1(moduleExport);
  28497. }
  28498. }
  28499. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  28500. finally {
  28501. try {
  28502. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  28503. }
  28504. finally { if (e_2) throw e_2.error; }
  28505. }
  28506. }
  28507. // handle the actual metadata. Has to be after the exports
  28508. // as there might be collisions in the names, and we want the symbols
  28509. // of the current module to win ofter reexports.
  28510. if (metadata['metadata']) {
  28511. // handle direct declarations of the symbol
  28512. var topLevelSymbolNames_1 = new Set(Object.keys(metadata['metadata']).map(unescapeIdentifier));
  28513. var origins_1 = metadata['origins'] || {};
  28514. Object.keys(metadata['metadata']).forEach(function (metadataKey) {
  28515. var symbolMeta = metadata['metadata'][metadataKey];
  28516. var name = unescapeIdentifier(metadataKey);
  28517. var symbol = _this.getStaticSymbol(filePath, name);
  28518. var origin = origins_1.hasOwnProperty(metadataKey) && origins_1[metadataKey];
  28519. if (origin) {
  28520. // If the symbol is from a bundled index, use the declaration location of the
  28521. // symbol so relative references (such as './my.html') will be calculated
  28522. // correctly.
  28523. var originFilePath = _this.resolveModule(origin, filePath);
  28524. if (!originFilePath) {
  28525. _this.reportError(new Error("Couldn't resolve original symbol for " + origin + " from " + filePath));
  28526. }
  28527. else {
  28528. _this.symbolResourcePaths.set(symbol, originFilePath);
  28529. }
  28530. }
  28531. resolvedSymbols.push(_this.createResolvedSymbol(symbol, filePath, topLevelSymbolNames_1, symbolMeta));
  28532. });
  28533. }
  28534. resolvedSymbols.forEach(function (resolvedSymbol) { return _this.resolvedSymbols.set(resolvedSymbol.symbol, resolvedSymbol); });
  28535. this.symbolFromFile.set(filePath, resolvedSymbols.map(function (resolvedSymbol) { return resolvedSymbol.symbol; }));
  28536. };
  28537. StaticSymbolResolver.prototype.createResolvedSymbol = function (sourceSymbol, topLevelPath, topLevelSymbolNames, metadata) {
  28538. var _this = this;
  28539. // For classes that don't have Angular summaries / metadata,
  28540. // we only keep their arity, but nothing else
  28541. // (e.g. their constructor parameters).
  28542. // We do this to prevent introducing deep imports
  28543. // as we didn't generate .ngfactory.ts files with proper reexports.
  28544. var isTsFile = TS.test(sourceSymbol.filePath);
  28545. if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) && !isTsFile && metadata &&
  28546. metadata['__symbolic'] === 'class') {
  28547. var transformedMeta_1 = { __symbolic: 'class', arity: metadata.arity };
  28548. return new ResolvedStaticSymbol(sourceSymbol, transformedMeta_1);
  28549. }
  28550. var _originalFileMemo;
  28551. var getOriginalName = function () {
  28552. if (!_originalFileMemo) {
  28553. // Guess what the original file name is from the reference. If it has a `.d.ts` extension
  28554. // replace it with `.ts`. If it already has `.ts` just leave it in place. If it doesn't have
  28555. // .ts or .d.ts, append `.ts'. Also, if it is in `node_modules`, trim the `node_module`
  28556. // location as it is not important to finding the file.
  28557. _originalFileMemo =
  28558. _this.host.getOutputName(topLevelPath.replace(/((\.ts)|(\.d\.ts)|)$/, '.ts')
  28559. .replace(/^.*node_modules[/\\]/, ''));
  28560. }
  28561. return _originalFileMemo;
  28562. };
  28563. var self = this;
  28564. var ReferenceTransformer = /** @class */ (function (_super) {
  28565. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ReferenceTransformer, _super);
  28566. function ReferenceTransformer() {
  28567. return _super !== null && _super.apply(this, arguments) || this;
  28568. }
  28569. ReferenceTransformer.prototype.visitStringMap = function (map, functionParams) {
  28570. var symbolic = map['__symbolic'];
  28571. if (symbolic === 'function') {
  28572. var oldLen = functionParams.length;
  28573. functionParams.push.apply(functionParams, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])((map['parameters'] || [])));
  28574. var result = _super.prototype.visitStringMap.call(this, map, functionParams);
  28575. functionParams.length = oldLen;
  28576. return result;
  28577. }
  28578. else if (symbolic === 'reference') {
  28579. var module = map['module'];
  28580. var name_1 = map['name'] ? unescapeIdentifier(map['name']) : map['name'];
  28581. if (!name_1) {
  28582. return null;
  28583. }
  28584. var filePath = void 0;
  28585. if (module) {
  28586. filePath = self.resolveModule(module, sourceSymbol.filePath);
  28587. if (!filePath) {
  28588. return {
  28589. __symbolic: 'error',
  28590. message: "Could not resolve " + module + " relative to " + sourceSymbol.filePath + ".",
  28591. line: map.line,
  28592. character: map.character,
  28593. fileName: getOriginalName()
  28594. };
  28595. }
  28596. return {
  28597. __symbolic: 'resolved',
  28598. symbol: self.getStaticSymbol(filePath, name_1),
  28599. line: map.line,
  28600. character: map.character,
  28601. fileName: getOriginalName()
  28602. };
  28603. }
  28604. else if (functionParams.indexOf(name_1) >= 0) {
  28605. // reference to a function parameter
  28606. return { __symbolic: 'reference', name: name_1 };
  28607. }
  28608. else {
  28609. if (topLevelSymbolNames.has(name_1)) {
  28610. return self.getStaticSymbol(topLevelPath, name_1);
  28611. }
  28612. }
  28613. }
  28614. else if (symbolic === 'error') {
  28615. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, map, { fileName: getOriginalName() });
  28616. }
  28617. else {
  28618. return _super.prototype.visitStringMap.call(this, map, functionParams);
  28619. }
  28620. };
  28621. return ReferenceTransformer;
  28622. }(ValueTransformer));
  28623. var transformedMeta = visitValue(metadata, new ReferenceTransformer(), []);
  28624. var unwrappedTransformedMeta = unwrapResolvedMetadata(transformedMeta);
  28625. if (unwrappedTransformedMeta instanceof StaticSymbol) {
  28626. return this.createExport(sourceSymbol, unwrappedTransformedMeta);
  28627. }
  28628. return new ResolvedStaticSymbol(sourceSymbol, transformedMeta);
  28629. };
  28630. StaticSymbolResolver.prototype.createExport = function (sourceSymbol, targetSymbol) {
  28631. sourceSymbol.assertNoMembers();
  28632. targetSymbol.assertNoMembers();
  28633. if (this.summaryResolver.isLibraryFile(sourceSymbol.filePath) &&
  28634. this.summaryResolver.isLibraryFile(targetSymbol.filePath)) {
  28635. // This case is for an ng library importing symbols from a plain ts library
  28636. // transitively.
  28637. // Note: We rely on the fact that we discover symbols in the direction
  28638. // from source files to library files
  28639. this.importAs.set(targetSymbol, this.getImportAs(sourceSymbol) || sourceSymbol);
  28640. }
  28641. return new ResolvedStaticSymbol(sourceSymbol, targetSymbol);
  28642. };
  28643. StaticSymbolResolver.prototype.reportError = function (error$$1, context, path) {
  28644. if (this.errorRecorder) {
  28645. this.errorRecorder(error$$1, (context && context.filePath) || path);
  28646. }
  28647. else {
  28648. throw error$$1;
  28649. }
  28650. };
  28651. /**
  28652. * @param module an absolute path to a module file.
  28653. */
  28654. StaticSymbolResolver.prototype.getModuleMetadata = function (module) {
  28655. var moduleMetadata = this.metadataCache.get(module);
  28656. if (!moduleMetadata) {
  28657. var moduleMetadatas = this.host.getMetadataFor(module);
  28658. if (moduleMetadatas) {
  28659. var maxVersion_1 = -1;
  28660. moduleMetadatas.forEach(function (md) {
  28661. if (md && md['version'] > maxVersion_1) {
  28662. maxVersion_1 = md['version'];
  28663. moduleMetadata = md;
  28664. }
  28665. });
  28666. }
  28667. if (!moduleMetadata) {
  28668. moduleMetadata =
  28669. { __symbolic: 'module', version: SUPPORTED_SCHEMA_VERSION, module: module, metadata: {} };
  28670. }
  28671. if (moduleMetadata['version'] != SUPPORTED_SCHEMA_VERSION) {
  28672. var errorMessage = moduleMetadata['version'] == 2 ?
  28673. "Unsupported metadata version " + moduleMetadata['version'] + " for module " + module + ". This module should be compiled with a newer version of ngc" :
  28674. "Metadata version mismatch for module " + module + ", found version " + moduleMetadata['version'] + ", expected " + SUPPORTED_SCHEMA_VERSION;
  28675. this.reportError(new Error(errorMessage));
  28676. }
  28677. this.metadataCache.set(module, moduleMetadata);
  28678. }
  28679. return moduleMetadata;
  28680. };
  28681. StaticSymbolResolver.prototype.getSymbolByModule = function (module, symbolName, containingFile) {
  28682. var filePath = this.resolveModule(module, containingFile);
  28683. if (!filePath) {
  28684. this.reportError(new Error("Could not resolve module " + module + (containingFile ? ' relative to ' +
  28685. containingFile : '')));
  28686. return this.getStaticSymbol("ERROR:" + module, symbolName);
  28687. }
  28688. return this.getStaticSymbol(filePath, symbolName);
  28689. };
  28690. StaticSymbolResolver.prototype.resolveModule = function (module, containingFile) {
  28691. try {
  28692. return this.host.moduleNameToFileName(module, containingFile);
  28693. }
  28694. catch (e) {
  28695. console.error("Could not resolve module '" + module + "' relative to file " + containingFile);
  28696. this.reportError(e, undefined, containingFile);
  28697. }
  28698. return null;
  28699. };
  28700. return StaticSymbolResolver;
  28701. }());
  28702. // Remove extra underscore from escaped identifier.
  28703. // See https://github.com/Microsoft/TypeScript/blob/master/src/compiler/utilities.ts
  28704. function unescapeIdentifier(identifier) {
  28705. return identifier.startsWith('___') ? identifier.substr(1) : identifier;
  28706. }
  28707. function unwrapResolvedMetadata(metadata) {
  28708. if (metadata && metadata.__symbolic === 'resolved') {
  28709. return metadata.symbol;
  28710. }
  28711. return metadata;
  28712. }
  28713. function serializeSummaries(srcFileName, forJitCtx, summaryResolver, symbolResolver, symbols, types) {
  28714. var toJsonSerializer = new ToJsonSerializer(symbolResolver, summaryResolver, srcFileName);
  28715. // for symbols, we use everything except for the class metadata itself
  28716. // (we keep the statics though), as the class metadata is contained in the
  28717. // CompileTypeSummary.
  28718. symbols.forEach(function (resolvedSymbol) { return toJsonSerializer.addSummary({ symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata }); });
  28719. // Add type summaries.
  28720. types.forEach(function (_a) {
  28721. var summary = _a.summary, metadata = _a.metadata;
  28722. toJsonSerializer.addSummary({ symbol: summary.type.reference, metadata: undefined, type: summary });
  28723. });
  28724. var _a = toJsonSerializer.serialize(), json = _a.json, exportAs = _a.exportAs;
  28725. if (forJitCtx) {
  28726. var forJitSerializer_1 = new ForJitSerializer(forJitCtx, symbolResolver, summaryResolver);
  28727. types.forEach(function (_a) {
  28728. var summary = _a.summary, metadata = _a.metadata;
  28729. forJitSerializer_1.addSourceType(summary, metadata);
  28730. });
  28731. toJsonSerializer.unprocessedSymbolSummariesBySymbol.forEach(function (summary) {
  28732. if (summaryResolver.isLibraryFile(summary.symbol.filePath) && summary.type) {
  28733. forJitSerializer_1.addLibType(summary.type);
  28734. }
  28735. });
  28736. forJitSerializer_1.serialize(exportAs);
  28737. }
  28738. return { json: json, exportAs: exportAs };
  28739. }
  28740. function deserializeSummaries(symbolCache, summaryResolver, libraryFileName, json) {
  28741. var deserializer = new FromJsonDeserializer(symbolCache, summaryResolver);
  28742. return deserializer.deserialize(libraryFileName, json);
  28743. }
  28744. function createForJitStub(outputCtx, reference) {
  28745. return createSummaryForJitFunction(outputCtx, reference, NULL_EXPR);
  28746. }
  28747. function createSummaryForJitFunction(outputCtx, reference, value) {
  28748. var fnName = summaryForJitName(reference.name);
  28749. outputCtx.statements.push(fn([], [new ReturnStatement(value)], new ArrayType(DYNAMIC_TYPE)).toDeclStmt(fnName, [
  28750. StmtModifier.Final, StmtModifier.Exported
  28751. ]));
  28752. }
  28753. var ToJsonSerializer = /** @class */ (function (_super) {
  28754. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ToJsonSerializer, _super);
  28755. function ToJsonSerializer(symbolResolver, summaryResolver, srcFileName) {
  28756. var _this = _super.call(this) || this;
  28757. _this.symbolResolver = symbolResolver;
  28758. _this.summaryResolver = summaryResolver;
  28759. _this.srcFileName = srcFileName;
  28760. // Note: This only contains symbols without members.
  28761. _this.symbols = [];
  28762. _this.indexBySymbol = new Map();
  28763. _this.reexportedBy = new Map();
  28764. // This now contains a `__symbol: number` in the place of
  28765. // StaticSymbols, but otherwise has the same shape as the original objects.
  28766. _this.processedSummaryBySymbol = new Map();
  28767. _this.processedSummaries = [];
  28768. _this.unprocessedSymbolSummariesBySymbol = new Map();
  28769. _this.moduleName = symbolResolver.getKnownModuleName(srcFileName);
  28770. return _this;
  28771. }
  28772. ToJsonSerializer.prototype.addSummary = function (summary) {
  28773. var _this = this;
  28774. var unprocessedSummary = this.unprocessedSymbolSummariesBySymbol.get(summary.symbol);
  28775. var processedSummary = this.processedSummaryBySymbol.get(summary.symbol);
  28776. if (!unprocessedSummary) {
  28777. unprocessedSummary = { symbol: summary.symbol, metadata: undefined };
  28778. this.unprocessedSymbolSummariesBySymbol.set(summary.symbol, unprocessedSummary);
  28779. processedSummary = { symbol: this.processValue(summary.symbol, 0 /* None */) };
  28780. this.processedSummaries.push(processedSummary);
  28781. this.processedSummaryBySymbol.set(summary.symbol, processedSummary);
  28782. }
  28783. if (!unprocessedSummary.metadata && summary.metadata) {
  28784. var metadata_1 = summary.metadata || {};
  28785. if (metadata_1.__symbolic === 'class') {
  28786. // For classes, we keep everything except their class decorators.
  28787. // We need to keep e.g. the ctor args, method names, method decorators
  28788. // so that the class can be extended in another compilation unit.
  28789. // We don't keep the class decorators as
  28790. // 1) they refer to data
  28791. // that should not cause a rebuild of downstream compilation units
  28792. // (e.g. inline templates of @Component, or @NgModule.declarations)
  28793. // 2) their data is already captured in TypeSummaries, e.g. DirectiveSummary.
  28794. var clone_1 = {};
  28795. Object.keys(metadata_1).forEach(function (propName) {
  28796. if (propName !== 'decorators') {
  28797. clone_1[propName] = metadata_1[propName];
  28798. }
  28799. });
  28800. metadata_1 = clone_1;
  28801. }
  28802. else if (isCall(metadata_1)) {
  28803. if (!isFunctionCall(metadata_1) && !isMethodCallOnVariable(metadata_1)) {
  28804. // Don't store complex calls as we won't be able to simplify them anyways later on.
  28805. metadata_1 = {
  28806. __symbolic: 'error',
  28807. message: 'Complex function calls are not supported.',
  28808. };
  28809. }
  28810. }
  28811. // Note: We need to keep storing ctor calls for e.g.
  28812. // `export const x = new InjectionToken(...)`
  28813. unprocessedSummary.metadata = metadata_1;
  28814. processedSummary.metadata = this.processValue(metadata_1, 1 /* ResolveValue */);
  28815. if (metadata_1 instanceof StaticSymbol &&
  28816. this.summaryResolver.isLibraryFile(metadata_1.filePath)) {
  28817. var declarationSymbol = this.symbols[this.indexBySymbol.get(metadata_1)];
  28818. if (!isLoweredSymbol(declarationSymbol.name)) {
  28819. // Note: symbols that were introduced during codegen in the user file can have a reexport
  28820. // if a user used `export *`. However, we can't rely on this as tsickle will change
  28821. // `export *` into named exports, using only the information from the typechecker.
  28822. // As we introduce the new symbols after typecheck, Tsickle does not know about them,
  28823. // and omits them when expanding `export *`.
  28824. // So we have to keep reexporting these symbols manually via .ngfactory files.
  28825. this.reexportedBy.set(declarationSymbol, summary.symbol);
  28826. }
  28827. }
  28828. }
  28829. if (!unprocessedSummary.type && summary.type) {
  28830. unprocessedSummary.type = summary.type;
  28831. // Note: We don't add the summaries of all referenced symbols as for the ResolvedSymbols,
  28832. // as the type summaries already contain the transitive data that they require
  28833. // (in a minimal way).
  28834. processedSummary.type = this.processValue(summary.type, 0 /* None */);
  28835. // except for reexported directives / pipes, so we need to store
  28836. // their summaries explicitly.
  28837. if (summary.type.summaryKind === CompileSummaryKind.NgModule) {
  28838. var ngModuleSummary = summary.type;
  28839. ngModuleSummary.exportedDirectives.concat(ngModuleSummary.exportedPipes).forEach(function (id) {
  28840. var symbol = id.reference;
  28841. if (_this.summaryResolver.isLibraryFile(symbol.filePath) &&
  28842. !_this.unprocessedSymbolSummariesBySymbol.has(symbol)) {
  28843. var summary_1 = _this.summaryResolver.resolveSummary(symbol);
  28844. if (summary_1) {
  28845. _this.addSummary(summary_1);
  28846. }
  28847. }
  28848. });
  28849. }
  28850. }
  28851. };
  28852. ToJsonSerializer.prototype.serialize = function () {
  28853. var _this = this;
  28854. var exportAs = [];
  28855. var json = JSON.stringify({
  28856. moduleName: this.moduleName,
  28857. summaries: this.processedSummaries,
  28858. symbols: this.symbols.map(function (symbol, index) {
  28859. symbol.assertNoMembers();
  28860. var importAs = undefined;
  28861. if (_this.summaryResolver.isLibraryFile(symbol.filePath)) {
  28862. var reexportSymbol = _this.reexportedBy.get(symbol);
  28863. if (reexportSymbol) {
  28864. importAs = _this.indexBySymbol.get(reexportSymbol);
  28865. }
  28866. else {
  28867. var summary = _this.unprocessedSymbolSummariesBySymbol.get(symbol);
  28868. if (!summary || !summary.metadata || summary.metadata.__symbolic !== 'interface') {
  28869. importAs = symbol.name + "_" + index;
  28870. exportAs.push({ symbol: symbol, exportAs: importAs });
  28871. }
  28872. }
  28873. }
  28874. return {
  28875. __symbol: index,
  28876. name: symbol.name,
  28877. filePath: _this.summaryResolver.toSummaryFileName(symbol.filePath, _this.srcFileName),
  28878. importAs: importAs
  28879. };
  28880. })
  28881. });
  28882. return { json: json, exportAs: exportAs };
  28883. };
  28884. ToJsonSerializer.prototype.processValue = function (value, flags) {
  28885. return visitValue(value, this, flags);
  28886. };
  28887. ToJsonSerializer.prototype.visitOther = function (value, context) {
  28888. if (value instanceof StaticSymbol) {
  28889. var baseSymbol = this.symbolResolver.getStaticSymbol(value.filePath, value.name);
  28890. var index = this.visitStaticSymbol(baseSymbol, context);
  28891. return { __symbol: index, members: value.members };
  28892. }
  28893. };
  28894. /**
  28895. * Strip line and character numbers from ngsummaries.
  28896. * Emitting them causes white spaces changes to retrigger upstream
  28897. * recompilations in bazel.
  28898. * TODO: find out a way to have line and character numbers in errors without
  28899. * excessive recompilation in bazel.
  28900. */
  28901. ToJsonSerializer.prototype.visitStringMap = function (map, context) {
  28902. if (map['__symbolic'] === 'resolved') {
  28903. return visitValue(map.symbol, this, context);
  28904. }
  28905. if (map['__symbolic'] === 'error') {
  28906. delete map['line'];
  28907. delete map['character'];
  28908. }
  28909. return _super.prototype.visitStringMap.call(this, map, context);
  28910. };
  28911. /**
  28912. * Returns null if the options.resolveValue is true, and the summary for the symbol
  28913. * resolved to a type or could not be resolved.
  28914. */
  28915. ToJsonSerializer.prototype.visitStaticSymbol = function (baseSymbol, flags) {
  28916. var index = this.indexBySymbol.get(baseSymbol);
  28917. var summary = null;
  28918. if (flags & 1 /* ResolveValue */ &&
  28919. this.summaryResolver.isLibraryFile(baseSymbol.filePath)) {
  28920. if (this.unprocessedSymbolSummariesBySymbol.has(baseSymbol)) {
  28921. // the summary for this symbol was already added
  28922. // -> nothing to do.
  28923. return index;
  28924. }
  28925. summary = this.loadSummary(baseSymbol);
  28926. if (summary && summary.metadata instanceof StaticSymbol) {
  28927. // The summary is a reexport
  28928. index = this.visitStaticSymbol(summary.metadata, flags);
  28929. // reset the summary as it is just a reexport, so we don't want to store it.
  28930. summary = null;
  28931. }
  28932. }
  28933. else if (index != null) {
  28934. // Note: == on purpose to compare with undefined!
  28935. // No summary and the symbol is already added -> nothing to do.
  28936. return index;
  28937. }
  28938. // Note: == on purpose to compare with undefined!
  28939. if (index == null) {
  28940. index = this.symbols.length;
  28941. this.symbols.push(baseSymbol);
  28942. }
  28943. this.indexBySymbol.set(baseSymbol, index);
  28944. if (summary) {
  28945. this.addSummary(summary);
  28946. }
  28947. return index;
  28948. };
  28949. ToJsonSerializer.prototype.loadSummary = function (symbol) {
  28950. var summary = this.summaryResolver.resolveSummary(symbol);
  28951. if (!summary) {
  28952. // some symbols might originate from a plain typescript library
  28953. // that just exported .d.ts and .metadata.json files, i.e. where no summary
  28954. // files were created.
  28955. var resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
  28956. if (resolvedSymbol) {
  28957. summary = { symbol: resolvedSymbol.symbol, metadata: resolvedSymbol.metadata };
  28958. }
  28959. }
  28960. return summary;
  28961. };
  28962. return ToJsonSerializer;
  28963. }(ValueTransformer));
  28964. var ForJitSerializer = /** @class */ (function () {
  28965. function ForJitSerializer(outputCtx, symbolResolver, summaryResolver) {
  28966. this.outputCtx = outputCtx;
  28967. this.symbolResolver = symbolResolver;
  28968. this.summaryResolver = summaryResolver;
  28969. this.data = [];
  28970. }
  28971. ForJitSerializer.prototype.addSourceType = function (summary, metadata) {
  28972. this.data.push({ summary: summary, metadata: metadata, isLibrary: false });
  28973. };
  28974. ForJitSerializer.prototype.addLibType = function (summary) {
  28975. this.data.push({ summary: summary, metadata: null, isLibrary: true });
  28976. };
  28977. ForJitSerializer.prototype.serialize = function (exportAsArr) {
  28978. var _this = this;
  28979. var e_1, _a, e_2, _b, e_3, _c;
  28980. var exportAsBySymbol = new Map();
  28981. try {
  28982. for (var exportAsArr_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(exportAsArr), exportAsArr_1_1 = exportAsArr_1.next(); !exportAsArr_1_1.done; exportAsArr_1_1 = exportAsArr_1.next()) {
  28983. var _d = exportAsArr_1_1.value, symbol = _d.symbol, exportAs = _d.exportAs;
  28984. exportAsBySymbol.set(symbol, exportAs);
  28985. }
  28986. }
  28987. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  28988. finally {
  28989. try {
  28990. if (exportAsArr_1_1 && !exportAsArr_1_1.done && (_a = exportAsArr_1.return)) _a.call(exportAsArr_1);
  28991. }
  28992. finally { if (e_1) throw e_1.error; }
  28993. }
  28994. var ngModuleSymbols = new Set();
  28995. try {
  28996. for (var _e = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(this.data), _f = _e.next(); !_f.done; _f = _e.next()) {
  28997. var _g = _f.value, summary = _g.summary, metadata = _g.metadata, isLibrary = _g.isLibrary;
  28998. if (summary.summaryKind === CompileSummaryKind.NgModule) {
  28999. // collect the symbols that refer to NgModule classes.
  29000. // Note: we can't just rely on `summary.type.summaryKind` to determine this as
  29001. // we don't add the summaries of all referenced symbols when we serialize type summaries.
  29002. // See serializeSummaries for details.
  29003. ngModuleSymbols.add(summary.type.reference);
  29004. var modSummary = summary;
  29005. try {
  29006. for (var _h = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(modSummary.modules), _j = _h.next(); !_j.done; _j = _h.next()) {
  29007. var mod = _j.value;
  29008. ngModuleSymbols.add(mod.reference);
  29009. }
  29010. }
  29011. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  29012. finally {
  29013. try {
  29014. if (_j && !_j.done && (_c = _h.return)) _c.call(_h);
  29015. }
  29016. finally { if (e_3) throw e_3.error; }
  29017. }
  29018. }
  29019. if (!isLibrary) {
  29020. var fnName = summaryForJitName(summary.type.reference.name);
  29021. createSummaryForJitFunction(this.outputCtx, summary.type.reference, this.serializeSummaryWithDeps(summary, metadata));
  29022. }
  29023. }
  29024. }
  29025. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  29026. finally {
  29027. try {
  29028. if (_f && !_f.done && (_b = _e.return)) _b.call(_e);
  29029. }
  29030. finally { if (e_2) throw e_2.error; }
  29031. }
  29032. ngModuleSymbols.forEach(function (ngModuleSymbol) {
  29033. if (_this.summaryResolver.isLibraryFile(ngModuleSymbol.filePath)) {
  29034. var exportAs = exportAsBySymbol.get(ngModuleSymbol) || ngModuleSymbol.name;
  29035. var jitExportAsName = summaryForJitName(exportAs);
  29036. _this.outputCtx.statements.push(variable(jitExportAsName)
  29037. .set(_this.serializeSummaryRef(ngModuleSymbol))
  29038. .toDeclStmt(null, [StmtModifier.Exported]));
  29039. }
  29040. });
  29041. };
  29042. ForJitSerializer.prototype.serializeSummaryWithDeps = function (summary, metadata) {
  29043. var _this = this;
  29044. var expressions = [this.serializeSummary(summary)];
  29045. var providers = [];
  29046. if (metadata instanceof CompileNgModuleMetadata) {
  29047. expressions.push.apply(expressions, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(
  29048. // For directives / pipes, we only add the declared ones,
  29049. // and rely on transitively importing NgModules to get the transitive
  29050. // summaries.
  29051. metadata.declaredDirectives.concat(metadata.declaredPipes)
  29052. .map(function (type) { return type.reference; })
  29053. // For modules,
  29054. // we also add the summaries for modules
  29055. // from libraries.
  29056. // This is ok as we produce reexports for all transitive modules.
  29057. .concat(metadata.transitiveModule.modules.map(function (type) { return type.reference; })
  29058. .filter(function (ref) { return ref !== metadata.type.reference; }))
  29059. .map(function (ref) { return _this.serializeSummaryRef(ref); })));
  29060. // Note: We don't use `NgModuleSummary.providers`, as that one is transitive,
  29061. // and we already have transitive modules.
  29062. providers = metadata.providers;
  29063. }
  29064. else if (summary.summaryKind === CompileSummaryKind.Directive) {
  29065. var dirSummary = summary;
  29066. providers = dirSummary.providers.concat(dirSummary.viewProviders);
  29067. }
  29068. // Note: We can't just refer to the `ngsummary.ts` files for `useClass` providers (as we do for
  29069. // declaredDirectives / declaredPipes), as we allow
  29070. // providers without ctor arguments to skip the `@Injectable` decorator,
  29071. // i.e. we didn't generate .ngsummary.ts files for these.
  29072. expressions.push.apply(expressions, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(providers.filter(function (provider) { return !!provider.useClass; }).map(function (provider) { return _this.serializeSummary({
  29073. summaryKind: CompileSummaryKind.Injectable, type: provider.useClass
  29074. }); })));
  29075. return literalArr(expressions);
  29076. };
  29077. ForJitSerializer.prototype.serializeSummaryRef = function (typeSymbol) {
  29078. var jitImportedSymbol = this.symbolResolver.getStaticSymbol(summaryForJitFileName(typeSymbol.filePath), summaryForJitName(typeSymbol.name));
  29079. return this.outputCtx.importExpr(jitImportedSymbol);
  29080. };
  29081. ForJitSerializer.prototype.serializeSummary = function (data) {
  29082. var outputCtx = this.outputCtx;
  29083. var Transformer = /** @class */ (function () {
  29084. function Transformer() {
  29085. }
  29086. Transformer.prototype.visitArray = function (arr, context) {
  29087. var _this = this;
  29088. return literalArr(arr.map(function (entry) { return visitValue(entry, _this, context); }));
  29089. };
  29090. Transformer.prototype.visitStringMap = function (map, context) {
  29091. var _this = this;
  29092. return new LiteralMapExpr(Object.keys(map).map(function (key) { return new LiteralMapEntry(key, visitValue(map[key], _this, context), false); }));
  29093. };
  29094. Transformer.prototype.visitPrimitive = function (value, context) { return literal(value); };
  29095. Transformer.prototype.visitOther = function (value, context) {
  29096. if (value instanceof StaticSymbol) {
  29097. return outputCtx.importExpr(value);
  29098. }
  29099. else {
  29100. throw new Error("Illegal State: Encountered value " + value);
  29101. }
  29102. };
  29103. return Transformer;
  29104. }());
  29105. return visitValue(data, new Transformer(), null);
  29106. };
  29107. return ForJitSerializer;
  29108. }());
  29109. var FromJsonDeserializer = /** @class */ (function (_super) {
  29110. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FromJsonDeserializer, _super);
  29111. function FromJsonDeserializer(symbolCache, summaryResolver) {
  29112. var _this = _super.call(this) || this;
  29113. _this.symbolCache = symbolCache;
  29114. _this.summaryResolver = summaryResolver;
  29115. return _this;
  29116. }
  29117. FromJsonDeserializer.prototype.deserialize = function (libraryFileName, json) {
  29118. var _this = this;
  29119. var data = JSON.parse(json);
  29120. var allImportAs = [];
  29121. this.symbols = data.symbols.map(function (serializedSymbol) { return _this.symbolCache.get(_this.summaryResolver.fromSummaryFileName(serializedSymbol.filePath, libraryFileName), serializedSymbol.name); });
  29122. data.symbols.forEach(function (serializedSymbol, index) {
  29123. var symbol = _this.symbols[index];
  29124. var importAs = serializedSymbol.importAs;
  29125. if (typeof importAs === 'number') {
  29126. allImportAs.push({ symbol: symbol, importAs: _this.symbols[importAs] });
  29127. }
  29128. else if (typeof importAs === 'string') {
  29129. allImportAs.push({ symbol: symbol, importAs: _this.symbolCache.get(ngfactoryFilePath(libraryFileName), importAs) });
  29130. }
  29131. });
  29132. var summaries = visitValue(data.summaries, this, null);
  29133. return { moduleName: data.moduleName, summaries: summaries, importAs: allImportAs };
  29134. };
  29135. FromJsonDeserializer.prototype.visitStringMap = function (map, context) {
  29136. if ('__symbol' in map) {
  29137. var baseSymbol = this.symbols[map['__symbol']];
  29138. var members = map['members'];
  29139. return members.length ? this.symbolCache.get(baseSymbol.filePath, baseSymbol.name, members) :
  29140. baseSymbol;
  29141. }
  29142. else {
  29143. return _super.prototype.visitStringMap.call(this, map, context);
  29144. }
  29145. };
  29146. return FromJsonDeserializer;
  29147. }(ValueTransformer));
  29148. function isCall(metadata) {
  29149. return metadata && metadata.__symbolic === 'call';
  29150. }
  29151. function isFunctionCall(metadata) {
  29152. return isCall(metadata) && unwrapResolvedMetadata(metadata.expression) instanceof StaticSymbol;
  29153. }
  29154. function isMethodCallOnVariable(metadata) {
  29155. return isCall(metadata) && metadata.expression && metadata.expression.__symbolic === 'select' &&
  29156. unwrapResolvedMetadata(metadata.expression.expression) instanceof StaticSymbol;
  29157. }
  29158. /**
  29159. * @license
  29160. * Copyright Google Inc. All Rights Reserved.
  29161. *
  29162. * Use of this source code is governed by an MIT-style license that can be
  29163. * found in the LICENSE file at https://angular.io/license
  29164. */
  29165. var AotCompiler = /** @class */ (function () {
  29166. function AotCompiler(_config, _options, _host, reflector, _metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _typeCheckCompiler, _ngModuleCompiler, _injectableCompiler, _outputEmitter, _summaryResolver, _symbolResolver) {
  29167. this._config = _config;
  29168. this._options = _options;
  29169. this._host = _host;
  29170. this.reflector = reflector;
  29171. this._metadataResolver = _metadataResolver;
  29172. this._templateParser = _templateParser;
  29173. this._styleCompiler = _styleCompiler;
  29174. this._viewCompiler = _viewCompiler;
  29175. this._typeCheckCompiler = _typeCheckCompiler;
  29176. this._ngModuleCompiler = _ngModuleCompiler;
  29177. this._injectableCompiler = _injectableCompiler;
  29178. this._outputEmitter = _outputEmitter;
  29179. this._summaryResolver = _summaryResolver;
  29180. this._symbolResolver = _symbolResolver;
  29181. this._templateAstCache = new Map();
  29182. this._analyzedFiles = new Map();
  29183. this._analyzedFilesForInjectables = new Map();
  29184. }
  29185. AotCompiler.prototype.clearCache = function () { this._metadataResolver.clearCache(); };
  29186. AotCompiler.prototype.analyzeModulesSync = function (rootFiles) {
  29187. var _this = this;
  29188. var analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
  29189. analyzeResult.ngModules.forEach(function (ngModule) { return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true); });
  29190. return analyzeResult;
  29191. };
  29192. AotCompiler.prototype.analyzeModulesAsync = function (rootFiles) {
  29193. var _this = this;
  29194. var analyzeResult = analyzeAndValidateNgModules(rootFiles, this._host, this._symbolResolver, this._metadataResolver);
  29195. return Promise
  29196. .all(analyzeResult.ngModules.map(function (ngModule) { return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false); }))
  29197. .then(function () { return analyzeResult; });
  29198. };
  29199. AotCompiler.prototype._analyzeFile = function (fileName) {
  29200. var analyzedFile = this._analyzedFiles.get(fileName);
  29201. if (!analyzedFile) {
  29202. analyzedFile =
  29203. analyzeFile(this._host, this._symbolResolver, this._metadataResolver, fileName);
  29204. this._analyzedFiles.set(fileName, analyzedFile);
  29205. }
  29206. return analyzedFile;
  29207. };
  29208. AotCompiler.prototype._analyzeFileForInjectables = function (fileName) {
  29209. var analyzedFile = this._analyzedFilesForInjectables.get(fileName);
  29210. if (!analyzedFile) {
  29211. analyzedFile = analyzeFileForInjectables(this._host, this._symbolResolver, this._metadataResolver, fileName);
  29212. this._analyzedFilesForInjectables.set(fileName, analyzedFile);
  29213. }
  29214. return analyzedFile;
  29215. };
  29216. AotCompiler.prototype.findGeneratedFileNames = function (fileName) {
  29217. var _this = this;
  29218. var genFileNames = [];
  29219. var file = this._analyzeFile(fileName);
  29220. // Make sure we create a .ngfactory if we have a injectable/directive/pipe/NgModule
  29221. // or a reference to a non source file.
  29222. // Note: This is overestimating the required .ngfactory files as the real calculation is harder.
  29223. // Only do this for StubEmitFlags.Basic, as adding a type check block
  29224. // does not change this file (as we generate type check blocks based on NgModules).
  29225. if (this._options.allowEmptyCodegenFiles || file.directives.length || file.pipes.length ||
  29226. file.injectables.length || file.ngModules.length || file.exportsNonSourceFiles) {
  29227. genFileNames.push(ngfactoryFilePath(file.fileName, true));
  29228. if (this._options.enableSummariesForJit) {
  29229. genFileNames.push(summaryForJitFileName(file.fileName, true));
  29230. }
  29231. }
  29232. var fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(file.fileName, true)[1]);
  29233. file.directives.forEach(function (dirSymbol) {
  29234. var compMeta = _this._metadataResolver.getNonNormalizedDirectiveMetadata(dirSymbol).metadata;
  29235. if (!compMeta.isComponent) {
  29236. return;
  29237. }
  29238. // Note: compMeta is a component and therefore template is non null.
  29239. compMeta.template.styleUrls.forEach(function (styleUrl) {
  29240. var normalizedUrl = _this._host.resourceNameToFileName(styleUrl, file.fileName);
  29241. if (!normalizedUrl) {
  29242. throw syntaxError("Couldn't resolve resource " + styleUrl + " relative to " + file.fileName);
  29243. }
  29244. var needsShim = (compMeta.template.encapsulation ||
  29245. _this._config.defaultEncapsulation) === ViewEncapsulation.Emulated;
  29246. genFileNames.push(_stylesModuleUrl(normalizedUrl, needsShim, fileSuffix));
  29247. if (_this._options.allowEmptyCodegenFiles) {
  29248. genFileNames.push(_stylesModuleUrl(normalizedUrl, !needsShim, fileSuffix));
  29249. }
  29250. });
  29251. });
  29252. return genFileNames;
  29253. };
  29254. AotCompiler.prototype.emitBasicStub = function (genFileName, originalFileName) {
  29255. var outputCtx = this._createOutputContext(genFileName);
  29256. if (genFileName.endsWith('.ngfactory.ts')) {
  29257. if (!originalFileName) {
  29258. throw new Error("Assertion error: require the original file for .ngfactory.ts stubs. File: " + genFileName);
  29259. }
  29260. var originalFile = this._analyzeFile(originalFileName);
  29261. this._createNgFactoryStub(outputCtx, originalFile, 1 /* Basic */);
  29262. }
  29263. else if (genFileName.endsWith('.ngsummary.ts')) {
  29264. if (this._options.enableSummariesForJit) {
  29265. if (!originalFileName) {
  29266. throw new Error("Assertion error: require the original file for .ngsummary.ts stubs. File: " + genFileName);
  29267. }
  29268. var originalFile = this._analyzeFile(originalFileName);
  29269. _createEmptyStub(outputCtx);
  29270. originalFile.ngModules.forEach(function (ngModule) {
  29271. // create exports that user code can reference
  29272. createForJitStub(outputCtx, ngModule.type.reference);
  29273. });
  29274. }
  29275. }
  29276. else if (genFileName.endsWith('.ngstyle.ts')) {
  29277. _createEmptyStub(outputCtx);
  29278. }
  29279. // Note: for the stubs, we don't need a property srcFileUrl,
  29280. // as later on in emitAllImpls we will create the proper GeneratedFiles with the
  29281. // correct srcFileUrl.
  29282. // This is good as e.g. for .ngstyle.ts files we can't derive
  29283. // the url of components based on the genFileUrl.
  29284. return this._codegenSourceModule('unknown', outputCtx);
  29285. };
  29286. AotCompiler.prototype.emitTypeCheckStub = function (genFileName, originalFileName) {
  29287. var originalFile = this._analyzeFile(originalFileName);
  29288. var outputCtx = this._createOutputContext(genFileName);
  29289. if (genFileName.endsWith('.ngfactory.ts')) {
  29290. this._createNgFactoryStub(outputCtx, originalFile, 2 /* TypeCheck */);
  29291. }
  29292. return outputCtx.statements.length > 0 ?
  29293. this._codegenSourceModule(originalFile.fileName, outputCtx) :
  29294. null;
  29295. };
  29296. AotCompiler.prototype.loadFilesAsync = function (fileNames, tsFiles) {
  29297. var _this = this;
  29298. var files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
  29299. var loadingPromises = [];
  29300. files.forEach(function (file) { return file.ngModules.forEach(function (ngModule) {
  29301. return loadingPromises.push(_this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false));
  29302. }); });
  29303. var analyzedInjectables = tsFiles.map(function (tsFile) { return _this._analyzeFileForInjectables(tsFile); });
  29304. return Promise.all(loadingPromises).then(function (_) { return ({
  29305. analyzedModules: mergeAndValidateNgFiles(files),
  29306. analyzedInjectables: analyzedInjectables,
  29307. }); });
  29308. };
  29309. AotCompiler.prototype.loadFilesSync = function (fileNames, tsFiles) {
  29310. var _this = this;
  29311. var files = fileNames.map(function (fileName) { return _this._analyzeFile(fileName); });
  29312. files.forEach(function (file) { return file.ngModules.forEach(function (ngModule) { return _this._metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, true); }); });
  29313. var analyzedInjectables = tsFiles.map(function (tsFile) { return _this._analyzeFileForInjectables(tsFile); });
  29314. return {
  29315. analyzedModules: mergeAndValidateNgFiles(files),
  29316. analyzedInjectables: analyzedInjectables,
  29317. };
  29318. };
  29319. AotCompiler.prototype._createNgFactoryStub = function (outputCtx, file, emitFlags) {
  29320. var _this = this;
  29321. var componentId = 0;
  29322. file.ngModules.forEach(function (ngModuleMeta, ngModuleIndex) {
  29323. // Note: the code below needs to executed for StubEmitFlags.Basic and StubEmitFlags.TypeCheck,
  29324. // so we don't change the .ngfactory file too much when adding the type-check block.
  29325. // create exports that user code can reference
  29326. _this._ngModuleCompiler.createStub(outputCtx, ngModuleMeta.type.reference);
  29327. // add references to the symbols from the metadata.
  29328. // These can be used by the type check block for components,
  29329. // and they also cause TypeScript to include these files into the program too,
  29330. // which will make them part of the analyzedFiles.
  29331. var externalReferences = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(ngModuleMeta.transitiveModule.directives.map(function (d) { return d.reference; }), ngModuleMeta.transitiveModule.pipes.map(function (d) { return d.reference; }), ngModuleMeta.importedModules.map(function (m) { return m.type.reference; }), ngModuleMeta.exportedModules.map(function (m) { return m.type.reference; }), _this._externalIdentifierReferences([Identifiers.TemplateRef, Identifiers.ElementRef]));
  29332. var externalReferenceVars = new Map();
  29333. externalReferences.forEach(function (ref, typeIndex) {
  29334. externalReferenceVars.set(ref, "_decl" + ngModuleIndex + "_" + typeIndex);
  29335. });
  29336. externalReferenceVars.forEach(function (varName, reference) {
  29337. outputCtx.statements.push(variable(varName)
  29338. .set(NULL_EXPR.cast(DYNAMIC_TYPE))
  29339. .toDeclStmt(expressionType(outputCtx.importExpr(reference, /* typeParams */ null, /* useSummaries */ false))));
  29340. });
  29341. if (emitFlags & 2 /* TypeCheck */) {
  29342. // add the type-check block for all components of the NgModule
  29343. ngModuleMeta.declaredDirectives.forEach(function (dirId) {
  29344. var compMeta = _this._metadataResolver.getDirectiveMetadata(dirId.reference);
  29345. if (!compMeta.isComponent) {
  29346. return;
  29347. }
  29348. componentId++;
  29349. _this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_Host_" + componentId, ngModuleMeta, _this._metadataResolver.getHostComponentMetadata(compMeta), [compMeta.type], externalReferenceVars);
  29350. _this._createTypeCheckBlock(outputCtx, compMeta.type.reference.name + "_" + componentId, ngModuleMeta, compMeta, ngModuleMeta.transitiveModule.directives, externalReferenceVars);
  29351. });
  29352. }
  29353. });
  29354. if (outputCtx.statements.length === 0) {
  29355. _createEmptyStub(outputCtx);
  29356. }
  29357. };
  29358. AotCompiler.prototype._externalIdentifierReferences = function (references) {
  29359. var e_1, _a;
  29360. var result = [];
  29361. try {
  29362. for (var references_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(references), references_1_1 = references_1.next(); !references_1_1.done; references_1_1 = references_1.next()) {
  29363. var reference = references_1_1.value;
  29364. var token = createTokenForExternalReference(this.reflector, reference);
  29365. if (token.identifier) {
  29366. result.push(token.identifier.reference);
  29367. }
  29368. }
  29369. }
  29370. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  29371. finally {
  29372. try {
  29373. if (references_1_1 && !references_1_1.done && (_a = references_1.return)) _a.call(references_1);
  29374. }
  29375. finally { if (e_1) throw e_1.error; }
  29376. }
  29377. return result;
  29378. };
  29379. AotCompiler.prototype._createTypeCheckBlock = function (ctx, componentId, moduleMeta, compMeta, directives, externalReferenceVars) {
  29380. var _a;
  29381. var _b = this._parseTemplate(compMeta, moduleMeta, directives), parsedTemplate = _b.template, usedPipes = _b.pipes;
  29382. (_a = ctx.statements).push.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(this._typeCheckCompiler.compileComponent(componentId, compMeta, parsedTemplate, usedPipes, externalReferenceVars, ctx)));
  29383. };
  29384. AotCompiler.prototype.emitMessageBundle = function (analyzeResult, locale) {
  29385. var _this = this;
  29386. var errors = [];
  29387. var htmlParser = new HtmlParser();
  29388. // TODO(vicb): implicit tags & attributes
  29389. var messageBundle = new MessageBundle(htmlParser, [], {}, locale);
  29390. analyzeResult.files.forEach(function (file) {
  29391. var compMetas = [];
  29392. file.directives.forEach(function (directiveType) {
  29393. var dirMeta = _this._metadataResolver.getDirectiveMetadata(directiveType);
  29394. if (dirMeta && dirMeta.isComponent) {
  29395. compMetas.push(dirMeta);
  29396. }
  29397. });
  29398. compMetas.forEach(function (compMeta) {
  29399. var html = compMeta.template.template;
  29400. // Template URL points to either an HTML or TS file depending on whether
  29401. // the file is used with `templateUrl:` or `template:`, respectively.
  29402. var templateUrl = compMeta.template.templateUrl;
  29403. var interpolationConfig = InterpolationConfig.fromArray(compMeta.template.interpolation);
  29404. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(messageBundle.updateFromTemplate(html, templateUrl, interpolationConfig)));
  29405. });
  29406. });
  29407. if (errors.length) {
  29408. throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
  29409. }
  29410. return messageBundle;
  29411. };
  29412. AotCompiler.prototype.emitAllPartialModules = function (_a, r3Files) {
  29413. var _this = this;
  29414. var ngModuleByPipeOrDirective = _a.ngModuleByPipeOrDirective, files = _a.files;
  29415. var contextMap = new Map();
  29416. var getContext = function (fileName) {
  29417. if (!contextMap.has(fileName)) {
  29418. contextMap.set(fileName, _this._createOutputContext(fileName));
  29419. }
  29420. return contextMap.get(fileName);
  29421. };
  29422. files.forEach(function (file) { return _this._compilePartialModule(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables, getContext(file.fileName)); });
  29423. r3Files.forEach(function (file) { return _this._compileShallowModules(file.fileName, file.shallowModules, getContext(file.fileName)); });
  29424. return Array.from(contextMap.values())
  29425. .map(function (context) { return ({
  29426. fileName: context.genFilePath,
  29427. statements: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(context.constantPool.statements, context.statements),
  29428. }); });
  29429. };
  29430. AotCompiler.prototype._compileShallowModules = function (fileName, shallowModules, context) {
  29431. var _this = this;
  29432. shallowModules.forEach(function (module) { return compileNgModuleFromRender2(context, module, _this._injectableCompiler); });
  29433. };
  29434. AotCompiler.prototype._compilePartialModule = function (fileName, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables, context) {
  29435. var _this = this;
  29436. var errors = [];
  29437. var schemaRegistry = new DomElementSchemaRegistry();
  29438. var hostBindingParser = new BindingParser(this._templateParser.expressionParser, DEFAULT_INTERPOLATION_CONFIG, schemaRegistry, [], errors);
  29439. // Process all components and directives
  29440. directives.forEach(function (directiveType) {
  29441. var directiveMetadata = _this._metadataResolver.getDirectiveMetadata(directiveType);
  29442. if (directiveMetadata.isComponent) {
  29443. var module = ngModuleByPipeOrDirective.get(directiveType);
  29444. module ||
  29445. error("Cannot determine the module for component '" + identifierName(directiveMetadata.type) + "'");
  29446. var htmlAst = directiveMetadata.template.htmlAst;
  29447. var preserveWhitespaces = directiveMetadata.template.preserveWhitespaces;
  29448. if (!preserveWhitespaces) {
  29449. htmlAst = removeWhitespaces(htmlAst);
  29450. }
  29451. var render3Ast = htmlAstToRender3Ast(htmlAst.rootNodes, hostBindingParser);
  29452. // Map of StaticType by directive selectors
  29453. var directiveTypeBySel_1 = new Map();
  29454. var directives_1 = module.transitiveModule.directives.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
  29455. directives_1.forEach(function (directive) {
  29456. if (directive.selector) {
  29457. directiveTypeBySel_1.set(directive.selector, directive.type.reference);
  29458. }
  29459. });
  29460. // Map of StaticType by pipe names
  29461. var pipeTypeByName_1 = new Map();
  29462. var pipes_1 = module.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  29463. pipes_1.forEach(function (pipe) { pipeTypeByName_1.set(pipe.name, pipe.type.reference); });
  29464. compileComponentFromRender2(context, directiveMetadata, render3Ast, _this.reflector, hostBindingParser, directiveTypeBySel_1, pipeTypeByName_1);
  29465. }
  29466. else {
  29467. compileDirectiveFromRender2(context, directiveMetadata, _this.reflector, hostBindingParser);
  29468. }
  29469. });
  29470. pipes.forEach(function (pipeType) {
  29471. var pipeMetadata = _this._metadataResolver.getPipeMetadata(pipeType);
  29472. if (pipeMetadata) {
  29473. compilePipeFromRender2(context, pipeMetadata, _this.reflector);
  29474. }
  29475. });
  29476. injectables.forEach(function (injectable) { return _this._injectableCompiler.compile(injectable, context); });
  29477. };
  29478. AotCompiler.prototype.emitAllPartialModules2 = function (files) {
  29479. var _this = this;
  29480. // Using reduce like this is a select many pattern (where map is a select pattern)
  29481. return files.reduce(function (r, file) {
  29482. r.push.apply(r, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(_this._emitPartialModule2(file.fileName, file.injectables)));
  29483. return r;
  29484. }, []);
  29485. };
  29486. AotCompiler.prototype._emitPartialModule2 = function (fileName, injectables) {
  29487. var _this = this;
  29488. var context = this._createOutputContext(fileName);
  29489. injectables.forEach(function (injectable) { return _this._injectableCompiler.compile(injectable, context); });
  29490. if (context.statements && context.statements.length > 0) {
  29491. return [{ fileName: fileName, statements: Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(context.constantPool.statements, context.statements) }];
  29492. }
  29493. return [];
  29494. };
  29495. AotCompiler.prototype.emitAllImpls = function (analyzeResult) {
  29496. var _this = this;
  29497. var ngModuleByPipeOrDirective = analyzeResult.ngModuleByPipeOrDirective, files = analyzeResult.files;
  29498. var sourceModules = files.map(function (file) { return _this._compileImplFile(file.fileName, ngModuleByPipeOrDirective, file.directives, file.pipes, file.ngModules, file.injectables); });
  29499. return flatten(sourceModules);
  29500. };
  29501. AotCompiler.prototype._compileImplFile = function (srcFileUrl, ngModuleByPipeOrDirective, directives, pipes, ngModules, injectables) {
  29502. var _this = this;
  29503. var fileSuffix = normalizeGenFileSuffix(splitTypescriptSuffix(srcFileUrl, true)[1]);
  29504. var generatedFiles = [];
  29505. var outputCtx = this._createOutputContext(ngfactoryFilePath(srcFileUrl, true));
  29506. generatedFiles.push.apply(generatedFiles, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(this._createSummary(srcFileUrl, directives, pipes, ngModules, injectables, outputCtx)));
  29507. // compile all ng modules
  29508. ngModules.forEach(function (ngModuleMeta) { return _this._compileModule(outputCtx, ngModuleMeta); });
  29509. // compile components
  29510. directives.forEach(function (dirType) {
  29511. var compMeta = _this._metadataResolver.getDirectiveMetadata(dirType);
  29512. if (!compMeta.isComponent) {
  29513. return;
  29514. }
  29515. var ngModule = ngModuleByPipeOrDirective.get(dirType);
  29516. if (!ngModule) {
  29517. throw new Error("Internal Error: cannot determine the module for component " + identifierName(compMeta.type) + "!");
  29518. }
  29519. // compile styles
  29520. var componentStylesheet = _this._styleCompiler.compileComponent(outputCtx, compMeta);
  29521. // Note: compMeta is a component and therefore template is non null.
  29522. compMeta.template.externalStylesheets.forEach(function (stylesheetMeta) {
  29523. // Note: fill non shim and shim style files as they might
  29524. // be shared by component with and without ViewEncapsulation.
  29525. var shim = _this._styleCompiler.needsStyleShim(compMeta);
  29526. generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, shim, fileSuffix));
  29527. if (_this._options.allowEmptyCodegenFiles) {
  29528. generatedFiles.push(_this._codegenStyles(srcFileUrl, compMeta, stylesheetMeta, !shim, fileSuffix));
  29529. }
  29530. });
  29531. // compile components
  29532. var compViewVars = _this._compileComponent(outputCtx, compMeta, ngModule, ngModule.transitiveModule.directives, componentStylesheet, fileSuffix);
  29533. _this._compileComponentFactory(outputCtx, compMeta, ngModule, fileSuffix);
  29534. });
  29535. if (outputCtx.statements.length > 0 || this._options.allowEmptyCodegenFiles) {
  29536. var srcModule = this._codegenSourceModule(srcFileUrl, outputCtx);
  29537. generatedFiles.unshift(srcModule);
  29538. }
  29539. return generatedFiles;
  29540. };
  29541. AotCompiler.prototype._createSummary = function (srcFileName, directives, pipes, ngModules, injectables, ngFactoryCtx) {
  29542. var _this = this;
  29543. var symbolSummaries = this._symbolResolver.getSymbolsOf(srcFileName)
  29544. .map(function (symbol) { return _this._symbolResolver.resolveSymbol(symbol); });
  29545. var typeData = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(ngModules.map(function (meta) { return ({
  29546. summary: _this._metadataResolver.getNgModuleSummary(meta.type.reference),
  29547. metadata: _this._metadataResolver.getNgModuleMetadata(meta.type.reference)
  29548. }); }), directives.map(function (ref) { return ({
  29549. summary: _this._metadataResolver.getDirectiveSummary(ref),
  29550. metadata: _this._metadataResolver.getDirectiveMetadata(ref)
  29551. }); }), pipes.map(function (ref) { return ({
  29552. summary: _this._metadataResolver.getPipeSummary(ref),
  29553. metadata: _this._metadataResolver.getPipeMetadata(ref)
  29554. }); }), injectables.map(function (ref) { return ({
  29555. summary: _this._metadataResolver.getInjectableSummary(ref.symbol),
  29556. metadata: _this._metadataResolver.getInjectableSummary(ref.symbol).type
  29557. }); }));
  29558. var forJitOutputCtx = this._options.enableSummariesForJit ?
  29559. this._createOutputContext(summaryForJitFileName(srcFileName, true)) :
  29560. null;
  29561. var _a = serializeSummaries(srcFileName, forJitOutputCtx, this._summaryResolver, this._symbolResolver, symbolSummaries, typeData), json = _a.json, exportAs = _a.exportAs;
  29562. exportAs.forEach(function (entry) {
  29563. ngFactoryCtx.statements.push(variable(entry.exportAs).set(ngFactoryCtx.importExpr(entry.symbol)).toDeclStmt(null, [
  29564. StmtModifier.Exported
  29565. ]));
  29566. });
  29567. var summaryJson = new GeneratedFile(srcFileName, summaryFileName(srcFileName), json);
  29568. var result = [summaryJson];
  29569. if (forJitOutputCtx) {
  29570. result.push(this._codegenSourceModule(srcFileName, forJitOutputCtx));
  29571. }
  29572. return result;
  29573. };
  29574. AotCompiler.prototype._compileModule = function (outputCtx, ngModule) {
  29575. var providers = [];
  29576. if (this._options.locale) {
  29577. var normalizedLocale = this._options.locale.replace(/_/g, '-');
  29578. providers.push({
  29579. token: createTokenForExternalReference(this.reflector, Identifiers.LOCALE_ID),
  29580. useValue: normalizedLocale,
  29581. });
  29582. }
  29583. if (this._options.i18nFormat) {
  29584. providers.push({
  29585. token: createTokenForExternalReference(this.reflector, Identifiers.TRANSLATIONS_FORMAT),
  29586. useValue: this._options.i18nFormat
  29587. });
  29588. }
  29589. this._ngModuleCompiler.compile(outputCtx, ngModule, providers);
  29590. };
  29591. AotCompiler.prototype._compileComponentFactory = function (outputCtx, compMeta, ngModule, fileSuffix) {
  29592. var hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta);
  29593. var hostViewFactoryVar = this._compileComponent(outputCtx, hostMeta, ngModule, [compMeta.type], null, fileSuffix)
  29594. .viewClassVar;
  29595. var compFactoryVar = componentFactoryName(compMeta.type.reference);
  29596. var inputsExprs = [];
  29597. for (var propName in compMeta.inputs) {
  29598. var templateName = compMeta.inputs[propName];
  29599. // Don't quote so that the key gets minified...
  29600. inputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
  29601. }
  29602. var outputsExprs = [];
  29603. for (var propName in compMeta.outputs) {
  29604. var templateName = compMeta.outputs[propName];
  29605. // Don't quote so that the key gets minified...
  29606. outputsExprs.push(new LiteralMapEntry(propName, literal(templateName), false));
  29607. }
  29608. outputCtx.statements.push(variable(compFactoryVar)
  29609. .set(importExpr(Identifiers.createComponentFactory).callFn([
  29610. literal(compMeta.selector), outputCtx.importExpr(compMeta.type.reference),
  29611. variable(hostViewFactoryVar), new LiteralMapExpr(inputsExprs),
  29612. new LiteralMapExpr(outputsExprs),
  29613. literalArr(compMeta.template.ngContentSelectors.map(function (selector) { return literal(selector); }))
  29614. ]))
  29615. .toDeclStmt(importType(Identifiers.ComponentFactory, [expressionType(outputCtx.importExpr(compMeta.type.reference))], [TypeModifier.Const]), [StmtModifier.Final, StmtModifier.Exported]));
  29616. };
  29617. AotCompiler.prototype._compileComponent = function (outputCtx, compMeta, ngModule, directiveIdentifiers, componentStyles, fileSuffix) {
  29618. var _a = this._parseTemplate(compMeta, ngModule, directiveIdentifiers), parsedTemplate = _a.template, usedPipes = _a.pipes;
  29619. var stylesExpr = componentStyles ? variable(componentStyles.stylesVar) : literalArr([]);
  29620. var viewResult = this._viewCompiler.compileComponent(outputCtx, compMeta, parsedTemplate, stylesExpr, usedPipes);
  29621. if (componentStyles) {
  29622. _resolveStyleStatements(this._symbolResolver, componentStyles, this._styleCompiler.needsStyleShim(compMeta), fileSuffix);
  29623. }
  29624. return viewResult;
  29625. };
  29626. AotCompiler.prototype._parseTemplate = function (compMeta, ngModule, directiveIdentifiers) {
  29627. var _this = this;
  29628. if (this._templateAstCache.has(compMeta.type.reference)) {
  29629. return this._templateAstCache.get(compMeta.type.reference);
  29630. }
  29631. var preserveWhitespaces = compMeta.template.preserveWhitespaces;
  29632. var directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
  29633. var pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  29634. var result = this._templateParser.parse(compMeta, compMeta.template.htmlAst, directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, compMeta.template), preserveWhitespaces);
  29635. this._templateAstCache.set(compMeta.type.reference, result);
  29636. return result;
  29637. };
  29638. AotCompiler.prototype._createOutputContext = function (genFilePath) {
  29639. var _this = this;
  29640. var importExpr$$1 = function (symbol, typeParams, useSummaries) {
  29641. if (typeParams === void 0) { typeParams = null; }
  29642. if (useSummaries === void 0) { useSummaries = true; }
  29643. if (!(symbol instanceof StaticSymbol)) {
  29644. throw new Error("Internal error: unknown identifier " + JSON.stringify(symbol));
  29645. }
  29646. var arity = _this._symbolResolver.getTypeArity(symbol) || 0;
  29647. var _a = _this._symbolResolver.getImportAs(symbol, useSummaries) || symbol, filePath = _a.filePath, name = _a.name, members = _a.members;
  29648. var importModule = _this._fileNameToModuleName(filePath, genFilePath);
  29649. // It should be good enough to compare filePath to genFilePath and if they are equal
  29650. // there is a self reference. However, ngfactory files generate to .ts but their
  29651. // symbols have .d.ts so a simple compare is insufficient. They should be canonical
  29652. // and is tracked by #17705.
  29653. var selfReference = _this._fileNameToModuleName(genFilePath, genFilePath);
  29654. var moduleName = importModule === selfReference ? null : importModule;
  29655. // If we are in a type expression that refers to a generic type then supply
  29656. // the required type parameters. If there were not enough type parameters
  29657. // supplied, supply any as the type. Outside a type expression the reference
  29658. // should not supply type parameters and be treated as a simple value reference
  29659. // to the constructor function itself.
  29660. var suppliedTypeParams = typeParams || [];
  29661. var missingTypeParamsCount = arity - suppliedTypeParams.length;
  29662. var allTypeParams = suppliedTypeParams.concat(new Array(missingTypeParamsCount).fill(DYNAMIC_TYPE));
  29663. return members.reduce(function (expr, memberName) { return expr.prop(memberName); }, importExpr(new ExternalReference(moduleName, name, null), allTypeParams));
  29664. };
  29665. return { statements: [], genFilePath: genFilePath, importExpr: importExpr$$1, constantPool: new ConstantPool() };
  29666. };
  29667. AotCompiler.prototype._fileNameToModuleName = function (importedFilePath, containingFilePath) {
  29668. return this._summaryResolver.getKnownModuleName(importedFilePath) ||
  29669. this._symbolResolver.getKnownModuleName(importedFilePath) ||
  29670. this._host.fileNameToModuleName(importedFilePath, containingFilePath);
  29671. };
  29672. AotCompiler.prototype._codegenStyles = function (srcFileUrl, compMeta, stylesheetMetadata, isShimmed, fileSuffix) {
  29673. var outputCtx = this._createOutputContext(_stylesModuleUrl(stylesheetMetadata.moduleUrl, isShimmed, fileSuffix));
  29674. var compiledStylesheet = this._styleCompiler.compileStyles(outputCtx, compMeta, stylesheetMetadata, isShimmed);
  29675. _resolveStyleStatements(this._symbolResolver, compiledStylesheet, isShimmed, fileSuffix);
  29676. return this._codegenSourceModule(srcFileUrl, outputCtx);
  29677. };
  29678. AotCompiler.prototype._codegenSourceModule = function (srcFileUrl, ctx) {
  29679. return new GeneratedFile(srcFileUrl, ctx.genFilePath, ctx.statements);
  29680. };
  29681. AotCompiler.prototype.listLazyRoutes = function (entryRoute, analyzedModules) {
  29682. var e_2, _a, e_3, _b;
  29683. var self = this;
  29684. if (entryRoute) {
  29685. var symbol = parseLazyRoute(entryRoute, this.reflector).referencedModule;
  29686. return visitLazyRoute(symbol);
  29687. }
  29688. else if (analyzedModules) {
  29689. var allLazyRoutes = [];
  29690. try {
  29691. for (var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(analyzedModules.ngModules), _d = _c.next(); !_d.done; _d = _c.next()) {
  29692. var ngModule = _d.value;
  29693. var lazyRoutes = listLazyRoutes(ngModule, this.reflector);
  29694. try {
  29695. for (var lazyRoutes_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(lazyRoutes), lazyRoutes_1_1 = lazyRoutes_1.next(); !lazyRoutes_1_1.done; lazyRoutes_1_1 = lazyRoutes_1.next()) {
  29696. var lazyRoute = lazyRoutes_1_1.value;
  29697. allLazyRoutes.push(lazyRoute);
  29698. }
  29699. }
  29700. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  29701. finally {
  29702. try {
  29703. if (lazyRoutes_1_1 && !lazyRoutes_1_1.done && (_b = lazyRoutes_1.return)) _b.call(lazyRoutes_1);
  29704. }
  29705. finally { if (e_3) throw e_3.error; }
  29706. }
  29707. }
  29708. }
  29709. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  29710. finally {
  29711. try {
  29712. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  29713. }
  29714. finally { if (e_2) throw e_2.error; }
  29715. }
  29716. return allLazyRoutes;
  29717. }
  29718. else {
  29719. throw new Error("Either route or analyzedModules has to be specified!");
  29720. }
  29721. function visitLazyRoute(symbol, seenRoutes, allLazyRoutes) {
  29722. if (seenRoutes === void 0) { seenRoutes = new Set(); }
  29723. if (allLazyRoutes === void 0) { allLazyRoutes = []; }
  29724. var e_4, _a;
  29725. // Support pointing to default exports, but stop recursing there,
  29726. // as the StaticReflector does not yet support default exports.
  29727. if (seenRoutes.has(symbol) || !symbol.name) {
  29728. return allLazyRoutes;
  29729. }
  29730. seenRoutes.add(symbol);
  29731. var lazyRoutes = listLazyRoutes(self._metadataResolver.getNgModuleMetadata(symbol, true), self.reflector);
  29732. try {
  29733. for (var lazyRoutes_2 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(lazyRoutes), lazyRoutes_2_1 = lazyRoutes_2.next(); !lazyRoutes_2_1.done; lazyRoutes_2_1 = lazyRoutes_2.next()) {
  29734. var lazyRoute = lazyRoutes_2_1.value;
  29735. allLazyRoutes.push(lazyRoute);
  29736. visitLazyRoute(lazyRoute.referencedModule, seenRoutes, allLazyRoutes);
  29737. }
  29738. }
  29739. catch (e_4_1) { e_4 = { error: e_4_1 }; }
  29740. finally {
  29741. try {
  29742. if (lazyRoutes_2_1 && !lazyRoutes_2_1.done && (_a = lazyRoutes_2.return)) _a.call(lazyRoutes_2);
  29743. }
  29744. finally { if (e_4) throw e_4.error; }
  29745. }
  29746. return allLazyRoutes;
  29747. }
  29748. };
  29749. return AotCompiler;
  29750. }());
  29751. function _createEmptyStub(outputCtx) {
  29752. // Note: We need to produce at least one import statement so that
  29753. // TypeScript knows that the file is an es6 module. Otherwise our generated
  29754. // exports / imports won't be emitted properly by TypeScript.
  29755. outputCtx.statements.push(importExpr(Identifiers.ComponentFactory).toStmt());
  29756. }
  29757. function _resolveStyleStatements(symbolResolver, compileResult, needsShim, fileSuffix) {
  29758. compileResult.dependencies.forEach(function (dep) {
  29759. dep.setValue(symbolResolver.getStaticSymbol(_stylesModuleUrl(dep.moduleUrl, needsShim, fileSuffix), dep.name));
  29760. });
  29761. }
  29762. function _stylesModuleUrl(stylesheetUrl, shim, suffix) {
  29763. return "" + stylesheetUrl + (shim ? '.shim' : '') + ".ngstyle" + suffix;
  29764. }
  29765. function analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
  29766. var files = _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver);
  29767. return mergeAnalyzedFiles(files);
  29768. }
  29769. function analyzeAndValidateNgModules(fileNames, host, staticSymbolResolver, metadataResolver) {
  29770. return validateAnalyzedModules(analyzeNgModules(fileNames, host, staticSymbolResolver, metadataResolver));
  29771. }
  29772. function validateAnalyzedModules(analyzedModules) {
  29773. if (analyzedModules.symbolsMissingModule && analyzedModules.symbolsMissingModule.length) {
  29774. var messages = analyzedModules.symbolsMissingModule.map(function (s) {
  29775. return "Cannot determine the module for class " + s.name + " in " + s.filePath + "! Add " + s.name + " to the NgModule to fix it.";
  29776. });
  29777. throw syntaxError(messages.join('\n'));
  29778. }
  29779. return analyzedModules;
  29780. }
  29781. // Analyzes all of the program files,
  29782. // including files that are not part of the program
  29783. // but are referenced by an NgModule.
  29784. function _analyzeFilesIncludingNonProgramFiles(fileNames, host, staticSymbolResolver, metadataResolver) {
  29785. var seenFiles = new Set();
  29786. var files = [];
  29787. var visitFile = function (fileName) {
  29788. if (seenFiles.has(fileName) || !host.isSourceFile(fileName)) {
  29789. return false;
  29790. }
  29791. seenFiles.add(fileName);
  29792. var analyzedFile = analyzeFile(host, staticSymbolResolver, metadataResolver, fileName);
  29793. files.push(analyzedFile);
  29794. analyzedFile.ngModules.forEach(function (ngModule) {
  29795. ngModule.transitiveModule.modules.forEach(function (modMeta) { return visitFile(modMeta.reference.filePath); });
  29796. });
  29797. };
  29798. fileNames.forEach(function (fileName) { return visitFile(fileName); });
  29799. return files;
  29800. }
  29801. function analyzeFile(host, staticSymbolResolver, metadataResolver, fileName) {
  29802. var directives = [];
  29803. var pipes = [];
  29804. var injectables = [];
  29805. var ngModules = [];
  29806. var hasDecorators = staticSymbolResolver.hasDecorators(fileName);
  29807. var exportsNonSourceFiles = false;
  29808. // Don't analyze .d.ts files that have no decorators as a shortcut
  29809. // to speed up the analysis. This prevents us from
  29810. // resolving the references in these files.
  29811. // Note: exportsNonSourceFiles is only needed when compiling with summaries,
  29812. // which is not the case when .d.ts files are treated as input files.
  29813. if (!fileName.endsWith('.d.ts') || hasDecorators) {
  29814. staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) {
  29815. var resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
  29816. var symbolMeta = resolvedSymbol.metadata;
  29817. if (!symbolMeta || symbolMeta.__symbolic === 'error') {
  29818. return;
  29819. }
  29820. var isNgSymbol = false;
  29821. if (symbolMeta.__symbolic === 'class') {
  29822. if (metadataResolver.isDirective(symbol)) {
  29823. isNgSymbol = true;
  29824. directives.push(symbol);
  29825. }
  29826. else if (metadataResolver.isPipe(symbol)) {
  29827. isNgSymbol = true;
  29828. pipes.push(symbol);
  29829. }
  29830. else if (metadataResolver.isNgModule(symbol)) {
  29831. var ngModule = metadataResolver.getNgModuleMetadata(symbol, false);
  29832. if (ngModule) {
  29833. isNgSymbol = true;
  29834. ngModules.push(ngModule);
  29835. }
  29836. }
  29837. else if (metadataResolver.isInjectable(symbol)) {
  29838. isNgSymbol = true;
  29839. var injectable = metadataResolver.getInjectableMetadata(symbol, null, false);
  29840. if (injectable) {
  29841. injectables.push(injectable);
  29842. }
  29843. }
  29844. }
  29845. if (!isNgSymbol) {
  29846. exportsNonSourceFiles =
  29847. exportsNonSourceFiles || isValueExportingNonSourceFile(host, symbolMeta);
  29848. }
  29849. });
  29850. }
  29851. return {
  29852. fileName: fileName, directives: directives, pipes: pipes, ngModules: ngModules, injectables: injectables, exportsNonSourceFiles: exportsNonSourceFiles,
  29853. };
  29854. }
  29855. function analyzeFileForInjectables(host, staticSymbolResolver, metadataResolver, fileName) {
  29856. var injectables = [];
  29857. var shallowModules = [];
  29858. if (staticSymbolResolver.hasDecorators(fileName)) {
  29859. staticSymbolResolver.getSymbolsOf(fileName).forEach(function (symbol) {
  29860. var resolvedSymbol = staticSymbolResolver.resolveSymbol(symbol);
  29861. var symbolMeta = resolvedSymbol.metadata;
  29862. if (!symbolMeta || symbolMeta.__symbolic === 'error') {
  29863. return;
  29864. }
  29865. if (symbolMeta.__symbolic === 'class') {
  29866. if (metadataResolver.isInjectable(symbol)) {
  29867. var injectable = metadataResolver.getInjectableMetadata(symbol, null, false);
  29868. if (injectable) {
  29869. injectables.push(injectable);
  29870. }
  29871. }
  29872. else if (metadataResolver.isNgModule(symbol)) {
  29873. var module = metadataResolver.getShallowModuleMetadata(symbol);
  29874. if (module) {
  29875. shallowModules.push(module);
  29876. }
  29877. }
  29878. }
  29879. });
  29880. }
  29881. return { fileName: fileName, injectables: injectables, shallowModules: shallowModules };
  29882. }
  29883. function isValueExportingNonSourceFile(host, metadata) {
  29884. var exportsNonSourceFiles = false;
  29885. var Visitor = /** @class */ (function () {
  29886. function Visitor() {
  29887. }
  29888. Visitor.prototype.visitArray = function (arr, context) {
  29889. var _this = this;
  29890. arr.forEach(function (v) { return visitValue(v, _this, context); });
  29891. };
  29892. Visitor.prototype.visitStringMap = function (map, context) {
  29893. var _this = this;
  29894. Object.keys(map).forEach(function (key) { return visitValue(map[key], _this, context); });
  29895. };
  29896. Visitor.prototype.visitPrimitive = function (value, context) { };
  29897. Visitor.prototype.visitOther = function (value, context) {
  29898. if (value instanceof StaticSymbol && !host.isSourceFile(value.filePath)) {
  29899. exportsNonSourceFiles = true;
  29900. }
  29901. };
  29902. return Visitor;
  29903. }());
  29904. visitValue(metadata, new Visitor(), null);
  29905. return exportsNonSourceFiles;
  29906. }
  29907. function mergeAnalyzedFiles(analyzedFiles) {
  29908. var allNgModules = [];
  29909. var ngModuleByPipeOrDirective = new Map();
  29910. var allPipesAndDirectives = new Set();
  29911. analyzedFiles.forEach(function (af) {
  29912. af.ngModules.forEach(function (ngModule) {
  29913. allNgModules.push(ngModule);
  29914. ngModule.declaredDirectives.forEach(function (d) { return ngModuleByPipeOrDirective.set(d.reference, ngModule); });
  29915. ngModule.declaredPipes.forEach(function (p) { return ngModuleByPipeOrDirective.set(p.reference, ngModule); });
  29916. });
  29917. af.directives.forEach(function (d) { return allPipesAndDirectives.add(d); });
  29918. af.pipes.forEach(function (p) { return allPipesAndDirectives.add(p); });
  29919. });
  29920. var symbolsMissingModule = [];
  29921. allPipesAndDirectives.forEach(function (ref) {
  29922. if (!ngModuleByPipeOrDirective.has(ref)) {
  29923. symbolsMissingModule.push(ref);
  29924. }
  29925. });
  29926. return {
  29927. ngModules: allNgModules,
  29928. ngModuleByPipeOrDirective: ngModuleByPipeOrDirective,
  29929. symbolsMissingModule: symbolsMissingModule,
  29930. files: analyzedFiles
  29931. };
  29932. }
  29933. function mergeAndValidateNgFiles(files) {
  29934. return validateAnalyzedModules(mergeAnalyzedFiles(files));
  29935. }
  29936. /**
  29937. * @license
  29938. * Copyright Google Inc. All Rights Reserved.
  29939. *
  29940. * Use of this source code is governed by an MIT-style license that can be
  29941. * found in the LICENSE file at https://angular.io/license
  29942. */
  29943. var FORMATTED_MESSAGE = 'ngFormattedMessage';
  29944. function indentStr(level) {
  29945. if (level <= 0)
  29946. return '';
  29947. if (level < 6)
  29948. return ['', ' ', ' ', ' ', ' ', ' '][level];
  29949. var half = indentStr(Math.floor(level / 2));
  29950. return half + half + (level % 2 === 1 ? ' ' : '');
  29951. }
  29952. function formatChain(chain, indent) {
  29953. if (indent === void 0) { indent = 0; }
  29954. if (!chain)
  29955. return '';
  29956. var position = chain.position ?
  29957. chain.position.fileName + "(" + (chain.position.line + 1) + "," + (chain.position.column + 1) + ")" :
  29958. '';
  29959. var prefix = position && indent === 0 ? position + ": " : '';
  29960. var postfix = position && indent !== 0 ? " at " + position : '';
  29961. var message = "" + prefix + chain.message + postfix;
  29962. return "" + indentStr(indent) + message + ((chain.next && ('\n' + formatChain(chain.next, indent + 2))) || '');
  29963. }
  29964. function formattedError(chain) {
  29965. var message = formatChain(chain) + '.';
  29966. var error$$1 = syntaxError(message);
  29967. error$$1[FORMATTED_MESSAGE] = true;
  29968. error$$1.chain = chain;
  29969. error$$1.position = chain.position;
  29970. return error$$1;
  29971. }
  29972. function isFormattedError(error$$1) {
  29973. return !!error$$1[FORMATTED_MESSAGE];
  29974. }
  29975. /**
  29976. * @license
  29977. * Copyright Google Inc. All Rights Reserved.
  29978. *
  29979. * Use of this source code is governed by an MIT-style license that can be
  29980. * found in the LICENSE file at https://angular.io/license
  29981. */
  29982. var ANGULAR_CORE = '@angular/core';
  29983. var ANGULAR_ROUTER = '@angular/router';
  29984. var HIDDEN_KEY = /^\$.*\$$/;
  29985. var IGNORE = {
  29986. __symbolic: 'ignore'
  29987. };
  29988. var USE_VALUE = 'useValue';
  29989. var PROVIDE = 'provide';
  29990. var REFERENCE_SET = new Set([USE_VALUE, 'useFactory', 'data', 'id', 'loadChildren']);
  29991. var TYPEGUARD_POSTFIX = 'TypeGuard';
  29992. var USE_IF = 'UseIf';
  29993. function shouldIgnore(value) {
  29994. return value && value.__symbolic == 'ignore';
  29995. }
  29996. /**
  29997. * A static reflector implements enough of the Reflector API that is necessary to compile
  29998. * templates statically.
  29999. */
  30000. var StaticReflector = /** @class */ (function () {
  30001. function StaticReflector(summaryResolver, symbolResolver, knownMetadataClasses, knownMetadataFunctions, errorRecorder) {
  30002. if (knownMetadataClasses === void 0) { knownMetadataClasses = []; }
  30003. if (knownMetadataFunctions === void 0) { knownMetadataFunctions = []; }
  30004. var _this = this;
  30005. this.summaryResolver = summaryResolver;
  30006. this.symbolResolver = symbolResolver;
  30007. this.errorRecorder = errorRecorder;
  30008. this.annotationCache = new Map();
  30009. this.shallowAnnotationCache = new Map();
  30010. this.propertyCache = new Map();
  30011. this.parameterCache = new Map();
  30012. this.methodCache = new Map();
  30013. this.staticCache = new Map();
  30014. this.conversionMap = new Map();
  30015. this.resolvedExternalReferences = new Map();
  30016. this.annotationForParentClassWithSummaryKind = new Map();
  30017. this.initializeConversionMap();
  30018. knownMetadataClasses.forEach(function (kc) { return _this._registerDecoratorOrConstructor(_this.getStaticSymbol(kc.filePath, kc.name), kc.ctor); });
  30019. knownMetadataFunctions.forEach(function (kf) { return _this._registerFunction(_this.getStaticSymbol(kf.filePath, kf.name), kf.fn); });
  30020. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Directive, [createDirective, createComponent]);
  30021. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Pipe, [createPipe]);
  30022. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.NgModule, [createNgModule]);
  30023. this.annotationForParentClassWithSummaryKind.set(CompileSummaryKind.Injectable, [createInjectable, createPipe, createDirective, createComponent, createNgModule]);
  30024. }
  30025. StaticReflector.prototype.componentModuleUrl = function (typeOrFunc) {
  30026. var staticSymbol = this.findSymbolDeclaration(typeOrFunc);
  30027. return this.symbolResolver.getResourcePath(staticSymbol);
  30028. };
  30029. StaticReflector.prototype.resolveExternalReference = function (ref, containingFile) {
  30030. var key = undefined;
  30031. if (!containingFile) {
  30032. key = ref.moduleName + ":" + ref.name;
  30033. var declarationSymbol_1 = this.resolvedExternalReferences.get(key);
  30034. if (declarationSymbol_1)
  30035. return declarationSymbol_1;
  30036. }
  30037. var refSymbol = this.symbolResolver.getSymbolByModule(ref.moduleName, ref.name, containingFile);
  30038. var declarationSymbol = this.findSymbolDeclaration(refSymbol);
  30039. if (!containingFile) {
  30040. this.symbolResolver.recordModuleNameForFileName(refSymbol.filePath, ref.moduleName);
  30041. this.symbolResolver.recordImportAs(declarationSymbol, refSymbol);
  30042. }
  30043. if (key) {
  30044. this.resolvedExternalReferences.set(key, declarationSymbol);
  30045. }
  30046. return declarationSymbol;
  30047. };
  30048. StaticReflector.prototype.findDeclaration = function (moduleUrl, name, containingFile) {
  30049. return this.findSymbolDeclaration(this.symbolResolver.getSymbolByModule(moduleUrl, name, containingFile));
  30050. };
  30051. StaticReflector.prototype.tryFindDeclaration = function (moduleUrl, name, containingFile) {
  30052. var _this = this;
  30053. return this.symbolResolver.ignoreErrorsFor(function () { return _this.findDeclaration(moduleUrl, name, containingFile); });
  30054. };
  30055. StaticReflector.prototype.findSymbolDeclaration = function (symbol) {
  30056. var resolvedSymbol = this.symbolResolver.resolveSymbol(symbol);
  30057. if (resolvedSymbol) {
  30058. var resolvedMetadata = resolvedSymbol.metadata;
  30059. if (resolvedMetadata && resolvedMetadata.__symbolic === 'resolved') {
  30060. resolvedMetadata = resolvedMetadata.symbol;
  30061. }
  30062. if (resolvedMetadata instanceof StaticSymbol) {
  30063. return this.findSymbolDeclaration(resolvedSymbol.metadata);
  30064. }
  30065. }
  30066. return symbol;
  30067. };
  30068. StaticReflector.prototype.tryAnnotations = function (type) {
  30069. var originalRecorder = this.errorRecorder;
  30070. this.errorRecorder = function (error$$1, fileName) { };
  30071. try {
  30072. return this.annotations(type);
  30073. }
  30074. finally {
  30075. this.errorRecorder = originalRecorder;
  30076. }
  30077. };
  30078. StaticReflector.prototype.annotations = function (type) {
  30079. var _this = this;
  30080. return this._annotations(type, function (type, decorators) { return _this.simplify(type, decorators); }, this.annotationCache);
  30081. };
  30082. StaticReflector.prototype.shallowAnnotations = function (type) {
  30083. var _this = this;
  30084. return this._annotations(type, function (type, decorators) { return _this.simplify(type, decorators, true); }, this.shallowAnnotationCache);
  30085. };
  30086. StaticReflector.prototype._annotations = function (type, simplify, annotationCache) {
  30087. var annotations = annotationCache.get(type);
  30088. if (!annotations) {
  30089. annotations = [];
  30090. var classMetadata = this.getTypeMetadata(type);
  30091. var parentType = this.findParentType(type, classMetadata);
  30092. if (parentType) {
  30093. var parentAnnotations = this.annotations(parentType);
  30094. annotations.push.apply(annotations, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(parentAnnotations));
  30095. }
  30096. var ownAnnotations_1 = [];
  30097. if (classMetadata['decorators']) {
  30098. ownAnnotations_1 = simplify(type, classMetadata['decorators']);
  30099. if (ownAnnotations_1) {
  30100. annotations.push.apply(annotations, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(ownAnnotations_1));
  30101. }
  30102. }
  30103. if (parentType && !this.summaryResolver.isLibraryFile(type.filePath) &&
  30104. this.summaryResolver.isLibraryFile(parentType.filePath)) {
  30105. var summary = this.summaryResolver.resolveSummary(parentType);
  30106. if (summary && summary.type) {
  30107. var requiredAnnotationTypes = this.annotationForParentClassWithSummaryKind.get(summary.type.summaryKind);
  30108. var typeHasRequiredAnnotation = requiredAnnotationTypes.some(function (requiredType) { return ownAnnotations_1.some(function (ann) { return requiredType.isTypeOf(ann); }); });
  30109. if (!typeHasRequiredAnnotation) {
  30110. this.reportError(formatMetadataError(metadataError("Class " + type.name + " in " + type.filePath + " extends from a " + CompileSummaryKind[summary.type.summaryKind] + " in another compilation unit without duplicating the decorator",
  30111. /* summary */ undefined, "Please add a " + requiredAnnotationTypes.map(function (type) { return type.ngMetadataName; }).join(' or ') + " decorator to the class"), type), type);
  30112. }
  30113. }
  30114. }
  30115. annotationCache.set(type, annotations.filter(function (ann) { return !!ann; }));
  30116. }
  30117. return annotations;
  30118. };
  30119. StaticReflector.prototype.propMetadata = function (type) {
  30120. var _this = this;
  30121. var propMetadata = this.propertyCache.get(type);
  30122. if (!propMetadata) {
  30123. var classMetadata = this.getTypeMetadata(type);
  30124. propMetadata = {};
  30125. var parentType = this.findParentType(type, classMetadata);
  30126. if (parentType) {
  30127. var parentPropMetadata_1 = this.propMetadata(parentType);
  30128. Object.keys(parentPropMetadata_1).forEach(function (parentProp) {
  30129. propMetadata[parentProp] = parentPropMetadata_1[parentProp];
  30130. });
  30131. }
  30132. var members_1 = classMetadata['members'] || {};
  30133. Object.keys(members_1).forEach(function (propName) {
  30134. var propData = members_1[propName];
  30135. var prop = propData
  30136. .find(function (a) { return a['__symbolic'] == 'property' || a['__symbolic'] == 'method'; });
  30137. var decorators = [];
  30138. if (propMetadata[propName]) {
  30139. decorators.push.apply(decorators, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(propMetadata[propName]));
  30140. }
  30141. propMetadata[propName] = decorators;
  30142. if (prop && prop['decorators']) {
  30143. decorators.push.apply(decorators, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(_this.simplify(type, prop['decorators'])));
  30144. }
  30145. });
  30146. this.propertyCache.set(type, propMetadata);
  30147. }
  30148. return propMetadata;
  30149. };
  30150. StaticReflector.prototype.parameters = function (type) {
  30151. var _this = this;
  30152. if (!(type instanceof StaticSymbol)) {
  30153. this.reportError(new Error("parameters received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
  30154. return [];
  30155. }
  30156. try {
  30157. var parameters_1 = this.parameterCache.get(type);
  30158. if (!parameters_1) {
  30159. var classMetadata = this.getTypeMetadata(type);
  30160. var parentType = this.findParentType(type, classMetadata);
  30161. var members = classMetadata ? classMetadata['members'] : null;
  30162. var ctorData = members ? members['__ctor__'] : null;
  30163. if (ctorData) {
  30164. var ctor = ctorData.find(function (a) { return a['__symbolic'] == 'constructor'; });
  30165. var rawParameterTypes = ctor['parameters'] || [];
  30166. var parameterDecorators_1 = this.simplify(type, ctor['parameterDecorators'] || []);
  30167. parameters_1 = [];
  30168. rawParameterTypes.forEach(function (rawParamType, index) {
  30169. var nestedResult = [];
  30170. var paramType = _this.trySimplify(type, rawParamType);
  30171. if (paramType)
  30172. nestedResult.push(paramType);
  30173. var decorators = parameterDecorators_1 ? parameterDecorators_1[index] : null;
  30174. if (decorators) {
  30175. nestedResult.push.apply(nestedResult, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(decorators));
  30176. }
  30177. parameters_1.push(nestedResult);
  30178. });
  30179. }
  30180. else if (parentType) {
  30181. parameters_1 = this.parameters(parentType);
  30182. }
  30183. if (!parameters_1) {
  30184. parameters_1 = [];
  30185. }
  30186. this.parameterCache.set(type, parameters_1);
  30187. }
  30188. return parameters_1;
  30189. }
  30190. catch (e) {
  30191. console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
  30192. throw e;
  30193. }
  30194. };
  30195. StaticReflector.prototype._methodNames = function (type) {
  30196. var methodNames = this.methodCache.get(type);
  30197. if (!methodNames) {
  30198. var classMetadata = this.getTypeMetadata(type);
  30199. methodNames = {};
  30200. var parentType = this.findParentType(type, classMetadata);
  30201. if (parentType) {
  30202. var parentMethodNames_1 = this._methodNames(parentType);
  30203. Object.keys(parentMethodNames_1).forEach(function (parentProp) {
  30204. methodNames[parentProp] = parentMethodNames_1[parentProp];
  30205. });
  30206. }
  30207. var members_2 = classMetadata['members'] || {};
  30208. Object.keys(members_2).forEach(function (propName) {
  30209. var propData = members_2[propName];
  30210. var isMethod = propData.some(function (a) { return a['__symbolic'] == 'method'; });
  30211. methodNames[propName] = methodNames[propName] || isMethod;
  30212. });
  30213. this.methodCache.set(type, methodNames);
  30214. }
  30215. return methodNames;
  30216. };
  30217. StaticReflector.prototype._staticMembers = function (type) {
  30218. var staticMembers = this.staticCache.get(type);
  30219. if (!staticMembers) {
  30220. var classMetadata = this.getTypeMetadata(type);
  30221. var staticMemberData = classMetadata['statics'] || {};
  30222. staticMembers = Object.keys(staticMemberData);
  30223. this.staticCache.set(type, staticMembers);
  30224. }
  30225. return staticMembers;
  30226. };
  30227. StaticReflector.prototype.findParentType = function (type, classMetadata) {
  30228. var parentType = this.trySimplify(type, classMetadata['extends']);
  30229. if (parentType instanceof StaticSymbol) {
  30230. return parentType;
  30231. }
  30232. };
  30233. StaticReflector.prototype.hasLifecycleHook = function (type, lcProperty) {
  30234. if (!(type instanceof StaticSymbol)) {
  30235. this.reportError(new Error("hasLifecycleHook received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
  30236. }
  30237. try {
  30238. return !!this._methodNames(type)[lcProperty];
  30239. }
  30240. catch (e) {
  30241. console.error("Failed on type " + JSON.stringify(type) + " with error " + e);
  30242. throw e;
  30243. }
  30244. };
  30245. StaticReflector.prototype.guards = function (type) {
  30246. var e_1, _a;
  30247. if (!(type instanceof StaticSymbol)) {
  30248. this.reportError(new Error("guards received " + JSON.stringify(type) + " which is not a StaticSymbol"), type);
  30249. return {};
  30250. }
  30251. var staticMembers = this._staticMembers(type);
  30252. var result = {};
  30253. try {
  30254. for (var staticMembers_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(staticMembers), staticMembers_1_1 = staticMembers_1.next(); !staticMembers_1_1.done; staticMembers_1_1 = staticMembers_1.next()) {
  30255. var name_1 = staticMembers_1_1.value;
  30256. if (name_1.endsWith(TYPEGUARD_POSTFIX)) {
  30257. var property = name_1.substr(0, name_1.length - TYPEGUARD_POSTFIX.length);
  30258. var value = void 0;
  30259. if (property.endsWith(USE_IF)) {
  30260. property = name_1.substr(0, property.length - USE_IF.length);
  30261. value = USE_IF;
  30262. }
  30263. else {
  30264. value = this.getStaticSymbol(type.filePath, type.name, [name_1]);
  30265. }
  30266. result[property] = value;
  30267. }
  30268. }
  30269. }
  30270. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  30271. finally {
  30272. try {
  30273. if (staticMembers_1_1 && !staticMembers_1_1.done && (_a = staticMembers_1.return)) _a.call(staticMembers_1);
  30274. }
  30275. finally { if (e_1) throw e_1.error; }
  30276. }
  30277. return result;
  30278. };
  30279. StaticReflector.prototype._registerDecoratorOrConstructor = function (type, ctor) {
  30280. this.conversionMap.set(type, function (context, args) { return new (ctor.bind.apply(ctor, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], args)))(); });
  30281. };
  30282. StaticReflector.prototype._registerFunction = function (type, fn) {
  30283. this.conversionMap.set(type, function (context, args) { return fn.apply(undefined, args); });
  30284. };
  30285. StaticReflector.prototype.initializeConversionMap = function () {
  30286. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Injectable'), createInjectable);
  30287. this.injectionToken = this.findDeclaration(ANGULAR_CORE, 'InjectionToken');
  30288. this.opaqueToken = this.findDeclaration(ANGULAR_CORE, 'OpaqueToken');
  30289. this.ROUTES = this.tryFindDeclaration(ANGULAR_ROUTER, 'ROUTES');
  30290. this.ANALYZE_FOR_ENTRY_COMPONENTS =
  30291. this.findDeclaration(ANGULAR_CORE, 'ANALYZE_FOR_ENTRY_COMPONENTS');
  30292. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
  30293. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
  30294. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
  30295. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Inject'), createInject);
  30296. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
  30297. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Attribute'), createAttribute);
  30298. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChild'), createContentChild);
  30299. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ContentChildren'), createContentChildren);
  30300. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChild'), createViewChild);
  30301. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'ViewChildren'), createViewChildren);
  30302. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Input'), createInput);
  30303. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Output'), createOutput);
  30304. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Pipe'), createPipe);
  30305. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostBinding'), createHostBinding);
  30306. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'HostListener'), createHostListener);
  30307. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Directive'), createDirective);
  30308. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Component'), createComponent);
  30309. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'NgModule'), createNgModule);
  30310. // Note: Some metadata classes can be used directly with Provider.deps.
  30311. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Host'), createHost);
  30312. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Self'), createSelf);
  30313. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'SkipSelf'), createSkipSelf);
  30314. this._registerDecoratorOrConstructor(this.findDeclaration(ANGULAR_CORE, 'Optional'), createOptional);
  30315. };
  30316. /**
  30317. * getStaticSymbol produces a Type whose metadata is known but whose implementation is not loaded.
  30318. * All types passed to the StaticResolver should be pseudo-types returned by this method.
  30319. *
  30320. * @param declarationFile the absolute path of the file where the symbol is declared
  30321. * @param name the name of the type.
  30322. */
  30323. StaticReflector.prototype.getStaticSymbol = function (declarationFile, name, members) {
  30324. return this.symbolResolver.getStaticSymbol(declarationFile, name, members);
  30325. };
  30326. /**
  30327. * Simplify but discard any errors
  30328. */
  30329. StaticReflector.prototype.trySimplify = function (context, value) {
  30330. var originalRecorder = this.errorRecorder;
  30331. this.errorRecorder = function (error$$1, fileName) { };
  30332. var result = this.simplify(context, value);
  30333. this.errorRecorder = originalRecorder;
  30334. return result;
  30335. };
  30336. /** @internal */
  30337. StaticReflector.prototype.simplify = function (context, value, lazy) {
  30338. if (lazy === void 0) { lazy = false; }
  30339. var self = this;
  30340. var scope = BindingScope$1.empty;
  30341. var calling = new Map();
  30342. function simplifyInContext(context, value, depth, references) {
  30343. function resolveReferenceValue(staticSymbol) {
  30344. var resolvedSymbol = self.symbolResolver.resolveSymbol(staticSymbol);
  30345. return resolvedSymbol ? resolvedSymbol.metadata : null;
  30346. }
  30347. function simplifyEagerly(value) {
  30348. return simplifyInContext(context, value, depth, 0);
  30349. }
  30350. function simplifyLazily(value) {
  30351. return simplifyInContext(context, value, depth, references + 1);
  30352. }
  30353. function simplifyNested(nestedContext, value) {
  30354. if (nestedContext === context) {
  30355. // If the context hasn't changed let the exception propagate unmodified.
  30356. return simplifyInContext(nestedContext, value, depth + 1, references);
  30357. }
  30358. try {
  30359. return simplifyInContext(nestedContext, value, depth + 1, references);
  30360. }
  30361. catch (e) {
  30362. if (isMetadataError(e)) {
  30363. // Propagate the message text up but add a message to the chain that explains how we got
  30364. // here.
  30365. // e.chain implies e.symbol
  30366. var summaryMsg = e.chain ? 'references \'' + e.symbol.name + '\'' : errorSummary(e);
  30367. var summary = "'" + nestedContext.name + "' " + summaryMsg;
  30368. var chain = { message: summary, position: e.position, next: e.chain };
  30369. // TODO(chuckj): retrieve the position information indirectly from the collectors node
  30370. // map if the metadata is from a .ts file.
  30371. self.error({
  30372. message: e.message,
  30373. advise: e.advise,
  30374. context: e.context, chain: chain,
  30375. symbol: nestedContext
  30376. }, context);
  30377. }
  30378. else {
  30379. // It is probably an internal error.
  30380. throw e;
  30381. }
  30382. }
  30383. }
  30384. function simplifyCall(functionSymbol, targetFunction, args, targetExpression) {
  30385. if (targetFunction && targetFunction['__symbolic'] == 'function') {
  30386. if (calling.get(functionSymbol)) {
  30387. self.error({
  30388. message: 'Recursion is not supported',
  30389. summary: "called '" + functionSymbol.name + "' recursively",
  30390. value: targetFunction
  30391. }, functionSymbol);
  30392. }
  30393. try {
  30394. var value_1 = targetFunction['value'];
  30395. if (value_1 && (depth != 0 || value_1.__symbolic != 'error')) {
  30396. var parameters = targetFunction['parameters'];
  30397. var defaults = targetFunction.defaults;
  30398. args = args.map(function (arg) { return simplifyNested(context, arg); })
  30399. .map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
  30400. if (defaults && defaults.length > args.length) {
  30401. args.push.apply(args, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(defaults.slice(args.length).map(function (value) { return simplify(value); })));
  30402. }
  30403. calling.set(functionSymbol, true);
  30404. var functionScope = BindingScope$1.build();
  30405. for (var i = 0; i < parameters.length; i++) {
  30406. functionScope.define(parameters[i], args[i]);
  30407. }
  30408. var oldScope = scope;
  30409. var result_1;
  30410. try {
  30411. scope = functionScope.done();
  30412. result_1 = simplifyNested(functionSymbol, value_1);
  30413. }
  30414. finally {
  30415. scope = oldScope;
  30416. }
  30417. return result_1;
  30418. }
  30419. }
  30420. finally {
  30421. calling.delete(functionSymbol);
  30422. }
  30423. }
  30424. if (depth === 0) {
  30425. // If depth is 0 we are evaluating the top level expression that is describing element
  30426. // decorator. In this case, it is a decorator we don't understand, such as a custom
  30427. // non-angular decorator, and we should just ignore it.
  30428. return IGNORE;
  30429. }
  30430. var position = undefined;
  30431. if (targetExpression && targetExpression.__symbolic == 'resolved') {
  30432. var line = targetExpression.line;
  30433. var character = targetExpression.character;
  30434. var fileName = targetExpression.fileName;
  30435. if (fileName != null && line != null && character != null) {
  30436. position = { fileName: fileName, line: line, column: character };
  30437. }
  30438. }
  30439. self.error({
  30440. message: FUNCTION_CALL_NOT_SUPPORTED,
  30441. context: functionSymbol,
  30442. value: targetFunction, position: position
  30443. }, context);
  30444. }
  30445. function simplify(expression) {
  30446. var e_2, _a, e_3, _b;
  30447. if (isPrimitive(expression)) {
  30448. return expression;
  30449. }
  30450. if (expression instanceof Array) {
  30451. var result_2 = [];
  30452. try {
  30453. for (var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(expression), _d = _c.next(); !_d.done; _d = _c.next()) {
  30454. var item = _d.value;
  30455. // Check for a spread expression
  30456. if (item && item.__symbolic === 'spread') {
  30457. // We call with references as 0 because we require the actual value and cannot
  30458. // tolerate a reference here.
  30459. var spreadArray = simplifyEagerly(item.expression);
  30460. if (Array.isArray(spreadArray)) {
  30461. try {
  30462. for (var spreadArray_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(spreadArray), spreadArray_1_1 = spreadArray_1.next(); !spreadArray_1_1.done; spreadArray_1_1 = spreadArray_1.next()) {
  30463. var spreadItem = spreadArray_1_1.value;
  30464. result_2.push(spreadItem);
  30465. }
  30466. }
  30467. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  30468. finally {
  30469. try {
  30470. if (spreadArray_1_1 && !spreadArray_1_1.done && (_b = spreadArray_1.return)) _b.call(spreadArray_1);
  30471. }
  30472. finally { if (e_3) throw e_3.error; }
  30473. }
  30474. continue;
  30475. }
  30476. }
  30477. var value_2 = simplify(item);
  30478. if (shouldIgnore(value_2)) {
  30479. continue;
  30480. }
  30481. result_2.push(value_2);
  30482. }
  30483. }
  30484. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  30485. finally {
  30486. try {
  30487. if (_d && !_d.done && (_a = _c.return)) _a.call(_c);
  30488. }
  30489. finally { if (e_2) throw e_2.error; }
  30490. }
  30491. return result_2;
  30492. }
  30493. if (expression instanceof StaticSymbol) {
  30494. // Stop simplification at builtin symbols or if we are in a reference context and
  30495. // the symbol doesn't have members.
  30496. if (expression === self.injectionToken || self.conversionMap.has(expression) ||
  30497. (references > 0 && !expression.members.length)) {
  30498. return expression;
  30499. }
  30500. else {
  30501. var staticSymbol = expression;
  30502. var declarationValue = resolveReferenceValue(staticSymbol);
  30503. if (declarationValue != null) {
  30504. return simplifyNested(staticSymbol, declarationValue);
  30505. }
  30506. else {
  30507. return staticSymbol;
  30508. }
  30509. }
  30510. }
  30511. if (expression) {
  30512. if (expression['__symbolic']) {
  30513. var staticSymbol = void 0;
  30514. switch (expression['__symbolic']) {
  30515. case 'binop':
  30516. var left = simplify(expression['left']);
  30517. if (shouldIgnore(left))
  30518. return left;
  30519. var right = simplify(expression['right']);
  30520. if (shouldIgnore(right))
  30521. return right;
  30522. switch (expression['operator']) {
  30523. case '&&':
  30524. return left && right;
  30525. case '||':
  30526. return left || right;
  30527. case '|':
  30528. return left | right;
  30529. case '^':
  30530. return left ^ right;
  30531. case '&':
  30532. return left & right;
  30533. case '==':
  30534. return left == right;
  30535. case '!=':
  30536. return left != right;
  30537. case '===':
  30538. return left === right;
  30539. case '!==':
  30540. return left !== right;
  30541. case '<':
  30542. return left < right;
  30543. case '>':
  30544. return left > right;
  30545. case '<=':
  30546. return left <= right;
  30547. case '>=':
  30548. return left >= right;
  30549. case '<<':
  30550. return left << right;
  30551. case '>>':
  30552. return left >> right;
  30553. case '+':
  30554. return left + right;
  30555. case '-':
  30556. return left - right;
  30557. case '*':
  30558. return left * right;
  30559. case '/':
  30560. return left / right;
  30561. case '%':
  30562. return left % right;
  30563. }
  30564. return null;
  30565. case 'if':
  30566. var condition = simplify(expression['condition']);
  30567. return condition ? simplify(expression['thenExpression']) :
  30568. simplify(expression['elseExpression']);
  30569. case 'pre':
  30570. var operand = simplify(expression['operand']);
  30571. if (shouldIgnore(operand))
  30572. return operand;
  30573. switch (expression['operator']) {
  30574. case '+':
  30575. return operand;
  30576. case '-':
  30577. return -operand;
  30578. case '!':
  30579. return !operand;
  30580. case '~':
  30581. return ~operand;
  30582. }
  30583. return null;
  30584. case 'index':
  30585. var indexTarget = simplifyEagerly(expression['expression']);
  30586. var index = simplifyEagerly(expression['index']);
  30587. if (indexTarget && isPrimitive(index))
  30588. return indexTarget[index];
  30589. return null;
  30590. case 'select':
  30591. var member = expression['member'];
  30592. var selectContext = context;
  30593. var selectTarget = simplify(expression['expression']);
  30594. if (selectTarget instanceof StaticSymbol) {
  30595. var members = selectTarget.members.concat(member);
  30596. selectContext =
  30597. self.getStaticSymbol(selectTarget.filePath, selectTarget.name, members);
  30598. var declarationValue = resolveReferenceValue(selectContext);
  30599. if (declarationValue != null) {
  30600. return simplifyNested(selectContext, declarationValue);
  30601. }
  30602. else {
  30603. return selectContext;
  30604. }
  30605. }
  30606. if (selectTarget && isPrimitive(member))
  30607. return simplifyNested(selectContext, selectTarget[member]);
  30608. return null;
  30609. case 'reference':
  30610. // Note: This only has to deal with variable references, as symbol references have
  30611. // been converted into 'resolved'
  30612. // in the StaticSymbolResolver.
  30613. var name_2 = expression['name'];
  30614. var localValue = scope.resolve(name_2);
  30615. if (localValue != BindingScope$1.missing) {
  30616. return localValue;
  30617. }
  30618. break;
  30619. case 'resolved':
  30620. try {
  30621. return simplify(expression.symbol);
  30622. }
  30623. catch (e) {
  30624. // If an error is reported evaluating the symbol record the position of the
  30625. // reference in the error so it can
  30626. // be reported in the error message generated from the exception.
  30627. if (isMetadataError(e) && expression.fileName != null &&
  30628. expression.line != null && expression.character != null) {
  30629. e.position = {
  30630. fileName: expression.fileName,
  30631. line: expression.line,
  30632. column: expression.character
  30633. };
  30634. }
  30635. throw e;
  30636. }
  30637. case 'class':
  30638. return context;
  30639. case 'function':
  30640. return context;
  30641. case 'new':
  30642. case 'call':
  30643. // Determine if the function is a built-in conversion
  30644. staticSymbol = simplifyInContext(context, expression['expression'], depth + 1, /* references */ 0);
  30645. if (staticSymbol instanceof StaticSymbol) {
  30646. if (staticSymbol === self.injectionToken || staticSymbol === self.opaqueToken) {
  30647. // if somebody calls new InjectionToken, don't create an InjectionToken,
  30648. // but rather return the symbol to which the InjectionToken is assigned to.
  30649. // OpaqueToken is supported too as it is required by the language service to
  30650. // support v4 and prior versions of Angular.
  30651. return context;
  30652. }
  30653. var argExpressions = expression['arguments'] || [];
  30654. var converter = self.conversionMap.get(staticSymbol);
  30655. if (converter) {
  30656. var args = argExpressions.map(function (arg) { return simplifyNested(context, arg); })
  30657. .map(function (arg) { return shouldIgnore(arg) ? undefined : arg; });
  30658. return converter(context, args);
  30659. }
  30660. else {
  30661. // Determine if the function is one we can simplify.
  30662. var targetFunction = resolveReferenceValue(staticSymbol);
  30663. return simplifyCall(staticSymbol, targetFunction, argExpressions, expression['expression']);
  30664. }
  30665. }
  30666. return IGNORE;
  30667. case 'error':
  30668. var message = expression.message;
  30669. if (expression['line'] != null) {
  30670. self.error({
  30671. message: message,
  30672. context: expression.context,
  30673. value: expression,
  30674. position: {
  30675. fileName: expression['fileName'],
  30676. line: expression['line'],
  30677. column: expression['character']
  30678. }
  30679. }, context);
  30680. }
  30681. else {
  30682. self.error({ message: message, context: expression.context }, context);
  30683. }
  30684. return IGNORE;
  30685. case 'ignore':
  30686. return expression;
  30687. }
  30688. return null;
  30689. }
  30690. return mapStringMap(expression, function (value, name) {
  30691. if (REFERENCE_SET.has(name)) {
  30692. if (name === USE_VALUE && PROVIDE in expression) {
  30693. // If this is a provider expression, check for special tokens that need the value
  30694. // during analysis.
  30695. var provide = simplify(expression.provide);
  30696. if (provide === self.ROUTES || provide == self.ANALYZE_FOR_ENTRY_COMPONENTS) {
  30697. return simplify(value);
  30698. }
  30699. }
  30700. return simplifyLazily(value);
  30701. }
  30702. return simplify(value);
  30703. });
  30704. }
  30705. return IGNORE;
  30706. }
  30707. return simplify(value);
  30708. }
  30709. var result;
  30710. try {
  30711. result = simplifyInContext(context, value, 0, lazy ? 1 : 0);
  30712. }
  30713. catch (e) {
  30714. if (this.errorRecorder) {
  30715. this.reportError(e, context);
  30716. }
  30717. else {
  30718. throw formatMetadataError(e, context);
  30719. }
  30720. }
  30721. if (shouldIgnore(result)) {
  30722. return undefined;
  30723. }
  30724. return result;
  30725. };
  30726. StaticReflector.prototype.getTypeMetadata = function (type) {
  30727. var resolvedSymbol = this.symbolResolver.resolveSymbol(type);
  30728. return resolvedSymbol && resolvedSymbol.metadata ? resolvedSymbol.metadata :
  30729. { __symbolic: 'class' };
  30730. };
  30731. StaticReflector.prototype.reportError = function (error$$1, context, path) {
  30732. if (this.errorRecorder) {
  30733. this.errorRecorder(formatMetadataError(error$$1, context), (context && context.filePath) || path);
  30734. }
  30735. else {
  30736. throw error$$1;
  30737. }
  30738. };
  30739. StaticReflector.prototype.error = function (_a, reportingContext) {
  30740. var message = _a.message, summary = _a.summary, advise = _a.advise, position = _a.position, context = _a.context, value = _a.value, symbol = _a.symbol, chain = _a.chain;
  30741. this.reportError(metadataError(message, summary, advise, position, symbol, context, chain), reportingContext);
  30742. };
  30743. return StaticReflector;
  30744. }());
  30745. var METADATA_ERROR = 'ngMetadataError';
  30746. function metadataError(message, summary, advise, position, symbol, context, chain) {
  30747. var error$$1 = syntaxError(message);
  30748. error$$1[METADATA_ERROR] = true;
  30749. if (advise)
  30750. error$$1.advise = advise;
  30751. if (position)
  30752. error$$1.position = position;
  30753. if (summary)
  30754. error$$1.summary = summary;
  30755. if (context)
  30756. error$$1.context = context;
  30757. if (chain)
  30758. error$$1.chain = chain;
  30759. if (symbol)
  30760. error$$1.symbol = symbol;
  30761. return error$$1;
  30762. }
  30763. function isMetadataError(error$$1) {
  30764. return !!error$$1[METADATA_ERROR];
  30765. }
  30766. var REFERENCE_TO_NONEXPORTED_CLASS = 'Reference to non-exported class';
  30767. var VARIABLE_NOT_INITIALIZED = 'Variable not initialized';
  30768. var DESTRUCTURE_NOT_SUPPORTED = 'Destructuring not supported';
  30769. var COULD_NOT_RESOLVE_TYPE = 'Could not resolve type';
  30770. var FUNCTION_CALL_NOT_SUPPORTED = 'Function call not supported';
  30771. var REFERENCE_TO_LOCAL_SYMBOL = 'Reference to a local symbol';
  30772. var LAMBDA_NOT_SUPPORTED = 'Lambda not supported';
  30773. function expandedMessage(message, context) {
  30774. switch (message) {
  30775. case REFERENCE_TO_NONEXPORTED_CLASS:
  30776. if (context && context.className) {
  30777. return "References to a non-exported class are not supported in decorators but " + context.className + " was referenced.";
  30778. }
  30779. break;
  30780. case VARIABLE_NOT_INITIALIZED:
  30781. return 'Only initialized variables and constants can be referenced in decorators because the value of this variable is needed by the template compiler';
  30782. case DESTRUCTURE_NOT_SUPPORTED:
  30783. return 'Referencing an exported destructured variable or constant is not supported in decorators and this value is needed by the template compiler';
  30784. case COULD_NOT_RESOLVE_TYPE:
  30785. if (context && context.typeName) {
  30786. return "Could not resolve type " + context.typeName;
  30787. }
  30788. break;
  30789. case FUNCTION_CALL_NOT_SUPPORTED:
  30790. if (context && context.name) {
  30791. return "Function calls are not supported in decorators but '" + context.name + "' was called";
  30792. }
  30793. return 'Function calls are not supported in decorators';
  30794. case REFERENCE_TO_LOCAL_SYMBOL:
  30795. if (context && context.name) {
  30796. return "Reference to a local (non-exported) symbols are not supported in decorators but '" + context.name + "' was referenced";
  30797. }
  30798. break;
  30799. case LAMBDA_NOT_SUPPORTED:
  30800. return "Function expressions are not supported in decorators";
  30801. }
  30802. return message;
  30803. }
  30804. function messageAdvise(message, context) {
  30805. switch (message) {
  30806. case REFERENCE_TO_NONEXPORTED_CLASS:
  30807. if (context && context.className) {
  30808. return "Consider exporting '" + context.className + "'";
  30809. }
  30810. break;
  30811. case DESTRUCTURE_NOT_SUPPORTED:
  30812. return 'Consider simplifying to avoid destructuring';
  30813. case REFERENCE_TO_LOCAL_SYMBOL:
  30814. if (context && context.name) {
  30815. return "Consider exporting '" + context.name + "'";
  30816. }
  30817. break;
  30818. case LAMBDA_NOT_SUPPORTED:
  30819. return "Consider changing the function expression into an exported function";
  30820. }
  30821. return undefined;
  30822. }
  30823. function errorSummary(error$$1) {
  30824. if (error$$1.summary) {
  30825. return error$$1.summary;
  30826. }
  30827. switch (error$$1.message) {
  30828. case REFERENCE_TO_NONEXPORTED_CLASS:
  30829. if (error$$1.context && error$$1.context.className) {
  30830. return "references non-exported class " + error$$1.context.className;
  30831. }
  30832. break;
  30833. case VARIABLE_NOT_INITIALIZED:
  30834. return 'is not initialized';
  30835. case DESTRUCTURE_NOT_SUPPORTED:
  30836. return 'is a destructured variable';
  30837. case COULD_NOT_RESOLVE_TYPE:
  30838. return 'could not be resolved';
  30839. case FUNCTION_CALL_NOT_SUPPORTED:
  30840. if (error$$1.context && error$$1.context.name) {
  30841. return "calls '" + error$$1.context.name + "'";
  30842. }
  30843. return "calls a function";
  30844. case REFERENCE_TO_LOCAL_SYMBOL:
  30845. if (error$$1.context && error$$1.context.name) {
  30846. return "references local variable " + error$$1.context.name;
  30847. }
  30848. return "references a local variable";
  30849. }
  30850. return 'contains the error';
  30851. }
  30852. function mapStringMap(input, transform) {
  30853. if (!input)
  30854. return {};
  30855. var result = {};
  30856. Object.keys(input).forEach(function (key) {
  30857. var value = transform(input[key], key);
  30858. if (!shouldIgnore(value)) {
  30859. if (HIDDEN_KEY.test(key)) {
  30860. Object.defineProperty(result, key, { enumerable: false, configurable: true, value: value });
  30861. }
  30862. else {
  30863. result[key] = value;
  30864. }
  30865. }
  30866. });
  30867. return result;
  30868. }
  30869. function isPrimitive(o) {
  30870. return o === null || (typeof o !== 'function' && typeof o !== 'object');
  30871. }
  30872. var BindingScope$1 = /** @class */ (function () {
  30873. function BindingScope() {
  30874. }
  30875. BindingScope.build = function () {
  30876. var current = new Map();
  30877. return {
  30878. define: function (name, value) {
  30879. current.set(name, value);
  30880. return this;
  30881. },
  30882. done: function () {
  30883. return current.size > 0 ? new PopulatedScope(current) : BindingScope.empty;
  30884. }
  30885. };
  30886. };
  30887. BindingScope.missing = {};
  30888. BindingScope.empty = { resolve: function (name) { return BindingScope.missing; } };
  30889. return BindingScope;
  30890. }());
  30891. var PopulatedScope = /** @class */ (function (_super) {
  30892. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(PopulatedScope, _super);
  30893. function PopulatedScope(bindings) {
  30894. var _this = _super.call(this) || this;
  30895. _this.bindings = bindings;
  30896. return _this;
  30897. }
  30898. PopulatedScope.prototype.resolve = function (name) {
  30899. return this.bindings.has(name) ? this.bindings.get(name) : BindingScope$1.missing;
  30900. };
  30901. return PopulatedScope;
  30902. }(BindingScope$1));
  30903. function formatMetadataMessageChain(chain, advise) {
  30904. var expanded = expandedMessage(chain.message, chain.context);
  30905. var nesting = chain.symbol ? " in '" + chain.symbol.name + "'" : '';
  30906. var message = "" + expanded + nesting;
  30907. var position = chain.position;
  30908. var next = chain.next ?
  30909. formatMetadataMessageChain(chain.next, advise) :
  30910. advise ? { message: advise } : undefined;
  30911. return { message: message, position: position, next: next };
  30912. }
  30913. function formatMetadataError(e, context) {
  30914. if (isMetadataError(e)) {
  30915. // Produce a formatted version of the and leaving enough information in the original error
  30916. // to recover the formatting information to eventually produce a diagnostic error message.
  30917. var position = e.position;
  30918. var chain = {
  30919. message: "Error during template compile of '" + context.name + "'",
  30920. position: position,
  30921. next: { message: e.message, next: e.chain, context: e.context, symbol: e.symbol }
  30922. };
  30923. var advise = e.advise || messageAdvise(e.message, e.context);
  30924. return formattedError(formatMetadataMessageChain(chain, advise));
  30925. }
  30926. return e;
  30927. }
  30928. /**
  30929. * @license
  30930. * Copyright Google Inc. All Rights Reserved.
  30931. *
  30932. * Use of this source code is governed by an MIT-style license that can be
  30933. * found in the LICENSE file at https://angular.io/license
  30934. */
  30935. var AotSummaryResolver = /** @class */ (function () {
  30936. function AotSummaryResolver(host, staticSymbolCache) {
  30937. this.host = host;
  30938. this.staticSymbolCache = staticSymbolCache;
  30939. // Note: this will only contain StaticSymbols without members!
  30940. this.summaryCache = new Map();
  30941. this.loadedFilePaths = new Map();
  30942. // Note: this will only contain StaticSymbols without members!
  30943. this.importAs = new Map();
  30944. this.knownFileNameToModuleNames = new Map();
  30945. }
  30946. AotSummaryResolver.prototype.isLibraryFile = function (filePath) {
  30947. // Note: We need to strip the .ngfactory. file path,
  30948. // so this method also works for generated files
  30949. // (for which host.isSourceFile will always return false).
  30950. return !this.host.isSourceFile(stripGeneratedFileSuffix(filePath));
  30951. };
  30952. AotSummaryResolver.prototype.toSummaryFileName = function (filePath, referringSrcFileName) {
  30953. return this.host.toSummaryFileName(filePath, referringSrcFileName);
  30954. };
  30955. AotSummaryResolver.prototype.fromSummaryFileName = function (fileName, referringLibFileName) {
  30956. return this.host.fromSummaryFileName(fileName, referringLibFileName);
  30957. };
  30958. AotSummaryResolver.prototype.resolveSummary = function (staticSymbol) {
  30959. var rootSymbol = staticSymbol.members.length ?
  30960. this.staticSymbolCache.get(staticSymbol.filePath, staticSymbol.name) :
  30961. staticSymbol;
  30962. var summary = this.summaryCache.get(rootSymbol);
  30963. if (!summary) {
  30964. this._loadSummaryFile(staticSymbol.filePath);
  30965. summary = this.summaryCache.get(staticSymbol);
  30966. }
  30967. return (rootSymbol === staticSymbol && summary) || null;
  30968. };
  30969. AotSummaryResolver.prototype.getSymbolsOf = function (filePath) {
  30970. if (this._loadSummaryFile(filePath)) {
  30971. return Array.from(this.summaryCache.keys()).filter(function (symbol) { return symbol.filePath === filePath; });
  30972. }
  30973. return null;
  30974. };
  30975. AotSummaryResolver.prototype.getImportAs = function (staticSymbol) {
  30976. staticSymbol.assertNoMembers();
  30977. return this.importAs.get(staticSymbol);
  30978. };
  30979. /**
  30980. * Converts a file path to a module name that can be used as an `import`.
  30981. */
  30982. AotSummaryResolver.prototype.getKnownModuleName = function (importedFilePath) {
  30983. return this.knownFileNameToModuleNames.get(importedFilePath) || null;
  30984. };
  30985. AotSummaryResolver.prototype.addSummary = function (summary) { this.summaryCache.set(summary.symbol, summary); };
  30986. AotSummaryResolver.prototype._loadSummaryFile = function (filePath) {
  30987. var _this = this;
  30988. var hasSummary = this.loadedFilePaths.get(filePath);
  30989. if (hasSummary != null) {
  30990. return hasSummary;
  30991. }
  30992. var json = null;
  30993. if (this.isLibraryFile(filePath)) {
  30994. var summaryFilePath = summaryFileName(filePath);
  30995. try {
  30996. json = this.host.loadSummary(summaryFilePath);
  30997. }
  30998. catch (e) {
  30999. console.error("Error loading summary file " + summaryFilePath);
  31000. throw e;
  31001. }
  31002. }
  31003. hasSummary = json != null;
  31004. this.loadedFilePaths.set(filePath, hasSummary);
  31005. if (json) {
  31006. var _a = deserializeSummaries(this.staticSymbolCache, this, filePath, json), moduleName = _a.moduleName, summaries = _a.summaries, importAs = _a.importAs;
  31007. summaries.forEach(function (summary) { return _this.summaryCache.set(summary.symbol, summary); });
  31008. if (moduleName) {
  31009. this.knownFileNameToModuleNames.set(filePath, moduleName);
  31010. }
  31011. importAs.forEach(function (importAs) { _this.importAs.set(importAs.symbol, importAs.importAs); });
  31012. }
  31013. return hasSummary;
  31014. };
  31015. return AotSummaryResolver;
  31016. }());
  31017. /**
  31018. * @license
  31019. * Copyright Google Inc. All Rights Reserved.
  31020. *
  31021. * Use of this source code is governed by an MIT-style license that can be
  31022. * found in the LICENSE file at https://angular.io/license
  31023. */
  31024. function createAotUrlResolver(host) {
  31025. return {
  31026. resolve: function (basePath, url) {
  31027. var filePath = host.resourceNameToFileName(url, basePath);
  31028. if (!filePath) {
  31029. throw syntaxError("Couldn't resolve resource " + url + " from " + basePath);
  31030. }
  31031. return filePath;
  31032. }
  31033. };
  31034. }
  31035. /**
  31036. * Creates a new AotCompiler based on options and a host.
  31037. */
  31038. function createAotCompiler(compilerHost, options, errorCollector) {
  31039. var translations = options.translations || '';
  31040. var urlResolver = createAotUrlResolver(compilerHost);
  31041. var symbolCache = new StaticSymbolCache();
  31042. var summaryResolver = new AotSummaryResolver(compilerHost, symbolCache);
  31043. var symbolResolver = new StaticSymbolResolver(compilerHost, symbolCache, summaryResolver);
  31044. var staticReflector = new StaticReflector(summaryResolver, symbolResolver, [], [], errorCollector);
  31045. var htmlParser;
  31046. if (!!options.enableIvy) {
  31047. // Ivy handles i18n at the compiler level so we must use a regular parser
  31048. htmlParser = new HtmlParser();
  31049. }
  31050. else {
  31051. htmlParser = new I18NHtmlParser(new HtmlParser(), translations, options.i18nFormat, options.missingTranslation, console);
  31052. }
  31053. var config = new CompilerConfig({
  31054. defaultEncapsulation: ViewEncapsulation.Emulated,
  31055. useJit: false,
  31056. missingTranslation: options.missingTranslation,
  31057. preserveWhitespaces: options.preserveWhitespaces,
  31058. strictInjectionParameters: options.strictInjectionParameters,
  31059. });
  31060. var normalizer = new DirectiveNormalizer({ get: function (url) { return compilerHost.loadResource(url); } }, urlResolver, htmlParser, config);
  31061. var expressionParser = new Parser(new Lexer());
  31062. var elementSchemaRegistry = new DomElementSchemaRegistry();
  31063. var tmplParser = new TemplateParser(config, staticReflector, expressionParser, elementSchemaRegistry, htmlParser, console, []);
  31064. var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector, errorCollector);
  31065. // TODO(vicb): do not pass options.i18nFormat here
  31066. var viewCompiler = new ViewCompiler(staticReflector);
  31067. var typeCheckCompiler = new TypeCheckCompiler(options, staticReflector);
  31068. var compiler = new AotCompiler(config, options, compilerHost, staticReflector, resolver, tmplParser, new StyleCompiler(urlResolver), viewCompiler, typeCheckCompiler, new NgModuleCompiler(staticReflector), new InjectableCompiler(staticReflector, !!options.enableIvy), new TypeScriptEmitter(), summaryResolver, symbolResolver);
  31069. return { compiler: compiler, reflector: staticReflector };
  31070. }
  31071. var SummaryResolver = /** @class */ (function () {
  31072. function SummaryResolver() {
  31073. }
  31074. return SummaryResolver;
  31075. }());
  31076. var JitSummaryResolver = /** @class */ (function () {
  31077. function JitSummaryResolver() {
  31078. this._summaries = new Map();
  31079. }
  31080. JitSummaryResolver.prototype.isLibraryFile = function () { return false; };
  31081. JitSummaryResolver.prototype.toSummaryFileName = function (fileName) { return fileName; };
  31082. JitSummaryResolver.prototype.fromSummaryFileName = function (fileName) { return fileName; };
  31083. JitSummaryResolver.prototype.resolveSummary = function (reference) {
  31084. return this._summaries.get(reference) || null;
  31085. };
  31086. JitSummaryResolver.prototype.getSymbolsOf = function () { return []; };
  31087. JitSummaryResolver.prototype.getImportAs = function (reference) { return reference; };
  31088. JitSummaryResolver.prototype.getKnownModuleName = function (fileName) { return null; };
  31089. JitSummaryResolver.prototype.addSummary = function (summary) { this._summaries.set(summary.symbol, summary); };
  31090. return JitSummaryResolver;
  31091. }());
  31092. /**
  31093. * @license
  31094. * Copyright Google Inc. All Rights Reserved.
  31095. *
  31096. * Use of this source code is governed by an MIT-style license that can be
  31097. * found in the LICENSE file at https://angular.io/license
  31098. */
  31099. function interpretStatements(statements, reflector) {
  31100. var ctx = new _ExecutionContext(null, null, null, new Map());
  31101. var visitor = new StatementInterpreter(reflector);
  31102. visitor.visitAllStatements(statements, ctx);
  31103. var result = {};
  31104. ctx.exports.forEach(function (exportName) { result[exportName] = ctx.vars.get(exportName); });
  31105. return result;
  31106. }
  31107. function _executeFunctionStatements(varNames, varValues, statements, ctx, visitor) {
  31108. var childCtx = ctx.createChildWihtLocalVars();
  31109. for (var i = 0; i < varNames.length; i++) {
  31110. childCtx.vars.set(varNames[i], varValues[i]);
  31111. }
  31112. var result = visitor.visitAllStatements(statements, childCtx);
  31113. return result ? result.value : null;
  31114. }
  31115. var _ExecutionContext = /** @class */ (function () {
  31116. function _ExecutionContext(parent, instance, className, vars) {
  31117. this.parent = parent;
  31118. this.instance = instance;
  31119. this.className = className;
  31120. this.vars = vars;
  31121. this.exports = [];
  31122. }
  31123. _ExecutionContext.prototype.createChildWihtLocalVars = function () {
  31124. return new _ExecutionContext(this, this.instance, this.className, new Map());
  31125. };
  31126. return _ExecutionContext;
  31127. }());
  31128. var ReturnValue = /** @class */ (function () {
  31129. function ReturnValue(value) {
  31130. this.value = value;
  31131. }
  31132. return ReturnValue;
  31133. }());
  31134. function createDynamicClass(_classStmt, _ctx, _visitor) {
  31135. var propertyDescriptors = {};
  31136. _classStmt.getters.forEach(function (getter) {
  31137. // Note: use `function` instead of arrow function to capture `this`
  31138. propertyDescriptors[getter.name] = {
  31139. configurable: false,
  31140. get: function () {
  31141. var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
  31142. return _executeFunctionStatements([], [], getter.body, instanceCtx, _visitor);
  31143. }
  31144. };
  31145. });
  31146. _classStmt.methods.forEach(function (method) {
  31147. var paramNames = method.params.map(function (param) { return param.name; });
  31148. // Note: use `function` instead of arrow function to capture `this`
  31149. propertyDescriptors[method.name] = {
  31150. writable: false,
  31151. configurable: false,
  31152. value: function () {
  31153. var args = [];
  31154. for (var _i = 0; _i < arguments.length; _i++) {
  31155. args[_i] = arguments[_i];
  31156. }
  31157. var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
  31158. return _executeFunctionStatements(paramNames, args, method.body, instanceCtx, _visitor);
  31159. }
  31160. };
  31161. });
  31162. var ctorParamNames = _classStmt.constructorMethod.params.map(function (param) { return param.name; });
  31163. // Note: use `function` instead of arrow function to capture `this`
  31164. var ctor = function () {
  31165. var _this = this;
  31166. var args = [];
  31167. for (var _i = 0; _i < arguments.length; _i++) {
  31168. args[_i] = arguments[_i];
  31169. }
  31170. var instanceCtx = new _ExecutionContext(_ctx, this, _classStmt.name, _ctx.vars);
  31171. _classStmt.fields.forEach(function (field) { _this[field.name] = undefined; });
  31172. _executeFunctionStatements(ctorParamNames, args, _classStmt.constructorMethod.body, instanceCtx, _visitor);
  31173. };
  31174. var superClass = _classStmt.parent ? _classStmt.parent.visitExpression(_visitor, _ctx) : Object;
  31175. ctor.prototype = Object.create(superClass.prototype, propertyDescriptors);
  31176. return ctor;
  31177. }
  31178. var StatementInterpreter = /** @class */ (function () {
  31179. function StatementInterpreter(reflector) {
  31180. this.reflector = reflector;
  31181. }
  31182. StatementInterpreter.prototype.debugAst = function (ast) { return debugOutputAstAsTypeScript(ast); };
  31183. StatementInterpreter.prototype.visitDeclareVarStmt = function (stmt, ctx) {
  31184. var initialValue = stmt.value ? stmt.value.visitExpression(this, ctx) : undefined;
  31185. ctx.vars.set(stmt.name, initialValue);
  31186. if (stmt.hasModifier(StmtModifier.Exported)) {
  31187. ctx.exports.push(stmt.name);
  31188. }
  31189. return null;
  31190. };
  31191. StatementInterpreter.prototype.visitWriteVarExpr = function (expr, ctx) {
  31192. var value = expr.value.visitExpression(this, ctx);
  31193. var currCtx = ctx;
  31194. while (currCtx != null) {
  31195. if (currCtx.vars.has(expr.name)) {
  31196. currCtx.vars.set(expr.name, value);
  31197. return value;
  31198. }
  31199. currCtx = currCtx.parent;
  31200. }
  31201. throw new Error("Not declared variable " + expr.name);
  31202. };
  31203. StatementInterpreter.prototype.visitWrappedNodeExpr = function (ast, ctx) {
  31204. throw new Error('Cannot interpret a WrappedNodeExpr.');
  31205. };
  31206. StatementInterpreter.prototype.visitTypeofExpr = function (ast, ctx) {
  31207. throw new Error('Cannot interpret a TypeofExpr');
  31208. };
  31209. StatementInterpreter.prototype.visitReadVarExpr = function (ast, ctx) {
  31210. var varName = ast.name;
  31211. if (ast.builtin != null) {
  31212. switch (ast.builtin) {
  31213. case BuiltinVar.Super:
  31214. return ctx.instance.__proto__;
  31215. case BuiltinVar.This:
  31216. return ctx.instance;
  31217. case BuiltinVar.CatchError:
  31218. varName = CATCH_ERROR_VAR$2;
  31219. break;
  31220. case BuiltinVar.CatchStack:
  31221. varName = CATCH_STACK_VAR$2;
  31222. break;
  31223. default:
  31224. throw new Error("Unknown builtin variable " + ast.builtin);
  31225. }
  31226. }
  31227. var currCtx = ctx;
  31228. while (currCtx != null) {
  31229. if (currCtx.vars.has(varName)) {
  31230. return currCtx.vars.get(varName);
  31231. }
  31232. currCtx = currCtx.parent;
  31233. }
  31234. throw new Error("Not declared variable " + varName);
  31235. };
  31236. StatementInterpreter.prototype.visitWriteKeyExpr = function (expr, ctx) {
  31237. var receiver = expr.receiver.visitExpression(this, ctx);
  31238. var index = expr.index.visitExpression(this, ctx);
  31239. var value = expr.value.visitExpression(this, ctx);
  31240. receiver[index] = value;
  31241. return value;
  31242. };
  31243. StatementInterpreter.prototype.visitWritePropExpr = function (expr, ctx) {
  31244. var receiver = expr.receiver.visitExpression(this, ctx);
  31245. var value = expr.value.visitExpression(this, ctx);
  31246. receiver[expr.name] = value;
  31247. return value;
  31248. };
  31249. StatementInterpreter.prototype.visitInvokeMethodExpr = function (expr, ctx) {
  31250. var receiver = expr.receiver.visitExpression(this, ctx);
  31251. var args = this.visitAllExpressions(expr.args, ctx);
  31252. var result;
  31253. if (expr.builtin != null) {
  31254. switch (expr.builtin) {
  31255. case BuiltinMethod.ConcatArray:
  31256. result = receiver.concat.apply(receiver, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args));
  31257. break;
  31258. case BuiltinMethod.SubscribeObservable:
  31259. result = receiver.subscribe({ next: args[0] });
  31260. break;
  31261. case BuiltinMethod.Bind:
  31262. result = receiver.bind.apply(receiver, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args));
  31263. break;
  31264. default:
  31265. throw new Error("Unknown builtin method " + expr.builtin);
  31266. }
  31267. }
  31268. else {
  31269. result = receiver[expr.name].apply(receiver, args);
  31270. }
  31271. return result;
  31272. };
  31273. StatementInterpreter.prototype.visitInvokeFunctionExpr = function (stmt, ctx) {
  31274. var args = this.visitAllExpressions(stmt.args, ctx);
  31275. var fnExpr = stmt.fn;
  31276. if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
  31277. ctx.instance.constructor.prototype.constructor.apply(ctx.instance, args);
  31278. return null;
  31279. }
  31280. else {
  31281. var fn$$1 = stmt.fn.visitExpression(this, ctx);
  31282. return fn$$1.apply(null, args);
  31283. }
  31284. };
  31285. StatementInterpreter.prototype.visitReturnStmt = function (stmt, ctx) {
  31286. return new ReturnValue(stmt.value.visitExpression(this, ctx));
  31287. };
  31288. StatementInterpreter.prototype.visitDeclareClassStmt = function (stmt, ctx) {
  31289. var clazz = createDynamicClass(stmt, ctx, this);
  31290. ctx.vars.set(stmt.name, clazz);
  31291. if (stmt.hasModifier(StmtModifier.Exported)) {
  31292. ctx.exports.push(stmt.name);
  31293. }
  31294. return null;
  31295. };
  31296. StatementInterpreter.prototype.visitExpressionStmt = function (stmt, ctx) {
  31297. return stmt.expr.visitExpression(this, ctx);
  31298. };
  31299. StatementInterpreter.prototype.visitIfStmt = function (stmt, ctx) {
  31300. var condition = stmt.condition.visitExpression(this, ctx);
  31301. if (condition) {
  31302. return this.visitAllStatements(stmt.trueCase, ctx);
  31303. }
  31304. else if (stmt.falseCase != null) {
  31305. return this.visitAllStatements(stmt.falseCase, ctx);
  31306. }
  31307. return null;
  31308. };
  31309. StatementInterpreter.prototype.visitTryCatchStmt = function (stmt, ctx) {
  31310. try {
  31311. return this.visitAllStatements(stmt.bodyStmts, ctx);
  31312. }
  31313. catch (e) {
  31314. var childCtx = ctx.createChildWihtLocalVars();
  31315. childCtx.vars.set(CATCH_ERROR_VAR$2, e);
  31316. childCtx.vars.set(CATCH_STACK_VAR$2, e.stack);
  31317. return this.visitAllStatements(stmt.catchStmts, childCtx);
  31318. }
  31319. };
  31320. StatementInterpreter.prototype.visitThrowStmt = function (stmt, ctx) {
  31321. throw stmt.error.visitExpression(this, ctx);
  31322. };
  31323. StatementInterpreter.prototype.visitCommentStmt = function (stmt, context) { return null; };
  31324. StatementInterpreter.prototype.visitJSDocCommentStmt = function (stmt, context) { return null; };
  31325. StatementInterpreter.prototype.visitInstantiateExpr = function (ast, ctx) {
  31326. var args = this.visitAllExpressions(ast.args, ctx);
  31327. var clazz = ast.classExpr.visitExpression(this, ctx);
  31328. return new (clazz.bind.apply(clazz, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], args)))();
  31329. };
  31330. StatementInterpreter.prototype.visitLiteralExpr = function (ast, ctx) { return ast.value; };
  31331. StatementInterpreter.prototype.visitExternalExpr = function (ast, ctx) {
  31332. return this.reflector.resolveExternalReference(ast.value);
  31333. };
  31334. StatementInterpreter.prototype.visitConditionalExpr = function (ast, ctx) {
  31335. if (ast.condition.visitExpression(this, ctx)) {
  31336. return ast.trueCase.visitExpression(this, ctx);
  31337. }
  31338. else if (ast.falseCase != null) {
  31339. return ast.falseCase.visitExpression(this, ctx);
  31340. }
  31341. return null;
  31342. };
  31343. StatementInterpreter.prototype.visitNotExpr = function (ast, ctx) {
  31344. return !ast.condition.visitExpression(this, ctx);
  31345. };
  31346. StatementInterpreter.prototype.visitAssertNotNullExpr = function (ast, ctx) {
  31347. return ast.condition.visitExpression(this, ctx);
  31348. };
  31349. StatementInterpreter.prototype.visitCastExpr = function (ast, ctx) {
  31350. return ast.value.visitExpression(this, ctx);
  31351. };
  31352. StatementInterpreter.prototype.visitFunctionExpr = function (ast, ctx) {
  31353. var paramNames = ast.params.map(function (param) { return param.name; });
  31354. return _declareFn(paramNames, ast.statements, ctx, this);
  31355. };
  31356. StatementInterpreter.prototype.visitDeclareFunctionStmt = function (stmt, ctx) {
  31357. var paramNames = stmt.params.map(function (param) { return param.name; });
  31358. ctx.vars.set(stmt.name, _declareFn(paramNames, stmt.statements, ctx, this));
  31359. if (stmt.hasModifier(StmtModifier.Exported)) {
  31360. ctx.exports.push(stmt.name);
  31361. }
  31362. return null;
  31363. };
  31364. StatementInterpreter.prototype.visitBinaryOperatorExpr = function (ast, ctx) {
  31365. var _this = this;
  31366. var lhs = function () { return ast.lhs.visitExpression(_this, ctx); };
  31367. var rhs = function () { return ast.rhs.visitExpression(_this, ctx); };
  31368. switch (ast.operator) {
  31369. case BinaryOperator.Equals:
  31370. return lhs() == rhs();
  31371. case BinaryOperator.Identical:
  31372. return lhs() === rhs();
  31373. case BinaryOperator.NotEquals:
  31374. return lhs() != rhs();
  31375. case BinaryOperator.NotIdentical:
  31376. return lhs() !== rhs();
  31377. case BinaryOperator.And:
  31378. return lhs() && rhs();
  31379. case BinaryOperator.Or:
  31380. return lhs() || rhs();
  31381. case BinaryOperator.Plus:
  31382. return lhs() + rhs();
  31383. case BinaryOperator.Minus:
  31384. return lhs() - rhs();
  31385. case BinaryOperator.Divide:
  31386. return lhs() / rhs();
  31387. case BinaryOperator.Multiply:
  31388. return lhs() * rhs();
  31389. case BinaryOperator.Modulo:
  31390. return lhs() % rhs();
  31391. case BinaryOperator.Lower:
  31392. return lhs() < rhs();
  31393. case BinaryOperator.LowerEquals:
  31394. return lhs() <= rhs();
  31395. case BinaryOperator.Bigger:
  31396. return lhs() > rhs();
  31397. case BinaryOperator.BiggerEquals:
  31398. return lhs() >= rhs();
  31399. default:
  31400. throw new Error("Unknown operator " + ast.operator);
  31401. }
  31402. };
  31403. StatementInterpreter.prototype.visitReadPropExpr = function (ast, ctx) {
  31404. var result;
  31405. var receiver = ast.receiver.visitExpression(this, ctx);
  31406. result = receiver[ast.name];
  31407. return result;
  31408. };
  31409. StatementInterpreter.prototype.visitReadKeyExpr = function (ast, ctx) {
  31410. var receiver = ast.receiver.visitExpression(this, ctx);
  31411. var prop = ast.index.visitExpression(this, ctx);
  31412. return receiver[prop];
  31413. };
  31414. StatementInterpreter.prototype.visitLiteralArrayExpr = function (ast, ctx) {
  31415. return this.visitAllExpressions(ast.entries, ctx);
  31416. };
  31417. StatementInterpreter.prototype.visitLiteralMapExpr = function (ast, ctx) {
  31418. var _this = this;
  31419. var result = {};
  31420. ast.entries.forEach(function (entry) { return result[entry.key] = entry.value.visitExpression(_this, ctx); });
  31421. return result;
  31422. };
  31423. StatementInterpreter.prototype.visitCommaExpr = function (ast, context) {
  31424. var values = this.visitAllExpressions(ast.parts, context);
  31425. return values[values.length - 1];
  31426. };
  31427. StatementInterpreter.prototype.visitAllExpressions = function (expressions, ctx) {
  31428. var _this = this;
  31429. return expressions.map(function (expr) { return expr.visitExpression(_this, ctx); });
  31430. };
  31431. StatementInterpreter.prototype.visitAllStatements = function (statements, ctx) {
  31432. for (var i = 0; i < statements.length; i++) {
  31433. var stmt = statements[i];
  31434. var val = stmt.visitStatement(this, ctx);
  31435. if (val instanceof ReturnValue) {
  31436. return val;
  31437. }
  31438. }
  31439. return null;
  31440. };
  31441. return StatementInterpreter;
  31442. }());
  31443. function _declareFn(varNames, statements, ctx, visitor) {
  31444. return function () {
  31445. var args = [];
  31446. for (var _i = 0; _i < arguments.length; _i++) {
  31447. args[_i] = arguments[_i];
  31448. }
  31449. return _executeFunctionStatements(varNames, args, statements, ctx, visitor);
  31450. };
  31451. }
  31452. var CATCH_ERROR_VAR$2 = 'error';
  31453. var CATCH_STACK_VAR$2 = 'stack';
  31454. /**
  31455. * @license
  31456. * Copyright Google Inc. All Rights Reserved.
  31457. *
  31458. * Use of this source code is governed by an MIT-style license that can be
  31459. * found in the LICENSE file at https://angular.io/license
  31460. */
  31461. var AbstractJsEmitterVisitor = /** @class */ (function (_super) {
  31462. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AbstractJsEmitterVisitor, _super);
  31463. function AbstractJsEmitterVisitor() {
  31464. return _super.call(this, false) || this;
  31465. }
  31466. AbstractJsEmitterVisitor.prototype.visitDeclareClassStmt = function (stmt, ctx) {
  31467. var _this = this;
  31468. ctx.pushClass(stmt);
  31469. this._visitClassConstructor(stmt, ctx);
  31470. if (stmt.parent != null) {
  31471. ctx.print(stmt, stmt.name + ".prototype = Object.create(");
  31472. stmt.parent.visitExpression(this, ctx);
  31473. ctx.println(stmt, ".prototype);");
  31474. }
  31475. stmt.getters.forEach(function (getter) { return _this._visitClassGetter(stmt, getter, ctx); });
  31476. stmt.methods.forEach(function (method) { return _this._visitClassMethod(stmt, method, ctx); });
  31477. ctx.popClass();
  31478. return null;
  31479. };
  31480. AbstractJsEmitterVisitor.prototype._visitClassConstructor = function (stmt, ctx) {
  31481. ctx.print(stmt, "function " + stmt.name + "(");
  31482. if (stmt.constructorMethod != null) {
  31483. this._visitParams(stmt.constructorMethod.params, ctx);
  31484. }
  31485. ctx.println(stmt, ") {");
  31486. ctx.incIndent();
  31487. if (stmt.constructorMethod != null) {
  31488. if (stmt.constructorMethod.body.length > 0) {
  31489. ctx.println(stmt, "var self = this;");
  31490. this.visitAllStatements(stmt.constructorMethod.body, ctx);
  31491. }
  31492. }
  31493. ctx.decIndent();
  31494. ctx.println(stmt, "}");
  31495. };
  31496. AbstractJsEmitterVisitor.prototype._visitClassGetter = function (stmt, getter, ctx) {
  31497. ctx.println(stmt, "Object.defineProperty(" + stmt.name + ".prototype, '" + getter.name + "', { get: function() {");
  31498. ctx.incIndent();
  31499. if (getter.body.length > 0) {
  31500. ctx.println(stmt, "var self = this;");
  31501. this.visitAllStatements(getter.body, ctx);
  31502. }
  31503. ctx.decIndent();
  31504. ctx.println(stmt, "}});");
  31505. };
  31506. AbstractJsEmitterVisitor.prototype._visitClassMethod = function (stmt, method, ctx) {
  31507. ctx.print(stmt, stmt.name + ".prototype." + method.name + " = function(");
  31508. this._visitParams(method.params, ctx);
  31509. ctx.println(stmt, ") {");
  31510. ctx.incIndent();
  31511. if (method.body.length > 0) {
  31512. ctx.println(stmt, "var self = this;");
  31513. this.visitAllStatements(method.body, ctx);
  31514. }
  31515. ctx.decIndent();
  31516. ctx.println(stmt, "};");
  31517. };
  31518. AbstractJsEmitterVisitor.prototype.visitWrappedNodeExpr = function (ast, ctx) {
  31519. throw new Error('Cannot emit a WrappedNodeExpr in Javascript.');
  31520. };
  31521. AbstractJsEmitterVisitor.prototype.visitReadVarExpr = function (ast, ctx) {
  31522. if (ast.builtin === BuiltinVar.This) {
  31523. ctx.print(ast, 'self');
  31524. }
  31525. else if (ast.builtin === BuiltinVar.Super) {
  31526. throw new Error("'super' needs to be handled at a parent ast node, not at the variable level!");
  31527. }
  31528. else {
  31529. _super.prototype.visitReadVarExpr.call(this, ast, ctx);
  31530. }
  31531. return null;
  31532. };
  31533. AbstractJsEmitterVisitor.prototype.visitDeclareVarStmt = function (stmt, ctx) {
  31534. ctx.print(stmt, "var " + stmt.name);
  31535. if (stmt.value) {
  31536. ctx.print(stmt, ' = ');
  31537. stmt.value.visitExpression(this, ctx);
  31538. }
  31539. ctx.println(stmt, ";");
  31540. return null;
  31541. };
  31542. AbstractJsEmitterVisitor.prototype.visitCastExpr = function (ast, ctx) {
  31543. ast.value.visitExpression(this, ctx);
  31544. return null;
  31545. };
  31546. AbstractJsEmitterVisitor.prototype.visitInvokeFunctionExpr = function (expr, ctx) {
  31547. var fnExpr = expr.fn;
  31548. if (fnExpr instanceof ReadVarExpr && fnExpr.builtin === BuiltinVar.Super) {
  31549. ctx.currentClass.parent.visitExpression(this, ctx);
  31550. ctx.print(expr, ".call(this");
  31551. if (expr.args.length > 0) {
  31552. ctx.print(expr, ", ");
  31553. this.visitAllExpressions(expr.args, ctx, ',');
  31554. }
  31555. ctx.print(expr, ")");
  31556. }
  31557. else {
  31558. _super.prototype.visitInvokeFunctionExpr.call(this, expr, ctx);
  31559. }
  31560. return null;
  31561. };
  31562. AbstractJsEmitterVisitor.prototype.visitFunctionExpr = function (ast, ctx) {
  31563. ctx.print(ast, "function" + (ast.name ? ' ' + ast.name : '') + "(");
  31564. this._visitParams(ast.params, ctx);
  31565. ctx.println(ast, ") {");
  31566. ctx.incIndent();
  31567. this.visitAllStatements(ast.statements, ctx);
  31568. ctx.decIndent();
  31569. ctx.print(ast, "}");
  31570. return null;
  31571. };
  31572. AbstractJsEmitterVisitor.prototype.visitDeclareFunctionStmt = function (stmt, ctx) {
  31573. ctx.print(stmt, "function " + stmt.name + "(");
  31574. this._visitParams(stmt.params, ctx);
  31575. ctx.println(stmt, ") {");
  31576. ctx.incIndent();
  31577. this.visitAllStatements(stmt.statements, ctx);
  31578. ctx.decIndent();
  31579. ctx.println(stmt, "}");
  31580. return null;
  31581. };
  31582. AbstractJsEmitterVisitor.prototype.visitTryCatchStmt = function (stmt, ctx) {
  31583. ctx.println(stmt, "try {");
  31584. ctx.incIndent();
  31585. this.visitAllStatements(stmt.bodyStmts, ctx);
  31586. ctx.decIndent();
  31587. ctx.println(stmt, "} catch (" + CATCH_ERROR_VAR$1.name + ") {");
  31588. ctx.incIndent();
  31589. var catchStmts = [CATCH_STACK_VAR$1.set(CATCH_ERROR_VAR$1.prop('stack')).toDeclStmt(null, [
  31590. StmtModifier.Final
  31591. ])].concat(stmt.catchStmts);
  31592. this.visitAllStatements(catchStmts, ctx);
  31593. ctx.decIndent();
  31594. ctx.println(stmt, "}");
  31595. return null;
  31596. };
  31597. AbstractJsEmitterVisitor.prototype._visitParams = function (params, ctx) {
  31598. this.visitAllObjects(function (param) { return ctx.print(null, param.name); }, params, ctx, ',');
  31599. };
  31600. AbstractJsEmitterVisitor.prototype.getBuiltinMethodName = function (method) {
  31601. var name;
  31602. switch (method) {
  31603. case BuiltinMethod.ConcatArray:
  31604. name = 'concat';
  31605. break;
  31606. case BuiltinMethod.SubscribeObservable:
  31607. name = 'subscribe';
  31608. break;
  31609. case BuiltinMethod.Bind:
  31610. name = 'bind';
  31611. break;
  31612. default:
  31613. throw new Error("Unknown builtin method: " + method);
  31614. }
  31615. return name;
  31616. };
  31617. return AbstractJsEmitterVisitor;
  31618. }(AbstractEmitterVisitor));
  31619. /**
  31620. * @license
  31621. * Copyright Google Inc. All Rights Reserved.
  31622. *
  31623. * Use of this source code is governed by an MIT-style license that can be
  31624. * found in the LICENSE file at https://angular.io/license
  31625. */
  31626. function evalExpression(sourceUrl, ctx, vars, createSourceMap) {
  31627. var fnBody = ctx.toSource() + "\n//# sourceURL=" + sourceUrl;
  31628. var fnArgNames = [];
  31629. var fnArgValues = [];
  31630. for (var argName in vars) {
  31631. fnArgNames.push(argName);
  31632. fnArgValues.push(vars[argName]);
  31633. }
  31634. if (createSourceMap) {
  31635. // using `new Function(...)` generates a header, 1 line of no arguments, 2 lines otherwise
  31636. // E.g. ```
  31637. // function anonymous(a,b,c
  31638. // /**/) { ... }```
  31639. // We don't want to hard code this fact, so we auto detect it via an empty function first.
  31640. var emptyFn = new (Function.bind.apply(Function, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], fnArgNames.concat('return null;'))))().toString();
  31641. var headerLines = emptyFn.slice(0, emptyFn.indexOf('return null;')).split('\n').length - 1;
  31642. fnBody += "\n" + ctx.toSourceMapGenerator(sourceUrl, headerLines).toJsComment();
  31643. }
  31644. return new (Function.bind.apply(Function, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], fnArgNames.concat(fnBody))))().apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(fnArgValues));
  31645. }
  31646. function jitStatements(sourceUrl, statements, reflector, createSourceMaps) {
  31647. var converter = new JitEmitterVisitor(reflector);
  31648. var ctx = EmitterVisitorContext.createRoot();
  31649. converter.visitAllStatements(statements, ctx);
  31650. converter.createReturnStmt(ctx);
  31651. return evalExpression(sourceUrl, ctx, converter.getArgs(), createSourceMaps);
  31652. }
  31653. var JitEmitterVisitor = /** @class */ (function (_super) {
  31654. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(JitEmitterVisitor, _super);
  31655. function JitEmitterVisitor(reflector) {
  31656. var _this = _super.call(this) || this;
  31657. _this.reflector = reflector;
  31658. _this._evalArgNames = [];
  31659. _this._evalArgValues = [];
  31660. _this._evalExportedVars = [];
  31661. return _this;
  31662. }
  31663. JitEmitterVisitor.prototype.createReturnStmt = function (ctx) {
  31664. var stmt = new ReturnStatement(new LiteralMapExpr(this._evalExportedVars.map(function (resultVar) { return new LiteralMapEntry(resultVar, variable(resultVar), false); })));
  31665. stmt.visitStatement(this, ctx);
  31666. };
  31667. JitEmitterVisitor.prototype.getArgs = function () {
  31668. var result = {};
  31669. for (var i = 0; i < this._evalArgNames.length; i++) {
  31670. result[this._evalArgNames[i]] = this._evalArgValues[i];
  31671. }
  31672. return result;
  31673. };
  31674. JitEmitterVisitor.prototype.visitExternalExpr = function (ast, ctx) {
  31675. this._emitReferenceToExternal(ast, this.reflector.resolveExternalReference(ast.value), ctx);
  31676. return null;
  31677. };
  31678. JitEmitterVisitor.prototype.visitWrappedNodeExpr = function (ast, ctx) {
  31679. this._emitReferenceToExternal(ast, ast.node, ctx);
  31680. return null;
  31681. };
  31682. JitEmitterVisitor.prototype.visitDeclareVarStmt = function (stmt, ctx) {
  31683. if (stmt.hasModifier(StmtModifier.Exported)) {
  31684. this._evalExportedVars.push(stmt.name);
  31685. }
  31686. return _super.prototype.visitDeclareVarStmt.call(this, stmt, ctx);
  31687. };
  31688. JitEmitterVisitor.prototype.visitDeclareFunctionStmt = function (stmt, ctx) {
  31689. if (stmt.hasModifier(StmtModifier.Exported)) {
  31690. this._evalExportedVars.push(stmt.name);
  31691. }
  31692. return _super.prototype.visitDeclareFunctionStmt.call(this, stmt, ctx);
  31693. };
  31694. JitEmitterVisitor.prototype.visitDeclareClassStmt = function (stmt, ctx) {
  31695. if (stmt.hasModifier(StmtModifier.Exported)) {
  31696. this._evalExportedVars.push(stmt.name);
  31697. }
  31698. return _super.prototype.visitDeclareClassStmt.call(this, stmt, ctx);
  31699. };
  31700. JitEmitterVisitor.prototype._emitReferenceToExternal = function (ast, value, ctx) {
  31701. var id = this._evalArgValues.indexOf(value);
  31702. if (id === -1) {
  31703. id = this._evalArgValues.length;
  31704. this._evalArgValues.push(value);
  31705. var name_1 = identifierName({ reference: value }) || 'val';
  31706. this._evalArgNames.push("jit_" + name_1 + "_" + id);
  31707. }
  31708. ctx.print(ast, this._evalArgNames[id]);
  31709. };
  31710. return JitEmitterVisitor;
  31711. }(AbstractJsEmitterVisitor));
  31712. /**
  31713. * @license
  31714. * Copyright Google Inc. All Rights Reserved.
  31715. *
  31716. * Use of this source code is governed by an MIT-style license that can be
  31717. * found in the LICENSE file at https://angular.io/license
  31718. */
  31719. /**
  31720. * An internal module of the Angular compiler that begins with component types,
  31721. * extracts templates, and eventually produces a compiled version of the component
  31722. * ready for linking into an application.
  31723. *
  31724. * @security When compiling templates at runtime, you must ensure that the entire template comes
  31725. * from a trusted source. Attacker-controlled data introduced by a template could expose your
  31726. * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
  31727. */
  31728. var JitCompiler = /** @class */ (function () {
  31729. function JitCompiler(_metadataResolver, _templateParser, _styleCompiler, _viewCompiler, _ngModuleCompiler, _summaryResolver, _reflector, _compilerConfig, _console, getExtraNgModuleProviders) {
  31730. this._metadataResolver = _metadataResolver;
  31731. this._templateParser = _templateParser;
  31732. this._styleCompiler = _styleCompiler;
  31733. this._viewCompiler = _viewCompiler;
  31734. this._ngModuleCompiler = _ngModuleCompiler;
  31735. this._summaryResolver = _summaryResolver;
  31736. this._reflector = _reflector;
  31737. this._compilerConfig = _compilerConfig;
  31738. this._console = _console;
  31739. this.getExtraNgModuleProviders = getExtraNgModuleProviders;
  31740. this._compiledTemplateCache = new Map();
  31741. this._compiledHostTemplateCache = new Map();
  31742. this._compiledDirectiveWrapperCache = new Map();
  31743. this._compiledNgModuleCache = new Map();
  31744. this._sharedStylesheetCount = 0;
  31745. this._addedAotSummaries = new Set();
  31746. }
  31747. JitCompiler.prototype.compileModuleSync = function (moduleType) {
  31748. return SyncAsync.assertSync(this._compileModuleAndComponents(moduleType, true));
  31749. };
  31750. JitCompiler.prototype.compileModuleAsync = function (moduleType) {
  31751. return Promise.resolve(this._compileModuleAndComponents(moduleType, false));
  31752. };
  31753. JitCompiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
  31754. return SyncAsync.assertSync(this._compileModuleAndAllComponents(moduleType, true));
  31755. };
  31756. JitCompiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
  31757. return Promise.resolve(this._compileModuleAndAllComponents(moduleType, false));
  31758. };
  31759. JitCompiler.prototype.getComponentFactory = function (component) {
  31760. var summary = this._metadataResolver.getDirectiveSummary(component);
  31761. return summary.componentFactory;
  31762. };
  31763. JitCompiler.prototype.loadAotSummaries = function (summaries) {
  31764. this.clearCache();
  31765. this._addAotSummaries(summaries);
  31766. };
  31767. JitCompiler.prototype._addAotSummaries = function (fn$$1) {
  31768. if (this._addedAotSummaries.has(fn$$1)) {
  31769. return;
  31770. }
  31771. this._addedAotSummaries.add(fn$$1);
  31772. var summaries = fn$$1();
  31773. for (var i = 0; i < summaries.length; i++) {
  31774. var entry = summaries[i];
  31775. if (typeof entry === 'function') {
  31776. this._addAotSummaries(entry);
  31777. }
  31778. else {
  31779. var summary = entry;
  31780. this._summaryResolver.addSummary({ symbol: summary.type.reference, metadata: null, type: summary });
  31781. }
  31782. }
  31783. };
  31784. JitCompiler.prototype.hasAotSummary = function (ref) { return !!this._summaryResolver.resolveSummary(ref); };
  31785. JitCompiler.prototype._filterJitIdentifiers = function (ids) {
  31786. var _this = this;
  31787. return ids.map(function (mod) { return mod.reference; }).filter(function (ref) { return !_this.hasAotSummary(ref); });
  31788. };
  31789. JitCompiler.prototype._compileModuleAndComponents = function (moduleType, isSync) {
  31790. var _this = this;
  31791. return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
  31792. _this._compileComponents(moduleType, null);
  31793. return _this._compileModule(moduleType);
  31794. });
  31795. };
  31796. JitCompiler.prototype._compileModuleAndAllComponents = function (moduleType, isSync) {
  31797. var _this = this;
  31798. return SyncAsync.then(this._loadModules(moduleType, isSync), function () {
  31799. var componentFactories = [];
  31800. _this._compileComponents(moduleType, componentFactories);
  31801. return {
  31802. ngModuleFactory: _this._compileModule(moduleType),
  31803. componentFactories: componentFactories
  31804. };
  31805. });
  31806. };
  31807. JitCompiler.prototype._loadModules = function (mainModule, isSync) {
  31808. var _this = this;
  31809. var loading = [];
  31810. var mainNgModule = this._metadataResolver.getNgModuleMetadata(mainModule);
  31811. // Note: for runtime compilation, we want to transitively compile all modules,
  31812. // so we also need to load the declared directives / pipes for all nested modules.
  31813. this._filterJitIdentifiers(mainNgModule.transitiveModule.modules).forEach(function (nestedNgModule) {
  31814. // getNgModuleMetadata only returns null if the value passed in is not an NgModule
  31815. var moduleMeta = _this._metadataResolver.getNgModuleMetadata(nestedNgModule);
  31816. _this._filterJitIdentifiers(moduleMeta.declaredDirectives).forEach(function (ref) {
  31817. var promise = _this._metadataResolver.loadDirectiveMetadata(moduleMeta.type.reference, ref, isSync);
  31818. if (promise) {
  31819. loading.push(promise);
  31820. }
  31821. });
  31822. _this._filterJitIdentifiers(moduleMeta.declaredPipes)
  31823. .forEach(function (ref) { return _this._metadataResolver.getOrLoadPipeMetadata(ref); });
  31824. });
  31825. return SyncAsync.all(loading);
  31826. };
  31827. JitCompiler.prototype._compileModule = function (moduleType) {
  31828. var ngModuleFactory = this._compiledNgModuleCache.get(moduleType);
  31829. if (!ngModuleFactory) {
  31830. var moduleMeta = this._metadataResolver.getNgModuleMetadata(moduleType);
  31831. // Always provide a bound Compiler
  31832. var extraProviders = this.getExtraNgModuleProviders(moduleMeta.type.reference);
  31833. var outputCtx = createOutputContext();
  31834. var compileResult = this._ngModuleCompiler.compile(outputCtx, moduleMeta, extraProviders);
  31835. ngModuleFactory = this._interpretOrJit(ngModuleJitUrl(moduleMeta), outputCtx.statements)[compileResult.ngModuleFactoryVar];
  31836. this._compiledNgModuleCache.set(moduleMeta.type.reference, ngModuleFactory);
  31837. }
  31838. return ngModuleFactory;
  31839. };
  31840. /**
  31841. * @internal
  31842. */
  31843. JitCompiler.prototype._compileComponents = function (mainModule, allComponentFactories) {
  31844. var _this = this;
  31845. var ngModule = this._metadataResolver.getNgModuleMetadata(mainModule);
  31846. var moduleByJitDirective = new Map();
  31847. var templates = new Set();
  31848. var transJitModules = this._filterJitIdentifiers(ngModule.transitiveModule.modules);
  31849. transJitModules.forEach(function (localMod) {
  31850. var localModuleMeta = _this._metadataResolver.getNgModuleMetadata(localMod);
  31851. _this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
  31852. moduleByJitDirective.set(dirRef, localModuleMeta);
  31853. var dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
  31854. if (dirMeta.isComponent) {
  31855. templates.add(_this._createCompiledTemplate(dirMeta, localModuleMeta));
  31856. if (allComponentFactories) {
  31857. var template = _this._createCompiledHostTemplate(dirMeta.type.reference, localModuleMeta);
  31858. templates.add(template);
  31859. allComponentFactories.push(dirMeta.componentFactory);
  31860. }
  31861. }
  31862. });
  31863. });
  31864. transJitModules.forEach(function (localMod) {
  31865. var localModuleMeta = _this._metadataResolver.getNgModuleMetadata(localMod);
  31866. _this._filterJitIdentifiers(localModuleMeta.declaredDirectives).forEach(function (dirRef) {
  31867. var dirMeta = _this._metadataResolver.getDirectiveMetadata(dirRef);
  31868. if (dirMeta.isComponent) {
  31869. dirMeta.entryComponents.forEach(function (entryComponentType) {
  31870. var moduleMeta = moduleByJitDirective.get(entryComponentType.componentType);
  31871. templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
  31872. });
  31873. }
  31874. });
  31875. localModuleMeta.entryComponents.forEach(function (entryComponentType) {
  31876. if (!_this.hasAotSummary(entryComponentType.componentType)) {
  31877. var moduleMeta = moduleByJitDirective.get(entryComponentType.componentType);
  31878. templates.add(_this._createCompiledHostTemplate(entryComponentType.componentType, moduleMeta));
  31879. }
  31880. });
  31881. });
  31882. templates.forEach(function (template) { return _this._compileTemplate(template); });
  31883. };
  31884. JitCompiler.prototype.clearCacheFor = function (type) {
  31885. this._compiledNgModuleCache.delete(type);
  31886. this._metadataResolver.clearCacheFor(type);
  31887. this._compiledHostTemplateCache.delete(type);
  31888. var compiledTemplate = this._compiledTemplateCache.get(type);
  31889. if (compiledTemplate) {
  31890. this._compiledTemplateCache.delete(type);
  31891. }
  31892. };
  31893. JitCompiler.prototype.clearCache = function () {
  31894. // Note: don't clear the _addedAotSummaries, as they don't change!
  31895. this._metadataResolver.clearCache();
  31896. this._compiledTemplateCache.clear();
  31897. this._compiledHostTemplateCache.clear();
  31898. this._compiledNgModuleCache.clear();
  31899. };
  31900. JitCompiler.prototype._createCompiledHostTemplate = function (compType, ngModule) {
  31901. if (!ngModule) {
  31902. throw new Error("Component " + stringify(compType) + " is not part of any NgModule or the module has not been imported into your module.");
  31903. }
  31904. var compiledTemplate = this._compiledHostTemplateCache.get(compType);
  31905. if (!compiledTemplate) {
  31906. var compMeta = this._metadataResolver.getDirectiveMetadata(compType);
  31907. assertComponent(compMeta);
  31908. var hostMeta = this._metadataResolver.getHostComponentMetadata(compMeta, compMeta.componentFactory.viewDefFactory);
  31909. compiledTemplate =
  31910. new CompiledTemplate(true, compMeta.type, hostMeta, ngModule, [compMeta.type]);
  31911. this._compiledHostTemplateCache.set(compType, compiledTemplate);
  31912. }
  31913. return compiledTemplate;
  31914. };
  31915. JitCompiler.prototype._createCompiledTemplate = function (compMeta, ngModule) {
  31916. var compiledTemplate = this._compiledTemplateCache.get(compMeta.type.reference);
  31917. if (!compiledTemplate) {
  31918. assertComponent(compMeta);
  31919. compiledTemplate = new CompiledTemplate(false, compMeta.type, compMeta, ngModule, ngModule.transitiveModule.directives);
  31920. this._compiledTemplateCache.set(compMeta.type.reference, compiledTemplate);
  31921. }
  31922. return compiledTemplate;
  31923. };
  31924. JitCompiler.prototype._compileTemplate = function (template) {
  31925. var _this = this;
  31926. if (template.isCompiled) {
  31927. return;
  31928. }
  31929. var compMeta = template.compMeta;
  31930. var externalStylesheetsByModuleUrl = new Map();
  31931. var outputContext = createOutputContext();
  31932. var componentStylesheet = this._styleCompiler.compileComponent(outputContext, compMeta);
  31933. compMeta.template.externalStylesheets.forEach(function (stylesheetMeta) {
  31934. var compiledStylesheet = _this._styleCompiler.compileStyles(createOutputContext(), compMeta, stylesheetMeta);
  31935. externalStylesheetsByModuleUrl.set(stylesheetMeta.moduleUrl, compiledStylesheet);
  31936. });
  31937. this._resolveStylesCompileResult(componentStylesheet, externalStylesheetsByModuleUrl);
  31938. var pipes = template.ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  31939. var _a = this._parseTemplate(compMeta, template.ngModule, template.directives), parsedTemplate = _a.template, usedPipes = _a.pipes;
  31940. var compileResult = this._viewCompiler.compileComponent(outputContext, compMeta, parsedTemplate, variable(componentStylesheet.stylesVar), usedPipes);
  31941. var evalResult = this._interpretOrJit(templateJitUrl(template.ngModule.type, template.compMeta), outputContext.statements);
  31942. var viewClass = evalResult[compileResult.viewClassVar];
  31943. var rendererType = evalResult[compileResult.rendererTypeVar];
  31944. template.compiled(viewClass, rendererType);
  31945. };
  31946. JitCompiler.prototype._parseTemplate = function (compMeta, ngModule, directiveIdentifiers) {
  31947. var _this = this;
  31948. // Note: ! is ok here as components always have a template.
  31949. var preserveWhitespaces = compMeta.template.preserveWhitespaces;
  31950. var directives = directiveIdentifiers.map(function (dir) { return _this._metadataResolver.getDirectiveSummary(dir.reference); });
  31951. var pipes = ngModule.transitiveModule.pipes.map(function (pipe) { return _this._metadataResolver.getPipeSummary(pipe.reference); });
  31952. return this._templateParser.parse(compMeta, compMeta.template.htmlAst, directives, pipes, ngModule.schemas, templateSourceUrl(ngModule.type, compMeta, compMeta.template), preserveWhitespaces);
  31953. };
  31954. JitCompiler.prototype._resolveStylesCompileResult = function (result, externalStylesheetsByModuleUrl) {
  31955. var _this = this;
  31956. result.dependencies.forEach(function (dep, i) {
  31957. var nestedCompileResult = externalStylesheetsByModuleUrl.get(dep.moduleUrl);
  31958. var nestedStylesArr = _this._resolveAndEvalStylesCompileResult(nestedCompileResult, externalStylesheetsByModuleUrl);
  31959. dep.setValue(nestedStylesArr);
  31960. });
  31961. };
  31962. JitCompiler.prototype._resolveAndEvalStylesCompileResult = function (result, externalStylesheetsByModuleUrl) {
  31963. this._resolveStylesCompileResult(result, externalStylesheetsByModuleUrl);
  31964. return this._interpretOrJit(sharedStylesheetJitUrl(result.meta, this._sharedStylesheetCount++), result.outputCtx.statements)[result.stylesVar];
  31965. };
  31966. JitCompiler.prototype._interpretOrJit = function (sourceUrl, statements) {
  31967. if (!this._compilerConfig.useJit) {
  31968. return interpretStatements(statements, this._reflector);
  31969. }
  31970. else {
  31971. return jitStatements(sourceUrl, statements, this._reflector, this._compilerConfig.jitDevMode);
  31972. }
  31973. };
  31974. return JitCompiler;
  31975. }());
  31976. var CompiledTemplate = /** @class */ (function () {
  31977. function CompiledTemplate(isHost, compType, compMeta, ngModule, directives) {
  31978. this.isHost = isHost;
  31979. this.compType = compType;
  31980. this.compMeta = compMeta;
  31981. this.ngModule = ngModule;
  31982. this.directives = directives;
  31983. this._viewClass = null;
  31984. this.isCompiled = false;
  31985. }
  31986. CompiledTemplate.prototype.compiled = function (viewClass, rendererType) {
  31987. this._viewClass = viewClass;
  31988. this.compMeta.componentViewType.setDelegate(viewClass);
  31989. for (var prop in rendererType) {
  31990. this.compMeta.rendererType[prop] = rendererType[prop];
  31991. }
  31992. this.isCompiled = true;
  31993. };
  31994. return CompiledTemplate;
  31995. }());
  31996. function assertComponent(meta) {
  31997. if (!meta.isComponent) {
  31998. throw new Error("Could not compile '" + identifierName(meta.type) + "' because it is not a component.");
  31999. }
  32000. }
  32001. function createOutputContext() {
  32002. var importExpr$$1 = function (symbol) {
  32003. return importExpr({ name: identifierName(symbol), moduleName: null, runtime: symbol });
  32004. };
  32005. return { statements: [], genFilePath: '', importExpr: importExpr$$1, constantPool: new ConstantPool() };
  32006. }
  32007. /**
  32008. * @license
  32009. * Copyright Google Inc. All Rights Reserved.
  32010. *
  32011. * Use of this source code is governed by an MIT-style license that can be
  32012. * found in the LICENSE file at https://angular.io/license
  32013. */
  32014. /**
  32015. * Provides access to reflection data about symbols that the compiler needs.
  32016. */
  32017. var CompileReflector = /** @class */ (function () {
  32018. function CompileReflector() {
  32019. }
  32020. return CompileReflector;
  32021. }());
  32022. /**
  32023. * @license
  32024. * Copyright Google Inc. All Rights Reserved.
  32025. *
  32026. * Use of this source code is governed by an MIT-style license that can be
  32027. * found in the LICENSE file at https://angular.io/license
  32028. */
  32029. /**
  32030. * Create a {@link UrlResolver} with no package prefix.
  32031. */
  32032. function createUrlResolverWithoutPackagePrefix() {
  32033. return new UrlResolver();
  32034. }
  32035. function createOfflineCompileUrlResolver() {
  32036. return new UrlResolver('.');
  32037. }
  32038. var UrlResolver = /** @class */ (function () {
  32039. function UrlResolverImpl(_packagePrefix) {
  32040. if (_packagePrefix === void 0) { _packagePrefix = null; }
  32041. this._packagePrefix = _packagePrefix;
  32042. }
  32043. /**
  32044. * Resolves the `url` given the `baseUrl`:
  32045. * - when the `url` is null, the `baseUrl` is returned,
  32046. * - if `url` is relative ('path/to/here', './path/to/here'), the resolved url is a combination of
  32047. * `baseUrl` and `url`,
  32048. * - if `url` is absolute (it has a scheme: 'http://', 'https://' or start with '/'), the `url` is
  32049. * returned as is (ignoring the `baseUrl`)
  32050. */
  32051. UrlResolverImpl.prototype.resolve = function (baseUrl, url) {
  32052. var resolvedUrl = url;
  32053. if (baseUrl != null && baseUrl.length > 0) {
  32054. resolvedUrl = _resolveUrl(baseUrl, resolvedUrl);
  32055. }
  32056. var resolvedParts = _split(resolvedUrl);
  32057. var prefix = this._packagePrefix;
  32058. if (prefix != null && resolvedParts != null &&
  32059. resolvedParts[_ComponentIndex.Scheme] == 'package') {
  32060. var path = resolvedParts[_ComponentIndex.Path];
  32061. prefix = prefix.replace(/\/+$/, '');
  32062. path = path.replace(/^\/+/, '');
  32063. return prefix + "/" + path;
  32064. }
  32065. return resolvedUrl;
  32066. };
  32067. return UrlResolverImpl;
  32068. }());
  32069. /**
  32070. * Extract the scheme of a URL.
  32071. */
  32072. function getUrlScheme(url) {
  32073. var match = _split(url);
  32074. return (match && match[_ComponentIndex.Scheme]) || '';
  32075. }
  32076. // The code below is adapted from Traceur:
  32077. // https://github.com/google/traceur-compiler/blob/9511c1dafa972bf0de1202a8a863bad02f0f95a8/src/runtime/url.js
  32078. /**
  32079. * Builds a URI string from already-encoded parts.
  32080. *
  32081. * No encoding is performed. Any component may be omitted as either null or
  32082. * undefined.
  32083. *
  32084. * @param opt_scheme The scheme such as 'http'.
  32085. * @param opt_userInfo The user name before the '@'.
  32086. * @param opt_domain The domain such as 'www.google.com', already
  32087. * URI-encoded.
  32088. * @param opt_port The port number.
  32089. * @param opt_path The path, already URI-encoded. If it is not
  32090. * empty, it must begin with a slash.
  32091. * @param opt_queryData The URI-encoded query data.
  32092. * @param opt_fragment The URI-encoded fragment identifier.
  32093. * @return The fully combined URI.
  32094. */
  32095. function _buildFromEncodedParts(opt_scheme, opt_userInfo, opt_domain, opt_port, opt_path, opt_queryData, opt_fragment) {
  32096. var out = [];
  32097. if (opt_scheme != null) {
  32098. out.push(opt_scheme + ':');
  32099. }
  32100. if (opt_domain != null) {
  32101. out.push('//');
  32102. if (opt_userInfo != null) {
  32103. out.push(opt_userInfo + '@');
  32104. }
  32105. out.push(opt_domain);
  32106. if (opt_port != null) {
  32107. out.push(':' + opt_port);
  32108. }
  32109. }
  32110. if (opt_path != null) {
  32111. out.push(opt_path);
  32112. }
  32113. if (opt_queryData != null) {
  32114. out.push('?' + opt_queryData);
  32115. }
  32116. if (opt_fragment != null) {
  32117. out.push('#' + opt_fragment);
  32118. }
  32119. return out.join('');
  32120. }
  32121. /**
  32122. * A regular expression for breaking a URI into its component parts.
  32123. *
  32124. * {@link http://www.gbiv.com/protocols/uri/rfc/rfc3986.html#RFC2234} says
  32125. * As the "first-match-wins" algorithm is identical to the "greedy"
  32126. * disambiguation method used by POSIX regular expressions, it is natural and
  32127. * commonplace to use a regular expression for parsing the potential five
  32128. * components of a URI reference.
  32129. *
  32130. * The following line is the regular expression for breaking-down a
  32131. * well-formed URI reference into its components.
  32132. *
  32133. * <pre>
  32134. * ^(([^:/?#]+):)?(//([^/?#]*))?([^?#]*)(\?([^#]*))?(#(.*))?
  32135. * 12 3 4 5 6 7 8 9
  32136. * </pre>
  32137. *
  32138. * The numbers in the second line above are only to assist readability; they
  32139. * indicate the reference points for each subexpression (i.e., each paired
  32140. * parenthesis). We refer to the value matched for subexpression <n> as $<n>.
  32141. * For example, matching the above expression to
  32142. * <pre>
  32143. * http://www.ics.uci.edu/pub/ietf/uri/#Related
  32144. * </pre>
  32145. * results in the following subexpression matches:
  32146. * <pre>
  32147. * $1 = http:
  32148. * $2 = http
  32149. * $3 = //www.ics.uci.edu
  32150. * $4 = www.ics.uci.edu
  32151. * $5 = /pub/ietf/uri/
  32152. * $6 = <undefined>
  32153. * $7 = <undefined>
  32154. * $8 = #Related
  32155. * $9 = Related
  32156. * </pre>
  32157. * where <undefined> indicates that the component is not present, as is the
  32158. * case for the query component in the above example. Therefore, we can
  32159. * determine the value of the five components as
  32160. * <pre>
  32161. * scheme = $2
  32162. * authority = $4
  32163. * path = $5
  32164. * query = $7
  32165. * fragment = $9
  32166. * </pre>
  32167. *
  32168. * The regular expression has been modified slightly to expose the
  32169. * userInfo, domain, and port separately from the authority.
  32170. * The modified version yields
  32171. * <pre>
  32172. * $1 = http scheme
  32173. * $2 = <undefined> userInfo -\
  32174. * $3 = www.ics.uci.edu domain | authority
  32175. * $4 = <undefined> port -/
  32176. * $5 = /pub/ietf/uri/ path
  32177. * $6 = <undefined> query without ?
  32178. * $7 = Related fragment without #
  32179. * </pre>
  32180. * @internal
  32181. */
  32182. var _splitRe = new RegExp('^' +
  32183. '(?:' +
  32184. '([^:/?#.]+)' + // scheme - ignore special characters
  32185. // used by other URL parts such as :,
  32186. // ?, /, #, and .
  32187. ':)?' +
  32188. '(?://' +
  32189. '(?:([^/?#]*)@)?' + // userInfo
  32190. '([\\w\\d\\-\\u0100-\\uffff.%]*)' + // domain - restrict to letters,
  32191. // digits, dashes, dots, percent
  32192. // escapes, and unicode characters.
  32193. '(?::([0-9]+))?' + // port
  32194. ')?' +
  32195. '([^?#]+)?' + // path
  32196. '(?:\\?([^#]*))?' + // query
  32197. '(?:#(.*))?' + // fragment
  32198. '$');
  32199. /**
  32200. * The index of each URI component in the return value of goog.uri.utils.split.
  32201. * @enum {number}
  32202. */
  32203. var _ComponentIndex;
  32204. (function (_ComponentIndex) {
  32205. _ComponentIndex[_ComponentIndex["Scheme"] = 1] = "Scheme";
  32206. _ComponentIndex[_ComponentIndex["UserInfo"] = 2] = "UserInfo";
  32207. _ComponentIndex[_ComponentIndex["Domain"] = 3] = "Domain";
  32208. _ComponentIndex[_ComponentIndex["Port"] = 4] = "Port";
  32209. _ComponentIndex[_ComponentIndex["Path"] = 5] = "Path";
  32210. _ComponentIndex[_ComponentIndex["QueryData"] = 6] = "QueryData";
  32211. _ComponentIndex[_ComponentIndex["Fragment"] = 7] = "Fragment";
  32212. })(_ComponentIndex || (_ComponentIndex = {}));
  32213. /**
  32214. * Splits a URI into its component parts.
  32215. *
  32216. * Each component can be accessed via the component indices; for example:
  32217. * <pre>
  32218. * goog.uri.utils.split(someStr)[goog.uri.utils.CompontentIndex.QUERY_DATA];
  32219. * </pre>
  32220. *
  32221. * @param uri The URI string to examine.
  32222. * @return Each component still URI-encoded.
  32223. * Each component that is present will contain the encoded value, whereas
  32224. * components that are not present will be undefined or empty, depending
  32225. * on the browser's regular expression implementation. Never null, since
  32226. * arbitrary strings may still look like path names.
  32227. */
  32228. function _split(uri) {
  32229. return uri.match(_splitRe);
  32230. }
  32231. /**
  32232. * Removes dot segments in given path component, as described in
  32233. * RFC 3986, section 5.2.4.
  32234. *
  32235. * @param path A non-empty path component.
  32236. * @return Path component with removed dot segments.
  32237. */
  32238. function _removeDotSegments(path) {
  32239. if (path == '/')
  32240. return '/';
  32241. var leadingSlash = path[0] == '/' ? '/' : '';
  32242. var trailingSlash = path[path.length - 1] === '/' ? '/' : '';
  32243. var segments = path.split('/');
  32244. var out = [];
  32245. var up = 0;
  32246. for (var pos = 0; pos < segments.length; pos++) {
  32247. var segment = segments[pos];
  32248. switch (segment) {
  32249. case '':
  32250. case '.':
  32251. break;
  32252. case '..':
  32253. if (out.length > 0) {
  32254. out.pop();
  32255. }
  32256. else {
  32257. up++;
  32258. }
  32259. break;
  32260. default:
  32261. out.push(segment);
  32262. }
  32263. }
  32264. if (leadingSlash == '') {
  32265. while (up-- > 0) {
  32266. out.unshift('..');
  32267. }
  32268. if (out.length === 0)
  32269. out.push('.');
  32270. }
  32271. return leadingSlash + out.join('/') + trailingSlash;
  32272. }
  32273. /**
  32274. * Takes an array of the parts from split and canonicalizes the path part
  32275. * and then joins all the parts.
  32276. */
  32277. function _joinAndCanonicalizePath(parts) {
  32278. var path = parts[_ComponentIndex.Path];
  32279. path = path == null ? '' : _removeDotSegments(path);
  32280. parts[_ComponentIndex.Path] = path;
  32281. return _buildFromEncodedParts(parts[_ComponentIndex.Scheme], parts[_ComponentIndex.UserInfo], parts[_ComponentIndex.Domain], parts[_ComponentIndex.Port], path, parts[_ComponentIndex.QueryData], parts[_ComponentIndex.Fragment]);
  32282. }
  32283. /**
  32284. * Resolves a URL.
  32285. * @param base The URL acting as the base URL.
  32286. * @param to The URL to resolve.
  32287. */
  32288. function _resolveUrl(base, url) {
  32289. var parts = _split(encodeURI(url));
  32290. var baseParts = _split(base);
  32291. if (parts[_ComponentIndex.Scheme] != null) {
  32292. return _joinAndCanonicalizePath(parts);
  32293. }
  32294. else {
  32295. parts[_ComponentIndex.Scheme] = baseParts[_ComponentIndex.Scheme];
  32296. }
  32297. for (var i = _ComponentIndex.Scheme; i <= _ComponentIndex.Port; i++) {
  32298. if (parts[i] == null) {
  32299. parts[i] = baseParts[i];
  32300. }
  32301. }
  32302. if (parts[_ComponentIndex.Path][0] == '/') {
  32303. return _joinAndCanonicalizePath(parts);
  32304. }
  32305. var path = baseParts[_ComponentIndex.Path];
  32306. if (path == null)
  32307. path = '/';
  32308. var index = path.lastIndexOf('/');
  32309. path = path.substring(0, index + 1) + parts[_ComponentIndex.Path];
  32310. parts[_ComponentIndex.Path] = path;
  32311. return _joinAndCanonicalizePath(parts);
  32312. }
  32313. /**
  32314. * @license
  32315. * Copyright Google Inc. All Rights Reserved.
  32316. *
  32317. * Use of this source code is governed by an MIT-style license that can be
  32318. * found in the LICENSE file at https://angular.io/license
  32319. */
  32320. /**
  32321. * An interface for retrieving documents by URL that the compiler uses
  32322. * to load templates.
  32323. */
  32324. var ResourceLoader = /** @class */ (function () {
  32325. function ResourceLoader() {
  32326. }
  32327. ResourceLoader.prototype.get = function (url) { return ''; };
  32328. return ResourceLoader;
  32329. }());
  32330. /**
  32331. * @license
  32332. * Copyright Google Inc. All Rights Reserved.
  32333. *
  32334. * Use of this source code is governed by an MIT-style license that can be
  32335. * found in the LICENSE file at https://angular.io/license
  32336. */
  32337. var Extractor = /** @class */ (function () {
  32338. function Extractor(host, staticSymbolResolver, messageBundle, metadataResolver) {
  32339. this.host = host;
  32340. this.staticSymbolResolver = staticSymbolResolver;
  32341. this.messageBundle = messageBundle;
  32342. this.metadataResolver = metadataResolver;
  32343. }
  32344. Extractor.prototype.extract = function (rootFiles) {
  32345. var _this = this;
  32346. var _a = analyzeAndValidateNgModules(rootFiles, this.host, this.staticSymbolResolver, this.metadataResolver), files = _a.files, ngModules = _a.ngModules;
  32347. return Promise
  32348. .all(ngModules.map(function (ngModule) { return _this.metadataResolver.loadNgModuleDirectiveAndPipeMetadata(ngModule.type.reference, false); }))
  32349. .then(function () {
  32350. var errors = [];
  32351. files.forEach(function (file) {
  32352. var compMetas = [];
  32353. file.directives.forEach(function (directiveType) {
  32354. var dirMeta = _this.metadataResolver.getDirectiveMetadata(directiveType);
  32355. if (dirMeta && dirMeta.isComponent) {
  32356. compMetas.push(dirMeta);
  32357. }
  32358. });
  32359. compMetas.forEach(function (compMeta) {
  32360. var html = compMeta.template.template;
  32361. // Template URL points to either an HTML or TS file depending on
  32362. // whether the file is used with `templateUrl:` or `template:`,
  32363. // respectively.
  32364. var templateUrl = compMeta.template.templateUrl;
  32365. var interpolationConfig = InterpolationConfig.fromArray(compMeta.template.interpolation);
  32366. errors.push.apply(errors, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(_this.messageBundle.updateFromTemplate(html, templateUrl, interpolationConfig)));
  32367. });
  32368. });
  32369. if (errors.length) {
  32370. throw new Error(errors.map(function (e) { return e.toString(); }).join('\n'));
  32371. }
  32372. return _this.messageBundle;
  32373. });
  32374. };
  32375. Extractor.create = function (host, locale) {
  32376. var htmlParser = new HtmlParser();
  32377. var urlResolver = createAotUrlResolver(host);
  32378. var symbolCache = new StaticSymbolCache();
  32379. var summaryResolver = new AotSummaryResolver(host, symbolCache);
  32380. var staticSymbolResolver = new StaticSymbolResolver(host, symbolCache, summaryResolver);
  32381. var staticReflector = new StaticReflector(summaryResolver, staticSymbolResolver);
  32382. var config = new CompilerConfig({ defaultEncapsulation: ViewEncapsulation.Emulated, useJit: false });
  32383. var normalizer = new DirectiveNormalizer({ get: function (url) { return host.loadResource(url); } }, urlResolver, htmlParser, config);
  32384. var elementSchemaRegistry = new DomElementSchemaRegistry();
  32385. var resolver = new CompileMetadataResolver(config, htmlParser, new NgModuleResolver(staticReflector), new DirectiveResolver(staticReflector), new PipeResolver(staticReflector), summaryResolver, elementSchemaRegistry, normalizer, console, symbolCache, staticReflector);
  32386. // TODO(vicb): implicit tags & attributes
  32387. var messageBundle = new MessageBundle(htmlParser, [], {}, locale);
  32388. var extractor = new Extractor(host, staticSymbolResolver, messageBundle, resolver);
  32389. return { extractor: extractor, staticReflector: staticReflector };
  32390. };
  32391. return Extractor;
  32392. }());
  32393. /**
  32394. * @license
  32395. * Copyright Google Inc. All Rights Reserved.
  32396. *
  32397. * Use of this source code is governed by an MIT-style license that can be
  32398. * found in the LICENSE file at https://angular.io/license
  32399. */
  32400. /**
  32401. * @license
  32402. * Copyright Google Inc. All Rights Reserved.
  32403. *
  32404. * Use of this source code is governed by an MIT-style license that can be
  32405. * found in the LICENSE file at https://angular.io/license
  32406. */
  32407. function compileInjectable(meta) {
  32408. var factory = NULL_EXPR;
  32409. function makeFn(ret) {
  32410. return fn([], [new ReturnStatement(ret)], undefined, undefined, meta.name + "_Factory");
  32411. }
  32412. if (meta.useClass !== undefined || meta.useFactory !== undefined) {
  32413. // First, handle useClass and useFactory together, since both involve a similar call to
  32414. // `compileFactoryFunction`. Either dependencies are explicitly specified, in which case
  32415. // a factory function call is generated, or they're not specified and the calls are special-
  32416. // cased.
  32417. if (meta.deps !== undefined) {
  32418. // Either call `new meta.useClass(...)` or `meta.useFactory(...)`.
  32419. var fnOrClass = meta.useClass || meta.useFactory;
  32420. // useNew: true if meta.useClass, false for meta.useFactory.
  32421. var useNew = meta.useClass !== undefined;
  32422. factory = compileFactoryFunction({
  32423. name: meta.name,
  32424. fnOrClass: fnOrClass,
  32425. useNew: useNew,
  32426. injectFn: Identifiers.inject,
  32427. deps: meta.deps,
  32428. });
  32429. }
  32430. else if (meta.useClass !== undefined) {
  32431. // Special case for useClass where the factory from the class's ngInjectableDef is used.
  32432. if (meta.useClass.isEquivalent(meta.type)) {
  32433. // For the injectable compiler, useClass represents a foreign type that should be
  32434. // instantiated to satisfy construction of the given type. It's not valid to specify
  32435. // useClass === type, since the useClass type is expected to already be compiled.
  32436. throw new Error("useClass is the same as the type, but no deps specified, which is invalid.");
  32437. }
  32438. factory =
  32439. makeFn(new ReadPropExpr(new ReadPropExpr(meta.useClass, 'ngInjectableDef'), 'factory')
  32440. .callFn([]));
  32441. }
  32442. else if (meta.useFactory !== undefined) {
  32443. // Special case for useFactory where no arguments are passed.
  32444. factory = meta.useFactory.callFn([]);
  32445. }
  32446. else {
  32447. // Can't happen - outer conditional guards against both useClass and useFactory being
  32448. // undefined.
  32449. throw new Error('Reached unreachable block in injectable compiler.');
  32450. }
  32451. }
  32452. else if (meta.useValue !== undefined) {
  32453. // Note: it's safe to use `meta.useValue` instead of the `USE_VALUE in meta` check used for
  32454. // client code because meta.useValue is an Expression which will be defined even if the actual
  32455. // value is undefined.
  32456. factory = makeFn(meta.useValue);
  32457. }
  32458. else if (meta.useExisting !== undefined) {
  32459. // useExisting is an `inject` call on the existing token.
  32460. factory = makeFn(importExpr(Identifiers.inject).callFn([meta.useExisting]));
  32461. }
  32462. else {
  32463. // A strict type is compiled according to useClass semantics, except the dependencies are
  32464. // required.
  32465. if (meta.deps === undefined) {
  32466. throw new Error("Type compilation of an injectable requires dependencies.");
  32467. }
  32468. factory = compileFactoryFunction({
  32469. name: meta.name,
  32470. fnOrClass: meta.type,
  32471. useNew: true,
  32472. injectFn: Identifiers.inject,
  32473. deps: meta.deps,
  32474. });
  32475. }
  32476. var token = meta.type;
  32477. var providedIn = meta.providedIn;
  32478. var expression = importExpr(Identifiers.defineInjectable).callFn([mapToMapExpression({ token: token, factory: factory, providedIn: providedIn })]);
  32479. var type = new ExpressionType(importExpr(Identifiers.InjectableDef, [new ExpressionType(meta.type)]));
  32480. return {
  32481. expression: expression, type: type,
  32482. };
  32483. }
  32484. /**
  32485. * @license
  32486. * Copyright Google Inc. All Rights Reserved.
  32487. *
  32488. * Use of this source code is governed by an MIT-style license that can be
  32489. * found in the LICENSE file at https://angular.io/license
  32490. */
  32491. /**
  32492. * Implementation of `CompileReflector` which resolves references to @angular/core
  32493. * symbols at runtime, according to a consumer-provided mapping.
  32494. *
  32495. * Only supports `resolveExternalReference`, all other methods throw.
  32496. */
  32497. var R3JitReflector = /** @class */ (function () {
  32498. function R3JitReflector(context) {
  32499. this.context = context;
  32500. }
  32501. R3JitReflector.prototype.resolveExternalReference = function (ref) {
  32502. // This reflector only handles @angular/core imports.
  32503. if (ref.moduleName !== '@angular/core') {
  32504. throw new Error("Cannot resolve external reference to " + ref.moduleName + ", only references to @angular/core are supported.");
  32505. }
  32506. if (!this.context.hasOwnProperty(ref.name)) {
  32507. throw new Error("No value provided for @angular/core symbol '" + ref.name + "'.");
  32508. }
  32509. return this.context[ref.name];
  32510. };
  32511. R3JitReflector.prototype.parameters = function (typeOrFunc) { throw new Error('Not implemented.'); };
  32512. R3JitReflector.prototype.annotations = function (typeOrFunc) { throw new Error('Not implemented.'); };
  32513. R3JitReflector.prototype.shallowAnnotations = function (typeOrFunc) { throw new Error('Not implemented.'); };
  32514. R3JitReflector.prototype.tryAnnotations = function (typeOrFunc) { throw new Error('Not implemented.'); };
  32515. R3JitReflector.prototype.propMetadata = function (typeOrFunc) { throw new Error('Not implemented.'); };
  32516. R3JitReflector.prototype.hasLifecycleHook = function (type, lcProperty) { throw new Error('Not implemented.'); };
  32517. R3JitReflector.prototype.guards = function (typeOrFunc) { throw new Error('Not implemented.'); };
  32518. R3JitReflector.prototype.componentModuleUrl = function (type, cmpMetadata) { throw new Error('Not implemented.'); };
  32519. return R3JitReflector;
  32520. }());
  32521. /**
  32522. * JIT compiles an expression and returns the result of executing that expression.
  32523. *
  32524. * @param def the definition which will be compiled and executed to get the value to patch
  32525. * @param context an object map of @angular/core symbol names to symbols which will be available in
  32526. * the context of the compiled expression
  32527. * @param sourceUrl a URL to use for the source map of the compiled expression
  32528. * @param constantPool an optional `ConstantPool` which contains constants used in the expression
  32529. */
  32530. function jitExpression(def, context, sourceUrl, constantPool) {
  32531. // The ConstantPool may contain Statements which declare variables used in the final expression.
  32532. // Therefore, its statements need to precede the actual JIT operation. The final statement is a
  32533. // declaration of $def which is set to the expression being compiled.
  32534. var statements = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])((constantPool !== undefined ? constantPool.statements : []), [
  32535. new DeclareVarStmt('$def', def, undefined, [StmtModifier.Exported]),
  32536. ]);
  32537. var res = jitStatements(sourceUrl, statements, new R3JitReflector(context), false);
  32538. return res['$def'];
  32539. }
  32540. /**
  32541. * @license
  32542. * Copyright Google Inc. All Rights Reserved.
  32543. *
  32544. * Use of this source code is governed by an MIT-style license that can be
  32545. * found in the LICENSE file at https://angular.io/license
  32546. */
  32547. // This file only reexports content of the `src` folder. Keep it that way.
  32548. /**
  32549. * @license
  32550. * Copyright Google Inc. All Rights Reserved.
  32551. *
  32552. * Use of this source code is governed by an MIT-style license that can be
  32553. * found in the LICENSE file at https://angular.io/license
  32554. */
  32555. // This file only reexports content of the `src` folder. Keep it that way.
  32556. /**
  32557. * @license
  32558. * Copyright Google Inc. All Rights Reserved.
  32559. *
  32560. * Use of this source code is governed by an MIT-style license that can be
  32561. * found in the LICENSE file at https://angular.io/license
  32562. */
  32563. /**
  32564. * @license
  32565. * Copyright Google Inc. All Rights Reserved.
  32566. *
  32567. * Use of this source code is governed by an MIT-style license that can be
  32568. * found in the LICENSE file at https://angular.io/license
  32569. */
  32570. //# sourceMappingURL=compiler.js.map
  32571. /***/ }),
  32572. /***/ "./node_modules/@angular/core/fesm5/core.js":
  32573. /*!**************************************************!*\
  32574. !*** ./node_modules/@angular/core/fesm5/core.js ***!
  32575. \**************************************************/
  32576. /*! exports provided: ɵangular_packages_core_core_l, ɵangular_packages_core_core_i, ɵangular_packages_core_core_j, ɵangular_packages_core_core_k, ɵangular_packages_core_core_f, ɵangular_packages_core_core_g, ɵangular_packages_core_core_h, ɵangular_packages_core_core_c, ɵangular_packages_core_core_d, ɵangular_packages_core_core_e, ɵangular_packages_core_core_m, ɵangular_packages_core_core_o, ɵangular_packages_core_core_n, ɵangular_packages_core_core_r, ɵangular_packages_core_core_p, ɵangular_packages_core_core_q, ɵangular_packages_core_core_v, ɵangular_packages_core_core_y, ɵangular_packages_core_core_x, ɵangular_packages_core_core_w, ɵangular_packages_core_core_u, ɵangular_packages_core_core_z, ɵangular_packages_core_core_ba, ɵangular_packages_core_core_bb, ɵangular_packages_core_core_a, ɵangular_packages_core_core_b, ɵangular_packages_core_core_s, ɵangular_packages_core_core_t, createPlatform, assertPlatform, destroyPlatform, getPlatform, PlatformRef, ApplicationRef, enableProdMode, isDevMode, createPlatformFactory, NgProbeToken, APP_ID, PACKAGE_ROOT_URL, PLATFORM_INITIALIZER, PLATFORM_ID, APP_BOOTSTRAP_LISTENER, APP_INITIALIZER, ApplicationInitStatus, DebugElement, DebugNode, asNativeElements, getDebugNode, Testability, TestabilityRegistry, setTestabilityGetter, TRANSLATIONS, TRANSLATIONS_FORMAT, LOCALE_ID, MissingTranslationStrategy, ApplicationModule, wtfCreateScope, wtfLeave, wtfStartTimeRange, wtfEndTimeRange, Type, EventEmitter, ErrorHandler, Sanitizer, SecurityContext, ANALYZE_FOR_ENTRY_COMPONENTS, Attribute, ContentChild, ContentChildren, Query, ViewChild, ViewChildren, Component, Directive, HostBinding, HostListener, Input, Output, Pipe, CUSTOM_ELEMENTS_SCHEMA, NO_ERRORS_SCHEMA, NgModule, ViewEncapsulation, Version, VERSION, defineInjectable, defineInjector, forwardRef, resolveForwardRef, Injectable, inject, INJECTOR, Injector, ReflectiveInjector, createInjector, ResolvedReflectiveFactory, ReflectiveKey, InjectionToken, Inject, Optional, Self, SkipSelf, Host, NgZone, ɵNoopNgZone, RenderComponentType, Renderer, Renderer2, RendererFactory2, RendererStyleFlags2, RootRenderer, COMPILER_OPTIONS, Compiler, CompilerFactory, ModuleWithComponentFactories, ComponentFactory, ComponentRef, ComponentFactoryResolver, ElementRef, NgModuleFactory, NgModuleRef, NgModuleFactoryLoader, getModuleFactory, QueryList, SystemJsNgModuleLoader, SystemJsNgModuleLoaderConfig, TemplateRef, ViewContainerRef, EmbeddedViewRef, ViewRef, ChangeDetectionStrategy, ChangeDetectorRef, DefaultIterableDiffer, IterableDiffers, KeyValueDiffers, SimpleChange, WrappedValue, platformCore, ɵALLOW_MULTIPLE_PLATFORMS, ɵAPP_ID_RANDOM_PROVIDER, ɵdefaultIterableDiffers, ɵdefaultKeyValueDiffers, ɵdevModeEqual, ɵisListLikeIterable, ɵChangeDetectorStatus, ɵisDefaultChangeDetectionStrategy, ɵConsole, ɵinject, ɵsetCurrentInjector, ɵAPP_ROOT, ɵivyEnabled, ɵComponentFactory, ɵCodegenComponentFactoryResolver, ɵresolveComponentResources, ɵReflectionCapabilities, ɵRenderDebugInfo, ɵ_sanitizeHtml, ɵ_sanitizeStyle, ɵ_sanitizeUrl, ɵglobal, ɵlooseIdentical, ɵstringify, ɵmakeDecorator, ɵisObservable, ɵisPromise, ɵclearOverrides, ɵinitServicesIfNeeded, ɵoverrideComponentView, ɵoverrideProvider, ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR, ɵdefineComponent, ɵdefineDirective, ɵdefinePipe, ɵdefineNgModule, ɵdetectChanges, ɵrenderComponent, ɵdirectiveInject, ɵinjectElementRef, ɵinjectTemplateRef, ɵinjectViewContainerRef, ɵinjectChangeDetectorRef, ɵinjectAttribute, ɵPublicFeature, ɵInheritDefinitionFeature, ɵNgOnChangesFeature, ɵmarkDirty, ɵNgModuleFactory, ɵNC, ɵC, ɵE, ɵNH, ɵNM, ɵNS, ɵEe, ɵL, ɵT, ɵV, ɵQ, ɵQr, ɵd, ɵP, ɵb, ɵi1, ɵi2, ɵi3, ɵi4, ɵi5, ɵi6, ɵi7, ɵi8, ɵiV, ɵpb1, ɵpb2, ɵpb3, ɵpb4, ɵpbV, ɵf0, ɵf1, ɵf2, ɵf3, ɵf4, ɵf5, ɵf6, ɵf7, ɵf8, ɵfV, ɵcR, ɵcr, ɵqR, ɵql, ɵe, ɵp, ɵpD, ɵrS, ɵa, ɵs, ɵsm, ɵsp, ɵsa, ɵcp, ɵt, ɵv, ɵst, ɵld, ɵPp, ɵwhenRendered, ɵiA, ɵiEM, ɵiI1, ɵiI2, ɵiI3, ɵiI4, ɵiI5, ɵiI6, ɵiI7, ɵiI8, ɵIV, ɵiM, ɵsanitizeHtml, ɵsanitizeStyle, ɵsanitizeUrl, ɵsanitizeResourceUrl, ɵbypassSanitizationTrustHtml, ɵbypassSanitizationTrustStyle, ɵbypassSanitizationTrustScript, ɵbypassSanitizationTrustUrl, ɵbypassSanitizationTrustResourceUrl, ɵregisterModuleFactory, ɵEMPTY_ARRAY, ɵEMPTY_MAP, ɵand, ɵccf, ɵcmf, ɵcrt, ɵdid, ɵeld, ɵelementEventFullName, ɵgetComponentViewDefinitionFactory, ɵinlineInterpolate, ɵinterpolate, ɵmod, ɵmpd, ɵncd, ɵnov, ɵpid, ɵprd, ɵpad, ɵpod, ɵppd, ɵqud, ɵted, ɵunv, ɵvid */
  32577. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  32578. "use strict";
  32579. __webpack_require__.r(__webpack_exports__);
  32580. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_l", function() { return APPLICATION_MODULE_PROVIDERS; });
  32581. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_i", function() { return _iterableDiffersFactory; });
  32582. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_j", function() { return _keyValueDiffersFactory; });
  32583. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_k", function() { return _localeFactory; });
  32584. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_f", function() { return _appIdRandomProviderFactory; });
  32585. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_g", function() { return DefaultIterableDifferFactory; });
  32586. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_h", function() { return DefaultKeyValueDifferFactory; });
  32587. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_c", function() { return ReflectiveInjector_; });
  32588. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_d", function() { return ReflectiveDependency; });
  32589. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_e", function() { return resolveReflectiveProviders; });
  32590. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_m", function() { return wtfEnabled; });
  32591. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_o", function() { return createScope; });
  32592. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_n", function() { return detectWTF; });
  32593. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_r", function() { return endTimeRange; });
  32594. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_p", function() { return leave; });
  32595. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_q", function() { return startTimeRange; });
  32596. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_v", function() { return getOrCreateChangeDetectorRef; });
  32597. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_y", function() { return getOrCreateContainerRef; });
  32598. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_x", function() { return getOrCreateElementRef; });
  32599. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_w", function() { return getOrCreateInjectable; });
  32600. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_u", function() { return getOrCreateNodeInjector; });
  32601. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_z", function() { return getOrCreateTemplateRef; });
  32602. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_ba", function() { return bindingUpdated; });
  32603. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_bb", function() { return loadInternal; });
  32604. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_a", function() { return makeParamDecorator; });
  32605. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_b", function() { return makePropDecorator; });
  32606. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_s", function() { return _def; });
  32607. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_core_core_t", function() { return DebugContext; });
  32608. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatform", function() { return createPlatform; });
  32609. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "assertPlatform", function() { return assertPlatform; });
  32610. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "destroyPlatform", function() { return destroyPlatform; });
  32611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getPlatform", function() { return getPlatform; });
  32612. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PlatformRef", function() { return PlatformRef; });
  32613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationRef", function() { return ApplicationRef; });
  32614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableProdMode", function() { return enableProdMode; });
  32615. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDevMode", function() { return isDevMode; });
  32616. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createPlatformFactory", function() { return createPlatformFactory; });
  32617. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgProbeToken", function() { return NgProbeToken; });
  32618. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_ID", function() { return APP_ID; });
  32619. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PACKAGE_ROOT_URL", function() { return PACKAGE_ROOT_URL; });
  32620. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_INITIALIZER", function() { return PLATFORM_INITIALIZER; });
  32621. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PLATFORM_ID", function() { return PLATFORM_ID; });
  32622. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_BOOTSTRAP_LISTENER", function() { return APP_BOOTSTRAP_LISTENER; });
  32623. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "APP_INITIALIZER", function() { return APP_INITIALIZER; });
  32624. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationInitStatus", function() { return ApplicationInitStatus; });
  32625. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugElement", function() { return DebugElement; });
  32626. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DebugNode", function() { return DebugNode; });
  32627. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asNativeElements", function() { return asNativeElements; });
  32628. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getDebugNode", function() { return getDebugNode; });
  32629. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Testability", function() { return Testability; });
  32630. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TestabilityRegistry", function() { return TestabilityRegistry; });
  32631. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "setTestabilityGetter", function() { return setTestabilityGetter; });
  32632. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS", function() { return TRANSLATIONS; });
  32633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TRANSLATIONS_FORMAT", function() { return TRANSLATIONS_FORMAT; });
  32634. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "LOCALE_ID", function() { return LOCALE_ID; });
  32635. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MissingTranslationStrategy", function() { return MissingTranslationStrategy; });
  32636. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ApplicationModule", function() { return ApplicationModule; });
  32637. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfCreateScope", function() { return wtfCreateScope; });
  32638. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfLeave", function() { return wtfLeave; });
  32639. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfStartTimeRange", function() { return wtfStartTimeRange; });
  32640. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "wtfEndTimeRange", function() { return wtfEndTimeRange; });
  32641. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Type", function() { return Type; });
  32642. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventEmitter", function() { return EventEmitter; });
  32643. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ErrorHandler", function() { return ErrorHandler; });
  32644. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Sanitizer", function() { return Sanitizer; });
  32645. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SecurityContext", function() { return SecurityContext; });
  32646. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ANALYZE_FOR_ENTRY_COMPONENTS", function() { return ANALYZE_FOR_ENTRY_COMPONENTS; });
  32647. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Attribute", function() { return Attribute; });
  32648. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChild", function() { return ContentChild; });
  32649. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ContentChildren", function() { return ContentChildren; });
  32650. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Query", function() { return Query; });
  32651. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChild", function() { return ViewChild; });
  32652. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewChildren", function() { return ViewChildren; });
  32653. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Component", function() { return Component; });
  32654. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Directive", function() { return Directive; });
  32655. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostBinding", function() { return HostBinding; });
  32656. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HostListener", function() { return HostListener; });
  32657. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Input", function() { return Input; });
  32658. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Output", function() { return Output; });
  32659. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Pipe", function() { return Pipe; });
  32660. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CUSTOM_ELEMENTS_SCHEMA", function() { return CUSTOM_ELEMENTS_SCHEMA; });
  32661. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NO_ERRORS_SCHEMA", function() { return NO_ERRORS_SCHEMA; });
  32662. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModule", function() { return NgModule; });
  32663. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewEncapsulation", function() { return ViewEncapsulation; });
  32664. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Version", function() { return Version; });
  32665. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  32666. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defineInjectable", function() { return defineInjectable; });
  32667. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defineInjector", function() { return defineInjector; });
  32668. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forwardRef", function() { return forwardRef; });
  32669. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "resolveForwardRef", function() { return resolveForwardRef; });
  32670. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injectable", function() { return Injectable; });
  32671. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "inject", function() { return inject; });
  32672. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "INJECTOR", function() { return INJECTOR; });
  32673. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Injector", function() { return Injector; });
  32674. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveInjector", function() { return ReflectiveInjector; });
  32675. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "createInjector", function() { return createInjector; });
  32676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolvedReflectiveFactory", function() { return ResolvedReflectiveFactory; });
  32677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReflectiveKey", function() { return ReflectiveKey; });
  32678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InjectionToken", function() { return InjectionToken; });
  32679. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Inject", function() { return Inject; });
  32680. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Optional", function() { return Optional; });
  32681. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Self", function() { return Self; });
  32682. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SkipSelf", function() { return SkipSelf; });
  32683. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Host", function() { return Host; });
  32684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgZone", function() { return NgZone; });
  32685. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNoopNgZone", function() { return NoopNgZone; });
  32686. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RenderComponentType", function() { return RenderComponentType; });
  32687. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer", function() { return Renderer; });
  32688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Renderer2", function() { return Renderer2; });
  32689. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererFactory2", function() { return RendererFactory2; });
  32690. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RendererStyleFlags2", function() { return RendererStyleFlags2; });
  32691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RootRenderer", function() { return RootRenderer; });
  32692. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPILER_OPTIONS", function() { return COMPILER_OPTIONS; });
  32693. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Compiler", function() { return Compiler; });
  32694. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CompilerFactory", function() { return CompilerFactory; });
  32695. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ModuleWithComponentFactories", function() { return ModuleWithComponentFactories; });
  32696. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactory", function() { return ComponentFactory; });
  32697. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentRef", function() { return ComponentRef; });
  32698. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ComponentFactoryResolver", function() { return ComponentFactoryResolver; });
  32699. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ElementRef", function() { return ElementRef; });
  32700. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactory", function() { return NgModuleFactory; });
  32701. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleRef", function() { return NgModuleRef; });
  32702. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModuleFactoryLoader", function() { return NgModuleFactoryLoader; });
  32703. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getModuleFactory", function() { return getModuleFactory; });
  32704. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueryList", function() { return QueryList; });
  32705. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoader", function() { return SystemJsNgModuleLoader; });
  32706. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SystemJsNgModuleLoaderConfig", function() { return SystemJsNgModuleLoaderConfig; });
  32707. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TemplateRef", function() { return TemplateRef; });
  32708. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewContainerRef", function() { return ViewContainerRef; });
  32709. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmbeddedViewRef", function() { return EmbeddedViewRef; });
  32710. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ViewRef", function() { return ViewRef; });
  32711. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectionStrategy", function() { return ChangeDetectionStrategy; });
  32712. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChangeDetectorRef", function() { return ChangeDetectorRef; });
  32713. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultIterableDiffer", function() { return DefaultIterableDiffer; });
  32714. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "IterableDiffers", function() { return IterableDiffers; });
  32715. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "KeyValueDiffers", function() { return KeyValueDiffers; });
  32716. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SimpleChange", function() { return SimpleChange; });
  32717. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "WrappedValue", function() { return WrappedValue; });
  32718. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformCore", function() { return platformCore; });
  32719. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵALLOW_MULTIPLE_PLATFORMS", function() { return ALLOW_MULTIPLE_PLATFORMS; });
  32720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAPP_ID_RANDOM_PROVIDER", function() { return APP_ID_RANDOM_PROVIDER; });
  32721. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefaultIterableDiffers", function() { return defaultIterableDiffers; });
  32722. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefaultKeyValueDiffers", function() { return defaultKeyValueDiffers; });
  32723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdevModeEqual", function() { return devModeEqual; });
  32724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisListLikeIterable", function() { return isListLikeIterable; });
  32725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵChangeDetectorStatus", function() { return ChangeDetectorStatus; });
  32726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisDefaultChangeDetectionStrategy", function() { return isDefaultChangeDetectionStrategy; });
  32727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵConsole", function() { return Console; });
  32728. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinject", function() { return inject; });
  32729. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetCurrentInjector", function() { return setCurrentInjector; });
  32730. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵAPP_ROOT", function() { return APP_ROOT; });
  32731. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵivyEnabled", function() { return ivyEnabled; });
  32732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵComponentFactory", function() { return ComponentFactory; });
  32733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCodegenComponentFactoryResolver", function() { return CodegenComponentFactoryResolver; });
  32734. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵresolveComponentResources", function() { return resolveComponentResources; });
  32735. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵReflectionCapabilities", function() { return ReflectionCapabilities; });
  32736. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵRenderDebugInfo", function() { return RenderDebugInfo; });
  32737. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵ_sanitizeHtml", function() { return _sanitizeHtml; });
  32738. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵ_sanitizeStyle", function() { return _sanitizeStyle; });
  32739. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵ_sanitizeUrl", function() { return _sanitizeUrl; });
  32740. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵglobal", function() { return _global; });
  32741. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵlooseIdentical", function() { return looseIdentical; });
  32742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵstringify", function() { return stringify; });
  32743. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmakeDecorator", function() { return makeDecorator; });
  32744. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisObservable", function() { return isObservable; });
  32745. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵisPromise", function() { return isPromise; });
  32746. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵclearOverrides", function() { return clearOverrides; });
  32747. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinitServicesIfNeeded", function() { return initServicesIfNeeded; });
  32748. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵoverrideComponentView", function() { return overrideComponentView; });
  32749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵoverrideProvider", function() { return overrideProvider; });
  32750. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR", function() { return NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR; });
  32751. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefineComponent", function() { return defineComponent; });
  32752. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefineDirective", function() { return defineDirective; });
  32753. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefinePipe", function() { return definePipe; });
  32754. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdefineNgModule", function() { return defineNgModule; });
  32755. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdetectChanges", function() { return detectChanges; });
  32756. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵrenderComponent", function() { return renderComponent; });
  32757. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdirectiveInject", function() { return directiveInject; });
  32758. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinjectElementRef", function() { return injectElementRef; });
  32759. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinjectTemplateRef", function() { return injectTemplateRef; });
  32760. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinjectViewContainerRef", function() { return injectViewContainerRef; });
  32761. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinjectChangeDetectorRef", function() { return injectChangeDetectorRef; });
  32762. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinjectAttribute", function() { return injectAttribute; });
  32763. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPublicFeature", function() { return PublicFeature; });
  32764. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵInheritDefinitionFeature", function() { return InheritDefinitionFeature; });
  32765. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgOnChangesFeature", function() { return NgOnChangesFeature; });
  32766. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmarkDirty", function() { return markDirty; });
  32767. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNgModuleFactory", function() { return NgModuleFactory$1; });
  32768. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNC", function() { return NO_CHANGE; });
  32769. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵC", function() { return container; });
  32770. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵE", function() { return elementStart; });
  32771. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNH", function() { return namespaceHTML; });
  32772. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNM", function() { return namespaceMathML; });
  32773. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNS", function() { return namespaceSVG; });
  32774. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEe", function() { return element; });
  32775. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵL", function() { return listener; });
  32776. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵT", function() { return text; });
  32777. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵV", function() { return embeddedViewStart; });
  32778. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵQ", function() { return query; });
  32779. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵQr", function() { return registerContentQuery; });
  32780. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵd", function() { return loadDirective; });
  32781. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵP", function() { return projection; });
  32782. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return bind; });
  32783. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi1", function() { return interpolation1; });
  32784. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi2", function() { return interpolation2; });
  32785. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi3", function() { return interpolation3; });
  32786. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi4", function() { return interpolation4; });
  32787. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi5", function() { return interpolation5; });
  32788. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi6", function() { return interpolation6; });
  32789. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi7", function() { return interpolation7; });
  32790. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵi8", function() { return interpolation8; });
  32791. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiV", function() { return interpolationV; });
  32792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpb1", function() { return pipeBind1; });
  32793. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpb2", function() { return pipeBind2; });
  32794. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpb3", function() { return pipeBind3; });
  32795. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpb4", function() { return pipeBind4; });
  32796. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpbV", function() { return pipeBindV; });
  32797. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf0", function() { return pureFunction0; });
  32798. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf1", function() { return pureFunction1; });
  32799. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf2", function() { return pureFunction2; });
  32800. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf3", function() { return pureFunction3; });
  32801. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf4", function() { return pureFunction4; });
  32802. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf5", function() { return pureFunction5; });
  32803. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf6", function() { return pureFunction6; });
  32804. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf7", function() { return pureFunction7; });
  32805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵf8", function() { return pureFunction8; });
  32806. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵfV", function() { return pureFunctionV; });
  32807. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcR", function() { return containerRefreshStart; });
  32808. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcr", function() { return containerRefreshEnd; });
  32809. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵqR", function() { return queryRefresh; });
  32810. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵql", function() { return loadQueryList; });
  32811. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵe", function() { return elementEnd; });
  32812. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵp", function() { return elementProperty; });
  32813. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpD", function() { return projectionDef; });
  32814. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵrS", function() { return reserveSlots; });
  32815. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return elementAttribute; });
  32816. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵs", function() { return elementStyling; });
  32817. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsm", function() { return elementStylingMap; });
  32818. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsp", function() { return elementStyleProp; });
  32819. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsa", function() { return elementStylingApply; });
  32820. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcp", function() { return elementClassProp; });
  32821. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵt", function() { return textBinding; });
  32822. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵv", function() { return embeddedViewEnd; });
  32823. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵst", function() { return store; });
  32824. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵld", function() { return load; });
  32825. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵPp", function() { return pipe; });
  32826. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵwhenRendered", function() { return whenRendered; });
  32827. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiA", function() { return i18nApply; });
  32828. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiEM", function() { return i18nExpMapping; });
  32829. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI1", function() { return i18nInterpolation1; });
  32830. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI2", function() { return i18nInterpolation2; });
  32831. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI3", function() { return i18nInterpolation3; });
  32832. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI4", function() { return i18nInterpolation4; });
  32833. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI5", function() { return i18nInterpolation5; });
  32834. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI6", function() { return i18nInterpolation6; });
  32835. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI7", function() { return i18nInterpolation7; });
  32836. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiI8", function() { return i18nInterpolation8; });
  32837. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵIV", function() { return i18nInterpolationV; });
  32838. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵiM", function() { return i18nMapping; });
  32839. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsanitizeHtml", function() { return sanitizeHtml; });
  32840. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsanitizeStyle", function() { return sanitizeStyle; });
  32841. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsanitizeUrl", function() { return sanitizeUrl; });
  32842. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsanitizeResourceUrl", function() { return sanitizeResourceUrl; });
  32843. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustHtml", function() { return bypassSanitizationTrustHtml; });
  32844. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustStyle", function() { return bypassSanitizationTrustStyle; });
  32845. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustScript", function() { return bypassSanitizationTrustScript; });
  32846. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustUrl", function() { return bypassSanitizationTrustUrl; });
  32847. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵbypassSanitizationTrustResourceUrl", function() { return bypassSanitizationTrustResourceUrl; });
  32848. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵregisterModuleFactory", function() { return registerModuleFactory; });
  32849. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_ARRAY", function() { return EMPTY_ARRAY$2; });
  32850. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEMPTY_MAP", function() { return EMPTY_MAP; });
  32851. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵand", function() { return anchorDef; });
  32852. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵccf", function() { return createComponentFactory; });
  32853. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcmf", function() { return createNgModuleFactory; });
  32854. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵcrt", function() { return createRendererType2; });
  32855. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵdid", function() { return directiveDef; });
  32856. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵeld", function() { return elementDef; });
  32857. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵelementEventFullName", function() { return elementEventFullName; });
  32858. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetComponentViewDefinitionFactory", function() { return getComponentViewDefinitionFactory; });
  32859. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinlineInterpolate", function() { return inlineInterpolate; });
  32860. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinterpolate", function() { return interpolate; });
  32861. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmod", function() { return moduleDef; });
  32862. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵmpd", function() { return moduleProvideDef; });
  32863. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵncd", function() { return ngContentDef; });
  32864. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵnov", function() { return nodeValue; });
  32865. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpid", function() { return pipeDef; });
  32866. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵprd", function() { return providerDef; });
  32867. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpad", function() { return pureArrayDef; });
  32868. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵpod", function() { return pureObjectDef; });
  32869. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵppd", function() { return purePipeDef; });
  32870. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵqud", function() { return queryDef; });
  32871. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵted", function() { return textDef; });
  32872. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵunv", function() { return unwrapValue; });
  32873. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵvid", function() { return viewDef; });
  32874. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  32875. /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  32876. /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  32877. /**
  32878. * @license Angular v6.1.10
  32879. * (c) 2010-2018 Google, Inc. https://angular.io/
  32880. * License: MIT
  32881. */
  32882. /**
  32883. * @license
  32884. * Copyright Google Inc. All Rights Reserved.
  32885. *
  32886. * Use of this source code is governed by an MIT-style license that can be
  32887. * found in the LICENSE file at https://angular.io/license
  32888. */
  32889. /**
  32890. * Construct an `InjectableDef` which defines how a token will be constructed by the DI system, and
  32891. * in which injectors (if any) it will be available.
  32892. *
  32893. * This should be assigned to a static `ngInjectableDef` field on a type, which will then be an
  32894. * `InjectableType`.
  32895. *
  32896. * Options:
  32897. * * `providedIn` determines which injectors will include the injectable, by either associating it
  32898. * with an `@NgModule` or other `InjectorType`, or by specifying that this injectable should be
  32899. * provided in the `'root'` injector, which will be the application-level injector in most apps.
  32900. * * `factory` gives the zero argument function which will create an instance of the injectable.
  32901. * The factory can call `inject` to access the `Injector` and request injection of dependencies.
  32902. *
  32903. * @experimental
  32904. */
  32905. function defineInjectable(opts) {
  32906. return {
  32907. providedIn: opts.providedIn || null, factory: opts.factory, value: undefined,
  32908. };
  32909. }
  32910. /**
  32911. * Construct an `InjectorDef` which configures an injector.
  32912. *
  32913. * This should be assigned to a static `ngInjectorDef` field on a type, which will then be an
  32914. * `InjectorType`.
  32915. *
  32916. * Options:
  32917. *
  32918. * * `factory`: an `InjectorType` is an instantiable type, so a zero argument `factory` function to
  32919. * create the type must be provided. If that factory function needs to inject arguments, it can
  32920. * use the `inject` function.
  32921. * * `providers`: an optional array of providers to add to the injector. Each provider must
  32922. * either have a factory or point to a type which has an `ngInjectableDef` static property (the
  32923. * type must be an `InjectableType`).
  32924. * * `imports`: an optional array of imports of other `InjectorType`s or `InjectorTypeWithModule`s
  32925. * whose providers will also be added to the injector. Locally provided types will override
  32926. * providers from imports.
  32927. *
  32928. * @experimental
  32929. */
  32930. function defineInjector(options) {
  32931. return {
  32932. factory: options.factory, providers: options.providers || [], imports: options.imports || [],
  32933. };
  32934. }
  32935. /**
  32936. * @license
  32937. * Copyright Google Inc. All Rights Reserved.
  32938. *
  32939. * Use of this source code is governed by an MIT-style license that can be
  32940. * found in the LICENSE file at https://angular.io/license
  32941. */
  32942. /**
  32943. * Creates a token that can be used in a DI Provider.
  32944. *
  32945. * Use an `InjectionToken` whenever the type you are injecting is not reified (does not have a
  32946. * runtime representation) such as when injecting an interface, callable type, array or
  32947. * parametrized type.
  32948. *
  32949. * `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
  32950. * the `Injector`. This provides additional level of type safety.
  32951. *
  32952. * ```
  32953. * interface MyInterface {...}
  32954. * var myInterface = injector.get(new InjectionToken<MyInterface>('SomeToken'));
  32955. * // myInterface is inferred to be MyInterface.
  32956. * ```
  32957. *
  32958. * When creating an `InjectionToken`, you can optionally specify a factory function which returns
  32959. * (possibly by creating) a default value of the parameterized type `T`. This sets up the
  32960. * `InjectionToken` using this factory as a provider as if it was defined explicitly in the
  32961. * application's root injector. If the factory function, which takes zero arguments, needs to inject
  32962. * dependencies, it can do so using the `inject` function. See below for an example.
  32963. *
  32964. * Additionally, if a `factory` is specified you can also specify the `providedIn` option, which
  32965. * overrides the above behavior and marks the token as belonging to a particular `@NgModule`. As
  32966. * mentioned above, `'root'` is the default value for `providedIn`.
  32967. *
  32968. * @usageNotes
  32969. * ### Basic Example
  32970. *
  32971. * ### Plain InjectionToken
  32972. *
  32973. * {@example core/di/ts/injector_spec.ts region='InjectionToken'}
  32974. *
  32975. * ### Tree-shakable InjectionToken
  32976. *
  32977. * {@example core/di/ts/injector_spec.ts region='ShakableInjectionToken'}
  32978. *
  32979. */
  32980. var InjectionToken = /** @class */ (function () {
  32981. function InjectionToken(_desc, options) {
  32982. this._desc = _desc;
  32983. /** @internal */
  32984. this.ngMetadataName = 'InjectionToken';
  32985. if (options !== undefined) {
  32986. this.ngInjectableDef = defineInjectable({
  32987. providedIn: options.providedIn || 'root',
  32988. factory: options.factory,
  32989. });
  32990. }
  32991. else {
  32992. this.ngInjectableDef = undefined;
  32993. }
  32994. }
  32995. InjectionToken.prototype.toString = function () { return "InjectionToken " + this._desc; };
  32996. return InjectionToken;
  32997. }());
  32998. /**
  32999. * @license
  33000. * Copyright Google Inc. All Rights Reserved.
  33001. *
  33002. * Use of this source code is governed by an MIT-style license that can be
  33003. * found in the LICENSE file at https://angular.io/license
  33004. */
  33005. var ANNOTATIONS = '__annotations__';
  33006. var PARAMETERS = '__parameters__';
  33007. var PROP_METADATA = '__prop__metadata__';
  33008. /**
  33009. * @suppress {globalThis}
  33010. */
  33011. function makeDecorator(name, props, parentClass, chainFn, typeFn) {
  33012. var metaCtor = makeMetadataCtor(props);
  33013. function DecoratorFactory() {
  33014. var args = [];
  33015. for (var _i = 0; _i < arguments.length; _i++) {
  33016. args[_i] = arguments[_i];
  33017. }
  33018. var _a;
  33019. if (this instanceof DecoratorFactory) {
  33020. metaCtor.call.apply(metaCtor, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([this], args));
  33021. return this;
  33022. }
  33023. var annotationInstance = new ((_a = DecoratorFactory).bind.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], args)))();
  33024. var TypeDecorator = function TypeDecorator(cls) {
  33025. typeFn && typeFn.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([cls], args));
  33026. // Use of Object.defineProperty is important since it creates non-enumerable property which
  33027. // prevents the property is copied during subclassing.
  33028. var annotations = cls.hasOwnProperty(ANNOTATIONS) ?
  33029. cls[ANNOTATIONS] :
  33030. Object.defineProperty(cls, ANNOTATIONS, { value: [] })[ANNOTATIONS];
  33031. annotations.push(annotationInstance);
  33032. return cls;
  33033. };
  33034. if (chainFn)
  33035. chainFn(TypeDecorator);
  33036. return TypeDecorator;
  33037. }
  33038. if (parentClass) {
  33039. DecoratorFactory.prototype = Object.create(parentClass.prototype);
  33040. }
  33041. DecoratorFactory.prototype.ngMetadataName = name;
  33042. DecoratorFactory.annotationCls = DecoratorFactory;
  33043. return DecoratorFactory;
  33044. }
  33045. function makeMetadataCtor(props) {
  33046. return function ctor() {
  33047. var args = [];
  33048. for (var _i = 0; _i < arguments.length; _i++) {
  33049. args[_i] = arguments[_i];
  33050. }
  33051. if (props) {
  33052. var values = props.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args));
  33053. for (var propName in values) {
  33054. this[propName] = values[propName];
  33055. }
  33056. }
  33057. };
  33058. }
  33059. function makeParamDecorator(name, props, parentClass) {
  33060. var metaCtor = makeMetadataCtor(props);
  33061. function ParamDecoratorFactory() {
  33062. var args = [];
  33063. for (var _i = 0; _i < arguments.length; _i++) {
  33064. args[_i] = arguments[_i];
  33065. }
  33066. var _a;
  33067. if (this instanceof ParamDecoratorFactory) {
  33068. metaCtor.apply(this, args);
  33069. return this;
  33070. }
  33071. var annotationInstance = new ((_a = ParamDecoratorFactory).bind.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], args)))();
  33072. ParamDecorator.annotation = annotationInstance;
  33073. return ParamDecorator;
  33074. function ParamDecorator(cls, unusedKey, index) {
  33075. // Use of Object.defineProperty is important since it creates non-enumerable property which
  33076. // prevents the property is copied during subclassing.
  33077. var parameters = cls.hasOwnProperty(PARAMETERS) ?
  33078. cls[PARAMETERS] :
  33079. Object.defineProperty(cls, PARAMETERS, { value: [] })[PARAMETERS];
  33080. // there might be gaps if some in between parameters do not have annotations.
  33081. // we pad with nulls.
  33082. while (parameters.length <= index) {
  33083. parameters.push(null);
  33084. }
  33085. (parameters[index] = parameters[index] || []).push(annotationInstance);
  33086. return cls;
  33087. }
  33088. }
  33089. if (parentClass) {
  33090. ParamDecoratorFactory.prototype = Object.create(parentClass.prototype);
  33091. }
  33092. ParamDecoratorFactory.prototype.ngMetadataName = name;
  33093. ParamDecoratorFactory.annotationCls = ParamDecoratorFactory;
  33094. return ParamDecoratorFactory;
  33095. }
  33096. function makePropDecorator(name, props, parentClass) {
  33097. var metaCtor = makeMetadataCtor(props);
  33098. function PropDecoratorFactory() {
  33099. var args = [];
  33100. for (var _i = 0; _i < arguments.length; _i++) {
  33101. args[_i] = arguments[_i];
  33102. }
  33103. var _a;
  33104. if (this instanceof PropDecoratorFactory) {
  33105. metaCtor.apply(this, args);
  33106. return this;
  33107. }
  33108. var decoratorInstance = new ((_a = PropDecoratorFactory).bind.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], args)))();
  33109. return function PropDecorator(target, name) {
  33110. var constructor = target.constructor;
  33111. // Use of Object.defineProperty is important since it creates non-enumerable property which
  33112. // prevents the property is copied during subclassing.
  33113. var meta = constructor.hasOwnProperty(PROP_METADATA) ?
  33114. constructor[PROP_METADATA] :
  33115. Object.defineProperty(constructor, PROP_METADATA, { value: {} })[PROP_METADATA];
  33116. meta[name] = meta.hasOwnProperty(name) && meta[name] || [];
  33117. meta[name].unshift(decoratorInstance);
  33118. };
  33119. }
  33120. if (parentClass) {
  33121. PropDecoratorFactory.prototype = Object.create(parentClass.prototype);
  33122. }
  33123. PropDecoratorFactory.prototype.ngMetadataName = name;
  33124. PropDecoratorFactory.annotationCls = PropDecoratorFactory;
  33125. return PropDecoratorFactory;
  33126. }
  33127. /**
  33128. * @license
  33129. * Copyright Google Inc. All Rights Reserved.
  33130. *
  33131. * Use of this source code is governed by an MIT-style license that can be
  33132. * found in the LICENSE file at https://angular.io/license
  33133. */
  33134. /**
  33135. * This token can be used to create a virtual provider that will populate the
  33136. * `entryComponents` fields of components and ng modules based on its `useValue`.
  33137. * All components that are referenced in the `useValue` value (either directly
  33138. * or in a nested array or map) will be added to the `entryComponents` property.
  33139. *
  33140. * @usageNotes
  33141. * ### Example
  33142. * The following example shows how the router can populate the `entryComponents`
  33143. * field of an NgModule based on the router configuration which refers
  33144. * to components.
  33145. *
  33146. * ```typescript
  33147. * // helper function inside the router
  33148. * function provideRoutes(routes) {
  33149. * return [
  33150. * {provide: ROUTES, useValue: routes},
  33151. * {provide: ANALYZE_FOR_ENTRY_COMPONENTS, useValue: routes, multi: true}
  33152. * ];
  33153. * }
  33154. *
  33155. * // user code
  33156. * let routes = [
  33157. * {path: '/root', component: RootComp},
  33158. * {path: '/teams', component: TeamsComp}
  33159. * ];
  33160. *
  33161. * @NgModule({
  33162. * providers: [provideRoutes(routes)]
  33163. * })
  33164. * class ModuleWithRoutes {}
  33165. * ```
  33166. *
  33167. * @experimental
  33168. */
  33169. var ANALYZE_FOR_ENTRY_COMPONENTS = new InjectionToken('AnalyzeForEntryComponents');
  33170. /**
  33171. * Attribute decorator and metadata.
  33172. *
  33173. * @Annotation
  33174. */
  33175. var Attribute = makeParamDecorator('Attribute', function (attributeName) { return ({ attributeName: attributeName }); });
  33176. /**
  33177. * Base class for query metadata.
  33178. *
  33179. * @see `ContentChildren`.
  33180. * @see `ContentChild`.
  33181. * @see `ViewChildren`.
  33182. * @see `ViewChild`.
  33183. */
  33184. var Query = /** @class */ (function () {
  33185. function Query() {
  33186. }
  33187. return Query;
  33188. }());
  33189. /**
  33190. * ContentChildren decorator and metadata.
  33191. *
  33192. *
  33193. * @Annotation
  33194. */
  33195. var ContentChildren = makePropDecorator('ContentChildren', function (selector, data) {
  33196. if (data === void 0) { data = {}; }
  33197. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: false, isViewQuery: false, descendants: false }, data));
  33198. }, Query);
  33199. /**
  33200. * ContentChild decorator and metadata.
  33201. *
  33202. *
  33203. * @Annotation
  33204. */
  33205. var ContentChild = makePropDecorator('ContentChild', function (selector, data) {
  33206. if (data === void 0) { data = {}; }
  33207. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: true, isViewQuery: false, descendants: true }, data));
  33208. }, Query);
  33209. /**
  33210. * ViewChildren decorator and metadata.
  33211. *
  33212. * @Annotation
  33213. */
  33214. var ViewChildren = makePropDecorator('ViewChildren', function (selector, data) {
  33215. if (data === void 0) { data = {}; }
  33216. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: false, isViewQuery: true, descendants: true }, data));
  33217. }, Query);
  33218. /**
  33219. * ViewChild decorator and metadata.
  33220. *
  33221. * @Annotation
  33222. */
  33223. var ViewChild = makePropDecorator('ViewChild', function (selector, data) {
  33224. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ selector: selector, first: true, isViewQuery: true, descendants: true }, data));
  33225. }, Query);
  33226. /**
  33227. * @license
  33228. * Copyright Google Inc. All Rights Reserved.
  33229. *
  33230. * Use of this source code is governed by an MIT-style license that can be
  33231. * found in the LICENSE file at https://angular.io/license
  33232. */
  33233. /**
  33234. * The strategy that the default change detector uses to detect changes.
  33235. * When set, takes effect the next time change detection is triggered.
  33236. *
  33237. */
  33238. var ChangeDetectionStrategy;
  33239. (function (ChangeDetectionStrategy) {
  33240. /**
  33241. * Use the `CheckOnce` strategy, meaning that automatic change detection is deactivated
  33242. * until reactivated by setting the strategy to `Default` (`CheckAlways`).
  33243. * Change detection can still be explictly invoked.
  33244. */
  33245. ChangeDetectionStrategy[ChangeDetectionStrategy["OnPush"] = 0] = "OnPush";
  33246. /**
  33247. * Use the default `CheckAlways` strategy, in which change detection is automatic until
  33248. * explicitly deactivated.
  33249. */
  33250. ChangeDetectionStrategy[ChangeDetectionStrategy["Default"] = 1] = "Default";
  33251. })(ChangeDetectionStrategy || (ChangeDetectionStrategy = {}));
  33252. /**
  33253. * Defines the possible states of the default change detector.
  33254. * @see `ChangeDetectorRef`
  33255. */
  33256. var ChangeDetectorStatus;
  33257. (function (ChangeDetectorStatus) {
  33258. /**
  33259. * A state in which, after calling `detectChanges()`, the change detector
  33260. * state becomes `Checked`, and must be explicitly invoked or reactivated.
  33261. */
  33262. ChangeDetectorStatus[ChangeDetectorStatus["CheckOnce"] = 0] = "CheckOnce";
  33263. /**
  33264. * A state in which change detection is skipped until the change detector mode
  33265. * becomes `CheckOnce`.
  33266. */
  33267. ChangeDetectorStatus[ChangeDetectorStatus["Checked"] = 1] = "Checked";
  33268. /**
  33269. * A state in which change detection continues automatically until explictly
  33270. * deactivated.
  33271. */
  33272. ChangeDetectorStatus[ChangeDetectorStatus["CheckAlways"] = 2] = "CheckAlways";
  33273. /**
  33274. * A state in which a change detector sub tree is not a part of the main tree and
  33275. * should be skipped.
  33276. */
  33277. ChangeDetectorStatus[ChangeDetectorStatus["Detached"] = 3] = "Detached";
  33278. /**
  33279. * Indicates that the change detector encountered an error checking a binding
  33280. * or calling a directive lifecycle method and is now in an inconsistent state. Change
  33281. * detectors in this state do not detect changes.
  33282. */
  33283. ChangeDetectorStatus[ChangeDetectorStatus["Errored"] = 4] = "Errored";
  33284. /**
  33285. * Indicates that the change detector has been destroyed.
  33286. */
  33287. ChangeDetectorStatus[ChangeDetectorStatus["Destroyed"] = 5] = "Destroyed";
  33288. })(ChangeDetectorStatus || (ChangeDetectorStatus = {}));
  33289. /**
  33290. * Reports whether a given strategy is currently the default for change detection.
  33291. * @param changeDetectionStrategy The strategy to check.
  33292. * @returns True if the given strategy is the current default, false otherwise.
  33293. * @see `ChangeDetectorStatus`
  33294. * @see `ChangeDetectorRef`
  33295. */
  33296. function isDefaultChangeDetectionStrategy(changeDetectionStrategy) {
  33297. return changeDetectionStrategy == null ||
  33298. changeDetectionStrategy === ChangeDetectionStrategy.Default;
  33299. }
  33300. /**
  33301. * @license
  33302. * Copyright Google Inc. All Rights Reserved.
  33303. *
  33304. * Use of this source code is governed by an MIT-style license that can be
  33305. * found in the LICENSE file at https://angular.io/license
  33306. */
  33307. var ivyEnabled = false;
  33308. /**
  33309. * @license
  33310. * Copyright Google Inc. All Rights Reserved.
  33311. *
  33312. * Use of this source code is governed by an MIT-style license that can be
  33313. * found in the LICENSE file at https://angular.io/license
  33314. */
  33315. /**
  33316. * Type of the Directive metadata.
  33317. */
  33318. var Directive = makeDecorator('Directive', function (dir) {
  33319. if (dir === void 0) { dir = {}; }
  33320. return dir;
  33321. }, undefined, undefined, function (type, meta) { return (function () { })(type, meta); });
  33322. /**
  33323. * Component decorator and metadata.
  33324. *
  33325. * @usageNotes
  33326. *
  33327. * ### Using animations
  33328. *
  33329. * The following snippet shows an animation trigger in a component's
  33330. * metadata. The trigger is attached to an element in the component's
  33331. * template, using "@_trigger_name_", and a state expression that is evaluated
  33332. * at run time to determine whether the animation should start.
  33333. *
  33334. * ```typescript
  33335. * @Component({
  33336. * selector: 'animation-cmp',
  33337. * templateUrl: 'animation-cmp.html',
  33338. * animations: [
  33339. * trigger('myTriggerName', [
  33340. * state('on', style({ opacity: 1 }),
  33341. * state('off', style({ opacity: 0 }),
  33342. * transition('on => off', [
  33343. * animate("1s")
  33344. * ])
  33345. * ])
  33346. * ]
  33347. * })
  33348. * ```
  33349. *
  33350. * ```html
  33351. * <!-- animation-cmp.html -->
  33352. * <div @myTriggerName="expression">...</div>
  33353. * ```
  33354. *
  33355. * ### Preserving whitespace
  33356. *
  33357. * Removing whitespace can greatly reduce AOT-generated code size, and speed up view creation.
  33358. * As of Angular 6, default for `preserveWhitespaces` is false (whitespace is removed).
  33359. * To change the default setting for all components in your application, set
  33360. * the `preserveWhitespaces` option of the AOT compiler.
  33361. *
  33362. * Current implementation removes whitespace characters as follows:
  33363. * - Trims all whitespaces at the beginning and the end of a template.
  33364. * - Removes whitespace-only text nodes. For example,
  33365. * `<button>Action 1</button> <button>Action 2</button>` becomes
  33366. * `<button>Action 1</button><button>Action 2</button>`.
  33367. * - Replaces a series of whitespace characters in text nodes with a single space.
  33368. * For example, `<span>\n some text\n</span>` becomes `<span> some text </span>`.
  33369. * - Does NOT alter text nodes inside HTML tags such as `<pre>` or `<textarea>`,
  33370. * where whitespace characters are significant.
  33371. *
  33372. * Note that these transformations can influence DOM nodes layout, although impact
  33373. * should be minimal.
  33374. *
  33375. * You can override the default behavior to preserve whitespace characters
  33376. * in certain fragments of a template. For example, you can exclude an entire
  33377. * DOM sub-tree by using the `ngPreserveWhitespaces` attribute:
  33378. *
  33379. * ```html
  33380. * <div ngPreserveWhitespaces>
  33381. * whitespaces are preserved here
  33382. * <span> and here </span>
  33383. * </div>
  33384. * ```
  33385. *
  33386. * You can force a single space to be preserved in a text node by using `&ngsp;`,
  33387. * which is replaced with a space character by Angular's template
  33388. * compiler:
  33389. *
  33390. * ```html
  33391. * <a>Spaces</a>&ngsp;<a>between</a>&ngsp;<a>links.</a>
  33392. * <!-->compiled to be equivalent to:</>
  33393. * <a>Spaces</a> <a>between</a> <a>links.</a>
  33394. * ```
  33395. *
  33396. * Note that sequences of `&ngsp;` are still collapsed to just one space character when
  33397. * the `preserveWhitespaces` option is set to `false`.
  33398. *
  33399. * ```html
  33400. * <a>before</a>&ngsp;&ngsp;&ngsp;<a>after</a>
  33401. * <!-->compiled to be equivalent to:</>
  33402. * <a>Spaces</a> <a>between</a> <a>links.</a>
  33403. * ```
  33404. *
  33405. * To preserve sequences of whitespace characters, use the
  33406. * `ngPreserveWhitespaces` attribute.
  33407. *
  33408. * @Annotation
  33409. */
  33410. var Component = makeDecorator('Component', function (c) {
  33411. if (c === void 0) { c = {}; }
  33412. return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ changeDetection: ChangeDetectionStrategy.Default }, c));
  33413. }, Directive, undefined, function (type, meta) { return (function () { })(type, meta); });
  33414. /**
  33415. *
  33416. *
  33417. * @Annotation
  33418. */
  33419. var Pipe = makeDecorator('Pipe', function (p) { return (Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({ pure: true }, p)); }, undefined, undefined, function (type, meta) { return (function () { })(type, meta); });
  33420. /**
  33421. *
  33422. * @Annotation
  33423. */
  33424. var Input = makePropDecorator('Input', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  33425. /**
  33426. *
  33427. * @Annotation
  33428. */
  33429. var Output = makePropDecorator('Output', function (bindingPropertyName) { return ({ bindingPropertyName: bindingPropertyName }); });
  33430. /**
  33431. *
  33432. * @Annotation
  33433. */
  33434. var HostBinding = makePropDecorator('HostBinding', function (hostPropertyName) { return ({ hostPropertyName: hostPropertyName }); });
  33435. /**
  33436. * Binds a CSS event to a host listener and supplies configuration metadata.
  33437. * Angular invokes the supplied handler method when the host element emits the specified event,
  33438. * and updates the bound element with the result.
  33439. * If the handler method returns false, applies `preventDefault` on the bound element.
  33440. *
  33441. * @usageNotes
  33442. *
  33443. * The following example declares a directive
  33444. * that attaches a click listener to a button and counts clicks.
  33445. *
  33446. * ```
  33447. * @Directive({selector: 'button[counting]'})
  33448. * class CountClicks {
  33449. * numberOfClicks = 0;
  33450. *
  33451. * @HostListener('click', ['$event.target'])
  33452. * onClick(btn) {
  33453. * console.log('button', btn, 'number of clicks:', this.numberOfClicks++);
  33454. * }
  33455. * }
  33456. *
  33457. * @Component({
  33458. * selector: 'app',
  33459. * template: '<button counting>Increment</button>',
  33460. * })
  33461. * class App {}
  33462. * ```
  33463. *
  33464. * @Annotation
  33465. */
  33466. var HostListener = makePropDecorator('HostListener', function (eventName, args) { return ({ eventName: eventName, args: args }); });
  33467. /**
  33468. * @license
  33469. * Copyright Google Inc. All Rights Reserved.
  33470. *
  33471. * Use of this source code is governed by an MIT-style license that can be
  33472. * found in the LICENSE file at https://angular.io/license
  33473. */
  33474. /**
  33475. * @description
  33476. *
  33477. * Represents a type that a Component or other object is instances of.
  33478. *
  33479. * An example of a `Type` is `MyCustomComponent` class, which in JavaScript is be represented by
  33480. * the `MyCustomComponent` constructor function.
  33481. *
  33482. *
  33483. */
  33484. var Type = Function;
  33485. function isType(v) {
  33486. return typeof v === 'function';
  33487. }
  33488. /**
  33489. * @license
  33490. * Copyright Google Inc. All Rights Reserved.
  33491. *
  33492. * Use of this source code is governed by an MIT-style license that can be
  33493. * found in the LICENSE file at https://angular.io/license
  33494. */
  33495. var __window = typeof window !== 'undefined' && window;
  33496. var __self = typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
  33497. self instanceof WorkerGlobalScope && self;
  33498. var __global = typeof global !== 'undefined' && global;
  33499. // Check __global first, because in Node tests both __global and __window may be defined and _global
  33500. // should be __global in that case.
  33501. var _global = __global || __window || __self;
  33502. var promise = Promise.resolve(0);
  33503. var _symbolIterator = null;
  33504. function getSymbolIterator() {
  33505. if (!_symbolIterator) {
  33506. var Symbol_1 = _global['Symbol'];
  33507. if (Symbol_1 && Symbol_1.iterator) {
  33508. _symbolIterator = Symbol_1.iterator;
  33509. }
  33510. else {
  33511. // es6-shim specific logic
  33512. var keys = Object.getOwnPropertyNames(Map.prototype);
  33513. for (var i = 0; i < keys.length; ++i) {
  33514. var key = keys[i];
  33515. if (key !== 'entries' && key !== 'size' &&
  33516. Map.prototype[key] === Map.prototype['entries']) {
  33517. _symbolIterator = key;
  33518. }
  33519. }
  33520. }
  33521. }
  33522. return _symbolIterator;
  33523. }
  33524. function scheduleMicroTask(fn) {
  33525. if (typeof Zone === 'undefined') {
  33526. // use promise to schedule microTask instead of use Zone
  33527. promise.then(function () { fn && fn.apply(null, null); });
  33528. }
  33529. else {
  33530. Zone.current.scheduleMicroTask('scheduleMicrotask', fn);
  33531. }
  33532. }
  33533. // JS has NaN !== NaN
  33534. function looseIdentical(a, b) {
  33535. return a === b || typeof a === 'number' && typeof b === 'number' && isNaN(a) && isNaN(b);
  33536. }
  33537. function stringify(token) {
  33538. if (typeof token === 'string') {
  33539. return token;
  33540. }
  33541. if (token instanceof Array) {
  33542. return '[' + token.map(stringify).join(', ') + ']';
  33543. }
  33544. if (token == null) {
  33545. return '' + token;
  33546. }
  33547. if (token.overriddenName) {
  33548. return "" + token.overriddenName;
  33549. }
  33550. if (token.name) {
  33551. return "" + token.name;
  33552. }
  33553. var res = token.toString();
  33554. if (res == null) {
  33555. return '' + res;
  33556. }
  33557. var newLineIndex = res.indexOf('\n');
  33558. return newLineIndex === -1 ? res : res.substring(0, newLineIndex);
  33559. }
  33560. /**
  33561. * @license
  33562. * Copyright Google Inc. All Rights Reserved.
  33563. *
  33564. * Use of this source code is governed by an MIT-style license that can be
  33565. * found in the LICENSE file at https://angular.io/license
  33566. */
  33567. /**
  33568. * Attention: These regex has to hold even if the code is minified!
  33569. */
  33570. var DELEGATE_CTOR = /^function\s+\S+\(\)\s*{[\s\S]+\.apply\(this,\s*arguments\)/;
  33571. var INHERITED_CLASS = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{/;
  33572. var INHERITED_CLASS_WITH_CTOR = /^class\s+[A-Za-z\d$_]*\s*extends\s+[A-Za-z\d$_]+\s*{[\s\S]*constructor\s*\(/;
  33573. var ReflectionCapabilities = /** @class */ (function () {
  33574. function ReflectionCapabilities(reflect) {
  33575. this._reflect = reflect || _global['Reflect'];
  33576. }
  33577. ReflectionCapabilities.prototype.isReflectionEnabled = function () { return true; };
  33578. ReflectionCapabilities.prototype.factory = function (t) { return function () {
  33579. var args = [];
  33580. for (var _i = 0; _i < arguments.length; _i++) {
  33581. args[_i] = arguments[_i];
  33582. }
  33583. return new (t.bind.apply(t, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], args)))();
  33584. }; };
  33585. /** @internal */
  33586. ReflectionCapabilities.prototype._zipTypesAndAnnotations = function (paramTypes, paramAnnotations) {
  33587. var result;
  33588. if (typeof paramTypes === 'undefined') {
  33589. result = new Array(paramAnnotations.length);
  33590. }
  33591. else {
  33592. result = new Array(paramTypes.length);
  33593. }
  33594. for (var i = 0; i < result.length; i++) {
  33595. // TS outputs Object for parameters without types, while Traceur omits
  33596. // the annotations. For now we preserve the Traceur behavior to aid
  33597. // migration, but this can be revisited.
  33598. if (typeof paramTypes === 'undefined') {
  33599. result[i] = [];
  33600. }
  33601. else if (paramTypes[i] != Object) {
  33602. result[i] = [paramTypes[i]];
  33603. }
  33604. else {
  33605. result[i] = [];
  33606. }
  33607. if (paramAnnotations && paramAnnotations[i] != null) {
  33608. result[i] = result[i].concat(paramAnnotations[i]);
  33609. }
  33610. }
  33611. return result;
  33612. };
  33613. ReflectionCapabilities.prototype._ownParameters = function (type, parentCtor) {
  33614. var typeStr = type.toString();
  33615. // If we have no decorators, we only have function.length as metadata.
  33616. // In that case, to detect whether a child class declared an own constructor or not,
  33617. // we need to look inside of that constructor to check whether it is
  33618. // just calling the parent.
  33619. // This also helps to work around for https://github.com/Microsoft/TypeScript/issues/12439
  33620. // that sets 'design:paramtypes' to []
  33621. // if a class inherits from another class but has no ctor declared itself.
  33622. if (DELEGATE_CTOR.exec(typeStr) ||
  33623. (INHERITED_CLASS.exec(typeStr) && !INHERITED_CLASS_WITH_CTOR.exec(typeStr))) {
  33624. return null;
  33625. }
  33626. // Prefer the direct API.
  33627. if (type.parameters && type.parameters !== parentCtor.parameters) {
  33628. return type.parameters;
  33629. }
  33630. // API of tsickle for lowering decorators to properties on the class.
  33631. var tsickleCtorParams = type.ctorParameters;
  33632. if (tsickleCtorParams && tsickleCtorParams !== parentCtor.ctorParameters) {
  33633. // Newer tsickle uses a function closure
  33634. // Retain the non-function case for compatibility with older tsickle
  33635. var ctorParameters = typeof tsickleCtorParams === 'function' ? tsickleCtorParams() : tsickleCtorParams;
  33636. var paramTypes_1 = ctorParameters.map(function (ctorParam) { return ctorParam && ctorParam.type; });
  33637. var paramAnnotations_1 = ctorParameters.map(function (ctorParam) {
  33638. return ctorParam && convertTsickleDecoratorIntoMetadata(ctorParam.decorators);
  33639. });
  33640. return this._zipTypesAndAnnotations(paramTypes_1, paramAnnotations_1);
  33641. }
  33642. // API for metadata created by invoking the decorators.
  33643. var paramAnnotations = type.hasOwnProperty(PARAMETERS) && type[PARAMETERS];
  33644. var paramTypes = this._reflect && this._reflect.getOwnMetadata &&
  33645. this._reflect.getOwnMetadata('design:paramtypes', type);
  33646. if (paramTypes || paramAnnotations) {
  33647. return this._zipTypesAndAnnotations(paramTypes, paramAnnotations);
  33648. }
  33649. // If a class has no decorators, at least create metadata
  33650. // based on function.length.
  33651. // Note: We know that this is a real constructor as we checked
  33652. // the content of the constructor above.
  33653. return new Array(type.length).fill(undefined);
  33654. };
  33655. ReflectionCapabilities.prototype.parameters = function (type) {
  33656. // Note: only report metadata if we have at least one class decorator
  33657. // to stay in sync with the static reflector.
  33658. if (!isType(type)) {
  33659. return [];
  33660. }
  33661. var parentCtor = getParentCtor(type);
  33662. var parameters = this._ownParameters(type, parentCtor);
  33663. if (!parameters && parentCtor !== Object) {
  33664. parameters = this.parameters(parentCtor);
  33665. }
  33666. return parameters || [];
  33667. };
  33668. ReflectionCapabilities.prototype._ownAnnotations = function (typeOrFunc, parentCtor) {
  33669. // Prefer the direct API.
  33670. if (typeOrFunc.annotations && typeOrFunc.annotations !== parentCtor.annotations) {
  33671. var annotations = typeOrFunc.annotations;
  33672. if (typeof annotations === 'function' && annotations.annotations) {
  33673. annotations = annotations.annotations;
  33674. }
  33675. return annotations;
  33676. }
  33677. // API of tsickle for lowering decorators to properties on the class.
  33678. if (typeOrFunc.decorators && typeOrFunc.decorators !== parentCtor.decorators) {
  33679. return convertTsickleDecoratorIntoMetadata(typeOrFunc.decorators);
  33680. }
  33681. // API for metadata created by invoking the decorators.
  33682. if (typeOrFunc.hasOwnProperty(ANNOTATIONS)) {
  33683. return typeOrFunc[ANNOTATIONS];
  33684. }
  33685. return null;
  33686. };
  33687. ReflectionCapabilities.prototype.annotations = function (typeOrFunc) {
  33688. if (!isType(typeOrFunc)) {
  33689. return [];
  33690. }
  33691. var parentCtor = getParentCtor(typeOrFunc);
  33692. var ownAnnotations = this._ownAnnotations(typeOrFunc, parentCtor) || [];
  33693. var parentAnnotations = parentCtor !== Object ? this.annotations(parentCtor) : [];
  33694. return parentAnnotations.concat(ownAnnotations);
  33695. };
  33696. ReflectionCapabilities.prototype._ownPropMetadata = function (typeOrFunc, parentCtor) {
  33697. // Prefer the direct API.
  33698. if (typeOrFunc.propMetadata &&
  33699. typeOrFunc.propMetadata !== parentCtor.propMetadata) {
  33700. var propMetadata = typeOrFunc.propMetadata;
  33701. if (typeof propMetadata === 'function' && propMetadata.propMetadata) {
  33702. propMetadata = propMetadata.propMetadata;
  33703. }
  33704. return propMetadata;
  33705. }
  33706. // API of tsickle for lowering decorators to properties on the class.
  33707. if (typeOrFunc.propDecorators &&
  33708. typeOrFunc.propDecorators !== parentCtor.propDecorators) {
  33709. var propDecorators_1 = typeOrFunc.propDecorators;
  33710. var propMetadata_1 = {};
  33711. Object.keys(propDecorators_1).forEach(function (prop) {
  33712. propMetadata_1[prop] = convertTsickleDecoratorIntoMetadata(propDecorators_1[prop]);
  33713. });
  33714. return propMetadata_1;
  33715. }
  33716. // API for metadata created by invoking the decorators.
  33717. if (typeOrFunc.hasOwnProperty(PROP_METADATA)) {
  33718. return typeOrFunc[PROP_METADATA];
  33719. }
  33720. return null;
  33721. };
  33722. ReflectionCapabilities.prototype.propMetadata = function (typeOrFunc) {
  33723. if (!isType(typeOrFunc)) {
  33724. return {};
  33725. }
  33726. var parentCtor = getParentCtor(typeOrFunc);
  33727. var propMetadata = {};
  33728. if (parentCtor !== Object) {
  33729. var parentPropMetadata_1 = this.propMetadata(parentCtor);
  33730. Object.keys(parentPropMetadata_1).forEach(function (propName) {
  33731. propMetadata[propName] = parentPropMetadata_1[propName];
  33732. });
  33733. }
  33734. var ownPropMetadata = this._ownPropMetadata(typeOrFunc, parentCtor);
  33735. if (ownPropMetadata) {
  33736. Object.keys(ownPropMetadata).forEach(function (propName) {
  33737. var decorators = [];
  33738. if (propMetadata.hasOwnProperty(propName)) {
  33739. decorators.push.apply(decorators, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(propMetadata[propName]));
  33740. }
  33741. decorators.push.apply(decorators, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(ownPropMetadata[propName]));
  33742. propMetadata[propName] = decorators;
  33743. });
  33744. }
  33745. return propMetadata;
  33746. };
  33747. ReflectionCapabilities.prototype.hasLifecycleHook = function (type, lcProperty) {
  33748. return type instanceof Type && lcProperty in type.prototype;
  33749. };
  33750. ReflectionCapabilities.prototype.guards = function (type) { return {}; };
  33751. ReflectionCapabilities.prototype.getter = function (name) { return new Function('o', 'return o.' + name + ';'); };
  33752. ReflectionCapabilities.prototype.setter = function (name) {
  33753. return new Function('o', 'v', 'return o.' + name + ' = v;');
  33754. };
  33755. ReflectionCapabilities.prototype.method = function (name) {
  33756. var functionBody = "if (!o." + name + ") throw new Error('\"" + name + "\" is undefined');\n return o." + name + ".apply(o, args);";
  33757. return new Function('o', 'args', functionBody);
  33758. };
  33759. // There is not a concept of import uri in Js, but this is useful in developing Dart applications.
  33760. ReflectionCapabilities.prototype.importUri = function (type) {
  33761. // StaticSymbol
  33762. if (typeof type === 'object' && type['filePath']) {
  33763. return type['filePath'];
  33764. }
  33765. // Runtime type
  33766. return "./" + stringify(type);
  33767. };
  33768. ReflectionCapabilities.prototype.resourceUri = function (type) { return "./" + stringify(type); };
  33769. ReflectionCapabilities.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
  33770. return runtime;
  33771. };
  33772. ReflectionCapabilities.prototype.resolveEnum = function (enumIdentifier, name) { return enumIdentifier[name]; };
  33773. return ReflectionCapabilities;
  33774. }());
  33775. function convertTsickleDecoratorIntoMetadata(decoratorInvocations) {
  33776. if (!decoratorInvocations) {
  33777. return [];
  33778. }
  33779. return decoratorInvocations.map(function (decoratorInvocation) {
  33780. var decoratorType = decoratorInvocation.type;
  33781. var annotationCls = decoratorType.annotationCls;
  33782. var annotationArgs = decoratorInvocation.args ? decoratorInvocation.args : [];
  33783. return new (annotationCls.bind.apply(annotationCls, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], annotationArgs)))();
  33784. });
  33785. }
  33786. function getParentCtor(ctor) {
  33787. var parentProto = ctor.prototype ? Object.getPrototypeOf(ctor.prototype) : null;
  33788. var parentCtor = parentProto ? parentProto.constructor : null;
  33789. // Note: We always use `Object` as the null value
  33790. // to simplify checking later on.
  33791. return parentCtor || Object;
  33792. }
  33793. /**
  33794. * @license
  33795. * Copyright Google Inc. All Rights Reserved.
  33796. *
  33797. * Use of this source code is governed by an MIT-style license that can be
  33798. * found in the LICENSE file at https://angular.io/license
  33799. */
  33800. function getClosureSafeProperty(objWithPropertyToExtract, target) {
  33801. for (var key in objWithPropertyToExtract) {
  33802. if (objWithPropertyToExtract[key] === target) {
  33803. return key;
  33804. }
  33805. }
  33806. throw Error('Could not find renamed property on target object.');
  33807. }
  33808. /**
  33809. * @license
  33810. * Copyright Google Inc. All Rights Reserved.
  33811. *
  33812. * Use of this source code is governed by an MIT-style license that can be
  33813. * found in the LICENSE file at https://angular.io/license
  33814. */
  33815. /**
  33816. * Allows to refer to references which are not yet defined.
  33817. *
  33818. * For instance, `forwardRef` is used when the `token` which we need to refer to for the purposes of
  33819. * DI is declared, but not yet defined. It is also used when the `token` which we use when creating
  33820. * a query is not yet defined.
  33821. *
  33822. * @usageNotes
  33823. * ### Example
  33824. * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
  33825. * @experimental
  33826. */
  33827. function forwardRef(forwardRefFn) {
  33828. forwardRefFn.__forward_ref__ = forwardRef;
  33829. forwardRefFn.toString = function () { return stringify(this()); };
  33830. return forwardRefFn;
  33831. }
  33832. /**
  33833. * Lazily retrieves the reference value from a forwardRef.
  33834. *
  33835. * Acts as the identity function when given a non-forward-ref value.
  33836. *
  33837. * @usageNotes
  33838. * ### Example
  33839. *
  33840. * {@example core/di/ts/forward_ref/forward_ref_spec.ts region='resolve_forward_ref'}
  33841. *
  33842. * @see `forwardRef`
  33843. * @experimental
  33844. */
  33845. function resolveForwardRef(type) {
  33846. if (typeof type === 'function' && type.hasOwnProperty('__forward_ref__') &&
  33847. type.__forward_ref__ === forwardRef) {
  33848. return type();
  33849. }
  33850. else {
  33851. return type;
  33852. }
  33853. }
  33854. /**
  33855. * @license
  33856. * Copyright Google Inc. All Rights Reserved.
  33857. *
  33858. * Use of this source code is governed by an MIT-style license that can be
  33859. * found in the LICENSE file at https://angular.io/license
  33860. */
  33861. /**
  33862. * Inject decorator and metadata.
  33863. *
  33864. * @Annotation
  33865. */
  33866. var Inject = makeParamDecorator('Inject', function (token) { return ({ token: token }); });
  33867. /**
  33868. * Optional decorator and metadata.
  33869. *
  33870. * @Annotation
  33871. */
  33872. var Optional = makeParamDecorator('Optional');
  33873. /**
  33874. * Self decorator and metadata.
  33875. *
  33876. * @Annotation
  33877. */
  33878. var Self = makeParamDecorator('Self');
  33879. /**
  33880. * SkipSelf decorator and metadata.
  33881. *
  33882. * @Annotation
  33883. */
  33884. var SkipSelf = makeParamDecorator('SkipSelf');
  33885. /**
  33886. * Host decorator and metadata.
  33887. *
  33888. * @Annotation
  33889. */
  33890. var Host = makeParamDecorator('Host');
  33891. /**
  33892. * @license
  33893. * Copyright Google Inc. All Rights Reserved.
  33894. *
  33895. * Use of this source code is governed by an MIT-style license that can be
  33896. * found in the LICENSE file at https://angular.io/license
  33897. */
  33898. var SOURCE = '__source';
  33899. var _THROW_IF_NOT_FOUND = new Object();
  33900. var THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
  33901. /**
  33902. * An InjectionToken that gets the current `Injector` for `createInjector()`-style injectors.
  33903. *
  33904. * Requesting this token instead of `Injector` allows `StaticInjector` to be tree-shaken from a
  33905. * project.
  33906. *
  33907. * @experimental
  33908. */
  33909. var INJECTOR = new InjectionToken('INJECTOR');
  33910. var NullInjector = /** @class */ (function () {
  33911. function NullInjector() {
  33912. }
  33913. NullInjector.prototype.get = function (token, notFoundValue) {
  33914. if (notFoundValue === void 0) { notFoundValue = _THROW_IF_NOT_FOUND; }
  33915. if (notFoundValue === _THROW_IF_NOT_FOUND) {
  33916. // Intentionally left behind: With dev tools open the debugger will stop here. There is no
  33917. // reason why correctly written application should cause this exception.
  33918. // TODO(misko): uncomment the next line once `ngDevMode` works with closure.
  33919. // if(ngDevMode) debugger;
  33920. throw new Error("NullInjectorError: No provider for " + stringify(token) + "!");
  33921. }
  33922. return notFoundValue;
  33923. };
  33924. return NullInjector;
  33925. }());
  33926. /**
  33927. * Concrete injectors implement this interface.
  33928. *
  33929. * For more details, see the ["Dependency Injection Guide"](guide/dependency-injection).
  33930. *
  33931. * @usageNotes
  33932. * ### Example
  33933. *
  33934. * {@example core/di/ts/injector_spec.ts region='Injector'}
  33935. *
  33936. * `Injector` returns itself when given `Injector` as a token:
  33937. *
  33938. * {@example core/di/ts/injector_spec.ts region='injectInjector'}
  33939. *
  33940. *
  33941. */
  33942. var Injector = /** @class */ (function () {
  33943. function Injector() {
  33944. }
  33945. /**
  33946. * Create a new Injector which is configure using `StaticProvider`s.
  33947. *
  33948. * @usageNotes
  33949. * ### Example
  33950. *
  33951. * {@example core/di/ts/provider_spec.ts region='ConstructorProvider'}
  33952. */
  33953. Injector.create = function (options, parent) {
  33954. if (Array.isArray(options)) {
  33955. return new StaticInjector(options, parent);
  33956. }
  33957. else {
  33958. return new StaticInjector(options.providers, options.parent, options.name || null);
  33959. }
  33960. };
  33961. Injector.THROW_IF_NOT_FOUND = _THROW_IF_NOT_FOUND;
  33962. Injector.NULL = new NullInjector();
  33963. Injector.ngInjectableDef = defineInjectable({
  33964. providedIn: 'any',
  33965. factory: function () { return inject(INJECTOR); },
  33966. });
  33967. return Injector;
  33968. }());
  33969. var IDENT = function (value) {
  33970. return value;
  33971. };
  33972. var EMPTY = [];
  33973. var CIRCULAR = IDENT;
  33974. var MULTI_PROVIDER_FN = function () {
  33975. return Array.prototype.slice.call(arguments);
  33976. };
  33977. var GET_PROPERTY_NAME = {};
  33978. var USE_VALUE = getClosureSafeProperty$1({ provide: String, useValue: GET_PROPERTY_NAME });
  33979. var NG_TOKEN_PATH = 'ngTokenPath';
  33980. var NG_TEMP_TOKEN_PATH = 'ngTempTokenPath';
  33981. var NULL_INJECTOR = Injector.NULL;
  33982. var NEW_LINE = /\n/gm;
  33983. var NO_NEW_LINE = 'ɵ';
  33984. var StaticInjector = /** @class */ (function () {
  33985. function StaticInjector(providers, parent, source) {
  33986. if (parent === void 0) { parent = NULL_INJECTOR; }
  33987. if (source === void 0) { source = null; }
  33988. this.parent = parent;
  33989. this.source = source;
  33990. var records = this._records = new Map();
  33991. records.set(Injector, { token: Injector, fn: IDENT, deps: EMPTY, value: this, useNew: false });
  33992. records.set(INJECTOR, { token: INJECTOR, fn: IDENT, deps: EMPTY, value: this, useNew: false });
  33993. recursivelyProcessProviders(records, providers);
  33994. }
  33995. StaticInjector.prototype.get = function (token, notFoundValue, flags) {
  33996. if (flags === void 0) { flags = 0 /* Default */; }
  33997. var record = this._records.get(token);
  33998. try {
  33999. return tryResolveToken(token, record, this._records, this.parent, notFoundValue, flags);
  34000. }
  34001. catch (e) {
  34002. var tokenPath = e[NG_TEMP_TOKEN_PATH];
  34003. if (token[SOURCE]) {
  34004. tokenPath.unshift(token[SOURCE]);
  34005. }
  34006. e.message = formatError('\n' + e.message, tokenPath, this.source);
  34007. e[NG_TOKEN_PATH] = tokenPath;
  34008. e[NG_TEMP_TOKEN_PATH] = null;
  34009. throw e;
  34010. }
  34011. };
  34012. StaticInjector.prototype.toString = function () {
  34013. var tokens = [], records = this._records;
  34014. records.forEach(function (v, token) { return tokens.push(stringify(token)); });
  34015. return "StaticInjector[" + tokens.join(', ') + "]";
  34016. };
  34017. return StaticInjector;
  34018. }());
  34019. function resolveProvider(provider) {
  34020. var deps = computeDeps(provider);
  34021. var fn = IDENT;
  34022. var value = EMPTY;
  34023. var useNew = false;
  34024. var provide = resolveForwardRef(provider.provide);
  34025. if (USE_VALUE in provider) {
  34026. // We need to use USE_VALUE in provider since provider.useValue could be defined as undefined.
  34027. value = provider.useValue;
  34028. }
  34029. else if (provider.useFactory) {
  34030. fn = provider.useFactory;
  34031. }
  34032. else if (provider.useExisting) ;
  34033. else if (provider.useClass) {
  34034. useNew = true;
  34035. fn = resolveForwardRef(provider.useClass);
  34036. }
  34037. else if (typeof provide == 'function') {
  34038. useNew = true;
  34039. fn = provide;
  34040. }
  34041. else {
  34042. throw staticError('StaticProvider does not have [useValue|useFactory|useExisting|useClass] or [provide] is not newable', provider);
  34043. }
  34044. return { deps: deps, fn: fn, useNew: useNew, value: value };
  34045. }
  34046. function multiProviderMixError(token) {
  34047. return staticError('Cannot mix multi providers and regular providers', token);
  34048. }
  34049. function recursivelyProcessProviders(records, provider) {
  34050. if (provider) {
  34051. provider = resolveForwardRef(provider);
  34052. if (provider instanceof Array) {
  34053. // if we have an array recurse into the array
  34054. for (var i = 0; i < provider.length; i++) {
  34055. recursivelyProcessProviders(records, provider[i]);
  34056. }
  34057. }
  34058. else if (typeof provider === 'function') {
  34059. // Functions were supported in ReflectiveInjector, but are not here. For safety give useful
  34060. // error messages
  34061. throw staticError('Function/Class not supported', provider);
  34062. }
  34063. else if (provider && typeof provider === 'object' && provider.provide) {
  34064. // At this point we have what looks like a provider: {provide: ?, ....}
  34065. var token = resolveForwardRef(provider.provide);
  34066. var resolvedProvider = resolveProvider(provider);
  34067. if (provider.multi === true) {
  34068. // This is a multi provider.
  34069. var multiProvider = records.get(token);
  34070. if (multiProvider) {
  34071. if (multiProvider.fn !== MULTI_PROVIDER_FN) {
  34072. throw multiProviderMixError(token);
  34073. }
  34074. }
  34075. else {
  34076. // Create a placeholder factory which will look up the constituents of the multi provider.
  34077. records.set(token, multiProvider = {
  34078. token: provider.provide,
  34079. deps: [],
  34080. useNew: false,
  34081. fn: MULTI_PROVIDER_FN,
  34082. value: EMPTY
  34083. });
  34084. }
  34085. // Treat the provider as the token.
  34086. token = provider;
  34087. multiProvider.deps.push({ token: token, options: 6 /* Default */ });
  34088. }
  34089. var record = records.get(token);
  34090. if (record && record.fn == MULTI_PROVIDER_FN) {
  34091. throw multiProviderMixError(token);
  34092. }
  34093. records.set(token, resolvedProvider);
  34094. }
  34095. else {
  34096. throw staticError('Unexpected provider', provider);
  34097. }
  34098. }
  34099. }
  34100. function tryResolveToken(token, record, records, parent, notFoundValue, flags) {
  34101. try {
  34102. return resolveToken(token, record, records, parent, notFoundValue, flags);
  34103. }
  34104. catch (e) {
  34105. // ensure that 'e' is of type Error.
  34106. if (!(e instanceof Error)) {
  34107. e = new Error(e);
  34108. }
  34109. var path = e[NG_TEMP_TOKEN_PATH] = e[NG_TEMP_TOKEN_PATH] || [];
  34110. path.unshift(token);
  34111. if (record && record.value == CIRCULAR) {
  34112. // Reset the Circular flag.
  34113. record.value = EMPTY;
  34114. }
  34115. throw e;
  34116. }
  34117. }
  34118. function resolveToken(token, record, records, parent, notFoundValue, flags) {
  34119. var _a;
  34120. var value;
  34121. if (record && !(flags & 4 /* SkipSelf */)) {
  34122. // If we don't have a record, this implies that we don't own the provider hence don't know how
  34123. // to resolve it.
  34124. value = record.value;
  34125. if (value == CIRCULAR) {
  34126. throw Error(NO_NEW_LINE + 'Circular dependency');
  34127. }
  34128. else if (value === EMPTY) {
  34129. record.value = CIRCULAR;
  34130. var obj = undefined;
  34131. var useNew = record.useNew;
  34132. var fn = record.fn;
  34133. var depRecords = record.deps;
  34134. var deps = EMPTY;
  34135. if (depRecords.length) {
  34136. deps = [];
  34137. for (var i = 0; i < depRecords.length; i++) {
  34138. var depRecord = depRecords[i];
  34139. var options = depRecord.options;
  34140. var childRecord = options & 2 /* CheckSelf */ ? records.get(depRecord.token) : undefined;
  34141. deps.push(tryResolveToken(
  34142. // Current Token to resolve
  34143. depRecord.token,
  34144. // A record which describes how to resolve the token.
  34145. // If undefined, this means we don't have such a record
  34146. childRecord,
  34147. // Other records we know about.
  34148. records,
  34149. // If we don't know how to resolve dependency and we should not check parent for it,
  34150. // than pass in Null injector.
  34151. !childRecord && !(options & 4 /* CheckParent */) ? NULL_INJECTOR : parent, options & 1 /* Optional */ ? null : Injector.THROW_IF_NOT_FOUND, 0 /* Default */));
  34152. }
  34153. }
  34154. record.value = value = useNew ? new ((_a = fn).bind.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], deps)))() : fn.apply(obj, deps);
  34155. }
  34156. }
  34157. else if (!(flags & 2 /* Self */)) {
  34158. value = parent.get(token, notFoundValue, 0 /* Default */);
  34159. }
  34160. return value;
  34161. }
  34162. function computeDeps(provider) {
  34163. var deps = EMPTY;
  34164. var providerDeps = provider.deps;
  34165. if (providerDeps && providerDeps.length) {
  34166. deps = [];
  34167. for (var i = 0; i < providerDeps.length; i++) {
  34168. var options = 6 /* Default */;
  34169. var token = resolveForwardRef(providerDeps[i]);
  34170. if (token instanceof Array) {
  34171. for (var j = 0, annotations = token; j < annotations.length; j++) {
  34172. var annotation = annotations[j];
  34173. if (annotation instanceof Optional || annotation == Optional) {
  34174. options = options | 1 /* Optional */;
  34175. }
  34176. else if (annotation instanceof SkipSelf || annotation == SkipSelf) {
  34177. options = options & ~2 /* CheckSelf */;
  34178. }
  34179. else if (annotation instanceof Self || annotation == Self) {
  34180. options = options & ~4 /* CheckParent */;
  34181. }
  34182. else if (annotation instanceof Inject) {
  34183. token = annotation.token;
  34184. }
  34185. else {
  34186. token = resolveForwardRef(annotation);
  34187. }
  34188. }
  34189. }
  34190. deps.push({ token: token, options: options });
  34191. }
  34192. }
  34193. else if (provider.useExisting) {
  34194. var token = resolveForwardRef(provider.useExisting);
  34195. deps = [{ token: token, options: 6 /* Default */ }];
  34196. }
  34197. else if (!providerDeps && !(USE_VALUE in provider)) {
  34198. // useValue & useExisting are the only ones which are exempt from deps all others need it.
  34199. throw staticError('\'deps\' required', provider);
  34200. }
  34201. return deps;
  34202. }
  34203. function formatError(text, obj, source) {
  34204. if (source === void 0) { source = null; }
  34205. text = text && text.charAt(0) === '\n' && text.charAt(1) == NO_NEW_LINE ? text.substr(2) : text;
  34206. var context = stringify(obj);
  34207. if (obj instanceof Array) {
  34208. context = obj.map(stringify).join(' -> ');
  34209. }
  34210. else if (typeof obj === 'object') {
  34211. var parts = [];
  34212. for (var key in obj) {
  34213. if (obj.hasOwnProperty(key)) {
  34214. var value = obj[key];
  34215. parts.push(key + ':' + (typeof value === 'string' ? JSON.stringify(value) : stringify(value)));
  34216. }
  34217. }
  34218. context = "{" + parts.join(', ') + "}";
  34219. }
  34220. return "StaticInjectorError" + (source ? '(' + source + ')' : '') + "[" + context + "]: " + text.replace(NEW_LINE, '\n ');
  34221. }
  34222. function staticError(text, obj) {
  34223. return new Error(formatError(text, obj));
  34224. }
  34225. function getClosureSafeProperty$1(objWithPropertyToExtract) {
  34226. for (var key in objWithPropertyToExtract) {
  34227. if (objWithPropertyToExtract[key] === GET_PROPERTY_NAME) {
  34228. return key;
  34229. }
  34230. }
  34231. throw Error('!prop');
  34232. }
  34233. /**
  34234. * Current injector value used by `inject`.
  34235. * - `undefined`: it is an error to call `inject`
  34236. * - `null`: `inject` can be called but there is no injector (limp-mode).
  34237. * - Injector instance: Use the injector for resolution.
  34238. */
  34239. var _currentInjector = undefined;
  34240. function setCurrentInjector(injector) {
  34241. var former = _currentInjector;
  34242. _currentInjector = injector;
  34243. return former;
  34244. }
  34245. function inject(token, flags) {
  34246. if (flags === void 0) { flags = 0 /* Default */; }
  34247. if (_currentInjector === undefined) {
  34248. throw new Error("inject() must be called from an injection context");
  34249. }
  34250. else if (_currentInjector === null) {
  34251. var injectableDef = token.ngInjectableDef;
  34252. if (injectableDef && injectableDef.providedIn == 'root') {
  34253. return injectableDef.value === undefined ? injectableDef.value = injectableDef.factory() :
  34254. injectableDef.value;
  34255. }
  34256. if (flags & 8 /* Optional */)
  34257. return null;
  34258. throw new Error("Injector: NOT_FOUND [" + stringify(token) + "]");
  34259. }
  34260. else {
  34261. return _currentInjector.get(token, flags & 8 /* Optional */ ? null : undefined, flags);
  34262. }
  34263. }
  34264. function injectArgs(types) {
  34265. var args = [];
  34266. for (var i = 0; i < types.length; i++) {
  34267. var arg = types[i];
  34268. if (Array.isArray(arg)) {
  34269. if (arg.length === 0) {
  34270. throw new Error('Arguments array must have arguments.');
  34271. }
  34272. var type = undefined;
  34273. var flags = 0 /* Default */;
  34274. for (var j = 0; j < arg.length; j++) {
  34275. var meta = arg[j];
  34276. if (meta instanceof Optional || meta.ngMetadataName === 'Optional') {
  34277. flags |= 8 /* Optional */;
  34278. }
  34279. else if (meta instanceof SkipSelf || meta.ngMetadataName === 'SkipSelf') {
  34280. flags |= 4 /* SkipSelf */;
  34281. }
  34282. else if (meta instanceof Self || meta.ngMetadataName === 'Self') {
  34283. flags |= 2 /* Self */;
  34284. }
  34285. else if (meta instanceof Inject) {
  34286. type = meta.token;
  34287. }
  34288. else {
  34289. type = meta;
  34290. }
  34291. }
  34292. args.push(inject(type, flags));
  34293. }
  34294. else {
  34295. args.push(inject(arg));
  34296. }
  34297. }
  34298. return args;
  34299. }
  34300. /**
  34301. * @license
  34302. * Copyright Google Inc. All Rights Reserved.
  34303. *
  34304. * Use of this source code is governed by an MIT-style license that can be
  34305. * found in the LICENSE file at https://angular.io/license
  34306. */
  34307. var GET_PROPERTY_NAME$1 = {};
  34308. var ɵ0$1 = GET_PROPERTY_NAME$1;
  34309. var USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: ɵ0$1 }, GET_PROPERTY_NAME$1);
  34310. var EMPTY_ARRAY = [];
  34311. function convertInjectableProviderToFactory(type, provider) {
  34312. if (!provider) {
  34313. var reflectionCapabilities = new ReflectionCapabilities();
  34314. var deps_1 = reflectionCapabilities.parameters(type);
  34315. // TODO - convert to flags.
  34316. return function () { return new (type.bind.apply(type, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], injectArgs(deps_1))))(); };
  34317. }
  34318. if (USE_VALUE$1 in provider) {
  34319. var valueProvider_1 = provider;
  34320. return function () { return valueProvider_1.useValue; };
  34321. }
  34322. else if (provider.useExisting) {
  34323. var existingProvider_1 = provider;
  34324. return function () { return inject(existingProvider_1.useExisting); };
  34325. }
  34326. else if (provider.useFactory) {
  34327. var factoryProvider_1 = provider;
  34328. return function () { return factoryProvider_1.useFactory.apply(factoryProvider_1, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(injectArgs(factoryProvider_1.deps || EMPTY_ARRAY))); };
  34329. }
  34330. else if (provider.useClass) {
  34331. var classProvider_1 = provider;
  34332. var deps_2 = provider.deps;
  34333. if (!deps_2) {
  34334. var reflectionCapabilities = new ReflectionCapabilities();
  34335. deps_2 = reflectionCapabilities.parameters(type);
  34336. }
  34337. return function () {
  34338. var _a;
  34339. return new ((_a = classProvider_1.useClass).bind.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], injectArgs(deps_2))))();
  34340. };
  34341. }
  34342. else {
  34343. var deps_3 = provider.deps;
  34344. if (!deps_3) {
  34345. var reflectionCapabilities = new ReflectionCapabilities();
  34346. deps_3 = reflectionCapabilities.parameters(type);
  34347. }
  34348. return function () { return new (type.bind.apply(type, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], injectArgs(deps_3))))(); };
  34349. }
  34350. }
  34351. /**
  34352. * Supports @Injectable() in JIT mode for Render2.
  34353. */
  34354. function preR3InjectableCompile(injectableType, options) {
  34355. if (options && options.providedIn !== undefined && injectableType.ngInjectableDef === undefined) {
  34356. injectableType.ngInjectableDef = defineInjectable({
  34357. providedIn: options.providedIn,
  34358. factory: convertInjectableProviderToFactory(injectableType, options),
  34359. });
  34360. }
  34361. }
  34362. /**
  34363. * Injectable decorator and metadata.
  34364. *
  34365. * @Annotation
  34366. */
  34367. var Injectable = makeDecorator('Injectable', undefined, undefined, undefined, function (type, meta) {
  34368. return (preR3InjectableCompile)(type, meta);
  34369. });
  34370. /**
  34371. * @license
  34372. * Copyright Google Inc. All Rights Reserved.
  34373. *
  34374. * Use of this source code is governed by an MIT-style license that can be
  34375. * found in the LICENSE file at https://angular.io/license
  34376. */
  34377. /**
  34378. * Defines a schema that allows an NgModule to contain the following:
  34379. * - Non-Angular elements named with dash case (`-`).
  34380. * - Element properties named with dash case (`-`).
  34381. * Dash case is the naming convention for custom elements.
  34382. *
  34383. *
  34384. */
  34385. var CUSTOM_ELEMENTS_SCHEMA = {
  34386. name: 'custom-elements'
  34387. };
  34388. /**
  34389. * Defines a schema that allows any property on any element.
  34390. *
  34391. * @experimental
  34392. */
  34393. var NO_ERRORS_SCHEMA = {
  34394. name: 'no-errors-schema'
  34395. };
  34396. function preR3NgModuleCompile(moduleType, metadata) {
  34397. var imports = (metadata && metadata.imports) || [];
  34398. if (metadata && metadata.exports) {
  34399. imports = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(imports, [metadata.exports]);
  34400. }
  34401. moduleType.ngInjectorDef = defineInjector({
  34402. factory: convertInjectableProviderToFactory(moduleType, { useClass: moduleType }),
  34403. providers: metadata && metadata.providers,
  34404. imports: imports,
  34405. });
  34406. }
  34407. /**
  34408. * @Annotation
  34409. */
  34410. var NgModule = makeDecorator('NgModule', function (ngModule) { return ngModule; }, undefined, undefined,
  34411. /**
  34412. * Decorator that marks the following class as an NgModule, and supplies
  34413. * configuration metadata for it.
  34414. *
  34415. * * The `declarations` and `entryComponents` options configure the compiler
  34416. * with information about what belongs to the NgModule.
  34417. * * The `providers` options configures the NgModule's injector to provide
  34418. * dependencies the NgModule members.
  34419. * * The `imports` and `exports` options bring in members from other modules, and make
  34420. * this module's members available to others.
  34421. */
  34422. function (type, meta) { return (preR3NgModuleCompile)(type, meta); });
  34423. /**
  34424. * @license
  34425. * Copyright Google Inc. All Rights Reserved.
  34426. *
  34427. * Use of this source code is governed by an MIT-style license that can be
  34428. * found in the LICENSE file at https://angular.io/license
  34429. */
  34430. /**
  34431. * Defines template and style encapsulation options available for Component's {@link Component}.
  34432. *
  34433. * See {@link Component#encapsulation encapsulation}.
  34434. *
  34435. * @usageNotes
  34436. * ### Example
  34437. * {@example core/ts/metadata/encapsulation.ts region='longform'}
  34438. */
  34439. var ViewEncapsulation;
  34440. (function (ViewEncapsulation) {
  34441. /**
  34442. * Emulate `Native` scoping of styles by adding an attribute containing surrogate id to the Host
  34443. * Element and pre-processing the style rules provided via {@link Component#styles styles} or
  34444. * {@link Component#styleUrls styleUrls}, and adding the new Host Element attribute to all
  34445. * selectors.
  34446. *
  34447. * This is the default option.
  34448. */
  34449. ViewEncapsulation[ViewEncapsulation["Emulated"] = 0] = "Emulated";
  34450. /**
  34451. * @deprecated v6.1.0 - use {ViewEncapsulation.ShadowDom} instead.
  34452. * Use the native encapsulation mechanism of the renderer.
  34453. *
  34454. * For the DOM this means using the deprecated [Shadow DOM
  34455. * v0](https://w3c.github.io/webcomponents/spec/shadow/) and
  34456. * creating a ShadowRoot for Component's Host Element.
  34457. */
  34458. ViewEncapsulation[ViewEncapsulation["Native"] = 1] = "Native";
  34459. /**
  34460. * Don't provide any template or style encapsulation.
  34461. */
  34462. ViewEncapsulation[ViewEncapsulation["None"] = 2] = "None";
  34463. /**
  34464. * Use Shadow DOM to encapsulate styles.
  34465. *
  34466. * For the DOM this means using modern [Shadow
  34467. * DOM](https://w3c.github.io/webcomponents/spec/shadow/) and
  34468. * creating a ShadowRoot for Component's Host Element.
  34469. */
  34470. ViewEncapsulation[ViewEncapsulation["ShadowDom"] = 3] = "ShadowDom";
  34471. })(ViewEncapsulation || (ViewEncapsulation = {}));
  34472. /**
  34473. * @license
  34474. * Copyright Google Inc. All Rights Reserved.
  34475. *
  34476. * Use of this source code is governed by an MIT-style license that can be
  34477. * found in the LICENSE file at https://angular.io/license
  34478. */
  34479. /**
  34480. * @license
  34481. * Copyright Google Inc. All Rights Reserved.
  34482. *
  34483. * Use of this source code is governed by an MIT-style license that can be
  34484. * found in the LICENSE file at https://angular.io/license
  34485. */
  34486. /**
  34487. * @description Represents the version of Angular
  34488. *
  34489. *
  34490. */
  34491. var Version = /** @class */ (function () {
  34492. function Version(full) {
  34493. this.full = full;
  34494. this.major = full.split('.')[0];
  34495. this.minor = full.split('.')[1];
  34496. this.patch = full.split('.').slice(2).join('.');
  34497. }
  34498. return Version;
  34499. }());
  34500. var VERSION = new Version('6.1.10');
  34501. /**
  34502. * @license
  34503. * Copyright Google Inc. All Rights Reserved.
  34504. *
  34505. * Use of this source code is governed by an MIT-style license that can be
  34506. * found in the LICENSE file at https://angular.io/license
  34507. */
  34508. var ERROR_DEBUG_CONTEXT = 'ngDebugContext';
  34509. var ERROR_ORIGINAL_ERROR = 'ngOriginalError';
  34510. var ERROR_LOGGER = 'ngErrorLogger';
  34511. function getDebugContext(error) {
  34512. return error[ERROR_DEBUG_CONTEXT];
  34513. }
  34514. function getOriginalError(error) {
  34515. return error[ERROR_ORIGINAL_ERROR];
  34516. }
  34517. function getErrorLogger(error) {
  34518. return error[ERROR_LOGGER] || defaultErrorLogger;
  34519. }
  34520. function defaultErrorLogger(console) {
  34521. var values = [];
  34522. for (var _i = 1; _i < arguments.length; _i++) {
  34523. values[_i - 1] = arguments[_i];
  34524. }
  34525. console.error.apply(console, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(values));
  34526. }
  34527. /**
  34528. * @license
  34529. * Copyright Google Inc. All Rights Reserved.
  34530. *
  34531. * Use of this source code is governed by an MIT-style license that can be
  34532. * found in the LICENSE file at https://angular.io/license
  34533. */
  34534. /**
  34535. * Provides a hook for centralized exception handling.
  34536. *
  34537. * The default implementation of `ErrorHandler` prints error messages to the `console`. To
  34538. * intercept error handling, write a custom exception handler that replaces this default as
  34539. * appropriate for your app.
  34540. *
  34541. * @usageNotes
  34542. * ### Example
  34543. *
  34544. * ```
  34545. * class MyErrorHandler implements ErrorHandler {
  34546. * handleError(error) {
  34547. * // do something with the exception
  34548. * }
  34549. * }
  34550. *
  34551. * @NgModule({
  34552. * providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
  34553. * })
  34554. * class MyModule {}
  34555. * ```
  34556. */
  34557. var ErrorHandler = /** @class */ (function () {
  34558. function ErrorHandler() {
  34559. /**
  34560. * @internal
  34561. */
  34562. this._console = console;
  34563. }
  34564. ErrorHandler.prototype.handleError = function (error) {
  34565. var originalError = this._findOriginalError(error);
  34566. var context = this._findContext(error);
  34567. // Note: Browser consoles show the place from where console.error was called.
  34568. // We can use this to give users additional information about the error.
  34569. var errorLogger = getErrorLogger(error);
  34570. errorLogger(this._console, "ERROR", error);
  34571. if (originalError) {
  34572. errorLogger(this._console, "ORIGINAL ERROR", originalError);
  34573. }
  34574. if (context) {
  34575. errorLogger(this._console, 'ERROR CONTEXT', context);
  34576. }
  34577. };
  34578. /** @internal */
  34579. ErrorHandler.prototype._findContext = function (error) {
  34580. if (error) {
  34581. return getDebugContext(error) ? getDebugContext(error) :
  34582. this._findContext(getOriginalError(error));
  34583. }
  34584. return null;
  34585. };
  34586. /** @internal */
  34587. ErrorHandler.prototype._findOriginalError = function (error) {
  34588. var e = getOriginalError(error);
  34589. while (e && getOriginalError(e)) {
  34590. e = getOriginalError(e);
  34591. }
  34592. return e;
  34593. };
  34594. return ErrorHandler;
  34595. }());
  34596. function wrappedError(message, originalError) {
  34597. var msg = message + " caused by: " + (originalError instanceof Error ? originalError.message : originalError);
  34598. var error = Error(msg);
  34599. error[ERROR_ORIGINAL_ERROR] = originalError;
  34600. return error;
  34601. }
  34602. /**
  34603. * @license
  34604. * Copyright Google Inc. All Rights Reserved.
  34605. *
  34606. * Use of this source code is governed by an MIT-style license that can be
  34607. * found in the LICENSE file at https://angular.io/license
  34608. */
  34609. function findFirstClosedCycle(keys) {
  34610. var res = [];
  34611. for (var i = 0; i < keys.length; ++i) {
  34612. if (res.indexOf(keys[i]) > -1) {
  34613. res.push(keys[i]);
  34614. return res;
  34615. }
  34616. res.push(keys[i]);
  34617. }
  34618. return res;
  34619. }
  34620. function constructResolvingPath(keys) {
  34621. if (keys.length > 1) {
  34622. var reversed = findFirstClosedCycle(keys.slice().reverse());
  34623. var tokenStrs = reversed.map(function (k) { return stringify(k.token); });
  34624. return ' (' + tokenStrs.join(' -> ') + ')';
  34625. }
  34626. return '';
  34627. }
  34628. function injectionError(injector, key, constructResolvingMessage, originalError) {
  34629. var keys = [key];
  34630. var errMsg = constructResolvingMessage(keys);
  34631. var error = (originalError ? wrappedError(errMsg, originalError) : Error(errMsg));
  34632. error.addKey = addKey;
  34633. error.keys = keys;
  34634. error.injectors = [injector];
  34635. error.constructResolvingMessage = constructResolvingMessage;
  34636. error[ERROR_ORIGINAL_ERROR] = originalError;
  34637. return error;
  34638. }
  34639. function addKey(injector, key) {
  34640. this.injectors.push(injector);
  34641. this.keys.push(key);
  34642. // Note: This updated message won't be reflected in the `.stack` property
  34643. this.message = this.constructResolvingMessage(this.keys);
  34644. }
  34645. /**
  34646. * Thrown when trying to retrieve a dependency by key from {@link Injector}, but the
  34647. * {@link Injector} does not have a {@link Provider} for the given key.
  34648. *
  34649. * @usageNotes
  34650. * ### Example
  34651. *
  34652. * ```typescript
  34653. * class A {
  34654. * constructor(b:B) {}
  34655. * }
  34656. *
  34657. * expect(() => Injector.resolveAndCreate([A])).toThrowError();
  34658. * ```
  34659. */
  34660. function noProviderError(injector, key) {
  34661. return injectionError(injector, key, function (keys) {
  34662. var first = stringify(keys[0].token);
  34663. return "No provider for " + first + "!" + constructResolvingPath(keys);
  34664. });
  34665. }
  34666. /**
  34667. * Thrown when dependencies form a cycle.
  34668. *
  34669. * @usageNotes
  34670. * ### Example
  34671. *
  34672. * ```typescript
  34673. * var injector = Injector.resolveAndCreate([
  34674. * {provide: "one", useFactory: (two) => "two", deps: [[new Inject("two")]]},
  34675. * {provide: "two", useFactory: (one) => "one", deps: [[new Inject("one")]]}
  34676. * ]);
  34677. *
  34678. * expect(() => injector.get("one")).toThrowError();
  34679. * ```
  34680. *
  34681. * Retrieving `A` or `B` throws a `CyclicDependencyError` as the graph above cannot be constructed.
  34682. */
  34683. function cyclicDependencyError(injector, key) {
  34684. return injectionError(injector, key, function (keys) {
  34685. return "Cannot instantiate cyclic dependency!" + constructResolvingPath(keys);
  34686. });
  34687. }
  34688. /**
  34689. * Thrown when a constructing type returns with an Error.
  34690. *
  34691. * The `InstantiationError` class contains the original error plus the dependency graph which caused
  34692. * this object to be instantiated.
  34693. *
  34694. * @usageNotes
  34695. * ### Example
  34696. *
  34697. * ```typescript
  34698. * class A {
  34699. * constructor() {
  34700. * throw new Error('message');
  34701. * }
  34702. * }
  34703. *
  34704. * var injector = Injector.resolveAndCreate([A]);
  34705. * try {
  34706. * injector.get(A);
  34707. * } catch (e) {
  34708. * expect(e instanceof InstantiationError).toBe(true);
  34709. * expect(e.originalException.message).toEqual("message");
  34710. * expect(e.originalStack).toBeDefined();
  34711. * }
  34712. * ```
  34713. */
  34714. function instantiationError(injector, originalException, originalStack, key) {
  34715. return injectionError(injector, key, function (keys) {
  34716. var first = stringify(keys[0].token);
  34717. return originalException.message + ": Error during instantiation of " + first + "!" + constructResolvingPath(keys) + ".";
  34718. }, originalException);
  34719. }
  34720. /**
  34721. * Thrown when an object other then {@link Provider} (or `Type`) is passed to {@link Injector}
  34722. * creation.
  34723. *
  34724. * @usageNotes
  34725. * ### Example
  34726. *
  34727. * ```typescript
  34728. * expect(() => Injector.resolveAndCreate(["not a type"])).toThrowError();
  34729. * ```
  34730. */
  34731. function invalidProviderError(provider) {
  34732. return Error("Invalid provider - only instances of Provider and Type are allowed, got: " + provider);
  34733. }
  34734. /**
  34735. * Thrown when the class has no annotation information.
  34736. *
  34737. * Lack of annotation information prevents the {@link Injector} from determining which dependencies
  34738. * need to be injected into the constructor.
  34739. *
  34740. * @usageNotes
  34741. * ### Example
  34742. *
  34743. * ```typescript
  34744. * class A {
  34745. * constructor(b) {}
  34746. * }
  34747. *
  34748. * expect(() => Injector.resolveAndCreate([A])).toThrowError();
  34749. * ```
  34750. *
  34751. * This error is also thrown when the class not marked with {@link Injectable} has parameter types.
  34752. *
  34753. * ```typescript
  34754. * class B {}
  34755. *
  34756. * class A {
  34757. * constructor(b:B) {} // no information about the parameter types of A is available at runtime.
  34758. * }
  34759. *
  34760. * expect(() => Injector.resolveAndCreate([A,B])).toThrowError();
  34761. * ```
  34762. *
  34763. */
  34764. function noAnnotationError(typeOrFunc, params) {
  34765. var signature = [];
  34766. for (var i = 0, ii = params.length; i < ii; i++) {
  34767. var parameter = params[i];
  34768. if (!parameter || parameter.length == 0) {
  34769. signature.push('?');
  34770. }
  34771. else {
  34772. signature.push(parameter.map(stringify).join(' '));
  34773. }
  34774. }
  34775. return Error('Cannot resolve all parameters for \'' + stringify(typeOrFunc) + '\'(' +
  34776. signature.join(', ') + '). ' +
  34777. 'Make sure that all the parameters are decorated with Inject or have valid type annotations and that \'' +
  34778. stringify(typeOrFunc) + '\' is decorated with Injectable.');
  34779. }
  34780. /**
  34781. * Thrown when getting an object by index.
  34782. *
  34783. * @usageNotes
  34784. * ### Example
  34785. *
  34786. * ```typescript
  34787. * class A {}
  34788. *
  34789. * var injector = Injector.resolveAndCreate([A]);
  34790. *
  34791. * expect(() => injector.getAt(100)).toThrowError();
  34792. * ```
  34793. *
  34794. */
  34795. function outOfBoundsError(index) {
  34796. return Error("Index " + index + " is out-of-bounds.");
  34797. }
  34798. // TODO: add a working example after alpha38 is released
  34799. /**
  34800. * Thrown when a multi provider and a regular provider are bound to the same token.
  34801. *
  34802. * @usageNotes
  34803. * ### Example
  34804. *
  34805. * ```typescript
  34806. * expect(() => Injector.resolveAndCreate([
  34807. * { provide: "Strings", useValue: "string1", multi: true},
  34808. * { provide: "Strings", useValue: "string2", multi: false}
  34809. * ])).toThrowError();
  34810. * ```
  34811. */
  34812. function mixingMultiProvidersWithRegularProvidersError(provider1, provider2) {
  34813. return Error("Cannot mix multi providers and regular providers, got: " + provider1 + " " + provider2);
  34814. }
  34815. /**
  34816. * @license
  34817. * Copyright Google Inc. All Rights Reserved.
  34818. *
  34819. * Use of this source code is governed by an MIT-style license that can be
  34820. * found in the LICENSE file at https://angular.io/license
  34821. */
  34822. /**
  34823. * A unique object used for retrieving items from the {@link ReflectiveInjector}.
  34824. *
  34825. * Keys have:
  34826. * - a system-wide unique `id`.
  34827. * - a `token`.
  34828. *
  34829. * `Key` is used internally by {@link ReflectiveInjector} because its system-wide unique `id` allows
  34830. * the
  34831. * injector to store created objects in a more efficient way.
  34832. *
  34833. * `Key` should not be created directly. {@link ReflectiveInjector} creates keys automatically when
  34834. * resolving
  34835. * providers.
  34836. * @deprecated No replacement
  34837. */
  34838. var ReflectiveKey = /** @class */ (function () {
  34839. /**
  34840. * Private
  34841. */
  34842. function ReflectiveKey(token, id) {
  34843. this.token = token;
  34844. this.id = id;
  34845. if (!token) {
  34846. throw new Error('Token must be defined!');
  34847. }
  34848. this.displayName = stringify(this.token);
  34849. }
  34850. /**
  34851. * Retrieves a `Key` for a token.
  34852. */
  34853. ReflectiveKey.get = function (token) {
  34854. return _globalKeyRegistry.get(resolveForwardRef(token));
  34855. };
  34856. Object.defineProperty(ReflectiveKey, "numberOfKeys", {
  34857. /**
  34858. * @returns the number of keys registered in the system.
  34859. */
  34860. get: function () { return _globalKeyRegistry.numberOfKeys; },
  34861. enumerable: true,
  34862. configurable: true
  34863. });
  34864. return ReflectiveKey;
  34865. }());
  34866. var KeyRegistry = /** @class */ (function () {
  34867. function KeyRegistry() {
  34868. this._allKeys = new Map();
  34869. }
  34870. KeyRegistry.prototype.get = function (token) {
  34871. if (token instanceof ReflectiveKey)
  34872. return token;
  34873. if (this._allKeys.has(token)) {
  34874. return this._allKeys.get(token);
  34875. }
  34876. var newKey = new ReflectiveKey(token, ReflectiveKey.numberOfKeys);
  34877. this._allKeys.set(token, newKey);
  34878. return newKey;
  34879. };
  34880. Object.defineProperty(KeyRegistry.prototype, "numberOfKeys", {
  34881. get: function () { return this._allKeys.size; },
  34882. enumerable: true,
  34883. configurable: true
  34884. });
  34885. return KeyRegistry;
  34886. }());
  34887. var _globalKeyRegistry = new KeyRegistry();
  34888. /**
  34889. * @license
  34890. * Copyright Google Inc. All Rights Reserved.
  34891. *
  34892. * Use of this source code is governed by an MIT-style license that can be
  34893. * found in the LICENSE file at https://angular.io/license
  34894. */
  34895. /**
  34896. * Provides access to reflection data about symbols. Used internally by Angular
  34897. * to power dependency injection and compilation.
  34898. */
  34899. var Reflector = /** @class */ (function () {
  34900. function Reflector(reflectionCapabilities) {
  34901. this.reflectionCapabilities = reflectionCapabilities;
  34902. }
  34903. Reflector.prototype.updateCapabilities = function (caps) { this.reflectionCapabilities = caps; };
  34904. Reflector.prototype.factory = function (type) { return this.reflectionCapabilities.factory(type); };
  34905. Reflector.prototype.parameters = function (typeOrFunc) {
  34906. return this.reflectionCapabilities.parameters(typeOrFunc);
  34907. };
  34908. Reflector.prototype.annotations = function (typeOrFunc) {
  34909. return this.reflectionCapabilities.annotations(typeOrFunc);
  34910. };
  34911. Reflector.prototype.propMetadata = function (typeOrFunc) {
  34912. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  34913. };
  34914. Reflector.prototype.hasLifecycleHook = function (type, lcProperty) {
  34915. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  34916. };
  34917. Reflector.prototype.getter = function (name) { return this.reflectionCapabilities.getter(name); };
  34918. Reflector.prototype.setter = function (name) { return this.reflectionCapabilities.setter(name); };
  34919. Reflector.prototype.method = function (name) { return this.reflectionCapabilities.method(name); };
  34920. Reflector.prototype.importUri = function (type) { return this.reflectionCapabilities.importUri(type); };
  34921. Reflector.prototype.resourceUri = function (type) { return this.reflectionCapabilities.resourceUri(type); };
  34922. Reflector.prototype.resolveIdentifier = function (name, moduleUrl, members, runtime) {
  34923. return this.reflectionCapabilities.resolveIdentifier(name, moduleUrl, members, runtime);
  34924. };
  34925. Reflector.prototype.resolveEnum = function (identifier, name) {
  34926. return this.reflectionCapabilities.resolveEnum(identifier, name);
  34927. };
  34928. return Reflector;
  34929. }());
  34930. /**
  34931. * @license
  34932. * Copyright Google Inc. All Rights Reserved.
  34933. *
  34934. * Use of this source code is governed by an MIT-style license that can be
  34935. * found in the LICENSE file at https://angular.io/license
  34936. */
  34937. /**
  34938. * The {@link Reflector} used internally in Angular to access metadata
  34939. * about symbols.
  34940. */
  34941. var reflector = new Reflector(new ReflectionCapabilities());
  34942. /**
  34943. * @license
  34944. * Copyright Google Inc. All Rights Reserved.
  34945. *
  34946. * Use of this source code is governed by an MIT-style license that can be
  34947. * found in the LICENSE file at https://angular.io/license
  34948. */
  34949. /**
  34950. * `Dependency` is used by the framework to extend DI.
  34951. * This is internal to Angular and should not be used directly.
  34952. */
  34953. var ReflectiveDependency = /** @class */ (function () {
  34954. function ReflectiveDependency(key, optional, visibility) {
  34955. this.key = key;
  34956. this.optional = optional;
  34957. this.visibility = visibility;
  34958. }
  34959. ReflectiveDependency.fromKey = function (key) {
  34960. return new ReflectiveDependency(key, false, null);
  34961. };
  34962. return ReflectiveDependency;
  34963. }());
  34964. var _EMPTY_LIST = [];
  34965. var ResolvedReflectiveProvider_ = /** @class */ (function () {
  34966. function ResolvedReflectiveProvider_(key, resolvedFactories, multiProvider) {
  34967. this.key = key;
  34968. this.resolvedFactories = resolvedFactories;
  34969. this.multiProvider = multiProvider;
  34970. this.resolvedFactory = this.resolvedFactories[0];
  34971. }
  34972. return ResolvedReflectiveProvider_;
  34973. }());
  34974. /**
  34975. * An internal resolved representation of a factory function created by resolving `Provider`.
  34976. * @experimental
  34977. */
  34978. var ResolvedReflectiveFactory = /** @class */ (function () {
  34979. function ResolvedReflectiveFactory(
  34980. /**
  34981. * Factory function which can return an instance of an object represented by a key.
  34982. */
  34983. factory,
  34984. /**
  34985. * Arguments (dependencies) to the `factory` function.
  34986. */
  34987. dependencies) {
  34988. this.factory = factory;
  34989. this.dependencies = dependencies;
  34990. }
  34991. return ResolvedReflectiveFactory;
  34992. }());
  34993. /**
  34994. * Resolve a single provider.
  34995. */
  34996. function resolveReflectiveFactory(provider) {
  34997. var factoryFn;
  34998. var resolvedDeps;
  34999. if (provider.useClass) {
  35000. var useClass = resolveForwardRef(provider.useClass);
  35001. factoryFn = reflector.factory(useClass);
  35002. resolvedDeps = _dependenciesFor(useClass);
  35003. }
  35004. else if (provider.useExisting) {
  35005. factoryFn = function (aliasInstance) { return aliasInstance; };
  35006. resolvedDeps = [ReflectiveDependency.fromKey(ReflectiveKey.get(provider.useExisting))];
  35007. }
  35008. else if (provider.useFactory) {
  35009. factoryFn = provider.useFactory;
  35010. resolvedDeps = constructDependencies(provider.useFactory, provider.deps);
  35011. }
  35012. else {
  35013. factoryFn = function () { return provider.useValue; };
  35014. resolvedDeps = _EMPTY_LIST;
  35015. }
  35016. return new ResolvedReflectiveFactory(factoryFn, resolvedDeps);
  35017. }
  35018. /**
  35019. * Converts the `Provider` into `ResolvedProvider`.
  35020. *
  35021. * `Injector` internally only uses `ResolvedProvider`, `Provider` contains convenience provider
  35022. * syntax.
  35023. */
  35024. function resolveReflectiveProvider(provider) {
  35025. return new ResolvedReflectiveProvider_(ReflectiveKey.get(provider.provide), [resolveReflectiveFactory(provider)], provider.multi || false);
  35026. }
  35027. /**
  35028. * Resolve a list of Providers.
  35029. */
  35030. function resolveReflectiveProviders(providers) {
  35031. var normalized = _normalizeProviders(providers, []);
  35032. var resolved = normalized.map(resolveReflectiveProvider);
  35033. var resolvedProviderMap = mergeResolvedReflectiveProviders(resolved, new Map());
  35034. return Array.from(resolvedProviderMap.values());
  35035. }
  35036. /**
  35037. * Merges a list of ResolvedProviders into a list where each key is contained exactly once and
  35038. * multi providers have been merged.
  35039. */
  35040. function mergeResolvedReflectiveProviders(providers, normalizedProvidersMap) {
  35041. for (var i = 0; i < providers.length; i++) {
  35042. var provider = providers[i];
  35043. var existing = normalizedProvidersMap.get(provider.key.id);
  35044. if (existing) {
  35045. if (provider.multiProvider !== existing.multiProvider) {
  35046. throw mixingMultiProvidersWithRegularProvidersError(existing, provider);
  35047. }
  35048. if (provider.multiProvider) {
  35049. for (var j = 0; j < provider.resolvedFactories.length; j++) {
  35050. existing.resolvedFactories.push(provider.resolvedFactories[j]);
  35051. }
  35052. }
  35053. else {
  35054. normalizedProvidersMap.set(provider.key.id, provider);
  35055. }
  35056. }
  35057. else {
  35058. var resolvedProvider = void 0;
  35059. if (provider.multiProvider) {
  35060. resolvedProvider = new ResolvedReflectiveProvider_(provider.key, provider.resolvedFactories.slice(), provider.multiProvider);
  35061. }
  35062. else {
  35063. resolvedProvider = provider;
  35064. }
  35065. normalizedProvidersMap.set(provider.key.id, resolvedProvider);
  35066. }
  35067. }
  35068. return normalizedProvidersMap;
  35069. }
  35070. function _normalizeProviders(providers, res) {
  35071. providers.forEach(function (b) {
  35072. if (b instanceof Type) {
  35073. res.push({ provide: b, useClass: b });
  35074. }
  35075. else if (b && typeof b == 'object' && b.provide !== undefined) {
  35076. res.push(b);
  35077. }
  35078. else if (b instanceof Array) {
  35079. _normalizeProviders(b, res);
  35080. }
  35081. else {
  35082. throw invalidProviderError(b);
  35083. }
  35084. });
  35085. return res;
  35086. }
  35087. function constructDependencies(typeOrFunc, dependencies) {
  35088. if (!dependencies) {
  35089. return _dependenciesFor(typeOrFunc);
  35090. }
  35091. else {
  35092. var params_1 = dependencies.map(function (t) { return [t]; });
  35093. return dependencies.map(function (t) { return _extractToken(typeOrFunc, t, params_1); });
  35094. }
  35095. }
  35096. function _dependenciesFor(typeOrFunc) {
  35097. var params = reflector.parameters(typeOrFunc);
  35098. if (!params)
  35099. return [];
  35100. if (params.some(function (p) { return p == null; })) {
  35101. throw noAnnotationError(typeOrFunc, params);
  35102. }
  35103. return params.map(function (p) { return _extractToken(typeOrFunc, p, params); });
  35104. }
  35105. function _extractToken(typeOrFunc, metadata, params) {
  35106. var token = null;
  35107. var optional = false;
  35108. if (!Array.isArray(metadata)) {
  35109. if (metadata instanceof Inject) {
  35110. return _createDependency(metadata.token, optional, null);
  35111. }
  35112. else {
  35113. return _createDependency(metadata, optional, null);
  35114. }
  35115. }
  35116. var visibility = null;
  35117. for (var i = 0; i < metadata.length; ++i) {
  35118. var paramMetadata = metadata[i];
  35119. if (paramMetadata instanceof Type) {
  35120. token = paramMetadata;
  35121. }
  35122. else if (paramMetadata instanceof Inject) {
  35123. token = paramMetadata.token;
  35124. }
  35125. else if (paramMetadata instanceof Optional) {
  35126. optional = true;
  35127. }
  35128. else if (paramMetadata instanceof Self || paramMetadata instanceof SkipSelf) {
  35129. visibility = paramMetadata;
  35130. }
  35131. else if (paramMetadata instanceof InjectionToken) {
  35132. token = paramMetadata;
  35133. }
  35134. }
  35135. token = resolveForwardRef(token);
  35136. if (token != null) {
  35137. return _createDependency(token, optional, visibility);
  35138. }
  35139. else {
  35140. throw noAnnotationError(typeOrFunc, params);
  35141. }
  35142. }
  35143. function _createDependency(token, optional, visibility) {
  35144. return new ReflectiveDependency(ReflectiveKey.get(token), optional, visibility);
  35145. }
  35146. /**
  35147. * @license
  35148. * Copyright Google Inc. All Rights Reserved.
  35149. *
  35150. * Use of this source code is governed by an MIT-style license that can be
  35151. * found in the LICENSE file at https://angular.io/license
  35152. */
  35153. // Threshold for the dynamic version
  35154. var UNDEFINED = new Object();
  35155. /**
  35156. * A ReflectiveDependency injection container used for instantiating objects and resolving
  35157. * dependencies.
  35158. *
  35159. * An `Injector` is a replacement for a `new` operator, which can automatically resolve the
  35160. * constructor dependencies.
  35161. *
  35162. * In typical use, application code asks for the dependencies in the constructor and they are
  35163. * resolved by the `Injector`.
  35164. *
  35165. * @usageNotes
  35166. * ### Example
  35167. *
  35168. * The following example creates an `Injector` configured to create `Engine` and `Car`.
  35169. *
  35170. * ```typescript
  35171. * @Injectable()
  35172. * class Engine {
  35173. * }
  35174. *
  35175. * @Injectable()
  35176. * class Car {
  35177. * constructor(public engine:Engine) {}
  35178. * }
  35179. *
  35180. * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
  35181. * var car = injector.get(Car);
  35182. * expect(car instanceof Car).toBe(true);
  35183. * expect(car.engine instanceof Engine).toBe(true);
  35184. * ```
  35185. *
  35186. * Notice, we don't use the `new` operator because we explicitly want to have the `Injector`
  35187. * resolve all of the object's dependencies automatically.
  35188. *
  35189. * @deprecated from v5 - slow and brings in a lot of code, Use `Injector.create` instead.
  35190. */
  35191. var ReflectiveInjector = /** @class */ (function () {
  35192. function ReflectiveInjector() {
  35193. }
  35194. /**
  35195. * Turns an array of provider definitions into an array of resolved providers.
  35196. *
  35197. * A resolution is a process of flattening multiple nested arrays and converting individual
  35198. * providers into an array of `ResolvedReflectiveProvider`s.
  35199. *
  35200. * @usageNotes
  35201. * ### Example
  35202. *
  35203. * ```typescript
  35204. * @Injectable()
  35205. * class Engine {
  35206. * }
  35207. *
  35208. * @Injectable()
  35209. * class Car {
  35210. * constructor(public engine:Engine) {}
  35211. * }
  35212. *
  35213. * var providers = ReflectiveInjector.resolve([Car, [[Engine]]]);
  35214. *
  35215. * expect(providers.length).toEqual(2);
  35216. *
  35217. * expect(providers[0] instanceof ResolvedReflectiveProvider).toBe(true);
  35218. * expect(providers[0].key.displayName).toBe("Car");
  35219. * expect(providers[0].dependencies.length).toEqual(1);
  35220. * expect(providers[0].factory).toBeDefined();
  35221. *
  35222. * expect(providers[1].key.displayName).toBe("Engine");
  35223. * });
  35224. * ```
  35225. *
  35226. */
  35227. ReflectiveInjector.resolve = function (providers) {
  35228. return resolveReflectiveProviders(providers);
  35229. };
  35230. /**
  35231. * Resolves an array of providers and creates an injector from those providers.
  35232. *
  35233. * The passed-in providers can be an array of `Type`, `Provider`,
  35234. * or a recursive array of more providers.
  35235. *
  35236. * @usageNotes
  35237. * ### Example
  35238. *
  35239. * ```typescript
  35240. * @Injectable()
  35241. * class Engine {
  35242. * }
  35243. *
  35244. * @Injectable()
  35245. * class Car {
  35246. * constructor(public engine:Engine) {}
  35247. * }
  35248. *
  35249. * var injector = ReflectiveInjector.resolveAndCreate([Car, Engine]);
  35250. * expect(injector.get(Car) instanceof Car).toBe(true);
  35251. * ```
  35252. */
  35253. ReflectiveInjector.resolveAndCreate = function (providers, parent) {
  35254. var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
  35255. return ReflectiveInjector.fromResolvedProviders(ResolvedReflectiveProviders, parent);
  35256. };
  35257. /**
  35258. * Creates an injector from previously resolved providers.
  35259. *
  35260. * This API is the recommended way to construct injectors in performance-sensitive parts.
  35261. *
  35262. * @usageNotes
  35263. * ### Example
  35264. *
  35265. * ```typescript
  35266. * @Injectable()
  35267. * class Engine {
  35268. * }
  35269. *
  35270. * @Injectable()
  35271. * class Car {
  35272. * constructor(public engine:Engine) {}
  35273. * }
  35274. *
  35275. * var providers = ReflectiveInjector.resolve([Car, Engine]);
  35276. * var injector = ReflectiveInjector.fromResolvedProviders(providers);
  35277. * expect(injector.get(Car) instanceof Car).toBe(true);
  35278. * ```
  35279. * @experimental
  35280. */
  35281. ReflectiveInjector.fromResolvedProviders = function (providers, parent) {
  35282. return new ReflectiveInjector_(providers, parent);
  35283. };
  35284. return ReflectiveInjector;
  35285. }());
  35286. var ReflectiveInjector_ = /** @class */ (function () {
  35287. /**
  35288. * Private
  35289. */
  35290. function ReflectiveInjector_(_providers, _parent) {
  35291. /** @internal */
  35292. this._constructionCounter = 0;
  35293. this._providers = _providers;
  35294. this.parent = _parent || null;
  35295. var len = _providers.length;
  35296. this.keyIds = new Array(len);
  35297. this.objs = new Array(len);
  35298. for (var i = 0; i < len; i++) {
  35299. this.keyIds[i] = _providers[i].key.id;
  35300. this.objs[i] = UNDEFINED;
  35301. }
  35302. }
  35303. ReflectiveInjector_.prototype.get = function (token, notFoundValue) {
  35304. if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
  35305. return this._getByKey(ReflectiveKey.get(token), null, notFoundValue);
  35306. };
  35307. ReflectiveInjector_.prototype.resolveAndCreateChild = function (providers) {
  35308. var ResolvedReflectiveProviders = ReflectiveInjector.resolve(providers);
  35309. return this.createChildFromResolved(ResolvedReflectiveProviders);
  35310. };
  35311. ReflectiveInjector_.prototype.createChildFromResolved = function (providers) {
  35312. var inj = new ReflectiveInjector_(providers);
  35313. inj.parent = this;
  35314. return inj;
  35315. };
  35316. ReflectiveInjector_.prototype.resolveAndInstantiate = function (provider) {
  35317. return this.instantiateResolved(ReflectiveInjector.resolve([provider])[0]);
  35318. };
  35319. ReflectiveInjector_.prototype.instantiateResolved = function (provider) {
  35320. return this._instantiateProvider(provider);
  35321. };
  35322. ReflectiveInjector_.prototype.getProviderAtIndex = function (index) {
  35323. if (index < 0 || index >= this._providers.length) {
  35324. throw outOfBoundsError(index);
  35325. }
  35326. return this._providers[index];
  35327. };
  35328. /** @internal */
  35329. ReflectiveInjector_.prototype._new = function (provider) {
  35330. if (this._constructionCounter++ > this._getMaxNumberOfObjects()) {
  35331. throw cyclicDependencyError(this, provider.key);
  35332. }
  35333. return this._instantiateProvider(provider);
  35334. };
  35335. ReflectiveInjector_.prototype._getMaxNumberOfObjects = function () { return this.objs.length; };
  35336. ReflectiveInjector_.prototype._instantiateProvider = function (provider) {
  35337. if (provider.multiProvider) {
  35338. var res = new Array(provider.resolvedFactories.length);
  35339. for (var i = 0; i < provider.resolvedFactories.length; ++i) {
  35340. res[i] = this._instantiate(provider, provider.resolvedFactories[i]);
  35341. }
  35342. return res;
  35343. }
  35344. else {
  35345. return this._instantiate(provider, provider.resolvedFactories[0]);
  35346. }
  35347. };
  35348. ReflectiveInjector_.prototype._instantiate = function (provider, ResolvedReflectiveFactory$$1) {
  35349. var _this = this;
  35350. var factory = ResolvedReflectiveFactory$$1.factory;
  35351. var deps;
  35352. try {
  35353. deps =
  35354. ResolvedReflectiveFactory$$1.dependencies.map(function (dep) { return _this._getByReflectiveDependency(dep); });
  35355. }
  35356. catch (e) {
  35357. if (e.addKey) {
  35358. e.addKey(this, provider.key);
  35359. }
  35360. throw e;
  35361. }
  35362. var obj;
  35363. try {
  35364. obj = factory.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(deps));
  35365. }
  35366. catch (e) {
  35367. throw instantiationError(this, e, e.stack, provider.key);
  35368. }
  35369. return obj;
  35370. };
  35371. ReflectiveInjector_.prototype._getByReflectiveDependency = function (dep) {
  35372. return this._getByKey(dep.key, dep.visibility, dep.optional ? null : THROW_IF_NOT_FOUND);
  35373. };
  35374. ReflectiveInjector_.prototype._getByKey = function (key, visibility, notFoundValue) {
  35375. if (key === ReflectiveInjector_.INJECTOR_KEY) {
  35376. return this;
  35377. }
  35378. if (visibility instanceof Self) {
  35379. return this._getByKeySelf(key, notFoundValue);
  35380. }
  35381. else {
  35382. return this._getByKeyDefault(key, notFoundValue, visibility);
  35383. }
  35384. };
  35385. ReflectiveInjector_.prototype._getObjByKeyId = function (keyId) {
  35386. for (var i = 0; i < this.keyIds.length; i++) {
  35387. if (this.keyIds[i] === keyId) {
  35388. if (this.objs[i] === UNDEFINED) {
  35389. this.objs[i] = this._new(this._providers[i]);
  35390. }
  35391. return this.objs[i];
  35392. }
  35393. }
  35394. return UNDEFINED;
  35395. };
  35396. /** @internal */
  35397. ReflectiveInjector_.prototype._throwOrNull = function (key, notFoundValue) {
  35398. if (notFoundValue !== THROW_IF_NOT_FOUND) {
  35399. return notFoundValue;
  35400. }
  35401. else {
  35402. throw noProviderError(this, key);
  35403. }
  35404. };
  35405. /** @internal */
  35406. ReflectiveInjector_.prototype._getByKeySelf = function (key, notFoundValue) {
  35407. var obj = this._getObjByKeyId(key.id);
  35408. return (obj !== UNDEFINED) ? obj : this._throwOrNull(key, notFoundValue);
  35409. };
  35410. /** @internal */
  35411. ReflectiveInjector_.prototype._getByKeyDefault = function (key, notFoundValue, visibility) {
  35412. var inj;
  35413. if (visibility instanceof SkipSelf) {
  35414. inj = this.parent;
  35415. }
  35416. else {
  35417. inj = this;
  35418. }
  35419. while (inj instanceof ReflectiveInjector_) {
  35420. var inj_ = inj;
  35421. var obj = inj_._getObjByKeyId(key.id);
  35422. if (obj !== UNDEFINED)
  35423. return obj;
  35424. inj = inj_.parent;
  35425. }
  35426. if (inj !== null) {
  35427. return inj.get(key.token, notFoundValue);
  35428. }
  35429. else {
  35430. return this._throwOrNull(key, notFoundValue);
  35431. }
  35432. };
  35433. Object.defineProperty(ReflectiveInjector_.prototype, "displayName", {
  35434. get: function () {
  35435. var providers = _mapProviders(this, function (b) { return ' "' + b.key.displayName + '" '; })
  35436. .join(', ');
  35437. return "ReflectiveInjector(providers: [" + providers + "])";
  35438. },
  35439. enumerable: true,
  35440. configurable: true
  35441. });
  35442. ReflectiveInjector_.prototype.toString = function () { return this.displayName; };
  35443. ReflectiveInjector_.INJECTOR_KEY = ReflectiveKey.get(Injector);
  35444. return ReflectiveInjector_;
  35445. }());
  35446. function _mapProviders(injector, fn) {
  35447. var res = new Array(injector._providers.length);
  35448. for (var i = 0; i < injector._providers.length; ++i) {
  35449. res[i] = fn(injector.getProviderAtIndex(i));
  35450. }
  35451. return res;
  35452. }
  35453. /**
  35454. * @license
  35455. * Copyright Google Inc. All Rights Reserved.
  35456. *
  35457. * Use of this source code is governed by an MIT-style license that can be
  35458. * found in the LICENSE file at https://angular.io/license
  35459. */
  35460. /**
  35461. * An internal token whose presence in an injector indicates that the injector should treat itself
  35462. * as a root scoped injector when processing requests for unknown tokens which may indicate
  35463. * they are provided in the root scope.
  35464. */
  35465. var APP_ROOT = new InjectionToken('The presence of this token marks an injector as being the root injector.');
  35466. /**
  35467. * @license
  35468. * Copyright Google Inc. All Rights Reserved.
  35469. *
  35470. * Use of this source code is governed by an MIT-style license that can be
  35471. * found in the LICENSE file at https://angular.io/license
  35472. */
  35473. /**
  35474. * Marker which indicates that a value has not yet been created from the factory function.
  35475. */
  35476. var NOT_YET = {};
  35477. /**
  35478. * Marker which indicates that the factory function for a token is in the process of being called.
  35479. *
  35480. * If the injector is asked to inject a token with its value set to CIRCULAR, that indicates
  35481. * injection of a dependency has recursively attempted to inject the original token, and there is
  35482. * a circular dependency among the providers.
  35483. */
  35484. var CIRCULAR$1 = {};
  35485. var EMPTY_ARRAY$1 = [];
  35486. /**
  35487. * A lazily initialized NullInjector.
  35488. */
  35489. var NULL_INJECTOR$1 = undefined;
  35490. function getNullInjector() {
  35491. if (NULL_INJECTOR$1 === undefined) {
  35492. NULL_INJECTOR$1 = new NullInjector();
  35493. }
  35494. return NULL_INJECTOR$1;
  35495. }
  35496. /**
  35497. * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s.
  35498. *
  35499. * @experimental
  35500. */
  35501. function createInjector(defType, parent, additionalProviders) {
  35502. if (parent === void 0) { parent = null; }
  35503. if (additionalProviders === void 0) { additionalProviders = null; }
  35504. parent = parent || getNullInjector();
  35505. return new R3Injector(defType, additionalProviders, parent);
  35506. }
  35507. var R3Injector = /** @class */ (function () {
  35508. function R3Injector(def, additionalProviders, parent) {
  35509. var _this = this;
  35510. this.parent = parent;
  35511. /**
  35512. * Map of tokens to records which contain the instances of those tokens.
  35513. */
  35514. this.records = new Map();
  35515. /**
  35516. * The transitive set of `InjectorType`s which define this injector.
  35517. */
  35518. this.injectorDefTypes = new Set();
  35519. /**
  35520. * Set of values instantiated by this injector which contain `ngOnDestroy` lifecycle hooks.
  35521. */
  35522. this.onDestroy = new Set();
  35523. /**
  35524. * Flag indicating that this injector was previously destroyed.
  35525. */
  35526. this.destroyed = false;
  35527. // Start off by creating Records for every provider declared in every InjectorType
  35528. // included transitively in `def`.
  35529. deepForEach([def], function (injectorDef) { return _this.processInjectorType(injectorDef, new Set()); });
  35530. additionalProviders &&
  35531. deepForEach(additionalProviders, function (provider) { return _this.processProvider(provider); });
  35532. // Make sure the INJECTOR token provides this injector.
  35533. this.records.set(INJECTOR, makeRecord(undefined, this));
  35534. // Detect whether this injector has the APP_ROOT_SCOPE token and thus should provide
  35535. // any injectable scoped to APP_ROOT_SCOPE.
  35536. this.isRootInjector = this.records.has(APP_ROOT);
  35537. // Eagerly instantiate the InjectorType classes themselves.
  35538. this.injectorDefTypes.forEach(function (defType) { return _this.get(defType); });
  35539. }
  35540. /**
  35541. * Destroy the injector and release references to every instance or provider associated with it.
  35542. *
  35543. * Also calls the `OnDestroy` lifecycle hooks of every instance that was created for which a
  35544. * hook was found.
  35545. */
  35546. R3Injector.prototype.destroy = function () {
  35547. this.assertNotDestroyed();
  35548. // Set destroyed = true first, in case lifecycle hooks re-enter destroy().
  35549. this.destroyed = true;
  35550. try {
  35551. // Call all the lifecycle hooks.
  35552. this.onDestroy.forEach(function (service) { return service.ngOnDestroy(); });
  35553. }
  35554. finally {
  35555. // Release all references.
  35556. this.records.clear();
  35557. this.onDestroy.clear();
  35558. this.injectorDefTypes.clear();
  35559. }
  35560. };
  35561. R3Injector.prototype.get = function (token, notFoundValue, flags) {
  35562. if (notFoundValue === void 0) { notFoundValue = THROW_IF_NOT_FOUND; }
  35563. if (flags === void 0) { flags = 0 /* Default */; }
  35564. this.assertNotDestroyed();
  35565. // Set the injection context.
  35566. var previousInjector = setCurrentInjector(this);
  35567. try {
  35568. // Check for the SkipSelf flag.
  35569. if (!(flags & 4 /* SkipSelf */)) {
  35570. // SkipSelf isn't set, check if the record belongs to this injector.
  35571. var record = this.records.get(token);
  35572. if (record === undefined) {
  35573. // No record, but maybe the token is scoped to this injector. Look for an ngInjectableDef
  35574. // with a scope matching this injector.
  35575. var def = couldBeInjectableType(token) &&
  35576. token.ngInjectableDef ||
  35577. undefined;
  35578. if (def !== undefined && this.injectableDefInScope(def)) {
  35579. // Found an ngInjectableDef and it's scoped to this injector. Pretend as if it was here
  35580. // all along.
  35581. record = injectableDefRecord(token);
  35582. this.records.set(token, record);
  35583. }
  35584. }
  35585. // If a record was found, get the instance for it and return it.
  35586. if (record !== undefined) {
  35587. return this.hydrate(token, record);
  35588. }
  35589. }
  35590. // Select the next injector based on the Self flag - if self is set, the next injector is
  35591. // the NullInjector, otherwise it's the parent.
  35592. var next = !(flags & 2 /* Self */) ? this.parent : getNullInjector();
  35593. return this.parent.get(token, notFoundValue);
  35594. }
  35595. finally {
  35596. // Lastly, clean up the state by restoring the previous injector.
  35597. setCurrentInjector(previousInjector);
  35598. }
  35599. };
  35600. R3Injector.prototype.assertNotDestroyed = function () {
  35601. if (this.destroyed) {
  35602. throw new Error('Injector has already been destroyed.');
  35603. }
  35604. };
  35605. /**
  35606. * Add an `InjectorType` or `InjectorDefTypeWithProviders` and all of its transitive providers
  35607. * to this injector.
  35608. */
  35609. R3Injector.prototype.processInjectorType = function (defOrWrappedDef, parents) {
  35610. var _this = this;
  35611. defOrWrappedDef = resolveForwardRef(defOrWrappedDef);
  35612. // Either the defOrWrappedDef is an InjectorType (with ngInjectorDef) or an
  35613. // InjectorDefTypeWithProviders (aka ModuleWithProviders). Detecting either is a megamorphic
  35614. // read, so care is taken to only do the read once.
  35615. // First attempt to read the ngInjectorDef.
  35616. var def = defOrWrappedDef.ngInjectorDef;
  35617. // If that's not present, then attempt to read ngModule from the InjectorDefTypeWithProviders.
  35618. var ngModule = (def == null) && defOrWrappedDef.ngModule || undefined;
  35619. // Determine the InjectorType. In the case where `defOrWrappedDef` is an `InjectorType`,
  35620. // then this is easy. In the case of an InjectorDefTypeWithProviders, then the definition type
  35621. // is the `ngModule`.
  35622. var defType = (ngModule === undefined) ? defOrWrappedDef : ngModule;
  35623. // If defOrWrappedType was an InjectorDefTypeWithProviders, then .providers may hold some
  35624. // extra providers.
  35625. var providers = (ngModule !== undefined) && defOrWrappedDef.providers ||
  35626. EMPTY_ARRAY$1;
  35627. // Finally, if defOrWrappedType was an `InjectorDefTypeWithProviders`, then the actual
  35628. // `InjectorDef` is on its `ngModule`.
  35629. if (ngModule !== undefined) {
  35630. def = ngModule.ngInjectorDef;
  35631. }
  35632. // If no definition was found, it might be from exports. Remove it.
  35633. if (def == null) {
  35634. return;
  35635. }
  35636. // Check for circular dependencies.
  35637. if (parents.has(defType)) {
  35638. throw new Error("Circular dependency: type " + stringify(defType) + " ends up importing itself.");
  35639. }
  35640. // Track the InjectorType and add a provider for it.
  35641. this.injectorDefTypes.add(defType);
  35642. this.records.set(defType, makeRecord(def.factory));
  35643. // Add providers in the same way that @NgModule resolution did:
  35644. // First, include providers from any imports.
  35645. if (def.imports != null) {
  35646. // Before processing defType's imports, add it to the set of parents. This way, if it ends
  35647. // up deeply importing itself, this can be detected.
  35648. parents.add(defType);
  35649. try {
  35650. deepForEach(def.imports, function (imported) { return _this.processInjectorType(imported, parents); });
  35651. }
  35652. finally {
  35653. // Remove it from the parents set when finished.
  35654. parents.delete(defType);
  35655. }
  35656. }
  35657. // Next, include providers listed on the definition itself.
  35658. if (def.providers != null) {
  35659. deepForEach(def.providers, function (provider) { return _this.processProvider(provider); });
  35660. }
  35661. // Finally, include providers from an InjectorDefTypeWithProviders if there was one.
  35662. deepForEach(providers, function (provider) { return _this.processProvider(provider); });
  35663. };
  35664. /**
  35665. * Process a `SingleProvider` and add it.
  35666. */
  35667. R3Injector.prototype.processProvider = function (provider) {
  35668. // Determine the token from the provider. Either it's its own token, or has a {provide: ...}
  35669. // property.
  35670. provider = resolveForwardRef(provider);
  35671. var token = isTypeProvider(provider) ? provider : resolveForwardRef(provider.provide);
  35672. // Construct a `Record` for the provider.
  35673. var record = providerToRecord(provider);
  35674. if (!isTypeProvider(provider) && provider.multi === true) {
  35675. // If the provider indicates that it's a multi-provider, process it specially.
  35676. // First check whether it's been defined already.
  35677. var multiRecord_1 = this.records.get(token);
  35678. if (multiRecord_1) {
  35679. // It has. Throw a nice error if
  35680. if (multiRecord_1.multi === undefined) {
  35681. throw new Error("Mixed multi-provider for " + token + ".");
  35682. }
  35683. }
  35684. else {
  35685. multiRecord_1 = makeRecord(undefined, NOT_YET, true);
  35686. multiRecord_1.factory = function () { return injectArgs(multiRecord_1.multi); };
  35687. this.records.set(token, multiRecord_1);
  35688. }
  35689. token = provider;
  35690. multiRecord_1.multi.push(provider);
  35691. }
  35692. else {
  35693. var existing = this.records.get(token);
  35694. if (existing && existing.multi !== undefined) {
  35695. throw new Error("Mixed multi-provider for " + stringify(token));
  35696. }
  35697. }
  35698. this.records.set(token, record);
  35699. };
  35700. R3Injector.prototype.hydrate = function (token, record) {
  35701. if (record.value === CIRCULAR$1) {
  35702. throw new Error("Circular dep for " + stringify(token));
  35703. }
  35704. else if (record.value === NOT_YET) {
  35705. record.value = CIRCULAR$1;
  35706. record.value = record.factory();
  35707. }
  35708. if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {
  35709. this.onDestroy.add(record.value);
  35710. }
  35711. return record.value;
  35712. };
  35713. R3Injector.prototype.injectableDefInScope = function (def) {
  35714. if (!def.providedIn) {
  35715. return false;
  35716. }
  35717. else if (typeof def.providedIn === 'string') {
  35718. return def.providedIn === 'any' || (def.providedIn === 'root' && this.isRootInjector);
  35719. }
  35720. else {
  35721. return this.injectorDefTypes.has(def.providedIn);
  35722. }
  35723. };
  35724. return R3Injector;
  35725. }());
  35726. function injectableDefRecord(token) {
  35727. var def = token.ngInjectableDef;
  35728. if (def === undefined) {
  35729. if (token instanceof InjectionToken) {
  35730. throw new Error("Token " + stringify(token) + " is missing an ngInjectableDef definition.");
  35731. }
  35732. // TODO(alxhub): there should probably be a strict mode which throws here instead of assuming a
  35733. // no-args constructor.
  35734. return makeRecord(function () { return new token(); });
  35735. }
  35736. return makeRecord(def.factory);
  35737. }
  35738. function providerToRecord(provider) {
  35739. var token = resolveForwardRef(provider);
  35740. var value = NOT_YET;
  35741. var factory = undefined;
  35742. if (isTypeProvider(provider)) {
  35743. return injectableDefRecord(provider);
  35744. }
  35745. else {
  35746. token = resolveForwardRef(provider.provide);
  35747. if (isValueProvider(provider)) {
  35748. value = provider.useValue;
  35749. }
  35750. else if (isExistingProvider(provider)) {
  35751. factory = function () { return inject(provider.useExisting); };
  35752. }
  35753. else if (isFactoryProvider(provider)) {
  35754. factory = function () { return provider.useFactory.apply(provider, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(injectArgs(provider.deps || []))); };
  35755. }
  35756. else {
  35757. var classRef_1 = provider.useClass || token;
  35758. if (hasDeps(provider)) {
  35759. factory = function () { return new ((classRef_1).bind.apply((classRef_1), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], injectArgs(provider.deps))))(); };
  35760. }
  35761. else {
  35762. return injectableDefRecord(classRef_1);
  35763. }
  35764. }
  35765. }
  35766. return makeRecord(factory, value);
  35767. }
  35768. function makeRecord(factory, value, multi) {
  35769. if (value === void 0) { value = NOT_YET; }
  35770. if (multi === void 0) { multi = false; }
  35771. return {
  35772. factory: factory,
  35773. value: value,
  35774. multi: multi ? [] : undefined,
  35775. };
  35776. }
  35777. function deepForEach(input, fn) {
  35778. input.forEach(function (value) { return Array.isArray(value) ? deepForEach(value, fn) : fn(value); });
  35779. }
  35780. function isValueProvider(value) {
  35781. return USE_VALUE in value;
  35782. }
  35783. function isExistingProvider(value) {
  35784. return !!value.useExisting;
  35785. }
  35786. function isFactoryProvider(value) {
  35787. return !!value.useFactory;
  35788. }
  35789. function isTypeProvider(value) {
  35790. return typeof value === 'function';
  35791. }
  35792. function hasDeps(value) {
  35793. return !!value.deps;
  35794. }
  35795. function hasOnDestroy(value) {
  35796. return typeof value === 'object' && value != null && value.ngOnDestroy &&
  35797. typeof value.ngOnDestroy === 'function';
  35798. }
  35799. function couldBeInjectableType(value) {
  35800. return (typeof value === 'function') ||
  35801. (typeof value === 'object' && value instanceof InjectionToken);
  35802. }
  35803. /**
  35804. * @license
  35805. * Copyright Google Inc. All Rights Reserved.
  35806. *
  35807. * Use of this source code is governed by an MIT-style license that can be
  35808. * found in the LICENSE file at https://angular.io/license
  35809. */
  35810. /**
  35811. * @license
  35812. * Copyright Google Inc. All Rights Reserved.
  35813. *
  35814. * Use of this source code is governed by an MIT-style license that can be
  35815. * found in the LICENSE file at https://angular.io/license
  35816. */
  35817. /**
  35818. * Determine if the argument is shaped like a Promise
  35819. */
  35820. function isPromise(obj) {
  35821. // allow any Promise/A+ compliant thenable.
  35822. // It's up to the caller to ensure that obj.then conforms to the spec
  35823. return !!obj && typeof obj.then === 'function';
  35824. }
  35825. /**
  35826. * Determine if the argument is an Observable
  35827. */
  35828. function isObservable(obj) {
  35829. // TODO: use Symbol.observable when https://github.com/ReactiveX/rxjs/issues/2415 will be resolved
  35830. return !!obj && typeof obj.subscribe === 'function';
  35831. }
  35832. /**
  35833. * @license
  35834. * Copyright Google Inc. All Rights Reserved.
  35835. *
  35836. * Use of this source code is governed by an MIT-style license that can be
  35837. * found in the LICENSE file at https://angular.io/license
  35838. */
  35839. /**
  35840. * A function that will be executed when an application is initialized.
  35841. */
  35842. var APP_INITIALIZER = new InjectionToken('Application Initializer');
  35843. /**
  35844. * A class that reflects the state of running {@link APP_INITIALIZER}s.
  35845. */
  35846. var ApplicationInitStatus = /** @class */ (function () {
  35847. function ApplicationInitStatus(appInits) {
  35848. var _this = this;
  35849. this.appInits = appInits;
  35850. this.initialized = false;
  35851. this.done = false;
  35852. this.donePromise = new Promise(function (res, rej) {
  35853. _this.resolve = res;
  35854. _this.reject = rej;
  35855. });
  35856. }
  35857. /** @internal */
  35858. ApplicationInitStatus.prototype.runInitializers = function () {
  35859. var _this = this;
  35860. if (this.initialized) {
  35861. return;
  35862. }
  35863. var asyncInitPromises = [];
  35864. var complete = function () {
  35865. _this.done = true;
  35866. _this.resolve();
  35867. };
  35868. if (this.appInits) {
  35869. for (var i = 0; i < this.appInits.length; i++) {
  35870. var initResult = this.appInits[i]();
  35871. if (isPromise(initResult)) {
  35872. asyncInitPromises.push(initResult);
  35873. }
  35874. }
  35875. }
  35876. Promise.all(asyncInitPromises).then(function () { complete(); }).catch(function (e) { _this.reject(e); });
  35877. if (asyncInitPromises.length === 0) {
  35878. complete();
  35879. }
  35880. this.initialized = true;
  35881. };
  35882. ApplicationInitStatus = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  35883. Injectable(),
  35884. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Inject(APP_INITIALIZER)), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Optional()),
  35885. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Array])
  35886. ], ApplicationInitStatus);
  35887. return ApplicationInitStatus;
  35888. }());
  35889. /**
  35890. * @license
  35891. * Copyright Google Inc. All Rights Reserved.
  35892. *
  35893. * Use of this source code is governed by an MIT-style license that can be
  35894. * found in the LICENSE file at https://angular.io/license
  35895. */
  35896. /**
  35897. * A DI Token representing a unique string id assigned to the application by Angular and used
  35898. * primarily for prefixing application attributes and CSS styles when
  35899. * {@link ViewEncapsulation#Emulated ViewEncapsulation.Emulated} is being used.
  35900. *
  35901. * If you need to avoid randomly generated value to be used as an application id, you can provide
  35902. * a custom value via a DI provider <!-- TODO: provider --> configuring the root {@link Injector}
  35903. * using this token.
  35904. * @experimental
  35905. */
  35906. var APP_ID = new InjectionToken('AppId');
  35907. function _appIdRandomProviderFactory() {
  35908. return "" + _randomChar() + _randomChar() + _randomChar();
  35909. }
  35910. /**
  35911. * Providers that will generate a random APP_ID_TOKEN.
  35912. * @experimental
  35913. */
  35914. var APP_ID_RANDOM_PROVIDER = {
  35915. provide: APP_ID,
  35916. useFactory: _appIdRandomProviderFactory,
  35917. deps: [],
  35918. };
  35919. function _randomChar() {
  35920. return String.fromCharCode(97 + Math.floor(Math.random() * 25));
  35921. }
  35922. /**
  35923. * A function that will be executed when a platform is initialized.
  35924. * @experimental
  35925. */
  35926. var PLATFORM_INITIALIZER = new InjectionToken('Platform Initializer');
  35927. /**
  35928. * A token that indicates an opaque platform id.
  35929. * @experimental
  35930. */
  35931. var PLATFORM_ID = new InjectionToken('Platform ID');
  35932. /**
  35933. * All callbacks provided via this token will be called for every component that is bootstrapped.
  35934. * Signature of the callback:
  35935. *
  35936. * `(componentRef: ComponentRef) => void`.
  35937. *
  35938. * @experimental
  35939. */
  35940. var APP_BOOTSTRAP_LISTENER = new InjectionToken('appBootstrapListener');
  35941. /**
  35942. * A token which indicates the root directory of the application
  35943. * @experimental
  35944. */
  35945. var PACKAGE_ROOT_URL = new InjectionToken('Application Packages Root URL');
  35946. /**
  35947. * @license
  35948. * Copyright Google Inc. All Rights Reserved.
  35949. *
  35950. * Use of this source code is governed by an MIT-style license that can be
  35951. * found in the LICENSE file at https://angular.io/license
  35952. */
  35953. var Console = /** @class */ (function () {
  35954. function Console() {
  35955. }
  35956. Console.prototype.log = function (message) {
  35957. // tslint:disable-next-line:no-console
  35958. console.log(message);
  35959. };
  35960. // Note: for reporting errors use `DOM.logError()` as it is platform specific
  35961. Console.prototype.warn = function (message) {
  35962. // tslint:disable-next-line:no-console
  35963. console.warn(message);
  35964. };
  35965. Console = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  35966. Injectable()
  35967. ], Console);
  35968. return Console;
  35969. }());
  35970. /**
  35971. * @license
  35972. * Copyright Google Inc. All Rights Reserved.
  35973. *
  35974. * Use of this source code is governed by an MIT-style license that can be
  35975. * found in the LICENSE file at https://angular.io/license
  35976. */
  35977. /**
  35978. * Combination of NgModuleFactory and ComponentFactorys.
  35979. *
  35980. * @experimental
  35981. */
  35982. var ModuleWithComponentFactories = /** @class */ (function () {
  35983. function ModuleWithComponentFactories(ngModuleFactory, componentFactories) {
  35984. this.ngModuleFactory = ngModuleFactory;
  35985. this.componentFactories = componentFactories;
  35986. }
  35987. return ModuleWithComponentFactories;
  35988. }());
  35989. function _throwError() {
  35990. throw new Error("Runtime compiler is not loaded");
  35991. }
  35992. /**
  35993. * Low-level service for running the angular compiler during runtime
  35994. * to create {@link ComponentFactory}s, which
  35995. * can later be used to create and render a Component instance.
  35996. *
  35997. * Each `@NgModule` provides an own `Compiler` to its injector,
  35998. * that will use the directives/pipes of the ng module for compilation
  35999. * of components.
  36000. *
  36001. */
  36002. var Compiler = /** @class */ (function () {
  36003. function Compiler() {
  36004. }
  36005. /**
  36006. * Compiles the given NgModule and all of its components. All templates of the components listed
  36007. * in `entryComponents` have to be inlined.
  36008. */
  36009. Compiler.prototype.compileModuleSync = function (moduleType) { throw _throwError(); };
  36010. /**
  36011. * Compiles the given NgModule and all of its components
  36012. */
  36013. Compiler.prototype.compileModuleAsync = function (moduleType) { throw _throwError(); };
  36014. /**
  36015. * Same as {@link #compileModuleSync} but also creates ComponentFactories for all components.
  36016. */
  36017. Compiler.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
  36018. throw _throwError();
  36019. };
  36020. /**
  36021. * Same as {@link #compileModuleAsync} but also creates ComponentFactories for all components.
  36022. */
  36023. Compiler.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
  36024. throw _throwError();
  36025. };
  36026. /**
  36027. * Clears all caches.
  36028. */
  36029. Compiler.prototype.clearCache = function () { };
  36030. /**
  36031. * Clears the cache for the given component/ngModule.
  36032. */
  36033. Compiler.prototype.clearCacheFor = function (type) { };
  36034. /**
  36035. * Returns the id for a given NgModule, if one is defined and known to the compiler.
  36036. */
  36037. Compiler.prototype.getModuleId = function (moduleType) { return undefined; };
  36038. Compiler = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  36039. Injectable()
  36040. ], Compiler);
  36041. return Compiler;
  36042. }());
  36043. /**
  36044. * Token to provide CompilerOptions in the platform injector.
  36045. *
  36046. * @experimental
  36047. */
  36048. var COMPILER_OPTIONS = new InjectionToken('compilerOptions');
  36049. /**
  36050. * A factory for creating a Compiler
  36051. *
  36052. * @experimental
  36053. */
  36054. var CompilerFactory = /** @class */ (function () {
  36055. function CompilerFactory() {
  36056. }
  36057. return CompilerFactory;
  36058. }());
  36059. /**
  36060. * @license
  36061. * Copyright Google Inc. All Rights Reserved.
  36062. *
  36063. * Use of this source code is governed by an MIT-style license that can be
  36064. * found in the LICENSE file at https://angular.io/license
  36065. */
  36066. /**
  36067. * Represents a component created by a `ComponentFactory`.
  36068. * Provides access to the component instance and related objects,
  36069. * and provides the means of destroying the instance.
  36070. *
  36071. */
  36072. var ComponentRef = /** @class */ (function () {
  36073. function ComponentRef() {
  36074. }
  36075. return ComponentRef;
  36076. }());
  36077. var ComponentFactory = /** @class */ (function () {
  36078. function ComponentFactory() {
  36079. }
  36080. return ComponentFactory;
  36081. }());
  36082. /**
  36083. * @license
  36084. * Copyright Google Inc. All Rights Reserved.
  36085. *
  36086. * Use of this source code is governed by an MIT-style license that can be
  36087. * found in the LICENSE file at https://angular.io/license
  36088. */
  36089. function noComponentFactoryError(component) {
  36090. var error = Error("No component factory found for " + stringify(component) + ". Did you add it to @NgModule.entryComponents?");
  36091. error[ERROR_COMPONENT] = component;
  36092. return error;
  36093. }
  36094. var ERROR_COMPONENT = 'ngComponent';
  36095. var _NullComponentFactoryResolver = /** @class */ (function () {
  36096. function _NullComponentFactoryResolver() {
  36097. }
  36098. _NullComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
  36099. throw noComponentFactoryError(component);
  36100. };
  36101. return _NullComponentFactoryResolver;
  36102. }());
  36103. var ComponentFactoryResolver = /** @class */ (function () {
  36104. function ComponentFactoryResolver() {
  36105. }
  36106. ComponentFactoryResolver.NULL = new _NullComponentFactoryResolver();
  36107. return ComponentFactoryResolver;
  36108. }());
  36109. var CodegenComponentFactoryResolver = /** @class */ (function () {
  36110. function CodegenComponentFactoryResolver(factories, _parent, _ngModule) {
  36111. this._parent = _parent;
  36112. this._ngModule = _ngModule;
  36113. this._factories = new Map();
  36114. for (var i = 0; i < factories.length; i++) {
  36115. var factory = factories[i];
  36116. this._factories.set(factory.componentType, factory);
  36117. }
  36118. }
  36119. CodegenComponentFactoryResolver.prototype.resolveComponentFactory = function (component) {
  36120. var factory = this._factories.get(component);
  36121. if (!factory && this._parent) {
  36122. factory = this._parent.resolveComponentFactory(component);
  36123. }
  36124. if (!factory) {
  36125. throw noComponentFactoryError(component);
  36126. }
  36127. return new ComponentFactoryBoundToModule(factory, this._ngModule);
  36128. };
  36129. return CodegenComponentFactoryResolver;
  36130. }());
  36131. var ComponentFactoryBoundToModule = /** @class */ (function (_super) {
  36132. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentFactoryBoundToModule, _super);
  36133. function ComponentFactoryBoundToModule(factory, ngModule) {
  36134. var _this = _super.call(this) || this;
  36135. _this.factory = factory;
  36136. _this.ngModule = ngModule;
  36137. _this.selector = factory.selector;
  36138. _this.componentType = factory.componentType;
  36139. _this.ngContentSelectors = factory.ngContentSelectors;
  36140. _this.inputs = factory.inputs;
  36141. _this.outputs = factory.outputs;
  36142. return _this;
  36143. }
  36144. ComponentFactoryBoundToModule.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
  36145. return this.factory.create(injector, projectableNodes, rootSelectorOrNode, ngModule || this.ngModule);
  36146. };
  36147. return ComponentFactoryBoundToModule;
  36148. }(ComponentFactory));
  36149. /**
  36150. * @license
  36151. * Copyright Google Inc. All Rights Reserved.
  36152. *
  36153. * Use of this source code is governed by an MIT-style license that can be
  36154. * found in the LICENSE file at https://angular.io/license
  36155. */
  36156. /**
  36157. * Represents an instance of an NgModule created via a {@link NgModuleFactory}.
  36158. *
  36159. * `NgModuleRef` provides access to the NgModule Instance as well other objects related to this
  36160. * NgModule Instance.
  36161. *
  36162. *
  36163. */
  36164. var NgModuleRef = /** @class */ (function () {
  36165. function NgModuleRef() {
  36166. }
  36167. return NgModuleRef;
  36168. }());
  36169. /**
  36170. * @experimental
  36171. */
  36172. var NgModuleFactory = /** @class */ (function () {
  36173. function NgModuleFactory() {
  36174. }
  36175. return NgModuleFactory;
  36176. }());
  36177. /**
  36178. * @license
  36179. * Copyright Google Inc. All Rights Reserved.
  36180. *
  36181. * Use of this source code is governed by an MIT-style license that can be
  36182. * found in the LICENSE file at https://angular.io/license
  36183. */
  36184. var trace;
  36185. var events;
  36186. function detectWTF() {
  36187. var wtf = _global /** TODO #9100 */['wtf'];
  36188. if (wtf) {
  36189. trace = wtf['trace'];
  36190. if (trace) {
  36191. events = trace['events'];
  36192. return true;
  36193. }
  36194. }
  36195. return false;
  36196. }
  36197. function createScope(signature, flags) {
  36198. if (flags === void 0) { flags = null; }
  36199. return events.createScope(signature, flags);
  36200. }
  36201. function leave(scope, returnValue) {
  36202. trace.leaveScope(scope, returnValue);
  36203. return returnValue;
  36204. }
  36205. function startTimeRange(rangeType, action) {
  36206. return trace.beginTimeRange(rangeType, action);
  36207. }
  36208. function endTimeRange(range) {
  36209. trace.endTimeRange(range);
  36210. }
  36211. /**
  36212. * @license
  36213. * Copyright Google Inc. All Rights Reserved.
  36214. *
  36215. * Use of this source code is governed by an MIT-style license that can be
  36216. * found in the LICENSE file at https://angular.io/license
  36217. */
  36218. /**
  36219. * True if WTF is enabled.
  36220. */
  36221. var wtfEnabled = detectWTF();
  36222. function noopScope(arg0, arg1) {
  36223. return null;
  36224. }
  36225. /**
  36226. * Create trace scope.
  36227. *
  36228. * Scopes must be strictly nested and are analogous to stack frames, but
  36229. * do not have to follow the stack frames. Instead it is recommended that they follow logical
  36230. * nesting. You may want to use
  36231. * [Event
  36232. * Signatures](http://google.github.io/tracing-framework/instrumenting-code.html#custom-events)
  36233. * as they are defined in WTF.
  36234. *
  36235. * Used to mark scope entry. The return value is used to leave the scope.
  36236. *
  36237. * var myScope = wtfCreateScope('MyClass#myMethod(ascii someVal)');
  36238. *
  36239. * someMethod() {
  36240. * var s = myScope('Foo'); // 'Foo' gets stored in tracing UI
  36241. * // DO SOME WORK HERE
  36242. * return wtfLeave(s, 123); // Return value 123
  36243. * }
  36244. *
  36245. * Note, adding try-finally block around the work to ensure that `wtfLeave` gets called can
  36246. * negatively impact the performance of your application. For this reason we recommend that
  36247. * you don't add them to ensure that `wtfLeave` gets called. In production `wtfLeave` is a noop and
  36248. * so try-finally block has no value. When debugging perf issues, skipping `wtfLeave`, do to
  36249. * exception, will produce incorrect trace, but presence of exception signifies logic error which
  36250. * needs to be fixed before the app should be profiled. Add try-finally only when you expect that
  36251. * an exception is expected during normal execution while profiling.
  36252. *
  36253. * @experimental
  36254. */
  36255. var wtfCreateScope = wtfEnabled ? createScope : function (signature, flags) { return noopScope; };
  36256. /**
  36257. * Used to mark end of Scope.
  36258. *
  36259. * - `scope` to end.
  36260. * - `returnValue` (optional) to be passed to the WTF.
  36261. *
  36262. * Returns the `returnValue for easy chaining.
  36263. * @experimental
  36264. */
  36265. var wtfLeave = wtfEnabled ? leave : function (s, r) { return r; };
  36266. /**
  36267. * Used to mark Async start. Async are similar to scope but they don't have to be strictly nested.
  36268. * The return value is used in the call to [endAsync]. Async ranges only work if WTF has been
  36269. * enabled.
  36270. *
  36271. * someMethod() {
  36272. * var s = wtfStartTimeRange('HTTP:GET', 'some.url');
  36273. * var future = new Future.delay(5).then((_) {
  36274. * wtfEndTimeRange(s);
  36275. * });
  36276. * }
  36277. * @experimental
  36278. */
  36279. var wtfStartTimeRange = wtfEnabled ? startTimeRange : function (rangeType, action) { return null; };
  36280. /**
  36281. * Ends a async time range operation.
  36282. * [range] is the return value from [wtfStartTimeRange] Async ranges only work if WTF has been
  36283. * enabled.
  36284. * @experimental
  36285. */
  36286. var wtfEndTimeRange = wtfEnabled ? endTimeRange : function (r) { return null; };
  36287. /**
  36288. * @license
  36289. * Copyright Google Inc. All Rights Reserved.
  36290. *
  36291. * Use of this source code is governed by an MIT-style license that can be
  36292. * found in the LICENSE file at https://angular.io/license
  36293. */
  36294. /**
  36295. * Use in directives and components to emit custom events synchronously
  36296. * or asynchronously, and register handlers for those events by subscribing
  36297. * to an instance.
  36298. *
  36299. * @usageNotes
  36300. *
  36301. * In the following example, a component defines two output properties
  36302. * that create event emitters. When the title is clicked, the emitter
  36303. * emits an open or close event to toggle the current visibility state.
  36304. *
  36305. * ```
  36306. * @Component({
  36307. * selector: 'zippy',
  36308. * template: `
  36309. * <div class="zippy">
  36310. * <div (click)="toggle()">Toggle</div>
  36311. * <div [hidden]="!visible">
  36312. * <ng-content></ng-content>
  36313. * </div>
  36314. * </div>`})
  36315. * export class Zippy {
  36316. * visible: boolean = true;
  36317. * @Output() open: EventEmitter<any> = new EventEmitter();
  36318. * @Output() close: EventEmitter<any> = new EventEmitter();
  36319. *
  36320. * toggle() {
  36321. * this.visible = !this.visible;
  36322. * if (this.visible) {
  36323. * this.open.emit(null);
  36324. * } else {
  36325. * this.close.emit(null);
  36326. * }
  36327. * }
  36328. * }
  36329. * ```
  36330. *
  36331. * Access the event object with the `$event` argument passed to the output event
  36332. * handler:
  36333. *
  36334. * ```
  36335. * <zippy (open)="onOpen($event)" (close)="onClose($event)"></zippy>
  36336. * ```
  36337. *
  36338. * ### Notes
  36339. *
  36340. * Uses Rx.Observable but provides an adapter to make it work as specified here:
  36341. * https://github.com/jhusain/observable-spec
  36342. *
  36343. * Once a reference implementation of the spec is available, switch to it.
  36344. *
  36345. */
  36346. var EventEmitter = /** @class */ (function (_super) {
  36347. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(EventEmitter, _super);
  36348. /**
  36349. * Creates an instance of this class that can
  36350. * deliver events synchronously or asynchronously.
  36351. *
  36352. * @param isAsync When true, deliver events asynchronously.
  36353. *
  36354. */
  36355. function EventEmitter(isAsync) {
  36356. if (isAsync === void 0) { isAsync = false; }
  36357. var _this = _super.call(this) || this;
  36358. _this.__isAsync = isAsync;
  36359. return _this;
  36360. }
  36361. /**
  36362. * Emits an event containing a given value.
  36363. * @param value The value to emit.
  36364. */
  36365. EventEmitter.prototype.emit = function (value) { _super.prototype.next.call(this, value); };
  36366. /**
  36367. * Registers handlers for events emitted by this instance.
  36368. * @param generatorOrNext When supplied, a custom handler for emitted events.
  36369. * @param error When supplied, a custom handler for an error notification
  36370. * from this emitter.
  36371. * @param complete When supplied, a custom handler for a completion
  36372. * notification from this emitter.
  36373. */
  36374. EventEmitter.prototype.subscribe = function (generatorOrNext, error, complete) {
  36375. var schedulerFn;
  36376. var errorFn = function (err) { return null; };
  36377. var completeFn = function () { return null; };
  36378. if (generatorOrNext && typeof generatorOrNext === 'object') {
  36379. schedulerFn = this.__isAsync ? function (value) {
  36380. setTimeout(function () { return generatorOrNext.next(value); });
  36381. } : function (value) { generatorOrNext.next(value); };
  36382. if (generatorOrNext.error) {
  36383. errorFn = this.__isAsync ? function (err) { setTimeout(function () { return generatorOrNext.error(err); }); } :
  36384. function (err) { generatorOrNext.error(err); };
  36385. }
  36386. if (generatorOrNext.complete) {
  36387. completeFn = this.__isAsync ? function () { setTimeout(function () { return generatorOrNext.complete(); }); } :
  36388. function () { generatorOrNext.complete(); };
  36389. }
  36390. }
  36391. else {
  36392. schedulerFn = this.__isAsync ? function (value) { setTimeout(function () { return generatorOrNext(value); }); } :
  36393. function (value) { generatorOrNext(value); };
  36394. if (error) {
  36395. errorFn =
  36396. this.__isAsync ? function (err) { setTimeout(function () { return error(err); }); } : function (err) { error(err); };
  36397. }
  36398. if (complete) {
  36399. completeFn =
  36400. this.__isAsync ? function () { setTimeout(function () { return complete(); }); } : function () { complete(); };
  36401. }
  36402. }
  36403. var sink = _super.prototype.subscribe.call(this, schedulerFn, errorFn, completeFn);
  36404. if (generatorOrNext instanceof rxjs__WEBPACK_IMPORTED_MODULE_1__["Subscription"]) {
  36405. generatorOrNext.add(sink);
  36406. }
  36407. return sink;
  36408. };
  36409. return EventEmitter;
  36410. }(rxjs__WEBPACK_IMPORTED_MODULE_1__["Subject"]));
  36411. /**
  36412. * @license
  36413. * Copyright Google Inc. All Rights Reserved.
  36414. *
  36415. * Use of this source code is governed by an MIT-style license that can be
  36416. * found in the LICENSE file at https://angular.io/license
  36417. */
  36418. /**
  36419. * An injectable service for executing work inside or outside of the Angular zone.
  36420. *
  36421. * The most common use of this service is to optimize performance when starting a work consisting of
  36422. * one or more asynchronous tasks that don't require UI updates or error handling to be handled by
  36423. * Angular. Such tasks can be kicked off via {@link #runOutsideAngular} and if needed, these tasks
  36424. * can reenter the Angular zone via {@link #run}.
  36425. *
  36426. * <!-- TODO: add/fix links to:
  36427. * - docs explaining zones and the use of zones in Angular and change-detection
  36428. * - link to runOutsideAngular/run (throughout this file!)
  36429. * -->
  36430. *
  36431. * @usageNotes
  36432. * ### Example
  36433. *
  36434. * ```
  36435. * import {Component, NgZone} from '@angular/core';
  36436. * import {NgIf} from '@angular/common';
  36437. *
  36438. * @Component({
  36439. * selector: 'ng-zone-demo',
  36440. * template: `
  36441. * <h2>Demo: NgZone</h2>
  36442. *
  36443. * <p>Progress: {{progress}}%</p>
  36444. * <p *ngIf="progress >= 100">Done processing {{label}} of Angular zone!</p>
  36445. *
  36446. * <button (click)="processWithinAngularZone()">Process within Angular zone</button>
  36447. * <button (click)="processOutsideOfAngularZone()">Process outside of Angular zone</button>
  36448. * `,
  36449. * })
  36450. * export class NgZoneDemo {
  36451. * progress: number = 0;
  36452. * label: string;
  36453. *
  36454. * constructor(private _ngZone: NgZone) {}
  36455. *
  36456. * // Loop inside the Angular zone
  36457. * // so the UI DOES refresh after each setTimeout cycle
  36458. * processWithinAngularZone() {
  36459. * this.label = 'inside';
  36460. * this.progress = 0;
  36461. * this._increaseProgress(() => console.log('Inside Done!'));
  36462. * }
  36463. *
  36464. * // Loop outside of the Angular zone
  36465. * // so the UI DOES NOT refresh after each setTimeout cycle
  36466. * processOutsideOfAngularZone() {
  36467. * this.label = 'outside';
  36468. * this.progress = 0;
  36469. * this._ngZone.runOutsideAngular(() => {
  36470. * this._increaseProgress(() => {
  36471. * // reenter the Angular zone and display done
  36472. * this._ngZone.run(() => { console.log('Outside Done!'); });
  36473. * });
  36474. * });
  36475. * }
  36476. *
  36477. * _increaseProgress(doneCallback: () => void) {
  36478. * this.progress += 1;
  36479. * console.log(`Current progress: ${this.progress}%`);
  36480. *
  36481. * if (this.progress < 100) {
  36482. * window.setTimeout(() => this._increaseProgress(doneCallback), 10);
  36483. * } else {
  36484. * doneCallback();
  36485. * }
  36486. * }
  36487. * }
  36488. * ```
  36489. *
  36490. * @experimental
  36491. */
  36492. var NgZone = /** @class */ (function () {
  36493. function NgZone(_a) {
  36494. var _b = _a.enableLongStackTrace, enableLongStackTrace = _b === void 0 ? false : _b;
  36495. this.hasPendingMicrotasks = false;
  36496. this.hasPendingMacrotasks = false;
  36497. /**
  36498. * Whether there are no outstanding microtasks or macrotasks.
  36499. */
  36500. this.isStable = true;
  36501. /**
  36502. * Notifies when code enters Angular Zone. This gets fired first on VM Turn.
  36503. */
  36504. this.onUnstable = new EventEmitter(false);
  36505. /**
  36506. * Notifies when there is no more microtasks enqueued in the current VM Turn.
  36507. * This is a hint for Angular to do change detection, which may enqueue more microtasks.
  36508. * For this reason this event can fire multiple times per VM Turn.
  36509. */
  36510. this.onMicrotaskEmpty = new EventEmitter(false);
  36511. /**
  36512. * Notifies when the last `onMicrotaskEmpty` has run and there are no more microtasks, which
  36513. * implies we are about to relinquish VM turn.
  36514. * This event gets called just once.
  36515. */
  36516. this.onStable = new EventEmitter(false);
  36517. /**
  36518. * Notifies that an error has been delivered.
  36519. */
  36520. this.onError = new EventEmitter(false);
  36521. if (typeof Zone == 'undefined') {
  36522. throw new Error("In this configuration Angular requires Zone.js");
  36523. }
  36524. Zone.assertZonePatched();
  36525. var self = this;
  36526. self._nesting = 0;
  36527. self._outer = self._inner = Zone.current;
  36528. if (Zone['wtfZoneSpec']) {
  36529. self._inner = self._inner.fork(Zone['wtfZoneSpec']);
  36530. }
  36531. if (Zone['TaskTrackingZoneSpec']) {
  36532. self._inner = self._inner.fork(new Zone['TaskTrackingZoneSpec']);
  36533. }
  36534. if (enableLongStackTrace && Zone['longStackTraceZoneSpec']) {
  36535. self._inner = self._inner.fork(Zone['longStackTraceZoneSpec']);
  36536. }
  36537. forkInnerZoneWithAngularBehavior(self);
  36538. }
  36539. NgZone.isInAngularZone = function () { return Zone.current.get('isAngularZone') === true; };
  36540. NgZone.assertInAngularZone = function () {
  36541. if (!NgZone.isInAngularZone()) {
  36542. throw new Error('Expected to be in Angular Zone, but it is not!');
  36543. }
  36544. };
  36545. NgZone.assertNotInAngularZone = function () {
  36546. if (NgZone.isInAngularZone()) {
  36547. throw new Error('Expected to not be in Angular Zone, but it is!');
  36548. }
  36549. };
  36550. /**
  36551. * Executes the `fn` function synchronously within the Angular zone and returns value returned by
  36552. * the function.
  36553. *
  36554. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  36555. * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
  36556. *
  36557. * Any future tasks or microtasks scheduled from within this function will continue executing from
  36558. * within the Angular zone.
  36559. *
  36560. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  36561. */
  36562. NgZone.prototype.run = function (fn, applyThis, applyArgs) {
  36563. return this._inner.run(fn, applyThis, applyArgs);
  36564. };
  36565. /**
  36566. * Executes the `fn` function synchronously within the Angular zone as a task and returns value
  36567. * returned by the function.
  36568. *
  36569. * Running functions via `run` allows you to reenter Angular zone from a task that was executed
  36570. * outside of the Angular zone (typically started via {@link #runOutsideAngular}).
  36571. *
  36572. * Any future tasks or microtasks scheduled from within this function will continue executing from
  36573. * within the Angular zone.
  36574. *
  36575. * If a synchronous error happens it will be rethrown and not reported via `onError`.
  36576. */
  36577. NgZone.prototype.runTask = function (fn, applyThis, applyArgs, name) {
  36578. var zone = this._inner;
  36579. var task = zone.scheduleEventTask('NgZoneEvent: ' + name, fn, EMPTY_PAYLOAD, noop, noop);
  36580. try {
  36581. return zone.runTask(task, applyThis, applyArgs);
  36582. }
  36583. finally {
  36584. zone.cancelTask(task);
  36585. }
  36586. };
  36587. /**
  36588. * Same as `run`, except that synchronous errors are caught and forwarded via `onError` and not
  36589. * rethrown.
  36590. */
  36591. NgZone.prototype.runGuarded = function (fn, applyThis, applyArgs) {
  36592. return this._inner.runGuarded(fn, applyThis, applyArgs);
  36593. };
  36594. /**
  36595. * Executes the `fn` function synchronously in Angular's parent zone and returns value returned by
  36596. * the function.
  36597. *
  36598. * Running functions via {@link #runOutsideAngular} allows you to escape Angular's zone and do
  36599. * work that
  36600. * doesn't trigger Angular change-detection or is subject to Angular's error handling.
  36601. *
  36602. * Any future tasks or microtasks scheduled from within this function will continue executing from
  36603. * outside of the Angular zone.
  36604. *
  36605. * Use {@link #run} to reenter the Angular zone and do work that updates the application model.
  36606. */
  36607. NgZone.prototype.runOutsideAngular = function (fn) {
  36608. return this._outer.run(fn);
  36609. };
  36610. return NgZone;
  36611. }());
  36612. function noop() { }
  36613. var EMPTY_PAYLOAD = {};
  36614. function checkStable(zone) {
  36615. if (zone._nesting == 0 && !zone.hasPendingMicrotasks && !zone.isStable) {
  36616. try {
  36617. zone._nesting++;
  36618. zone.onMicrotaskEmpty.emit(null);
  36619. }
  36620. finally {
  36621. zone._nesting--;
  36622. if (!zone.hasPendingMicrotasks) {
  36623. try {
  36624. zone.runOutsideAngular(function () { return zone.onStable.emit(null); });
  36625. }
  36626. finally {
  36627. zone.isStable = true;
  36628. }
  36629. }
  36630. }
  36631. }
  36632. }
  36633. function forkInnerZoneWithAngularBehavior(zone) {
  36634. zone._inner = zone._inner.fork({
  36635. name: 'angular',
  36636. properties: { 'isAngularZone': true },
  36637. onInvokeTask: function (delegate, current, target, task, applyThis, applyArgs) {
  36638. try {
  36639. onEnter(zone);
  36640. return delegate.invokeTask(target, task, applyThis, applyArgs);
  36641. }
  36642. finally {
  36643. onLeave(zone);
  36644. }
  36645. },
  36646. onInvoke: function (delegate, current, target, callback, applyThis, applyArgs, source) {
  36647. try {
  36648. onEnter(zone);
  36649. return delegate.invoke(target, callback, applyThis, applyArgs, source);
  36650. }
  36651. finally {
  36652. onLeave(zone);
  36653. }
  36654. },
  36655. onHasTask: function (delegate, current, target, hasTaskState) {
  36656. delegate.hasTask(target, hasTaskState);
  36657. if (current === target) {
  36658. // We are only interested in hasTask events which originate from our zone
  36659. // (A child hasTask event is not interesting to us)
  36660. if (hasTaskState.change == 'microTask') {
  36661. zone.hasPendingMicrotasks = hasTaskState.microTask;
  36662. checkStable(zone);
  36663. }
  36664. else if (hasTaskState.change == 'macroTask') {
  36665. zone.hasPendingMacrotasks = hasTaskState.macroTask;
  36666. }
  36667. }
  36668. },
  36669. onHandleError: function (delegate, current, target, error) {
  36670. delegate.handleError(target, error);
  36671. zone.runOutsideAngular(function () { return zone.onError.emit(error); });
  36672. return false;
  36673. }
  36674. });
  36675. }
  36676. function onEnter(zone) {
  36677. zone._nesting++;
  36678. if (zone.isStable) {
  36679. zone.isStable = false;
  36680. zone.onUnstable.emit(null);
  36681. }
  36682. }
  36683. function onLeave(zone) {
  36684. zone._nesting--;
  36685. checkStable(zone);
  36686. }
  36687. /**
  36688. * Provides a noop implementation of `NgZone` which does nothing. This zone requires explicit calls
  36689. * to framework to perform rendering.
  36690. */
  36691. var NoopNgZone = /** @class */ (function () {
  36692. function NoopNgZone() {
  36693. this.hasPendingMicrotasks = false;
  36694. this.hasPendingMacrotasks = false;
  36695. this.isStable = true;
  36696. this.onUnstable = new EventEmitter();
  36697. this.onMicrotaskEmpty = new EventEmitter();
  36698. this.onStable = new EventEmitter();
  36699. this.onError = new EventEmitter();
  36700. }
  36701. NoopNgZone.prototype.run = function (fn) { return fn(); };
  36702. NoopNgZone.prototype.runGuarded = function (fn) { return fn(); };
  36703. NoopNgZone.prototype.runOutsideAngular = function (fn) { return fn(); };
  36704. NoopNgZone.prototype.runTask = function (fn) { return fn(); };
  36705. return NoopNgZone;
  36706. }());
  36707. /**
  36708. * @license
  36709. * Copyright Google Inc. All Rights Reserved.
  36710. *
  36711. * Use of this source code is governed by an MIT-style license that can be
  36712. * found in the LICENSE file at https://angular.io/license
  36713. */
  36714. /**
  36715. * The Testability service provides testing hooks that can be accessed from
  36716. * the browser and by services such as Protractor. Each bootstrapped Angular
  36717. * application on the page will have an instance of Testability.
  36718. * @experimental
  36719. */
  36720. var Testability = /** @class */ (function () {
  36721. function Testability(_ngZone) {
  36722. var _this = this;
  36723. this._ngZone = _ngZone;
  36724. this._pendingCount = 0;
  36725. this._isZoneStable = true;
  36726. /**
  36727. * Whether any work was done since the last 'whenStable' callback. This is
  36728. * useful to detect if this could have potentially destabilized another
  36729. * component while it is stabilizing.
  36730. * @internal
  36731. */
  36732. this._didWork = false;
  36733. this._callbacks = [];
  36734. this._watchAngularEvents();
  36735. _ngZone.run(function () { _this.taskTrackingZone = Zone.current.get('TaskTrackingZone'); });
  36736. }
  36737. Testability.prototype._watchAngularEvents = function () {
  36738. var _this = this;
  36739. this._ngZone.onUnstable.subscribe({
  36740. next: function () {
  36741. _this._didWork = true;
  36742. _this._isZoneStable = false;
  36743. }
  36744. });
  36745. this._ngZone.runOutsideAngular(function () {
  36746. _this._ngZone.onStable.subscribe({
  36747. next: function () {
  36748. NgZone.assertNotInAngularZone();
  36749. scheduleMicroTask(function () {
  36750. _this._isZoneStable = true;
  36751. _this._runCallbacksIfReady();
  36752. });
  36753. }
  36754. });
  36755. });
  36756. };
  36757. /**
  36758. * Increases the number of pending request
  36759. * @deprecated pending requests are now tracked with zones.
  36760. */
  36761. Testability.prototype.increasePendingRequestCount = function () {
  36762. this._pendingCount += 1;
  36763. this._didWork = true;
  36764. return this._pendingCount;
  36765. };
  36766. /**
  36767. * Decreases the number of pending request
  36768. * @deprecated pending requests are now tracked with zones
  36769. */
  36770. Testability.prototype.decreasePendingRequestCount = function () {
  36771. this._pendingCount -= 1;
  36772. if (this._pendingCount < 0) {
  36773. throw new Error('pending async requests below zero');
  36774. }
  36775. this._runCallbacksIfReady();
  36776. return this._pendingCount;
  36777. };
  36778. /**
  36779. * Whether an associated application is stable
  36780. */
  36781. Testability.prototype.isStable = function () {
  36782. return this._isZoneStable && this._pendingCount === 0 && !this._ngZone.hasPendingMacrotasks;
  36783. };
  36784. Testability.prototype._runCallbacksIfReady = function () {
  36785. var _this = this;
  36786. if (this.isStable()) {
  36787. // Schedules the call backs in a new frame so that it is always async.
  36788. scheduleMicroTask(function () {
  36789. while (_this._callbacks.length !== 0) {
  36790. var cb = _this._callbacks.pop();
  36791. clearTimeout(cb.timeoutId);
  36792. cb.doneCb(_this._didWork);
  36793. }
  36794. _this._didWork = false;
  36795. });
  36796. }
  36797. else {
  36798. // Still not stable, send updates.
  36799. var pending_1 = this.getPendingTasks();
  36800. this._callbacks = this._callbacks.filter(function (cb) {
  36801. if (cb.updateCb && cb.updateCb(pending_1)) {
  36802. clearTimeout(cb.timeoutId);
  36803. return false;
  36804. }
  36805. return true;
  36806. });
  36807. this._didWork = true;
  36808. }
  36809. };
  36810. Testability.prototype.getPendingTasks = function () {
  36811. if (!this.taskTrackingZone) {
  36812. return [];
  36813. }
  36814. return this.taskTrackingZone.macroTasks.map(function (t) {
  36815. return {
  36816. source: t.source,
  36817. isPeriodic: t.data.isPeriodic,
  36818. delay: t.data.delay,
  36819. // From TaskTrackingZone:
  36820. // https://github.com/angular/zone.js/blob/master/lib/zone-spec/task-tracking.ts#L40
  36821. creationLocation: t.creationLocation,
  36822. // Added by Zones for XHRs
  36823. // https://github.com/angular/zone.js/blob/master/lib/browser/browser.ts#L133
  36824. xhr: t.data.target
  36825. };
  36826. });
  36827. };
  36828. Testability.prototype.addCallback = function (cb, timeout, updateCb) {
  36829. var _this = this;
  36830. var timeoutId = -1;
  36831. if (timeout && timeout > 0) {
  36832. timeoutId = setTimeout(function () {
  36833. _this._callbacks = _this._callbacks.filter(function (cb) { return cb.timeoutId !== timeoutId; });
  36834. cb(_this._didWork, _this.getPendingTasks());
  36835. }, timeout);
  36836. }
  36837. this._callbacks.push({ doneCb: cb, timeoutId: timeoutId, updateCb: updateCb });
  36838. };
  36839. /**
  36840. * Wait for the application to be stable with a timeout. If the timeout is reached before that
  36841. * happens, the callback receives a list of the macro tasks that were pending, otherwise null.
  36842. *
  36843. * @param doneCb The callback to invoke when Angular is stable or the timeout expires
  36844. * whichever comes first.
  36845. * @param timeout Optional. The maximum time to wait for Angular to become stable. If not
  36846. * specified, whenStable() will wait forever.
  36847. * @param updateCb Optional. If specified, this callback will be invoked whenever the set of
  36848. * pending macrotasks changes. If this callback returns true doneCb will not be invoked
  36849. * and no further updates will be issued.
  36850. */
  36851. Testability.prototype.whenStable = function (doneCb, timeout, updateCb) {
  36852. if (updateCb && !this.taskTrackingZone) {
  36853. throw new Error('Task tracking zone is required when passing an update callback to ' +
  36854. 'whenStable(). Is "zone.js/dist/task-tracking.js" loaded?');
  36855. }
  36856. // These arguments are 'Function' above to keep the public API simple.
  36857. this.addCallback(doneCb, timeout, updateCb);
  36858. this._runCallbacksIfReady();
  36859. };
  36860. /**
  36861. * Get the number of pending requests
  36862. * @deprecated pending requests are now tracked with zones
  36863. */
  36864. Testability.prototype.getPendingRequestCount = function () { return this._pendingCount; };
  36865. /**
  36866. * Find providers by name
  36867. * @param using The root element to search from
  36868. * @param provider The name of binding variable
  36869. * @param exactMatch Whether using exactMatch
  36870. */
  36871. Testability.prototype.findProviders = function (using, provider, exactMatch) {
  36872. // TODO(juliemr): implement.
  36873. return [];
  36874. };
  36875. Testability = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  36876. Injectable(),
  36877. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [NgZone])
  36878. ], Testability);
  36879. return Testability;
  36880. }());
  36881. /**
  36882. * A global registry of {@link Testability} instances for specific elements.
  36883. * @experimental
  36884. */
  36885. var TestabilityRegistry = /** @class */ (function () {
  36886. function TestabilityRegistry() {
  36887. /** @internal */
  36888. this._applications = new Map();
  36889. _testabilityGetter.addToWindow(this);
  36890. }
  36891. /**
  36892. * Registers an application with a testability hook so that it can be tracked
  36893. * @param token token of application, root element
  36894. * @param testability Testability hook
  36895. */
  36896. TestabilityRegistry.prototype.registerApplication = function (token, testability) {
  36897. this._applications.set(token, testability);
  36898. };
  36899. /**
  36900. * Unregisters an application.
  36901. * @param token token of application, root element
  36902. */
  36903. TestabilityRegistry.prototype.unregisterApplication = function (token) { this._applications.delete(token); };
  36904. /**
  36905. * Unregisters all applications
  36906. */
  36907. TestabilityRegistry.prototype.unregisterAllApplications = function () { this._applications.clear(); };
  36908. /**
  36909. * Get a testability hook associated with the application
  36910. * @param elem root element
  36911. */
  36912. TestabilityRegistry.prototype.getTestability = function (elem) { return this._applications.get(elem) || null; };
  36913. /**
  36914. * Get all registered testabilities
  36915. */
  36916. TestabilityRegistry.prototype.getAllTestabilities = function () { return Array.from(this._applications.values()); };
  36917. /**
  36918. * Get all registered applications(root elements)
  36919. */
  36920. TestabilityRegistry.prototype.getAllRootElements = function () { return Array.from(this._applications.keys()); };
  36921. /**
  36922. * Find testability of a node in the Tree
  36923. * @param elem node
  36924. * @param findInAncestors whether finding testability in ancestors if testability was not found in
  36925. * current node
  36926. */
  36927. TestabilityRegistry.prototype.findTestabilityInTree = function (elem, findInAncestors) {
  36928. if (findInAncestors === void 0) { findInAncestors = true; }
  36929. return _testabilityGetter.findTestabilityInTree(this, elem, findInAncestors);
  36930. };
  36931. TestabilityRegistry = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  36932. Injectable(),
  36933. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [])
  36934. ], TestabilityRegistry);
  36935. return TestabilityRegistry;
  36936. }());
  36937. var _NoopGetTestability = /** @class */ (function () {
  36938. function _NoopGetTestability() {
  36939. }
  36940. _NoopGetTestability.prototype.addToWindow = function (registry) { };
  36941. _NoopGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
  36942. return null;
  36943. };
  36944. return _NoopGetTestability;
  36945. }());
  36946. /**
  36947. * Set the {@link GetTestability} implementation used by the Angular testing framework.
  36948. * @experimental
  36949. */
  36950. function setTestabilityGetter(getter) {
  36951. _testabilityGetter = getter;
  36952. }
  36953. var _testabilityGetter = new _NoopGetTestability();
  36954. /**
  36955. * @license
  36956. * Copyright Google Inc. All Rights Reserved.
  36957. *
  36958. * Use of this source code is governed by an MIT-style license that can be
  36959. * found in the LICENSE file at https://angular.io/license
  36960. */
  36961. var _devMode = true;
  36962. var _runModeLocked = false;
  36963. var _platform;
  36964. var ALLOW_MULTIPLE_PLATFORMS = new InjectionToken('AllowMultipleToken');
  36965. /**
  36966. * Disable Angular's development mode, which turns off assertions and other
  36967. * checks within the framework.
  36968. *
  36969. * One important assertion this disables verifies that a change detection pass
  36970. * does not result in additional changes to any bindings (also known as
  36971. * unidirectional data flow).
  36972. *
  36973. *
  36974. */
  36975. function enableProdMode() {
  36976. if (_runModeLocked) {
  36977. throw new Error('Cannot enable prod mode after platform setup.');
  36978. }
  36979. _devMode = false;
  36980. }
  36981. /**
  36982. * Returns whether Angular is in development mode. After called once,
  36983. * the value is locked and won't change any more.
  36984. *
  36985. * By default, this is true, unless a user calls `enableProdMode` before calling this.
  36986. *
  36987. * @experimental APIs related to application bootstrap are currently under review.
  36988. */
  36989. function isDevMode() {
  36990. _runModeLocked = true;
  36991. return _devMode;
  36992. }
  36993. /**
  36994. * A token for third-party components that can register themselves with NgProbe.
  36995. *
  36996. * @experimental
  36997. */
  36998. var NgProbeToken = /** @class */ (function () {
  36999. function NgProbeToken(name, token) {
  37000. this.name = name;
  37001. this.token = token;
  37002. }
  37003. return NgProbeToken;
  37004. }());
  37005. /**
  37006. * Creates a platform.
  37007. * Platforms have to be eagerly created via this function.
  37008. *
  37009. * @experimental APIs related to application bootstrap are currently under review.
  37010. */
  37011. function createPlatform(injector) {
  37012. if (_platform && !_platform.destroyed &&
  37013. !_platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
  37014. throw new Error('There can be only one platform. Destroy the previous one to create a new one.');
  37015. }
  37016. _platform = injector.get(PlatformRef);
  37017. var inits = injector.get(PLATFORM_INITIALIZER, null);
  37018. if (inits)
  37019. inits.forEach(function (init) { return init(); });
  37020. return _platform;
  37021. }
  37022. /**
  37023. * Creates a factory for a platform
  37024. *
  37025. * @experimental APIs related to application bootstrap are currently under review.
  37026. */
  37027. function createPlatformFactory(parentPlatformFactory, name, providers) {
  37028. if (providers === void 0) { providers = []; }
  37029. var desc = "Platform: " + name;
  37030. var marker = new InjectionToken(desc);
  37031. return function (extraProviders) {
  37032. if (extraProviders === void 0) { extraProviders = []; }
  37033. var platform = getPlatform();
  37034. if (!platform || platform.injector.get(ALLOW_MULTIPLE_PLATFORMS, false)) {
  37035. if (parentPlatformFactory) {
  37036. parentPlatformFactory(providers.concat(extraProviders).concat({ provide: marker, useValue: true }));
  37037. }
  37038. else {
  37039. var injectedProviders = providers.concat(extraProviders).concat({ provide: marker, useValue: true });
  37040. createPlatform(Injector.create({ providers: injectedProviders, name: desc }));
  37041. }
  37042. }
  37043. return assertPlatform(marker);
  37044. };
  37045. }
  37046. /**
  37047. * Checks that there currently is a platform which contains the given token as a provider.
  37048. *
  37049. * @experimental APIs related to application bootstrap are currently under review.
  37050. */
  37051. function assertPlatform(requiredToken) {
  37052. var platform = getPlatform();
  37053. if (!platform) {
  37054. throw new Error('No platform exists!');
  37055. }
  37056. if (!platform.injector.get(requiredToken, null)) {
  37057. throw new Error('A platform with a different configuration has been created. Please destroy it first.');
  37058. }
  37059. return platform;
  37060. }
  37061. /**
  37062. * Destroy the existing platform.
  37063. *
  37064. * @experimental APIs related to application bootstrap are currently under review.
  37065. */
  37066. function destroyPlatform() {
  37067. if (_platform && !_platform.destroyed) {
  37068. _platform.destroy();
  37069. }
  37070. }
  37071. /**
  37072. * Returns the current platform.
  37073. *
  37074. * @experimental APIs related to application bootstrap are currently under review.
  37075. */
  37076. function getPlatform() {
  37077. return _platform && !_platform.destroyed ? _platform : null;
  37078. }
  37079. /**
  37080. * The Angular platform is the entry point for Angular on a web page. Each page
  37081. * has exactly one platform, and services (such as reflection) which are common
  37082. * to every Angular application running on the page are bound in its scope.
  37083. *
  37084. * A page's platform is initialized implicitly when a platform is created via a platform factory
  37085. * (e.g. {@link platformBrowser}), or explicitly by calling the {@link createPlatform} function.
  37086. */
  37087. var PlatformRef = /** @class */ (function () {
  37088. /** @internal */
  37089. function PlatformRef(_injector) {
  37090. this._injector = _injector;
  37091. this._modules = [];
  37092. this._destroyListeners = [];
  37093. this._destroyed = false;
  37094. }
  37095. /**
  37096. * Creates an instance of an `@NgModule` for the given platform
  37097. * for offline compilation.
  37098. *
  37099. * @usageNotes
  37100. * ### Simple Example
  37101. *
  37102. * ```typescript
  37103. * my_module.ts:
  37104. *
  37105. * @NgModule({
  37106. * imports: [BrowserModule]
  37107. * })
  37108. * class MyModule {}
  37109. *
  37110. * main.ts:
  37111. * import {MyModuleNgFactory} from './my_module.ngfactory';
  37112. * import {platformBrowser} from '@angular/platform-browser';
  37113. *
  37114. * let moduleRef = platformBrowser().bootstrapModuleFactory(MyModuleNgFactory);
  37115. * ```
  37116. *
  37117. * @experimental APIs related to application bootstrap are currently under review.
  37118. */
  37119. PlatformRef.prototype.bootstrapModuleFactory = function (moduleFactory, options) {
  37120. var _this = this;
  37121. // Note: We need to create the NgZone _before_ we instantiate the module,
  37122. // as instantiating the module creates some providers eagerly.
  37123. // So we create a mini parent injector that just contains the new NgZone and
  37124. // pass that as parent to the NgModuleFactory.
  37125. var ngZoneOption = options ? options.ngZone : undefined;
  37126. var ngZone = getNgZone(ngZoneOption);
  37127. var providers = [{ provide: NgZone, useValue: ngZone }];
  37128. // Attention: Don't use ApplicationRef.run here,
  37129. // as we want to be sure that all possible constructor calls are inside `ngZone.run`!
  37130. return ngZone.run(function () {
  37131. var ngZoneInjector = Injector.create({ providers: providers, parent: _this.injector, name: moduleFactory.moduleType.name });
  37132. var moduleRef = moduleFactory.create(ngZoneInjector);
  37133. var exceptionHandler = moduleRef.injector.get(ErrorHandler, null);
  37134. if (!exceptionHandler) {
  37135. throw new Error('No ErrorHandler. Is platform module (BrowserModule) included?');
  37136. }
  37137. moduleRef.onDestroy(function () { return remove(_this._modules, moduleRef); });
  37138. ngZone.runOutsideAngular(function () { return ngZone.onError.subscribe({ next: function (error) { exceptionHandler.handleError(error); } }); });
  37139. return _callAndReportToErrorHandler(exceptionHandler, ngZone, function () {
  37140. var initStatus = moduleRef.injector.get(ApplicationInitStatus);
  37141. initStatus.runInitializers();
  37142. return initStatus.donePromise.then(function () {
  37143. _this._moduleDoBootstrap(moduleRef);
  37144. return moduleRef;
  37145. });
  37146. });
  37147. });
  37148. };
  37149. /**
  37150. * Creates an instance of an `@NgModule` for a given platform using the given runtime compiler.
  37151. *
  37152. * @usageNotes
  37153. * ### Simple Example
  37154. *
  37155. * ```typescript
  37156. * @NgModule({
  37157. * imports: [BrowserModule]
  37158. * })
  37159. * class MyModule {}
  37160. *
  37161. * let moduleRef = platformBrowser().bootstrapModule(MyModule);
  37162. * ```
  37163. *
  37164. */
  37165. PlatformRef.prototype.bootstrapModule = function (moduleType, compilerOptions) {
  37166. var _this = this;
  37167. if (compilerOptions === void 0) { compilerOptions = []; }
  37168. var compilerFactory = this.injector.get(CompilerFactory);
  37169. var options = optionsReducer({}, compilerOptions);
  37170. var compiler = compilerFactory.createCompiler([options]);
  37171. return compiler.compileModuleAsync(moduleType)
  37172. .then(function (moduleFactory) { return _this.bootstrapModuleFactory(moduleFactory, options); });
  37173. };
  37174. PlatformRef.prototype._moduleDoBootstrap = function (moduleRef) {
  37175. var appRef = moduleRef.injector.get(ApplicationRef);
  37176. if (moduleRef._bootstrapComponents.length > 0) {
  37177. moduleRef._bootstrapComponents.forEach(function (f) { return appRef.bootstrap(f); });
  37178. }
  37179. else if (moduleRef.instance.ngDoBootstrap) {
  37180. moduleRef.instance.ngDoBootstrap(appRef);
  37181. }
  37182. else {
  37183. throw new Error("The module " + stringify(moduleRef.instance.constructor) + " was bootstrapped, but it does not declare \"@NgModule.bootstrap\" components nor a \"ngDoBootstrap\" method. " +
  37184. "Please define one of these.");
  37185. }
  37186. this._modules.push(moduleRef);
  37187. };
  37188. /**
  37189. * Register a listener to be called when the platform is disposed.
  37190. */
  37191. PlatformRef.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
  37192. Object.defineProperty(PlatformRef.prototype, "injector", {
  37193. /**
  37194. * Retrieve the platform {@link Injector}, which is the parent injector for
  37195. * every Angular application on the page and provides singleton providers.
  37196. */
  37197. get: function () { return this._injector; },
  37198. enumerable: true,
  37199. configurable: true
  37200. });
  37201. /**
  37202. * Destroy the Angular platform and all Angular applications on the page.
  37203. */
  37204. PlatformRef.prototype.destroy = function () {
  37205. if (this._destroyed) {
  37206. throw new Error('The platform has already been destroyed!');
  37207. }
  37208. this._modules.slice().forEach(function (module) { return module.destroy(); });
  37209. this._destroyListeners.forEach(function (listener) { return listener(); });
  37210. this._destroyed = true;
  37211. };
  37212. Object.defineProperty(PlatformRef.prototype, "destroyed", {
  37213. get: function () { return this._destroyed; },
  37214. enumerable: true,
  37215. configurable: true
  37216. });
  37217. PlatformRef = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  37218. Injectable(),
  37219. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Injector])
  37220. ], PlatformRef);
  37221. return PlatformRef;
  37222. }());
  37223. function getNgZone(ngZoneOption) {
  37224. var ngZone;
  37225. if (ngZoneOption === 'noop') {
  37226. ngZone = new NoopNgZone();
  37227. }
  37228. else {
  37229. ngZone = (ngZoneOption === 'zone.js' ? undefined : ngZoneOption) ||
  37230. new NgZone({ enableLongStackTrace: isDevMode() });
  37231. }
  37232. return ngZone;
  37233. }
  37234. function _callAndReportToErrorHandler(errorHandler, ngZone, callback) {
  37235. try {
  37236. var result = callback();
  37237. if (isPromise(result)) {
  37238. return result.catch(function (e) {
  37239. ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
  37240. // rethrow as the exception handler might not do it
  37241. throw e;
  37242. });
  37243. }
  37244. return result;
  37245. }
  37246. catch (e) {
  37247. ngZone.runOutsideAngular(function () { return errorHandler.handleError(e); });
  37248. // rethrow as the exception handler might not do it
  37249. throw e;
  37250. }
  37251. }
  37252. function optionsReducer(dst, objs) {
  37253. if (Array.isArray(objs)) {
  37254. dst = objs.reduce(optionsReducer, dst);
  37255. }
  37256. else {
  37257. dst = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, dst, objs);
  37258. }
  37259. return dst;
  37260. }
  37261. /**
  37262. * A reference to an Angular application running on a page.
  37263. */
  37264. var ApplicationRef = /** @class */ (function () {
  37265. /** @internal */
  37266. function ApplicationRef(_zone, _console, _injector, _exceptionHandler, _componentFactoryResolver, _initStatus) {
  37267. var _this = this;
  37268. this._zone = _zone;
  37269. this._console = _console;
  37270. this._injector = _injector;
  37271. this._exceptionHandler = _exceptionHandler;
  37272. this._componentFactoryResolver = _componentFactoryResolver;
  37273. this._initStatus = _initStatus;
  37274. this._bootstrapListeners = [];
  37275. this._views = [];
  37276. this._runningTick = false;
  37277. this._enforceNoNewChanges = false;
  37278. this._stable = true;
  37279. /**
  37280. * Get a list of component types registered to this application.
  37281. * This list is populated even before the component is created.
  37282. */
  37283. this.componentTypes = [];
  37284. /**
  37285. * Get a list of components registered to this application.
  37286. */
  37287. this.components = [];
  37288. this._enforceNoNewChanges = isDevMode();
  37289. this._zone.onMicrotaskEmpty.subscribe({ next: function () { _this._zone.run(function () { _this.tick(); }); } });
  37290. var isCurrentlyStable = new rxjs__WEBPACK_IMPORTED_MODULE_1__["Observable"](function (observer) {
  37291. _this._stable = _this._zone.isStable && !_this._zone.hasPendingMacrotasks &&
  37292. !_this._zone.hasPendingMicrotasks;
  37293. _this._zone.runOutsideAngular(function () {
  37294. observer.next(_this._stable);
  37295. observer.complete();
  37296. });
  37297. });
  37298. var isStable = new rxjs__WEBPACK_IMPORTED_MODULE_1__["Observable"](function (observer) {
  37299. // Create the subscription to onStable outside the Angular Zone so that
  37300. // the callback is run outside the Angular Zone.
  37301. var stableSub;
  37302. _this._zone.runOutsideAngular(function () {
  37303. stableSub = _this._zone.onStable.subscribe(function () {
  37304. NgZone.assertNotInAngularZone();
  37305. // Check whether there are no pending macro/micro tasks in the next tick
  37306. // to allow for NgZone to update the state.
  37307. scheduleMicroTask(function () {
  37308. if (!_this._stable && !_this._zone.hasPendingMacrotasks &&
  37309. !_this._zone.hasPendingMicrotasks) {
  37310. _this._stable = true;
  37311. observer.next(true);
  37312. }
  37313. });
  37314. });
  37315. });
  37316. var unstableSub = _this._zone.onUnstable.subscribe(function () {
  37317. NgZone.assertInAngularZone();
  37318. if (_this._stable) {
  37319. _this._stable = false;
  37320. _this._zone.runOutsideAngular(function () { observer.next(false); });
  37321. }
  37322. });
  37323. return function () {
  37324. stableSub.unsubscribe();
  37325. unstableSub.unsubscribe();
  37326. };
  37327. });
  37328. this.isStable =
  37329. Object(rxjs__WEBPACK_IMPORTED_MODULE_1__["merge"])(isCurrentlyStable, isStable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_2__["share"])()));
  37330. }
  37331. ApplicationRef_1 = ApplicationRef;
  37332. /**
  37333. * Bootstrap a new component at the root level of the application.
  37334. *
  37335. * @usageNotes
  37336. * ### Bootstrap process
  37337. *
  37338. * When bootstrapping a new root component into an application, Angular mounts the
  37339. * specified application component onto DOM elements identified by the componentType's
  37340. * selector and kicks off automatic change detection to finish initializing the component.
  37341. *
  37342. * Optionally, a component can be mounted onto a DOM element that does not match the
  37343. * componentType's selector.
  37344. *
  37345. * ### Example
  37346. * {@example core/ts/platform/platform.ts region='longform'}
  37347. */
  37348. ApplicationRef.prototype.bootstrap = function (componentOrFactory, rootSelectorOrNode) {
  37349. var _this = this;
  37350. if (!this._initStatus.done) {
  37351. throw new Error('Cannot bootstrap as there are still asynchronous initializers running. Bootstrap components in the `ngDoBootstrap` method of the root module.');
  37352. }
  37353. var componentFactory;
  37354. if (componentOrFactory instanceof ComponentFactory) {
  37355. componentFactory = componentOrFactory;
  37356. }
  37357. else {
  37358. componentFactory =
  37359. this._componentFactoryResolver.resolveComponentFactory(componentOrFactory);
  37360. }
  37361. this.componentTypes.push(componentFactory.componentType);
  37362. // Create a factory associated with the current module if it's not bound to some other
  37363. var ngModule = componentFactory instanceof ComponentFactoryBoundToModule ?
  37364. null :
  37365. this._injector.get(NgModuleRef);
  37366. var selectorOrNode = rootSelectorOrNode || componentFactory.selector;
  37367. var compRef = componentFactory.create(Injector.NULL, [], selectorOrNode, ngModule);
  37368. compRef.onDestroy(function () { _this._unloadComponent(compRef); });
  37369. var testability = compRef.injector.get(Testability, null);
  37370. if (testability) {
  37371. compRef.injector.get(TestabilityRegistry)
  37372. .registerApplication(compRef.location.nativeElement, testability);
  37373. }
  37374. this._loadComponent(compRef);
  37375. if (isDevMode()) {
  37376. this._console.log("Angular is running in the development mode. Call enableProdMode() to enable the production mode.");
  37377. }
  37378. return compRef;
  37379. };
  37380. /**
  37381. * Invoke this method to explicitly process change detection and its side-effects.
  37382. *
  37383. * In development mode, `tick()` also performs a second change detection cycle to ensure that no
  37384. * further changes are detected. If additional changes are picked up during this second cycle,
  37385. * bindings in the app have side-effects that cannot be resolved in a single change detection
  37386. * pass.
  37387. * In this case, Angular throws an error, since an Angular application can only have one change
  37388. * detection pass during which all change detection must complete.
  37389. */
  37390. ApplicationRef.prototype.tick = function () {
  37391. var _this = this;
  37392. if (this._runningTick) {
  37393. throw new Error('ApplicationRef.tick is called recursively');
  37394. }
  37395. var scope = ApplicationRef_1._tickScope();
  37396. try {
  37397. this._runningTick = true;
  37398. this._views.forEach(function (view) { return view.detectChanges(); });
  37399. if (this._enforceNoNewChanges) {
  37400. this._views.forEach(function (view) { return view.checkNoChanges(); });
  37401. }
  37402. }
  37403. catch (e) {
  37404. // Attention: Don't rethrow as it could cancel subscriptions to Observables!
  37405. this._zone.runOutsideAngular(function () { return _this._exceptionHandler.handleError(e); });
  37406. }
  37407. finally {
  37408. this._runningTick = false;
  37409. wtfLeave(scope);
  37410. }
  37411. };
  37412. /**
  37413. * Attaches a view so that it will be dirty checked.
  37414. * The view will be automatically detached when it is destroyed.
  37415. * This will throw if the view is already attached to a ViewContainer.
  37416. */
  37417. ApplicationRef.prototype.attachView = function (viewRef) {
  37418. var view = viewRef;
  37419. this._views.push(view);
  37420. view.attachToAppRef(this);
  37421. };
  37422. /**
  37423. * Detaches a view from dirty checking again.
  37424. */
  37425. ApplicationRef.prototype.detachView = function (viewRef) {
  37426. var view = viewRef;
  37427. remove(this._views, view);
  37428. view.detachFromAppRef();
  37429. };
  37430. ApplicationRef.prototype._loadComponent = function (componentRef) {
  37431. this.attachView(componentRef.hostView);
  37432. this.tick();
  37433. this.components.push(componentRef);
  37434. // Get the listeners lazily to prevent DI cycles.
  37435. var listeners = this._injector.get(APP_BOOTSTRAP_LISTENER, []).concat(this._bootstrapListeners);
  37436. listeners.forEach(function (listener) { return listener(componentRef); });
  37437. };
  37438. ApplicationRef.prototype._unloadComponent = function (componentRef) {
  37439. this.detachView(componentRef.hostView);
  37440. remove(this.components, componentRef);
  37441. };
  37442. /** @internal */
  37443. ApplicationRef.prototype.ngOnDestroy = function () {
  37444. // TODO(alxhub): Dispose of the NgZone.
  37445. this._views.slice().forEach(function (view) { return view.destroy(); });
  37446. };
  37447. Object.defineProperty(ApplicationRef.prototype, "viewCount", {
  37448. /**
  37449. * Returns the number of attached views.
  37450. */
  37451. get: function () { return this._views.length; },
  37452. enumerable: true,
  37453. configurable: true
  37454. });
  37455. var ApplicationRef_1;
  37456. /** @internal */
  37457. ApplicationRef._tickScope = wtfCreateScope('ApplicationRef#tick()');
  37458. ApplicationRef = ApplicationRef_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  37459. Injectable(),
  37460. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [NgZone, Console, Injector,
  37461. ErrorHandler,
  37462. ComponentFactoryResolver,
  37463. ApplicationInitStatus])
  37464. ], ApplicationRef);
  37465. return ApplicationRef;
  37466. }());
  37467. function remove(list, el) {
  37468. var index = list.indexOf(el);
  37469. if (index > -1) {
  37470. list.splice(index, 1);
  37471. }
  37472. }
  37473. /**
  37474. * @license
  37475. * Copyright Google Inc. All Rights Reserved.
  37476. *
  37477. * Use of this source code is governed by an MIT-style license that can be
  37478. * found in the LICENSE file at https://angular.io/license
  37479. */
  37480. /**
  37481. * @license
  37482. * Copyright Google Inc. All Rights Reserved.
  37483. *
  37484. * Use of this source code is governed by an MIT-style license that can be
  37485. * found in the LICENSE file at https://angular.io/license
  37486. */
  37487. /**
  37488. * @deprecated Use `RendererType2` (and `Renderer2`) instead.
  37489. */
  37490. var RenderComponentType = /** @class */ (function () {
  37491. function RenderComponentType(id, templateUrl, slotCount, encapsulation, styles, animations) {
  37492. this.id = id;
  37493. this.templateUrl = templateUrl;
  37494. this.slotCount = slotCount;
  37495. this.encapsulation = encapsulation;
  37496. this.styles = styles;
  37497. this.animations = animations;
  37498. }
  37499. return RenderComponentType;
  37500. }());
  37501. /**
  37502. * @deprecated Debug info is handeled internally in the view engine now.
  37503. */
  37504. var RenderDebugInfo = /** @class */ (function () {
  37505. function RenderDebugInfo() {
  37506. }
  37507. return RenderDebugInfo;
  37508. }());
  37509. /**
  37510. * @deprecated Use the `Renderer2` instead.
  37511. */
  37512. var Renderer = /** @class */ (function () {
  37513. function Renderer() {
  37514. }
  37515. return Renderer;
  37516. }());
  37517. var Renderer2Interceptor = new InjectionToken('Renderer2Interceptor');
  37518. /**
  37519. * Injectable service that provides a low-level interface for modifying the UI.
  37520. *
  37521. * Use this service to bypass Angular's templating and make custom UI changes that can't be
  37522. * expressed declaratively. For example if you need to set a property or an attribute whose name is
  37523. * not statically known, use {@link Renderer#setElementProperty setElementProperty} or
  37524. * {@link Renderer#setElementAttribute setElementAttribute} respectively.
  37525. *
  37526. * If you are implementing a custom renderer, you must implement this interface.
  37527. *
  37528. * The default Renderer implementation is `DomRenderer`. Also available is `WebWorkerRenderer`.
  37529. *
  37530. * @deprecated Use `RendererFactory2` instead.
  37531. */
  37532. var RootRenderer = /** @class */ (function () {
  37533. function RootRenderer() {
  37534. }
  37535. return RootRenderer;
  37536. }());
  37537. /**
  37538. * Creates and initializes a custom renderer that implements the `Renderer2` base class.
  37539. *
  37540. * @experimental
  37541. */
  37542. var RendererFactory2 = /** @class */ (function () {
  37543. function RendererFactory2() {
  37544. }
  37545. return RendererFactory2;
  37546. }());
  37547. /**
  37548. * Flags for renderer-specific style modifiers.
  37549. * @experimental
  37550. */
  37551. var RendererStyleFlags2;
  37552. (function (RendererStyleFlags2) {
  37553. /**
  37554. * Marks a style as important.
  37555. */
  37556. RendererStyleFlags2[RendererStyleFlags2["Important"] = 1] = "Important";
  37557. /**
  37558. * Marks a style as using dash case naming (this-is-dash-case).
  37559. */
  37560. RendererStyleFlags2[RendererStyleFlags2["DashCase"] = 2] = "DashCase";
  37561. })(RendererStyleFlags2 || (RendererStyleFlags2 = {}));
  37562. /**
  37563. * Extend this base class to implement custom rendering. By default, Angular
  37564. * renders a template into DOM. You can use custom rendering to intercept
  37565. * rendering calls, or to render to something other than DOM.
  37566. *
  37567. * Create your custom renderer using `RendererFactory2`.
  37568. *
  37569. * Use a custom renderer to bypass Angular's templating and
  37570. * make custom UI changes that can't be expressed declaratively.
  37571. * For example if you need to set a property or an attribute whose name is
  37572. * not statically known, use the `setProperty()` or
  37573. * `setAttribute()` method.
  37574. *
  37575. * @experimental
  37576. */
  37577. var Renderer2 = /** @class */ (function () {
  37578. function Renderer2() {
  37579. }
  37580. return Renderer2;
  37581. }());
  37582. /**
  37583. * @license
  37584. * Copyright Google Inc. All Rights Reserved.
  37585. *
  37586. * Use of this source code is governed by an MIT-style license that can be
  37587. * found in the LICENSE file at https://angular.io/license
  37588. */
  37589. /**
  37590. * @license
  37591. * Copyright Google Inc. All Rights Reserved.
  37592. *
  37593. * Use of this source code is governed by an MIT-style license that can be
  37594. * found in the LICENSE file at https://angular.io/license
  37595. */
  37596. /**
  37597. * A wrapper around a native element inside of a View.
  37598. *
  37599. * An `ElementRef` is backed by a render-specific element. In the browser, this is usually a DOM
  37600. * element.
  37601. *
  37602. * @security Permitting direct access to the DOM can make your application more vulnerable to
  37603. * XSS attacks. Carefully review any use of `ElementRef` in your code. For more detail, see the
  37604. * [Security Guide](http://g.co/ng/security).
  37605. *
  37606. *
  37607. */
  37608. // Note: We don't expose things like `Injector`, `ViewContainer`, ... here,
  37609. // i.e. users have to ask for what they need. With that, we can build better analysis tools
  37610. // and could do better codegen in the future.
  37611. var ElementRef = /** @class */ (function () {
  37612. function ElementRef(nativeElement) {
  37613. this.nativeElement = nativeElement;
  37614. }
  37615. return ElementRef;
  37616. }());
  37617. /**
  37618. * @license
  37619. * Copyright Google Inc. All Rights Reserved.
  37620. *
  37621. * Use of this source code is governed by an MIT-style license that can be
  37622. * found in the LICENSE file at https://angular.io/license
  37623. */
  37624. /**
  37625. * Used to load ng module factories.
  37626. *
  37627. */
  37628. var NgModuleFactoryLoader = /** @class */ (function () {
  37629. function NgModuleFactoryLoader() {
  37630. }
  37631. return NgModuleFactoryLoader;
  37632. }());
  37633. var moduleFactories = new Map();
  37634. /**
  37635. * Registers a loaded module. Should only be called from generated NgModuleFactory code.
  37636. * @experimental
  37637. */
  37638. function registerModuleFactory(id, factory) {
  37639. var existing = moduleFactories.get(id);
  37640. if (existing) {
  37641. throw new Error("Duplicate module registered for " + id + " - " + existing.moduleType.name + " vs " + factory.moduleType.name);
  37642. }
  37643. moduleFactories.set(id, factory);
  37644. }
  37645. /**
  37646. * Returns the NgModuleFactory with the given id, if it exists and has been loaded.
  37647. * Factories for modules that do not specify an `id` cannot be retrieved. Throws if the module
  37648. * cannot be found.
  37649. * @experimental
  37650. */
  37651. function getModuleFactory(id) {
  37652. var factory = moduleFactories.get(id);
  37653. if (!factory)
  37654. throw new Error("No module with ID " + id + " loaded");
  37655. return factory;
  37656. }
  37657. /**
  37658. * @license
  37659. * Copyright Google Inc. All Rights Reserved.
  37660. *
  37661. * Use of this source code is governed by an MIT-style license that can be
  37662. * found in the LICENSE file at https://angular.io/license
  37663. */
  37664. /**
  37665. * An unmodifiable list of items that Angular keeps up to date when the state
  37666. * of the application changes.
  37667. *
  37668. * The type of object that {@link ViewChildren}, {@link ContentChildren}, and {@link QueryList}
  37669. * provide.
  37670. *
  37671. * Implements an iterable interface, therefore it can be used in both ES6
  37672. * javascript `for (var i of items)` loops as well as in Angular templates with
  37673. * `*ngFor="let i of myList"`.
  37674. *
  37675. * Changes can be observed by subscribing to the changes `Observable`.
  37676. *
  37677. * NOTE: In the future this class will implement an `Observable` interface.
  37678. *
  37679. * @usageNotes
  37680. * ### Example
  37681. * ```typescript
  37682. * @Component({...})
  37683. * class Container {
  37684. * @ViewChildren(Item) items:QueryList<Item>;
  37685. * }
  37686. * ```
  37687. */
  37688. var QueryList = /** @class */ (function () {
  37689. function QueryList() {
  37690. this.dirty = true;
  37691. this._results = [];
  37692. this.changes = new EventEmitter();
  37693. this.length = 0;
  37694. }
  37695. /**
  37696. * See
  37697. * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
  37698. */
  37699. QueryList.prototype.map = function (fn) { return this._results.map(fn); };
  37700. /**
  37701. * See
  37702. * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
  37703. */
  37704. QueryList.prototype.filter = function (fn) {
  37705. return this._results.filter(fn);
  37706. };
  37707. /**
  37708. * See
  37709. * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
  37710. */
  37711. QueryList.prototype.find = function (fn) {
  37712. return this._results.find(fn);
  37713. };
  37714. /**
  37715. * See
  37716. * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
  37717. */
  37718. QueryList.prototype.reduce = function (fn, init) {
  37719. return this._results.reduce(fn, init);
  37720. };
  37721. /**
  37722. * See
  37723. * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
  37724. */
  37725. QueryList.prototype.forEach = function (fn) { this._results.forEach(fn); };
  37726. /**
  37727. * See
  37728. * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
  37729. */
  37730. QueryList.prototype.some = function (fn) {
  37731. return this._results.some(fn);
  37732. };
  37733. QueryList.prototype.toArray = function () { return this._results.slice(); };
  37734. QueryList.prototype[getSymbolIterator()] = function () { return this._results[getSymbolIterator()](); };
  37735. QueryList.prototype.toString = function () { return this._results.toString(); };
  37736. QueryList.prototype.reset = function (res) {
  37737. this._results = flatten(res);
  37738. this.dirty = false;
  37739. this.length = this._results.length;
  37740. this.last = this._results[this.length - 1];
  37741. this.first = this._results[0];
  37742. };
  37743. QueryList.prototype.notifyOnChanges = function () { this.changes.emit(this); };
  37744. /** internal */
  37745. QueryList.prototype.setDirty = function () { this.dirty = true; };
  37746. /** internal */
  37747. QueryList.prototype.destroy = function () {
  37748. this.changes.complete();
  37749. this.changes.unsubscribe();
  37750. };
  37751. return QueryList;
  37752. }());
  37753. function flatten(list) {
  37754. return list.reduce(function (flat, item) {
  37755. var flatItem = Array.isArray(item) ? flatten(item) : item;
  37756. return flat.concat(flatItem);
  37757. }, []);
  37758. }
  37759. /**
  37760. * @license
  37761. * Copyright Google Inc. All Rights Reserved.
  37762. *
  37763. * Use of this source code is governed by an MIT-style license that can be
  37764. * found in the LICENSE file at https://angular.io/license
  37765. */
  37766. var _SEPARATOR = '#';
  37767. var FACTORY_CLASS_SUFFIX = 'NgFactory';
  37768. /**
  37769. * Configuration for SystemJsNgModuleLoader.
  37770. * token.
  37771. *
  37772. * @experimental
  37773. */
  37774. var SystemJsNgModuleLoaderConfig = /** @class */ (function () {
  37775. function SystemJsNgModuleLoaderConfig() {
  37776. }
  37777. return SystemJsNgModuleLoaderConfig;
  37778. }());
  37779. var DEFAULT_CONFIG = {
  37780. factoryPathPrefix: '',
  37781. factoryPathSuffix: '.ngfactory',
  37782. };
  37783. /**
  37784. * NgModuleFactoryLoader that uses SystemJS to load NgModuleFactory
  37785. * @experimental
  37786. */
  37787. var SystemJsNgModuleLoader = /** @class */ (function () {
  37788. function SystemJsNgModuleLoader(_compiler, config) {
  37789. this._compiler = _compiler;
  37790. this._config = config || DEFAULT_CONFIG;
  37791. }
  37792. SystemJsNgModuleLoader.prototype.load = function (path) {
  37793. var offlineMode = this._compiler instanceof Compiler;
  37794. return offlineMode ? this.loadFactory(path) : this.loadAndCompile(path);
  37795. };
  37796. SystemJsNgModuleLoader.prototype.loadAndCompile = function (path) {
  37797. var _this = this;
  37798. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1];
  37799. if (exportName === undefined) {
  37800. exportName = 'default';
  37801. }
  37802. return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(module)
  37803. .then(function (module) { return module[exportName]; })
  37804. .then(function (type) { return checkNotEmpty(type, module, exportName); })
  37805. .then(function (type) { return _this._compiler.compileModuleAsync(type); });
  37806. };
  37807. SystemJsNgModuleLoader.prototype.loadFactory = function (path) {
  37808. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(path.split(_SEPARATOR), 2), module = _a[0], exportName = _a[1];
  37809. var factoryClassSuffix = FACTORY_CLASS_SUFFIX;
  37810. if (exportName === undefined) {
  37811. exportName = 'default';
  37812. factoryClassSuffix = '';
  37813. }
  37814. return __webpack_require__("./src/$$_lazy_route_resource lazy recursive")(this._config.factoryPathPrefix + module + this._config.factoryPathSuffix)
  37815. .then(function (module) { return module[exportName + factoryClassSuffix]; })
  37816. .then(function (factory) { return checkNotEmpty(factory, module, exportName); });
  37817. };
  37818. SystemJsNgModuleLoader = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  37819. Injectable(),
  37820. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Optional()),
  37821. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Compiler, SystemJsNgModuleLoaderConfig])
  37822. ], SystemJsNgModuleLoader);
  37823. return SystemJsNgModuleLoader;
  37824. }());
  37825. function checkNotEmpty(value, modulePath, exportName) {
  37826. if (!value) {
  37827. throw new Error("Cannot find '" + exportName + "' in '" + modulePath + "'");
  37828. }
  37829. return value;
  37830. }
  37831. /**
  37832. * @license
  37833. * Copyright Google Inc. All Rights Reserved.
  37834. *
  37835. * Use of this source code is governed by an MIT-style license that can be
  37836. * found in the LICENSE file at https://angular.io/license
  37837. */
  37838. /**
  37839. * Represents an embedded template that can be used to instantiate embedded views.
  37840. * To instantiate embedded views based on a template, use the `ViewContainerRef`
  37841. * method `createEmbeddedView()`.
  37842. *
  37843. * Access a `TemplateRef` instance by placing a directive on an `<ng-template>`
  37844. * element (or directive prefixed with `*`). The `TemplateRef` for the embedded view
  37845. * is injected into the constructor of the directive,
  37846. * using the `TemplateRef` token.
  37847. *
  37848. * You can also use a `Query` to find a `TemplateRef` associated with
  37849. * a component or a directive.
  37850. *
  37851. * @see `ViewContainerRef`
  37852. * @see [Navigate the Component Tree with DI](guide/dependency-injection-navtree)
  37853. *
  37854. */
  37855. var TemplateRef = /** @class */ (function () {
  37856. function TemplateRef() {
  37857. }
  37858. return TemplateRef;
  37859. }());
  37860. /**
  37861. * @license
  37862. * Copyright Google Inc. All Rights Reserved.
  37863. *
  37864. * Use of this source code is governed by an MIT-style license that can be
  37865. * found in the LICENSE file at https://angular.io/license
  37866. */
  37867. /**
  37868. * Represents a container where one or more views can be attached to a component.
  37869. *
  37870. * Can contain *host views* (created by instantiating a
  37871. * component with the `createComponent()` method), and *embedded views*
  37872. * (created by instantiating a `TemplateRef` with the `createEmbeddedView()` method).
  37873. *
  37874. * A view container instance can contain other view containers,
  37875. * creating a [view hierarchy](guide/glossary#view-tree).
  37876. *
  37877. * @see `ComponentRef`
  37878. * @see `EmbeddedViewRef`
  37879. *
  37880. */
  37881. var ViewContainerRef = /** @class */ (function () {
  37882. function ViewContainerRef() {
  37883. }
  37884. return ViewContainerRef;
  37885. }());
  37886. /**
  37887. * @license
  37888. * Copyright Google Inc. All Rights Reserved.
  37889. *
  37890. * Use of this source code is governed by an MIT-style license that can be
  37891. * found in the LICENSE file at https://angular.io/license
  37892. */
  37893. /**
  37894. * Base class for Angular Views, provides change detection functionality.
  37895. * A change-detection tree collects all views that are to be checked for changes.
  37896. * Use the methods to add and remove views from the tree, initiate change-detection,
  37897. * and explicitly mark views as _dirty_, meaning that they have changed and need to be rerendered.
  37898. *
  37899. * @usageNotes
  37900. *
  37901. * The following examples demonstrate how to modify default change-detection behavior
  37902. * to perform explicit detection when needed.
  37903. *
  37904. * ### Use `markForCheck()` with `CheckOnce` strategy
  37905. *
  37906. * The following example sets the `OnPush` change-detection strategy for a component
  37907. * (`CheckOnce`, rather than the default `CheckAlways`), then forces a second check
  37908. * after an interval. See [live demo](http://plnkr.co/edit/GC512b?p=preview).
  37909. *
  37910. * <code-example path="core/ts/change_detect/change-detection.ts"
  37911. * region="mark-for-check"></code-example>
  37912. *
  37913. * ### Detach change detector to limit how often check occurs
  37914. *
  37915. * The following example defines a component with a large list of read-only data
  37916. * that is expected to change constantly, many times per second.
  37917. * To improve performance, we want to check and update the list
  37918. * less often than the changes actually occur. To do that, we detach
  37919. * the component's change detector and perform an explicit local check every five seconds.
  37920. *
  37921. * <code-example path="core/ts/change_detect/change-detection.ts" region="detach"></code-example>
  37922. *
  37923. *
  37924. * ### Reattaching a detached component
  37925. *
  37926. * The following example creates a component displaying live data.
  37927. * The component detaches its change detector from the main change detector tree
  37928. * when the `live` property is set to false, and reattaches it when the property
  37929. * becomes true.
  37930. *
  37931. * <code-example path="core/ts/change_detect/change-detection.ts" region="reattach"></code-example>
  37932. *
  37933. */
  37934. var ChangeDetectorRef = /** @class */ (function () {
  37935. function ChangeDetectorRef() {
  37936. }
  37937. return ChangeDetectorRef;
  37938. }());
  37939. /**
  37940. * @license
  37941. * Copyright Google Inc. All Rights Reserved.
  37942. *
  37943. * Use of this source code is governed by an MIT-style license that can be
  37944. * found in the LICENSE file at https://angular.io/license
  37945. */
  37946. /**
  37947. * Represents an Angular [view](guide/glossary#view),
  37948. * specifically the [host view](guide/glossary#view-tree) that is defined by a component.
  37949. * Also serves as the base class
  37950. * that adds destroy methods for [embedded views](guide/glossary#view-tree).
  37951. *
  37952. * @see `EmbeddedViewRef`
  37953. */
  37954. var ViewRef = /** @class */ (function (_super) {
  37955. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ViewRef, _super);
  37956. function ViewRef() {
  37957. return _super !== null && _super.apply(this, arguments) || this;
  37958. }
  37959. return ViewRef;
  37960. }(ChangeDetectorRef));
  37961. /**
  37962. * Represents an Angular [view](guide/glossary#view) in a view container.
  37963. * An [embedded view](guide/glossary#view-tree) can be referenced from a component
  37964. * other than the hosting component whose template defines it, or it can be defined
  37965. * independently by a `TemplateRef`.
  37966. *
  37967. * Properties of elements in a view can change, but the structure (number and order) of elements in
  37968. * a view cannot. Change the structure of elements by inserting, moving, or
  37969. * removing nested views in a view container.
  37970. *
  37971. * @see `ViewContainerRef`
  37972. *
  37973. * @usageNotes
  37974. *
  37975. * The following template breaks down into two separate `TemplateRef` instances,
  37976. * an outer one and an inner one.
  37977. *
  37978. * ```
  37979. * Count: {{items.length}}
  37980. * <ul>
  37981. * <li *ngFor="let item of items">{{item}}</li>
  37982. * </ul>
  37983. * ```
  37984. *
  37985. * This is the outer `TemplateRef`:
  37986. *
  37987. * ```
  37988. * Count: {{items.length}}
  37989. * <ul>
  37990. * <ng-template ngFor let-item [ngForOf]="items"></ng-template>
  37991. * </ul>
  37992. * ```
  37993. *
  37994. * This is the inner `TemplateRef`:
  37995. *
  37996. * ```
  37997. * <li>{{item}}</li>
  37998. * ```
  37999. *
  38000. * The outer and inner `TemplateRef` instances are assembled into views as follows:
  38001. *
  38002. * ```
  38003. * <!-- ViewRef: outer-0 -->
  38004. * Count: 2
  38005. * <ul>
  38006. * <ng-template view-container-ref></ng-template>
  38007. * <!-- ViewRef: inner-1 --><li>first</li><!-- /ViewRef: inner-1 -->
  38008. * <!-- ViewRef: inner-2 --><li>second</li><!-- /ViewRef: inner-2 -->
  38009. * </ul>
  38010. * <!-- /ViewRef: outer-0 -->
  38011. * ```
  38012. * @experimental
  38013. */
  38014. var EmbeddedViewRef = /** @class */ (function (_super) {
  38015. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(EmbeddedViewRef, _super);
  38016. function EmbeddedViewRef() {
  38017. return _super !== null && _super.apply(this, arguments) || this;
  38018. }
  38019. return EmbeddedViewRef;
  38020. }(ViewRef));
  38021. /**
  38022. * @license
  38023. * Copyright Google Inc. All Rights Reserved.
  38024. *
  38025. * Use of this source code is governed by an MIT-style license that can be
  38026. * found in the LICENSE file at https://angular.io/license
  38027. */
  38028. /**
  38029. * @license
  38030. * Copyright Google Inc. All Rights Reserved.
  38031. *
  38032. * Use of this source code is governed by an MIT-style license that can be
  38033. * found in the LICENSE file at https://angular.io/license
  38034. */
  38035. var EventListener = /** @class */ (function () {
  38036. function EventListener(name, callback) {
  38037. this.name = name;
  38038. this.callback = callback;
  38039. }
  38040. return EventListener;
  38041. }());
  38042. /**
  38043. * @experimental All debugging apis are currently experimental.
  38044. */
  38045. var DebugNode = /** @class */ (function () {
  38046. function DebugNode(nativeNode, parent, _debugContext) {
  38047. this._debugContext = _debugContext;
  38048. this.nativeNode = nativeNode;
  38049. if (parent && parent instanceof DebugElement) {
  38050. parent.addChild(this);
  38051. }
  38052. else {
  38053. this.parent = null;
  38054. }
  38055. this.listeners = [];
  38056. }
  38057. Object.defineProperty(DebugNode.prototype, "injector", {
  38058. get: function () { return this._debugContext.injector; },
  38059. enumerable: true,
  38060. configurable: true
  38061. });
  38062. Object.defineProperty(DebugNode.prototype, "componentInstance", {
  38063. get: function () { return this._debugContext.component; },
  38064. enumerable: true,
  38065. configurable: true
  38066. });
  38067. Object.defineProperty(DebugNode.prototype, "context", {
  38068. get: function () { return this._debugContext.context; },
  38069. enumerable: true,
  38070. configurable: true
  38071. });
  38072. Object.defineProperty(DebugNode.prototype, "references", {
  38073. get: function () { return this._debugContext.references; },
  38074. enumerable: true,
  38075. configurable: true
  38076. });
  38077. Object.defineProperty(DebugNode.prototype, "providerTokens", {
  38078. get: function () { return this._debugContext.providerTokens; },
  38079. enumerable: true,
  38080. configurable: true
  38081. });
  38082. return DebugNode;
  38083. }());
  38084. /**
  38085. * @experimental All debugging apis are currently experimental.
  38086. */
  38087. var DebugElement = /** @class */ (function (_super) {
  38088. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DebugElement, _super);
  38089. function DebugElement(nativeNode, parent, _debugContext) {
  38090. var _this = _super.call(this, nativeNode, parent, _debugContext) || this;
  38091. _this.properties = {};
  38092. _this.attributes = {};
  38093. _this.classes = {};
  38094. _this.styles = {};
  38095. _this.childNodes = [];
  38096. _this.nativeElement = nativeNode;
  38097. return _this;
  38098. }
  38099. DebugElement.prototype.addChild = function (child) {
  38100. if (child) {
  38101. this.childNodes.push(child);
  38102. child.parent = this;
  38103. }
  38104. };
  38105. DebugElement.prototype.removeChild = function (child) {
  38106. var childIndex = this.childNodes.indexOf(child);
  38107. if (childIndex !== -1) {
  38108. child.parent = null;
  38109. this.childNodes.splice(childIndex, 1);
  38110. }
  38111. };
  38112. DebugElement.prototype.insertChildrenAfter = function (child, newChildren) {
  38113. var _this = this;
  38114. var _a;
  38115. var siblingIndex = this.childNodes.indexOf(child);
  38116. if (siblingIndex !== -1) {
  38117. (_a = this.childNodes).splice.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([siblingIndex + 1, 0], newChildren));
  38118. newChildren.forEach(function (c) {
  38119. if (c.parent) {
  38120. c.parent.removeChild(c);
  38121. }
  38122. c.parent = _this;
  38123. });
  38124. }
  38125. };
  38126. DebugElement.prototype.insertBefore = function (refChild, newChild) {
  38127. var refIndex = this.childNodes.indexOf(refChild);
  38128. if (refIndex === -1) {
  38129. this.addChild(newChild);
  38130. }
  38131. else {
  38132. if (newChild.parent) {
  38133. newChild.parent.removeChild(newChild);
  38134. }
  38135. newChild.parent = this;
  38136. this.childNodes.splice(refIndex, 0, newChild);
  38137. }
  38138. };
  38139. DebugElement.prototype.query = function (predicate) {
  38140. var results = this.queryAll(predicate);
  38141. return results[0] || null;
  38142. };
  38143. DebugElement.prototype.queryAll = function (predicate) {
  38144. var matches = [];
  38145. _queryElementChildren(this, predicate, matches);
  38146. return matches;
  38147. };
  38148. DebugElement.prototype.queryAllNodes = function (predicate) {
  38149. var matches = [];
  38150. _queryNodeChildren(this, predicate, matches);
  38151. return matches;
  38152. };
  38153. Object.defineProperty(DebugElement.prototype, "children", {
  38154. get: function () {
  38155. return this.childNodes.filter(function (node) { return node instanceof DebugElement; });
  38156. },
  38157. enumerable: true,
  38158. configurable: true
  38159. });
  38160. DebugElement.prototype.triggerEventHandler = function (eventName, eventObj) {
  38161. this.listeners.forEach(function (listener) {
  38162. if (listener.name == eventName) {
  38163. listener.callback(eventObj);
  38164. }
  38165. });
  38166. };
  38167. return DebugElement;
  38168. }(DebugNode));
  38169. /**
  38170. * @experimental
  38171. */
  38172. function asNativeElements(debugEls) {
  38173. return debugEls.map(function (el) { return el.nativeElement; });
  38174. }
  38175. function _queryElementChildren(element, predicate, matches) {
  38176. element.childNodes.forEach(function (node) {
  38177. if (node instanceof DebugElement) {
  38178. if (predicate(node)) {
  38179. matches.push(node);
  38180. }
  38181. _queryElementChildren(node, predicate, matches);
  38182. }
  38183. });
  38184. }
  38185. function _queryNodeChildren(parentNode, predicate, matches) {
  38186. if (parentNode instanceof DebugElement) {
  38187. parentNode.childNodes.forEach(function (node) {
  38188. if (predicate(node)) {
  38189. matches.push(node);
  38190. }
  38191. if (node instanceof DebugElement) {
  38192. _queryNodeChildren(node, predicate, matches);
  38193. }
  38194. });
  38195. }
  38196. }
  38197. // Need to keep the nodes in a global Map so that multiple angular apps are supported.
  38198. var _nativeNodeToDebugNode = new Map();
  38199. /**
  38200. * @experimental
  38201. */
  38202. function getDebugNode(nativeNode) {
  38203. return _nativeNodeToDebugNode.get(nativeNode) || null;
  38204. }
  38205. function indexDebugNode(node) {
  38206. _nativeNodeToDebugNode.set(node.nativeNode, node);
  38207. }
  38208. function removeDebugNodeFromIndex(node) {
  38209. _nativeNodeToDebugNode.delete(node.nativeNode);
  38210. }
  38211. /**
  38212. * @license
  38213. * Copyright Google Inc. All Rights Reserved.
  38214. *
  38215. * Use of this source code is governed by an MIT-style license that can be
  38216. * found in the LICENSE file at https://angular.io/license
  38217. */
  38218. function devModeEqual(a, b) {
  38219. var isListLikeIterableA = isListLikeIterable(a);
  38220. var isListLikeIterableB = isListLikeIterable(b);
  38221. if (isListLikeIterableA && isListLikeIterableB) {
  38222. return areIterablesEqual(a, b, devModeEqual);
  38223. }
  38224. else {
  38225. var isAObject = a && (typeof a === 'object' || typeof a === 'function');
  38226. var isBObject = b && (typeof b === 'object' || typeof b === 'function');
  38227. if (!isListLikeIterableA && isAObject && !isListLikeIterableB && isBObject) {
  38228. return true;
  38229. }
  38230. else {
  38231. return looseIdentical(a, b);
  38232. }
  38233. }
  38234. }
  38235. /**
  38236. * Indicates that the result of a {@link Pipe} transformation has changed even though the
  38237. * reference has not changed.
  38238. *
  38239. * Wrapped values are unwrapped automatically during the change detection, and the unwrapped value
  38240. * is stored.
  38241. *
  38242. * Example:
  38243. *
  38244. * ```
  38245. * if (this._latestValue === this._latestReturnedValue) {
  38246. * return this._latestReturnedValue;
  38247. * } else {
  38248. * this._latestReturnedValue = this._latestValue;
  38249. * return WrappedValue.wrap(this._latestValue); // this will force update
  38250. * }
  38251. * ```
  38252. *
  38253. */
  38254. var WrappedValue = /** @class */ (function () {
  38255. function WrappedValue(value) {
  38256. this.wrapped = value;
  38257. }
  38258. /** Creates a wrapped value. */
  38259. WrappedValue.wrap = function (value) { return new WrappedValue(value); };
  38260. /**
  38261. * Returns the underlying value of a wrapped value.
  38262. * Returns the given `value` when it is not wrapped.
  38263. **/
  38264. WrappedValue.unwrap = function (value) { return WrappedValue.isWrapped(value) ? value.wrapped : value; };
  38265. /** Returns true if `value` is a wrapped value. */
  38266. WrappedValue.isWrapped = function (value) { return value instanceof WrappedValue; };
  38267. return WrappedValue;
  38268. }());
  38269. /**
  38270. * Represents a basic change from a previous to a new value.
  38271. *
  38272. */
  38273. var SimpleChange = /** @class */ (function () {
  38274. function SimpleChange(previousValue, currentValue, firstChange) {
  38275. this.previousValue = previousValue;
  38276. this.currentValue = currentValue;
  38277. this.firstChange = firstChange;
  38278. }
  38279. /**
  38280. * Check whether the new value is the first value assigned.
  38281. */
  38282. SimpleChange.prototype.isFirstChange = function () { return this.firstChange; };
  38283. return SimpleChange;
  38284. }());
  38285. function isListLikeIterable(obj) {
  38286. if (!isJsObject(obj))
  38287. return false;
  38288. return Array.isArray(obj) ||
  38289. (!(obj instanceof Map) && // JS Map are iterables but return entries as [k, v]
  38290. getSymbolIterator() in obj); // JS Iterable have a Symbol.iterator prop
  38291. }
  38292. function areIterablesEqual(a, b, comparator) {
  38293. var iterator1 = a[getSymbolIterator()]();
  38294. var iterator2 = b[getSymbolIterator()]();
  38295. while (true) {
  38296. var item1 = iterator1.next();
  38297. var item2 = iterator2.next();
  38298. if (item1.done && item2.done)
  38299. return true;
  38300. if (item1.done || item2.done)
  38301. return false;
  38302. if (!comparator(item1.value, item2.value))
  38303. return false;
  38304. }
  38305. }
  38306. function iterateListLike(obj, fn) {
  38307. if (Array.isArray(obj)) {
  38308. for (var i = 0; i < obj.length; i++) {
  38309. fn(obj[i]);
  38310. }
  38311. }
  38312. else {
  38313. var iterator = obj[getSymbolIterator()]();
  38314. var item = void 0;
  38315. while (!((item = iterator.next()).done)) {
  38316. fn(item.value);
  38317. }
  38318. }
  38319. }
  38320. function isJsObject(o) {
  38321. return o !== null && (typeof o === 'function' || typeof o === 'object');
  38322. }
  38323. /**
  38324. * @license
  38325. * Copyright Google Inc. All Rights Reserved.
  38326. *
  38327. * Use of this source code is governed by an MIT-style license that can be
  38328. * found in the LICENSE file at https://angular.io/license
  38329. */
  38330. var DefaultIterableDifferFactory = /** @class */ (function () {
  38331. function DefaultIterableDifferFactory() {
  38332. }
  38333. DefaultIterableDifferFactory.prototype.supports = function (obj) { return isListLikeIterable(obj); };
  38334. DefaultIterableDifferFactory.prototype.create = function (trackByFn) {
  38335. return new DefaultIterableDiffer(trackByFn);
  38336. };
  38337. return DefaultIterableDifferFactory;
  38338. }());
  38339. var trackByIdentity = function (index, item) { return item; };
  38340. /**
  38341. * @deprecated v4.0.0 - Should not be part of public API.
  38342. */
  38343. var DefaultIterableDiffer = /** @class */ (function () {
  38344. function DefaultIterableDiffer(trackByFn) {
  38345. this.length = 0;
  38346. // Keeps track of the used records at any point in time (during & across `_check()` calls)
  38347. this._linkedRecords = null;
  38348. // Keeps track of the removed records at any point in time during `_check()` calls.
  38349. this._unlinkedRecords = null;
  38350. this._previousItHead = null;
  38351. this._itHead = null;
  38352. this._itTail = null;
  38353. this._additionsHead = null;
  38354. this._additionsTail = null;
  38355. this._movesHead = null;
  38356. this._movesTail = null;
  38357. this._removalsHead = null;
  38358. this._removalsTail = null;
  38359. // Keeps track of records where custom track by is the same, but item identity has changed
  38360. this._identityChangesHead = null;
  38361. this._identityChangesTail = null;
  38362. this._trackByFn = trackByFn || trackByIdentity;
  38363. }
  38364. DefaultIterableDiffer.prototype.forEachItem = function (fn) {
  38365. var record;
  38366. for (record = this._itHead; record !== null; record = record._next) {
  38367. fn(record);
  38368. }
  38369. };
  38370. DefaultIterableDiffer.prototype.forEachOperation = function (fn) {
  38371. var nextIt = this._itHead;
  38372. var nextRemove = this._removalsHead;
  38373. var addRemoveOffset = 0;
  38374. var moveOffsets = null;
  38375. while (nextIt || nextRemove) {
  38376. // Figure out which is the next record to process
  38377. // Order: remove, add, move
  38378. var record = !nextRemove ||
  38379. nextIt &&
  38380. nextIt.currentIndex <
  38381. getPreviousIndex(nextRemove, addRemoveOffset, moveOffsets) ?
  38382. nextIt :
  38383. nextRemove;
  38384. var adjPreviousIndex = getPreviousIndex(record, addRemoveOffset, moveOffsets);
  38385. var currentIndex = record.currentIndex;
  38386. // consume the item, and adjust the addRemoveOffset and update moveDistance if necessary
  38387. if (record === nextRemove) {
  38388. addRemoveOffset--;
  38389. nextRemove = nextRemove._nextRemoved;
  38390. }
  38391. else {
  38392. nextIt = nextIt._next;
  38393. if (record.previousIndex == null) {
  38394. addRemoveOffset++;
  38395. }
  38396. else {
  38397. // INVARIANT: currentIndex < previousIndex
  38398. if (!moveOffsets)
  38399. moveOffsets = [];
  38400. var localMovePreviousIndex = adjPreviousIndex - addRemoveOffset;
  38401. var localCurrentIndex = currentIndex - addRemoveOffset;
  38402. if (localMovePreviousIndex != localCurrentIndex) {
  38403. for (var i = 0; i < localMovePreviousIndex; i++) {
  38404. var offset = i < moveOffsets.length ? moveOffsets[i] : (moveOffsets[i] = 0);
  38405. var index = offset + i;
  38406. if (localCurrentIndex <= index && index < localMovePreviousIndex) {
  38407. moveOffsets[i] = offset + 1;
  38408. }
  38409. }
  38410. var previousIndex = record.previousIndex;
  38411. moveOffsets[previousIndex] = localCurrentIndex - localMovePreviousIndex;
  38412. }
  38413. }
  38414. }
  38415. if (adjPreviousIndex !== currentIndex) {
  38416. fn(record, adjPreviousIndex, currentIndex);
  38417. }
  38418. }
  38419. };
  38420. DefaultIterableDiffer.prototype.forEachPreviousItem = function (fn) {
  38421. var record;
  38422. for (record = this._previousItHead; record !== null; record = record._nextPrevious) {
  38423. fn(record);
  38424. }
  38425. };
  38426. DefaultIterableDiffer.prototype.forEachAddedItem = function (fn) {
  38427. var record;
  38428. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  38429. fn(record);
  38430. }
  38431. };
  38432. DefaultIterableDiffer.prototype.forEachMovedItem = function (fn) {
  38433. var record;
  38434. for (record = this._movesHead; record !== null; record = record._nextMoved) {
  38435. fn(record);
  38436. }
  38437. };
  38438. DefaultIterableDiffer.prototype.forEachRemovedItem = function (fn) {
  38439. var record;
  38440. for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
  38441. fn(record);
  38442. }
  38443. };
  38444. DefaultIterableDiffer.prototype.forEachIdentityChange = function (fn) {
  38445. var record;
  38446. for (record = this._identityChangesHead; record !== null; record = record._nextIdentityChange) {
  38447. fn(record);
  38448. }
  38449. };
  38450. DefaultIterableDiffer.prototype.diff = function (collection) {
  38451. if (collection == null)
  38452. collection = [];
  38453. if (!isListLikeIterable(collection)) {
  38454. throw new Error("Error trying to diff '" + stringify(collection) + "'. Only arrays and iterables are allowed");
  38455. }
  38456. if (this.check(collection)) {
  38457. return this;
  38458. }
  38459. else {
  38460. return null;
  38461. }
  38462. };
  38463. DefaultIterableDiffer.prototype.onDestroy = function () { };
  38464. DefaultIterableDiffer.prototype.check = function (collection) {
  38465. var _this = this;
  38466. this._reset();
  38467. var record = this._itHead;
  38468. var mayBeDirty = false;
  38469. var index;
  38470. var item;
  38471. var itemTrackBy;
  38472. if (Array.isArray(collection)) {
  38473. this.length = collection.length;
  38474. for (var index_1 = 0; index_1 < this.length; index_1++) {
  38475. item = collection[index_1];
  38476. itemTrackBy = this._trackByFn(index_1, item);
  38477. if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
  38478. record = this._mismatch(record, item, itemTrackBy, index_1);
  38479. mayBeDirty = true;
  38480. }
  38481. else {
  38482. if (mayBeDirty) {
  38483. // TODO(misko): can we limit this to duplicates only?
  38484. record = this._verifyReinsertion(record, item, itemTrackBy, index_1);
  38485. }
  38486. if (!looseIdentical(record.item, item))
  38487. this._addIdentityChange(record, item);
  38488. }
  38489. record = record._next;
  38490. }
  38491. }
  38492. else {
  38493. index = 0;
  38494. iterateListLike(collection, function (item) {
  38495. itemTrackBy = _this._trackByFn(index, item);
  38496. if (record === null || !looseIdentical(record.trackById, itemTrackBy)) {
  38497. record = _this._mismatch(record, item, itemTrackBy, index);
  38498. mayBeDirty = true;
  38499. }
  38500. else {
  38501. if (mayBeDirty) {
  38502. // TODO(misko): can we limit this to duplicates only?
  38503. record = _this._verifyReinsertion(record, item, itemTrackBy, index);
  38504. }
  38505. if (!looseIdentical(record.item, item))
  38506. _this._addIdentityChange(record, item);
  38507. }
  38508. record = record._next;
  38509. index++;
  38510. });
  38511. this.length = index;
  38512. }
  38513. this._truncate(record);
  38514. this.collection = collection;
  38515. return this.isDirty;
  38516. };
  38517. Object.defineProperty(DefaultIterableDiffer.prototype, "isDirty", {
  38518. /* CollectionChanges is considered dirty if it has any additions, moves, removals, or identity
  38519. * changes.
  38520. */
  38521. get: function () {
  38522. return this._additionsHead !== null || this._movesHead !== null ||
  38523. this._removalsHead !== null || this._identityChangesHead !== null;
  38524. },
  38525. enumerable: true,
  38526. configurable: true
  38527. });
  38528. /**
  38529. * Reset the state of the change objects to show no changes. This means set previousKey to
  38530. * currentKey, and clear all of the queues (additions, moves, removals).
  38531. * Set the previousIndexes of moved and added items to their currentIndexes
  38532. * Reset the list of additions, moves and removals
  38533. *
  38534. * @internal
  38535. */
  38536. DefaultIterableDiffer.prototype._reset = function () {
  38537. if (this.isDirty) {
  38538. var record = void 0;
  38539. var nextRecord = void 0;
  38540. for (record = this._previousItHead = this._itHead; record !== null; record = record._next) {
  38541. record._nextPrevious = record._next;
  38542. }
  38543. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  38544. record.previousIndex = record.currentIndex;
  38545. }
  38546. this._additionsHead = this._additionsTail = null;
  38547. for (record = this._movesHead; record !== null; record = nextRecord) {
  38548. record.previousIndex = record.currentIndex;
  38549. nextRecord = record._nextMoved;
  38550. }
  38551. this._movesHead = this._movesTail = null;
  38552. this._removalsHead = this._removalsTail = null;
  38553. this._identityChangesHead = this._identityChangesTail = null;
  38554. // TODO(vicb): when assert gets supported
  38555. // assert(!this.isDirty);
  38556. }
  38557. };
  38558. /**
  38559. * This is the core function which handles differences between collections.
  38560. *
  38561. * - `record` is the record which we saw at this position last time. If null then it is a new
  38562. * item.
  38563. * - `item` is the current item in the collection
  38564. * - `index` is the position of the item in the collection
  38565. *
  38566. * @internal
  38567. */
  38568. DefaultIterableDiffer.prototype._mismatch = function (record, item, itemTrackBy, index) {
  38569. // The previous record after which we will append the current one.
  38570. var previousRecord;
  38571. if (record === null) {
  38572. previousRecord = this._itTail;
  38573. }
  38574. else {
  38575. previousRecord = record._prev;
  38576. // Remove the record from the collection since we know it does not match the item.
  38577. this._remove(record);
  38578. }
  38579. // Attempt to see if we have seen the item before.
  38580. record = this._linkedRecords === null ? null : this._linkedRecords.get(itemTrackBy, index);
  38581. if (record !== null) {
  38582. // We have seen this before, we need to move it forward in the collection.
  38583. // But first we need to check if identity changed, so we can update in view if necessary
  38584. if (!looseIdentical(record.item, item))
  38585. this._addIdentityChange(record, item);
  38586. this._moveAfter(record, previousRecord, index);
  38587. }
  38588. else {
  38589. // Never seen it, check evicted list.
  38590. record = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
  38591. if (record !== null) {
  38592. // It is an item which we have evicted earlier: reinsert it back into the list.
  38593. // But first we need to check if identity changed, so we can update in view if necessary
  38594. if (!looseIdentical(record.item, item))
  38595. this._addIdentityChange(record, item);
  38596. this._reinsertAfter(record, previousRecord, index);
  38597. }
  38598. else {
  38599. // It is a new item: add it.
  38600. record =
  38601. this._addAfter(new IterableChangeRecord_(item, itemTrackBy), previousRecord, index);
  38602. }
  38603. }
  38604. return record;
  38605. };
  38606. /**
  38607. * This check is only needed if an array contains duplicates. (Short circuit of nothing dirty)
  38608. *
  38609. * Use case: `[a, a]` => `[b, a, a]`
  38610. *
  38611. * If we did not have this check then the insertion of `b` would:
  38612. * 1) evict first `a`
  38613. * 2) insert `b` at `0` index.
  38614. * 3) leave `a` at index `1` as is. <-- this is wrong!
  38615. * 3) reinsert `a` at index 2. <-- this is wrong!
  38616. *
  38617. * The correct behavior is:
  38618. * 1) evict first `a`
  38619. * 2) insert `b` at `0` index.
  38620. * 3) reinsert `a` at index 1.
  38621. * 3) move `a` at from `1` to `2`.
  38622. *
  38623. *
  38624. * Double check that we have not evicted a duplicate item. We need to check if the item type may
  38625. * have already been removed:
  38626. * The insertion of b will evict the first 'a'. If we don't reinsert it now it will be reinserted
  38627. * at the end. Which will show up as the two 'a's switching position. This is incorrect, since a
  38628. * better way to think of it is as insert of 'b' rather then switch 'a' with 'b' and then add 'a'
  38629. * at the end.
  38630. *
  38631. * @internal
  38632. */
  38633. DefaultIterableDiffer.prototype._verifyReinsertion = function (record, item, itemTrackBy, index) {
  38634. var reinsertRecord = this._unlinkedRecords === null ? null : this._unlinkedRecords.get(itemTrackBy, null);
  38635. if (reinsertRecord !== null) {
  38636. record = this._reinsertAfter(reinsertRecord, record._prev, index);
  38637. }
  38638. else if (record.currentIndex != index) {
  38639. record.currentIndex = index;
  38640. this._addToMoves(record, index);
  38641. }
  38642. return record;
  38643. };
  38644. /**
  38645. * Get rid of any excess {@link IterableChangeRecord_}s from the previous collection
  38646. *
  38647. * - `record` The first excess {@link IterableChangeRecord_}.
  38648. *
  38649. * @internal
  38650. */
  38651. DefaultIterableDiffer.prototype._truncate = function (record) {
  38652. // Anything after that needs to be removed;
  38653. while (record !== null) {
  38654. var nextRecord = record._next;
  38655. this._addToRemovals(this._unlink(record));
  38656. record = nextRecord;
  38657. }
  38658. if (this._unlinkedRecords !== null) {
  38659. this._unlinkedRecords.clear();
  38660. }
  38661. if (this._additionsTail !== null) {
  38662. this._additionsTail._nextAdded = null;
  38663. }
  38664. if (this._movesTail !== null) {
  38665. this._movesTail._nextMoved = null;
  38666. }
  38667. if (this._itTail !== null) {
  38668. this._itTail._next = null;
  38669. }
  38670. if (this._removalsTail !== null) {
  38671. this._removalsTail._nextRemoved = null;
  38672. }
  38673. if (this._identityChangesTail !== null) {
  38674. this._identityChangesTail._nextIdentityChange = null;
  38675. }
  38676. };
  38677. /** @internal */
  38678. DefaultIterableDiffer.prototype._reinsertAfter = function (record, prevRecord, index) {
  38679. if (this._unlinkedRecords !== null) {
  38680. this._unlinkedRecords.remove(record);
  38681. }
  38682. var prev = record._prevRemoved;
  38683. var next = record._nextRemoved;
  38684. if (prev === null) {
  38685. this._removalsHead = next;
  38686. }
  38687. else {
  38688. prev._nextRemoved = next;
  38689. }
  38690. if (next === null) {
  38691. this._removalsTail = prev;
  38692. }
  38693. else {
  38694. next._prevRemoved = prev;
  38695. }
  38696. this._insertAfter(record, prevRecord, index);
  38697. this._addToMoves(record, index);
  38698. return record;
  38699. };
  38700. /** @internal */
  38701. DefaultIterableDiffer.prototype._moveAfter = function (record, prevRecord, index) {
  38702. this._unlink(record);
  38703. this._insertAfter(record, prevRecord, index);
  38704. this._addToMoves(record, index);
  38705. return record;
  38706. };
  38707. /** @internal */
  38708. DefaultIterableDiffer.prototype._addAfter = function (record, prevRecord, index) {
  38709. this._insertAfter(record, prevRecord, index);
  38710. if (this._additionsTail === null) {
  38711. // TODO(vicb):
  38712. // assert(this._additionsHead === null);
  38713. this._additionsTail = this._additionsHead = record;
  38714. }
  38715. else {
  38716. // TODO(vicb):
  38717. // assert(_additionsTail._nextAdded === null);
  38718. // assert(record._nextAdded === null);
  38719. this._additionsTail = this._additionsTail._nextAdded = record;
  38720. }
  38721. return record;
  38722. };
  38723. /** @internal */
  38724. DefaultIterableDiffer.prototype._insertAfter = function (record, prevRecord, index) {
  38725. // TODO(vicb):
  38726. // assert(record != prevRecord);
  38727. // assert(record._next === null);
  38728. // assert(record._prev === null);
  38729. var next = prevRecord === null ? this._itHead : prevRecord._next;
  38730. // TODO(vicb):
  38731. // assert(next != record);
  38732. // assert(prevRecord != record);
  38733. record._next = next;
  38734. record._prev = prevRecord;
  38735. if (next === null) {
  38736. this._itTail = record;
  38737. }
  38738. else {
  38739. next._prev = record;
  38740. }
  38741. if (prevRecord === null) {
  38742. this._itHead = record;
  38743. }
  38744. else {
  38745. prevRecord._next = record;
  38746. }
  38747. if (this._linkedRecords === null) {
  38748. this._linkedRecords = new _DuplicateMap();
  38749. }
  38750. this._linkedRecords.put(record);
  38751. record.currentIndex = index;
  38752. return record;
  38753. };
  38754. /** @internal */
  38755. DefaultIterableDiffer.prototype._remove = function (record) {
  38756. return this._addToRemovals(this._unlink(record));
  38757. };
  38758. /** @internal */
  38759. DefaultIterableDiffer.prototype._unlink = function (record) {
  38760. if (this._linkedRecords !== null) {
  38761. this._linkedRecords.remove(record);
  38762. }
  38763. var prev = record._prev;
  38764. var next = record._next;
  38765. // TODO(vicb):
  38766. // assert((record._prev = null) === null);
  38767. // assert((record._next = null) === null);
  38768. if (prev === null) {
  38769. this._itHead = next;
  38770. }
  38771. else {
  38772. prev._next = next;
  38773. }
  38774. if (next === null) {
  38775. this._itTail = prev;
  38776. }
  38777. else {
  38778. next._prev = prev;
  38779. }
  38780. return record;
  38781. };
  38782. /** @internal */
  38783. DefaultIterableDiffer.prototype._addToMoves = function (record, toIndex) {
  38784. // TODO(vicb):
  38785. // assert(record._nextMoved === null);
  38786. if (record.previousIndex === toIndex) {
  38787. return record;
  38788. }
  38789. if (this._movesTail === null) {
  38790. // TODO(vicb):
  38791. // assert(_movesHead === null);
  38792. this._movesTail = this._movesHead = record;
  38793. }
  38794. else {
  38795. // TODO(vicb):
  38796. // assert(_movesTail._nextMoved === null);
  38797. this._movesTail = this._movesTail._nextMoved = record;
  38798. }
  38799. return record;
  38800. };
  38801. DefaultIterableDiffer.prototype._addToRemovals = function (record) {
  38802. if (this._unlinkedRecords === null) {
  38803. this._unlinkedRecords = new _DuplicateMap();
  38804. }
  38805. this._unlinkedRecords.put(record);
  38806. record.currentIndex = null;
  38807. record._nextRemoved = null;
  38808. if (this._removalsTail === null) {
  38809. // TODO(vicb):
  38810. // assert(_removalsHead === null);
  38811. this._removalsTail = this._removalsHead = record;
  38812. record._prevRemoved = null;
  38813. }
  38814. else {
  38815. // TODO(vicb):
  38816. // assert(_removalsTail._nextRemoved === null);
  38817. // assert(record._nextRemoved === null);
  38818. record._prevRemoved = this._removalsTail;
  38819. this._removalsTail = this._removalsTail._nextRemoved = record;
  38820. }
  38821. return record;
  38822. };
  38823. /** @internal */
  38824. DefaultIterableDiffer.prototype._addIdentityChange = function (record, item) {
  38825. record.item = item;
  38826. if (this._identityChangesTail === null) {
  38827. this._identityChangesTail = this._identityChangesHead = record;
  38828. }
  38829. else {
  38830. this._identityChangesTail = this._identityChangesTail._nextIdentityChange = record;
  38831. }
  38832. return record;
  38833. };
  38834. return DefaultIterableDiffer;
  38835. }());
  38836. var IterableChangeRecord_ = /** @class */ (function () {
  38837. function IterableChangeRecord_(item, trackById) {
  38838. this.item = item;
  38839. this.trackById = trackById;
  38840. this.currentIndex = null;
  38841. this.previousIndex = null;
  38842. /** @internal */
  38843. this._nextPrevious = null;
  38844. /** @internal */
  38845. this._prev = null;
  38846. /** @internal */
  38847. this._next = null;
  38848. /** @internal */
  38849. this._prevDup = null;
  38850. /** @internal */
  38851. this._nextDup = null;
  38852. /** @internal */
  38853. this._prevRemoved = null;
  38854. /** @internal */
  38855. this._nextRemoved = null;
  38856. /** @internal */
  38857. this._nextAdded = null;
  38858. /** @internal */
  38859. this._nextMoved = null;
  38860. /** @internal */
  38861. this._nextIdentityChange = null;
  38862. }
  38863. return IterableChangeRecord_;
  38864. }());
  38865. // A linked list of CollectionChangeRecords with the same IterableChangeRecord_.item
  38866. var _DuplicateItemRecordList = /** @class */ (function () {
  38867. function _DuplicateItemRecordList() {
  38868. /** @internal */
  38869. this._head = null;
  38870. /** @internal */
  38871. this._tail = null;
  38872. }
  38873. /**
  38874. * Append the record to the list of duplicates.
  38875. *
  38876. * Note: by design all records in the list of duplicates hold the same value in record.item.
  38877. */
  38878. _DuplicateItemRecordList.prototype.add = function (record) {
  38879. if (this._head === null) {
  38880. this._head = this._tail = record;
  38881. record._nextDup = null;
  38882. record._prevDup = null;
  38883. }
  38884. else {
  38885. // TODO(vicb):
  38886. // assert(record.item == _head.item ||
  38887. // record.item is num && record.item.isNaN && _head.item is num && _head.item.isNaN);
  38888. this._tail._nextDup = record;
  38889. record._prevDup = this._tail;
  38890. record._nextDup = null;
  38891. this._tail = record;
  38892. }
  38893. };
  38894. // Returns a IterableChangeRecord_ having IterableChangeRecord_.trackById == trackById and
  38895. // IterableChangeRecord_.currentIndex >= atOrAfterIndex
  38896. _DuplicateItemRecordList.prototype.get = function (trackById, atOrAfterIndex) {
  38897. var record;
  38898. for (record = this._head; record !== null; record = record._nextDup) {
  38899. if ((atOrAfterIndex === null || atOrAfterIndex <= record.currentIndex) &&
  38900. looseIdentical(record.trackById, trackById)) {
  38901. return record;
  38902. }
  38903. }
  38904. return null;
  38905. };
  38906. /**
  38907. * Remove one {@link IterableChangeRecord_} from the list of duplicates.
  38908. *
  38909. * Returns whether the list of duplicates is empty.
  38910. */
  38911. _DuplicateItemRecordList.prototype.remove = function (record) {
  38912. // TODO(vicb):
  38913. // assert(() {
  38914. // // verify that the record being removed is in the list.
  38915. // for (IterableChangeRecord_ cursor = _head; cursor != null; cursor = cursor._nextDup) {
  38916. // if (identical(cursor, record)) return true;
  38917. // }
  38918. // return false;
  38919. //});
  38920. var prev = record._prevDup;
  38921. var next = record._nextDup;
  38922. if (prev === null) {
  38923. this._head = next;
  38924. }
  38925. else {
  38926. prev._nextDup = next;
  38927. }
  38928. if (next === null) {
  38929. this._tail = prev;
  38930. }
  38931. else {
  38932. next._prevDup = prev;
  38933. }
  38934. return this._head === null;
  38935. };
  38936. return _DuplicateItemRecordList;
  38937. }());
  38938. var _DuplicateMap = /** @class */ (function () {
  38939. function _DuplicateMap() {
  38940. this.map = new Map();
  38941. }
  38942. _DuplicateMap.prototype.put = function (record) {
  38943. var key = record.trackById;
  38944. var duplicates = this.map.get(key);
  38945. if (!duplicates) {
  38946. duplicates = new _DuplicateItemRecordList();
  38947. this.map.set(key, duplicates);
  38948. }
  38949. duplicates.add(record);
  38950. };
  38951. /**
  38952. * Retrieve the `value` using key. Because the IterableChangeRecord_ value may be one which we
  38953. * have already iterated over, we use the `atOrAfterIndex` to pretend it is not there.
  38954. *
  38955. * Use case: `[a, b, c, a, a]` if we are at index `3` which is the second `a` then asking if we
  38956. * have any more `a`s needs to return the second `a`.
  38957. */
  38958. _DuplicateMap.prototype.get = function (trackById, atOrAfterIndex) {
  38959. var key = trackById;
  38960. var recordList = this.map.get(key);
  38961. return recordList ? recordList.get(trackById, atOrAfterIndex) : null;
  38962. };
  38963. /**
  38964. * Removes a {@link IterableChangeRecord_} from the list of duplicates.
  38965. *
  38966. * The list of duplicates also is removed from the map if it gets empty.
  38967. */
  38968. _DuplicateMap.prototype.remove = function (record) {
  38969. var key = record.trackById;
  38970. var recordList = this.map.get(key);
  38971. // Remove the list of duplicates when it gets empty
  38972. if (recordList.remove(record)) {
  38973. this.map.delete(key);
  38974. }
  38975. return record;
  38976. };
  38977. Object.defineProperty(_DuplicateMap.prototype, "isEmpty", {
  38978. get: function () { return this.map.size === 0; },
  38979. enumerable: true,
  38980. configurable: true
  38981. });
  38982. _DuplicateMap.prototype.clear = function () { this.map.clear(); };
  38983. return _DuplicateMap;
  38984. }());
  38985. function getPreviousIndex(item, addRemoveOffset, moveOffsets) {
  38986. var previousIndex = item.previousIndex;
  38987. if (previousIndex === null)
  38988. return previousIndex;
  38989. var moveOffset = 0;
  38990. if (moveOffsets && previousIndex < moveOffsets.length) {
  38991. moveOffset = moveOffsets[previousIndex];
  38992. }
  38993. return previousIndex + addRemoveOffset + moveOffset;
  38994. }
  38995. /**
  38996. * @license
  38997. * Copyright Google Inc. All Rights Reserved.
  38998. *
  38999. * Use of this source code is governed by an MIT-style license that can be
  39000. * found in the LICENSE file at https://angular.io/license
  39001. */
  39002. var DefaultKeyValueDifferFactory = /** @class */ (function () {
  39003. function DefaultKeyValueDifferFactory() {
  39004. }
  39005. DefaultKeyValueDifferFactory.prototype.supports = function (obj) { return obj instanceof Map || isJsObject(obj); };
  39006. DefaultKeyValueDifferFactory.prototype.create = function () { return new DefaultKeyValueDiffer(); };
  39007. return DefaultKeyValueDifferFactory;
  39008. }());
  39009. var DefaultKeyValueDiffer = /** @class */ (function () {
  39010. function DefaultKeyValueDiffer() {
  39011. this._records = new Map();
  39012. this._mapHead = null;
  39013. // _appendAfter is used in the check loop
  39014. this._appendAfter = null;
  39015. this._previousMapHead = null;
  39016. this._changesHead = null;
  39017. this._changesTail = null;
  39018. this._additionsHead = null;
  39019. this._additionsTail = null;
  39020. this._removalsHead = null;
  39021. this._removalsTail = null;
  39022. }
  39023. Object.defineProperty(DefaultKeyValueDiffer.prototype, "isDirty", {
  39024. get: function () {
  39025. return this._additionsHead !== null || this._changesHead !== null ||
  39026. this._removalsHead !== null;
  39027. },
  39028. enumerable: true,
  39029. configurable: true
  39030. });
  39031. DefaultKeyValueDiffer.prototype.forEachItem = function (fn) {
  39032. var record;
  39033. for (record = this._mapHead; record !== null; record = record._next) {
  39034. fn(record);
  39035. }
  39036. };
  39037. DefaultKeyValueDiffer.prototype.forEachPreviousItem = function (fn) {
  39038. var record;
  39039. for (record = this._previousMapHead; record !== null; record = record._nextPrevious) {
  39040. fn(record);
  39041. }
  39042. };
  39043. DefaultKeyValueDiffer.prototype.forEachChangedItem = function (fn) {
  39044. var record;
  39045. for (record = this._changesHead; record !== null; record = record._nextChanged) {
  39046. fn(record);
  39047. }
  39048. };
  39049. DefaultKeyValueDiffer.prototype.forEachAddedItem = function (fn) {
  39050. var record;
  39051. for (record = this._additionsHead; record !== null; record = record._nextAdded) {
  39052. fn(record);
  39053. }
  39054. };
  39055. DefaultKeyValueDiffer.prototype.forEachRemovedItem = function (fn) {
  39056. var record;
  39057. for (record = this._removalsHead; record !== null; record = record._nextRemoved) {
  39058. fn(record);
  39059. }
  39060. };
  39061. DefaultKeyValueDiffer.prototype.diff = function (map) {
  39062. if (!map) {
  39063. map = new Map();
  39064. }
  39065. else if (!(map instanceof Map || isJsObject(map))) {
  39066. throw new Error("Error trying to diff '" + stringify(map) + "'. Only maps and objects are allowed");
  39067. }
  39068. return this.check(map) ? this : null;
  39069. };
  39070. DefaultKeyValueDiffer.prototype.onDestroy = function () { };
  39071. /**
  39072. * Check the current state of the map vs the previous.
  39073. * The algorithm is optimised for when the keys do no change.
  39074. */
  39075. DefaultKeyValueDiffer.prototype.check = function (map) {
  39076. var _this = this;
  39077. this._reset();
  39078. var insertBefore = this._mapHead;
  39079. this._appendAfter = null;
  39080. this._forEach(map, function (value, key) {
  39081. if (insertBefore && insertBefore.key === key) {
  39082. _this._maybeAddToChanges(insertBefore, value);
  39083. _this._appendAfter = insertBefore;
  39084. insertBefore = insertBefore._next;
  39085. }
  39086. else {
  39087. var record = _this._getOrCreateRecordForKey(key, value);
  39088. insertBefore = _this._insertBeforeOrAppend(insertBefore, record);
  39089. }
  39090. });
  39091. // Items remaining at the end of the list have been deleted
  39092. if (insertBefore) {
  39093. if (insertBefore._prev) {
  39094. insertBefore._prev._next = null;
  39095. }
  39096. this._removalsHead = insertBefore;
  39097. for (var record = insertBefore; record !== null; record = record._nextRemoved) {
  39098. if (record === this._mapHead) {
  39099. this._mapHead = null;
  39100. }
  39101. this._records.delete(record.key);
  39102. record._nextRemoved = record._next;
  39103. record.previousValue = record.currentValue;
  39104. record.currentValue = null;
  39105. record._prev = null;
  39106. record._next = null;
  39107. }
  39108. }
  39109. // Make sure tails have no next records from previous runs
  39110. if (this._changesTail)
  39111. this._changesTail._nextChanged = null;
  39112. if (this._additionsTail)
  39113. this._additionsTail._nextAdded = null;
  39114. return this.isDirty;
  39115. };
  39116. /**
  39117. * Inserts a record before `before` or append at the end of the list when `before` is null.
  39118. *
  39119. * Notes:
  39120. * - This method appends at `this._appendAfter`,
  39121. * - This method updates `this._appendAfter`,
  39122. * - The return value is the new value for the insertion pointer.
  39123. */
  39124. DefaultKeyValueDiffer.prototype._insertBeforeOrAppend = function (before, record) {
  39125. if (before) {
  39126. var prev = before._prev;
  39127. record._next = before;
  39128. record._prev = prev;
  39129. before._prev = record;
  39130. if (prev) {
  39131. prev._next = record;
  39132. }
  39133. if (before === this._mapHead) {
  39134. this._mapHead = record;
  39135. }
  39136. this._appendAfter = before;
  39137. return before;
  39138. }
  39139. if (this._appendAfter) {
  39140. this._appendAfter._next = record;
  39141. record._prev = this._appendAfter;
  39142. }
  39143. else {
  39144. this._mapHead = record;
  39145. }
  39146. this._appendAfter = record;
  39147. return null;
  39148. };
  39149. DefaultKeyValueDiffer.prototype._getOrCreateRecordForKey = function (key, value) {
  39150. if (this._records.has(key)) {
  39151. var record_1 = this._records.get(key);
  39152. this._maybeAddToChanges(record_1, value);
  39153. var prev = record_1._prev;
  39154. var next = record_1._next;
  39155. if (prev) {
  39156. prev._next = next;
  39157. }
  39158. if (next) {
  39159. next._prev = prev;
  39160. }
  39161. record_1._next = null;
  39162. record_1._prev = null;
  39163. return record_1;
  39164. }
  39165. var record = new KeyValueChangeRecord_(key);
  39166. this._records.set(key, record);
  39167. record.currentValue = value;
  39168. this._addToAdditions(record);
  39169. return record;
  39170. };
  39171. /** @internal */
  39172. DefaultKeyValueDiffer.prototype._reset = function () {
  39173. if (this.isDirty) {
  39174. var record = void 0;
  39175. // let `_previousMapHead` contain the state of the map before the changes
  39176. this._previousMapHead = this._mapHead;
  39177. for (record = this._previousMapHead; record !== null; record = record._next) {
  39178. record._nextPrevious = record._next;
  39179. }
  39180. // Update `record.previousValue` with the value of the item before the changes
  39181. // We need to update all changed items (that's those which have been added and changed)
  39182. for (record = this._changesHead; record !== null; record = record._nextChanged) {
  39183. record.previousValue = record.currentValue;
  39184. }
  39185. for (record = this._additionsHead; record != null; record = record._nextAdded) {
  39186. record.previousValue = record.currentValue;
  39187. }
  39188. this._changesHead = this._changesTail = null;
  39189. this._additionsHead = this._additionsTail = null;
  39190. this._removalsHead = null;
  39191. }
  39192. };
  39193. // Add the record or a given key to the list of changes only when the value has actually changed
  39194. DefaultKeyValueDiffer.prototype._maybeAddToChanges = function (record, newValue) {
  39195. if (!looseIdentical(newValue, record.currentValue)) {
  39196. record.previousValue = record.currentValue;
  39197. record.currentValue = newValue;
  39198. this._addToChanges(record);
  39199. }
  39200. };
  39201. DefaultKeyValueDiffer.prototype._addToAdditions = function (record) {
  39202. if (this._additionsHead === null) {
  39203. this._additionsHead = this._additionsTail = record;
  39204. }
  39205. else {
  39206. this._additionsTail._nextAdded = record;
  39207. this._additionsTail = record;
  39208. }
  39209. };
  39210. DefaultKeyValueDiffer.prototype._addToChanges = function (record) {
  39211. if (this._changesHead === null) {
  39212. this._changesHead = this._changesTail = record;
  39213. }
  39214. else {
  39215. this._changesTail._nextChanged = record;
  39216. this._changesTail = record;
  39217. }
  39218. };
  39219. /** @internal */
  39220. DefaultKeyValueDiffer.prototype._forEach = function (obj, fn) {
  39221. if (obj instanceof Map) {
  39222. obj.forEach(fn);
  39223. }
  39224. else {
  39225. Object.keys(obj).forEach(function (k) { return fn(obj[k], k); });
  39226. }
  39227. };
  39228. return DefaultKeyValueDiffer;
  39229. }());
  39230. var KeyValueChangeRecord_ = /** @class */ (function () {
  39231. function KeyValueChangeRecord_(key) {
  39232. this.key = key;
  39233. this.previousValue = null;
  39234. this.currentValue = null;
  39235. /** @internal */
  39236. this._nextPrevious = null;
  39237. /** @internal */
  39238. this._next = null;
  39239. /** @internal */
  39240. this._prev = null;
  39241. /** @internal */
  39242. this._nextAdded = null;
  39243. /** @internal */
  39244. this._nextRemoved = null;
  39245. /** @internal */
  39246. this._nextChanged = null;
  39247. }
  39248. return KeyValueChangeRecord_;
  39249. }());
  39250. /**
  39251. * @license
  39252. * Copyright Google Inc. All Rights Reserved.
  39253. *
  39254. * Use of this source code is governed by an MIT-style license that can be
  39255. * found in the LICENSE file at https://angular.io/license
  39256. */
  39257. /**
  39258. * A repository of different iterable diffing strategies used by NgFor, NgClass, and others.
  39259. *
  39260. */
  39261. var IterableDiffers = /** @class */ (function () {
  39262. function IterableDiffers(factories) {
  39263. this.factories = factories;
  39264. }
  39265. IterableDiffers.create = function (factories, parent) {
  39266. if (parent != null) {
  39267. var copied = parent.factories.slice();
  39268. factories = factories.concat(copied);
  39269. }
  39270. return new IterableDiffers(factories);
  39271. };
  39272. /**
  39273. * Takes an array of {@link IterableDifferFactory} and returns a provider used to extend the
  39274. * inherited {@link IterableDiffers} instance with the provided factories and return a new
  39275. * {@link IterableDiffers} instance.
  39276. *
  39277. * @usageNotes
  39278. * ### Example
  39279. *
  39280. * The following example shows how to extend an existing list of factories,
  39281. * which will only be applied to the injector for this component and its children.
  39282. * This step is all that's required to make a new {@link IterableDiffer} available.
  39283. *
  39284. * ```
  39285. * @Component({
  39286. * viewProviders: [
  39287. * IterableDiffers.extend([new ImmutableListDiffer()])
  39288. * ]
  39289. * })
  39290. * ```
  39291. */
  39292. IterableDiffers.extend = function (factories) {
  39293. return {
  39294. provide: IterableDiffers,
  39295. useFactory: function (parent) {
  39296. if (!parent) {
  39297. // Typically would occur when calling IterableDiffers.extend inside of dependencies passed
  39298. // to
  39299. // bootstrap(), which would override default pipes instead of extending them.
  39300. throw new Error('Cannot extend IterableDiffers without a parent injector');
  39301. }
  39302. return IterableDiffers.create(factories, parent);
  39303. },
  39304. // Dependency technically isn't optional, but we can provide a better error message this way.
  39305. deps: [[IterableDiffers, new SkipSelf(), new Optional()]]
  39306. };
  39307. };
  39308. IterableDiffers.prototype.find = function (iterable) {
  39309. var factory = this.factories.find(function (f) { return f.supports(iterable); });
  39310. if (factory != null) {
  39311. return factory;
  39312. }
  39313. else {
  39314. throw new Error("Cannot find a differ supporting object '" + iterable + "' of type '" + getTypeNameForDebugging(iterable) + "'");
  39315. }
  39316. };
  39317. IterableDiffers.ngInjectableDef = defineInjectable({
  39318. providedIn: 'root',
  39319. factory: function () { return new IterableDiffers([new DefaultIterableDifferFactory()]); }
  39320. });
  39321. return IterableDiffers;
  39322. }());
  39323. function getTypeNameForDebugging(type) {
  39324. return type['name'] || typeof type;
  39325. }
  39326. /**
  39327. * @license
  39328. * Copyright Google Inc. All Rights Reserved.
  39329. *
  39330. * Use of this source code is governed by an MIT-style license that can be
  39331. * found in the LICENSE file at https://angular.io/license
  39332. */
  39333. /**
  39334. * A repository of different Map diffing strategies used by NgClass, NgStyle, and others.
  39335. *
  39336. */
  39337. var KeyValueDiffers = /** @class */ (function () {
  39338. function KeyValueDiffers(factories) {
  39339. this.factories = factories;
  39340. }
  39341. KeyValueDiffers.create = function (factories, parent) {
  39342. if (parent) {
  39343. var copied = parent.factories.slice();
  39344. factories = factories.concat(copied);
  39345. }
  39346. return new KeyValueDiffers(factories);
  39347. };
  39348. /**
  39349. * Takes an array of {@link KeyValueDifferFactory} and returns a provider used to extend the
  39350. * inherited {@link KeyValueDiffers} instance with the provided factories and return a new
  39351. * {@link KeyValueDiffers} instance.
  39352. *
  39353. * @usageNotes
  39354. * ### Example
  39355. *
  39356. * The following example shows how to extend an existing list of factories,
  39357. * which will only be applied to the injector for this component and its children.
  39358. * This step is all that's required to make a new {@link KeyValueDiffer} available.
  39359. *
  39360. * ```
  39361. * @Component({
  39362. * viewProviders: [
  39363. * KeyValueDiffers.extend([new ImmutableMapDiffer()])
  39364. * ]
  39365. * })
  39366. * ```
  39367. */
  39368. KeyValueDiffers.extend = function (factories) {
  39369. return {
  39370. provide: KeyValueDiffers,
  39371. useFactory: function (parent) {
  39372. if (!parent) {
  39373. // Typically would occur when calling KeyValueDiffers.extend inside of dependencies passed
  39374. // to bootstrap(), which would override default pipes instead of extending them.
  39375. throw new Error('Cannot extend KeyValueDiffers without a parent injector');
  39376. }
  39377. return KeyValueDiffers.create(factories, parent);
  39378. },
  39379. // Dependency technically isn't optional, but we can provide a better error message this way.
  39380. deps: [[KeyValueDiffers, new SkipSelf(), new Optional()]]
  39381. };
  39382. };
  39383. KeyValueDiffers.prototype.find = function (kv) {
  39384. var factory = this.factories.find(function (f) { return f.supports(kv); });
  39385. if (factory) {
  39386. return factory;
  39387. }
  39388. throw new Error("Cannot find a differ supporting object '" + kv + "'");
  39389. };
  39390. return KeyValueDiffers;
  39391. }());
  39392. /**
  39393. * @license
  39394. * Copyright Google Inc. All Rights Reserved.
  39395. *
  39396. * Use of this source code is governed by an MIT-style license that can be
  39397. * found in the LICENSE file at https://angular.io/license
  39398. */
  39399. /**
  39400. * Structural diffing for `Object`s and `Map`s.
  39401. */
  39402. var keyValDiff = [new DefaultKeyValueDifferFactory()];
  39403. /**
  39404. * Structural diffing for `Iterable` types such as `Array`s.
  39405. */
  39406. var iterableDiff = [new DefaultIterableDifferFactory()];
  39407. var defaultIterableDiffers = new IterableDiffers(iterableDiff);
  39408. var defaultKeyValueDiffers = new KeyValueDiffers(keyValDiff);
  39409. /**
  39410. * @license
  39411. * Copyright Google Inc. All Rights Reserved.
  39412. *
  39413. * Use of this source code is governed by an MIT-style license that can be
  39414. * found in the LICENSE file at https://angular.io/license
  39415. */
  39416. /**
  39417. * @license
  39418. * Copyright Google Inc. All Rights Reserved.
  39419. *
  39420. * Use of this source code is governed by an MIT-style license that can be
  39421. * found in the LICENSE file at https://angular.io/license
  39422. */
  39423. var _CORE_PLATFORM_PROVIDERS = [
  39424. // Set a default platform name for platforms that don't set it explicitly.
  39425. { provide: PLATFORM_ID, useValue: 'unknown' },
  39426. { provide: PlatformRef, deps: [Injector] },
  39427. { provide: TestabilityRegistry, deps: [] },
  39428. { provide: Console, deps: [] },
  39429. ];
  39430. /**
  39431. * This platform has to be included in any other platform
  39432. *
  39433. * @experimental
  39434. */
  39435. var platformCore = createPlatformFactory(null, 'core', _CORE_PLATFORM_PROVIDERS);
  39436. /**
  39437. * @license
  39438. * Copyright Google Inc. All Rights Reserved.
  39439. *
  39440. * Use of this source code is governed by an MIT-style license that can be
  39441. * found in the LICENSE file at https://angular.io/license
  39442. */
  39443. /**
  39444. * Provide this token to set the locale of your application.
  39445. * It is used for i18n extraction, by i18n pipes (DatePipe, I18nPluralPipe, CurrencyPipe,
  39446. * DecimalPipe and PercentPipe) and by ICU expressions.
  39447. *
  39448. * See the [i18n guide](guide/i18n#setting-up-locale) for more information.
  39449. *
  39450. * @usageNotes
  39451. * ### Example
  39452. *
  39453. * ```typescript
  39454. * import { LOCALE_ID } from '@angular/core';
  39455. * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
  39456. * import { AppModule } from './app/app.module';
  39457. *
  39458. * platformBrowserDynamic().bootstrapModule(AppModule, {
  39459. * providers: [{provide: LOCALE_ID, useValue: 'en-US' }]
  39460. * });
  39461. * ```
  39462. *
  39463. * @experimental i18n support is experimental.
  39464. */
  39465. var LOCALE_ID = new InjectionToken('LocaleId');
  39466. /**
  39467. * Use this token at bootstrap to provide the content of your translation file (`xtb`,
  39468. * `xlf` or `xlf2`) when you want to translate your application in another language.
  39469. *
  39470. * See the [i18n guide](guide/i18n#merge) for more information.
  39471. *
  39472. * @usageNotes
  39473. * ### Example
  39474. *
  39475. * ```typescript
  39476. * import { TRANSLATIONS } from '@angular/core';
  39477. * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
  39478. * import { AppModule } from './app/app.module';
  39479. *
  39480. * // content of your translation file
  39481. * const translations = '....';
  39482. *
  39483. * platformBrowserDynamic().bootstrapModule(AppModule, {
  39484. * providers: [{provide: TRANSLATIONS, useValue: translations }]
  39485. * });
  39486. * ```
  39487. *
  39488. * @experimental i18n support is experimental.
  39489. */
  39490. var TRANSLATIONS = new InjectionToken('Translations');
  39491. /**
  39492. * Provide this token at bootstrap to set the format of your {@link TRANSLATIONS}: `xtb`,
  39493. * `xlf` or `xlf2`.
  39494. *
  39495. * See the [i18n guide](guide/i18n#merge) for more information.
  39496. *
  39497. * @usageNotes
  39498. * ### Example
  39499. *
  39500. * ```typescript
  39501. * import { TRANSLATIONS_FORMAT } from '@angular/core';
  39502. * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
  39503. * import { AppModule } from './app/app.module';
  39504. *
  39505. * platformBrowserDynamic().bootstrapModule(AppModule, {
  39506. * providers: [{provide: TRANSLATIONS_FORMAT, useValue: 'xlf' }]
  39507. * });
  39508. * ```
  39509. *
  39510. * @experimental i18n support is experimental.
  39511. */
  39512. var TRANSLATIONS_FORMAT = new InjectionToken('TranslationsFormat');
  39513. /**
  39514. * Use this enum at bootstrap as an option of `bootstrapModule` to define the strategy
  39515. * that the compiler should use in case of missing translations:
  39516. * - Error: throw if you have missing translations.
  39517. * - Warning (default): show a warning in the console and/or shell.
  39518. * - Ignore: do nothing.
  39519. *
  39520. * See the [i18n guide](guide/i18n#missing-translation) for more information.
  39521. *
  39522. * @usageNotes
  39523. * ### Example
  39524. * ```typescript
  39525. * import { MissingTranslationStrategy } from '@angular/core';
  39526. * import { platformBrowserDynamic } from '@angular/platform-browser-dynamic';
  39527. * import { AppModule } from './app/app.module';
  39528. *
  39529. * platformBrowserDynamic().bootstrapModule(AppModule, {
  39530. * missingTranslation: MissingTranslationStrategy.Error
  39531. * });
  39532. * ```
  39533. *
  39534. * @experimental i18n support is experimental.
  39535. */
  39536. var MissingTranslationStrategy;
  39537. (function (MissingTranslationStrategy) {
  39538. MissingTranslationStrategy[MissingTranslationStrategy["Error"] = 0] = "Error";
  39539. MissingTranslationStrategy[MissingTranslationStrategy["Warning"] = 1] = "Warning";
  39540. MissingTranslationStrategy[MissingTranslationStrategy["Ignore"] = 2] = "Ignore";
  39541. })(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
  39542. /**
  39543. * @license
  39544. * Copyright Google Inc. All Rights Reserved.
  39545. *
  39546. * Use of this source code is governed by an MIT-style license that can be
  39547. * found in the LICENSE file at https://angular.io/license
  39548. */
  39549. function _iterableDiffersFactory() {
  39550. return defaultIterableDiffers;
  39551. }
  39552. function _keyValueDiffersFactory() {
  39553. return defaultKeyValueDiffers;
  39554. }
  39555. function _localeFactory(locale) {
  39556. return locale || 'en-US';
  39557. }
  39558. /**
  39559. * A built-in [dependency injection token](guide/glossary#di-token)
  39560. * that is used to configure the root injector for bootstrapping.
  39561. */
  39562. var APPLICATION_MODULE_PROVIDERS = [
  39563. {
  39564. provide: ApplicationRef,
  39565. useClass: ApplicationRef,
  39566. deps: [NgZone, Console, Injector, ErrorHandler, ComponentFactoryResolver, ApplicationInitStatus]
  39567. },
  39568. {
  39569. provide: ApplicationInitStatus,
  39570. useClass: ApplicationInitStatus,
  39571. deps: [[new Optional(), APP_INITIALIZER]]
  39572. },
  39573. { provide: Compiler, useClass: Compiler, deps: [] },
  39574. APP_ID_RANDOM_PROVIDER,
  39575. { provide: IterableDiffers, useFactory: _iterableDiffersFactory, deps: [] },
  39576. { provide: KeyValueDiffers, useFactory: _keyValueDiffersFactory, deps: [] },
  39577. {
  39578. provide: LOCALE_ID,
  39579. useFactory: _localeFactory,
  39580. deps: [[new Inject(LOCALE_ID), new Optional(), new SkipSelf()]]
  39581. },
  39582. ];
  39583. /**
  39584. * Configures the root injector for an app with
  39585. * providers of `@angular/core` dependencies that `ApplicationRef` needs
  39586. * to bootstrap components.
  39587. *
  39588. * Re-exported by `BrowserModule`, which is included automatically in the root
  39589. * `AppModule` when you create a new app with the CLI `new` command.
  39590. *
  39591. * @experimental
  39592. */
  39593. var ApplicationModule = /** @class */ (function () {
  39594. // Inject ApplicationRef to make it eager...
  39595. function ApplicationModule(appRef) {
  39596. }
  39597. ApplicationModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  39598. NgModule({ providers: APPLICATION_MODULE_PROVIDERS }),
  39599. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ApplicationRef])
  39600. ], ApplicationModule);
  39601. return ApplicationModule;
  39602. }());
  39603. /**
  39604. * @license
  39605. * Copyright Google Inc. All Rights Reserved.
  39606. *
  39607. * Use of this source code is governed by an MIT-style license that can be
  39608. * found in the LICENSE file at https://angular.io/license
  39609. */
  39610. /**
  39611. * Used to resolve resource URLs on `@Component` when used with JIT compilation.
  39612. *
  39613. * Example:
  39614. * ```
  39615. * @Component({
  39616. * selector: 'my-comp',
  39617. * templateUrl: 'my-comp.html', // This requires asynchronous resolution
  39618. * })
  39619. * class MyComponnent{
  39620. * }
  39621. *
  39622. * // Calling `renderComponent` will fail because `MyComponent`'s `@Compenent.templateUrl`
  39623. * // needs to be resolved because `renderComponent` is synchronous process.
  39624. * // renderComponent(MyComponent);
  39625. *
  39626. * // Calling `resolveComponentResources` will resolve `@Compenent.templateUrl` into
  39627. * // `@Compenent.template`, which would allow `renderComponent` to proceed in synchronous manner.
  39628. * // Use browser's `fetch` function as the default resource resolution strategy.
  39629. * resolveComponentResources(fetch).then(() => {
  39630. * // After resolution all URLs have been converted into strings.
  39631. * renderComponent(MyComponent);
  39632. * });
  39633. *
  39634. * ```
  39635. *
  39636. * NOTE: In AOT the resolution happens during compilation, and so there should be no need
  39637. * to call this method outside JIT mode.
  39638. *
  39639. * @param resourceResolver a function which is responsible to returning a `Promise` of the resolved
  39640. * URL. Browser's `fetch` method is a good default implementation.
  39641. */
  39642. function resolveComponentResources(resourceResolver) {
  39643. // Store all promises which are fetching the resources.
  39644. var urlFetches = [];
  39645. // Cache so that we don't fetch the same resource more than once.
  39646. var urlMap = new Map();
  39647. function cachedResourceResolve(url) {
  39648. var promise = urlMap.get(url);
  39649. if (!promise) {
  39650. var resp = resourceResolver(url);
  39651. urlMap.set(url, promise = resp.then(unwrapResponse));
  39652. urlFetches.push(promise);
  39653. }
  39654. return promise;
  39655. }
  39656. componentResourceResolutionQueue.forEach(function (component) {
  39657. if (component.templateUrl) {
  39658. cachedResourceResolve(component.templateUrl).then(function (template) {
  39659. component.template = template;
  39660. component.templateUrl = undefined;
  39661. });
  39662. }
  39663. var styleUrls = component.styleUrls;
  39664. var styles = component.styles || (component.styles = []);
  39665. var styleOffset = component.styles.length;
  39666. styleUrls && styleUrls.forEach(function (styleUrl, index) {
  39667. styles.push(''); // pre-allocate array.
  39668. cachedResourceResolve(styleUrl).then(function (style) {
  39669. styles[styleOffset + index] = style;
  39670. styleUrls.splice(styleUrls.indexOf(styleUrl), 1);
  39671. if (styleUrls.length == 0) {
  39672. component.styleUrls = undefined;
  39673. }
  39674. });
  39675. });
  39676. });
  39677. componentResourceResolutionQueue.clear();
  39678. return Promise.all(urlFetches).then(function () { return null; });
  39679. }
  39680. var componentResourceResolutionQueue = new Set();
  39681. function unwrapResponse(response) {
  39682. return typeof response == 'string' ? response : response.text();
  39683. }
  39684. /**
  39685. * @license
  39686. * Copyright Google Inc. All Rights Reserved.
  39687. *
  39688. * Use of this source code is governed by an MIT-style license that can be
  39689. * found in the LICENSE file at https://angular.io/license
  39690. */
  39691. /**
  39692. * This helper class is used to get hold of an inert tree of DOM elements containing dirty HTML
  39693. * that needs sanitizing.
  39694. * Depending upon browser support we must use one of three strategies for doing this.
  39695. * Support: Safari 10.x -> XHR strategy
  39696. * Support: Firefox -> DomParser strategy
  39697. * Default: InertDocument strategy
  39698. */
  39699. var InertBodyHelper = /** @class */ (function () {
  39700. function InertBodyHelper(defaultDoc) {
  39701. this.defaultDoc = defaultDoc;
  39702. this.inertDocument = this.defaultDoc.implementation.createHTMLDocument('sanitization-inert');
  39703. this.inertBodyElement = this.inertDocument.body;
  39704. if (this.inertBodyElement == null) {
  39705. // usually there should be only one body element in the document, but IE doesn't have any, so
  39706. // we need to create one.
  39707. var inertHtml = this.inertDocument.createElement('html');
  39708. this.inertDocument.appendChild(inertHtml);
  39709. this.inertBodyElement = this.inertDocument.createElement('body');
  39710. inertHtml.appendChild(this.inertBodyElement);
  39711. }
  39712. this.inertBodyElement.innerHTML = '<svg><g onload="this.parentNode.remove()"></g></svg>';
  39713. if (this.inertBodyElement.querySelector && !this.inertBodyElement.querySelector('svg')) {
  39714. // We just hit the Safari 10.1 bug - which allows JS to run inside the SVG G element
  39715. // so use the XHR strategy.
  39716. this.getInertBodyElement = this.getInertBodyElement_XHR;
  39717. return;
  39718. }
  39719. this.inertBodyElement.innerHTML =
  39720. '<svg><p><style><img src="</style><img src=x onerror=alert(1)//">';
  39721. if (this.inertBodyElement.querySelector && this.inertBodyElement.querySelector('svg img')) {
  39722. // We just hit the Firefox bug - which prevents the inner img JS from being sanitized
  39723. // so use the DOMParser strategy, if it is available.
  39724. // If the DOMParser is not available then we are not in Firefox (Server/WebWorker?) so we
  39725. // fall through to the default strategy below.
  39726. if (isDOMParserAvailable()) {
  39727. this.getInertBodyElement = this.getInertBodyElement_DOMParser;
  39728. return;
  39729. }
  39730. }
  39731. // None of the bugs were hit so it is safe for us to use the default InertDocument strategy
  39732. this.getInertBodyElement = this.getInertBodyElement_InertDocument;
  39733. }
  39734. /**
  39735. * Use XHR to create and fill an inert body element (on Safari 10.1)
  39736. * See
  39737. * https://github.com/cure53/DOMPurify/blob/a992d3a75031cb8bb032e5ea8399ba972bdf9a65/src/purify.js#L439-L449
  39738. */
  39739. InertBodyHelper.prototype.getInertBodyElement_XHR = function (html) {
  39740. // We add these extra elements to ensure that the rest of the content is parsed as expected
  39741. // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
  39742. // `<head>` tag.
  39743. html = '<body><remove></remove>' + html + '</body>';
  39744. try {
  39745. html = encodeURI(html);
  39746. }
  39747. catch (e) {
  39748. return null;
  39749. }
  39750. var xhr = new XMLHttpRequest();
  39751. xhr.responseType = 'document';
  39752. xhr.open('GET', 'data:text/html;charset=utf-8,' + html, false);
  39753. xhr.send(null);
  39754. var body = xhr.response.body;
  39755. body.removeChild(body.firstChild);
  39756. return body;
  39757. };
  39758. /**
  39759. * Use DOMParser to create and fill an inert body element (on Firefox)
  39760. * See https://github.com/cure53/DOMPurify/releases/tag/0.6.7
  39761. *
  39762. */
  39763. InertBodyHelper.prototype.getInertBodyElement_DOMParser = function (html) {
  39764. // We add these extra elements to ensure that the rest of the content is parsed as expected
  39765. // e.g. leading whitespace is maintained and tags like `<meta>` do not get hoisted to the
  39766. // `<head>` tag.
  39767. html = '<body><remove></remove>' + html + '</body>';
  39768. try {
  39769. var body = new window
  39770. .DOMParser()
  39771. .parseFromString(html, 'text/html')
  39772. .body;
  39773. body.removeChild(body.firstChild);
  39774. return body;
  39775. }
  39776. catch (e) {
  39777. return null;
  39778. }
  39779. };
  39780. /**
  39781. * Use an HTML5 `template` element, if supported, or an inert body element created via
  39782. * `createHtmlDocument` to create and fill an inert DOM element.
  39783. * This is the default sane strategy to use if the browser does not require one of the specialised
  39784. * strategies above.
  39785. */
  39786. InertBodyHelper.prototype.getInertBodyElement_InertDocument = function (html) {
  39787. // Prefer using <template> element if supported.
  39788. var templateEl = this.inertDocument.createElement('template');
  39789. if ('content' in templateEl) {
  39790. templateEl.innerHTML = html;
  39791. return templateEl;
  39792. }
  39793. this.inertBodyElement.innerHTML = html;
  39794. // Support: IE 9-11 only
  39795. // strip custom-namespaced attributes on IE<=11
  39796. if (this.defaultDoc.documentMode) {
  39797. this.stripCustomNsAttrs(this.inertBodyElement);
  39798. }
  39799. return this.inertBodyElement;
  39800. };
  39801. /**
  39802. * When IE9-11 comes across an unknown namespaced attribute e.g. 'xlink:foo' it adds 'xmlns:ns1'
  39803. * attribute to declare ns1 namespace and prefixes the attribute with 'ns1' (e.g.
  39804. * 'ns1:xlink:foo').
  39805. *
  39806. * This is undesirable since we don't want to allow any of these custom attributes. This method
  39807. * strips them all.
  39808. */
  39809. InertBodyHelper.prototype.stripCustomNsAttrs = function (el) {
  39810. var elAttrs = el.attributes;
  39811. // loop backwards so that we can support removals.
  39812. for (var i = elAttrs.length - 1; 0 < i; i--) {
  39813. var attrib = elAttrs.item(i);
  39814. var attrName = attrib.name;
  39815. if (attrName === 'xmlns:ns1' || attrName.indexOf('ns1:') === 0) {
  39816. el.removeAttribute(attrName);
  39817. }
  39818. }
  39819. var childNode = el.firstChild;
  39820. while (childNode) {
  39821. if (childNode.nodeType === Node.ELEMENT_NODE)
  39822. this.stripCustomNsAttrs(childNode);
  39823. childNode = childNode.nextSibling;
  39824. }
  39825. };
  39826. return InertBodyHelper;
  39827. }());
  39828. /**
  39829. * We need to determine whether the DOMParser exists in the global context.
  39830. * The try-catch is because, on some browsers, trying to access this property
  39831. * on window can actually throw an error.
  39832. *
  39833. * @suppress {uselessCode}
  39834. */
  39835. function isDOMParserAvailable() {
  39836. try {
  39837. return !!window.DOMParser;
  39838. }
  39839. catch (e) {
  39840. return false;
  39841. }
  39842. }
  39843. /**
  39844. * @license
  39845. * Copyright Google Inc. All Rights Reserved.
  39846. *
  39847. * Use of this source code is governed by an MIT-style license that can be
  39848. * found in the LICENSE file at https://angular.io/license
  39849. */
  39850. /**
  39851. * A pattern that recognizes a commonly useful subset of URLs that are safe.
  39852. *
  39853. * This regular expression matches a subset of URLs that will not cause script
  39854. * execution if used in URL context within a HTML document. Specifically, this
  39855. * regular expression matches if (comment from here on and regex copied from
  39856. * Soy's EscapingConventions):
  39857. * (1) Either a protocol in a whitelist (http, https, mailto or ftp).
  39858. * (2) or no protocol. A protocol must be followed by a colon. The below
  39859. * allows that by allowing colons only after one of the characters [/?#].
  39860. * A colon after a hash (#) must be in the fragment.
  39861. * Otherwise, a colon after a (?) must be in a query.
  39862. * Otherwise, a colon after a single solidus (/) must be in a path.
  39863. * Otherwise, a colon after a double solidus (//) must be in the authority
  39864. * (before port).
  39865. *
  39866. * The pattern disallows &, used in HTML entity declarations before
  39867. * one of the characters in [/?#]. This disallows HTML entities used in the
  39868. * protocol name, which should never happen, e.g. "h&#116;tp" for "http".
  39869. * It also disallows HTML entities in the first path part of a relative path,
  39870. * e.g. "foo&lt;bar/baz". Our existing escaping functions should not produce
  39871. * that. More importantly, it disallows masking of a colon,
  39872. * e.g. "javascript&#58;...".
  39873. *
  39874. * This regular expression was taken from the Closure sanitization library.
  39875. */
  39876. var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^&:/?#]*(?:[/?#]|$))/gi;
  39877. /** A pattern that matches safe data URLs. Only matches image, video and audio types. */
  39878. var 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;
  39879. function _sanitizeUrl(url) {
  39880. url = String(url);
  39881. if (url.match(SAFE_URL_PATTERN) || url.match(DATA_URL_PATTERN))
  39882. return url;
  39883. if (isDevMode()) {
  39884. console.warn("WARNING: sanitizing unsafe URL value " + url + " (see http://g.co/ng/security#xss)");
  39885. }
  39886. return 'unsafe:' + url;
  39887. }
  39888. function sanitizeSrcset(srcset) {
  39889. srcset = String(srcset);
  39890. return srcset.split(',').map(function (srcset) { return _sanitizeUrl(srcset.trim()); }).join(', ');
  39891. }
  39892. /**
  39893. * @license
  39894. * Copyright Google Inc. All Rights Reserved.
  39895. *
  39896. * Use of this source code is governed by an MIT-style license that can be
  39897. * found in the LICENSE file at https://angular.io/license
  39898. */
  39899. function tagSet(tags) {
  39900. var e_1, _a;
  39901. var res = {};
  39902. try {
  39903. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(tags.split(',')), _c = _b.next(); !_c.done; _c = _b.next()) {
  39904. var t = _c.value;
  39905. res[t] = true;
  39906. }
  39907. }
  39908. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  39909. finally {
  39910. try {
  39911. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  39912. }
  39913. finally { if (e_1) throw e_1.error; }
  39914. }
  39915. return res;
  39916. }
  39917. function merge$1() {
  39918. var sets = [];
  39919. for (var _i = 0; _i < arguments.length; _i++) {
  39920. sets[_i] = arguments[_i];
  39921. }
  39922. var e_2, _a;
  39923. var res = {};
  39924. try {
  39925. for (var sets_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(sets), sets_1_1 = sets_1.next(); !sets_1_1.done; sets_1_1 = sets_1.next()) {
  39926. var s = sets_1_1.value;
  39927. for (var v in s) {
  39928. if (s.hasOwnProperty(v))
  39929. res[v] = true;
  39930. }
  39931. }
  39932. }
  39933. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  39934. finally {
  39935. try {
  39936. if (sets_1_1 && !sets_1_1.done && (_a = sets_1.return)) _a.call(sets_1);
  39937. }
  39938. finally { if (e_2) throw e_2.error; }
  39939. }
  39940. return res;
  39941. }
  39942. // Good source of info about elements and attributes
  39943. // http://dev.w3.org/html5/spec/Overview.html#semantics
  39944. // http://simon.html5.org/html-elements
  39945. // Safe Void Elements - HTML5
  39946. // http://dev.w3.org/html5/spec/Overview.html#void-elements
  39947. var VOID_ELEMENTS = tagSet('area,br,col,hr,img,wbr');
  39948. // Elements that you can, intentionally, leave open (and which close themselves)
  39949. // http://dev.w3.org/html5/spec/Overview.html#optional-tags
  39950. var OPTIONAL_END_TAG_BLOCK_ELEMENTS = tagSet('colgroup,dd,dt,li,p,tbody,td,tfoot,th,thead,tr');
  39951. var OPTIONAL_END_TAG_INLINE_ELEMENTS = tagSet('rp,rt');
  39952. var OPTIONAL_END_TAG_ELEMENTS = merge$1(OPTIONAL_END_TAG_INLINE_ELEMENTS, OPTIONAL_END_TAG_BLOCK_ELEMENTS);
  39953. // Safe Block Elements - HTML5
  39954. var BLOCK_ELEMENTS = merge$1(OPTIONAL_END_TAG_BLOCK_ELEMENTS, tagSet('address,article,' +
  39955. 'aside,blockquote,caption,center,del,details,dialog,dir,div,dl,figure,figcaption,footer,h1,h2,h3,h4,h5,' +
  39956. 'h6,header,hgroup,hr,ins,main,map,menu,nav,ol,pre,section,summary,table,ul'));
  39957. // Inline Elements - HTML5
  39958. var INLINE_ELEMENTS = merge$1(OPTIONAL_END_TAG_INLINE_ELEMENTS, tagSet('a,abbr,acronym,audio,b,' +
  39959. 'bdi,bdo,big,br,cite,code,del,dfn,em,font,i,img,ins,kbd,label,map,mark,picture,q,ruby,rp,rt,s,' +
  39960. 'samp,small,source,span,strike,strong,sub,sup,time,track,tt,u,var,video'));
  39961. var VALID_ELEMENTS = merge$1(VOID_ELEMENTS, BLOCK_ELEMENTS, INLINE_ELEMENTS, OPTIONAL_END_TAG_ELEMENTS);
  39962. // Attributes that have href and hence need to be sanitized
  39963. var URI_ATTRS = tagSet('background,cite,href,itemtype,longdesc,poster,src,xlink:href');
  39964. // Attributes that have special href set hence need to be sanitized
  39965. var SRCSET_ATTRS = tagSet('srcset');
  39966. var HTML_ATTRS = tagSet('abbr,accesskey,align,alt,autoplay,axis,bgcolor,border,cellpadding,cellspacing,class,clear,color,cols,colspan,' +
  39967. 'compact,controls,coords,datetime,default,dir,download,face,headers,height,hidden,hreflang,hspace,' +
  39968. 'ismap,itemscope,itemprop,kind,label,lang,language,loop,media,muted,nohref,nowrap,open,preload,rel,rev,role,rows,rowspan,rules,' +
  39969. 'scope,scrolling,shape,size,sizes,span,srclang,start,summary,tabindex,target,title,translate,type,usemap,' +
  39970. 'valign,value,vspace,width');
  39971. // NB: This currently consciously doesn't support SVG. SVG sanitization has had several security
  39972. // issues in the past, so it seems safer to leave it out if possible. If support for binding SVG via
  39973. // innerHTML is required, SVG attributes should be added here.
  39974. // NB: Sanitization does not allow <form> elements or other active elements (<button> etc). Those
  39975. // can be sanitized, but they increase security surface area without a legitimate use case, so they
  39976. // are left out here.
  39977. var VALID_ATTRS = merge$1(URI_ATTRS, SRCSET_ATTRS, HTML_ATTRS);
  39978. /**
  39979. * SanitizingHtmlSerializer serializes a DOM fragment, stripping out any unsafe elements and unsafe
  39980. * attributes.
  39981. */
  39982. var SanitizingHtmlSerializer = /** @class */ (function () {
  39983. function SanitizingHtmlSerializer() {
  39984. // Explicitly track if something was stripped, to avoid accidentally warning of sanitization just
  39985. // because characters were re-encoded.
  39986. this.sanitizedSomething = false;
  39987. this.buf = [];
  39988. }
  39989. SanitizingHtmlSerializer.prototype.sanitizeChildren = function (el) {
  39990. // This cannot use a TreeWalker, as it has to run on Angular's various DOM adapters.
  39991. // However this code never accesses properties off of `document` before deleting its contents
  39992. // again, so it shouldn't be vulnerable to DOM clobbering.
  39993. var current = el.firstChild;
  39994. while (current) {
  39995. if (current.nodeType === Node.ELEMENT_NODE) {
  39996. this.startElement(current);
  39997. }
  39998. else if (current.nodeType === Node.TEXT_NODE) {
  39999. this.chars(current.nodeValue);
  40000. }
  40001. else {
  40002. // Strip non-element, non-text nodes.
  40003. this.sanitizedSomething = true;
  40004. }
  40005. if (current.firstChild) {
  40006. current = current.firstChild;
  40007. continue;
  40008. }
  40009. while (current) {
  40010. // Leaving the element. Walk up and to the right, closing tags as we go.
  40011. if (current.nodeType === Node.ELEMENT_NODE) {
  40012. this.endElement(current);
  40013. }
  40014. var next = this.checkClobberedElement(current, current.nextSibling);
  40015. if (next) {
  40016. current = next;
  40017. break;
  40018. }
  40019. current = this.checkClobberedElement(current, current.parentNode);
  40020. }
  40021. }
  40022. return this.buf.join('');
  40023. };
  40024. SanitizingHtmlSerializer.prototype.startElement = function (element) {
  40025. var tagName = element.nodeName.toLowerCase();
  40026. if (!VALID_ELEMENTS.hasOwnProperty(tagName)) {
  40027. this.sanitizedSomething = true;
  40028. return;
  40029. }
  40030. this.buf.push('<');
  40031. this.buf.push(tagName);
  40032. var elAttrs = element.attributes;
  40033. for (var i = 0; i < elAttrs.length; i++) {
  40034. var elAttr = elAttrs.item(i);
  40035. var attrName = elAttr.name;
  40036. var lower = attrName.toLowerCase();
  40037. if (!VALID_ATTRS.hasOwnProperty(lower)) {
  40038. this.sanitizedSomething = true;
  40039. continue;
  40040. }
  40041. var value = elAttr.value;
  40042. // TODO(martinprobst): Special case image URIs for data:image/...
  40043. if (URI_ATTRS[lower])
  40044. value = _sanitizeUrl(value);
  40045. if (SRCSET_ATTRS[lower])
  40046. value = sanitizeSrcset(value);
  40047. this.buf.push(' ', attrName, '="', encodeEntities(value), '"');
  40048. }
  40049. this.buf.push('>');
  40050. };
  40051. SanitizingHtmlSerializer.prototype.endElement = function (current) {
  40052. var tagName = current.nodeName.toLowerCase();
  40053. if (VALID_ELEMENTS.hasOwnProperty(tagName) && !VOID_ELEMENTS.hasOwnProperty(tagName)) {
  40054. this.buf.push('</');
  40055. this.buf.push(tagName);
  40056. this.buf.push('>');
  40057. }
  40058. };
  40059. SanitizingHtmlSerializer.prototype.chars = function (chars) { this.buf.push(encodeEntities(chars)); };
  40060. SanitizingHtmlSerializer.prototype.checkClobberedElement = function (node, nextNode) {
  40061. if (nextNode &&
  40062. (node.compareDocumentPosition(nextNode) &
  40063. Node.DOCUMENT_POSITION_CONTAINED_BY) === Node.DOCUMENT_POSITION_CONTAINED_BY) {
  40064. throw new Error("Failed to sanitize html because the element is clobbered: " + node.outerHTML);
  40065. }
  40066. return nextNode;
  40067. };
  40068. return SanitizingHtmlSerializer;
  40069. }());
  40070. // Regular Expressions for parsing tags and attributes
  40071. var SURROGATE_PAIR_REGEXP = /[\uD800-\uDBFF][\uDC00-\uDFFF]/g;
  40072. // ! to ~ is the ASCII range.
  40073. var NON_ALPHANUMERIC_REGEXP = /([^\#-~ |!])/g;
  40074. /**
  40075. * Escapes all potentially dangerous characters, so that the
  40076. * resulting string can be safely inserted into attribute or
  40077. * element text.
  40078. * @param value
  40079. */
  40080. function encodeEntities(value) {
  40081. return value.replace(/&/g, '&amp;')
  40082. .replace(SURROGATE_PAIR_REGEXP, function (match) {
  40083. var hi = match.charCodeAt(0);
  40084. var low = match.charCodeAt(1);
  40085. return '&#' + (((hi - 0xD800) * 0x400) + (low - 0xDC00) + 0x10000) + ';';
  40086. })
  40087. .replace(NON_ALPHANUMERIC_REGEXP, function (match) { return '&#' + match.charCodeAt(0) + ';'; })
  40088. .replace(/</g, '&lt;')
  40089. .replace(/>/g, '&gt;');
  40090. }
  40091. var inertBodyHelper;
  40092. /**
  40093. * Sanitizes the given unsafe, untrusted HTML fragment, and returns HTML text that is safe to add to
  40094. * the DOM in a browser environment.
  40095. */
  40096. function _sanitizeHtml(defaultDoc, unsafeHtmlInput) {
  40097. var inertBodyElement = null;
  40098. try {
  40099. inertBodyHelper = inertBodyHelper || new InertBodyHelper(defaultDoc);
  40100. // Make sure unsafeHtml is actually a string (TypeScript types are not enforced at runtime).
  40101. var unsafeHtml = unsafeHtmlInput ? String(unsafeHtmlInput) : '';
  40102. inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
  40103. // mXSS protection. Repeatedly parse the document to make sure it stabilizes, so that a browser
  40104. // trying to auto-correct incorrect HTML cannot cause formerly inert HTML to become dangerous.
  40105. var mXSSAttempts = 5;
  40106. var parsedHtml = unsafeHtml;
  40107. do {
  40108. if (mXSSAttempts === 0) {
  40109. throw new Error('Failed to sanitize html because the input is unstable');
  40110. }
  40111. mXSSAttempts--;
  40112. unsafeHtml = parsedHtml;
  40113. parsedHtml = inertBodyElement.innerHTML;
  40114. inertBodyElement = inertBodyHelper.getInertBodyElement(unsafeHtml);
  40115. } while (unsafeHtml !== parsedHtml);
  40116. var sanitizer = new SanitizingHtmlSerializer();
  40117. var safeHtml = sanitizer.sanitizeChildren(getTemplateContent(inertBodyElement) || inertBodyElement);
  40118. if (isDevMode() && sanitizer.sanitizedSomething) {
  40119. console.warn('WARNING: sanitizing HTML stripped some content (see http://g.co/ng/security#xss).');
  40120. }
  40121. return safeHtml;
  40122. }
  40123. finally {
  40124. // In case anything goes wrong, clear out inertElement to reset the entire DOM structure.
  40125. if (inertBodyElement) {
  40126. var parent_1 = getTemplateContent(inertBodyElement) || inertBodyElement;
  40127. while (parent_1.firstChild) {
  40128. parent_1.removeChild(parent_1.firstChild);
  40129. }
  40130. }
  40131. }
  40132. }
  40133. function getTemplateContent(el) {
  40134. return 'content' in el /** Microsoft/TypeScript#21517 */ && isTemplateElement(el) ?
  40135. el.content :
  40136. null;
  40137. }
  40138. function isTemplateElement(el) {
  40139. return el.nodeType === Node.ELEMENT_NODE && el.nodeName === 'TEMPLATE';
  40140. }
  40141. /**
  40142. * @license
  40143. * Copyright Google Inc. All Rights Reserved.
  40144. *
  40145. * Use of this source code is governed by an MIT-style license that can be
  40146. * found in the LICENSE file at https://angular.io/license
  40147. */
  40148. /**
  40149. * Regular expression for safe style values.
  40150. *
  40151. * Quotes (" and ') are allowed, but a check must be done elsewhere to ensure they're balanced.
  40152. *
  40153. * ',' allows multiple values to be assigned to the same property (e.g. background-attachment or
  40154. * font-family) and hence could allow multiple values to get injected, but that should pose no risk
  40155. * of XSS.
  40156. *
  40157. * The function expression checks only for XSS safety, not for CSS validity.
  40158. *
  40159. * This regular expression was taken from the Closure sanitization library, and augmented for
  40160. * transformation values.
  40161. */
  40162. var VALUES = '[-,."\'%_!# a-zA-Z0-9]+';
  40163. var TRANSFORMATION_FNS = '(?:matrix|translate|scale|rotate|skew|perspective)(?:X|Y|3d)?';
  40164. var COLOR_FNS = '(?:rgb|hsl)a?';
  40165. var GRADIENTS = '(?:repeating-)?(?:linear|radial)-gradient';
  40166. var CSS3_FNS = '(?:calc|attr)';
  40167. var FN_ARGS = '\\([-0-9.%, #a-zA-Z]+\\)';
  40168. var SAFE_STYLE_VALUE = new RegExp("^(" + VALUES + "|" +
  40169. ("(?:" + TRANSFORMATION_FNS + "|" + COLOR_FNS + "|" + GRADIENTS + "|" + CSS3_FNS + ")") +
  40170. (FN_ARGS + ")$"), 'g');
  40171. /**
  40172. * Matches a `url(...)` value with an arbitrary argument as long as it does
  40173. * not contain parentheses.
  40174. *
  40175. * The URL value still needs to be sanitized separately.
  40176. *
  40177. * `url(...)` values are a very common use case, e.g. for `background-image`. With carefully crafted
  40178. * CSS style rules, it is possible to construct an information leak with `url` values in CSS, e.g.
  40179. * by observing whether scroll bars are displayed, or character ranges used by a font face
  40180. * definition.
  40181. *
  40182. * Angular only allows binding CSS values (as opposed to entire CSS rules), so it is unlikely that
  40183. * binding a URL value without further cooperation from the page will cause an information leak, and
  40184. * if so, it is just a leak, not a full blown XSS vulnerability.
  40185. *
  40186. * Given the common use case, low likelihood of attack vector, and low impact of an attack, this
  40187. * code is permissive and allows URLs that sanitize otherwise.
  40188. */
  40189. var URL_RE = /^url\(([^)]+)\)$/;
  40190. /**
  40191. * Checks that quotes (" and ') are properly balanced inside a string. Assumes
  40192. * that neither escape (\) nor any other character that could result in
  40193. * breaking out of a string parsing context are allowed;
  40194. * see http://www.w3.org/TR/css3-syntax/#string-token-diagram.
  40195. *
  40196. * This code was taken from the Closure sanitization library.
  40197. */
  40198. function hasBalancedQuotes(value) {
  40199. var outsideSingle = true;
  40200. var outsideDouble = true;
  40201. for (var i = 0; i < value.length; i++) {
  40202. var c = value.charAt(i);
  40203. if (c === '\'' && outsideDouble) {
  40204. outsideSingle = !outsideSingle;
  40205. }
  40206. else if (c === '"' && outsideSingle) {
  40207. outsideDouble = !outsideDouble;
  40208. }
  40209. }
  40210. return outsideSingle && outsideDouble;
  40211. }
  40212. /**
  40213. * Sanitizes the given untrusted CSS style property value (i.e. not an entire object, just a single
  40214. * value) and returns a value that is safe to use in a browser environment.
  40215. */
  40216. function _sanitizeStyle(value) {
  40217. value = String(value).trim(); // Make sure it's actually a string.
  40218. if (!value)
  40219. return '';
  40220. // Single url(...) values are supported, but only for URLs that sanitize cleanly. See above for
  40221. // reasoning behind this.
  40222. var urlMatch = value.match(URL_RE);
  40223. if ((urlMatch && _sanitizeUrl(urlMatch[1]) === urlMatch[1]) ||
  40224. value.match(SAFE_STYLE_VALUE) && hasBalancedQuotes(value)) {
  40225. return value; // Safe style values.
  40226. }
  40227. if (isDevMode()) {
  40228. console.warn("WARNING: sanitizing unsafe style value " + value + " (see http://g.co/ng/security#xss).");
  40229. }
  40230. return 'unsafe';
  40231. }
  40232. /**
  40233. * @license
  40234. * Copyright Google Inc. All Rights Reserved.
  40235. *
  40236. * Use of this source code is governed by an MIT-style license that can be
  40237. * found in the LICENSE file at https://angular.io/license
  40238. */
  40239. /**
  40240. * A SecurityContext marks a location that has dangerous security implications, e.g. a DOM property
  40241. * like `innerHTML` that could cause Cross Site Scripting (XSS) security bugs when improperly
  40242. * handled.
  40243. *
  40244. * See DomSanitizer for more details on security in Angular applications.
  40245. *
  40246. *
  40247. */
  40248. var SecurityContext;
  40249. (function (SecurityContext) {
  40250. SecurityContext[SecurityContext["NONE"] = 0] = "NONE";
  40251. SecurityContext[SecurityContext["HTML"] = 1] = "HTML";
  40252. SecurityContext[SecurityContext["STYLE"] = 2] = "STYLE";
  40253. SecurityContext[SecurityContext["SCRIPT"] = 3] = "SCRIPT";
  40254. SecurityContext[SecurityContext["URL"] = 4] = "URL";
  40255. SecurityContext[SecurityContext["RESOURCE_URL"] = 5] = "RESOURCE_URL";
  40256. })(SecurityContext || (SecurityContext = {}));
  40257. /**
  40258. * Sanitizer is used by the views to sanitize potentially dangerous values.
  40259. *
  40260. *
  40261. */
  40262. var Sanitizer = /** @class */ (function () {
  40263. function Sanitizer() {
  40264. }
  40265. return Sanitizer;
  40266. }());
  40267. /**
  40268. * @license
  40269. * Copyright Google Inc. All Rights Reserved.
  40270. *
  40271. * Use of this source code is governed by an MIT-style license that can be
  40272. * found in the LICENSE file at https://angular.io/license
  40273. */
  40274. // Called before each cycle of a view's check to detect whether this is in the
  40275. // initState for which we need to call ngOnInit, ngAfterContentInit or ngAfterViewInit
  40276. // lifecycle methods. Returns true if this check cycle should call lifecycle
  40277. // methods.
  40278. function shiftInitState(view, priorInitState, newInitState) {
  40279. // Only update the InitState if we are currently in the prior state.
  40280. // For example, only move into CallingInit if we are in BeforeInit. Only
  40281. // move into CallingContentInit if we are in CallingInit. Normally this will
  40282. // always be true because of how checkCycle is called in checkAndUpdateView.
  40283. // However, if checkAndUpdateView is called recursively or if an exception is
  40284. // thrown while checkAndUpdateView is running, checkAndUpdateView starts over
  40285. // from the beginning. This ensures the state is monotonically increasing,
  40286. // terminating in the AfterInit state, which ensures the Init methods are called
  40287. // at least once and only once.
  40288. var state = view.state;
  40289. var initState = state & 1792 /* InitState_Mask */;
  40290. if (initState === priorInitState) {
  40291. view.state = (state & ~1792 /* InitState_Mask */) | newInitState;
  40292. view.initIndex = -1;
  40293. return true;
  40294. }
  40295. return initState === newInitState;
  40296. }
  40297. // Returns true if the lifecycle init method should be called for the node with
  40298. // the given init index.
  40299. function shouldCallLifecycleInitHook(view, initState, index) {
  40300. if ((view.state & 1792 /* InitState_Mask */) === initState && view.initIndex <= index) {
  40301. view.initIndex = index + 1;
  40302. return true;
  40303. }
  40304. return false;
  40305. }
  40306. /**
  40307. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  40308. */
  40309. function asTextData(view, index) {
  40310. return view.nodes[index];
  40311. }
  40312. /**
  40313. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  40314. */
  40315. function asElementData(view, index) {
  40316. return view.nodes[index];
  40317. }
  40318. /**
  40319. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  40320. */
  40321. function asProviderData(view, index) {
  40322. return view.nodes[index];
  40323. }
  40324. /**
  40325. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  40326. */
  40327. function asPureExpressionData(view, index) {
  40328. return view.nodes[index];
  40329. }
  40330. /**
  40331. * Accessor for view.nodes, enforcing that every usage site stays monomorphic.
  40332. */
  40333. function asQueryList(view, index) {
  40334. return view.nodes[index];
  40335. }
  40336. var DebugContext = /** @class */ (function () {
  40337. function DebugContext() {
  40338. }
  40339. return DebugContext;
  40340. }());
  40341. /**
  40342. * This object is used to prevent cycles in the source files and to have a place where
  40343. * debug mode can hook it. It is lazily filled when `isDevMode` is known.
  40344. */
  40345. var Services = {
  40346. setCurrentNode: undefined,
  40347. createRootView: undefined,
  40348. createEmbeddedView: undefined,
  40349. createComponentView: undefined,
  40350. createNgModuleRef: undefined,
  40351. overrideProvider: undefined,
  40352. overrideComponentView: undefined,
  40353. clearOverrides: undefined,
  40354. checkAndUpdateView: undefined,
  40355. checkNoChangesView: undefined,
  40356. destroyView: undefined,
  40357. resolveDep: undefined,
  40358. createDebugContext: undefined,
  40359. handleEvent: undefined,
  40360. updateDirectives: undefined,
  40361. updateRenderer: undefined,
  40362. dirtyParentQueries: undefined,
  40363. };
  40364. /**
  40365. * @license
  40366. * Copyright Google Inc. All Rights Reserved.
  40367. *
  40368. * Use of this source code is governed by an MIT-style license that can be
  40369. * found in the LICENSE file at https://angular.io/license
  40370. */
  40371. function expressionChangedAfterItHasBeenCheckedError(context, oldValue, currValue, isFirstCheck) {
  40372. var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
  40373. if (isFirstCheck) {
  40374. msg +=
  40375. " It seems like the view has been created after its parent and its children have been dirty checked." +
  40376. " Has it been created in a change detection hook ?";
  40377. }
  40378. return viewDebugError(msg, context);
  40379. }
  40380. function viewWrappedDebugError(err, context) {
  40381. if (!(err instanceof Error)) {
  40382. // errors that are not Error instances don't have a stack,
  40383. // so it is ok to wrap them into a new Error object...
  40384. err = new Error(err.toString());
  40385. }
  40386. _addDebugContext(err, context);
  40387. return err;
  40388. }
  40389. function viewDebugError(msg, context) {
  40390. var err = new Error(msg);
  40391. _addDebugContext(err, context);
  40392. return err;
  40393. }
  40394. function _addDebugContext(err, context) {
  40395. err[ERROR_DEBUG_CONTEXT] = context;
  40396. err[ERROR_LOGGER] = context.logError.bind(context);
  40397. }
  40398. function isViewDebugError(err) {
  40399. return !!getDebugContext(err);
  40400. }
  40401. function viewDestroyedError(action) {
  40402. return new Error("ViewDestroyedError: Attempt to use a destroyed view: " + action);
  40403. }
  40404. /**
  40405. * @license
  40406. * Copyright Google Inc. All Rights Reserved.
  40407. *
  40408. * Use of this source code is governed by an MIT-style license that can be
  40409. * found in the LICENSE file at https://angular.io/license
  40410. */
  40411. var NOOP = function () { };
  40412. var _tokenKeyCache = new Map();
  40413. function tokenKey(token) {
  40414. var key = _tokenKeyCache.get(token);
  40415. if (!key) {
  40416. key = stringify(token) + '_' + _tokenKeyCache.size;
  40417. _tokenKeyCache.set(token, key);
  40418. }
  40419. return key;
  40420. }
  40421. function unwrapValue(view, nodeIdx, bindingIdx, value) {
  40422. if (WrappedValue.isWrapped(value)) {
  40423. value = WrappedValue.unwrap(value);
  40424. var globalBindingIdx = view.def.nodes[nodeIdx].bindingIndex + bindingIdx;
  40425. var oldValue = WrappedValue.unwrap(view.oldValues[globalBindingIdx]);
  40426. view.oldValues[globalBindingIdx] = new WrappedValue(oldValue);
  40427. }
  40428. return value;
  40429. }
  40430. var UNDEFINED_RENDERER_TYPE_ID = '$$undefined';
  40431. var EMPTY_RENDERER_TYPE_ID = '$$empty';
  40432. // Attention: this function is called as top level function.
  40433. // Putting any logic in here will destroy closure tree shaking!
  40434. function createRendererType2(values) {
  40435. return {
  40436. id: UNDEFINED_RENDERER_TYPE_ID,
  40437. styles: values.styles,
  40438. encapsulation: values.encapsulation,
  40439. data: values.data
  40440. };
  40441. }
  40442. var _renderCompCount = 0;
  40443. function resolveRendererType2(type) {
  40444. if (type && type.id === UNDEFINED_RENDERER_TYPE_ID) {
  40445. // first time we see this RendererType2. Initialize it...
  40446. var isFilled = ((type.encapsulation != null && type.encapsulation !== ViewEncapsulation.None) ||
  40447. type.styles.length || Object.keys(type.data).length);
  40448. if (isFilled) {
  40449. type.id = "c" + _renderCompCount++;
  40450. }
  40451. else {
  40452. type.id = EMPTY_RENDERER_TYPE_ID;
  40453. }
  40454. }
  40455. if (type && type.id === EMPTY_RENDERER_TYPE_ID) {
  40456. type = null;
  40457. }
  40458. return type || null;
  40459. }
  40460. function checkBinding(view, def, bindingIdx, value) {
  40461. var oldValues = view.oldValues;
  40462. if ((view.state & 2 /* FirstCheck */) ||
  40463. !looseIdentical(oldValues[def.bindingIndex + bindingIdx], value)) {
  40464. return true;
  40465. }
  40466. return false;
  40467. }
  40468. function checkAndUpdateBinding(view, def, bindingIdx, value) {
  40469. if (checkBinding(view, def, bindingIdx, value)) {
  40470. view.oldValues[def.bindingIndex + bindingIdx] = value;
  40471. return true;
  40472. }
  40473. return false;
  40474. }
  40475. function checkBindingNoChanges(view, def, bindingIdx, value) {
  40476. var oldValue = view.oldValues[def.bindingIndex + bindingIdx];
  40477. if ((view.state & 1 /* BeforeFirstCheck */) || !devModeEqual(oldValue, value)) {
  40478. var bindingName = def.bindings[bindingIdx].name;
  40479. throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, def.nodeIndex), bindingName + ": " + oldValue, bindingName + ": " + value, (view.state & 1 /* BeforeFirstCheck */) !== 0);
  40480. }
  40481. }
  40482. function markParentViewsForCheck(view) {
  40483. var currView = view;
  40484. while (currView) {
  40485. if (currView.def.flags & 2 /* OnPush */) {
  40486. currView.state |= 8 /* ChecksEnabled */;
  40487. }
  40488. currView = currView.viewContainerParent || currView.parent;
  40489. }
  40490. }
  40491. function markParentViewsForCheckProjectedViews(view, endView) {
  40492. var currView = view;
  40493. while (currView && currView !== endView) {
  40494. currView.state |= 64 /* CheckProjectedViews */;
  40495. currView = currView.viewContainerParent || currView.parent;
  40496. }
  40497. }
  40498. function dispatchEvent(view, nodeIndex, eventName, event) {
  40499. try {
  40500. var nodeDef = view.def.nodes[nodeIndex];
  40501. var startView = nodeDef.flags & 33554432 /* ComponentView */ ?
  40502. asElementData(view, nodeIndex).componentView :
  40503. view;
  40504. markParentViewsForCheck(startView);
  40505. return Services.handleEvent(view, nodeIndex, eventName, event);
  40506. }
  40507. catch (e) {
  40508. // Attention: Don't rethrow, as it would cancel Observable subscriptions!
  40509. view.root.errorHandler.handleError(e);
  40510. }
  40511. }
  40512. function declaredViewContainer(view) {
  40513. if (view.parent) {
  40514. var parentView = view.parent;
  40515. return asElementData(parentView, view.parentNodeDef.nodeIndex);
  40516. }
  40517. return null;
  40518. }
  40519. /**
  40520. * for component views, this is the host element.
  40521. * for embedded views, this is the index of the parent node
  40522. * that contains the view container.
  40523. */
  40524. function viewParentEl(view) {
  40525. var parentView = view.parent;
  40526. if (parentView) {
  40527. return view.parentNodeDef.parent;
  40528. }
  40529. else {
  40530. return null;
  40531. }
  40532. }
  40533. function renderNode(view, def) {
  40534. switch (def.flags & 201347067 /* Types */) {
  40535. case 1 /* TypeElement */:
  40536. return asElementData(view, def.nodeIndex).renderElement;
  40537. case 2 /* TypeText */:
  40538. return asTextData(view, def.nodeIndex).renderText;
  40539. }
  40540. }
  40541. function elementEventFullName(target, name) {
  40542. return target ? target + ":" + name : name;
  40543. }
  40544. function isComponentView(view) {
  40545. return !!view.parent && !!(view.parentNodeDef.flags & 32768 /* Component */);
  40546. }
  40547. function isEmbeddedView(view) {
  40548. return !!view.parent && !(view.parentNodeDef.flags & 32768 /* Component */);
  40549. }
  40550. function filterQueryId(queryId) {
  40551. return 1 << (queryId % 32);
  40552. }
  40553. function splitMatchedQueriesDsl(matchedQueriesDsl) {
  40554. var matchedQueries = {};
  40555. var matchedQueryIds = 0;
  40556. var references = {};
  40557. if (matchedQueriesDsl) {
  40558. matchedQueriesDsl.forEach(function (_a) {
  40559. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), queryId = _b[0], valueType = _b[1];
  40560. if (typeof queryId === 'number') {
  40561. matchedQueries[queryId] = valueType;
  40562. matchedQueryIds |= filterQueryId(queryId);
  40563. }
  40564. else {
  40565. references[queryId] = valueType;
  40566. }
  40567. });
  40568. }
  40569. return { matchedQueries: matchedQueries, references: references, matchedQueryIds: matchedQueryIds };
  40570. }
  40571. function splitDepsDsl(deps, sourceName) {
  40572. return deps.map(function (value) {
  40573. var _a;
  40574. var token;
  40575. var flags;
  40576. if (Array.isArray(value)) {
  40577. _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(value, 2), flags = _a[0], token = _a[1];
  40578. }
  40579. else {
  40580. flags = 0 /* None */;
  40581. token = value;
  40582. }
  40583. if (token && (typeof token === 'function' || typeof token === 'object') && sourceName) {
  40584. Object.defineProperty(token, SOURCE, { value: sourceName, configurable: true });
  40585. }
  40586. return { flags: flags, token: token, tokenKey: tokenKey(token) };
  40587. });
  40588. }
  40589. function getParentRenderElement(view, renderHost, def) {
  40590. var renderParent = def.renderParent;
  40591. if (renderParent) {
  40592. if ((renderParent.flags & 1 /* TypeElement */) === 0 ||
  40593. (renderParent.flags & 33554432 /* ComponentView */) === 0 ||
  40594. (renderParent.element.componentRendererType &&
  40595. renderParent.element.componentRendererType.encapsulation ===
  40596. ViewEncapsulation.Native)) {
  40597. // only children of non components, or children of components with native encapsulation should
  40598. // be attached.
  40599. return asElementData(view, def.renderParent.nodeIndex).renderElement;
  40600. }
  40601. }
  40602. else {
  40603. return renderHost;
  40604. }
  40605. }
  40606. var DEFINITION_CACHE = new WeakMap();
  40607. function resolveDefinition(factory) {
  40608. var value = DEFINITION_CACHE.get(factory);
  40609. if (!value) {
  40610. value = factory(function () { return NOOP; });
  40611. value.factory = factory;
  40612. DEFINITION_CACHE.set(factory, value);
  40613. }
  40614. return value;
  40615. }
  40616. function rootRenderNodes(view) {
  40617. var renderNodes = [];
  40618. visitRootRenderNodes(view, 0 /* Collect */, undefined, undefined, renderNodes);
  40619. return renderNodes;
  40620. }
  40621. function visitRootRenderNodes(view, action, parentNode, nextSibling, target) {
  40622. // We need to re-compute the parent node in case the nodes have been moved around manually
  40623. if (action === 3 /* RemoveChild */) {
  40624. parentNode = view.renderer.parentNode(renderNode(view, view.def.lastRenderRootNode));
  40625. }
  40626. visitSiblingRenderNodes(view, action, 0, view.def.nodes.length - 1, parentNode, nextSibling, target);
  40627. }
  40628. function visitSiblingRenderNodes(view, action, startIndex, endIndex, parentNode, nextSibling, target) {
  40629. for (var i = startIndex; i <= endIndex; i++) {
  40630. var nodeDef = view.def.nodes[i];
  40631. if (nodeDef.flags & (1 /* TypeElement */ | 2 /* TypeText */ | 8 /* TypeNgContent */)) {
  40632. visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target);
  40633. }
  40634. // jump to next sibling
  40635. i += nodeDef.childCount;
  40636. }
  40637. }
  40638. function visitProjectedRenderNodes(view, ngContentIndex, action, parentNode, nextSibling, target) {
  40639. var compView = view;
  40640. while (compView && !isComponentView(compView)) {
  40641. compView = compView.parent;
  40642. }
  40643. var hostView = compView.parent;
  40644. var hostElDef = viewParentEl(compView);
  40645. var startIndex = hostElDef.nodeIndex + 1;
  40646. var endIndex = hostElDef.nodeIndex + hostElDef.childCount;
  40647. for (var i = startIndex; i <= endIndex; i++) {
  40648. var nodeDef = hostView.def.nodes[i];
  40649. if (nodeDef.ngContentIndex === ngContentIndex) {
  40650. visitRenderNode(hostView, nodeDef, action, parentNode, nextSibling, target);
  40651. }
  40652. // jump to next sibling
  40653. i += nodeDef.childCount;
  40654. }
  40655. if (!hostView.parent) {
  40656. // a root view
  40657. var projectedNodes = view.root.projectableNodes[ngContentIndex];
  40658. if (projectedNodes) {
  40659. for (var i = 0; i < projectedNodes.length; i++) {
  40660. execRenderNodeAction(view, projectedNodes[i], action, parentNode, nextSibling, target);
  40661. }
  40662. }
  40663. }
  40664. }
  40665. function visitRenderNode(view, nodeDef, action, parentNode, nextSibling, target) {
  40666. if (nodeDef.flags & 8 /* TypeNgContent */) {
  40667. visitProjectedRenderNodes(view, nodeDef.ngContent.index, action, parentNode, nextSibling, target);
  40668. }
  40669. else {
  40670. var rn = renderNode(view, nodeDef);
  40671. if (action === 3 /* RemoveChild */ && (nodeDef.flags & 33554432 /* ComponentView */) &&
  40672. (nodeDef.bindingFlags & 48 /* CatSyntheticProperty */)) {
  40673. // Note: we might need to do both actions.
  40674. if (nodeDef.bindingFlags & (16 /* SyntheticProperty */)) {
  40675. execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
  40676. }
  40677. if (nodeDef.bindingFlags & (32 /* SyntheticHostProperty */)) {
  40678. var compView = asElementData(view, nodeDef.nodeIndex).componentView;
  40679. execRenderNodeAction(compView, rn, action, parentNode, nextSibling, target);
  40680. }
  40681. }
  40682. else {
  40683. execRenderNodeAction(view, rn, action, parentNode, nextSibling, target);
  40684. }
  40685. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  40686. var embeddedViews = asElementData(view, nodeDef.nodeIndex).viewContainer._embeddedViews;
  40687. for (var k = 0; k < embeddedViews.length; k++) {
  40688. visitRootRenderNodes(embeddedViews[k], action, parentNode, nextSibling, target);
  40689. }
  40690. }
  40691. if (nodeDef.flags & 1 /* TypeElement */ && !nodeDef.element.name) {
  40692. visitSiblingRenderNodes(view, action, nodeDef.nodeIndex + 1, nodeDef.nodeIndex + nodeDef.childCount, parentNode, nextSibling, target);
  40693. }
  40694. }
  40695. }
  40696. function execRenderNodeAction(view, renderNode, action, parentNode, nextSibling, target) {
  40697. var renderer = view.renderer;
  40698. switch (action) {
  40699. case 1 /* AppendChild */:
  40700. renderer.appendChild(parentNode, renderNode);
  40701. break;
  40702. case 2 /* InsertBefore */:
  40703. renderer.insertBefore(parentNode, renderNode, nextSibling);
  40704. break;
  40705. case 3 /* RemoveChild */:
  40706. renderer.removeChild(parentNode, renderNode);
  40707. break;
  40708. case 0 /* Collect */:
  40709. target.push(renderNode);
  40710. break;
  40711. }
  40712. }
  40713. var NS_PREFIX_RE = /^:([^:]+):(.+)$/;
  40714. function splitNamespace(name) {
  40715. if (name[0] === ':') {
  40716. var match = name.match(NS_PREFIX_RE);
  40717. return [match[1], match[2]];
  40718. }
  40719. return ['', name];
  40720. }
  40721. function calcBindingFlags(bindings) {
  40722. var flags = 0;
  40723. for (var i = 0; i < bindings.length; i++) {
  40724. flags |= bindings[i].flags;
  40725. }
  40726. return flags;
  40727. }
  40728. function interpolate(valueCount, constAndInterp) {
  40729. var result = '';
  40730. for (var i = 0; i < valueCount * 2; i = i + 2) {
  40731. result = result + constAndInterp[i] + _toStringWithNull(constAndInterp[i + 1]);
  40732. }
  40733. return result + constAndInterp[valueCount * 2];
  40734. }
  40735. function inlineInterpolate(valueCount, c0, a1, c1, a2, c2, a3, c3, a4, c4, a5, c5, a6, c6, a7, c7, a8, c8, a9, c9) {
  40736. switch (valueCount) {
  40737. case 1:
  40738. return c0 + _toStringWithNull(a1) + c1;
  40739. case 2:
  40740. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2;
  40741. case 3:
  40742. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40743. c3;
  40744. case 4:
  40745. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40746. c3 + _toStringWithNull(a4) + c4;
  40747. case 5:
  40748. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40749. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5;
  40750. case 6:
  40751. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40752. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) + c6;
  40753. case 7:
  40754. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40755. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
  40756. c6 + _toStringWithNull(a7) + c7;
  40757. case 8:
  40758. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40759. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
  40760. c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8;
  40761. case 9:
  40762. return c0 + _toStringWithNull(a1) + c1 + _toStringWithNull(a2) + c2 + _toStringWithNull(a3) +
  40763. c3 + _toStringWithNull(a4) + c4 + _toStringWithNull(a5) + c5 + _toStringWithNull(a6) +
  40764. c6 + _toStringWithNull(a7) + c7 + _toStringWithNull(a8) + c8 + _toStringWithNull(a9) + c9;
  40765. default:
  40766. throw new Error("Does not support more than 9 expressions");
  40767. }
  40768. }
  40769. function _toStringWithNull(v) {
  40770. return v != null ? v.toString() : '';
  40771. }
  40772. var EMPTY_ARRAY$2 = [];
  40773. var EMPTY_MAP = {};
  40774. /**
  40775. * @license
  40776. * Copyright Google Inc. All Rights Reserved.
  40777. *
  40778. * Use of this source code is governed by an MIT-style license that can be
  40779. * found in the LICENSE file at https://angular.io/license
  40780. */
  40781. function anchorDef(flags, matchedQueriesDsl, ngContentIndex, childCount, handleEvent, templateFactory) {
  40782. flags |= 1 /* TypeElement */;
  40783. var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
  40784. var template = templateFactory ? resolveDefinition(templateFactory) : null;
  40785. return {
  40786. // will bet set by the view definition
  40787. nodeIndex: -1,
  40788. parent: null,
  40789. renderParent: null,
  40790. bindingIndex: -1,
  40791. outputIndex: -1,
  40792. // regular values
  40793. flags: flags,
  40794. checkIndex: -1,
  40795. childFlags: 0,
  40796. directChildFlags: 0,
  40797. childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
  40798. bindings: [],
  40799. bindingFlags: 0,
  40800. outputs: [],
  40801. element: {
  40802. ns: null,
  40803. name: null,
  40804. attrs: null, template: template,
  40805. componentProvider: null,
  40806. componentView: null,
  40807. componentRendererType: null,
  40808. publicProviders: null,
  40809. allProviders: null,
  40810. handleEvent: handleEvent || NOOP
  40811. },
  40812. provider: null,
  40813. text: null,
  40814. query: null,
  40815. ngContent: null
  40816. };
  40817. }
  40818. function elementDef(checkIndex, flags, matchedQueriesDsl, ngContentIndex, childCount, namespaceAndName, fixedAttrs, bindings, outputs, handleEvent, componentView, componentRendererType) {
  40819. if (fixedAttrs === void 0) { fixedAttrs = []; }
  40820. var _a;
  40821. if (!handleEvent) {
  40822. handleEvent = NOOP;
  40823. }
  40824. var _b = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _b.matchedQueries, references = _b.references, matchedQueryIds = _b.matchedQueryIds;
  40825. var ns = null;
  40826. var name = null;
  40827. if (namespaceAndName) {
  40828. _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
  40829. }
  40830. bindings = bindings || [];
  40831. var bindingDefs = new Array(bindings.length);
  40832. for (var i = 0; i < bindings.length; i++) {
  40833. var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(bindings[i], 3), bindingFlags = _c[0], namespaceAndName_1 = _c[1], suffixOrSecurityContext = _c[2];
  40834. var _d = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitNamespace(namespaceAndName_1), 2), ns_1 = _d[0], name_1 = _d[1];
  40835. var securityContext = undefined;
  40836. var suffix = undefined;
  40837. switch (bindingFlags & 15 /* Types */) {
  40838. case 4 /* TypeElementStyle */:
  40839. suffix = suffixOrSecurityContext;
  40840. break;
  40841. case 1 /* TypeElementAttribute */:
  40842. case 8 /* TypeProperty */:
  40843. securityContext = suffixOrSecurityContext;
  40844. break;
  40845. }
  40846. bindingDefs[i] =
  40847. { flags: bindingFlags, ns: ns_1, name: name_1, nonMinifiedName: name_1, securityContext: securityContext, suffix: suffix };
  40848. }
  40849. outputs = outputs || [];
  40850. var outputDefs = new Array(outputs.length);
  40851. for (var i = 0; i < outputs.length; i++) {
  40852. var _e = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(outputs[i], 2), target = _e[0], eventName = _e[1];
  40853. outputDefs[i] = {
  40854. type: 0 /* ElementOutput */,
  40855. target: target, eventName: eventName,
  40856. propName: null
  40857. };
  40858. }
  40859. fixedAttrs = fixedAttrs || [];
  40860. var attrs = fixedAttrs.map(function (_a) {
  40861. var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(_a, 2), namespaceAndName = _b[0], value = _b[1];
  40862. var _c = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitNamespace(namespaceAndName), 2), ns = _c[0], name = _c[1];
  40863. return [ns, name, value];
  40864. });
  40865. componentRendererType = resolveRendererType2(componentRendererType);
  40866. if (componentView) {
  40867. flags |= 33554432 /* ComponentView */;
  40868. }
  40869. flags |= 1 /* TypeElement */;
  40870. return {
  40871. // will bet set by the view definition
  40872. nodeIndex: -1,
  40873. parent: null,
  40874. renderParent: null,
  40875. bindingIndex: -1,
  40876. outputIndex: -1,
  40877. // regular values
  40878. checkIndex: checkIndex,
  40879. flags: flags,
  40880. childFlags: 0,
  40881. directChildFlags: 0,
  40882. childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references, ngContentIndex: ngContentIndex, childCount: childCount,
  40883. bindings: bindingDefs,
  40884. bindingFlags: calcBindingFlags(bindingDefs),
  40885. outputs: outputDefs,
  40886. element: {
  40887. ns: ns,
  40888. name: name,
  40889. attrs: attrs,
  40890. template: null,
  40891. // will bet set by the view definition
  40892. componentProvider: null,
  40893. componentView: componentView || null,
  40894. componentRendererType: componentRendererType,
  40895. publicProviders: null,
  40896. allProviders: null,
  40897. handleEvent: handleEvent || NOOP,
  40898. },
  40899. provider: null,
  40900. text: null,
  40901. query: null,
  40902. ngContent: null
  40903. };
  40904. }
  40905. function createElement(view, renderHost, def) {
  40906. var elDef = def.element;
  40907. var rootSelectorOrNode = view.root.selectorOrNode;
  40908. var renderer = view.renderer;
  40909. var el;
  40910. if (view.parent || !rootSelectorOrNode) {
  40911. if (elDef.name) {
  40912. el = renderer.createElement(elDef.name, elDef.ns);
  40913. }
  40914. else {
  40915. el = renderer.createComment('');
  40916. }
  40917. var parentEl = getParentRenderElement(view, renderHost, def);
  40918. if (parentEl) {
  40919. renderer.appendChild(parentEl, el);
  40920. }
  40921. }
  40922. else {
  40923. el = renderer.selectRootElement(rootSelectorOrNode);
  40924. }
  40925. if (elDef.attrs) {
  40926. for (var i = 0; i < elDef.attrs.length; i++) {
  40927. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(elDef.attrs[i], 3), ns = _a[0], name_2 = _a[1], value = _a[2];
  40928. renderer.setAttribute(el, name_2, value, ns);
  40929. }
  40930. }
  40931. return el;
  40932. }
  40933. function listenToElementOutputs(view, compView, def, el) {
  40934. for (var i = 0; i < def.outputs.length; i++) {
  40935. var output = def.outputs[i];
  40936. var handleEventClosure = renderEventHandlerClosure(view, def.nodeIndex, elementEventFullName(output.target, output.eventName));
  40937. var listenTarget = output.target;
  40938. var listenerView = view;
  40939. if (output.target === 'component') {
  40940. listenTarget = null;
  40941. listenerView = compView;
  40942. }
  40943. var disposable = listenerView.renderer.listen(listenTarget || el, output.eventName, handleEventClosure);
  40944. view.disposables[def.outputIndex + i] = disposable;
  40945. }
  40946. }
  40947. function renderEventHandlerClosure(view, index, eventName) {
  40948. return function (event) { return dispatchEvent(view, index, eventName, event); };
  40949. }
  40950. function checkAndUpdateElementInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  40951. var bindLen = def.bindings.length;
  40952. var changed = false;
  40953. if (bindLen > 0 && checkAndUpdateElementValue(view, def, 0, v0))
  40954. changed = true;
  40955. if (bindLen > 1 && checkAndUpdateElementValue(view, def, 1, v1))
  40956. changed = true;
  40957. if (bindLen > 2 && checkAndUpdateElementValue(view, def, 2, v2))
  40958. changed = true;
  40959. if (bindLen > 3 && checkAndUpdateElementValue(view, def, 3, v3))
  40960. changed = true;
  40961. if (bindLen > 4 && checkAndUpdateElementValue(view, def, 4, v4))
  40962. changed = true;
  40963. if (bindLen > 5 && checkAndUpdateElementValue(view, def, 5, v5))
  40964. changed = true;
  40965. if (bindLen > 6 && checkAndUpdateElementValue(view, def, 6, v6))
  40966. changed = true;
  40967. if (bindLen > 7 && checkAndUpdateElementValue(view, def, 7, v7))
  40968. changed = true;
  40969. if (bindLen > 8 && checkAndUpdateElementValue(view, def, 8, v8))
  40970. changed = true;
  40971. if (bindLen > 9 && checkAndUpdateElementValue(view, def, 9, v9))
  40972. changed = true;
  40973. return changed;
  40974. }
  40975. function checkAndUpdateElementDynamic(view, def, values) {
  40976. var changed = false;
  40977. for (var i = 0; i < values.length; i++) {
  40978. if (checkAndUpdateElementValue(view, def, i, values[i]))
  40979. changed = true;
  40980. }
  40981. return changed;
  40982. }
  40983. function checkAndUpdateElementValue(view, def, bindingIdx, value) {
  40984. if (!checkAndUpdateBinding(view, def, bindingIdx, value)) {
  40985. return false;
  40986. }
  40987. var binding = def.bindings[bindingIdx];
  40988. var elData = asElementData(view, def.nodeIndex);
  40989. var renderNode$$1 = elData.renderElement;
  40990. var name = binding.name;
  40991. switch (binding.flags & 15 /* Types */) {
  40992. case 1 /* TypeElementAttribute */:
  40993. setElementAttribute(view, binding, renderNode$$1, binding.ns, name, value);
  40994. break;
  40995. case 2 /* TypeElementClass */:
  40996. setElementClass(view, renderNode$$1, name, value);
  40997. break;
  40998. case 4 /* TypeElementStyle */:
  40999. setElementStyle(view, binding, renderNode$$1, name, value);
  41000. break;
  41001. case 8 /* TypeProperty */:
  41002. var bindView = (def.flags & 33554432 /* ComponentView */ &&
  41003. binding.flags & 32 /* SyntheticHostProperty */) ?
  41004. elData.componentView :
  41005. view;
  41006. setElementProperty(bindView, binding, renderNode$$1, name, value);
  41007. break;
  41008. }
  41009. return true;
  41010. }
  41011. function setElementAttribute(view, binding, renderNode$$1, ns, name, value) {
  41012. var securityContext = binding.securityContext;
  41013. var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
  41014. renderValue = renderValue != null ? renderValue.toString() : null;
  41015. var renderer = view.renderer;
  41016. if (value != null) {
  41017. renderer.setAttribute(renderNode$$1, name, renderValue, ns);
  41018. }
  41019. else {
  41020. renderer.removeAttribute(renderNode$$1, name, ns);
  41021. }
  41022. }
  41023. function setElementClass(view, renderNode$$1, name, value) {
  41024. var renderer = view.renderer;
  41025. if (value) {
  41026. renderer.addClass(renderNode$$1, name);
  41027. }
  41028. else {
  41029. renderer.removeClass(renderNode$$1, name);
  41030. }
  41031. }
  41032. function setElementStyle(view, binding, renderNode$$1, name, value) {
  41033. var renderValue = view.root.sanitizer.sanitize(SecurityContext.STYLE, value);
  41034. if (renderValue != null) {
  41035. renderValue = renderValue.toString();
  41036. var unit = binding.suffix;
  41037. if (unit != null) {
  41038. renderValue = renderValue + unit;
  41039. }
  41040. }
  41041. else {
  41042. renderValue = null;
  41043. }
  41044. var renderer = view.renderer;
  41045. if (renderValue != null) {
  41046. renderer.setStyle(renderNode$$1, name, renderValue);
  41047. }
  41048. else {
  41049. renderer.removeStyle(renderNode$$1, name);
  41050. }
  41051. }
  41052. function setElementProperty(view, binding, renderNode$$1, name, value) {
  41053. var securityContext = binding.securityContext;
  41054. var renderValue = securityContext ? view.root.sanitizer.sanitize(securityContext, value) : value;
  41055. view.renderer.setProperty(renderNode$$1, name, renderValue);
  41056. }
  41057. /**
  41058. * @license
  41059. * Copyright Google Inc. All Rights Reserved.
  41060. *
  41061. * Use of this source code is governed by an MIT-style license that can be
  41062. * found in the LICENSE file at https://angular.io/license
  41063. */
  41064. var UNDEFINED_VALUE = new Object();
  41065. var InjectorRefTokenKey = tokenKey(Injector);
  41066. var INJECTORRefTokenKey = tokenKey(INJECTOR);
  41067. var NgModuleRefTokenKey = tokenKey(NgModuleRef);
  41068. function moduleProvideDef(flags, token, value, deps) {
  41069. // Need to resolve forwardRefs as e.g. for `useValue` we
  41070. // lowered the expression and then stopped evaluating it,
  41071. // i.e. also didn't unwrap it.
  41072. value = resolveForwardRef(value);
  41073. var depDefs = splitDepsDsl(deps, stringify(token));
  41074. return {
  41075. // will bet set by the module definition
  41076. index: -1,
  41077. deps: depDefs, flags: flags, token: token, value: value
  41078. };
  41079. }
  41080. function moduleDef(providers) {
  41081. var providersByKey = {};
  41082. var modules = [];
  41083. var isRoot = false;
  41084. for (var i = 0; i < providers.length; i++) {
  41085. var provider = providers[i];
  41086. if (provider.token === APP_ROOT && provider.value === true) {
  41087. isRoot = true;
  41088. }
  41089. if (provider.flags & 1073741824 /* TypeNgModule */) {
  41090. modules.push(provider.token);
  41091. }
  41092. provider.index = i;
  41093. providersByKey[tokenKey(provider.token)] = provider;
  41094. }
  41095. return {
  41096. // Will be filled later...
  41097. factory: null,
  41098. providersByKey: providersByKey,
  41099. providers: providers,
  41100. modules: modules,
  41101. isRoot: isRoot,
  41102. };
  41103. }
  41104. function initNgModule(data) {
  41105. var def = data._def;
  41106. var providers = data._providers = new Array(def.providers.length);
  41107. for (var i = 0; i < def.providers.length; i++) {
  41108. var provDef = def.providers[i];
  41109. if (!(provDef.flags & 4096 /* LazyProvider */)) {
  41110. // Make sure the provider has not been already initialized outside this loop.
  41111. if (providers[i] === undefined) {
  41112. providers[i] = _createProviderInstance(data, provDef);
  41113. }
  41114. }
  41115. }
  41116. }
  41117. function resolveNgModuleDep(data, depDef, notFoundValue) {
  41118. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  41119. var former = setCurrentInjector(data);
  41120. try {
  41121. if (depDef.flags & 8 /* Value */) {
  41122. return depDef.token;
  41123. }
  41124. if (depDef.flags & 2 /* Optional */) {
  41125. notFoundValue = null;
  41126. }
  41127. if (depDef.flags & 1 /* SkipSelf */) {
  41128. return data._parent.get(depDef.token, notFoundValue);
  41129. }
  41130. var tokenKey_1 = depDef.tokenKey;
  41131. switch (tokenKey_1) {
  41132. case InjectorRefTokenKey:
  41133. case INJECTORRefTokenKey:
  41134. case NgModuleRefTokenKey:
  41135. return data;
  41136. }
  41137. var providerDef = data._def.providersByKey[tokenKey_1];
  41138. if (providerDef) {
  41139. var providerInstance = data._providers[providerDef.index];
  41140. if (providerInstance === undefined) {
  41141. providerInstance = data._providers[providerDef.index] =
  41142. _createProviderInstance(data, providerDef);
  41143. }
  41144. return providerInstance === UNDEFINED_VALUE ? undefined : providerInstance;
  41145. }
  41146. else if (depDef.token.ngInjectableDef && targetsModule(data, depDef.token.ngInjectableDef)) {
  41147. var injectableDef = depDef.token.ngInjectableDef;
  41148. var index = data._providers.length;
  41149. data._def.providersByKey[depDef.tokenKey] = {
  41150. flags: 1024 /* TypeFactoryProvider */ | 4096 /* LazyProvider */,
  41151. value: injectableDef.factory,
  41152. deps: [], index: index,
  41153. token: depDef.token,
  41154. };
  41155. data._providers[index] = UNDEFINED_VALUE;
  41156. return (data._providers[index] =
  41157. _createProviderInstance(data, data._def.providersByKey[depDef.tokenKey]));
  41158. }
  41159. else if (depDef.flags & 4 /* Self */) {
  41160. return notFoundValue;
  41161. }
  41162. return data._parent.get(depDef.token, notFoundValue);
  41163. }
  41164. finally {
  41165. setCurrentInjector(former);
  41166. }
  41167. }
  41168. function moduleTransitivelyPresent(ngModule, scope) {
  41169. return ngModule._def.modules.indexOf(scope) > -1;
  41170. }
  41171. function targetsModule(ngModule, def) {
  41172. return def.providedIn != null && (moduleTransitivelyPresent(ngModule, def.providedIn) ||
  41173. def.providedIn === 'root' && ngModule._def.isRoot);
  41174. }
  41175. function _createProviderInstance(ngModule, providerDef) {
  41176. var injectable;
  41177. switch (providerDef.flags & 201347067 /* Types */) {
  41178. case 512 /* TypeClassProvider */:
  41179. injectable = _createClass(ngModule, providerDef.value, providerDef.deps);
  41180. break;
  41181. case 1024 /* TypeFactoryProvider */:
  41182. injectable = _callFactory(ngModule, providerDef.value, providerDef.deps);
  41183. break;
  41184. case 2048 /* TypeUseExistingProvider */:
  41185. injectable = resolveNgModuleDep(ngModule, providerDef.deps[0]);
  41186. break;
  41187. case 256 /* TypeValueProvider */:
  41188. injectable = providerDef.value;
  41189. break;
  41190. }
  41191. // The read of `ngOnDestroy` here is slightly expensive as it's megamorphic, so it should be
  41192. // avoided if possible. The sequence of checks here determines whether ngOnDestroy needs to be
  41193. // checked. It might not if the `injectable` isn't an object or if NodeFlags.OnDestroy is already
  41194. // set (ngOnDestroy was detected statically).
  41195. if (injectable !== UNDEFINED_VALUE && injectable != null && typeof injectable === 'object' &&
  41196. !(providerDef.flags & 131072 /* OnDestroy */) && typeof injectable.ngOnDestroy === 'function') {
  41197. providerDef.flags |= 131072 /* OnDestroy */;
  41198. }
  41199. return injectable === undefined ? UNDEFINED_VALUE : injectable;
  41200. }
  41201. function _createClass(ngModule, ctor, deps) {
  41202. var len = deps.length;
  41203. switch (len) {
  41204. case 0:
  41205. return new ctor();
  41206. case 1:
  41207. return new ctor(resolveNgModuleDep(ngModule, deps[0]));
  41208. case 2:
  41209. return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
  41210. case 3:
  41211. return new ctor(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
  41212. default:
  41213. var depValues = new Array(len);
  41214. for (var i = 0; i < len; i++) {
  41215. depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
  41216. }
  41217. return new (ctor.bind.apply(ctor, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], depValues)))();
  41218. }
  41219. }
  41220. function _callFactory(ngModule, factory, deps) {
  41221. var len = deps.length;
  41222. switch (len) {
  41223. case 0:
  41224. return factory();
  41225. case 1:
  41226. return factory(resolveNgModuleDep(ngModule, deps[0]));
  41227. case 2:
  41228. return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]));
  41229. case 3:
  41230. return factory(resolveNgModuleDep(ngModule, deps[0]), resolveNgModuleDep(ngModule, deps[1]), resolveNgModuleDep(ngModule, deps[2]));
  41231. default:
  41232. var depValues = Array(len);
  41233. for (var i = 0; i < len; i++) {
  41234. depValues[i] = resolveNgModuleDep(ngModule, deps[i]);
  41235. }
  41236. return factory.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(depValues));
  41237. }
  41238. }
  41239. function callNgModuleLifecycle(ngModule, lifecycles) {
  41240. var def = ngModule._def;
  41241. var destroyed = new Set();
  41242. for (var i = 0; i < def.providers.length; i++) {
  41243. var provDef = def.providers[i];
  41244. if (provDef.flags & 131072 /* OnDestroy */) {
  41245. var instance = ngModule._providers[i];
  41246. if (instance && instance !== UNDEFINED_VALUE) {
  41247. var onDestroy = instance.ngOnDestroy;
  41248. if (typeof onDestroy === 'function' && !destroyed.has(instance)) {
  41249. onDestroy.apply(instance);
  41250. destroyed.add(instance);
  41251. }
  41252. }
  41253. }
  41254. }
  41255. }
  41256. /**
  41257. * @license
  41258. * Copyright Google Inc. All Rights Reserved.
  41259. *
  41260. * Use of this source code is governed by an MIT-style license that can be
  41261. * found in the LICENSE file at https://angular.io/license
  41262. */
  41263. function attachEmbeddedView(parentView, elementData, viewIndex, view) {
  41264. var embeddedViews = elementData.viewContainer._embeddedViews;
  41265. if (viewIndex === null || viewIndex === undefined) {
  41266. viewIndex = embeddedViews.length;
  41267. }
  41268. view.viewContainerParent = parentView;
  41269. addToArray(embeddedViews, viewIndex, view);
  41270. attachProjectedView(elementData, view);
  41271. Services.dirtyParentQueries(view);
  41272. var prevView = viewIndex > 0 ? embeddedViews[viewIndex - 1] : null;
  41273. renderAttachEmbeddedView(elementData, prevView, view);
  41274. }
  41275. function attachProjectedView(vcElementData, view) {
  41276. var dvcElementData = declaredViewContainer(view);
  41277. if (!dvcElementData || dvcElementData === vcElementData ||
  41278. view.state & 16 /* IsProjectedView */) {
  41279. return;
  41280. }
  41281. // Note: For performance reasons, we
  41282. // - add a view to template._projectedViews only 1x throughout its lifetime,
  41283. // and remove it not until the view is destroyed.
  41284. // (hard, as when a parent view is attached/detached we would need to attach/detach all
  41285. // nested projected views as well, even across component boundaries).
  41286. // - don't track the insertion order of views in the projected views array
  41287. // (hard, as when the views of the same template are inserted different view containers)
  41288. view.state |= 16 /* IsProjectedView */;
  41289. var projectedViews = dvcElementData.template._projectedViews;
  41290. if (!projectedViews) {
  41291. projectedViews = dvcElementData.template._projectedViews = [];
  41292. }
  41293. projectedViews.push(view);
  41294. // Note: we are changing the NodeDef here as we cannot calculate
  41295. // the fact whether a template is used for projection during compilation.
  41296. markNodeAsProjectedTemplate(view.parent.def, view.parentNodeDef);
  41297. }
  41298. function markNodeAsProjectedTemplate(viewDef, nodeDef) {
  41299. if (nodeDef.flags & 4 /* ProjectedTemplate */) {
  41300. return;
  41301. }
  41302. viewDef.nodeFlags |= 4 /* ProjectedTemplate */;
  41303. nodeDef.flags |= 4 /* ProjectedTemplate */;
  41304. var parentNodeDef = nodeDef.parent;
  41305. while (parentNodeDef) {
  41306. parentNodeDef.childFlags |= 4 /* ProjectedTemplate */;
  41307. parentNodeDef = parentNodeDef.parent;
  41308. }
  41309. }
  41310. function detachEmbeddedView(elementData, viewIndex) {
  41311. var embeddedViews = elementData.viewContainer._embeddedViews;
  41312. if (viewIndex == null || viewIndex >= embeddedViews.length) {
  41313. viewIndex = embeddedViews.length - 1;
  41314. }
  41315. if (viewIndex < 0) {
  41316. return null;
  41317. }
  41318. var view = embeddedViews[viewIndex];
  41319. view.viewContainerParent = null;
  41320. removeFromArray(embeddedViews, viewIndex);
  41321. // See attachProjectedView for why we don't update projectedViews here.
  41322. Services.dirtyParentQueries(view);
  41323. renderDetachView(view);
  41324. return view;
  41325. }
  41326. function detachProjectedView(view) {
  41327. if (!(view.state & 16 /* IsProjectedView */)) {
  41328. return;
  41329. }
  41330. var dvcElementData = declaredViewContainer(view);
  41331. if (dvcElementData) {
  41332. var projectedViews = dvcElementData.template._projectedViews;
  41333. if (projectedViews) {
  41334. removeFromArray(projectedViews, projectedViews.indexOf(view));
  41335. Services.dirtyParentQueries(view);
  41336. }
  41337. }
  41338. }
  41339. function moveEmbeddedView(elementData, oldViewIndex, newViewIndex) {
  41340. var embeddedViews = elementData.viewContainer._embeddedViews;
  41341. var view = embeddedViews[oldViewIndex];
  41342. removeFromArray(embeddedViews, oldViewIndex);
  41343. if (newViewIndex == null) {
  41344. newViewIndex = embeddedViews.length;
  41345. }
  41346. addToArray(embeddedViews, newViewIndex, view);
  41347. // Note: Don't need to change projectedViews as the order in there
  41348. // as always invalid...
  41349. Services.dirtyParentQueries(view);
  41350. renderDetachView(view);
  41351. var prevView = newViewIndex > 0 ? embeddedViews[newViewIndex - 1] : null;
  41352. renderAttachEmbeddedView(elementData, prevView, view);
  41353. return view;
  41354. }
  41355. function renderAttachEmbeddedView(elementData, prevView, view) {
  41356. var prevRenderNode = prevView ? renderNode(prevView, prevView.def.lastRenderRootNode) :
  41357. elementData.renderElement;
  41358. var parentNode = view.renderer.parentNode(prevRenderNode);
  41359. var nextSibling = view.renderer.nextSibling(prevRenderNode);
  41360. // Note: We can't check if `nextSibling` is present, as on WebWorkers it will always be!
  41361. // However, browsers automatically do `appendChild` when there is no `nextSibling`.
  41362. visitRootRenderNodes(view, 2 /* InsertBefore */, parentNode, nextSibling, undefined);
  41363. }
  41364. function renderDetachView(view) {
  41365. visitRootRenderNodes(view, 3 /* RemoveChild */, null, null, undefined);
  41366. }
  41367. function addToArray(arr, index, value) {
  41368. // perf: array.push is faster than array.splice!
  41369. if (index >= arr.length) {
  41370. arr.push(value);
  41371. }
  41372. else {
  41373. arr.splice(index, 0, value);
  41374. }
  41375. }
  41376. function removeFromArray(arr, index) {
  41377. // perf: array.pop is faster than array.splice!
  41378. if (index >= arr.length - 1) {
  41379. arr.pop();
  41380. }
  41381. else {
  41382. arr.splice(index, 1);
  41383. }
  41384. }
  41385. /**
  41386. * @license
  41387. * Copyright Google Inc. All Rights Reserved.
  41388. *
  41389. * Use of this source code is governed by an MIT-style license that can be
  41390. * found in the LICENSE file at https://angular.io/license
  41391. */
  41392. var EMPTY_CONTEXT = new Object();
  41393. // Attention: this function is called as top level function.
  41394. // Putting any logic in here will destroy closure tree shaking!
  41395. function createComponentFactory(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors) {
  41396. return new ComponentFactory_(selector, componentType, viewDefFactory, inputs, outputs, ngContentSelectors);
  41397. }
  41398. function getComponentViewDefinitionFactory(componentFactory) {
  41399. return componentFactory.viewDefFactory;
  41400. }
  41401. var ComponentFactory_ = /** @class */ (function (_super) {
  41402. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentFactory_, _super);
  41403. function ComponentFactory_(selector, componentType, viewDefFactory, _inputs, _outputs, ngContentSelectors) {
  41404. var _this =
  41405. // Attention: this ctor is called as top level function.
  41406. // Putting any logic in here will destroy closure tree shaking!
  41407. _super.call(this) || this;
  41408. _this.selector = selector;
  41409. _this.componentType = componentType;
  41410. _this._inputs = _inputs;
  41411. _this._outputs = _outputs;
  41412. _this.ngContentSelectors = ngContentSelectors;
  41413. _this.viewDefFactory = viewDefFactory;
  41414. return _this;
  41415. }
  41416. Object.defineProperty(ComponentFactory_.prototype, "inputs", {
  41417. get: function () {
  41418. var inputsArr = [];
  41419. var inputs = this._inputs;
  41420. for (var propName in inputs) {
  41421. var templateName = inputs[propName];
  41422. inputsArr.push({ propName: propName, templateName: templateName });
  41423. }
  41424. return inputsArr;
  41425. },
  41426. enumerable: true,
  41427. configurable: true
  41428. });
  41429. Object.defineProperty(ComponentFactory_.prototype, "outputs", {
  41430. get: function () {
  41431. var outputsArr = [];
  41432. for (var propName in this._outputs) {
  41433. var templateName = this._outputs[propName];
  41434. outputsArr.push({ propName: propName, templateName: templateName });
  41435. }
  41436. return outputsArr;
  41437. },
  41438. enumerable: true,
  41439. configurable: true
  41440. });
  41441. /**
  41442. * Creates a new component.
  41443. */
  41444. ComponentFactory_.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
  41445. if (!ngModule) {
  41446. throw new Error('ngModule should be provided');
  41447. }
  41448. var viewDef = resolveDefinition(this.viewDefFactory);
  41449. var componentNodeIndex = viewDef.nodes[0].element.componentProvider.nodeIndex;
  41450. var view = Services.createRootView(injector, projectableNodes || [], rootSelectorOrNode, viewDef, ngModule, EMPTY_CONTEXT);
  41451. var component = asProviderData(view, componentNodeIndex).instance;
  41452. if (rootSelectorOrNode) {
  41453. view.renderer.setAttribute(asElementData(view, 0).renderElement, 'ng-version', VERSION.full);
  41454. }
  41455. return new ComponentRef_(view, new ViewRef_(view), component);
  41456. };
  41457. return ComponentFactory_;
  41458. }(ComponentFactory));
  41459. var ComponentRef_ = /** @class */ (function (_super) {
  41460. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentRef_, _super);
  41461. function ComponentRef_(_view, _viewRef, _component) {
  41462. var _this = _super.call(this) || this;
  41463. _this._view = _view;
  41464. _this._viewRef = _viewRef;
  41465. _this._component = _component;
  41466. _this._elDef = _this._view.def.nodes[0];
  41467. _this.hostView = _viewRef;
  41468. _this.changeDetectorRef = _viewRef;
  41469. _this.instance = _component;
  41470. return _this;
  41471. }
  41472. Object.defineProperty(ComponentRef_.prototype, "location", {
  41473. get: function () {
  41474. return new ElementRef(asElementData(this._view, this._elDef.nodeIndex).renderElement);
  41475. },
  41476. enumerable: true,
  41477. configurable: true
  41478. });
  41479. Object.defineProperty(ComponentRef_.prototype, "injector", {
  41480. get: function () { return new Injector_(this._view, this._elDef); },
  41481. enumerable: true,
  41482. configurable: true
  41483. });
  41484. Object.defineProperty(ComponentRef_.prototype, "componentType", {
  41485. get: function () { return this._component.constructor; },
  41486. enumerable: true,
  41487. configurable: true
  41488. });
  41489. ComponentRef_.prototype.destroy = function () { this._viewRef.destroy(); };
  41490. ComponentRef_.prototype.onDestroy = function (callback) { this._viewRef.onDestroy(callback); };
  41491. return ComponentRef_;
  41492. }(ComponentRef));
  41493. function createViewContainerData(view, elDef, elData) {
  41494. return new ViewContainerRef_(view, elDef, elData);
  41495. }
  41496. var ViewContainerRef_ = /** @class */ (function () {
  41497. function ViewContainerRef_(_view, _elDef, _data) {
  41498. this._view = _view;
  41499. this._elDef = _elDef;
  41500. this._data = _data;
  41501. /**
  41502. * @internal
  41503. */
  41504. this._embeddedViews = [];
  41505. }
  41506. Object.defineProperty(ViewContainerRef_.prototype, "element", {
  41507. get: function () { return new ElementRef(this._data.renderElement); },
  41508. enumerable: true,
  41509. configurable: true
  41510. });
  41511. Object.defineProperty(ViewContainerRef_.prototype, "injector", {
  41512. get: function () { return new Injector_(this._view, this._elDef); },
  41513. enumerable: true,
  41514. configurable: true
  41515. });
  41516. Object.defineProperty(ViewContainerRef_.prototype, "parentInjector", {
  41517. get: function () {
  41518. var view = this._view;
  41519. var elDef = this._elDef.parent;
  41520. while (!elDef && view) {
  41521. elDef = viewParentEl(view);
  41522. view = view.parent;
  41523. }
  41524. return view ? new Injector_(view, elDef) : new Injector_(this._view, null);
  41525. },
  41526. enumerable: true,
  41527. configurable: true
  41528. });
  41529. ViewContainerRef_.prototype.clear = function () {
  41530. var len = this._embeddedViews.length;
  41531. for (var i = len - 1; i >= 0; i--) {
  41532. var view = detachEmbeddedView(this._data, i);
  41533. Services.destroyView(view);
  41534. }
  41535. };
  41536. ViewContainerRef_.prototype.get = function (index) {
  41537. var view = this._embeddedViews[index];
  41538. if (view) {
  41539. var ref = new ViewRef_(view);
  41540. ref.attachToViewContainerRef(this);
  41541. return ref;
  41542. }
  41543. return null;
  41544. };
  41545. Object.defineProperty(ViewContainerRef_.prototype, "length", {
  41546. get: function () { return this._embeddedViews.length; },
  41547. enumerable: true,
  41548. configurable: true
  41549. });
  41550. ViewContainerRef_.prototype.createEmbeddedView = function (templateRef, context, index) {
  41551. var viewRef = templateRef.createEmbeddedView(context || {});
  41552. this.insert(viewRef, index);
  41553. return viewRef;
  41554. };
  41555. ViewContainerRef_.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
  41556. var contextInjector = injector || this.parentInjector;
  41557. if (!ngModuleRef && !(componentFactory instanceof ComponentFactoryBoundToModule)) {
  41558. ngModuleRef = contextInjector.get(NgModuleRef);
  41559. }
  41560. var componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
  41561. this.insert(componentRef.hostView, index);
  41562. return componentRef;
  41563. };
  41564. ViewContainerRef_.prototype.insert = function (viewRef, index) {
  41565. if (viewRef.destroyed) {
  41566. throw new Error('Cannot insert a destroyed View in a ViewContainer!');
  41567. }
  41568. var viewRef_ = viewRef;
  41569. var viewData = viewRef_._view;
  41570. attachEmbeddedView(this._view, this._data, index, viewData);
  41571. viewRef_.attachToViewContainerRef(this);
  41572. return viewRef;
  41573. };
  41574. ViewContainerRef_.prototype.move = function (viewRef, currentIndex) {
  41575. if (viewRef.destroyed) {
  41576. throw new Error('Cannot move a destroyed View in a ViewContainer!');
  41577. }
  41578. var previousIndex = this._embeddedViews.indexOf(viewRef._view);
  41579. moveEmbeddedView(this._data, previousIndex, currentIndex);
  41580. return viewRef;
  41581. };
  41582. ViewContainerRef_.prototype.indexOf = function (viewRef) {
  41583. return this._embeddedViews.indexOf(viewRef._view);
  41584. };
  41585. ViewContainerRef_.prototype.remove = function (index) {
  41586. var viewData = detachEmbeddedView(this._data, index);
  41587. if (viewData) {
  41588. Services.destroyView(viewData);
  41589. }
  41590. };
  41591. ViewContainerRef_.prototype.detach = function (index) {
  41592. var view = detachEmbeddedView(this._data, index);
  41593. return view ? new ViewRef_(view) : null;
  41594. };
  41595. return ViewContainerRef_;
  41596. }());
  41597. function createChangeDetectorRef(view) {
  41598. return new ViewRef_(view);
  41599. }
  41600. var ViewRef_ = /** @class */ (function () {
  41601. function ViewRef_(_view) {
  41602. this._view = _view;
  41603. this._viewContainerRef = null;
  41604. this._appRef = null;
  41605. }
  41606. Object.defineProperty(ViewRef_.prototype, "rootNodes", {
  41607. get: function () { return rootRenderNodes(this._view); },
  41608. enumerable: true,
  41609. configurable: true
  41610. });
  41611. Object.defineProperty(ViewRef_.prototype, "context", {
  41612. get: function () { return this._view.context; },
  41613. enumerable: true,
  41614. configurable: true
  41615. });
  41616. Object.defineProperty(ViewRef_.prototype, "destroyed", {
  41617. get: function () { return (this._view.state & 128 /* Destroyed */) !== 0; },
  41618. enumerable: true,
  41619. configurable: true
  41620. });
  41621. ViewRef_.prototype.markForCheck = function () { markParentViewsForCheck(this._view); };
  41622. ViewRef_.prototype.detach = function () { this._view.state &= ~4 /* Attached */; };
  41623. ViewRef_.prototype.detectChanges = function () {
  41624. var fs = this._view.root.rendererFactory;
  41625. if (fs.begin) {
  41626. fs.begin();
  41627. }
  41628. try {
  41629. Services.checkAndUpdateView(this._view);
  41630. }
  41631. finally {
  41632. if (fs.end) {
  41633. fs.end();
  41634. }
  41635. }
  41636. };
  41637. ViewRef_.prototype.checkNoChanges = function () { Services.checkNoChangesView(this._view); };
  41638. ViewRef_.prototype.reattach = function () { this._view.state |= 4 /* Attached */; };
  41639. ViewRef_.prototype.onDestroy = function (callback) {
  41640. if (!this._view.disposables) {
  41641. this._view.disposables = [];
  41642. }
  41643. this._view.disposables.push(callback);
  41644. };
  41645. ViewRef_.prototype.destroy = function () {
  41646. if (this._appRef) {
  41647. this._appRef.detachView(this);
  41648. }
  41649. else if (this._viewContainerRef) {
  41650. this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
  41651. }
  41652. Services.destroyView(this._view);
  41653. };
  41654. ViewRef_.prototype.detachFromAppRef = function () {
  41655. this._appRef = null;
  41656. renderDetachView(this._view);
  41657. Services.dirtyParentQueries(this._view);
  41658. };
  41659. ViewRef_.prototype.attachToAppRef = function (appRef) {
  41660. if (this._viewContainerRef) {
  41661. throw new Error('This view is already attached to a ViewContainer!');
  41662. }
  41663. this._appRef = appRef;
  41664. };
  41665. ViewRef_.prototype.attachToViewContainerRef = function (vcRef) {
  41666. if (this._appRef) {
  41667. throw new Error('This view is already attached directly to the ApplicationRef!');
  41668. }
  41669. this._viewContainerRef = vcRef;
  41670. };
  41671. return ViewRef_;
  41672. }());
  41673. function createTemplateData(view, def) {
  41674. return new TemplateRef_(view, def);
  41675. }
  41676. var TemplateRef_ = /** @class */ (function (_super) {
  41677. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(TemplateRef_, _super);
  41678. function TemplateRef_(_parentView, _def) {
  41679. var _this = _super.call(this) || this;
  41680. _this._parentView = _parentView;
  41681. _this._def = _def;
  41682. return _this;
  41683. }
  41684. TemplateRef_.prototype.createEmbeddedView = function (context) {
  41685. return new ViewRef_(Services.createEmbeddedView(this._parentView, this._def, this._def.element.template, context));
  41686. };
  41687. Object.defineProperty(TemplateRef_.prototype, "elementRef", {
  41688. get: function () {
  41689. return new ElementRef(asElementData(this._parentView, this._def.nodeIndex).renderElement);
  41690. },
  41691. enumerable: true,
  41692. configurable: true
  41693. });
  41694. return TemplateRef_;
  41695. }(TemplateRef));
  41696. function createInjector$1(view, elDef) {
  41697. return new Injector_(view, elDef);
  41698. }
  41699. var Injector_ = /** @class */ (function () {
  41700. function Injector_(view, elDef) {
  41701. this.view = view;
  41702. this.elDef = elDef;
  41703. }
  41704. Injector_.prototype.get = function (token, notFoundValue) {
  41705. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  41706. var allowPrivateServices = this.elDef ? (this.elDef.flags & 33554432 /* ComponentView */) !== 0 : false;
  41707. return Services.resolveDep(this.view, this.elDef, allowPrivateServices, { flags: 0 /* None */, token: token, tokenKey: tokenKey(token) }, notFoundValue);
  41708. };
  41709. return Injector_;
  41710. }());
  41711. function nodeValue(view, index) {
  41712. var def = view.def.nodes[index];
  41713. if (def.flags & 1 /* TypeElement */) {
  41714. var elData = asElementData(view, def.nodeIndex);
  41715. return def.element.template ? elData.template : elData.renderElement;
  41716. }
  41717. else if (def.flags & 2 /* TypeText */) {
  41718. return asTextData(view, def.nodeIndex).renderText;
  41719. }
  41720. else if (def.flags & (20224 /* CatProvider */ | 16 /* TypePipe */)) {
  41721. return asProviderData(view, def.nodeIndex).instance;
  41722. }
  41723. throw new Error("Illegal state: read nodeValue for node index " + index);
  41724. }
  41725. function createRendererV1(view) {
  41726. return new RendererAdapter(view.renderer);
  41727. }
  41728. var RendererAdapter = /** @class */ (function () {
  41729. function RendererAdapter(delegate) {
  41730. this.delegate = delegate;
  41731. }
  41732. RendererAdapter.prototype.selectRootElement = function (selectorOrNode) {
  41733. return this.delegate.selectRootElement(selectorOrNode);
  41734. };
  41735. RendererAdapter.prototype.createElement = function (parent, namespaceAndName) {
  41736. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
  41737. var el = this.delegate.createElement(name, ns);
  41738. if (parent) {
  41739. this.delegate.appendChild(parent, el);
  41740. }
  41741. return el;
  41742. };
  41743. RendererAdapter.prototype.createViewRoot = function (hostElement) { return hostElement; };
  41744. RendererAdapter.prototype.createTemplateAnchor = function (parentElement) {
  41745. var comment = this.delegate.createComment('');
  41746. if (parentElement) {
  41747. this.delegate.appendChild(parentElement, comment);
  41748. }
  41749. return comment;
  41750. };
  41751. RendererAdapter.prototype.createText = function (parentElement, value) {
  41752. var node = this.delegate.createText(value);
  41753. if (parentElement) {
  41754. this.delegate.appendChild(parentElement, node);
  41755. }
  41756. return node;
  41757. };
  41758. RendererAdapter.prototype.projectNodes = function (parentElement, nodes) {
  41759. for (var i = 0; i < nodes.length; i++) {
  41760. this.delegate.appendChild(parentElement, nodes[i]);
  41761. }
  41762. };
  41763. RendererAdapter.prototype.attachViewAfter = function (node, viewRootNodes) {
  41764. var parentElement = this.delegate.parentNode(node);
  41765. var nextSibling = this.delegate.nextSibling(node);
  41766. for (var i = 0; i < viewRootNodes.length; i++) {
  41767. this.delegate.insertBefore(parentElement, viewRootNodes[i], nextSibling);
  41768. }
  41769. };
  41770. RendererAdapter.prototype.detachView = function (viewRootNodes) {
  41771. for (var i = 0; i < viewRootNodes.length; i++) {
  41772. var node = viewRootNodes[i];
  41773. var parentElement = this.delegate.parentNode(node);
  41774. this.delegate.removeChild(parentElement, node);
  41775. }
  41776. };
  41777. RendererAdapter.prototype.destroyView = function (hostElement, viewAllNodes) {
  41778. for (var i = 0; i < viewAllNodes.length; i++) {
  41779. this.delegate.destroyNode(viewAllNodes[i]);
  41780. }
  41781. };
  41782. RendererAdapter.prototype.listen = function (renderElement, name, callback) {
  41783. return this.delegate.listen(renderElement, name, callback);
  41784. };
  41785. RendererAdapter.prototype.listenGlobal = function (target, name, callback) {
  41786. return this.delegate.listen(target, name, callback);
  41787. };
  41788. RendererAdapter.prototype.setElementProperty = function (renderElement, propertyName, propertyValue) {
  41789. this.delegate.setProperty(renderElement, propertyName, propertyValue);
  41790. };
  41791. RendererAdapter.prototype.setElementAttribute = function (renderElement, namespaceAndName, attributeValue) {
  41792. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(splitNamespace(namespaceAndName), 2), ns = _a[0], name = _a[1];
  41793. if (attributeValue != null) {
  41794. this.delegate.setAttribute(renderElement, name, attributeValue, ns);
  41795. }
  41796. else {
  41797. this.delegate.removeAttribute(renderElement, name, ns);
  41798. }
  41799. };
  41800. RendererAdapter.prototype.setBindingDebugInfo = function (renderElement, propertyName, propertyValue) { };
  41801. RendererAdapter.prototype.setElementClass = function (renderElement, className, isAdd) {
  41802. if (isAdd) {
  41803. this.delegate.addClass(renderElement, className);
  41804. }
  41805. else {
  41806. this.delegate.removeClass(renderElement, className);
  41807. }
  41808. };
  41809. RendererAdapter.prototype.setElementStyle = function (renderElement, styleName, styleValue) {
  41810. if (styleValue != null) {
  41811. this.delegate.setStyle(renderElement, styleName, styleValue);
  41812. }
  41813. else {
  41814. this.delegate.removeStyle(renderElement, styleName);
  41815. }
  41816. };
  41817. RendererAdapter.prototype.invokeElementMethod = function (renderElement, methodName, args) {
  41818. renderElement[methodName].apply(renderElement, args);
  41819. };
  41820. RendererAdapter.prototype.setText = function (renderNode$$1, text) { this.delegate.setValue(renderNode$$1, text); };
  41821. RendererAdapter.prototype.animate = function () { throw new Error('Renderer.animate is no longer supported!'); };
  41822. return RendererAdapter;
  41823. }());
  41824. function createNgModuleRef(moduleType, parent, bootstrapComponents, def) {
  41825. return new NgModuleRef_(moduleType, parent, bootstrapComponents, def);
  41826. }
  41827. var NgModuleRef_ = /** @class */ (function () {
  41828. function NgModuleRef_(_moduleType, _parent, _bootstrapComponents, _def) {
  41829. this._moduleType = _moduleType;
  41830. this._parent = _parent;
  41831. this._bootstrapComponents = _bootstrapComponents;
  41832. this._def = _def;
  41833. this._destroyListeners = [];
  41834. this._destroyed = false;
  41835. this.injector = this;
  41836. initNgModule(this);
  41837. }
  41838. NgModuleRef_.prototype.get = function (token, notFoundValue, injectFlags) {
  41839. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  41840. if (injectFlags === void 0) { injectFlags = 0 /* Default */; }
  41841. var flags = 0 /* None */;
  41842. if (injectFlags & 4 /* SkipSelf */) {
  41843. flags |= 1 /* SkipSelf */;
  41844. }
  41845. else if (injectFlags & 2 /* Self */) {
  41846. flags |= 4 /* Self */;
  41847. }
  41848. return resolveNgModuleDep(this, { token: token, tokenKey: tokenKey(token), flags: flags }, notFoundValue);
  41849. };
  41850. Object.defineProperty(NgModuleRef_.prototype, "instance", {
  41851. get: function () { return this.get(this._moduleType); },
  41852. enumerable: true,
  41853. configurable: true
  41854. });
  41855. Object.defineProperty(NgModuleRef_.prototype, "componentFactoryResolver", {
  41856. get: function () { return this.get(ComponentFactoryResolver); },
  41857. enumerable: true,
  41858. configurable: true
  41859. });
  41860. NgModuleRef_.prototype.destroy = function () {
  41861. if (this._destroyed) {
  41862. throw new Error("The ng module " + stringify(this.instance.constructor) + " has already been destroyed.");
  41863. }
  41864. this._destroyed = true;
  41865. callNgModuleLifecycle(this, 131072 /* OnDestroy */);
  41866. this._destroyListeners.forEach(function (listener) { return listener(); });
  41867. };
  41868. NgModuleRef_.prototype.onDestroy = function (callback) { this._destroyListeners.push(callback); };
  41869. return NgModuleRef_;
  41870. }());
  41871. /**
  41872. * @license
  41873. * Copyright Google Inc. All Rights Reserved.
  41874. *
  41875. * Use of this source code is governed by an MIT-style license that can be
  41876. * found in the LICENSE file at https://angular.io/license
  41877. */
  41878. var RendererV1TokenKey = tokenKey(Renderer);
  41879. var Renderer2TokenKey = tokenKey(Renderer2);
  41880. var ElementRefTokenKey = tokenKey(ElementRef);
  41881. var ViewContainerRefTokenKey = tokenKey(ViewContainerRef);
  41882. var TemplateRefTokenKey = tokenKey(TemplateRef);
  41883. var ChangeDetectorRefTokenKey = tokenKey(ChangeDetectorRef);
  41884. var InjectorRefTokenKey$1 = tokenKey(Injector);
  41885. var INJECTORRefTokenKey$1 = tokenKey(INJECTOR);
  41886. function directiveDef(checkIndex, flags, matchedQueries, childCount, ctor, deps, props, outputs) {
  41887. var bindings = [];
  41888. if (props) {
  41889. for (var prop in props) {
  41890. var _a = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__read"])(props[prop], 2), bindingIndex = _a[0], nonMinifiedName = _a[1];
  41891. bindings[bindingIndex] = {
  41892. flags: 8 /* TypeProperty */,
  41893. name: prop, nonMinifiedName: nonMinifiedName,
  41894. ns: null,
  41895. securityContext: null,
  41896. suffix: null
  41897. };
  41898. }
  41899. }
  41900. var outputDefs = [];
  41901. if (outputs) {
  41902. for (var propName in outputs) {
  41903. outputDefs.push({ type: 1 /* DirectiveOutput */, propName: propName, target: null, eventName: outputs[propName] });
  41904. }
  41905. }
  41906. flags |= 16384 /* TypeDirective */;
  41907. return _def(checkIndex, flags, matchedQueries, childCount, ctor, ctor, deps, bindings, outputDefs);
  41908. }
  41909. function pipeDef(flags, ctor, deps) {
  41910. flags |= 16 /* TypePipe */;
  41911. return _def(-1, flags, null, 0, ctor, ctor, deps);
  41912. }
  41913. function providerDef(flags, matchedQueries, token, value, deps) {
  41914. return _def(-1, flags, matchedQueries, 0, token, value, deps);
  41915. }
  41916. function _def(checkIndex, flags, matchedQueriesDsl, childCount, token, value, deps, bindings, outputs) {
  41917. var _a = splitMatchedQueriesDsl(matchedQueriesDsl), matchedQueries = _a.matchedQueries, references = _a.references, matchedQueryIds = _a.matchedQueryIds;
  41918. if (!outputs) {
  41919. outputs = [];
  41920. }
  41921. if (!bindings) {
  41922. bindings = [];
  41923. }
  41924. // Need to resolve forwardRefs as e.g. for `useValue` we
  41925. // lowered the expression and then stopped evaluating it,
  41926. // i.e. also didn't unwrap it.
  41927. value = resolveForwardRef(value);
  41928. var depDefs = splitDepsDsl(deps, stringify(token));
  41929. return {
  41930. // will bet set by the view definition
  41931. nodeIndex: -1,
  41932. parent: null,
  41933. renderParent: null,
  41934. bindingIndex: -1,
  41935. outputIndex: -1,
  41936. // regular values
  41937. checkIndex: checkIndex,
  41938. flags: flags,
  41939. childFlags: 0,
  41940. directChildFlags: 0,
  41941. childMatchedQueries: 0, matchedQueries: matchedQueries, matchedQueryIds: matchedQueryIds, references: references,
  41942. ngContentIndex: -1, childCount: childCount, bindings: bindings,
  41943. bindingFlags: calcBindingFlags(bindings), outputs: outputs,
  41944. element: null,
  41945. provider: { token: token, value: value, deps: depDefs },
  41946. text: null,
  41947. query: null,
  41948. ngContent: null
  41949. };
  41950. }
  41951. function createProviderInstance(view, def) {
  41952. return _createProviderInstance$1(view, def);
  41953. }
  41954. function createPipeInstance(view, def) {
  41955. // deps are looked up from component.
  41956. var compView = view;
  41957. while (compView.parent && !isComponentView(compView)) {
  41958. compView = compView.parent;
  41959. }
  41960. // pipes can see the private services of the component
  41961. var allowPrivateServices = true;
  41962. // pipes are always eager and classes!
  41963. return createClass(compView.parent, viewParentEl(compView), allowPrivateServices, def.provider.value, def.provider.deps);
  41964. }
  41965. function createDirectiveInstance(view, def) {
  41966. // components can see other private services, other directives can't.
  41967. var allowPrivateServices = (def.flags & 32768 /* Component */) > 0;
  41968. // directives are always eager and classes!
  41969. var instance = createClass(view, def.parent, allowPrivateServices, def.provider.value, def.provider.deps);
  41970. if (def.outputs.length) {
  41971. for (var i = 0; i < def.outputs.length; i++) {
  41972. var output = def.outputs[i];
  41973. var subscription = instance[output.propName].subscribe(eventHandlerClosure(view, def.parent.nodeIndex, output.eventName));
  41974. view.disposables[def.outputIndex + i] = subscription.unsubscribe.bind(subscription);
  41975. }
  41976. }
  41977. return instance;
  41978. }
  41979. function eventHandlerClosure(view, index, eventName) {
  41980. return function (event) { return dispatchEvent(view, index, eventName, event); };
  41981. }
  41982. function checkAndUpdateDirectiveInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  41983. var providerData = asProviderData(view, def.nodeIndex);
  41984. var directive = providerData.instance;
  41985. var changed = false;
  41986. var changes = undefined;
  41987. var bindLen = def.bindings.length;
  41988. if (bindLen > 0 && checkBinding(view, def, 0, v0)) {
  41989. changed = true;
  41990. changes = updateProp(view, providerData, def, 0, v0, changes);
  41991. }
  41992. if (bindLen > 1 && checkBinding(view, def, 1, v1)) {
  41993. changed = true;
  41994. changes = updateProp(view, providerData, def, 1, v1, changes);
  41995. }
  41996. if (bindLen > 2 && checkBinding(view, def, 2, v2)) {
  41997. changed = true;
  41998. changes = updateProp(view, providerData, def, 2, v2, changes);
  41999. }
  42000. if (bindLen > 3 && checkBinding(view, def, 3, v3)) {
  42001. changed = true;
  42002. changes = updateProp(view, providerData, def, 3, v3, changes);
  42003. }
  42004. if (bindLen > 4 && checkBinding(view, def, 4, v4)) {
  42005. changed = true;
  42006. changes = updateProp(view, providerData, def, 4, v4, changes);
  42007. }
  42008. if (bindLen > 5 && checkBinding(view, def, 5, v5)) {
  42009. changed = true;
  42010. changes = updateProp(view, providerData, def, 5, v5, changes);
  42011. }
  42012. if (bindLen > 6 && checkBinding(view, def, 6, v6)) {
  42013. changed = true;
  42014. changes = updateProp(view, providerData, def, 6, v6, changes);
  42015. }
  42016. if (bindLen > 7 && checkBinding(view, def, 7, v7)) {
  42017. changed = true;
  42018. changes = updateProp(view, providerData, def, 7, v7, changes);
  42019. }
  42020. if (bindLen > 8 && checkBinding(view, def, 8, v8)) {
  42021. changed = true;
  42022. changes = updateProp(view, providerData, def, 8, v8, changes);
  42023. }
  42024. if (bindLen > 9 && checkBinding(view, def, 9, v9)) {
  42025. changed = true;
  42026. changes = updateProp(view, providerData, def, 9, v9, changes);
  42027. }
  42028. if (changes) {
  42029. directive.ngOnChanges(changes);
  42030. }
  42031. if ((def.flags & 65536 /* OnInit */) &&
  42032. shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
  42033. directive.ngOnInit();
  42034. }
  42035. if (def.flags & 262144 /* DoCheck */) {
  42036. directive.ngDoCheck();
  42037. }
  42038. return changed;
  42039. }
  42040. function checkAndUpdateDirectiveDynamic(view, def, values) {
  42041. var providerData = asProviderData(view, def.nodeIndex);
  42042. var directive = providerData.instance;
  42043. var changed = false;
  42044. var changes = undefined;
  42045. for (var i = 0; i < values.length; i++) {
  42046. if (checkBinding(view, def, i, values[i])) {
  42047. changed = true;
  42048. changes = updateProp(view, providerData, def, i, values[i], changes);
  42049. }
  42050. }
  42051. if (changes) {
  42052. directive.ngOnChanges(changes);
  42053. }
  42054. if ((def.flags & 65536 /* OnInit */) &&
  42055. shouldCallLifecycleInitHook(view, 256 /* InitState_CallingOnInit */, def.nodeIndex)) {
  42056. directive.ngOnInit();
  42057. }
  42058. if (def.flags & 262144 /* DoCheck */) {
  42059. directive.ngDoCheck();
  42060. }
  42061. return changed;
  42062. }
  42063. function _createProviderInstance$1(view, def) {
  42064. // private services can see other private services
  42065. var allowPrivateServices = (def.flags & 8192 /* PrivateProvider */) > 0;
  42066. var providerDef = def.provider;
  42067. switch (def.flags & 201347067 /* Types */) {
  42068. case 512 /* TypeClassProvider */:
  42069. return createClass(view, def.parent, allowPrivateServices, providerDef.value, providerDef.deps);
  42070. case 1024 /* TypeFactoryProvider */:
  42071. return callFactory(view, def.parent, allowPrivateServices, providerDef.value, providerDef.deps);
  42072. case 2048 /* TypeUseExistingProvider */:
  42073. return resolveDep(view, def.parent, allowPrivateServices, providerDef.deps[0]);
  42074. case 256 /* TypeValueProvider */:
  42075. return providerDef.value;
  42076. }
  42077. }
  42078. function createClass(view, elDef, allowPrivateServices, ctor, deps) {
  42079. var len = deps.length;
  42080. switch (len) {
  42081. case 0:
  42082. return new ctor();
  42083. case 1:
  42084. return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]));
  42085. case 2:
  42086. return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
  42087. case 3:
  42088. return new ctor(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
  42089. default:
  42090. var depValues = new Array(len);
  42091. for (var i = 0; i < len; i++) {
  42092. depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
  42093. }
  42094. return new (ctor.bind.apply(ctor, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([void 0], depValues)))();
  42095. }
  42096. }
  42097. function callFactory(view, elDef, allowPrivateServices, factory, deps) {
  42098. var len = deps.length;
  42099. switch (len) {
  42100. case 0:
  42101. return factory();
  42102. case 1:
  42103. return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]));
  42104. case 2:
  42105. return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]));
  42106. case 3:
  42107. return factory(resolveDep(view, elDef, allowPrivateServices, deps[0]), resolveDep(view, elDef, allowPrivateServices, deps[1]), resolveDep(view, elDef, allowPrivateServices, deps[2]));
  42108. default:
  42109. var depValues = Array(len);
  42110. for (var i = 0; i < len; i++) {
  42111. depValues[i] = resolveDep(view, elDef, allowPrivateServices, deps[i]);
  42112. }
  42113. return factory.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(depValues));
  42114. }
  42115. }
  42116. // This default value is when checking the hierarchy for a token.
  42117. //
  42118. // It means both:
  42119. // - the token is not provided by the current injector,
  42120. // - only the element injectors should be checked (ie do not check module injectors
  42121. //
  42122. // mod1
  42123. // /
  42124. // el1 mod2
  42125. // \ /
  42126. // el2
  42127. //
  42128. // When requesting el2.injector.get(token), we should check in the following order and return the
  42129. // first found value:
  42130. // - el2.injector.get(token, default)
  42131. // - el1.injector.get(token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) -> do not check the module
  42132. // - mod2.injector.get(token, default)
  42133. var NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR = {};
  42134. function resolveDep(view, elDef, allowPrivateServices, depDef, notFoundValue) {
  42135. if (notFoundValue === void 0) { notFoundValue = Injector.THROW_IF_NOT_FOUND; }
  42136. if (depDef.flags & 8 /* Value */) {
  42137. return depDef.token;
  42138. }
  42139. var startView = view;
  42140. if (depDef.flags & 2 /* Optional */) {
  42141. notFoundValue = null;
  42142. }
  42143. var tokenKey$$1 = depDef.tokenKey;
  42144. if (tokenKey$$1 === ChangeDetectorRefTokenKey) {
  42145. // directives on the same element as a component should be able to control the change detector
  42146. // of that component as well.
  42147. allowPrivateServices = !!(elDef && elDef.element.componentView);
  42148. }
  42149. if (elDef && (depDef.flags & 1 /* SkipSelf */)) {
  42150. allowPrivateServices = false;
  42151. elDef = elDef.parent;
  42152. }
  42153. var searchView = view;
  42154. while (searchView) {
  42155. if (elDef) {
  42156. switch (tokenKey$$1) {
  42157. case RendererV1TokenKey: {
  42158. var compView = findCompView(searchView, elDef, allowPrivateServices);
  42159. return createRendererV1(compView);
  42160. }
  42161. case Renderer2TokenKey: {
  42162. var compView = findCompView(searchView, elDef, allowPrivateServices);
  42163. return compView.renderer;
  42164. }
  42165. case ElementRefTokenKey:
  42166. return new ElementRef(asElementData(searchView, elDef.nodeIndex).renderElement);
  42167. case ViewContainerRefTokenKey:
  42168. return asElementData(searchView, elDef.nodeIndex).viewContainer;
  42169. case TemplateRefTokenKey: {
  42170. if (elDef.element.template) {
  42171. return asElementData(searchView, elDef.nodeIndex).template;
  42172. }
  42173. break;
  42174. }
  42175. case ChangeDetectorRefTokenKey: {
  42176. var cdView = findCompView(searchView, elDef, allowPrivateServices);
  42177. return createChangeDetectorRef(cdView);
  42178. }
  42179. case InjectorRefTokenKey$1:
  42180. case INJECTORRefTokenKey$1:
  42181. return createInjector$1(searchView, elDef);
  42182. default:
  42183. var providerDef_1 = (allowPrivateServices ? elDef.element.allProviders :
  42184. elDef.element.publicProviders)[tokenKey$$1];
  42185. if (providerDef_1) {
  42186. var providerData = asProviderData(searchView, providerDef_1.nodeIndex);
  42187. if (!providerData) {
  42188. providerData = { instance: _createProviderInstance$1(searchView, providerDef_1) };
  42189. searchView.nodes[providerDef_1.nodeIndex] = providerData;
  42190. }
  42191. return providerData.instance;
  42192. }
  42193. }
  42194. }
  42195. allowPrivateServices = isComponentView(searchView);
  42196. elDef = viewParentEl(searchView);
  42197. searchView = searchView.parent;
  42198. if (depDef.flags & 4 /* Self */) {
  42199. searchView = null;
  42200. }
  42201. }
  42202. var value = startView.root.injector.get(depDef.token, NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR);
  42203. if (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR ||
  42204. notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR) {
  42205. // Return the value from the root element injector when
  42206. // - it provides it
  42207. // (value !== NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
  42208. // - the module injector should not be checked
  42209. // (notFoundValue === NOT_FOUND_CHECK_ONLY_ELEMENT_INJECTOR)
  42210. return value;
  42211. }
  42212. return startView.root.ngModule.injector.get(depDef.token, notFoundValue);
  42213. }
  42214. function findCompView(view, elDef, allowPrivateServices) {
  42215. var compView;
  42216. if (allowPrivateServices) {
  42217. compView = asElementData(view, elDef.nodeIndex).componentView;
  42218. }
  42219. else {
  42220. compView = view;
  42221. while (compView.parent && !isComponentView(compView)) {
  42222. compView = compView.parent;
  42223. }
  42224. }
  42225. return compView;
  42226. }
  42227. function updateProp(view, providerData, def, bindingIdx, value, changes) {
  42228. if (def.flags & 32768 /* Component */) {
  42229. var compView = asElementData(view, def.parent.nodeIndex).componentView;
  42230. if (compView.def.flags & 2 /* OnPush */) {
  42231. compView.state |= 8 /* ChecksEnabled */;
  42232. }
  42233. }
  42234. var binding = def.bindings[bindingIdx];
  42235. var propName = binding.name;
  42236. // Note: This is still safe with Closure Compiler as
  42237. // the user passed in the property name as an object has to `providerDef`,
  42238. // so Closure Compiler will have renamed the property correctly already.
  42239. providerData.instance[propName] = value;
  42240. if (def.flags & 524288 /* OnChanges */) {
  42241. changes = changes || {};
  42242. var oldValue = WrappedValue.unwrap(view.oldValues[def.bindingIndex + bindingIdx]);
  42243. var binding_1 = def.bindings[bindingIdx];
  42244. changes[binding_1.nonMinifiedName] =
  42245. new SimpleChange(oldValue, value, (view.state & 2 /* FirstCheck */) !== 0);
  42246. }
  42247. view.oldValues[def.bindingIndex + bindingIdx] = value;
  42248. return changes;
  42249. }
  42250. // This function calls the ngAfterContentCheck, ngAfterContentInit,
  42251. // ngAfterViewCheck, and ngAfterViewInit lifecycle hooks (depending on the node
  42252. // flags in lifecycle). Unlike ngDoCheck, ngOnChanges and ngOnInit, which are
  42253. // called during a pre-order traversal of the view tree (that is calling the
  42254. // parent hooks before the child hooks) these events are sent in using a
  42255. // post-order traversal of the tree (children before parents). This changes the
  42256. // meaning of initIndex in the view state. For ngOnInit, initIndex tracks the
  42257. // expected nodeIndex which a ngOnInit should be called. When sending
  42258. // ngAfterContentInit and ngAfterViewInit it is the expected count of
  42259. // ngAfterContentInit or ngAfterViewInit methods that have been called. This
  42260. // ensure that despite being called recursively or after picking up after an
  42261. // exception, the ngAfterContentInit or ngAfterViewInit will be called on the
  42262. // correct nodes. Consider for example, the following (where E is an element
  42263. // and D is a directive)
  42264. // Tree: pre-order index post-order index
  42265. // E1 0 6
  42266. // E2 1 1
  42267. // D3 2 0
  42268. // E4 3 5
  42269. // E5 4 4
  42270. // E6 5 2
  42271. // E7 6 3
  42272. // As can be seen, the post-order index has an unclear relationship to the
  42273. // pre-order index (postOrderIndex === preOrderIndex - parentCount +
  42274. // childCount). Since number of calls to ngAfterContentInit and ngAfterViewInit
  42275. // are stable (will be the same for the same view regardless of exceptions or
  42276. // recursion) we just need to count them which will roughly correspond to the
  42277. // post-order index (it skips elements and directives that do not have
  42278. // lifecycle hooks).
  42279. //
  42280. // For example, if an exception is raised in the E6.onAfterViewInit() the
  42281. // initIndex is left at 3 (by shouldCallLifecycleInitHook() which set it to
  42282. // initIndex + 1). When checkAndUpdateView() is called again D3, E2 and E6 will
  42283. // not have their ngAfterViewInit() called but, starting with E7, the rest of
  42284. // the view will begin getting ngAfterViewInit() called until a check and
  42285. // pass is complete.
  42286. //
  42287. // This algorthim also handles recursion. Consider if E4's ngAfterViewInit()
  42288. // indirectly calls E1's ChangeDetectorRef.detectChanges(). The expected
  42289. // initIndex is set to 6, the recusive checkAndUpdateView() starts walk again.
  42290. // D3, E2, E6, E7, E5 and E4 are skipped, ngAfterViewInit() is called on E1.
  42291. // When the recursion returns the initIndex will be 7 so E1 is skipped as it
  42292. // has already been called in the recursively called checkAnUpdateView().
  42293. function callLifecycleHooksChildrenFirst(view, lifecycles) {
  42294. if (!(view.def.nodeFlags & lifecycles)) {
  42295. return;
  42296. }
  42297. var nodes = view.def.nodes;
  42298. var initIndex = 0;
  42299. for (var i = 0; i < nodes.length; i++) {
  42300. var nodeDef = nodes[i];
  42301. var parent_1 = nodeDef.parent;
  42302. if (!parent_1 && nodeDef.flags & lifecycles) {
  42303. // matching root node (e.g. a pipe)
  42304. callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
  42305. }
  42306. if ((nodeDef.childFlags & lifecycles) === 0) {
  42307. // no child matches one of the lifecycles
  42308. i += nodeDef.childCount;
  42309. }
  42310. while (parent_1 && (parent_1.flags & 1 /* TypeElement */) &&
  42311. i === parent_1.nodeIndex + parent_1.childCount) {
  42312. // last child of an element
  42313. if (parent_1.directChildFlags & lifecycles) {
  42314. initIndex = callElementProvidersLifecycles(view, parent_1, lifecycles, initIndex);
  42315. }
  42316. parent_1 = parent_1.parent;
  42317. }
  42318. }
  42319. }
  42320. function callElementProvidersLifecycles(view, elDef, lifecycles, initIndex) {
  42321. for (var i = elDef.nodeIndex + 1; i <= elDef.nodeIndex + elDef.childCount; i++) {
  42322. var nodeDef = view.def.nodes[i];
  42323. if (nodeDef.flags & lifecycles) {
  42324. callProviderLifecycles(view, i, nodeDef.flags & lifecycles, initIndex++);
  42325. }
  42326. // only visit direct children
  42327. i += nodeDef.childCount;
  42328. }
  42329. return initIndex;
  42330. }
  42331. function callProviderLifecycles(view, index, lifecycles, initIndex) {
  42332. var providerData = asProviderData(view, index);
  42333. if (!providerData) {
  42334. return;
  42335. }
  42336. var provider = providerData.instance;
  42337. if (!provider) {
  42338. return;
  42339. }
  42340. Services.setCurrentNode(view, index);
  42341. if (lifecycles & 1048576 /* AfterContentInit */ &&
  42342. shouldCallLifecycleInitHook(view, 512 /* InitState_CallingAfterContentInit */, initIndex)) {
  42343. provider.ngAfterContentInit();
  42344. }
  42345. if (lifecycles & 2097152 /* AfterContentChecked */) {
  42346. provider.ngAfterContentChecked();
  42347. }
  42348. if (lifecycles & 4194304 /* AfterViewInit */ &&
  42349. shouldCallLifecycleInitHook(view, 768 /* InitState_CallingAfterViewInit */, initIndex)) {
  42350. provider.ngAfterViewInit();
  42351. }
  42352. if (lifecycles & 8388608 /* AfterViewChecked */) {
  42353. provider.ngAfterViewChecked();
  42354. }
  42355. if (lifecycles & 131072 /* OnDestroy */) {
  42356. provider.ngOnDestroy();
  42357. }
  42358. }
  42359. /**
  42360. * @license
  42361. * Copyright Google Inc. All Rights Reserved.
  42362. *
  42363. * Use of this source code is governed by an MIT-style license that can be
  42364. * found in the LICENSE file at https://angular.io/license
  42365. */
  42366. function queryDef(flags, id, bindings) {
  42367. var bindingDefs = [];
  42368. for (var propName in bindings) {
  42369. var bindingType = bindings[propName];
  42370. bindingDefs.push({ propName: propName, bindingType: bindingType });
  42371. }
  42372. return {
  42373. // will bet set by the view definition
  42374. nodeIndex: -1,
  42375. parent: null,
  42376. renderParent: null,
  42377. bindingIndex: -1,
  42378. outputIndex: -1,
  42379. // regular values
  42380. // TODO(vicb): check
  42381. checkIndex: -1, flags: flags,
  42382. childFlags: 0,
  42383. directChildFlags: 0,
  42384. childMatchedQueries: 0,
  42385. ngContentIndex: -1,
  42386. matchedQueries: {},
  42387. matchedQueryIds: 0,
  42388. references: {},
  42389. childCount: 0,
  42390. bindings: [],
  42391. bindingFlags: 0,
  42392. outputs: [],
  42393. element: null,
  42394. provider: null,
  42395. text: null,
  42396. query: { id: id, filterId: filterQueryId(id), bindings: bindingDefs },
  42397. ngContent: null
  42398. };
  42399. }
  42400. function createQuery() {
  42401. return new QueryList();
  42402. }
  42403. function dirtyParentQueries(view) {
  42404. var queryIds = view.def.nodeMatchedQueries;
  42405. while (view.parent && isEmbeddedView(view)) {
  42406. var tplDef = view.parentNodeDef;
  42407. view = view.parent;
  42408. // content queries
  42409. var end = tplDef.nodeIndex + tplDef.childCount;
  42410. for (var i = 0; i <= end; i++) {
  42411. var nodeDef = view.def.nodes[i];
  42412. if ((nodeDef.flags & 67108864 /* TypeContentQuery */) &&
  42413. (nodeDef.flags & 536870912 /* DynamicQuery */) &&
  42414. (nodeDef.query.filterId & queryIds) === nodeDef.query.filterId) {
  42415. asQueryList(view, i).setDirty();
  42416. }
  42417. if ((nodeDef.flags & 1 /* TypeElement */ && i + nodeDef.childCount < tplDef.nodeIndex) ||
  42418. !(nodeDef.childFlags & 67108864 /* TypeContentQuery */) ||
  42419. !(nodeDef.childFlags & 536870912 /* DynamicQuery */)) {
  42420. // skip elements that don't contain the template element or no query.
  42421. i += nodeDef.childCount;
  42422. }
  42423. }
  42424. }
  42425. // view queries
  42426. if (view.def.nodeFlags & 134217728 /* TypeViewQuery */) {
  42427. for (var i = 0; i < view.def.nodes.length; i++) {
  42428. var nodeDef = view.def.nodes[i];
  42429. if ((nodeDef.flags & 134217728 /* TypeViewQuery */) && (nodeDef.flags & 536870912 /* DynamicQuery */)) {
  42430. asQueryList(view, i).setDirty();
  42431. }
  42432. // only visit the root nodes
  42433. i += nodeDef.childCount;
  42434. }
  42435. }
  42436. }
  42437. function checkAndUpdateQuery(view, nodeDef) {
  42438. var queryList = asQueryList(view, nodeDef.nodeIndex);
  42439. if (!queryList.dirty) {
  42440. return;
  42441. }
  42442. var directiveInstance;
  42443. var newValues = undefined;
  42444. if (nodeDef.flags & 67108864 /* TypeContentQuery */) {
  42445. var elementDef = nodeDef.parent.parent;
  42446. newValues = calcQueryValues(view, elementDef.nodeIndex, elementDef.nodeIndex + elementDef.childCount, nodeDef.query, []);
  42447. directiveInstance = asProviderData(view, nodeDef.parent.nodeIndex).instance;
  42448. }
  42449. else if (nodeDef.flags & 134217728 /* TypeViewQuery */) {
  42450. newValues = calcQueryValues(view, 0, view.def.nodes.length - 1, nodeDef.query, []);
  42451. directiveInstance = view.component;
  42452. }
  42453. queryList.reset(newValues);
  42454. var bindings = nodeDef.query.bindings;
  42455. var notify = false;
  42456. for (var i = 0; i < bindings.length; i++) {
  42457. var binding = bindings[i];
  42458. var boundValue = void 0;
  42459. switch (binding.bindingType) {
  42460. case 0 /* First */:
  42461. boundValue = queryList.first;
  42462. break;
  42463. case 1 /* All */:
  42464. boundValue = queryList;
  42465. notify = true;
  42466. break;
  42467. }
  42468. directiveInstance[binding.propName] = boundValue;
  42469. }
  42470. if (notify) {
  42471. queryList.notifyOnChanges();
  42472. }
  42473. }
  42474. function calcQueryValues(view, startIndex, endIndex, queryDef, values) {
  42475. for (var i = startIndex; i <= endIndex; i++) {
  42476. var nodeDef = view.def.nodes[i];
  42477. var valueType = nodeDef.matchedQueries[queryDef.id];
  42478. if (valueType != null) {
  42479. values.push(getQueryValue(view, nodeDef, valueType));
  42480. }
  42481. if (nodeDef.flags & 1 /* TypeElement */ && nodeDef.element.template &&
  42482. (nodeDef.element.template.nodeMatchedQueries & queryDef.filterId) ===
  42483. queryDef.filterId) {
  42484. var elementData = asElementData(view, i);
  42485. // check embedded views that were attached at the place of their template,
  42486. // but process child nodes first if some match the query (see issue #16568)
  42487. if ((nodeDef.childMatchedQueries & queryDef.filterId) === queryDef.filterId) {
  42488. calcQueryValues(view, i + 1, i + nodeDef.childCount, queryDef, values);
  42489. i += nodeDef.childCount;
  42490. }
  42491. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  42492. var embeddedViews = elementData.viewContainer._embeddedViews;
  42493. for (var k = 0; k < embeddedViews.length; k++) {
  42494. var embeddedView = embeddedViews[k];
  42495. var dvc = declaredViewContainer(embeddedView);
  42496. if (dvc && dvc === elementData) {
  42497. calcQueryValues(embeddedView, 0, embeddedView.def.nodes.length - 1, queryDef, values);
  42498. }
  42499. }
  42500. }
  42501. var projectedViews = elementData.template._projectedViews;
  42502. if (projectedViews) {
  42503. for (var k = 0; k < projectedViews.length; k++) {
  42504. var projectedView = projectedViews[k];
  42505. calcQueryValues(projectedView, 0, projectedView.def.nodes.length - 1, queryDef, values);
  42506. }
  42507. }
  42508. }
  42509. if ((nodeDef.childMatchedQueries & queryDef.filterId) !== queryDef.filterId) {
  42510. // if no child matches the query, skip the children.
  42511. i += nodeDef.childCount;
  42512. }
  42513. }
  42514. return values;
  42515. }
  42516. function getQueryValue(view, nodeDef, queryValueType) {
  42517. if (queryValueType != null) {
  42518. // a match
  42519. switch (queryValueType) {
  42520. case 1 /* RenderElement */:
  42521. return asElementData(view, nodeDef.nodeIndex).renderElement;
  42522. case 0 /* ElementRef */:
  42523. return new ElementRef(asElementData(view, nodeDef.nodeIndex).renderElement);
  42524. case 2 /* TemplateRef */:
  42525. return asElementData(view, nodeDef.nodeIndex).template;
  42526. case 3 /* ViewContainerRef */:
  42527. return asElementData(view, nodeDef.nodeIndex).viewContainer;
  42528. case 4 /* Provider */:
  42529. return asProviderData(view, nodeDef.nodeIndex).instance;
  42530. }
  42531. }
  42532. }
  42533. /**
  42534. * @license
  42535. * Copyright Google Inc. All Rights Reserved.
  42536. *
  42537. * Use of this source code is governed by an MIT-style license that can be
  42538. * found in the LICENSE file at https://angular.io/license
  42539. */
  42540. function ngContentDef(ngContentIndex, index) {
  42541. return {
  42542. // will bet set by the view definition
  42543. nodeIndex: -1,
  42544. parent: null,
  42545. renderParent: null,
  42546. bindingIndex: -1,
  42547. outputIndex: -1,
  42548. // regular values
  42549. checkIndex: -1,
  42550. flags: 8 /* TypeNgContent */,
  42551. childFlags: 0,
  42552. directChildFlags: 0,
  42553. childMatchedQueries: 0,
  42554. matchedQueries: {},
  42555. matchedQueryIds: 0,
  42556. references: {}, ngContentIndex: ngContentIndex,
  42557. childCount: 0,
  42558. bindings: [],
  42559. bindingFlags: 0,
  42560. outputs: [],
  42561. element: null,
  42562. provider: null,
  42563. text: null,
  42564. query: null,
  42565. ngContent: { index: index }
  42566. };
  42567. }
  42568. function appendNgContent(view, renderHost, def) {
  42569. var parentEl = getParentRenderElement(view, renderHost, def);
  42570. if (!parentEl) {
  42571. // Nothing to do if there is no parent element.
  42572. return;
  42573. }
  42574. var ngContentIndex = def.ngContent.index;
  42575. visitProjectedRenderNodes(view, ngContentIndex, 1 /* AppendChild */, parentEl, null, undefined);
  42576. }
  42577. /**
  42578. * @license
  42579. * Copyright Google Inc. All Rights Reserved.
  42580. *
  42581. * Use of this source code is governed by an MIT-style license that can be
  42582. * found in the LICENSE file at https://angular.io/license
  42583. */
  42584. function purePipeDef(checkIndex, argCount) {
  42585. // argCount + 1 to include the pipe as first arg
  42586. return _pureExpressionDef(128 /* TypePurePipe */, checkIndex, new Array(argCount + 1));
  42587. }
  42588. function pureArrayDef(checkIndex, argCount) {
  42589. return _pureExpressionDef(32 /* TypePureArray */, checkIndex, new Array(argCount));
  42590. }
  42591. function pureObjectDef(checkIndex, propToIndex) {
  42592. var keys = Object.keys(propToIndex);
  42593. var nbKeys = keys.length;
  42594. var propertyNames = new Array(nbKeys);
  42595. for (var i = 0; i < nbKeys; i++) {
  42596. var key = keys[i];
  42597. var index = propToIndex[key];
  42598. propertyNames[index] = key;
  42599. }
  42600. return _pureExpressionDef(64 /* TypePureObject */, checkIndex, propertyNames);
  42601. }
  42602. function _pureExpressionDef(flags, checkIndex, propertyNames) {
  42603. var bindings = new Array(propertyNames.length);
  42604. for (var i = 0; i < propertyNames.length; i++) {
  42605. var prop = propertyNames[i];
  42606. bindings[i] = {
  42607. flags: 8 /* TypeProperty */,
  42608. name: prop,
  42609. ns: null,
  42610. nonMinifiedName: prop,
  42611. securityContext: null,
  42612. suffix: null
  42613. };
  42614. }
  42615. return {
  42616. // will bet set by the view definition
  42617. nodeIndex: -1,
  42618. parent: null,
  42619. renderParent: null,
  42620. bindingIndex: -1,
  42621. outputIndex: -1,
  42622. // regular values
  42623. checkIndex: checkIndex,
  42624. flags: flags,
  42625. childFlags: 0,
  42626. directChildFlags: 0,
  42627. childMatchedQueries: 0,
  42628. matchedQueries: {},
  42629. matchedQueryIds: 0,
  42630. references: {},
  42631. ngContentIndex: -1,
  42632. childCount: 0, bindings: bindings,
  42633. bindingFlags: calcBindingFlags(bindings),
  42634. outputs: [],
  42635. element: null,
  42636. provider: null,
  42637. text: null,
  42638. query: null,
  42639. ngContent: null
  42640. };
  42641. }
  42642. function createPureExpression(view, def) {
  42643. return { value: undefined };
  42644. }
  42645. function checkAndUpdatePureExpressionInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  42646. var bindings = def.bindings;
  42647. var changed = false;
  42648. var bindLen = bindings.length;
  42649. if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
  42650. changed = true;
  42651. if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
  42652. changed = true;
  42653. if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
  42654. changed = true;
  42655. if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
  42656. changed = true;
  42657. if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
  42658. changed = true;
  42659. if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
  42660. changed = true;
  42661. if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
  42662. changed = true;
  42663. if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
  42664. changed = true;
  42665. if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
  42666. changed = true;
  42667. if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
  42668. changed = true;
  42669. if (changed) {
  42670. var data = asPureExpressionData(view, def.nodeIndex);
  42671. var value = void 0;
  42672. switch (def.flags & 201347067 /* Types */) {
  42673. case 32 /* TypePureArray */:
  42674. value = new Array(bindings.length);
  42675. if (bindLen > 0)
  42676. value[0] = v0;
  42677. if (bindLen > 1)
  42678. value[1] = v1;
  42679. if (bindLen > 2)
  42680. value[2] = v2;
  42681. if (bindLen > 3)
  42682. value[3] = v3;
  42683. if (bindLen > 4)
  42684. value[4] = v4;
  42685. if (bindLen > 5)
  42686. value[5] = v5;
  42687. if (bindLen > 6)
  42688. value[6] = v6;
  42689. if (bindLen > 7)
  42690. value[7] = v7;
  42691. if (bindLen > 8)
  42692. value[8] = v8;
  42693. if (bindLen > 9)
  42694. value[9] = v9;
  42695. break;
  42696. case 64 /* TypePureObject */:
  42697. value = {};
  42698. if (bindLen > 0)
  42699. value[bindings[0].name] = v0;
  42700. if (bindLen > 1)
  42701. value[bindings[1].name] = v1;
  42702. if (bindLen > 2)
  42703. value[bindings[2].name] = v2;
  42704. if (bindLen > 3)
  42705. value[bindings[3].name] = v3;
  42706. if (bindLen > 4)
  42707. value[bindings[4].name] = v4;
  42708. if (bindLen > 5)
  42709. value[bindings[5].name] = v5;
  42710. if (bindLen > 6)
  42711. value[bindings[6].name] = v6;
  42712. if (bindLen > 7)
  42713. value[bindings[7].name] = v7;
  42714. if (bindLen > 8)
  42715. value[bindings[8].name] = v8;
  42716. if (bindLen > 9)
  42717. value[bindings[9].name] = v9;
  42718. break;
  42719. case 128 /* TypePurePipe */:
  42720. var pipe = v0;
  42721. switch (bindLen) {
  42722. case 1:
  42723. value = pipe.transform(v0);
  42724. break;
  42725. case 2:
  42726. value = pipe.transform(v1);
  42727. break;
  42728. case 3:
  42729. value = pipe.transform(v1, v2);
  42730. break;
  42731. case 4:
  42732. value = pipe.transform(v1, v2, v3);
  42733. break;
  42734. case 5:
  42735. value = pipe.transform(v1, v2, v3, v4);
  42736. break;
  42737. case 6:
  42738. value = pipe.transform(v1, v2, v3, v4, v5);
  42739. break;
  42740. case 7:
  42741. value = pipe.transform(v1, v2, v3, v4, v5, v6);
  42742. break;
  42743. case 8:
  42744. value = pipe.transform(v1, v2, v3, v4, v5, v6, v7);
  42745. break;
  42746. case 9:
  42747. value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8);
  42748. break;
  42749. case 10:
  42750. value = pipe.transform(v1, v2, v3, v4, v5, v6, v7, v8, v9);
  42751. break;
  42752. }
  42753. break;
  42754. }
  42755. data.value = value;
  42756. }
  42757. return changed;
  42758. }
  42759. function checkAndUpdatePureExpressionDynamic(view, def, values) {
  42760. var bindings = def.bindings;
  42761. var changed = false;
  42762. for (var i = 0; i < values.length; i++) {
  42763. // Note: We need to loop over all values, so that
  42764. // the old values are updates as well!
  42765. if (checkAndUpdateBinding(view, def, i, values[i])) {
  42766. changed = true;
  42767. }
  42768. }
  42769. if (changed) {
  42770. var data = asPureExpressionData(view, def.nodeIndex);
  42771. var value = void 0;
  42772. switch (def.flags & 201347067 /* Types */) {
  42773. case 32 /* TypePureArray */:
  42774. value = values;
  42775. break;
  42776. case 64 /* TypePureObject */:
  42777. value = {};
  42778. for (var i = 0; i < values.length; i++) {
  42779. value[bindings[i].name] = values[i];
  42780. }
  42781. break;
  42782. case 128 /* TypePurePipe */:
  42783. var pipe = values[0];
  42784. var params = values.slice(1);
  42785. value = pipe.transform.apply(pipe, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(params));
  42786. break;
  42787. }
  42788. data.value = value;
  42789. }
  42790. return changed;
  42791. }
  42792. /**
  42793. * @license
  42794. * Copyright Google Inc. All Rights Reserved.
  42795. *
  42796. * Use of this source code is governed by an MIT-style license that can be
  42797. * found in the LICENSE file at https://angular.io/license
  42798. */
  42799. function textDef(checkIndex, ngContentIndex, staticText) {
  42800. var bindings = new Array(staticText.length - 1);
  42801. for (var i = 1; i < staticText.length; i++) {
  42802. bindings[i - 1] = {
  42803. flags: 8 /* TypeProperty */,
  42804. name: null,
  42805. ns: null,
  42806. nonMinifiedName: null,
  42807. securityContext: null,
  42808. suffix: staticText[i],
  42809. };
  42810. }
  42811. return {
  42812. // will bet set by the view definition
  42813. nodeIndex: -1,
  42814. parent: null,
  42815. renderParent: null,
  42816. bindingIndex: -1,
  42817. outputIndex: -1,
  42818. // regular values
  42819. checkIndex: checkIndex,
  42820. flags: 2 /* TypeText */,
  42821. childFlags: 0,
  42822. directChildFlags: 0,
  42823. childMatchedQueries: 0,
  42824. matchedQueries: {},
  42825. matchedQueryIds: 0,
  42826. references: {}, ngContentIndex: ngContentIndex,
  42827. childCount: 0, bindings: bindings,
  42828. bindingFlags: 8 /* TypeProperty */,
  42829. outputs: [],
  42830. element: null,
  42831. provider: null,
  42832. text: { prefix: staticText[0] },
  42833. query: null,
  42834. ngContent: null,
  42835. };
  42836. }
  42837. function createText(view, renderHost, def) {
  42838. var renderNode$$1;
  42839. var renderer = view.renderer;
  42840. renderNode$$1 = renderer.createText(def.text.prefix);
  42841. var parentEl = getParentRenderElement(view, renderHost, def);
  42842. if (parentEl) {
  42843. renderer.appendChild(parentEl, renderNode$$1);
  42844. }
  42845. return { renderText: renderNode$$1 };
  42846. }
  42847. function checkAndUpdateTextInline(view, def, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  42848. var changed = false;
  42849. var bindings = def.bindings;
  42850. var bindLen = bindings.length;
  42851. if (bindLen > 0 && checkAndUpdateBinding(view, def, 0, v0))
  42852. changed = true;
  42853. if (bindLen > 1 && checkAndUpdateBinding(view, def, 1, v1))
  42854. changed = true;
  42855. if (bindLen > 2 && checkAndUpdateBinding(view, def, 2, v2))
  42856. changed = true;
  42857. if (bindLen > 3 && checkAndUpdateBinding(view, def, 3, v3))
  42858. changed = true;
  42859. if (bindLen > 4 && checkAndUpdateBinding(view, def, 4, v4))
  42860. changed = true;
  42861. if (bindLen > 5 && checkAndUpdateBinding(view, def, 5, v5))
  42862. changed = true;
  42863. if (bindLen > 6 && checkAndUpdateBinding(view, def, 6, v6))
  42864. changed = true;
  42865. if (bindLen > 7 && checkAndUpdateBinding(view, def, 7, v7))
  42866. changed = true;
  42867. if (bindLen > 8 && checkAndUpdateBinding(view, def, 8, v8))
  42868. changed = true;
  42869. if (bindLen > 9 && checkAndUpdateBinding(view, def, 9, v9))
  42870. changed = true;
  42871. if (changed) {
  42872. var value = def.text.prefix;
  42873. if (bindLen > 0)
  42874. value += _addInterpolationPart(v0, bindings[0]);
  42875. if (bindLen > 1)
  42876. value += _addInterpolationPart(v1, bindings[1]);
  42877. if (bindLen > 2)
  42878. value += _addInterpolationPart(v2, bindings[2]);
  42879. if (bindLen > 3)
  42880. value += _addInterpolationPart(v3, bindings[3]);
  42881. if (bindLen > 4)
  42882. value += _addInterpolationPart(v4, bindings[4]);
  42883. if (bindLen > 5)
  42884. value += _addInterpolationPart(v5, bindings[5]);
  42885. if (bindLen > 6)
  42886. value += _addInterpolationPart(v6, bindings[6]);
  42887. if (bindLen > 7)
  42888. value += _addInterpolationPart(v7, bindings[7]);
  42889. if (bindLen > 8)
  42890. value += _addInterpolationPart(v8, bindings[8]);
  42891. if (bindLen > 9)
  42892. value += _addInterpolationPart(v9, bindings[9]);
  42893. var renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
  42894. view.renderer.setValue(renderNode$$1, value);
  42895. }
  42896. return changed;
  42897. }
  42898. function checkAndUpdateTextDynamic(view, def, values) {
  42899. var bindings = def.bindings;
  42900. var changed = false;
  42901. for (var i = 0; i < values.length; i++) {
  42902. // Note: We need to loop over all values, so that
  42903. // the old values are updates as well!
  42904. if (checkAndUpdateBinding(view, def, i, values[i])) {
  42905. changed = true;
  42906. }
  42907. }
  42908. if (changed) {
  42909. var value = '';
  42910. for (var i = 0; i < values.length; i++) {
  42911. value = value + _addInterpolationPart(values[i], bindings[i]);
  42912. }
  42913. value = def.text.prefix + value;
  42914. var renderNode$$1 = asTextData(view, def.nodeIndex).renderText;
  42915. view.renderer.setValue(renderNode$$1, value);
  42916. }
  42917. return changed;
  42918. }
  42919. function _addInterpolationPart(value, binding) {
  42920. var valueStr = value != null ? value.toString() : '';
  42921. return valueStr + binding.suffix;
  42922. }
  42923. /**
  42924. * @license
  42925. * Copyright Google Inc. All Rights Reserved.
  42926. *
  42927. * Use of this source code is governed by an MIT-style license that can be
  42928. * found in the LICENSE file at https://angular.io/license
  42929. */
  42930. function viewDef(flags, nodes, updateDirectives, updateRenderer) {
  42931. // clone nodes and set auto calculated values
  42932. var viewBindingCount = 0;
  42933. var viewDisposableCount = 0;
  42934. var viewNodeFlags = 0;
  42935. var viewRootNodeFlags = 0;
  42936. var viewMatchedQueries = 0;
  42937. var currentParent = null;
  42938. var currentRenderParent = null;
  42939. var currentElementHasPublicProviders = false;
  42940. var currentElementHasPrivateProviders = false;
  42941. var lastRenderRootNode = null;
  42942. for (var i = 0; i < nodes.length; i++) {
  42943. var node = nodes[i];
  42944. node.nodeIndex = i;
  42945. node.parent = currentParent;
  42946. node.bindingIndex = viewBindingCount;
  42947. node.outputIndex = viewDisposableCount;
  42948. node.renderParent = currentRenderParent;
  42949. viewNodeFlags |= node.flags;
  42950. viewMatchedQueries |= node.matchedQueryIds;
  42951. if (node.element) {
  42952. var elDef = node.element;
  42953. elDef.publicProviders =
  42954. currentParent ? currentParent.element.publicProviders : Object.create(null);
  42955. elDef.allProviders = elDef.publicProviders;
  42956. // Note: We assume that all providers of an element are before any child element!
  42957. currentElementHasPublicProviders = false;
  42958. currentElementHasPrivateProviders = false;
  42959. if (node.element.template) {
  42960. viewMatchedQueries |= node.element.template.nodeMatchedQueries;
  42961. }
  42962. }
  42963. validateNode(currentParent, node, nodes.length);
  42964. viewBindingCount += node.bindings.length;
  42965. viewDisposableCount += node.outputs.length;
  42966. if (!currentRenderParent && (node.flags & 3 /* CatRenderNode */)) {
  42967. lastRenderRootNode = node;
  42968. }
  42969. if (node.flags & 20224 /* CatProvider */) {
  42970. if (!currentElementHasPublicProviders) {
  42971. currentElementHasPublicProviders = true;
  42972. // Use prototypical inheritance to not get O(n^2) complexity...
  42973. currentParent.element.publicProviders =
  42974. Object.create(currentParent.element.publicProviders);
  42975. currentParent.element.allProviders = currentParent.element.publicProviders;
  42976. }
  42977. var isPrivateService = (node.flags & 8192 /* PrivateProvider */) !== 0;
  42978. var isComponent = (node.flags & 32768 /* Component */) !== 0;
  42979. if (!isPrivateService || isComponent) {
  42980. currentParent.element.publicProviders[tokenKey(node.provider.token)] = node;
  42981. }
  42982. else {
  42983. if (!currentElementHasPrivateProviders) {
  42984. currentElementHasPrivateProviders = true;
  42985. // Use prototypical inheritance to not get O(n^2) complexity...
  42986. currentParent.element.allProviders =
  42987. Object.create(currentParent.element.publicProviders);
  42988. }
  42989. currentParent.element.allProviders[tokenKey(node.provider.token)] = node;
  42990. }
  42991. if (isComponent) {
  42992. currentParent.element.componentProvider = node;
  42993. }
  42994. }
  42995. if (currentParent) {
  42996. currentParent.childFlags |= node.flags;
  42997. currentParent.directChildFlags |= node.flags;
  42998. currentParent.childMatchedQueries |= node.matchedQueryIds;
  42999. if (node.element && node.element.template) {
  43000. currentParent.childMatchedQueries |= node.element.template.nodeMatchedQueries;
  43001. }
  43002. }
  43003. else {
  43004. viewRootNodeFlags |= node.flags;
  43005. }
  43006. if (node.childCount > 0) {
  43007. currentParent = node;
  43008. if (!isNgContainer(node)) {
  43009. currentRenderParent = node;
  43010. }
  43011. }
  43012. else {
  43013. // When the current node has no children, check if it is the last children of its parent.
  43014. // When it is, propagate the flags up.
  43015. // The loop is required because an element could be the last transitive children of several
  43016. // elements. We loop to either the root or the highest opened element (= with remaining
  43017. // children)
  43018. while (currentParent && i === currentParent.nodeIndex + currentParent.childCount) {
  43019. var newParent = currentParent.parent;
  43020. if (newParent) {
  43021. newParent.childFlags |= currentParent.childFlags;
  43022. newParent.childMatchedQueries |= currentParent.childMatchedQueries;
  43023. }
  43024. currentParent = newParent;
  43025. // We also need to update the render parent & account for ng-container
  43026. if (currentParent && isNgContainer(currentParent)) {
  43027. currentRenderParent = currentParent.renderParent;
  43028. }
  43029. else {
  43030. currentRenderParent = currentParent;
  43031. }
  43032. }
  43033. }
  43034. }
  43035. var handleEvent = function (view, nodeIndex, eventName, event) {
  43036. return nodes[nodeIndex].element.handleEvent(view, eventName, event);
  43037. };
  43038. return {
  43039. // Will be filled later...
  43040. factory: null,
  43041. nodeFlags: viewNodeFlags,
  43042. rootNodeFlags: viewRootNodeFlags,
  43043. nodeMatchedQueries: viewMatchedQueries, flags: flags,
  43044. nodes: nodes,
  43045. updateDirectives: updateDirectives || NOOP,
  43046. updateRenderer: updateRenderer || NOOP, handleEvent: handleEvent,
  43047. bindingCount: viewBindingCount,
  43048. outputCount: viewDisposableCount, lastRenderRootNode: lastRenderRootNode
  43049. };
  43050. }
  43051. function isNgContainer(node) {
  43052. return (node.flags & 1 /* TypeElement */) !== 0 && node.element.name === null;
  43053. }
  43054. function validateNode(parent, node, nodeCount) {
  43055. var template = node.element && node.element.template;
  43056. if (template) {
  43057. if (!template.lastRenderRootNode) {
  43058. throw new Error("Illegal State: Embedded templates without nodes are not allowed!");
  43059. }
  43060. if (template.lastRenderRootNode &&
  43061. template.lastRenderRootNode.flags & 16777216 /* EmbeddedViews */) {
  43062. throw new Error("Illegal State: Last root node of a template can't have embedded views, at index " + node.nodeIndex + "!");
  43063. }
  43064. }
  43065. if (node.flags & 20224 /* CatProvider */) {
  43066. var parentFlags = parent ? parent.flags : 0;
  43067. if ((parentFlags & 1 /* TypeElement */) === 0) {
  43068. throw new Error("Illegal State: StaticProvider/Directive nodes need to be children of elements or anchors, at index " + node.nodeIndex + "!");
  43069. }
  43070. }
  43071. if (node.query) {
  43072. if (node.flags & 67108864 /* TypeContentQuery */ &&
  43073. (!parent || (parent.flags & 16384 /* TypeDirective */) === 0)) {
  43074. throw new Error("Illegal State: Content Query nodes need to be children of directives, at index " + node.nodeIndex + "!");
  43075. }
  43076. if (node.flags & 134217728 /* TypeViewQuery */ && parent) {
  43077. throw new Error("Illegal State: View Query nodes have to be top level nodes, at index " + node.nodeIndex + "!");
  43078. }
  43079. }
  43080. if (node.childCount) {
  43081. var parentEnd = parent ? parent.nodeIndex + parent.childCount : nodeCount - 1;
  43082. if (node.nodeIndex <= parentEnd && node.nodeIndex + node.childCount > parentEnd) {
  43083. throw new Error("Illegal State: childCount of node leads outside of parent, at index " + node.nodeIndex + "!");
  43084. }
  43085. }
  43086. }
  43087. function createEmbeddedView(parent, anchorDef$$1, viewDef, context) {
  43088. // embedded views are seen as siblings to the anchor, so we need
  43089. // to get the parent of the anchor and use it as parentIndex.
  43090. var view = createView(parent.root, parent.renderer, parent, anchorDef$$1, viewDef);
  43091. initView(view, parent.component, context);
  43092. createViewNodes(view);
  43093. return view;
  43094. }
  43095. function createRootView(root, def, context) {
  43096. var view = createView(root, root.renderer, null, null, def);
  43097. initView(view, context, context);
  43098. createViewNodes(view);
  43099. return view;
  43100. }
  43101. function createComponentView(parentView, nodeDef, viewDef, hostElement) {
  43102. var rendererType = nodeDef.element.componentRendererType;
  43103. var compRenderer;
  43104. if (!rendererType) {
  43105. compRenderer = parentView.root.renderer;
  43106. }
  43107. else {
  43108. compRenderer = parentView.root.rendererFactory.createRenderer(hostElement, rendererType);
  43109. }
  43110. return createView(parentView.root, compRenderer, parentView, nodeDef.element.componentProvider, viewDef);
  43111. }
  43112. function createView(root, renderer, parent, parentNodeDef, def) {
  43113. var nodes = new Array(def.nodes.length);
  43114. var disposables = def.outputCount ? new Array(def.outputCount) : null;
  43115. var view = {
  43116. def: def,
  43117. parent: parent,
  43118. viewContainerParent: null, parentNodeDef: parentNodeDef,
  43119. context: null,
  43120. component: null, nodes: nodes,
  43121. state: 13 /* CatInit */, root: root, renderer: renderer,
  43122. oldValues: new Array(def.bindingCount), disposables: disposables,
  43123. initIndex: -1
  43124. };
  43125. return view;
  43126. }
  43127. function initView(view, component, context) {
  43128. view.component = component;
  43129. view.context = context;
  43130. }
  43131. function createViewNodes(view) {
  43132. var renderHost;
  43133. if (isComponentView(view)) {
  43134. var hostDef = view.parentNodeDef;
  43135. renderHost = asElementData(view.parent, hostDef.parent.nodeIndex).renderElement;
  43136. }
  43137. var def = view.def;
  43138. var nodes = view.nodes;
  43139. for (var i = 0; i < def.nodes.length; i++) {
  43140. var nodeDef = def.nodes[i];
  43141. Services.setCurrentNode(view, i);
  43142. var nodeData = void 0;
  43143. switch (nodeDef.flags & 201347067 /* Types */) {
  43144. case 1 /* TypeElement */:
  43145. var el = createElement(view, renderHost, nodeDef);
  43146. var componentView = undefined;
  43147. if (nodeDef.flags & 33554432 /* ComponentView */) {
  43148. var compViewDef = resolveDefinition(nodeDef.element.componentView);
  43149. componentView = Services.createComponentView(view, nodeDef, compViewDef, el);
  43150. }
  43151. listenToElementOutputs(view, componentView, nodeDef, el);
  43152. nodeData = {
  43153. renderElement: el,
  43154. componentView: componentView,
  43155. viewContainer: null,
  43156. template: nodeDef.element.template ? createTemplateData(view, nodeDef) : undefined
  43157. };
  43158. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  43159. nodeData.viewContainer = createViewContainerData(view, nodeDef, nodeData);
  43160. }
  43161. break;
  43162. case 2 /* TypeText */:
  43163. nodeData = createText(view, renderHost, nodeDef);
  43164. break;
  43165. case 512 /* TypeClassProvider */:
  43166. case 1024 /* TypeFactoryProvider */:
  43167. case 2048 /* TypeUseExistingProvider */:
  43168. case 256 /* TypeValueProvider */: {
  43169. nodeData = nodes[i];
  43170. if (!nodeData && !(nodeDef.flags & 4096 /* LazyProvider */)) {
  43171. var instance = createProviderInstance(view, nodeDef);
  43172. nodeData = { instance: instance };
  43173. }
  43174. break;
  43175. }
  43176. case 16 /* TypePipe */: {
  43177. var instance = createPipeInstance(view, nodeDef);
  43178. nodeData = { instance: instance };
  43179. break;
  43180. }
  43181. case 16384 /* TypeDirective */: {
  43182. nodeData = nodes[i];
  43183. if (!nodeData) {
  43184. var instance = createDirectiveInstance(view, nodeDef);
  43185. nodeData = { instance: instance };
  43186. }
  43187. if (nodeDef.flags & 32768 /* Component */) {
  43188. var compView = asElementData(view, nodeDef.parent.nodeIndex).componentView;
  43189. initView(compView, nodeData.instance, nodeData.instance);
  43190. }
  43191. break;
  43192. }
  43193. case 32 /* TypePureArray */:
  43194. case 64 /* TypePureObject */:
  43195. case 128 /* TypePurePipe */:
  43196. nodeData = createPureExpression(view, nodeDef);
  43197. break;
  43198. case 67108864 /* TypeContentQuery */:
  43199. case 134217728 /* TypeViewQuery */:
  43200. nodeData = createQuery();
  43201. break;
  43202. case 8 /* TypeNgContent */:
  43203. appendNgContent(view, renderHost, nodeDef);
  43204. // no runtime data needed for NgContent...
  43205. nodeData = undefined;
  43206. break;
  43207. }
  43208. nodes[i] = nodeData;
  43209. }
  43210. // Create the ViewData.nodes of component views after we created everything else,
  43211. // so that e.g. ng-content works
  43212. execComponentViewsAction(view, ViewAction.CreateViewNodes);
  43213. // fill static content and view queries
  43214. execQueriesAction(view, 67108864 /* TypeContentQuery */ | 134217728 /* TypeViewQuery */, 268435456 /* StaticQuery */, 0 /* CheckAndUpdate */);
  43215. }
  43216. function checkNoChangesView(view) {
  43217. markProjectedViewsForCheck(view);
  43218. Services.updateDirectives(view, 1 /* CheckNoChanges */);
  43219. execEmbeddedViewsAction(view, ViewAction.CheckNoChanges);
  43220. Services.updateRenderer(view, 1 /* CheckNoChanges */);
  43221. execComponentViewsAction(view, ViewAction.CheckNoChanges);
  43222. // Note: We don't check queries for changes as we didn't do this in v2.x.
  43223. // TODO(tbosch): investigate if we can enable the check again in v5.x with a nicer error message.
  43224. view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
  43225. }
  43226. function checkAndUpdateView(view) {
  43227. if (view.state & 1 /* BeforeFirstCheck */) {
  43228. view.state &= ~1 /* BeforeFirstCheck */;
  43229. view.state |= 2 /* FirstCheck */;
  43230. }
  43231. else {
  43232. view.state &= ~2 /* FirstCheck */;
  43233. }
  43234. shiftInitState(view, 0 /* InitState_BeforeInit */, 256 /* InitState_CallingOnInit */);
  43235. markProjectedViewsForCheck(view);
  43236. Services.updateDirectives(view, 0 /* CheckAndUpdate */);
  43237. execEmbeddedViewsAction(view, ViewAction.CheckAndUpdate);
  43238. execQueriesAction(view, 67108864 /* TypeContentQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
  43239. var callInit = shiftInitState(view, 256 /* InitState_CallingOnInit */, 512 /* InitState_CallingAfterContentInit */);
  43240. callLifecycleHooksChildrenFirst(view, 2097152 /* AfterContentChecked */ | (callInit ? 1048576 /* AfterContentInit */ : 0));
  43241. Services.updateRenderer(view, 0 /* CheckAndUpdate */);
  43242. execComponentViewsAction(view, ViewAction.CheckAndUpdate);
  43243. execQueriesAction(view, 134217728 /* TypeViewQuery */, 536870912 /* DynamicQuery */, 0 /* CheckAndUpdate */);
  43244. callInit = shiftInitState(view, 512 /* InitState_CallingAfterContentInit */, 768 /* InitState_CallingAfterViewInit */);
  43245. callLifecycleHooksChildrenFirst(view, 8388608 /* AfterViewChecked */ | (callInit ? 4194304 /* AfterViewInit */ : 0));
  43246. if (view.def.flags & 2 /* OnPush */) {
  43247. view.state &= ~8 /* ChecksEnabled */;
  43248. }
  43249. view.state &= ~(64 /* CheckProjectedViews */ | 32 /* CheckProjectedView */);
  43250. shiftInitState(view, 768 /* InitState_CallingAfterViewInit */, 1024 /* InitState_AfterInit */);
  43251. }
  43252. function checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  43253. if (argStyle === 0 /* Inline */) {
  43254. return checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43255. }
  43256. else {
  43257. return checkAndUpdateNodeDynamic(view, nodeDef, v0);
  43258. }
  43259. }
  43260. function markProjectedViewsForCheck(view) {
  43261. var def = view.def;
  43262. if (!(def.nodeFlags & 4 /* ProjectedTemplate */)) {
  43263. return;
  43264. }
  43265. for (var i = 0; i < def.nodes.length; i++) {
  43266. var nodeDef = def.nodes[i];
  43267. if (nodeDef.flags & 4 /* ProjectedTemplate */) {
  43268. var projectedViews = asElementData(view, i).template._projectedViews;
  43269. if (projectedViews) {
  43270. for (var i_1 = 0; i_1 < projectedViews.length; i_1++) {
  43271. var projectedView = projectedViews[i_1];
  43272. projectedView.state |= 32 /* CheckProjectedView */;
  43273. markParentViewsForCheckProjectedViews(projectedView, view);
  43274. }
  43275. }
  43276. }
  43277. else if ((nodeDef.childFlags & 4 /* ProjectedTemplate */) === 0) {
  43278. // a parent with leafs
  43279. // no child is a component,
  43280. // then skip the children
  43281. i += nodeDef.childCount;
  43282. }
  43283. }
  43284. }
  43285. function checkAndUpdateNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  43286. switch (nodeDef.flags & 201347067 /* Types */) {
  43287. case 1 /* TypeElement */:
  43288. return checkAndUpdateElementInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43289. case 2 /* TypeText */:
  43290. return checkAndUpdateTextInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43291. case 16384 /* TypeDirective */:
  43292. return checkAndUpdateDirectiveInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43293. case 32 /* TypePureArray */:
  43294. case 64 /* TypePureObject */:
  43295. case 128 /* TypePurePipe */:
  43296. return checkAndUpdatePureExpressionInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43297. default:
  43298. throw 'unreachable';
  43299. }
  43300. }
  43301. function checkAndUpdateNodeDynamic(view, nodeDef, values) {
  43302. switch (nodeDef.flags & 201347067 /* Types */) {
  43303. case 1 /* TypeElement */:
  43304. return checkAndUpdateElementDynamic(view, nodeDef, values);
  43305. case 2 /* TypeText */:
  43306. return checkAndUpdateTextDynamic(view, nodeDef, values);
  43307. case 16384 /* TypeDirective */:
  43308. return checkAndUpdateDirectiveDynamic(view, nodeDef, values);
  43309. case 32 /* TypePureArray */:
  43310. case 64 /* TypePureObject */:
  43311. case 128 /* TypePurePipe */:
  43312. return checkAndUpdatePureExpressionDynamic(view, nodeDef, values);
  43313. default:
  43314. throw 'unreachable';
  43315. }
  43316. }
  43317. function checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  43318. if (argStyle === 0 /* Inline */) {
  43319. checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43320. }
  43321. else {
  43322. checkNoChangesNodeDynamic(view, nodeDef, v0);
  43323. }
  43324. // Returning false is ok here as we would have thrown in case of a change.
  43325. return false;
  43326. }
  43327. function checkNoChangesNodeInline(view, nodeDef, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  43328. var bindLen = nodeDef.bindings.length;
  43329. if (bindLen > 0)
  43330. checkBindingNoChanges(view, nodeDef, 0, v0);
  43331. if (bindLen > 1)
  43332. checkBindingNoChanges(view, nodeDef, 1, v1);
  43333. if (bindLen > 2)
  43334. checkBindingNoChanges(view, nodeDef, 2, v2);
  43335. if (bindLen > 3)
  43336. checkBindingNoChanges(view, nodeDef, 3, v3);
  43337. if (bindLen > 4)
  43338. checkBindingNoChanges(view, nodeDef, 4, v4);
  43339. if (bindLen > 5)
  43340. checkBindingNoChanges(view, nodeDef, 5, v5);
  43341. if (bindLen > 6)
  43342. checkBindingNoChanges(view, nodeDef, 6, v6);
  43343. if (bindLen > 7)
  43344. checkBindingNoChanges(view, nodeDef, 7, v7);
  43345. if (bindLen > 8)
  43346. checkBindingNoChanges(view, nodeDef, 8, v8);
  43347. if (bindLen > 9)
  43348. checkBindingNoChanges(view, nodeDef, 9, v9);
  43349. }
  43350. function checkNoChangesNodeDynamic(view, nodeDef, values) {
  43351. for (var i = 0; i < values.length; i++) {
  43352. checkBindingNoChanges(view, nodeDef, i, values[i]);
  43353. }
  43354. }
  43355. /**
  43356. * Workaround https://github.com/angular/tsickle/issues/497
  43357. * @suppress {misplacedTypeAnnotation}
  43358. */
  43359. function checkNoChangesQuery(view, nodeDef) {
  43360. var queryList = asQueryList(view, nodeDef.nodeIndex);
  43361. if (queryList.dirty) {
  43362. throw expressionChangedAfterItHasBeenCheckedError(Services.createDebugContext(view, nodeDef.nodeIndex), "Query " + nodeDef.query.id + " not dirty", "Query " + nodeDef.query.id + " dirty", (view.state & 1 /* BeforeFirstCheck */) !== 0);
  43363. }
  43364. }
  43365. function destroyView(view) {
  43366. if (view.state & 128 /* Destroyed */) {
  43367. return;
  43368. }
  43369. execEmbeddedViewsAction(view, ViewAction.Destroy);
  43370. execComponentViewsAction(view, ViewAction.Destroy);
  43371. callLifecycleHooksChildrenFirst(view, 131072 /* OnDestroy */);
  43372. if (view.disposables) {
  43373. for (var i = 0; i < view.disposables.length; i++) {
  43374. view.disposables[i]();
  43375. }
  43376. }
  43377. detachProjectedView(view);
  43378. if (view.renderer.destroyNode) {
  43379. destroyViewNodes(view);
  43380. }
  43381. if (isComponentView(view)) {
  43382. view.renderer.destroy();
  43383. }
  43384. view.state |= 128 /* Destroyed */;
  43385. }
  43386. function destroyViewNodes(view) {
  43387. var len = view.def.nodes.length;
  43388. for (var i = 0; i < len; i++) {
  43389. var def = view.def.nodes[i];
  43390. if (def.flags & 1 /* TypeElement */) {
  43391. view.renderer.destroyNode(asElementData(view, i).renderElement);
  43392. }
  43393. else if (def.flags & 2 /* TypeText */) {
  43394. view.renderer.destroyNode(asTextData(view, i).renderText);
  43395. }
  43396. else if (def.flags & 67108864 /* TypeContentQuery */ || def.flags & 134217728 /* TypeViewQuery */) {
  43397. asQueryList(view, i).destroy();
  43398. }
  43399. }
  43400. }
  43401. var ViewAction;
  43402. (function (ViewAction) {
  43403. ViewAction[ViewAction["CreateViewNodes"] = 0] = "CreateViewNodes";
  43404. ViewAction[ViewAction["CheckNoChanges"] = 1] = "CheckNoChanges";
  43405. ViewAction[ViewAction["CheckNoChangesProjectedViews"] = 2] = "CheckNoChangesProjectedViews";
  43406. ViewAction[ViewAction["CheckAndUpdate"] = 3] = "CheckAndUpdate";
  43407. ViewAction[ViewAction["CheckAndUpdateProjectedViews"] = 4] = "CheckAndUpdateProjectedViews";
  43408. ViewAction[ViewAction["Destroy"] = 5] = "Destroy";
  43409. })(ViewAction || (ViewAction = {}));
  43410. function execComponentViewsAction(view, action) {
  43411. var def = view.def;
  43412. if (!(def.nodeFlags & 33554432 /* ComponentView */)) {
  43413. return;
  43414. }
  43415. for (var i = 0; i < def.nodes.length; i++) {
  43416. var nodeDef = def.nodes[i];
  43417. if (nodeDef.flags & 33554432 /* ComponentView */) {
  43418. // a leaf
  43419. callViewAction(asElementData(view, i).componentView, action);
  43420. }
  43421. else if ((nodeDef.childFlags & 33554432 /* ComponentView */) === 0) {
  43422. // a parent with leafs
  43423. // no child is a component,
  43424. // then skip the children
  43425. i += nodeDef.childCount;
  43426. }
  43427. }
  43428. }
  43429. function execEmbeddedViewsAction(view, action) {
  43430. var def = view.def;
  43431. if (!(def.nodeFlags & 16777216 /* EmbeddedViews */)) {
  43432. return;
  43433. }
  43434. for (var i = 0; i < def.nodes.length; i++) {
  43435. var nodeDef = def.nodes[i];
  43436. if (nodeDef.flags & 16777216 /* EmbeddedViews */) {
  43437. // a leaf
  43438. var embeddedViews = asElementData(view, i).viewContainer._embeddedViews;
  43439. for (var k = 0; k < embeddedViews.length; k++) {
  43440. callViewAction(embeddedViews[k], action);
  43441. }
  43442. }
  43443. else if ((nodeDef.childFlags & 16777216 /* EmbeddedViews */) === 0) {
  43444. // a parent with leafs
  43445. // no child is a component,
  43446. // then skip the children
  43447. i += nodeDef.childCount;
  43448. }
  43449. }
  43450. }
  43451. function callViewAction(view, action) {
  43452. var viewState = view.state;
  43453. switch (action) {
  43454. case ViewAction.CheckNoChanges:
  43455. if ((viewState & 128 /* Destroyed */) === 0) {
  43456. if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
  43457. checkNoChangesView(view);
  43458. }
  43459. else if (viewState & 64 /* CheckProjectedViews */) {
  43460. execProjectedViewsAction(view, ViewAction.CheckNoChangesProjectedViews);
  43461. }
  43462. }
  43463. break;
  43464. case ViewAction.CheckNoChangesProjectedViews:
  43465. if ((viewState & 128 /* Destroyed */) === 0) {
  43466. if (viewState & 32 /* CheckProjectedView */) {
  43467. checkNoChangesView(view);
  43468. }
  43469. else if (viewState & 64 /* CheckProjectedViews */) {
  43470. execProjectedViewsAction(view, action);
  43471. }
  43472. }
  43473. break;
  43474. case ViewAction.CheckAndUpdate:
  43475. if ((viewState & 128 /* Destroyed */) === 0) {
  43476. if ((viewState & 12 /* CatDetectChanges */) === 12 /* CatDetectChanges */) {
  43477. checkAndUpdateView(view);
  43478. }
  43479. else if (viewState & 64 /* CheckProjectedViews */) {
  43480. execProjectedViewsAction(view, ViewAction.CheckAndUpdateProjectedViews);
  43481. }
  43482. }
  43483. break;
  43484. case ViewAction.CheckAndUpdateProjectedViews:
  43485. if ((viewState & 128 /* Destroyed */) === 0) {
  43486. if (viewState & 32 /* CheckProjectedView */) {
  43487. checkAndUpdateView(view);
  43488. }
  43489. else if (viewState & 64 /* CheckProjectedViews */) {
  43490. execProjectedViewsAction(view, action);
  43491. }
  43492. }
  43493. break;
  43494. case ViewAction.Destroy:
  43495. // Note: destroyView recurses over all views,
  43496. // so we don't need to special case projected views here.
  43497. destroyView(view);
  43498. break;
  43499. case ViewAction.CreateViewNodes:
  43500. createViewNodes(view);
  43501. break;
  43502. }
  43503. }
  43504. function execProjectedViewsAction(view, action) {
  43505. execEmbeddedViewsAction(view, action);
  43506. execComponentViewsAction(view, action);
  43507. }
  43508. function execQueriesAction(view, queryFlags, staticDynamicQueryFlag, checkType) {
  43509. if (!(view.def.nodeFlags & queryFlags) || !(view.def.nodeFlags & staticDynamicQueryFlag)) {
  43510. return;
  43511. }
  43512. var nodeCount = view.def.nodes.length;
  43513. for (var i = 0; i < nodeCount; i++) {
  43514. var nodeDef = view.def.nodes[i];
  43515. if ((nodeDef.flags & queryFlags) && (nodeDef.flags & staticDynamicQueryFlag)) {
  43516. Services.setCurrentNode(view, nodeDef.nodeIndex);
  43517. switch (checkType) {
  43518. case 0 /* CheckAndUpdate */:
  43519. checkAndUpdateQuery(view, nodeDef);
  43520. break;
  43521. case 1 /* CheckNoChanges */:
  43522. checkNoChangesQuery(view, nodeDef);
  43523. break;
  43524. }
  43525. }
  43526. if (!(nodeDef.childFlags & queryFlags) || !(nodeDef.childFlags & staticDynamicQueryFlag)) {
  43527. // no child has a matching query
  43528. // then skip the children
  43529. i += nodeDef.childCount;
  43530. }
  43531. }
  43532. }
  43533. /**
  43534. * @license
  43535. * Copyright Google Inc. All Rights Reserved.
  43536. *
  43537. * Use of this source code is governed by an MIT-style license that can be
  43538. * found in the LICENSE file at https://angular.io/license
  43539. */
  43540. var initialized = false;
  43541. function initServicesIfNeeded() {
  43542. if (initialized) {
  43543. return;
  43544. }
  43545. initialized = true;
  43546. var services = isDevMode() ? createDebugServices() : createProdServices();
  43547. Services.setCurrentNode = services.setCurrentNode;
  43548. Services.createRootView = services.createRootView;
  43549. Services.createEmbeddedView = services.createEmbeddedView;
  43550. Services.createComponentView = services.createComponentView;
  43551. Services.createNgModuleRef = services.createNgModuleRef;
  43552. Services.overrideProvider = services.overrideProvider;
  43553. Services.overrideComponentView = services.overrideComponentView;
  43554. Services.clearOverrides = services.clearOverrides;
  43555. Services.checkAndUpdateView = services.checkAndUpdateView;
  43556. Services.checkNoChangesView = services.checkNoChangesView;
  43557. Services.destroyView = services.destroyView;
  43558. Services.resolveDep = resolveDep;
  43559. Services.createDebugContext = services.createDebugContext;
  43560. Services.handleEvent = services.handleEvent;
  43561. Services.updateDirectives = services.updateDirectives;
  43562. Services.updateRenderer = services.updateRenderer;
  43563. Services.dirtyParentQueries = dirtyParentQueries;
  43564. }
  43565. function createProdServices() {
  43566. return {
  43567. setCurrentNode: function () { },
  43568. createRootView: createProdRootView,
  43569. createEmbeddedView: createEmbeddedView,
  43570. createComponentView: createComponentView,
  43571. createNgModuleRef: createNgModuleRef,
  43572. overrideProvider: NOOP,
  43573. overrideComponentView: NOOP,
  43574. clearOverrides: NOOP,
  43575. checkAndUpdateView: checkAndUpdateView,
  43576. checkNoChangesView: checkNoChangesView,
  43577. destroyView: destroyView,
  43578. createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
  43579. handleEvent: function (view, nodeIndex, eventName, event) {
  43580. return view.def.handleEvent(view, nodeIndex, eventName, event);
  43581. },
  43582. updateDirectives: function (view, checkType) { return view.def.updateDirectives(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
  43583. prodCheckNoChangesNode, view); },
  43584. updateRenderer: function (view, checkType) { return view.def.updateRenderer(checkType === 0 /* CheckAndUpdate */ ? prodCheckAndUpdateNode :
  43585. prodCheckNoChangesNode, view); },
  43586. };
  43587. }
  43588. function createDebugServices() {
  43589. return {
  43590. setCurrentNode: debugSetCurrentNode,
  43591. createRootView: debugCreateRootView,
  43592. createEmbeddedView: debugCreateEmbeddedView,
  43593. createComponentView: debugCreateComponentView,
  43594. createNgModuleRef: debugCreateNgModuleRef,
  43595. overrideProvider: debugOverrideProvider,
  43596. overrideComponentView: debugOverrideComponentView,
  43597. clearOverrides: debugClearOverrides,
  43598. checkAndUpdateView: debugCheckAndUpdateView,
  43599. checkNoChangesView: debugCheckNoChangesView,
  43600. destroyView: debugDestroyView,
  43601. createDebugContext: function (view, nodeIndex) { return new DebugContext_(view, nodeIndex); },
  43602. handleEvent: debugHandleEvent,
  43603. updateDirectives: debugUpdateDirectives,
  43604. updateRenderer: debugUpdateRenderer,
  43605. };
  43606. }
  43607. function createProdRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
  43608. var rendererFactory = ngModule.injector.get(RendererFactory2);
  43609. return createRootView(createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode), def, context);
  43610. }
  43611. function debugCreateRootView(elInjector, projectableNodes, rootSelectorOrNode, def, ngModule, context) {
  43612. var rendererFactory = ngModule.injector.get(RendererFactory2);
  43613. var root = createRootData(elInjector, ngModule, new DebugRendererFactory2(rendererFactory), projectableNodes, rootSelectorOrNode);
  43614. var defWithOverride = applyProviderOverridesToView(def);
  43615. return callWithDebugContext(DebugAction.create, createRootView, null, [root, defWithOverride, context]);
  43616. }
  43617. function createRootData(elInjector, ngModule, rendererFactory, projectableNodes, rootSelectorOrNode) {
  43618. var sanitizer = ngModule.injector.get(Sanitizer);
  43619. var errorHandler = ngModule.injector.get(ErrorHandler);
  43620. var renderer = rendererFactory.createRenderer(null, null);
  43621. return {
  43622. ngModule: ngModule,
  43623. injector: elInjector, projectableNodes: projectableNodes,
  43624. selectorOrNode: rootSelectorOrNode, sanitizer: sanitizer, rendererFactory: rendererFactory, renderer: renderer, errorHandler: errorHandler
  43625. };
  43626. }
  43627. function debugCreateEmbeddedView(parentView, anchorDef, viewDef$$1, context) {
  43628. var defWithOverride = applyProviderOverridesToView(viewDef$$1);
  43629. return callWithDebugContext(DebugAction.create, createEmbeddedView, null, [parentView, anchorDef, defWithOverride, context]);
  43630. }
  43631. function debugCreateComponentView(parentView, nodeDef, viewDef$$1, hostElement) {
  43632. var overrideComponentView = viewDefOverrides.get(nodeDef.element.componentProvider.provider.token);
  43633. if (overrideComponentView) {
  43634. viewDef$$1 = overrideComponentView;
  43635. }
  43636. else {
  43637. viewDef$$1 = applyProviderOverridesToView(viewDef$$1);
  43638. }
  43639. return callWithDebugContext(DebugAction.create, createComponentView, null, [parentView, nodeDef, viewDef$$1, hostElement]);
  43640. }
  43641. function debugCreateNgModuleRef(moduleType, parentInjector, bootstrapComponents, def) {
  43642. var defWithOverride = applyProviderOverridesToNgModule(def);
  43643. return createNgModuleRef(moduleType, parentInjector, bootstrapComponents, defWithOverride);
  43644. }
  43645. var providerOverrides = new Map();
  43646. var providerOverridesWithScope = new Map();
  43647. var viewDefOverrides = new Map();
  43648. function debugOverrideProvider(override) {
  43649. providerOverrides.set(override.token, override);
  43650. if (typeof override.token === 'function' && override.token.ngInjectableDef &&
  43651. typeof override.token.ngInjectableDef.providedIn === 'function') {
  43652. providerOverridesWithScope.set(override.token, override);
  43653. }
  43654. }
  43655. function debugOverrideComponentView(comp, compFactory) {
  43656. var hostViewDef = resolveDefinition(getComponentViewDefinitionFactory(compFactory));
  43657. var compViewDef = resolveDefinition(hostViewDef.nodes[0].element.componentView);
  43658. viewDefOverrides.set(comp, compViewDef);
  43659. }
  43660. function debugClearOverrides() {
  43661. providerOverrides.clear();
  43662. providerOverridesWithScope.clear();
  43663. viewDefOverrides.clear();
  43664. }
  43665. // Notes about the algorithm:
  43666. // 1) Locate the providers of an element and check if one of them was overwritten
  43667. // 2) Change the providers of that element
  43668. //
  43669. // We only create new datastructures if we need to, to keep perf impact
  43670. // reasonable.
  43671. function applyProviderOverridesToView(def) {
  43672. if (providerOverrides.size === 0) {
  43673. return def;
  43674. }
  43675. var elementIndicesWithOverwrittenProviders = findElementIndicesWithOverwrittenProviders(def);
  43676. if (elementIndicesWithOverwrittenProviders.length === 0) {
  43677. return def;
  43678. }
  43679. // clone the whole view definition,
  43680. // as it maintains references between the nodes that are hard to update.
  43681. def = def.factory(function () { return NOOP; });
  43682. for (var i = 0; i < elementIndicesWithOverwrittenProviders.length; i++) {
  43683. applyProviderOverridesToElement(def, elementIndicesWithOverwrittenProviders[i]);
  43684. }
  43685. return def;
  43686. function findElementIndicesWithOverwrittenProviders(def) {
  43687. var elIndicesWithOverwrittenProviders = [];
  43688. var lastElementDef = null;
  43689. for (var i = 0; i < def.nodes.length; i++) {
  43690. var nodeDef = def.nodes[i];
  43691. if (nodeDef.flags & 1 /* TypeElement */) {
  43692. lastElementDef = nodeDef;
  43693. }
  43694. if (lastElementDef && nodeDef.flags & 3840 /* CatProviderNoDirective */ &&
  43695. providerOverrides.has(nodeDef.provider.token)) {
  43696. elIndicesWithOverwrittenProviders.push(lastElementDef.nodeIndex);
  43697. lastElementDef = null;
  43698. }
  43699. }
  43700. return elIndicesWithOverwrittenProviders;
  43701. }
  43702. function applyProviderOverridesToElement(viewDef$$1, elIndex) {
  43703. for (var i = elIndex + 1; i < viewDef$$1.nodes.length; i++) {
  43704. var nodeDef = viewDef$$1.nodes[i];
  43705. if (nodeDef.flags & 1 /* TypeElement */) {
  43706. // stop at the next element
  43707. return;
  43708. }
  43709. if (nodeDef.flags & 3840 /* CatProviderNoDirective */) {
  43710. var provider = nodeDef.provider;
  43711. var override = providerOverrides.get(provider.token);
  43712. if (override) {
  43713. nodeDef.flags = (nodeDef.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
  43714. provider.deps = splitDepsDsl(override.deps);
  43715. provider.value = override.value;
  43716. }
  43717. }
  43718. }
  43719. }
  43720. }
  43721. // Notes about the algorithm:
  43722. // We only create new datastructures if we need to, to keep perf impact
  43723. // reasonable.
  43724. function applyProviderOverridesToNgModule(def) {
  43725. var _a = calcHasOverrides(def), hasOverrides = _a.hasOverrides, hasDeprecatedOverrides = _a.hasDeprecatedOverrides;
  43726. if (!hasOverrides) {
  43727. return def;
  43728. }
  43729. // clone the whole view definition,
  43730. // as it maintains references between the nodes that are hard to update.
  43731. def = def.factory(function () { return NOOP; });
  43732. applyProviderOverrides(def);
  43733. return def;
  43734. function calcHasOverrides(def) {
  43735. var hasOverrides = false;
  43736. var hasDeprecatedOverrides = false;
  43737. if (providerOverrides.size === 0) {
  43738. return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
  43739. }
  43740. def.providers.forEach(function (node) {
  43741. var override = providerOverrides.get(node.token);
  43742. if ((node.flags & 3840 /* CatProviderNoDirective */) && override) {
  43743. hasOverrides = true;
  43744. hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
  43745. }
  43746. });
  43747. def.modules.forEach(function (module) {
  43748. providerOverridesWithScope.forEach(function (override, token) {
  43749. if (token.ngInjectableDef.providedIn === module) {
  43750. hasOverrides = true;
  43751. hasDeprecatedOverrides = hasDeprecatedOverrides || override.deprecatedBehavior;
  43752. }
  43753. });
  43754. });
  43755. return { hasOverrides: hasOverrides, hasDeprecatedOverrides: hasDeprecatedOverrides };
  43756. }
  43757. function applyProviderOverrides(def) {
  43758. for (var i = 0; i < def.providers.length; i++) {
  43759. var provider = def.providers[i];
  43760. if (hasDeprecatedOverrides) {
  43761. // We had a bug where me made
  43762. // all providers lazy. Keep this logic behind a flag
  43763. // for migrating existing users.
  43764. provider.flags |= 4096 /* LazyProvider */;
  43765. }
  43766. var override = providerOverrides.get(provider.token);
  43767. if (override) {
  43768. provider.flags = (provider.flags & ~3840 /* CatProviderNoDirective */) | override.flags;
  43769. provider.deps = splitDepsDsl(override.deps);
  43770. provider.value = override.value;
  43771. }
  43772. }
  43773. if (providerOverridesWithScope.size > 0) {
  43774. var moduleSet_1 = new Set(def.modules);
  43775. providerOverridesWithScope.forEach(function (override, token) {
  43776. if (moduleSet_1.has(token.ngInjectableDef.providedIn)) {
  43777. var provider = {
  43778. token: token,
  43779. flags: override.flags | (hasDeprecatedOverrides ? 4096 /* LazyProvider */ : 0 /* None */),
  43780. deps: splitDepsDsl(override.deps),
  43781. value: override.value,
  43782. index: def.providers.length,
  43783. };
  43784. def.providers.push(provider);
  43785. def.providersByKey[tokenKey(token)] = provider;
  43786. }
  43787. });
  43788. }
  43789. }
  43790. }
  43791. function prodCheckAndUpdateNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  43792. var nodeDef = view.def.nodes[checkIndex];
  43793. checkAndUpdateNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43794. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  43795. asPureExpressionData(view, checkIndex).value :
  43796. undefined;
  43797. }
  43798. function prodCheckNoChangesNode(view, checkIndex, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9) {
  43799. var nodeDef = view.def.nodes[checkIndex];
  43800. checkNoChangesNode(view, nodeDef, argStyle, v0, v1, v2, v3, v4, v5, v6, v7, v8, v9);
  43801. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  43802. asPureExpressionData(view, checkIndex).value :
  43803. undefined;
  43804. }
  43805. function debugCheckAndUpdateView(view) {
  43806. return callWithDebugContext(DebugAction.detectChanges, checkAndUpdateView, null, [view]);
  43807. }
  43808. function debugCheckNoChangesView(view) {
  43809. return callWithDebugContext(DebugAction.checkNoChanges, checkNoChangesView, null, [view]);
  43810. }
  43811. function debugDestroyView(view) {
  43812. return callWithDebugContext(DebugAction.destroy, destroyView, null, [view]);
  43813. }
  43814. var DebugAction;
  43815. (function (DebugAction) {
  43816. DebugAction[DebugAction["create"] = 0] = "create";
  43817. DebugAction[DebugAction["detectChanges"] = 1] = "detectChanges";
  43818. DebugAction[DebugAction["checkNoChanges"] = 2] = "checkNoChanges";
  43819. DebugAction[DebugAction["destroy"] = 3] = "destroy";
  43820. DebugAction[DebugAction["handleEvent"] = 4] = "handleEvent";
  43821. })(DebugAction || (DebugAction = {}));
  43822. var _currentAction;
  43823. var _currentView;
  43824. var _currentNodeIndex;
  43825. function debugSetCurrentNode(view, nodeIndex) {
  43826. _currentView = view;
  43827. _currentNodeIndex = nodeIndex;
  43828. }
  43829. function debugHandleEvent(view, nodeIndex, eventName, event) {
  43830. debugSetCurrentNode(view, nodeIndex);
  43831. return callWithDebugContext(DebugAction.handleEvent, view.def.handleEvent, null, [view, nodeIndex, eventName, event]);
  43832. }
  43833. function debugUpdateDirectives(view, checkType) {
  43834. if (view.state & 128 /* Destroyed */) {
  43835. throw viewDestroyedError(DebugAction[_currentAction]);
  43836. }
  43837. debugSetCurrentNode(view, nextDirectiveWithBinding(view, 0));
  43838. return view.def.updateDirectives(debugCheckDirectivesFn, view);
  43839. function debugCheckDirectivesFn(view, nodeIndex, argStyle) {
  43840. var values = [];
  43841. for (var _i = 3; _i < arguments.length; _i++) {
  43842. values[_i - 3] = arguments[_i];
  43843. }
  43844. var nodeDef = view.def.nodes[nodeIndex];
  43845. if (checkType === 0 /* CheckAndUpdate */) {
  43846. debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
  43847. }
  43848. else {
  43849. debugCheckNoChangesNode(view, nodeDef, argStyle, values);
  43850. }
  43851. if (nodeDef.flags & 16384 /* TypeDirective */) {
  43852. debugSetCurrentNode(view, nextDirectiveWithBinding(view, nodeIndex));
  43853. }
  43854. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  43855. asPureExpressionData(view, nodeDef.nodeIndex).value :
  43856. undefined;
  43857. }
  43858. }
  43859. function debugUpdateRenderer(view, checkType) {
  43860. if (view.state & 128 /* Destroyed */) {
  43861. throw viewDestroyedError(DebugAction[_currentAction]);
  43862. }
  43863. debugSetCurrentNode(view, nextRenderNodeWithBinding(view, 0));
  43864. return view.def.updateRenderer(debugCheckRenderNodeFn, view);
  43865. function debugCheckRenderNodeFn(view, nodeIndex, argStyle) {
  43866. var values = [];
  43867. for (var _i = 3; _i < arguments.length; _i++) {
  43868. values[_i - 3] = arguments[_i];
  43869. }
  43870. var nodeDef = view.def.nodes[nodeIndex];
  43871. if (checkType === 0 /* CheckAndUpdate */) {
  43872. debugCheckAndUpdateNode(view, nodeDef, argStyle, values);
  43873. }
  43874. else {
  43875. debugCheckNoChangesNode(view, nodeDef, argStyle, values);
  43876. }
  43877. if (nodeDef.flags & 3 /* CatRenderNode */) {
  43878. debugSetCurrentNode(view, nextRenderNodeWithBinding(view, nodeIndex));
  43879. }
  43880. return (nodeDef.flags & 224 /* CatPureExpression */) ?
  43881. asPureExpressionData(view, nodeDef.nodeIndex).value :
  43882. undefined;
  43883. }
  43884. }
  43885. function debugCheckAndUpdateNode(view, nodeDef, argStyle, givenValues) {
  43886. var changed = checkAndUpdateNode.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([view, nodeDef, argStyle], givenValues));
  43887. if (changed) {
  43888. var values = argStyle === 1 /* Dynamic */ ? givenValues[0] : givenValues;
  43889. if (nodeDef.flags & 16384 /* TypeDirective */) {
  43890. var bindingValues = {};
  43891. for (var i = 0; i < nodeDef.bindings.length; i++) {
  43892. var binding = nodeDef.bindings[i];
  43893. var value = values[i];
  43894. if (binding.flags & 8 /* TypeProperty */) {
  43895. bindingValues[normalizeDebugBindingName(binding.nonMinifiedName)] =
  43896. normalizeDebugBindingValue(value);
  43897. }
  43898. }
  43899. var elDef = nodeDef.parent;
  43900. var el = asElementData(view, elDef.nodeIndex).renderElement;
  43901. if (!elDef.element.name) {
  43902. // a comment.
  43903. view.renderer.setValue(el, "bindings=" + JSON.stringify(bindingValues, null, 2));
  43904. }
  43905. else {
  43906. // a regular element.
  43907. for (var attr in bindingValues) {
  43908. var value = bindingValues[attr];
  43909. if (value != null) {
  43910. view.renderer.setAttribute(el, attr, value);
  43911. }
  43912. else {
  43913. view.renderer.removeAttribute(el, attr);
  43914. }
  43915. }
  43916. }
  43917. }
  43918. }
  43919. }
  43920. function debugCheckNoChangesNode(view, nodeDef, argStyle, values) {
  43921. checkNoChangesNode.apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([view, nodeDef, argStyle], values));
  43922. }
  43923. function normalizeDebugBindingName(name) {
  43924. // Attribute names with `$` (eg `x-y$`) are valid per spec, but unsupported by some browsers
  43925. name = camelCaseToDashCase(name.replace(/[$@]/g, '_'));
  43926. return "ng-reflect-" + name;
  43927. }
  43928. var CAMEL_CASE_REGEXP = /([A-Z])/g;
  43929. function camelCaseToDashCase(input) {
  43930. return input.replace(CAMEL_CASE_REGEXP, function () {
  43931. var m = [];
  43932. for (var _i = 0; _i < arguments.length; _i++) {
  43933. m[_i] = arguments[_i];
  43934. }
  43935. return '-' + m[1].toLowerCase();
  43936. });
  43937. }
  43938. function normalizeDebugBindingValue(value) {
  43939. try {
  43940. // Limit the size of the value as otherwise the DOM just gets polluted.
  43941. return value != null ? value.toString().slice(0, 30) : value;
  43942. }
  43943. catch (e) {
  43944. return '[ERROR] Exception while trying to serialize the value';
  43945. }
  43946. }
  43947. function nextDirectiveWithBinding(view, nodeIndex) {
  43948. for (var i = nodeIndex; i < view.def.nodes.length; i++) {
  43949. var nodeDef = view.def.nodes[i];
  43950. if (nodeDef.flags & 16384 /* TypeDirective */ && nodeDef.bindings && nodeDef.bindings.length) {
  43951. return i;
  43952. }
  43953. }
  43954. return null;
  43955. }
  43956. function nextRenderNodeWithBinding(view, nodeIndex) {
  43957. for (var i = nodeIndex; i < view.def.nodes.length; i++) {
  43958. var nodeDef = view.def.nodes[i];
  43959. if ((nodeDef.flags & 3 /* CatRenderNode */) && nodeDef.bindings && nodeDef.bindings.length) {
  43960. return i;
  43961. }
  43962. }
  43963. return null;
  43964. }
  43965. var DebugContext_ = /** @class */ (function () {
  43966. function DebugContext_(view, nodeIndex) {
  43967. this.view = view;
  43968. this.nodeIndex = nodeIndex;
  43969. if (nodeIndex == null) {
  43970. this.nodeIndex = nodeIndex = 0;
  43971. }
  43972. this.nodeDef = view.def.nodes[nodeIndex];
  43973. var elDef = this.nodeDef;
  43974. var elView = view;
  43975. while (elDef && (elDef.flags & 1 /* TypeElement */) === 0) {
  43976. elDef = elDef.parent;
  43977. }
  43978. if (!elDef) {
  43979. while (!elDef && elView) {
  43980. elDef = viewParentEl(elView);
  43981. elView = elView.parent;
  43982. }
  43983. }
  43984. this.elDef = elDef;
  43985. this.elView = elView;
  43986. }
  43987. Object.defineProperty(DebugContext_.prototype, "elOrCompView", {
  43988. get: function () {
  43989. // Has to be done lazily as we use the DebugContext also during creation of elements...
  43990. return asElementData(this.elView, this.elDef.nodeIndex).componentView || this.view;
  43991. },
  43992. enumerable: true,
  43993. configurable: true
  43994. });
  43995. Object.defineProperty(DebugContext_.prototype, "injector", {
  43996. get: function () { return createInjector$1(this.elView, this.elDef); },
  43997. enumerable: true,
  43998. configurable: true
  43999. });
  44000. Object.defineProperty(DebugContext_.prototype, "component", {
  44001. get: function () { return this.elOrCompView.component; },
  44002. enumerable: true,
  44003. configurable: true
  44004. });
  44005. Object.defineProperty(DebugContext_.prototype, "context", {
  44006. get: function () { return this.elOrCompView.context; },
  44007. enumerable: true,
  44008. configurable: true
  44009. });
  44010. Object.defineProperty(DebugContext_.prototype, "providerTokens", {
  44011. get: function () {
  44012. var tokens = [];
  44013. if (this.elDef) {
  44014. for (var i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
  44015. var childDef = this.elView.def.nodes[i];
  44016. if (childDef.flags & 20224 /* CatProvider */) {
  44017. tokens.push(childDef.provider.token);
  44018. }
  44019. i += childDef.childCount;
  44020. }
  44021. }
  44022. return tokens;
  44023. },
  44024. enumerable: true,
  44025. configurable: true
  44026. });
  44027. Object.defineProperty(DebugContext_.prototype, "references", {
  44028. get: function () {
  44029. var references = {};
  44030. if (this.elDef) {
  44031. collectReferences(this.elView, this.elDef, references);
  44032. for (var i = this.elDef.nodeIndex + 1; i <= this.elDef.nodeIndex + this.elDef.childCount; i++) {
  44033. var childDef = this.elView.def.nodes[i];
  44034. if (childDef.flags & 20224 /* CatProvider */) {
  44035. collectReferences(this.elView, childDef, references);
  44036. }
  44037. i += childDef.childCount;
  44038. }
  44039. }
  44040. return references;
  44041. },
  44042. enumerable: true,
  44043. configurable: true
  44044. });
  44045. Object.defineProperty(DebugContext_.prototype, "componentRenderElement", {
  44046. get: function () {
  44047. var elData = findHostElement(this.elOrCompView);
  44048. return elData ? elData.renderElement : undefined;
  44049. },
  44050. enumerable: true,
  44051. configurable: true
  44052. });
  44053. Object.defineProperty(DebugContext_.prototype, "renderNode", {
  44054. get: function () {
  44055. return this.nodeDef.flags & 2 /* TypeText */ ? renderNode(this.view, this.nodeDef) :
  44056. renderNode(this.elView, this.elDef);
  44057. },
  44058. enumerable: true,
  44059. configurable: true
  44060. });
  44061. DebugContext_.prototype.logError = function (console) {
  44062. var values = [];
  44063. for (var _i = 1; _i < arguments.length; _i++) {
  44064. values[_i - 1] = arguments[_i];
  44065. }
  44066. var logViewDef;
  44067. var logNodeIndex;
  44068. if (this.nodeDef.flags & 2 /* TypeText */) {
  44069. logViewDef = this.view.def;
  44070. logNodeIndex = this.nodeDef.nodeIndex;
  44071. }
  44072. else {
  44073. logViewDef = this.elView.def;
  44074. logNodeIndex = this.elDef.nodeIndex;
  44075. }
  44076. // Note: we only generate a log function for text and element nodes
  44077. // to make the generated code as small as possible.
  44078. var renderNodeIndex = getRenderNodeIndex(logViewDef, logNodeIndex);
  44079. var currRenderNodeIndex = -1;
  44080. var nodeLogger = function () {
  44081. var _a;
  44082. currRenderNodeIndex++;
  44083. if (currRenderNodeIndex === renderNodeIndex) {
  44084. return (_a = console.error).bind.apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])([console], values));
  44085. }
  44086. else {
  44087. return NOOP;
  44088. }
  44089. };
  44090. logViewDef.factory(nodeLogger);
  44091. if (currRenderNodeIndex < renderNodeIndex) {
  44092. console.error('Illegal state: the ViewDefinitionFactory did not call the logger!');
  44093. console.error.apply(console, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(values));
  44094. }
  44095. };
  44096. return DebugContext_;
  44097. }());
  44098. function getRenderNodeIndex(viewDef$$1, nodeIndex) {
  44099. var renderNodeIndex = -1;
  44100. for (var i = 0; i <= nodeIndex; i++) {
  44101. var nodeDef = viewDef$$1.nodes[i];
  44102. if (nodeDef.flags & 3 /* CatRenderNode */) {
  44103. renderNodeIndex++;
  44104. }
  44105. }
  44106. return renderNodeIndex;
  44107. }
  44108. function findHostElement(view) {
  44109. while (view && !isComponentView(view)) {
  44110. view = view.parent;
  44111. }
  44112. if (view.parent) {
  44113. return asElementData(view.parent, viewParentEl(view).nodeIndex);
  44114. }
  44115. return null;
  44116. }
  44117. function collectReferences(view, nodeDef, references) {
  44118. for (var refName in nodeDef.references) {
  44119. references[refName] = getQueryValue(view, nodeDef, nodeDef.references[refName]);
  44120. }
  44121. }
  44122. function callWithDebugContext(action, fn, self, args) {
  44123. var oldAction = _currentAction;
  44124. var oldView = _currentView;
  44125. var oldNodeIndex = _currentNodeIndex;
  44126. try {
  44127. _currentAction = action;
  44128. var result = fn.apply(self, args);
  44129. _currentView = oldView;
  44130. _currentNodeIndex = oldNodeIndex;
  44131. _currentAction = oldAction;
  44132. return result;
  44133. }
  44134. catch (e) {
  44135. if (isViewDebugError(e) || !_currentView) {
  44136. throw e;
  44137. }
  44138. throw viewWrappedDebugError(e, getCurrentDebugContext());
  44139. }
  44140. }
  44141. function getCurrentDebugContext() {
  44142. return _currentView ? new DebugContext_(_currentView, _currentNodeIndex) : null;
  44143. }
  44144. var DebugRendererFactory2 = /** @class */ (function () {
  44145. function DebugRendererFactory2(delegate) {
  44146. this.delegate = delegate;
  44147. }
  44148. DebugRendererFactory2.prototype.createRenderer = function (element, renderData) {
  44149. return new DebugRenderer2(this.delegate.createRenderer(element, renderData));
  44150. };
  44151. DebugRendererFactory2.prototype.begin = function () {
  44152. if (this.delegate.begin) {
  44153. this.delegate.begin();
  44154. }
  44155. };
  44156. DebugRendererFactory2.prototype.end = function () {
  44157. if (this.delegate.end) {
  44158. this.delegate.end();
  44159. }
  44160. };
  44161. DebugRendererFactory2.prototype.whenRenderingDone = function () {
  44162. if (this.delegate.whenRenderingDone) {
  44163. return this.delegate.whenRenderingDone();
  44164. }
  44165. return Promise.resolve(null);
  44166. };
  44167. return DebugRendererFactory2;
  44168. }());
  44169. var DebugRenderer2 = /** @class */ (function () {
  44170. function DebugRenderer2(delegate) {
  44171. this.delegate = delegate;
  44172. this.data = this.delegate.data;
  44173. }
  44174. DebugRenderer2.prototype.destroyNode = function (node) {
  44175. removeDebugNodeFromIndex(getDebugNode(node));
  44176. if (this.delegate.destroyNode) {
  44177. this.delegate.destroyNode(node);
  44178. }
  44179. };
  44180. DebugRenderer2.prototype.destroy = function () { this.delegate.destroy(); };
  44181. DebugRenderer2.prototype.createElement = function (name, namespace) {
  44182. var el = this.delegate.createElement(name, namespace);
  44183. var debugCtx = getCurrentDebugContext();
  44184. if (debugCtx) {
  44185. var debugEl = new DebugElement(el, null, debugCtx);
  44186. debugEl.name = name;
  44187. indexDebugNode(debugEl);
  44188. }
  44189. return el;
  44190. };
  44191. DebugRenderer2.prototype.createComment = function (value) {
  44192. var comment = this.delegate.createComment(value);
  44193. var debugCtx = getCurrentDebugContext();
  44194. if (debugCtx) {
  44195. indexDebugNode(new DebugNode(comment, null, debugCtx));
  44196. }
  44197. return comment;
  44198. };
  44199. DebugRenderer2.prototype.createText = function (value) {
  44200. var text = this.delegate.createText(value);
  44201. var debugCtx = getCurrentDebugContext();
  44202. if (debugCtx) {
  44203. indexDebugNode(new DebugNode(text, null, debugCtx));
  44204. }
  44205. return text;
  44206. };
  44207. DebugRenderer2.prototype.appendChild = function (parent, newChild) {
  44208. var debugEl = getDebugNode(parent);
  44209. var debugChildEl = getDebugNode(newChild);
  44210. if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
  44211. debugEl.addChild(debugChildEl);
  44212. }
  44213. this.delegate.appendChild(parent, newChild);
  44214. };
  44215. DebugRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
  44216. var debugEl = getDebugNode(parent);
  44217. var debugChildEl = getDebugNode(newChild);
  44218. var debugRefEl = getDebugNode(refChild);
  44219. if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
  44220. debugEl.insertBefore(debugRefEl, debugChildEl);
  44221. }
  44222. this.delegate.insertBefore(parent, newChild, refChild);
  44223. };
  44224. DebugRenderer2.prototype.removeChild = function (parent, oldChild) {
  44225. var debugEl = getDebugNode(parent);
  44226. var debugChildEl = getDebugNode(oldChild);
  44227. if (debugEl && debugChildEl && debugEl instanceof DebugElement) {
  44228. debugEl.removeChild(debugChildEl);
  44229. }
  44230. this.delegate.removeChild(parent, oldChild);
  44231. };
  44232. DebugRenderer2.prototype.selectRootElement = function (selectorOrNode) {
  44233. var el = this.delegate.selectRootElement(selectorOrNode);
  44234. var debugCtx = getCurrentDebugContext();
  44235. if (debugCtx) {
  44236. indexDebugNode(new DebugElement(el, null, debugCtx));
  44237. }
  44238. return el;
  44239. };
  44240. DebugRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
  44241. var debugEl = getDebugNode(el);
  44242. if (debugEl && debugEl instanceof DebugElement) {
  44243. var fullName = namespace ? namespace + ':' + name : name;
  44244. debugEl.attributes[fullName] = value;
  44245. }
  44246. this.delegate.setAttribute(el, name, value, namespace);
  44247. };
  44248. DebugRenderer2.prototype.removeAttribute = function (el, name, namespace) {
  44249. var debugEl = getDebugNode(el);
  44250. if (debugEl && debugEl instanceof DebugElement) {
  44251. var fullName = namespace ? namespace + ':' + name : name;
  44252. debugEl.attributes[fullName] = null;
  44253. }
  44254. this.delegate.removeAttribute(el, name, namespace);
  44255. };
  44256. DebugRenderer2.prototype.addClass = function (el, name) {
  44257. var debugEl = getDebugNode(el);
  44258. if (debugEl && debugEl instanceof DebugElement) {
  44259. debugEl.classes[name] = true;
  44260. }
  44261. this.delegate.addClass(el, name);
  44262. };
  44263. DebugRenderer2.prototype.removeClass = function (el, name) {
  44264. var debugEl = getDebugNode(el);
  44265. if (debugEl && debugEl instanceof DebugElement) {
  44266. debugEl.classes[name] = false;
  44267. }
  44268. this.delegate.removeClass(el, name);
  44269. };
  44270. DebugRenderer2.prototype.setStyle = function (el, style, value, flags) {
  44271. var debugEl = getDebugNode(el);
  44272. if (debugEl && debugEl instanceof DebugElement) {
  44273. debugEl.styles[style] = value;
  44274. }
  44275. this.delegate.setStyle(el, style, value, flags);
  44276. };
  44277. DebugRenderer2.prototype.removeStyle = function (el, style, flags) {
  44278. var debugEl = getDebugNode(el);
  44279. if (debugEl && debugEl instanceof DebugElement) {
  44280. debugEl.styles[style] = null;
  44281. }
  44282. this.delegate.removeStyle(el, style, flags);
  44283. };
  44284. DebugRenderer2.prototype.setProperty = function (el, name, value) {
  44285. var debugEl = getDebugNode(el);
  44286. if (debugEl && debugEl instanceof DebugElement) {
  44287. debugEl.properties[name] = value;
  44288. }
  44289. this.delegate.setProperty(el, name, value);
  44290. };
  44291. DebugRenderer2.prototype.listen = function (target, eventName, callback) {
  44292. if (typeof target !== 'string') {
  44293. var debugEl = getDebugNode(target);
  44294. if (debugEl) {
  44295. debugEl.listeners.push(new EventListener(eventName, callback));
  44296. }
  44297. }
  44298. return this.delegate.listen(target, eventName, callback);
  44299. };
  44300. DebugRenderer2.prototype.parentNode = function (node) { return this.delegate.parentNode(node); };
  44301. DebugRenderer2.prototype.nextSibling = function (node) { return this.delegate.nextSibling(node); };
  44302. DebugRenderer2.prototype.setValue = function (node, value) { return this.delegate.setValue(node, value); };
  44303. return DebugRenderer2;
  44304. }());
  44305. /**
  44306. * @license
  44307. * Copyright Google Inc. All Rights Reserved.
  44308. *
  44309. * Use of this source code is governed by an MIT-style license that can be
  44310. * found in the LICENSE file at https://angular.io/license
  44311. */
  44312. function overrideProvider(override) {
  44313. initServicesIfNeeded();
  44314. return Services.overrideProvider(override);
  44315. }
  44316. function overrideComponentView(comp, componentFactory) {
  44317. initServicesIfNeeded();
  44318. return Services.overrideComponentView(comp, componentFactory);
  44319. }
  44320. function clearOverrides() {
  44321. initServicesIfNeeded();
  44322. return Services.clearOverrides();
  44323. }
  44324. // Attention: this function is called as top level function.
  44325. // Putting any logic in here will destroy closure tree shaking!
  44326. function createNgModuleFactory(ngModuleType, bootstrapComponents, defFactory) {
  44327. return new NgModuleFactory_(ngModuleType, bootstrapComponents, defFactory);
  44328. }
  44329. function cloneNgModuleDefinition(def) {
  44330. var providers = Array.from(def.providers);
  44331. var modules = Array.from(def.modules);
  44332. var providersByKey = {};
  44333. for (var key in def.providersByKey) {
  44334. providersByKey[key] = def.providersByKey[key];
  44335. }
  44336. return {
  44337. factory: def.factory,
  44338. isRoot: def.isRoot, providers: providers, modules: modules, providersByKey: providersByKey,
  44339. };
  44340. }
  44341. var NgModuleFactory_ = /** @class */ (function (_super) {
  44342. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgModuleFactory_, _super);
  44343. function NgModuleFactory_(moduleType, _bootstrapComponents, _ngModuleDefFactory) {
  44344. var _this =
  44345. // Attention: this ctor is called as top level function.
  44346. // Putting any logic in here will destroy closure tree shaking!
  44347. _super.call(this) || this;
  44348. _this.moduleType = moduleType;
  44349. _this._bootstrapComponents = _bootstrapComponents;
  44350. _this._ngModuleDefFactory = _ngModuleDefFactory;
  44351. return _this;
  44352. }
  44353. NgModuleFactory_.prototype.create = function (parentInjector) {
  44354. initServicesIfNeeded();
  44355. // Clone the NgModuleDefinition so that any tree shakeable provider definition
  44356. // added to this instance of the NgModuleRef doesn't affect the cached copy.
  44357. // See https://github.com/angular/angular/issues/25018.
  44358. var def = cloneNgModuleDefinition(resolveDefinition(this._ngModuleDefFactory));
  44359. return Services.createNgModuleRef(this.moduleType, parentInjector || Injector.NULL, this._bootstrapComponents, def);
  44360. };
  44361. return NgModuleFactory_;
  44362. }(NgModuleFactory));
  44363. /**
  44364. * @license
  44365. * Copyright Google Inc. All Rights Reserved.
  44366. *
  44367. * Use of this source code is governed by an MIT-style license that can be
  44368. * found in the LICENSE file at https://angular.io/license
  44369. */
  44370. /**
  44371. * @license
  44372. * Copyright Google Inc. All Rights Reserved.
  44373. *
  44374. * Use of this source code is governed by an MIT-style license that can be
  44375. * found in the LICENSE file at https://angular.io/license
  44376. */
  44377. /**
  44378. * @license
  44379. * Copyright Google Inc. All Rights Reserved.
  44380. *
  44381. * Use of this source code is governed by an MIT-style license that can be
  44382. * found in the LICENSE file at https://angular.io/license
  44383. */
  44384. function assertEqual(actual, expected, msg) {
  44385. if (actual != expected) {
  44386. throwError(msg);
  44387. }
  44388. }
  44389. function assertNotEqual(actual, expected, msg) {
  44390. if (actual == expected) {
  44391. throwError(msg);
  44392. }
  44393. }
  44394. function assertLessThan(actual, expected, msg) {
  44395. if (actual >= expected) {
  44396. throwError(msg);
  44397. }
  44398. }
  44399. function assertGreaterThan(actual, expected, msg) {
  44400. if (actual <= expected) {
  44401. throwError(msg);
  44402. }
  44403. }
  44404. function assertNotDefined(actual, msg) {
  44405. if (actual != null) {
  44406. throwError(msg);
  44407. }
  44408. }
  44409. function assertDefined(actual, msg) {
  44410. if (actual == null) {
  44411. throwError(msg);
  44412. }
  44413. }
  44414. function assertComponentType(actual, msg) {
  44415. if (msg === void 0) { msg = 'Type passed in is not ComponentType, it does not have \'ngComponentDef\' property.'; }
  44416. if (!actual.ngComponentDef) {
  44417. debugger;
  44418. throwError(msg);
  44419. }
  44420. }
  44421. function throwError(msg) {
  44422. debugger; // Left intentionally for better debugger experience.
  44423. throw new Error("ASSERTION ERROR: " + msg);
  44424. }
  44425. /**
  44426. * @license
  44427. * Copyright Google Inc. All Rights Reserved.
  44428. *
  44429. * Use of this source code is governed by an MIT-style license that can be
  44430. * found in the LICENSE file at https://angular.io/license
  44431. */
  44432. /** Size of LViewData's header. Necessary to adjust for it when setting slots. */
  44433. var HEADER_OFFSET = 16;
  44434. // Below are constants for LViewData indices to help us look up LViewData members
  44435. // without having to remember the specific indices.
  44436. // Uglify will inline these when minifying so there shouldn't be a cost.
  44437. var TVIEW = 0;
  44438. var PARENT = 1;
  44439. var NEXT = 2;
  44440. var QUERIES = 3;
  44441. var FLAGS = 4;
  44442. var HOST_NODE = 5;
  44443. var BINDING_INDEX = 6;
  44444. var DIRECTIVES = 7;
  44445. var CLEANUP = 8;
  44446. var CONTEXT = 9;
  44447. var INJECTOR$1 = 10;
  44448. var RENDERER = 11;
  44449. var SANITIZER = 12;
  44450. var TAIL = 13;
  44451. var CONTAINER_INDEX = 14;
  44452. var CONTENT_QUERIES = 15;
  44453. /**
  44454. * @license
  44455. * Copyright Google Inc. All Rights Reserved.
  44456. *
  44457. * Use of this source code is governed by an MIT-style license that can be
  44458. * found in the LICENSE file at https://angular.io/license
  44459. */
  44460. /**
  44461. * If this is the first template pass, any ngOnInit or ngDoCheck hooks will be queued into
  44462. * TView.initHooks during directiveCreate.
  44463. *
  44464. * The directive index and hook type are encoded into one number (1st bit: type, remaining bits:
  44465. * directive index), then saved in the even indices of the initHooks array. The odd indices
  44466. * hold the hook functions themselves.
  44467. *
  44468. * @param index The index of the directive in LViewData[DIRECTIVES]
  44469. * @param hooks The static hooks map on the directive def
  44470. * @param tView The current TView
  44471. */
  44472. function queueInitHooks(index, onInit, doCheck, tView) {
  44473. ngDevMode &&
  44474. assertEqual(tView.firstTemplatePass, true, 'Should only be called on first template pass');
  44475. if (onInit) {
  44476. (tView.initHooks || (tView.initHooks = [])).push(index, onInit);
  44477. }
  44478. if (doCheck) {
  44479. (tView.initHooks || (tView.initHooks = [])).push(index, doCheck);
  44480. (tView.checkHooks || (tView.checkHooks = [])).push(index, doCheck);
  44481. }
  44482. }
  44483. /**
  44484. * Loops through the directives on a node and queues all their hooks except ngOnInit
  44485. * and ngDoCheck, which are queued separately in directiveCreate.
  44486. */
  44487. function queueLifecycleHooks(flags, tView) {
  44488. if (tView.firstTemplatePass) {
  44489. var start = flags >> 14 /* DirectiveStartingIndexShift */;
  44490. var count = flags & 4095 /* DirectiveCountMask */;
  44491. var end = start + count;
  44492. // It's necessary to loop through the directives at elementEnd() (rather than processing in
  44493. // directiveCreate) so we can preserve the current hook order. Content, view, and destroy
  44494. // hooks for projected components and directives must be called *before* their hosts.
  44495. for (var i = start; i < end; i++) {
  44496. var def = tView.directives[i];
  44497. queueContentHooks(def, tView, i);
  44498. queueViewHooks(def, tView, i);
  44499. queueDestroyHooks(def, tView, i);
  44500. }
  44501. }
  44502. }
  44503. /** Queues afterContentInit and afterContentChecked hooks on TView */
  44504. function queueContentHooks(def, tView, i) {
  44505. if (def.afterContentInit) {
  44506. (tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentInit);
  44507. }
  44508. if (def.afterContentChecked) {
  44509. (tView.contentHooks || (tView.contentHooks = [])).push(i, def.afterContentChecked);
  44510. (tView.contentCheckHooks || (tView.contentCheckHooks = [])).push(i, def.afterContentChecked);
  44511. }
  44512. }
  44513. /** Queues afterViewInit and afterViewChecked hooks on TView */
  44514. function queueViewHooks(def, tView, i) {
  44515. if (def.afterViewInit) {
  44516. (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewInit);
  44517. }
  44518. if (def.afterViewChecked) {
  44519. (tView.viewHooks || (tView.viewHooks = [])).push(i, def.afterViewChecked);
  44520. (tView.viewCheckHooks || (tView.viewCheckHooks = [])).push(i, def.afterViewChecked);
  44521. }
  44522. }
  44523. /** Queues onDestroy hooks on TView */
  44524. function queueDestroyHooks(def, tView, i) {
  44525. if (def.onDestroy != null) {
  44526. (tView.destroyHooks || (tView.destroyHooks = [])).push(i, def.onDestroy);
  44527. }
  44528. }
  44529. /**
  44530. * Calls onInit and doCheck calls if they haven't already been called.
  44531. *
  44532. * @param currentView The current view
  44533. */
  44534. function executeInitHooks(currentView, tView, creationMode) {
  44535. if (currentView[FLAGS] & 16 /* RunInit */) {
  44536. executeHooks(currentView[DIRECTIVES], tView.initHooks, tView.checkHooks, creationMode);
  44537. currentView[FLAGS] &= ~16 /* RunInit */;
  44538. }
  44539. }
  44540. /**
  44541. * Iterates over afterViewInit and afterViewChecked functions and calls them.
  44542. *
  44543. * @param currentView The current view
  44544. */
  44545. function executeHooks(data, allHooks, checkHooks, creationMode) {
  44546. var hooksToCall = creationMode ? allHooks : checkHooks;
  44547. if (hooksToCall) {
  44548. callHooks(data, hooksToCall);
  44549. }
  44550. }
  44551. /**
  44552. * Calls lifecycle hooks with their contexts, skipping init hooks if it's not
  44553. * creation mode.
  44554. *
  44555. * @param currentView The current view
  44556. * @param arr The array in which the hooks are found
  44557. */
  44558. function callHooks(data, arr) {
  44559. for (var i = 0; i < arr.length; i += 2) {
  44560. arr[i + 1].call(data[arr[i]]);
  44561. }
  44562. }
  44563. /**
  44564. * @license
  44565. * Copyright Google Inc. All Rights Reserved.
  44566. *
  44567. * Use of this source code is governed by an MIT-style license that can be
  44568. * found in the LICENSE file at https://angular.io/license
  44569. */
  44570. function ngDevModeResetPerfCounters() {
  44571. var newCounters = {
  44572. firstTemplatePass: 0,
  44573. tNode: 0,
  44574. tView: 0,
  44575. rendererCreateTextNode: 0,
  44576. rendererSetText: 0,
  44577. rendererCreateElement: 0,
  44578. rendererAddEventListener: 0,
  44579. rendererSetAttribute: 0,
  44580. rendererRemoveAttribute: 0,
  44581. rendererSetProperty: 0,
  44582. rendererSetClassName: 0,
  44583. rendererAddClass: 0,
  44584. rendererRemoveClass: 0,
  44585. rendererSetStyle: 0,
  44586. rendererRemoveStyle: 0,
  44587. rendererDestroy: 0,
  44588. rendererDestroyNode: 0,
  44589. rendererMoveNode: 0,
  44590. rendererRemoveNode: 0,
  44591. };
  44592. // NOTE: Under Ivy we may have both window & global defined in the Node
  44593. // environment since ensureDocument() in render3.ts sets global.window.
  44594. if (typeof window != 'undefined') {
  44595. // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
  44596. window['ngDevMode'] = newCounters;
  44597. }
  44598. if (typeof global != 'undefined') {
  44599. // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
  44600. global['ngDevMode'] = newCounters;
  44601. }
  44602. if (typeof self != 'undefined') {
  44603. // Make sure to refer to ngDevMode as ['ngDevMode'] for closure.
  44604. self['ngDevMode'] = newCounters;
  44605. }
  44606. return newCounters;
  44607. }
  44608. /**
  44609. * This checks to see if the `ngDevMode` has been set. If yes,
  44610. * than we honor it, otherwise we default to dev mode with additional checks.
  44611. *
  44612. * The idea is that unless we are doing production build where we explicitly
  44613. * set `ngDevMode == false` we should be helping the developer by providing
  44614. * as much early warning and errors as possible.
  44615. */
  44616. if (typeof ngDevMode === 'undefined' || ngDevMode) {
  44617. ngDevModeResetPerfCounters();
  44618. }
  44619. /** Called when directives inject each other (creating a circular dependency) */
  44620. function throwCyclicDependencyError(token) {
  44621. throw new Error("Cannot instantiate cyclic dependency! " + token);
  44622. }
  44623. /** Called when there are multiple component selectors that match a given node */
  44624. function throwMultipleComponentError(tNode) {
  44625. throw new Error("Multiple components match node with tagname " + tNode.tagName);
  44626. }
  44627. /** Throws an ExpressionChangedAfterChecked error if checkNoChanges mode is on. */
  44628. function throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, oldValue, currValue) {
  44629. if (checkNoChangesMode) {
  44630. var msg = "ExpressionChangedAfterItHasBeenCheckedError: Expression has changed after it was checked. Previous value: '" + oldValue + "'. Current value: '" + currValue + "'.";
  44631. if (creationMode) {
  44632. msg +=
  44633. " It seems like the view has been created after its parent and its children have been dirty checked." +
  44634. " Has it been created in a change detection hook ?";
  44635. }
  44636. // TODO: include debug context
  44637. throw new Error(msg);
  44638. }
  44639. }
  44640. /**
  44641. * @license
  44642. * Copyright Google Inc. All Rights Reserved.
  44643. *
  44644. * Use of this source code is governed by an MIT-style license that can be
  44645. * found in the LICENSE file at https://angular.io/license
  44646. */
  44647. /**
  44648. * Below are constants for LContainer indices to help us look up LContainer members
  44649. * without having to remember the specific indices.
  44650. * Uglify will inline these when minifying so there shouldn't be a cost.
  44651. */
  44652. var ACTIVE_INDEX = 0;
  44653. // PARENT, NEXT, and QUERIES are indices 1, 2, and 3.
  44654. // As we already have these constants in LViewData, we don't need to re-create them.
  44655. var VIEWS = 4;
  44656. var RENDER_PARENT = 5;
  44657. /**
  44658. * @license
  44659. * Copyright Google Inc. All Rights Reserved.
  44660. *
  44661. * Use of this source code is governed by an MIT-style license that can be
  44662. * found in the LICENSE file at https://angular.io/license
  44663. */
  44664. var NG_PROJECT_AS_ATTR_NAME = 'ngProjectAs';
  44665. /**
  44666. * @license
  44667. * Copyright Google Inc. All Rights Reserved.
  44668. *
  44669. * Use of this source code is governed by an MIT-style license that can be
  44670. * found in the LICENSE file at https://angular.io/license
  44671. */
  44672. // TODO: cleanup once the code is merged in angular/angular
  44673. var RendererStyleFlags3;
  44674. (function (RendererStyleFlags3) {
  44675. RendererStyleFlags3[RendererStyleFlags3["Important"] = 1] = "Important";
  44676. RendererStyleFlags3[RendererStyleFlags3["DashCase"] = 2] = "DashCase";
  44677. })(RendererStyleFlags3 || (RendererStyleFlags3 = {}));
  44678. /** Returns whether the `renderer` is a `ProceduralRenderer3` */
  44679. function isProceduralRenderer(renderer) {
  44680. return !!(renderer.listen);
  44681. }
  44682. var domRendererFactory3 = {
  44683. createRenderer: function (hostElement, rendererType) { return document; }
  44684. };
  44685. /**
  44686. * @license
  44687. * Copyright Google Inc. All Rights Reserved.
  44688. *
  44689. * Use of this source code is governed by an MIT-style license that can be
  44690. * found in the LICENSE file at https://angular.io/license
  44691. */
  44692. function assertNodeType(node, type) {
  44693. assertDefined(node, 'should be called with a node');
  44694. assertEqual(node.tNode.type, type, "should be a " + typeName(type));
  44695. }
  44696. function assertNodeOfPossibleTypes(node) {
  44697. var types = [];
  44698. for (var _i = 1; _i < arguments.length; _i++) {
  44699. types[_i - 1] = arguments[_i];
  44700. }
  44701. assertDefined(node, 'should be called with a node');
  44702. var found = types.some(function (type) { return node.tNode.type === type; });
  44703. assertEqual(found, true, "Should be one of " + types.map(typeName).join(', '));
  44704. }
  44705. function typeName(type) {
  44706. if (type == 1 /* Projection */)
  44707. return 'Projection';
  44708. if (type == 0 /* Container */)
  44709. return 'Container';
  44710. if (type == 2 /* View */)
  44711. return 'View';
  44712. if (type == 3 /* Element */)
  44713. return 'Element';
  44714. return '<unknown>';
  44715. }
  44716. /**
  44717. * @license
  44718. * Copyright Google Inc. All Rights Reserved.
  44719. *
  44720. * Use of this source code is governed by an MIT-style license that can be
  44721. * found in the LICENSE file at https://angular.io/license
  44722. */
  44723. /**
  44724. * @license
  44725. * Copyright Google Inc. All Rights Reserved.
  44726. *
  44727. * Use of this source code is governed by an MIT-style license that can be
  44728. * found in the LICENSE file at https://angular.io/license
  44729. */
  44730. /**
  44731. * Must use this method for CD (instead of === ) since NaN !== NaN
  44732. */
  44733. function isDifferent(a, b) {
  44734. // NaN is the only value that is not equal to itself so the first
  44735. // test checks if both a and b are not NaN
  44736. return !(a !== a && b !== b) && a !== b;
  44737. }
  44738. function stringify$1(value) {
  44739. if (typeof value == 'function')
  44740. return value.name || value;
  44741. if (typeof value == 'string')
  44742. return value;
  44743. if (value == null)
  44744. return '';
  44745. return '' + value;
  44746. }
  44747. /**
  44748. * Flattens an array in non-recursive way. Input arrays are not modified.
  44749. */
  44750. function flatten$1(list) {
  44751. var result = [];
  44752. var i = 0;
  44753. while (i < list.length) {
  44754. var item = list[i];
  44755. if (Array.isArray(item)) {
  44756. if (item.length > 0) {
  44757. list = item.concat(list.slice(i + 1));
  44758. i = 0;
  44759. }
  44760. else {
  44761. i++;
  44762. }
  44763. }
  44764. else {
  44765. result.push(item);
  44766. i++;
  44767. }
  44768. }
  44769. return result;
  44770. }
  44771. /** Retrieves a value from any `LViewData`. */
  44772. function loadInternal(index, arr) {
  44773. ngDevMode && assertDataInRangeInternal(index + HEADER_OFFSET, arr);
  44774. return arr[index + HEADER_OFFSET];
  44775. }
  44776. function assertDataInRangeInternal(index, arr) {
  44777. assertLessThan(index, arr ? arr.length : 0, 'index expected to be a valid data index');
  44778. }
  44779. /** Retrieves an element value from the provided `viewData`.
  44780. *
  44781. * Elements that are read may be wrapped in a style context,
  44782. * therefore reading the value may involve unwrapping that.
  44783. */
  44784. function loadElementInternal(index, arr) {
  44785. var value = loadInternal(index, arr);
  44786. return readElementValue(value);
  44787. }
  44788. function readElementValue(value) {
  44789. return (Array.isArray(value) ? value[0] : value);
  44790. }
  44791. /**
  44792. * @license
  44793. * Copyright Google Inc. All Rights Reserved.
  44794. *
  44795. * Use of this source code is governed by an MIT-style license that can be
  44796. * found in the LICENSE file at https://angular.io/license
  44797. */
  44798. /** Retrieves the sibling node for the given node. */
  44799. function getNextLNode(node) {
  44800. // View nodes don't have TNodes, so their next must be retrieved through their LView.
  44801. if (node.tNode.type === 2 /* View */) {
  44802. var viewData = node.data;
  44803. return viewData[NEXT] ? viewData[NEXT][HOST_NODE] : null;
  44804. }
  44805. return node.tNode.next ? node.view[node.tNode.next.index] : null;
  44806. }
  44807. /** Retrieves the first child of a given node */
  44808. function getChildLNode(node) {
  44809. if (node.tNode.child) {
  44810. var viewData = node.tNode.type === 2 /* View */ ? node.data : node.view;
  44811. return readElementValue(viewData[node.tNode.child.index]);
  44812. }
  44813. return null;
  44814. }
  44815. function getParentLNode(node) {
  44816. if (node.tNode.index === -1 && node.tNode.type === 2 /* View */) {
  44817. // This is a dynamically created view inside a dynamic container.
  44818. // If the host index is -1, the view has not yet been inserted, so it has no parent.
  44819. var containerHostIndex = node.data[CONTAINER_INDEX];
  44820. return containerHostIndex === -1 ? null : node.view[containerHostIndex].dynamicLContainerNode;
  44821. }
  44822. var parent = node.tNode.parent;
  44823. return readElementValue(parent ? node.view[parent.index] : node.view[HOST_NODE]);
  44824. }
  44825. /**
  44826. * Stack used to keep track of projection nodes in walkLNodeTree.
  44827. *
  44828. * This is deliberately created outside of walkLNodeTree to avoid allocating
  44829. * a new array each time the function is called. Instead the array will be
  44830. * re-used by each invocation. This works because the function is not reentrant.
  44831. */
  44832. var projectionNodeStack = [];
  44833. /**
  44834. * Walks a tree of LNodes, applying a transformation on the LElement nodes, either only on the first
  44835. * one found, or on all of them.
  44836. *
  44837. * @param startingNode the node from which the walk is started.
  44838. * @param rootNode the root node considered. This prevents walking past that node.
  44839. * @param action identifies the action to be performed on the LElement nodes.
  44840. * @param renderer the current renderer.
  44841. * @param renderParentNode Optional the render parent node to be set in all LContainerNodes found,
  44842. * required for action modes Insert and Destroy.
  44843. * @param beforeNode Optional the node before which elements should be added, required for action
  44844. * Insert.
  44845. */
  44846. function walkLNodeTree(startingNode, rootNode, action, renderer, renderParentNode, beforeNode) {
  44847. var node = startingNode;
  44848. var projectionNodeIndex = -1;
  44849. while (node) {
  44850. var nextNode = null;
  44851. var parent_1 = renderParentNode ? renderParentNode.native : null;
  44852. var nodeType = node.tNode.type;
  44853. if (nodeType === 3 /* Element */) {
  44854. // Execute the action
  44855. executeNodeAction(action, renderer, parent_1, node.native, beforeNode);
  44856. if (node.dynamicLContainerNode) {
  44857. executeNodeAction(action, renderer, parent_1, node.dynamicLContainerNode.native, beforeNode);
  44858. }
  44859. }
  44860. else if (nodeType === 0 /* Container */) {
  44861. executeNodeAction(action, renderer, parent_1, node.native, beforeNode);
  44862. var lContainerNode = node;
  44863. var childContainerData = lContainerNode.dynamicLContainerNode ?
  44864. lContainerNode.dynamicLContainerNode.data :
  44865. lContainerNode.data;
  44866. if (renderParentNode) {
  44867. childContainerData[RENDER_PARENT] = renderParentNode;
  44868. }
  44869. nextNode =
  44870. childContainerData[VIEWS].length ? getChildLNode(childContainerData[VIEWS][0]) : null;
  44871. if (nextNode) {
  44872. // When the walker enters a container, then the beforeNode has to become the local native
  44873. // comment node.
  44874. beforeNode = lContainerNode.dynamicLContainerNode ?
  44875. lContainerNode.dynamicLContainerNode.native :
  44876. lContainerNode.native;
  44877. }
  44878. }
  44879. else if (nodeType === 1 /* Projection */) {
  44880. var componentHost = findComponentHost(node.view);
  44881. var head = componentHost.tNode.projection[node.tNode.projection];
  44882. projectionNodeStack[++projectionNodeIndex] = node;
  44883. nextNode = head ? componentHost.data[PARENT][head.index] : null;
  44884. }
  44885. else {
  44886. // Otherwise look at the first child
  44887. nextNode = getChildLNode(node);
  44888. }
  44889. if (nextNode === null) {
  44890. nextNode = getNextLNode(node);
  44891. // this last node was projected, we need to get back down to its projection node
  44892. if (nextNode === null && (node.tNode.flags & 8192 /* isProjected */)) {
  44893. nextNode = getNextLNode(projectionNodeStack[projectionNodeIndex--]);
  44894. }
  44895. /**
  44896. * Find the next node in the LNode tree, taking into account the place where a node is
  44897. * projected (in the shadow DOM) rather than where it comes from (in the light DOM).
  44898. *
  44899. * If there is no sibling node, then it goes to the next sibling of the parent node...
  44900. * until it reaches rootNode (at which point null is returned).
  44901. */
  44902. while (node && !nextNode) {
  44903. node = getParentLNode(node);
  44904. if (node === null || node === rootNode)
  44905. return null;
  44906. // When exiting a container, the beforeNode must be restored to the previous value
  44907. if (!node.tNode.next && nodeType === 0 /* Container */) {
  44908. beforeNode = node.native;
  44909. }
  44910. nextNode = getNextLNode(node);
  44911. }
  44912. }
  44913. node = nextNode;
  44914. }
  44915. }
  44916. /**
  44917. * Given a current view, finds the nearest component's host (LElement).
  44918. *
  44919. * @param lViewData LViewData for which we want a host element node
  44920. * @returns The host node
  44921. */
  44922. function findComponentHost(lViewData) {
  44923. var viewRootLNode = lViewData[HOST_NODE];
  44924. while (viewRootLNode.tNode.type === 2 /* View */) {
  44925. ngDevMode && assertDefined(lViewData[PARENT], 'lViewData.parent');
  44926. lViewData = lViewData[PARENT];
  44927. viewRootLNode = lViewData[HOST_NODE];
  44928. }
  44929. ngDevMode && assertNodeType(viewRootLNode, 3 /* Element */);
  44930. ngDevMode && assertDefined(viewRootLNode.data, 'node.data');
  44931. return viewRootLNode;
  44932. }
  44933. /**
  44934. * NOTE: for performance reasons, the possible actions are inlined within the function instead of
  44935. * being passed as an argument.
  44936. */
  44937. function executeNodeAction(action, renderer, parent, node, beforeNode) {
  44938. if (action === 0 /* Insert */) {
  44939. isProceduralRenderer(renderer) ?
  44940. renderer.insertBefore(parent, node, beforeNode) :
  44941. parent.insertBefore(node, beforeNode, true);
  44942. }
  44943. else if (action === 1 /* Detach */) {
  44944. isProceduralRenderer(renderer) ?
  44945. renderer.removeChild(parent, node) :
  44946. parent.removeChild(node);
  44947. }
  44948. else if (action === 2 /* Destroy */) {
  44949. ngDevMode && ngDevMode.rendererDestroyNode++;
  44950. renderer.destroyNode(node);
  44951. }
  44952. }
  44953. function createTextNode(value, renderer) {
  44954. return isProceduralRenderer(renderer) ? renderer.createText(stringify$1(value)) :
  44955. renderer.createTextNode(stringify$1(value));
  44956. }
  44957. function addRemoveViewFromContainer(container, rootNode, insertMode, beforeNode) {
  44958. ngDevMode && assertNodeType(container, 0 /* Container */);
  44959. ngDevMode && assertNodeType(rootNode, 2 /* View */);
  44960. var parentNode = container.data[RENDER_PARENT];
  44961. var parent = parentNode ? parentNode.native : null;
  44962. if (parent) {
  44963. var node = getChildLNode(rootNode);
  44964. var renderer = container.view[RENDERER];
  44965. walkLNodeTree(node, rootNode, insertMode ? 0 /* Insert */ : 1 /* Detach */, renderer, parentNode, beforeNode);
  44966. }
  44967. }
  44968. /**
  44969. * Traverses down and up the tree of views and containers to remove listeners and
  44970. * call onDestroy callbacks.
  44971. *
  44972. * Notes:
  44973. * - Because it's used for onDestroy calls, it needs to be bottom-up.
  44974. * - Must process containers instead of their views to avoid splicing
  44975. * when views are destroyed and re-added.
  44976. * - Using a while loop because it's faster than recursion
  44977. * - Destroy only called on movement to sibling or movement to parent (laterally or up)
  44978. *
  44979. * @param rootView The view to destroy
  44980. */
  44981. function destroyViewTree(rootView) {
  44982. // If the view has no children, we can clean it up and return early.
  44983. if (rootView[TVIEW].childIndex === -1) {
  44984. return cleanUpView(rootView);
  44985. }
  44986. var viewOrContainer = getLViewChild(rootView);
  44987. while (viewOrContainer) {
  44988. var next = null;
  44989. if (viewOrContainer.length >= HEADER_OFFSET) {
  44990. // If LViewData, traverse down to child.
  44991. var view = viewOrContainer;
  44992. if (view[TVIEW].childIndex > -1)
  44993. next = getLViewChild(view);
  44994. }
  44995. else {
  44996. // If container, traverse down to its first LViewData.
  44997. var container = viewOrContainer;
  44998. if (container[VIEWS].length)
  44999. next = container[VIEWS][0].data;
  45000. }
  45001. if (next == null) {
  45002. // Only clean up view when moving to the side or up, as destroy hooks
  45003. // should be called in order from the bottom up.
  45004. while (viewOrContainer && !viewOrContainer[NEXT] && viewOrContainer !== rootView) {
  45005. cleanUpView(viewOrContainer);
  45006. viewOrContainer = getParentState(viewOrContainer, rootView);
  45007. }
  45008. cleanUpView(viewOrContainer || rootView);
  45009. next = viewOrContainer && viewOrContainer[NEXT];
  45010. }
  45011. viewOrContainer = next;
  45012. }
  45013. }
  45014. /**
  45015. * Inserts a view into a container.
  45016. *
  45017. * This adds the view to the container's array of active views in the correct
  45018. * position. It also adds the view's elements to the DOM if the container isn't a
  45019. * root node of another view (in that case, the view's elements will be added when
  45020. * the container's parent view is added later).
  45021. *
  45022. * @param container The container into which the view should be inserted
  45023. * @param viewNode The view to insert
  45024. * @param index The index at which to insert the view
  45025. * @returns The inserted view
  45026. */
  45027. function insertView(container, viewNode, index) {
  45028. var state = container.data;
  45029. var views = state[VIEWS];
  45030. var lView = viewNode.data;
  45031. if (index > 0) {
  45032. // This is a new view, we need to add it to the children.
  45033. views[index - 1].data[NEXT] = lView;
  45034. }
  45035. if (index < views.length) {
  45036. lView[NEXT] = views[index].data;
  45037. views.splice(index, 0, viewNode);
  45038. }
  45039. else {
  45040. views.push(viewNode);
  45041. lView[NEXT] = null;
  45042. }
  45043. // Dynamically inserted views need a reference to their parent container'S host so it's
  45044. // possible to jump from a view to its container's next when walking the node tree.
  45045. if (viewNode.tNode.index === -1) {
  45046. lView[CONTAINER_INDEX] = container.tNode.parent.index;
  45047. viewNode.view = container.view;
  45048. }
  45049. // Notify query that a new view has been added
  45050. if (lView[QUERIES]) {
  45051. lView[QUERIES].insertView(index);
  45052. }
  45053. // Sets the attached flag
  45054. lView[FLAGS] |= 8 /* Attached */;
  45055. return viewNode;
  45056. }
  45057. /**
  45058. * Detaches a view from a container.
  45059. *
  45060. * This method splices the view from the container's array of active views. It also
  45061. * removes the view's elements from the DOM.
  45062. *
  45063. * @param container The container from which to detach a view
  45064. * @param removeIndex The index of the view to detach
  45065. * @returns The detached view
  45066. */
  45067. function detachView(container, removeIndex) {
  45068. var views = container.data[VIEWS];
  45069. var viewNode = views[removeIndex];
  45070. if (removeIndex > 0) {
  45071. views[removeIndex - 1].data[NEXT] = viewNode.data[NEXT];
  45072. }
  45073. views.splice(removeIndex, 1);
  45074. if (!container.tNode.detached) {
  45075. addRemoveViewFromContainer(container, viewNode, false);
  45076. }
  45077. // Notify query that view has been removed
  45078. var removedLView = viewNode.data;
  45079. if (removedLView[QUERIES]) {
  45080. removedLView[QUERIES].removeView();
  45081. }
  45082. removedLView[CONTAINER_INDEX] = -1;
  45083. viewNode.view = null;
  45084. // Unsets the attached flag
  45085. viewNode.data[FLAGS] &= ~8 /* Attached */;
  45086. return viewNode;
  45087. }
  45088. /**
  45089. * Removes a view from a container, i.e. detaches it and then destroys the underlying LView.
  45090. *
  45091. * @param container The container from which to remove a view
  45092. * @param removeIndex The index of the view to remove
  45093. * @returns The removed view
  45094. */
  45095. function removeView(container, removeIndex) {
  45096. var viewNode = container.data[VIEWS][removeIndex];
  45097. detachView(container, removeIndex);
  45098. destroyLView(viewNode.data);
  45099. return viewNode;
  45100. }
  45101. /** Gets the child of the given LViewData */
  45102. function getLViewChild(viewData) {
  45103. if (viewData[TVIEW].childIndex === -1)
  45104. return null;
  45105. var hostNode = viewData[viewData[TVIEW].childIndex];
  45106. return hostNode.data ? hostNode.data : hostNode.dynamicLContainerNode.data;
  45107. }
  45108. /**
  45109. * A standalone function which destroys an LView,
  45110. * conducting cleanup (e.g. removing listeners, calling onDestroys).
  45111. *
  45112. * @param view The view to be destroyed.
  45113. */
  45114. function destroyLView(view) {
  45115. var renderer = view[RENDERER];
  45116. if (isProceduralRenderer(renderer) && renderer.destroyNode) {
  45117. walkLNodeTree(view[HOST_NODE], view[HOST_NODE], 2 /* Destroy */, renderer);
  45118. }
  45119. destroyViewTree(view);
  45120. // Sets the destroyed flag
  45121. view[FLAGS] |= 32 /* Destroyed */;
  45122. }
  45123. /**
  45124. * Determines which LViewOrLContainer to jump to when traversing back up the
  45125. * tree in destroyViewTree.
  45126. *
  45127. * Normally, the view's parent LView should be checked, but in the case of
  45128. * embedded views, the container (which is the view node's parent, but not the
  45129. * LView's parent) needs to be checked for a possible next property.
  45130. *
  45131. * @param state The LViewOrLContainer for which we need a parent state
  45132. * @param rootView The rootView, so we don't propagate too far up the view tree
  45133. * @returns The correct parent LViewOrLContainer
  45134. */
  45135. function getParentState(state, rootView) {
  45136. var node;
  45137. if ((node = state[HOST_NODE]) && node.tNode.type === 2 /* View */) {
  45138. // if it's an embedded view, the state needs to go up to the container, in case the
  45139. // container has a next
  45140. return getParentLNode(node).data;
  45141. }
  45142. else {
  45143. // otherwise, use parent view for containers or component views
  45144. return state[PARENT] === rootView ? null : state[PARENT];
  45145. }
  45146. }
  45147. /**
  45148. * Removes all listeners and call all onDestroys in a given view.
  45149. *
  45150. * @param view The LViewData to clean up
  45151. */
  45152. function cleanUpView(viewOrContainer) {
  45153. if (viewOrContainer[TVIEW]) {
  45154. var view = viewOrContainer;
  45155. removeListeners(view);
  45156. executeOnDestroys(view);
  45157. executePipeOnDestroys(view);
  45158. // For component views only, the local renderer is destroyed as clean up time.
  45159. if (view[TVIEW].id === -1 && isProceduralRenderer(view[RENDERER])) {
  45160. ngDevMode && ngDevMode.rendererDestroy++;
  45161. view[RENDERER].destroy();
  45162. }
  45163. }
  45164. }
  45165. /** Removes listeners and unsubscribes from output subscriptions */
  45166. function removeListeners(viewData) {
  45167. var cleanup = viewData[TVIEW].cleanup;
  45168. if (cleanup != null) {
  45169. for (var i = 0; i < cleanup.length - 1; i += 2) {
  45170. if (typeof cleanup[i] === 'string') {
  45171. // This is a listener with the native renderer
  45172. var native = readElementValue(viewData[cleanup[i + 1]]).native;
  45173. var listener = viewData[CLEANUP][cleanup[i + 2]];
  45174. native.removeEventListener(cleanup[i], listener, cleanup[i + 3]);
  45175. i += 2;
  45176. }
  45177. else if (typeof cleanup[i] === 'number') {
  45178. // This is a listener with renderer2 (cleanup fn can be found by index)
  45179. var cleanupFn = viewData[CLEANUP][cleanup[i]];
  45180. cleanupFn();
  45181. }
  45182. else {
  45183. // This is a cleanup function that is grouped with the index of its context
  45184. var context = viewData[CLEANUP][cleanup[i + 1]];
  45185. cleanup[i].call(context);
  45186. }
  45187. }
  45188. viewData[CLEANUP] = null;
  45189. }
  45190. }
  45191. /** Calls onDestroy hooks for this view */
  45192. function executeOnDestroys(view) {
  45193. var tView = view[TVIEW];
  45194. var destroyHooks;
  45195. if (tView != null && (destroyHooks = tView.destroyHooks) != null) {
  45196. callHooks(view[DIRECTIVES], destroyHooks);
  45197. }
  45198. }
  45199. /** Calls pipe destroy hooks for this view */
  45200. function executePipeOnDestroys(viewData) {
  45201. var pipeDestroyHooks = viewData[TVIEW] && viewData[TVIEW].pipeDestroyHooks;
  45202. if (pipeDestroyHooks) {
  45203. callHooks(viewData, pipeDestroyHooks);
  45204. }
  45205. }
  45206. /**
  45207. * Returns whether a native element can be inserted into the given parent.
  45208. *
  45209. * There are two reasons why we may not be able to insert a element immediately.
  45210. * - Projection: When creating a child content element of a component, we have to skip the
  45211. * insertion because the content of a component will be projected.
  45212. * `<component><content>delayed due to projection</content></component>`
  45213. * - Parent container is disconnected: This can happen when we are inserting a view into
  45214. * parent container, which itself is disconnected. For example the parent container is part
  45215. * of a View which has not be inserted or is mare for projection but has not been inserted
  45216. * into destination.
  45217. *
  45218. *
  45219. * @param parent The parent where the child will be inserted into.
  45220. * @param currentView Current LView being processed.
  45221. * @return boolean Whether the child should be inserted now (or delayed until later).
  45222. */
  45223. function canInsertNativeNode(parent, currentView) {
  45224. // We can only insert into a Component or View. Any other type should be an Error.
  45225. ngDevMode && assertNodeOfPossibleTypes(parent, 3 /* Element */, 2 /* View */);
  45226. if (parent.tNode.type === 3 /* Element */) {
  45227. // Parent is an element.
  45228. if (parent.view !== currentView) {
  45229. // If the Parent view is not the same as current view than we are inserting across
  45230. // Views. This happens when we insert a root element of the component view into
  45231. // the component host element and it should always be eager.
  45232. return true;
  45233. }
  45234. // Parent elements can be a component which may have projection.
  45235. if (parent.data === null) {
  45236. // Parent is a regular non-component element. We should eagerly insert into it
  45237. // since we know that this relationship will never be broken.
  45238. return true;
  45239. }
  45240. else {
  45241. // Parent is a Component. Component's content nodes are not inserted immediately
  45242. // because they will be projected, and so doing insert at this point would be wasteful.
  45243. // Since the projection would than move it to its final destination.
  45244. return false;
  45245. }
  45246. }
  45247. else {
  45248. // Parent is a View.
  45249. ngDevMode && assertNodeType(parent, 2 /* View */);
  45250. // Because we are inserting into a `View` the `View` may be disconnected.
  45251. var grandParentContainer = getParentLNode(parent);
  45252. if (grandParentContainer == null) {
  45253. // The `View` is not inserted into a `Container` we have to delay insertion.
  45254. return false;
  45255. }
  45256. ngDevMode && assertNodeType(grandParentContainer, 0 /* Container */);
  45257. if (grandParentContainer.data[RENDER_PARENT] == null) {
  45258. // The parent `Container` itself is disconnected. So we have to delay.
  45259. return false;
  45260. }
  45261. else {
  45262. // The parent `Container` is in inserted state, so we can eagerly insert into
  45263. // this location.
  45264. return true;
  45265. }
  45266. }
  45267. }
  45268. /**
  45269. * Appends the `child` element to the `parent`.
  45270. *
  45271. * The element insertion might be delayed {@link canInsertNativeNode}.
  45272. *
  45273. * @param parent The parent to which to append the child
  45274. * @param child The child that should be appended
  45275. * @param currentView The current LView
  45276. * @returns Whether or not the child was appended
  45277. */
  45278. function appendChild(parent, child, currentView) {
  45279. if (child !== null && canInsertNativeNode(parent, currentView)) {
  45280. var renderer = currentView[RENDERER];
  45281. if (parent.tNode.type === 2 /* View */) {
  45282. var container = getParentLNode(parent);
  45283. var renderParent = container.data[RENDER_PARENT];
  45284. var views = container.data[VIEWS];
  45285. var index = views.indexOf(parent);
  45286. var beforeNode = index + 1 < views.length ? (getChildLNode(views[index + 1])).native : container.native;
  45287. isProceduralRenderer(renderer) ?
  45288. renderer.insertBefore(renderParent.native, child, beforeNode) :
  45289. renderParent.native.insertBefore(child, beforeNode, true);
  45290. }
  45291. else {
  45292. isProceduralRenderer(renderer) ? renderer.appendChild(parent.native, child) :
  45293. parent.native.appendChild(child);
  45294. }
  45295. return true;
  45296. }
  45297. return false;
  45298. }
  45299. /**
  45300. * Removes the `child` element of the `parent` from the DOM.
  45301. *
  45302. * @param parent The parent from which to remove the child
  45303. * @param child The child that should be removed
  45304. * @param currentView The current LView
  45305. * @returns Whether or not the child was removed
  45306. */
  45307. function removeChild(parent, child, currentView) {
  45308. if (child !== null && canInsertNativeNode(parent, currentView)) {
  45309. // We only remove the element if not in View or not projected.
  45310. var renderer = currentView[RENDERER];
  45311. isProceduralRenderer(renderer) ? renderer.removeChild(parent.native, child) :
  45312. parent.native.removeChild(child);
  45313. return true;
  45314. }
  45315. return false;
  45316. }
  45317. /**
  45318. * Appends a projected node to the DOM, or in the case of a projected container,
  45319. * appends the nodes from all of the container's active views to the DOM.
  45320. *
  45321. * @param node The node to process
  45322. * @param currentParent The last parent element to be processed
  45323. * @param currentView Current LView
  45324. */
  45325. function appendProjectedNode(node, currentParent, currentView, renderParent) {
  45326. appendChild(currentParent, node.native, currentView);
  45327. if (node.tNode.type === 0 /* Container */) {
  45328. // The node we are adding is a container and we are adding it to an element which
  45329. // is not a component (no more re-projection).
  45330. // Alternatively a container is projected at the root of a component's template
  45331. // and can't be re-projected (as not content of any component).
  45332. // Assign the final projection location in those cases.
  45333. var lContainer = node.data;
  45334. lContainer[RENDER_PARENT] = renderParent;
  45335. var views = lContainer[VIEWS];
  45336. for (var i = 0; i < views.length; i++) {
  45337. addRemoveViewFromContainer(node, views[i], true, node.native);
  45338. }
  45339. }
  45340. if (node.dynamicLContainerNode) {
  45341. node.dynamicLContainerNode.data[RENDER_PARENT] = renderParent;
  45342. appendChild(currentParent, node.dynamicLContainerNode.native, currentView);
  45343. }
  45344. }
  45345. /**
  45346. * @license
  45347. * Copyright Google Inc. All Rights Reserved.
  45348. *
  45349. * Use of this source code is governed by an MIT-style license that can be
  45350. * found in the LICENSE file at https://angular.io/license
  45351. */
  45352. function isCssClassMatching(nodeClassAttrVal, cssClassToMatch) {
  45353. var nodeClassesLen = nodeClassAttrVal.length;
  45354. var matchIndex = nodeClassAttrVal.indexOf(cssClassToMatch);
  45355. var matchEndIdx = matchIndex + cssClassToMatch.length;
  45356. if (matchIndex === -1 // no match
  45357. || (matchIndex > 0 && nodeClassAttrVal[matchIndex - 1] !== ' ') // no space before
  45358. ||
  45359. (matchEndIdx < nodeClassesLen && nodeClassAttrVal[matchEndIdx] !== ' ')) // no space after
  45360. {
  45361. return false;
  45362. }
  45363. return true;
  45364. }
  45365. /**
  45366. * A utility function to match an Ivy node static data against a simple CSS selector
  45367. *
  45368. * @param node static data to match
  45369. * @param selector
  45370. * @returns true if node matches the selector.
  45371. */
  45372. function isNodeMatchingSelector(tNode, selector) {
  45373. ngDevMode && assertDefined(selector[0], 'Selector should have a tag name');
  45374. var mode = 4 /* ELEMENT */;
  45375. var nodeAttrs = tNode.attrs;
  45376. var selectOnlyMarkerIdx = nodeAttrs ? nodeAttrs.indexOf(1 /* SelectOnly */) : -1;
  45377. // When processing ":not" selectors, we skip to the next ":not" if the
  45378. // current one doesn't match
  45379. var skipToNextSelector = false;
  45380. for (var i = 0; i < selector.length; i++) {
  45381. var current = selector[i];
  45382. if (typeof current === 'number') {
  45383. // If we finish processing a :not selector and it hasn't failed, return false
  45384. if (!skipToNextSelector && !isPositive(mode) && !isPositive(current)) {
  45385. return false;
  45386. }
  45387. // If we are skipping to the next :not() and this mode flag is positive,
  45388. // it's a part of the current :not() selector, and we should keep skipping
  45389. if (skipToNextSelector && isPositive(current))
  45390. continue;
  45391. skipToNextSelector = false;
  45392. mode = current | (mode & 1 /* NOT */);
  45393. continue;
  45394. }
  45395. if (skipToNextSelector)
  45396. continue;
  45397. if (mode & 4 /* ELEMENT */) {
  45398. mode = 2 /* ATTRIBUTE */ | mode & 1 /* NOT */;
  45399. if (current !== '' && current !== tNode.tagName) {
  45400. if (isPositive(mode))
  45401. return false;
  45402. skipToNextSelector = true;
  45403. }
  45404. }
  45405. else {
  45406. var attrName = mode & 8 /* CLASS */ ? 'class' : current;
  45407. var attrIndexInNode = findAttrIndexInNode(attrName, nodeAttrs);
  45408. if (attrIndexInNode === -1) {
  45409. if (isPositive(mode))
  45410. return false;
  45411. skipToNextSelector = true;
  45412. continue;
  45413. }
  45414. var selectorAttrValue = mode & 8 /* CLASS */ ? current : selector[++i];
  45415. if (selectorAttrValue !== '') {
  45416. var nodeAttrValue = void 0;
  45417. var maybeAttrName = nodeAttrs[attrIndexInNode];
  45418. if (selectOnlyMarkerIdx > -1 && attrIndexInNode > selectOnlyMarkerIdx) {
  45419. nodeAttrValue = '';
  45420. }
  45421. else {
  45422. ngDevMode && assertNotEqual(maybeAttrName, 0 /* NamespaceURI */, 'We do not match directives on namespaced attributes');
  45423. nodeAttrValue = nodeAttrs[attrIndexInNode + 1];
  45424. }
  45425. if (mode & 8 /* CLASS */ &&
  45426. !isCssClassMatching(nodeAttrValue, selectorAttrValue) ||
  45427. mode & 2 /* ATTRIBUTE */ && selectorAttrValue !== nodeAttrValue) {
  45428. if (isPositive(mode))
  45429. return false;
  45430. skipToNextSelector = true;
  45431. }
  45432. }
  45433. }
  45434. }
  45435. return isPositive(mode) || skipToNextSelector;
  45436. }
  45437. function isPositive(mode) {
  45438. return (mode & 1 /* NOT */) === 0;
  45439. }
  45440. /**
  45441. * Examines an attributes definition array from a node to find the index of the
  45442. * attribute with the specified name.
  45443. *
  45444. * NOTE: Will not find namespaced attributes.
  45445. *
  45446. * @param name the name of the attribute to find
  45447. * @param attrs the attribute array to examine
  45448. */
  45449. function findAttrIndexInNode(name, attrs) {
  45450. if (attrs === null)
  45451. return -1;
  45452. var selectOnlyMode = false;
  45453. var i = 0;
  45454. while (i < attrs.length) {
  45455. var maybeAttrName = attrs[i];
  45456. if (maybeAttrName === name) {
  45457. return i;
  45458. }
  45459. else if (maybeAttrName === 0 /* NamespaceURI */) {
  45460. // NOTE(benlesh): will not find namespaced attributes. This is by design.
  45461. i += 4;
  45462. }
  45463. else {
  45464. if (maybeAttrName === 1 /* SelectOnly */) {
  45465. selectOnlyMode = true;
  45466. }
  45467. i += selectOnlyMode ? 1 : 2;
  45468. }
  45469. }
  45470. return -1;
  45471. }
  45472. function isNodeMatchingSelectorList(tNode, selector) {
  45473. for (var i = 0; i < selector.length; i++) {
  45474. if (isNodeMatchingSelector(tNode, selector[i])) {
  45475. return true;
  45476. }
  45477. }
  45478. return false;
  45479. }
  45480. function getProjectAsAttrValue(tNode) {
  45481. var nodeAttrs = tNode.attrs;
  45482. if (nodeAttrs != null) {
  45483. var ngProjectAsAttrIdx = nodeAttrs.indexOf(NG_PROJECT_AS_ATTR_NAME);
  45484. // only check for ngProjectAs in attribute names, don't accidentally match attribute's value
  45485. // (attribute names are stored at even indexes)
  45486. if ((ngProjectAsAttrIdx & 1) === 0) {
  45487. return nodeAttrs[ngProjectAsAttrIdx + 1];
  45488. }
  45489. }
  45490. return null;
  45491. }
  45492. /**
  45493. * Checks a given node against matching selectors and returns
  45494. * selector index (or 0 if none matched).
  45495. *
  45496. * This function takes into account the ngProjectAs attribute: if present its value will be compared
  45497. * to the raw (un-parsed) CSS selector instead of using standard selector matching logic.
  45498. */
  45499. function matchingSelectorIndex(tNode, selectors, textSelectors) {
  45500. var ngProjectAsAttrVal = getProjectAsAttrValue(tNode);
  45501. for (var i = 0; i < selectors.length; i++) {
  45502. // if a node has the ngProjectAs attribute match it against unparsed selector
  45503. // match a node against a parsed selector only if ngProjectAs attribute is not present
  45504. if (ngProjectAsAttrVal === textSelectors[i] ||
  45505. ngProjectAsAttrVal === null && isNodeMatchingSelectorList(tNode, selectors[i])) {
  45506. return i + 1; // first matching selector "captures" a given node
  45507. }
  45508. }
  45509. return 0;
  45510. }
  45511. /**
  45512. * @license
  45513. * Copyright Google Inc. All Rights Reserved.
  45514. *
  45515. * Use of this source code is governed by an MIT-style license that can be
  45516. * found in the LICENSE file at https://angular.io/license
  45517. */
  45518. /**
  45519. * Used clone a copy of a pre-computed template of a styling context.
  45520. *
  45521. * A pre-computed template is designed to be computed once for a given element
  45522. * (instructions.ts has logic for caching this).
  45523. */
  45524. function allocStylingContext(lElement, templateStyleContext) {
  45525. // each instance gets a copy
  45526. var context = templateStyleContext.slice();
  45527. context[0 /* ElementPosition */] = lElement;
  45528. return context;
  45529. }
  45530. /**
  45531. * Creates a styling context template where styling information is stored.
  45532. * Any styles that are later referenced using `updateStyleProp` must be
  45533. * passed in within this function. Initial values for those styles are to
  45534. * be declared after all initial style properties are declared (this change in
  45535. * mode between declarations and initial styles is made possible using a special
  45536. * enum value found in `definition.ts`).
  45537. *
  45538. * @param initialStyleDeclarations a list of style declarations and initial style values
  45539. * that are used later within the styling context.
  45540. *
  45541. * -> ['width', 'height', SPECIAL_ENUM_VAL, 'width', '100px']
  45542. * This implies that `width` and `height` will be later styled and that the `width`
  45543. * property has an initial value of `100px`.
  45544. *
  45545. * @param initialClassDeclarations a list of class declarations and initial class values
  45546. * that are used later within the styling context.
  45547. *
  45548. * -> ['foo', 'bar', SPECIAL_ENUM_VAL, 'foo', true]
  45549. * This implies that `foo` and `bar` will be later styled and that the `foo`
  45550. * class will be applied to the element as an initial class since it's true
  45551. */
  45552. function createStylingContextTemplate(initialClassDeclarations, initialStyleDeclarations, styleSanitizer) {
  45553. var initialStylingValues = [null];
  45554. var context = [null, styleSanitizer || null, initialStylingValues, 0, 0, null];
  45555. // we use two maps since a class name might collide with a CSS style prop
  45556. var stylesLookup = {};
  45557. var classesLookup = {};
  45558. var totalStyleDeclarations = 0;
  45559. if (initialStyleDeclarations) {
  45560. var hasPassedDeclarations = false;
  45561. for (var i = 0; i < initialStyleDeclarations.length; i++) {
  45562. var v = initialStyleDeclarations[i];
  45563. // this flag value marks where the declarations end the initial values begin
  45564. if (v === 1 /* VALUES_MODE */) {
  45565. hasPassedDeclarations = true;
  45566. }
  45567. else {
  45568. var prop = v;
  45569. if (hasPassedDeclarations) {
  45570. var value = initialStyleDeclarations[++i];
  45571. initialStylingValues.push(value);
  45572. stylesLookup[prop] = initialStylingValues.length - 1;
  45573. }
  45574. else {
  45575. totalStyleDeclarations++;
  45576. stylesLookup[prop] = 0;
  45577. }
  45578. }
  45579. }
  45580. }
  45581. // make where the class offsets begin
  45582. context[4 /* ClassOffsetPosition */] = totalStyleDeclarations;
  45583. if (initialClassDeclarations) {
  45584. var hasPassedDeclarations = false;
  45585. for (var i = 0; i < initialClassDeclarations.length; i++) {
  45586. var v = initialClassDeclarations[i];
  45587. // this flag value marks where the declarations end the initial values begin
  45588. if (v === 1 /* VALUES_MODE */) {
  45589. hasPassedDeclarations = true;
  45590. }
  45591. else {
  45592. var className = v;
  45593. if (hasPassedDeclarations) {
  45594. var value = initialClassDeclarations[++i];
  45595. initialStylingValues.push(value);
  45596. classesLookup[className] = initialStylingValues.length - 1;
  45597. }
  45598. else {
  45599. classesLookup[className] = 0;
  45600. }
  45601. }
  45602. }
  45603. }
  45604. var styleProps = Object.keys(stylesLookup);
  45605. var classNames = Object.keys(classesLookup);
  45606. var classNamesIndexStart = styleProps.length;
  45607. var totalProps = styleProps.length + classNames.length;
  45608. // *2 because we are filling for both single and multi style spaces
  45609. var maxLength = totalProps * 3 /* Size */ * 2 + 6 /* SingleStylesStartPosition */;
  45610. // we need to fill the array from the start so that we can access
  45611. // both the multi and the single array positions in the same loop block
  45612. for (var i = 6 /* SingleStylesStartPosition */; i < maxLength; i++) {
  45613. context.push(null);
  45614. }
  45615. var singleStart = 6 /* SingleStylesStartPosition */;
  45616. var multiStart = totalProps * 3 /* Size */ + 6 /* SingleStylesStartPosition */;
  45617. // fill single and multi-level styles
  45618. for (var i = 0; i < totalProps; i++) {
  45619. var isClassBased_1 = i >= classNamesIndexStart;
  45620. var prop = isClassBased_1 ? classNames[i - classNamesIndexStart] : styleProps[i];
  45621. var indexForInitial = isClassBased_1 ? classesLookup[prop] : stylesLookup[prop];
  45622. var initialValue = initialStylingValues[indexForInitial];
  45623. var indexForMulti = i * 3 /* Size */ + multiStart;
  45624. var indexForSingle = i * 3 /* Size */ + singleStart;
  45625. var initialFlag = prepareInitialFlag(prop, isClassBased_1, styleSanitizer || null);
  45626. setFlag(context, indexForSingle, pointers(initialFlag, indexForInitial, indexForMulti));
  45627. setProp(context, indexForSingle, prop);
  45628. setValue(context, indexForSingle, null);
  45629. var flagForMulti = initialFlag | (initialValue !== null ? 1 /* Dirty */ : 0 /* None */);
  45630. setFlag(context, indexForMulti, pointers(flagForMulti, indexForInitial, indexForSingle));
  45631. setProp(context, indexForMulti, prop);
  45632. setValue(context, indexForMulti, null);
  45633. }
  45634. // there is no initial value flag for the master index since it doesn't
  45635. // reference an initial style value
  45636. setFlag(context, 3 /* MasterFlagPosition */, pointers(0, 0, multiStart));
  45637. setContextDirty(context, initialStylingValues.length > 1);
  45638. return context;
  45639. }
  45640. var EMPTY_ARR = [];
  45641. var EMPTY_OBJ = {};
  45642. /**
  45643. * Sets and resolves all `multi` styling on an `StylingContext` so that they can be
  45644. * applied to the element once `renderStyling` is called.
  45645. *
  45646. * All missing styles/class (any values that are not provided in the new `styles`
  45647. * or `classes` params) will resolve to `null` within their respective positions
  45648. * in the context.
  45649. *
  45650. * @param context The styling context that will be updated with the
  45651. * newly provided style values.
  45652. * @param classes The key/value map of CSS class names that will be used for the update.
  45653. * @param styles The key/value map of CSS styles that will be used for the update.
  45654. */
  45655. function updateStylingMap(context, classes, styles) {
  45656. var classNames = EMPTY_ARR;
  45657. var applyAllClasses = false;
  45658. var ignoreAllClassUpdates = false;
  45659. // each time a string-based value pops up then it shouldn't require a deep
  45660. // check of what's changed.
  45661. if (typeof classes == 'string') {
  45662. var cachedClassString = context[5 /* CachedCssClassString */];
  45663. if (cachedClassString && cachedClassString === classes) {
  45664. ignoreAllClassUpdates = true;
  45665. }
  45666. else {
  45667. context[5 /* CachedCssClassString */] = classes;
  45668. classNames = classes.split(/\s+/);
  45669. // this boolean is used to avoid having to create a key/value map of `true` values
  45670. // since a classname string implies that all those classes are added
  45671. applyAllClasses = true;
  45672. }
  45673. }
  45674. else {
  45675. classNames = classes ? Object.keys(classes) : EMPTY_ARR;
  45676. context[5 /* CachedCssClassString */] = null;
  45677. }
  45678. classes = (classes || EMPTY_OBJ);
  45679. var styleProps = styles ? Object.keys(styles) : EMPTY_ARR;
  45680. styles = styles || EMPTY_OBJ;
  45681. var classesStartIndex = styleProps.length;
  45682. var multiStartIndex = getMultiStartIndex(context);
  45683. var dirty = false;
  45684. var ctxIndex = multiStartIndex;
  45685. var propIndex = 0;
  45686. var propLimit = styleProps.length + classNames.length;
  45687. // the main loop here will try and figure out how the shape of the provided
  45688. // styles differ with respect to the context. Later if the context/styles/classes
  45689. // are off-balance then they will be dealt in another loop after this one
  45690. while (ctxIndex < context.length && propIndex < propLimit) {
  45691. var isClassBased_2 = propIndex >= classesStartIndex;
  45692. // when there is a cache-hit for a string-based class then we should
  45693. // avoid doing any work diffing any of the changes
  45694. if (!ignoreAllClassUpdates || !isClassBased_2) {
  45695. var adjustedPropIndex = isClassBased_2 ? propIndex - classesStartIndex : propIndex;
  45696. var newProp = isClassBased_2 ? classNames[adjustedPropIndex] : styleProps[adjustedPropIndex];
  45697. var newValue = isClassBased_2 ? (applyAllClasses ? true : classes[newProp]) : styles[newProp];
  45698. var prop = getProp(context, ctxIndex);
  45699. if (prop === newProp) {
  45700. var value = getValue(context, ctxIndex);
  45701. var flag = getPointers(context, ctxIndex);
  45702. if (hasValueChanged(flag, value, newValue)) {
  45703. setValue(context, ctxIndex, newValue);
  45704. var initialValue = getInitialValue(context, flag);
  45705. // there is no point in setting this to dirty if the previously
  45706. // rendered value was being referenced by the initial style (or null)
  45707. if (initialValue !== newValue) {
  45708. setDirty(context, ctxIndex, true);
  45709. dirty = true;
  45710. }
  45711. }
  45712. }
  45713. else {
  45714. var indexOfEntry = findEntryPositionByProp(context, newProp, ctxIndex);
  45715. if (indexOfEntry > 0) {
  45716. // it was found at a later point ... just swap the values
  45717. var valueToCompare = getValue(context, indexOfEntry);
  45718. var flagToCompare = getPointers(context, indexOfEntry);
  45719. swapMultiContextEntries(context, ctxIndex, indexOfEntry);
  45720. if (valueToCompare !== newValue) {
  45721. var initialValue = getInitialValue(context, flagToCompare);
  45722. setValue(context, ctxIndex, newValue);
  45723. if (initialValue !== newValue) {
  45724. setDirty(context, ctxIndex, true);
  45725. dirty = true;
  45726. }
  45727. }
  45728. }
  45729. else {
  45730. // we only care to do this if the insertion is in the middle
  45731. var newFlag = prepareInitialFlag(newProp, isClassBased_2, getStyleSanitizer(context));
  45732. insertNewMultiProperty(context, ctxIndex, isClassBased_2, newProp, newFlag, newValue);
  45733. dirty = true;
  45734. }
  45735. }
  45736. }
  45737. ctxIndex += 3 /* Size */;
  45738. propIndex++;
  45739. }
  45740. // this means that there are left-over values in the context that
  45741. // were not included in the provided styles/classes and in this
  45742. // case the goal is to "remove" them from the context (by nullifying)
  45743. while (ctxIndex < context.length) {
  45744. var flag = getPointers(context, ctxIndex);
  45745. var isClassBased_3 = (flag & 2 /* Class */) === 2 /* Class */;
  45746. if (ignoreAllClassUpdates && isClassBased_3)
  45747. break;
  45748. var value = getValue(context, ctxIndex);
  45749. var doRemoveValue = valueExists(value, isClassBased_3);
  45750. if (doRemoveValue) {
  45751. setDirty(context, ctxIndex, true);
  45752. setValue(context, ctxIndex, null);
  45753. dirty = true;
  45754. }
  45755. ctxIndex += 3 /* Size */;
  45756. }
  45757. // this means that there are left-over properties in the context that
  45758. // were not detected in the context during the loop above. In that
  45759. // case we want to add the new entries into the list
  45760. var sanitizer = getStyleSanitizer(context);
  45761. while (propIndex < propLimit) {
  45762. var isClassBased_4 = propIndex >= classesStartIndex;
  45763. if (ignoreAllClassUpdates && isClassBased_4)
  45764. break;
  45765. var adjustedPropIndex = isClassBased_4 ? propIndex - classesStartIndex : propIndex;
  45766. var prop = isClassBased_4 ? classNames[adjustedPropIndex] : styleProps[adjustedPropIndex];
  45767. var value = isClassBased_4 ? (applyAllClasses ? true : classes[prop]) : styles[prop];
  45768. var flag = prepareInitialFlag(prop, isClassBased_4, sanitizer) | 1 /* Dirty */;
  45769. context.push(flag, prop, value);
  45770. propIndex++;
  45771. dirty = true;
  45772. }
  45773. if (dirty) {
  45774. setContextDirty(context, true);
  45775. }
  45776. }
  45777. /**
  45778. * Sets and resolves a single styling property/value on the provided `StylingContext` so
  45779. * that they can be applied to the element once `renderStyling` is called.
  45780. *
  45781. * Note that prop-level styling values are considered higher priority than any styling that
  45782. * has been applied using `updateStylingMap`, therefore, when styling values are rendered
  45783. * then any styles/classes that have been applied using this function will be considered first
  45784. * (then multi values second and then initial values as a backup).
  45785. *
  45786. * @param context The styling context that will be updated with the
  45787. * newly provided style value.
  45788. * @param index The index of the property which is being updated.
  45789. * @param value The CSS style value that will be assigned
  45790. */
  45791. function updateStyleProp(context, index, value) {
  45792. var singleIndex = 6 /* SingleStylesStartPosition */ + index * 3 /* Size */;
  45793. var currValue = getValue(context, singleIndex);
  45794. var currFlag = getPointers(context, singleIndex);
  45795. // didn't change ... nothing to make a note of
  45796. if (hasValueChanged(currFlag, currValue, value)) {
  45797. // the value will always get updated (even if the dirty flag is skipped)
  45798. setValue(context, singleIndex, value);
  45799. var indexForMulti = getMultiOrSingleIndex(currFlag);
  45800. // if the value is the same in the multi-area then there's no point in re-assembling
  45801. var valueForMulti = getValue(context, indexForMulti);
  45802. if (!valueForMulti || valueForMulti !== value) {
  45803. var multiDirty = false;
  45804. var singleDirty = true;
  45805. var isClassBased_5 = (currFlag & 2 /* Class */) === 2 /* Class */;
  45806. // only when the value is set to `null` should the multi-value get flagged
  45807. if (!valueExists(value, isClassBased_5) && valueExists(valueForMulti, isClassBased_5)) {
  45808. multiDirty = true;
  45809. singleDirty = false;
  45810. }
  45811. setDirty(context, indexForMulti, multiDirty);
  45812. setDirty(context, singleIndex, singleDirty);
  45813. setContextDirty(context, true);
  45814. }
  45815. }
  45816. }
  45817. /**
  45818. * This method will toggle the referenced CSS class (by the provided index)
  45819. * within the given context.
  45820. *
  45821. * @param context The styling context that will be updated with the
  45822. * newly provided class value.
  45823. * @param index The index of the CSS class which is being updated.
  45824. * @param addOrRemove Whether or not to add or remove the CSS class
  45825. */
  45826. function updateClassProp(context, index, addOrRemove) {
  45827. var adjustedIndex = index + context[4 /* ClassOffsetPosition */];
  45828. updateStyleProp(context, adjustedIndex, addOrRemove);
  45829. }
  45830. /**
  45831. * Renders all queued styling using a renderer onto the given element.
  45832. *
  45833. * This function works by rendering any styles (that have been applied
  45834. * using `updateStylingMap`) and any classes (that have been applied using
  45835. * `updateStyleProp`) onto the provided element using the provided renderer.
  45836. * Just before the styles/classes are rendered a final key/value style map
  45837. * will be assembled (if `styleStore` or `classStore` are provided).
  45838. *
  45839. * @param lElement the element that the styles will be rendered on
  45840. * @param context The styling context that will be used to determine
  45841. * what styles will be rendered
  45842. * @param renderer the renderer that will be used to apply the styling
  45843. * @param styleStore if provided, the updated style values will be applied
  45844. * to this key/value map instead of being renderered via the renderer.
  45845. * @param classStore if provided, the updated class values will be applied
  45846. * to this key/value map instead of being renderered via the renderer.
  45847. */
  45848. function renderStyling(context, renderer, styleStore, classStore) {
  45849. if (isContextDirty(context)) {
  45850. var native = context[0 /* ElementPosition */].native;
  45851. var multiStartIndex = getMultiStartIndex(context);
  45852. var styleSanitizer = getStyleSanitizer(context);
  45853. for (var i = 6 /* SingleStylesStartPosition */; i < context.length; i += 3 /* Size */) {
  45854. // there is no point in rendering styles that have not changed on screen
  45855. if (isDirty(context, i)) {
  45856. var prop = getProp(context, i);
  45857. var value = getValue(context, i);
  45858. var flag = getPointers(context, i);
  45859. var isClassBased_6 = flag & 2 /* Class */ ? true : false;
  45860. var isInSingleRegion = i < multiStartIndex;
  45861. var valueToApply = value;
  45862. // VALUE DEFER CASE 1: Use a multi value instead of a null single value
  45863. // this check implies that a single value was removed and we
  45864. // should now defer to a multi value and use that (if set).
  45865. if (isInSingleRegion && !valueExists(valueToApply, isClassBased_6)) {
  45866. // single values ALWAYS have a reference to a multi index
  45867. var multiIndex = getMultiOrSingleIndex(flag);
  45868. valueToApply = getValue(context, multiIndex);
  45869. }
  45870. // VALUE DEFER CASE 2: Use the initial value if all else fails (is falsy)
  45871. // the initial value will always be a string or null,
  45872. // therefore we can safely adopt it incase there's nothing else
  45873. // note that this should always be a falsy check since `false` is used
  45874. // for both class and style comparisons (styles can't be false and false
  45875. // classes are turned off and should therefore defer to their initial values)
  45876. if (!valueExists(valueToApply, isClassBased_6)) {
  45877. valueToApply = getInitialValue(context, flag);
  45878. }
  45879. if (isClassBased_6) {
  45880. setClass(native, prop, valueToApply ? true : false, renderer, classStore);
  45881. }
  45882. else {
  45883. var sanitizer = (flag & 4 /* Sanitize */) ? styleSanitizer : null;
  45884. setStyle(native, prop, valueToApply, renderer, sanitizer, styleStore);
  45885. }
  45886. setDirty(context, i, false);
  45887. }
  45888. }
  45889. setContextDirty(context, false);
  45890. }
  45891. }
  45892. /**
  45893. * This function renders a given CSS prop/value entry using the
  45894. * provided renderer. If a `store` value is provided then
  45895. * that will be used a render context instead of the provided
  45896. * renderer.
  45897. *
  45898. * @param native the DOM Element
  45899. * @param prop the CSS style property that will be rendered
  45900. * @param value the CSS style value that will be rendered
  45901. * @param renderer
  45902. * @param store an optional key/value map that will be used as a context to render styles on
  45903. */
  45904. function setStyle(native, prop, value, renderer, sanitizer, store) {
  45905. value = sanitizer && value ? sanitizer(prop, value) : value;
  45906. if (store) {
  45907. store[prop] = value;
  45908. }
  45909. else if (value) {
  45910. ngDevMode && ngDevMode.rendererSetStyle++;
  45911. isProceduralRenderer(renderer) ?
  45912. renderer.setStyle(native, prop, value, RendererStyleFlags3.DashCase) :
  45913. native['style'].setProperty(prop, value);
  45914. }
  45915. else {
  45916. ngDevMode && ngDevMode.rendererRemoveStyle++;
  45917. isProceduralRenderer(renderer) ?
  45918. renderer.removeStyle(native, prop, RendererStyleFlags3.DashCase) :
  45919. native['style'].removeProperty(prop);
  45920. }
  45921. }
  45922. /**
  45923. * This function renders a given CSS class value using the provided
  45924. * renderer (by adding or removing it from the provided element).
  45925. * If a `store` value is provided then that will be used a render
  45926. * context instead of the provided renderer.
  45927. *
  45928. * @param native the DOM Element
  45929. * @param prop the CSS style property that will be rendered
  45930. * @param value the CSS style value that will be rendered
  45931. * @param renderer
  45932. * @param store an optional key/value map that will be used as a context to render styles on
  45933. */
  45934. function setClass(native, className, add, renderer, store) {
  45935. if (store) {
  45936. store[className] = add;
  45937. }
  45938. else if (add) {
  45939. ngDevMode && ngDevMode.rendererAddClass++;
  45940. isProceduralRenderer(renderer) ? renderer.addClass(native, className) :
  45941. native['classList'].add(className);
  45942. }
  45943. else {
  45944. ngDevMode && ngDevMode.rendererRemoveClass++;
  45945. isProceduralRenderer(renderer) ? renderer.removeClass(native, className) :
  45946. native['classList'].remove(className);
  45947. }
  45948. }
  45949. function setDirty(context, index, isDirtyYes) {
  45950. var adjustedIndex = index >= 6 /* SingleStylesStartPosition */ ? (index + 0 /* FlagsOffset */) : index;
  45951. if (isDirtyYes) {
  45952. context[adjustedIndex] |= 1 /* Dirty */;
  45953. }
  45954. else {
  45955. context[adjustedIndex] &= ~1 /* Dirty */;
  45956. }
  45957. }
  45958. function isDirty(context, index) {
  45959. var adjustedIndex = index >= 6 /* SingleStylesStartPosition */ ? (index + 0 /* FlagsOffset */) : index;
  45960. return (context[adjustedIndex] & 1 /* Dirty */) == 1 /* Dirty */;
  45961. }
  45962. function isClassBased(context, index) {
  45963. var adjustedIndex = index >= 6 /* SingleStylesStartPosition */ ? (index + 0 /* FlagsOffset */) : index;
  45964. return (context[adjustedIndex] & 2 /* Class */) == 2 /* Class */;
  45965. }
  45966. function isSanitizable(context, index) {
  45967. var adjustedIndex = index >= 6 /* SingleStylesStartPosition */ ? (index + 0 /* FlagsOffset */) : index;
  45968. return (context[adjustedIndex] & 4 /* Sanitize */) == 4 /* Sanitize */;
  45969. }
  45970. function pointers(configFlag, staticIndex, dynamicIndex) {
  45971. return (configFlag & 7 /* BitMask */) | (staticIndex << 3 /* BitCountSize */) |
  45972. (dynamicIndex << (14 /* BitCountSize */ + 3 /* BitCountSize */));
  45973. }
  45974. function getInitialValue(context, flag) {
  45975. var index = getInitialIndex(flag);
  45976. return context[2 /* InitialStylesPosition */][index];
  45977. }
  45978. function getInitialIndex(flag) {
  45979. return (flag >> 3 /* BitCountSize */) & 16383 /* BitMask */;
  45980. }
  45981. function getMultiOrSingleIndex(flag) {
  45982. var index = (flag >> (14 /* BitCountSize */ + 3 /* BitCountSize */)) & 16383 /* BitMask */;
  45983. return index >= 6 /* SingleStylesStartPosition */ ? index : -1;
  45984. }
  45985. function getMultiStartIndex(context) {
  45986. return getMultiOrSingleIndex(context[3 /* MasterFlagPosition */]);
  45987. }
  45988. function getStyleSanitizer(context) {
  45989. return context[1 /* StyleSanitizerPosition */];
  45990. }
  45991. function setProp(context, index, prop) {
  45992. context[index + 1 /* PropertyOffset */] = prop;
  45993. }
  45994. function setValue(context, index, value) {
  45995. context[index + 2 /* ValueOffset */] = value;
  45996. }
  45997. function setFlag(context, index, flag) {
  45998. var adjustedIndex = index === 3 /* MasterFlagPosition */ ? index : (index + 0 /* FlagsOffset */);
  45999. context[adjustedIndex] = flag;
  46000. }
  46001. function getPointers(context, index) {
  46002. var adjustedIndex = index === 3 /* MasterFlagPosition */ ? index : (index + 0 /* FlagsOffset */);
  46003. return context[adjustedIndex];
  46004. }
  46005. function getValue(context, index) {
  46006. return context[index + 2 /* ValueOffset */];
  46007. }
  46008. function getProp(context, index) {
  46009. return context[index + 1 /* PropertyOffset */];
  46010. }
  46011. function isContextDirty(context) {
  46012. return isDirty(context, 3 /* MasterFlagPosition */);
  46013. }
  46014. function setContextDirty(context, isDirtyYes) {
  46015. setDirty(context, 3 /* MasterFlagPosition */, isDirtyYes);
  46016. }
  46017. function findEntryPositionByProp(context, prop, startIndex) {
  46018. for (var i = (startIndex || 0) + 1 /* PropertyOffset */; i < context.length; i += 3 /* Size */) {
  46019. var thisProp = context[i];
  46020. if (thisProp == prop) {
  46021. return i - 1 /* PropertyOffset */;
  46022. }
  46023. }
  46024. return -1;
  46025. }
  46026. function swapMultiContextEntries(context, indexA, indexB) {
  46027. var tmpValue = getValue(context, indexA);
  46028. var tmpProp = getProp(context, indexA);
  46029. var tmpFlag = getPointers(context, indexA);
  46030. var flagA = tmpFlag;
  46031. var flagB = getPointers(context, indexB);
  46032. var singleIndexA = getMultiOrSingleIndex(flagA);
  46033. if (singleIndexA >= 0) {
  46034. var _flag = getPointers(context, singleIndexA);
  46035. var _initial = getInitialIndex(_flag);
  46036. setFlag(context, singleIndexA, pointers(_flag, _initial, indexB));
  46037. }
  46038. var singleIndexB = getMultiOrSingleIndex(flagB);
  46039. if (singleIndexB >= 0) {
  46040. var _flag = getPointers(context, singleIndexB);
  46041. var _initial = getInitialIndex(_flag);
  46042. setFlag(context, singleIndexB, pointers(_flag, _initial, indexA));
  46043. }
  46044. setValue(context, indexA, getValue(context, indexB));
  46045. setProp(context, indexA, getProp(context, indexB));
  46046. setFlag(context, indexA, getPointers(context, indexB));
  46047. setValue(context, indexB, tmpValue);
  46048. setProp(context, indexB, tmpProp);
  46049. setFlag(context, indexB, tmpFlag);
  46050. }
  46051. function updateSinglePointerValues(context, indexStartPosition) {
  46052. for (var i = indexStartPosition; i < context.length; i += 3 /* Size */) {
  46053. var multiFlag = getPointers(context, i);
  46054. var singleIndex = getMultiOrSingleIndex(multiFlag);
  46055. if (singleIndex > 0) {
  46056. var singleFlag = getPointers(context, singleIndex);
  46057. var initialIndexForSingle = getInitialIndex(singleFlag);
  46058. var flagValue = (isDirty(context, singleIndex) ? 1 /* Dirty */ : 0 /* None */) |
  46059. (isClassBased(context, singleIndex) ? 2 /* Class */ : 0 /* None */) |
  46060. (isSanitizable(context, singleIndex) ? 4 /* Sanitize */ : 0 /* None */);
  46061. var updatedFlag = pointers(flagValue, initialIndexForSingle, i);
  46062. setFlag(context, singleIndex, updatedFlag);
  46063. }
  46064. }
  46065. }
  46066. function insertNewMultiProperty(context, index, classBased, name, flag, value) {
  46067. var doShift = index < context.length;
  46068. // prop does not exist in the list, add it in
  46069. context.splice(index, 0, flag | 1 /* Dirty */ | (classBased ? 2 /* Class */ : 0 /* None */), name, value);
  46070. if (doShift) {
  46071. // because the value was inserted midway into the array then we
  46072. // need to update all the shifted multi values' single value
  46073. // pointers to point to the newly shifted location
  46074. updateSinglePointerValues(context, index + 3 /* Size */);
  46075. }
  46076. }
  46077. function valueExists(value, isClassBased) {
  46078. if (isClassBased) {
  46079. return value ? true : false;
  46080. }
  46081. return value !== null;
  46082. }
  46083. function prepareInitialFlag(name, isClassBased, sanitizer) {
  46084. if (isClassBased) {
  46085. return 2 /* Class */;
  46086. }
  46087. else if (sanitizer && sanitizer(name)) {
  46088. return 4 /* Sanitize */;
  46089. }
  46090. return 0 /* None */;
  46091. }
  46092. function hasValueChanged(flag, a, b) {
  46093. var isClassBased = flag & 2 /* Class */;
  46094. var hasValues = a && b;
  46095. var usesSanitizer = flag & 4 /* Sanitize */;
  46096. // the toString() comparison ensures that a value is checked
  46097. // ... otherwise (during sanitization bypassing) the === comparsion
  46098. // would fail since a new String() instance is created
  46099. if (!isClassBased && hasValues && usesSanitizer) {
  46100. // we know for sure we're dealing with strings at this point
  46101. return a.toString() !== b.toString();
  46102. }
  46103. // everything else is safe to check with a normal equality check
  46104. return a !== b;
  46105. }
  46106. /**
  46107. * @license
  46108. * Copyright Google Inc. All Rights Reserved.
  46109. *
  46110. * Use of this source code is governed by an MIT-style license that can be
  46111. * found in the LICENSE file at https://angular.io/license
  46112. */
  46113. /**
  46114. * Directive (D) sets a property on all component instances using this constant as a key and the
  46115. * component's host node (LElement) as the value. This is used in methods like detectChanges to
  46116. * facilitate jumping from an instance to the host node.
  46117. */
  46118. var NG_HOST_SYMBOL = '__ngHostLNode__';
  46119. /**
  46120. * A permanent marker promise which signifies that the current CD tree is
  46121. * clean.
  46122. */
  46123. var _CLEAN_PROMISE = Promise.resolve(null);
  46124. /**
  46125. * Directive and element indices for top-level directive.
  46126. *
  46127. * Saved here to avoid re-instantiating an array on every change detection run.
  46128. *
  46129. * Note: Element is not actually stored at index 0 because of the LViewData
  46130. * header, but the host bindings function expects an index that is NOT adjusted
  46131. * because it will ultimately be fed to instructions like elementProperty.
  46132. */
  46133. var _ROOT_DIRECTIVE_INDICES = [0, 0];
  46134. /**
  46135. * TView.data needs to fill the same number of slots as the LViewData header
  46136. * so the indices of nodes are consistent between LViewData and TView.data.
  46137. *
  46138. * It's much faster to keep a blueprint of the pre-filled array and slice it
  46139. * than it is to create a new array and fill it each time a TView is created.
  46140. */
  46141. var HEADER_FILLER = new Array(HEADER_OFFSET).fill(null);
  46142. /**
  46143. * Token set in currentMatches while dependencies are being resolved.
  46144. *
  46145. * If we visit a directive that has a value set to CIRCULAR, we know we've
  46146. * already seen it, and thus have a circular dependency.
  46147. */
  46148. var CIRCULAR$2 = '__CIRCULAR__';
  46149. /**
  46150. * This property gets set before entering a template.
  46151. *
  46152. * This renderer can be one of two varieties of Renderer3:
  46153. *
  46154. * - ObjectedOrientedRenderer3
  46155. *
  46156. * This is the native browser API style, e.g. operations are methods on individual objects
  46157. * like HTMLElement. With this style, no additional code is needed as a facade (reducing payload
  46158. * size).
  46159. *
  46160. * - ProceduralRenderer3
  46161. *
  46162. * In non-native browser environments (e.g. platforms such as web-workers), this is the facade
  46163. * that enables element manipulation. This also facilitates backwards compatibility with
  46164. * Renderer2.
  46165. */
  46166. var renderer;
  46167. var rendererFactory;
  46168. var currentElementNode = null;
  46169. function getRenderer() {
  46170. // top level variables should not be exported for performance reasons (PERF_NOTES.md)
  46171. return renderer;
  46172. }
  46173. function getCurrentSanitizer() {
  46174. return viewData && viewData[SANITIZER];
  46175. }
  46176. function getViewData() {
  46177. // top level variables should not be exported for performance reasons (PERF_NOTES.md)
  46178. return viewData;
  46179. }
  46180. /** Used to set the parent property when nodes are created. */
  46181. var previousOrParentNode;
  46182. function getPreviousOrParentNode() {
  46183. // top level variables should not be exported for performance reasons (PERF_NOTES.md)
  46184. return previousOrParentNode;
  46185. }
  46186. /**
  46187. * If `isParent` is:
  46188. * - `true`: then `previousOrParentNode` points to a parent node.
  46189. * - `false`: then `previousOrParentNode` points to previous node (sibling).
  46190. */
  46191. var isParent;
  46192. var tView;
  46193. var currentQueries;
  46194. /**
  46195. * Query instructions can ask for "current queries" in 2 different cases:
  46196. * - when creating view queries (at the root of a component view, before any node is created - in
  46197. * this case currentQueries points to view queries)
  46198. * - when creating content queries (inb this previousOrParentNode points to a node on which we
  46199. * create content queries).
  46200. */
  46201. function getCurrentQueries(QueryType) {
  46202. // top level variables should not be exported for performance reasons (PERF_NOTES.md)
  46203. return currentQueries ||
  46204. (currentQueries =
  46205. (previousOrParentNode.queries && previousOrParentNode.queries.clone() ||
  46206. new QueryType()));
  46207. }
  46208. /**
  46209. * This property gets set before entering a template.
  46210. */
  46211. var creationMode;
  46212. function getCreationMode() {
  46213. // top level variables should not be exported for performance reasons (PERF_NOTES.md)
  46214. return creationMode;
  46215. }
  46216. /**
  46217. * State of the current view being processed.
  46218. *
  46219. * An array of nodes (text, element, container, etc), pipes, their bindings, and
  46220. * any local variables that need to be stored between invocations.
  46221. */
  46222. var viewData;
  46223. /**
  46224. * An array of directive instances in the current view.
  46225. *
  46226. * These must be stored separately from LNodes because their presence is
  46227. * unknown at compile-time and thus space cannot be reserved in data[].
  46228. */
  46229. var directives;
  46230. function getCleanup(view) {
  46231. // top level variables should not be exported for performance reasons (PERF_NOTES.md)
  46232. return view[CLEANUP] || (view[CLEANUP] = []);
  46233. }
  46234. function getTViewCleanup(view) {
  46235. return view[TVIEW].cleanup || (view[TVIEW].cleanup = []);
  46236. }
  46237. /**
  46238. * In this mode, any changes in bindings will throw an ExpressionChangedAfterChecked error.
  46239. *
  46240. * Necessary to support ChangeDetectorRef.checkNoChanges().
  46241. */
  46242. var checkNoChangesMode = false;
  46243. /** Whether or not this is the first time the current view has been processed. */
  46244. var firstTemplatePass = true;
  46245. /**
  46246. * Swap the current state with a new state.
  46247. *
  46248. * For performance reasons we store the state in the top level of the module.
  46249. * This way we minimize the number of properties to read. Whenever a new view
  46250. * is entered we have to store the state for later, and when the view is
  46251. * exited the state has to be restored
  46252. *
  46253. * @param newView New state to become active
  46254. * @param host Element to which the View is a child of
  46255. * @returns the previous state;
  46256. */
  46257. function enterView(newView, host) {
  46258. var oldView = viewData;
  46259. directives = newView && newView[DIRECTIVES];
  46260. tView = newView && newView[TVIEW];
  46261. creationMode = newView && (newView[FLAGS] & 1 /* CreationMode */) === 1 /* CreationMode */;
  46262. firstTemplatePass = newView && tView.firstTemplatePass;
  46263. renderer = newView && newView[RENDERER];
  46264. if (host != null) {
  46265. previousOrParentNode = host;
  46266. isParent = true;
  46267. }
  46268. viewData = newView;
  46269. currentQueries = newView && newView[QUERIES];
  46270. return oldView;
  46271. }
  46272. /**
  46273. * Used in lieu of enterView to make it clear when we are exiting a child view. This makes
  46274. * the direction of traversal (up or down the view tree) a bit clearer.
  46275. *
  46276. * @param newView New state to become active
  46277. * @param creationOnly An optional boolean to indicate that the view was processed in creation mode
  46278. * only, i.e. the first update will be done later. Only possible for dynamically created views.
  46279. */
  46280. function leaveView(newView, creationOnly) {
  46281. if (!creationOnly) {
  46282. if (!checkNoChangesMode) {
  46283. executeHooks(directives, tView.viewHooks, tView.viewCheckHooks, creationMode);
  46284. }
  46285. // Views are clean and in update mode after being checked, so these bits are cleared
  46286. viewData[FLAGS] &= ~(1 /* CreationMode */ | 4 /* Dirty */);
  46287. }
  46288. viewData[FLAGS] |= 16 /* RunInit */;
  46289. viewData[BINDING_INDEX] = -1;
  46290. enterView(newView, null);
  46291. }
  46292. /**
  46293. * Refreshes the view, executing the following steps in that order:
  46294. * triggers init hooks, refreshes dynamic embedded views, triggers content hooks, sets host
  46295. * bindings,
  46296. * refreshes child components.
  46297. * Note: view hooks are triggered later when leaving the view.
  46298. */
  46299. function refreshView() {
  46300. if (!checkNoChangesMode) {
  46301. executeInitHooks(viewData, tView, creationMode);
  46302. }
  46303. refreshDynamicEmbeddedViews(viewData);
  46304. if (!checkNoChangesMode) {
  46305. executeHooks(directives, tView.contentHooks, tView.contentCheckHooks, creationMode);
  46306. }
  46307. // This needs to be set before children are processed to support recursive components
  46308. tView.firstTemplatePass = firstTemplatePass = false;
  46309. setHostBindings(tView.hostBindings);
  46310. refreshContentQueries(tView);
  46311. refreshChildComponents(tView.components);
  46312. }
  46313. /** Sets the host bindings for the current view. */
  46314. function setHostBindings(bindings) {
  46315. if (bindings != null) {
  46316. var defs = tView.directives;
  46317. for (var i = 0; i < bindings.length; i += 2) {
  46318. var dirIndex = bindings[i];
  46319. var def = defs[dirIndex];
  46320. def.hostBindings && def.hostBindings(dirIndex, bindings[i + 1]);
  46321. }
  46322. }
  46323. }
  46324. /** Refreshes content queries for all directives in the given view. */
  46325. function refreshContentQueries(tView) {
  46326. if (tView.contentQueries != null) {
  46327. for (var i = 0; i < tView.contentQueries.length; i += 2) {
  46328. var directiveDefIdx = tView.contentQueries[i];
  46329. var directiveDef = tView.directives[directiveDefIdx];
  46330. directiveDef.contentQueriesRefresh(directiveDefIdx, tView.contentQueries[i + 1]);
  46331. }
  46332. }
  46333. }
  46334. /** Refreshes child components in the current view. */
  46335. function refreshChildComponents(components) {
  46336. if (components != null) {
  46337. for (var i = 0; i < components.length; i += 2) {
  46338. componentRefresh(components[i], components[i + 1]);
  46339. }
  46340. }
  46341. }
  46342. function executeInitAndContentHooks() {
  46343. if (!checkNoChangesMode) {
  46344. executeInitHooks(viewData, tView, creationMode);
  46345. executeHooks(directives, tView.contentHooks, tView.contentCheckHooks, creationMode);
  46346. }
  46347. }
  46348. function createLViewData(renderer, tView, context, flags, sanitizer) {
  46349. return [
  46350. tView,
  46351. viewData,
  46352. null,
  46353. null,
  46354. flags | 1 /* CreationMode */ | 8 /* Attached */ | 16 /* RunInit */,
  46355. null,
  46356. -1,
  46357. null,
  46358. null,
  46359. context,
  46360. viewData && viewData[INJECTOR$1],
  46361. renderer,
  46362. sanitizer || null,
  46363. null,
  46364. -1,
  46365. null,
  46366. ];
  46367. }
  46368. /**
  46369. * Creation of LNode object is extracted to a separate function so we always create LNode object
  46370. * with the same shape
  46371. * (same properties assigned in the same order).
  46372. */
  46373. function createLNodeObject(type, currentView, parent, native, state, queries) {
  46374. return {
  46375. native: native,
  46376. view: currentView,
  46377. nodeInjector: parent ? parent.nodeInjector : null,
  46378. data: state,
  46379. queries: queries,
  46380. tNode: null,
  46381. dynamicLContainerNode: null
  46382. };
  46383. }
  46384. function createLNode(index, type, native, name, attrs, state) {
  46385. var parent = isParent ? previousOrParentNode :
  46386. previousOrParentNode && getParentLNode(previousOrParentNode);
  46387. // Parents cannot cross component boundaries because components will be used in multiple places,
  46388. // so it's only set if the view is the same.
  46389. var tParent = parent && parent.view === viewData ? parent.tNode : null;
  46390. var queries = (isParent ? currentQueries : previousOrParentNode && previousOrParentNode.queries) ||
  46391. parent && parent.queries && parent.queries.child();
  46392. var isState = state != null;
  46393. var node = createLNodeObject(type, viewData, parent, native, isState ? state : null, queries);
  46394. if (index === -1 || type === 2 /* View */) {
  46395. // View nodes are not stored in data because they can be added / removed at runtime (which
  46396. // would cause indices to change). Their TNodes are instead stored in TView.node.
  46397. node.tNode = (state ? state[TVIEW].node : null) ||
  46398. createTNode(type, index, null, null, tParent, null);
  46399. }
  46400. else {
  46401. var adjustedIndex = index + HEADER_OFFSET;
  46402. // This is an element or container or projection node
  46403. ngDevMode && assertDataNext(adjustedIndex);
  46404. var tData = tView.data;
  46405. viewData[adjustedIndex] = node;
  46406. // Every node adds a value to the static data array to avoid a sparse array
  46407. if (adjustedIndex >= tData.length) {
  46408. var tNode = tData[adjustedIndex] =
  46409. createTNode(type, adjustedIndex, name, attrs, tParent, null);
  46410. if (!isParent && previousOrParentNode) {
  46411. var previousTNode = previousOrParentNode.tNode;
  46412. previousTNode.next = tNode;
  46413. if (previousTNode.dynamicContainerNode)
  46414. previousTNode.dynamicContainerNode.next = tNode;
  46415. }
  46416. }
  46417. node.tNode = tData[adjustedIndex];
  46418. // Now link ourselves into the tree.
  46419. if (isParent) {
  46420. currentQueries = null;
  46421. if (previousOrParentNode.tNode.child == null && previousOrParentNode.view === viewData ||
  46422. previousOrParentNode.tNode.type === 2 /* View */) {
  46423. // We are in the same view, which means we are adding content node to the parent View.
  46424. previousOrParentNode.tNode.child = node.tNode;
  46425. }
  46426. }
  46427. }
  46428. // View nodes and host elements need to set their host node (components set host nodes later)
  46429. if ((type & 2 /* ViewOrElement */) === 2 /* ViewOrElement */ && isState) {
  46430. var lViewData = state;
  46431. ngDevMode && assertNotDefined(lViewData[HOST_NODE], 'lViewData[HOST_NODE] should not have been initialized');
  46432. lViewData[HOST_NODE] = node;
  46433. if (firstTemplatePass)
  46434. lViewData[TVIEW].node = node.tNode;
  46435. }
  46436. previousOrParentNode = node;
  46437. isParent = true;
  46438. return node;
  46439. }
  46440. //////////////////////////
  46441. //// Render
  46442. //////////////////////////
  46443. /**
  46444. * Resets the application state.
  46445. */
  46446. function resetApplicationState() {
  46447. isParent = false;
  46448. previousOrParentNode = null;
  46449. }
  46450. /**
  46451. * Used for creating the LViewNode of a dynamic embedded view,
  46452. * either through ViewContainerRef.createEmbeddedView() or TemplateRef.createEmbeddedView().
  46453. * Such lViewNode will then be renderer with renderEmbeddedTemplate() (see below).
  46454. */
  46455. function createEmbeddedViewNode(tView, context, renderer, queries) {
  46456. var _isParent = isParent;
  46457. var _previousOrParentNode = previousOrParentNode;
  46458. isParent = true;
  46459. previousOrParentNode = null;
  46460. var lView = createLViewData(renderer, tView, context, 2 /* CheckAlways */, getCurrentSanitizer());
  46461. if (queries) {
  46462. lView[QUERIES] = queries.createView();
  46463. }
  46464. var viewNode = createLNode(-1, 2 /* View */, null, null, null, lView);
  46465. isParent = _isParent;
  46466. previousOrParentNode = _previousOrParentNode;
  46467. return viewNode;
  46468. }
  46469. /**
  46470. * Used for rendering embedded views (e.g. dynamically created views)
  46471. *
  46472. * Dynamically created views must store/retrieve their TViews differently from component views
  46473. * because their template functions are nested in the template functions of their hosts, creating
  46474. * closures. If their host template happens to be an embedded template in a loop (e.g. ngFor inside
  46475. * an ngFor), the nesting would mean we'd have multiple instances of the template function, so we
  46476. * can't store TViews in the template function itself (as we do for comps). Instead, we store the
  46477. * TView for dynamically created views on their host TNode, which only has one instance.
  46478. */
  46479. function renderEmbeddedTemplate(viewNode, tView, context, rf) {
  46480. var _isParent = isParent;
  46481. var _previousOrParentNode = previousOrParentNode;
  46482. var oldView;
  46483. if (viewNode.data[PARENT] == null && viewNode.data[CONTEXT] && !tView.template) {
  46484. // This is a root view inside the view tree
  46485. tickRootContext(viewNode.data[CONTEXT]);
  46486. }
  46487. else {
  46488. try {
  46489. isParent = true;
  46490. previousOrParentNode = null;
  46491. oldView = enterView(viewNode.data, viewNode);
  46492. namespaceHTML();
  46493. tView.template(rf, context);
  46494. if (rf & 2 /* Update */) {
  46495. refreshView();
  46496. }
  46497. else {
  46498. viewNode.data[TVIEW].firstTemplatePass = firstTemplatePass = false;
  46499. }
  46500. }
  46501. finally {
  46502. // renderEmbeddedTemplate() is called twice in fact, once for creation only and then once for
  46503. // update. When for creation only, leaveView() must not trigger view hooks, nor clean flags.
  46504. var isCreationOnly = (rf & 1 /* Create */) === 1 /* Create */;
  46505. leaveView(oldView, isCreationOnly);
  46506. isParent = _isParent;
  46507. previousOrParentNode = _previousOrParentNode;
  46508. }
  46509. }
  46510. return viewNode;
  46511. }
  46512. function renderComponentOrTemplate(node, hostView, componentOrContext, template) {
  46513. var oldView = enterView(hostView, node);
  46514. try {
  46515. if (rendererFactory.begin) {
  46516. rendererFactory.begin();
  46517. }
  46518. if (template) {
  46519. namespaceHTML();
  46520. template(getRenderFlags(hostView), componentOrContext);
  46521. refreshView();
  46522. }
  46523. else {
  46524. executeInitAndContentHooks();
  46525. // Element was stored at 0 in data and directive was stored at 0 in directives
  46526. // in renderComponent()
  46527. setHostBindings(_ROOT_DIRECTIVE_INDICES);
  46528. componentRefresh(0, HEADER_OFFSET);
  46529. }
  46530. }
  46531. finally {
  46532. if (rendererFactory.end) {
  46533. rendererFactory.end();
  46534. }
  46535. leaveView(oldView);
  46536. }
  46537. }
  46538. /**
  46539. * This function returns the default configuration of rendering flags depending on when the
  46540. * template is in creation mode or update mode. By default, the update block is run with the
  46541. * creation block when the view is in creation mode. Otherwise, the update block is run
  46542. * alone.
  46543. *
  46544. * Dynamically created views do NOT use this configuration (update block and create block are
  46545. * always run separately).
  46546. */
  46547. function getRenderFlags(view) {
  46548. return view[FLAGS] & 1 /* CreationMode */ ? 1 /* Create */ | 2 /* Update */ :
  46549. 2 /* Update */;
  46550. }
  46551. //////////////////////////
  46552. //// Namespace
  46553. //////////////////////////
  46554. var _currentNamespace = null;
  46555. function namespaceSVG() {
  46556. _currentNamespace = 'http://www.w3.org/2000/svg/';
  46557. }
  46558. function namespaceMathML() {
  46559. _currentNamespace = 'http://www.w3.org/1998/MathML/';
  46560. }
  46561. function namespaceHTML() {
  46562. _currentNamespace = null;
  46563. }
  46564. //////////////////////////
  46565. //// Element
  46566. //////////////////////////
  46567. /**
  46568. * Creates an empty element using {@link elementStart} and {@link elementEnd}
  46569. *
  46570. * @param index Index of the element in the data array
  46571. * @param name Name of the DOM Node
  46572. * @param attrs Statically bound set of attributes to be written into the DOM element on creation.
  46573. * @param localRefs A set of local reference bindings on the element.
  46574. */
  46575. function element(index, name, attrs, localRefs) {
  46576. elementStart(index, name, attrs, localRefs);
  46577. elementEnd();
  46578. }
  46579. /**
  46580. * Create DOM element. The instruction must later be followed by `elementEnd()` call.
  46581. *
  46582. * @param index Index of the element in the LViewData array
  46583. * @param name Name of the DOM Node
  46584. * @param attrs Statically bound set of attributes to be written into the DOM element on creation.
  46585. * @param localRefs A set of local reference bindings on the element.
  46586. *
  46587. * Attributes and localRefs are passed as an array of strings where elements with an even index
  46588. * hold an attribute name and elements with an odd index hold an attribute value, ex.:
  46589. * ['id', 'warning5', 'class', 'alert']
  46590. */
  46591. function elementStart(index, name, attrs, localRefs) {
  46592. ngDevMode &&
  46593. assertEqual(viewData[BINDING_INDEX], -1, 'elements should be created before any bindings');
  46594. ngDevMode && ngDevMode.rendererCreateElement++;
  46595. var native = elementCreate(name);
  46596. ngDevMode && assertDataInRange(index - 1);
  46597. var node = createLNode(index, 3 /* Element */, native, name, attrs || null, null);
  46598. currentElementNode = node;
  46599. if (attrs) {
  46600. setUpAttributes(native, attrs);
  46601. }
  46602. appendChild(getParentLNode(node), native, viewData);
  46603. createDirectivesAndLocals(localRefs);
  46604. return native;
  46605. }
  46606. /**
  46607. * Creates a native element from a tag name, using a renderer.
  46608. * @param name the tag name
  46609. * @param overriddenRenderer Optional A renderer to override the default one
  46610. * @returns the element created
  46611. */
  46612. function elementCreate(name, overriddenRenderer) {
  46613. var native;
  46614. var rendererToUse = overriddenRenderer || renderer;
  46615. if (isProceduralRenderer(rendererToUse)) {
  46616. native = rendererToUse.createElement(name, _currentNamespace);
  46617. }
  46618. else {
  46619. if (_currentNamespace === null) {
  46620. native = rendererToUse.createElement(name);
  46621. }
  46622. else {
  46623. native = rendererToUse.createElementNS(_currentNamespace, name);
  46624. }
  46625. }
  46626. return native;
  46627. }
  46628. /**
  46629. * Creates directive instances and populates local refs.
  46630. *
  46631. * @param localRefs Local refs of the current node
  46632. */
  46633. function createDirectivesAndLocals(localRefs) {
  46634. var node = previousOrParentNode;
  46635. if (firstTemplatePass) {
  46636. ngDevMode && ngDevMode.firstTemplatePass++;
  46637. cacheMatchingDirectivesForNode(node.tNode, tView, localRefs || null);
  46638. }
  46639. else {
  46640. instantiateDirectivesDirectly();
  46641. }
  46642. saveResolvedLocalsInData();
  46643. }
  46644. /**
  46645. * On first template pass, we match each node against available directive selectors and save
  46646. * the resulting defs in the correct instantiation order for subsequent change detection runs
  46647. * (so dependencies are always created before the directives that inject them).
  46648. */
  46649. function cacheMatchingDirectivesForNode(tNode, tView, localRefs) {
  46650. // Please make sure to have explicit type for `exportsMap`. Inferred type triggers bug in tsickle.
  46651. var exportsMap = localRefs ? { '': -1 } : null;
  46652. var matches = tView.currentMatches = findDirectiveMatches(tNode);
  46653. if (matches) {
  46654. for (var i = 0; i < matches.length; i += 2) {
  46655. var def = matches[i];
  46656. var valueIndex = i + 1;
  46657. resolveDirective(def, valueIndex, matches, tView);
  46658. saveNameToExportMap(matches[valueIndex], def, exportsMap);
  46659. }
  46660. }
  46661. if (exportsMap)
  46662. cacheMatchingLocalNames(tNode, localRefs, exportsMap);
  46663. }
  46664. /** Matches the current node against all available selectors. */
  46665. function findDirectiveMatches(tNode) {
  46666. var registry = tView.directiveRegistry;
  46667. var matches = null;
  46668. if (registry) {
  46669. for (var i = 0; i < registry.length; i++) {
  46670. var def = registry[i];
  46671. if (isNodeMatchingSelectorList(tNode, def.selectors)) {
  46672. if (def.template) {
  46673. if (tNode.flags & 4096 /* isComponent */)
  46674. throwMultipleComponentError(tNode);
  46675. tNode.flags = 4096 /* isComponent */;
  46676. }
  46677. if (def.diPublic)
  46678. def.diPublic(def);
  46679. (matches || (matches = [])).push(def, null);
  46680. }
  46681. }
  46682. }
  46683. return matches;
  46684. }
  46685. function resolveDirective(def, valueIndex, matches, tView) {
  46686. if (matches[valueIndex] === null) {
  46687. matches[valueIndex] = CIRCULAR$2;
  46688. var instance = def.factory();
  46689. (tView.directives || (tView.directives = [])).push(def);
  46690. return directiveCreate(matches[valueIndex] = tView.directives.length - 1, instance, def);
  46691. }
  46692. else if (matches[valueIndex] === CIRCULAR$2) {
  46693. // If we revisit this directive before it's resolved, we know it's circular
  46694. throwCyclicDependencyError(def.type);
  46695. }
  46696. return null;
  46697. }
  46698. /** Stores index of component's host element so it will be queued for view refresh during CD. */
  46699. function queueComponentIndexForCheck(dirIndex) {
  46700. if (firstTemplatePass) {
  46701. (tView.components || (tView.components = [])).push(dirIndex, viewData.length - 1);
  46702. }
  46703. }
  46704. /** Stores index of directive and host element so it will be queued for binding refresh during CD.
  46705. */
  46706. function queueHostBindingForCheck(dirIndex) {
  46707. // Must subtract the header offset because hostBindings functions are generated with
  46708. // instructions that expect element indices that are NOT adjusted (e.g. elementProperty).
  46709. ngDevMode &&
  46710. assertEqual(firstTemplatePass, true, 'Should only be called in first template pass.');
  46711. (tView.hostBindings || (tView.hostBindings = [])).push(dirIndex, viewData.length - 1 - HEADER_OFFSET);
  46712. }
  46713. /** Sets the context for a ChangeDetectorRef to the given instance. */
  46714. function initChangeDetectorIfExisting(injector, instance, view) {
  46715. if (injector && injector.changeDetectorRef != null) {
  46716. injector.changeDetectorRef._setComponentContext(view, instance);
  46717. }
  46718. }
  46719. function isComponent(tNode) {
  46720. return (tNode.flags & 4096 /* isComponent */) === 4096 /* isComponent */;
  46721. }
  46722. /**
  46723. * This function instantiates the given directives.
  46724. */
  46725. function instantiateDirectivesDirectly() {
  46726. var tNode = previousOrParentNode.tNode;
  46727. var count = tNode.flags & 4095 /* DirectiveCountMask */;
  46728. if (count > 0) {
  46729. var start = tNode.flags >> 14 /* DirectiveStartingIndexShift */;
  46730. var end = start + count;
  46731. var tDirectives = tView.directives;
  46732. for (var i = start; i < end; i++) {
  46733. var def = tDirectives[i];
  46734. directiveCreate(i, def.factory(), def);
  46735. }
  46736. }
  46737. }
  46738. /** Caches local names and their matching directive indices for query and template lookups. */
  46739. function cacheMatchingLocalNames(tNode, localRefs, exportsMap) {
  46740. if (localRefs) {
  46741. var localNames = tNode.localNames = [];
  46742. // Local names must be stored in tNode in the same order that localRefs are defined
  46743. // in the template to ensure the data is loaded in the same slots as their refs
  46744. // in the template (for template queries).
  46745. for (var i = 0; i < localRefs.length; i += 2) {
  46746. var index = exportsMap[localRefs[i + 1]];
  46747. if (index == null)
  46748. throw new Error("Export of name '" + localRefs[i + 1] + "' not found!");
  46749. localNames.push(localRefs[i], index);
  46750. }
  46751. }
  46752. }
  46753. /**
  46754. * Builds up an export map as directives are created, so local refs can be quickly mapped
  46755. * to their directive instances.
  46756. */
  46757. function saveNameToExportMap(index, def, exportsMap) {
  46758. if (exportsMap) {
  46759. if (def.exportAs)
  46760. exportsMap[def.exportAs] = index;
  46761. if (def.template)
  46762. exportsMap[''] = index;
  46763. }
  46764. }
  46765. /**
  46766. * Takes a list of local names and indices and pushes the resolved local variable values
  46767. * to LViewData in the same order as they are loaded in the template with load().
  46768. */
  46769. function saveResolvedLocalsInData() {
  46770. var localNames = previousOrParentNode.tNode.localNames;
  46771. if (localNames) {
  46772. for (var i = 0; i < localNames.length; i += 2) {
  46773. var index = localNames[i + 1];
  46774. var value = index === -1 ? previousOrParentNode.native : directives[index];
  46775. viewData.push(value);
  46776. }
  46777. }
  46778. }
  46779. /**
  46780. * Gets TView from a template function or creates a new TView
  46781. * if it doesn't already exist.
  46782. *
  46783. * @param template The template from which to get static data
  46784. * @param directives Directive defs that should be saved on TView
  46785. * @param pipes Pipe defs that should be saved on TView
  46786. * @returns TView
  46787. */
  46788. function getOrCreateTView(template, directives, pipes, viewQuery) {
  46789. // TODO(misko): reading `ngPrivateData` here is problematic for two reasons
  46790. // 1. It is a megamorphic call on each invocation.
  46791. // 2. For nested embedded views (ngFor inside ngFor) the template instance is per
  46792. // outer template invocation, which means that no such property will exist
  46793. // Correct solution is to only put `ngPrivateData` on the Component template
  46794. // and not on embedded templates.
  46795. return template.ngPrivateData ||
  46796. (template.ngPrivateData = createTView(-1, template, directives, pipes, viewQuery));
  46797. }
  46798. /**
  46799. * Creates a TView instance
  46800. *
  46801. * @param viewIndex The viewBlockId for inline views, or -1 if it's a component/dynamic
  46802. * @param directives Registry of directives for this view
  46803. * @param pipes Registry of pipes for this view
  46804. */
  46805. function createTView(viewIndex, template, directives, pipes, viewQuery) {
  46806. ngDevMode && ngDevMode.tView++;
  46807. return {
  46808. id: viewIndex,
  46809. template: template,
  46810. viewQuery: viewQuery,
  46811. node: null,
  46812. data: HEADER_FILLER.slice(),
  46813. childIndex: -1,
  46814. bindingStartIndex: -1,
  46815. directives: null,
  46816. firstTemplatePass: true,
  46817. initHooks: null,
  46818. checkHooks: null,
  46819. contentHooks: null,
  46820. contentCheckHooks: null,
  46821. viewHooks: null,
  46822. viewCheckHooks: null,
  46823. destroyHooks: null,
  46824. pipeDestroyHooks: null,
  46825. cleanup: null,
  46826. hostBindings: null,
  46827. contentQueries: null,
  46828. components: null,
  46829. directiveRegistry: typeof directives === 'function' ? directives() : directives,
  46830. pipeRegistry: typeof pipes === 'function' ? pipes() : pipes,
  46831. currentMatches: null
  46832. };
  46833. }
  46834. function setUpAttributes(native, attrs) {
  46835. var isProc = isProceduralRenderer(renderer);
  46836. var i = 0;
  46837. while (i < attrs.length) {
  46838. var attrName = attrs[i];
  46839. if (attrName === 1 /* SelectOnly */)
  46840. break;
  46841. if (attrName === NG_PROJECT_AS_ATTR_NAME) {
  46842. i += 2;
  46843. }
  46844. else {
  46845. ngDevMode && ngDevMode.rendererSetAttribute++;
  46846. if (attrName === 0 /* NamespaceURI */) {
  46847. // Namespaced attributes
  46848. var namespaceURI = attrs[i + 1];
  46849. var attrName_1 = attrs[i + 2];
  46850. var attrVal = attrs[i + 3];
  46851. isProc ?
  46852. renderer
  46853. .setAttribute(native, attrName_1, attrVal, namespaceURI) :
  46854. native.setAttributeNS(namespaceURI, attrName_1, attrVal);
  46855. i += 4;
  46856. }
  46857. else {
  46858. // Standard attributes
  46859. var attrVal = attrs[i + 1];
  46860. isProc ?
  46861. renderer
  46862. .setAttribute(native, attrName, attrVal) :
  46863. native.setAttribute(attrName, attrVal);
  46864. i += 2;
  46865. }
  46866. }
  46867. }
  46868. }
  46869. function createError(text, token) {
  46870. return new Error("Renderer: " + text + " [" + stringify$1(token) + "]");
  46871. }
  46872. /**
  46873. * Locates the host native element, used for bootstrapping existing nodes into rendering pipeline.
  46874. *
  46875. * @param elementOrSelector Render element or CSS selector to locate the element.
  46876. */
  46877. function locateHostElement(factory, elementOrSelector) {
  46878. ngDevMode && assertDataInRange(-1);
  46879. rendererFactory = factory;
  46880. var defaultRenderer = factory.createRenderer(null, null);
  46881. var rNode = typeof elementOrSelector === 'string' ?
  46882. (isProceduralRenderer(defaultRenderer) ?
  46883. defaultRenderer.selectRootElement(elementOrSelector) :
  46884. defaultRenderer.querySelector(elementOrSelector)) :
  46885. elementOrSelector;
  46886. if (ngDevMode && !rNode) {
  46887. if (typeof elementOrSelector === 'string') {
  46888. throw createError('Host node with selector not found:', elementOrSelector);
  46889. }
  46890. else {
  46891. throw createError('Host node is required:', elementOrSelector);
  46892. }
  46893. }
  46894. return rNode;
  46895. }
  46896. /**
  46897. * Creates the host LNode.
  46898. *
  46899. * @param rNode Render host element.
  46900. * @param def ComponentDef
  46901. *
  46902. * @returns LElementNode created
  46903. */
  46904. function hostElement(tag, rNode, def, sanitizer) {
  46905. resetApplicationState();
  46906. var node = createLNode(0, 3 /* Element */, rNode, null, null, createLViewData(renderer, getOrCreateTView(def.template, def.directiveDefs, def.pipeDefs, def.viewQuery), null, def.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */, sanitizer));
  46907. if (firstTemplatePass) {
  46908. node.tNode.flags = 4096 /* isComponent */;
  46909. if (def.diPublic)
  46910. def.diPublic(def);
  46911. tView.directives = [def];
  46912. }
  46913. return node;
  46914. }
  46915. /**
  46916. * Adds an event listener to the current node.
  46917. *
  46918. * If an output exists on one of the node's directives, it also subscribes to the output
  46919. * and saves the subscription for later cleanup.
  46920. *
  46921. * @param eventName Name of the event
  46922. * @param listenerFn The function to be called when event emits
  46923. * @param useCapture Whether or not to use capture in event listener.
  46924. */
  46925. function listener(eventName, listenerFn, useCapture) {
  46926. if (useCapture === void 0) { useCapture = false; }
  46927. ngDevMode && assertPreviousIsParent();
  46928. var node = previousOrParentNode;
  46929. var native = node.native;
  46930. ngDevMode && ngDevMode.rendererAddEventListener++;
  46931. // In order to match current behavior, native DOM event listeners must be added for all
  46932. // events (including outputs).
  46933. if (isProceduralRenderer(renderer)) {
  46934. var wrappedListener = wrapListenerWithDirtyLogic(viewData, listenerFn);
  46935. var cleanupFn = renderer.listen(native, eventName, wrappedListener);
  46936. storeCleanupFn(viewData, cleanupFn);
  46937. }
  46938. else {
  46939. var wrappedListener = wrapListenerWithDirtyAndDefault(viewData, listenerFn);
  46940. native.addEventListener(eventName, wrappedListener, useCapture);
  46941. var cleanupInstances = getCleanup(viewData);
  46942. cleanupInstances.push(wrappedListener);
  46943. if (firstTemplatePass) {
  46944. getTViewCleanup(viewData).push(eventName, node.tNode.index, cleanupInstances.length - 1, useCapture);
  46945. }
  46946. }
  46947. var tNode = node.tNode;
  46948. if (tNode.outputs === undefined) {
  46949. // if we create TNode here, inputs must be undefined so we know they still need to be
  46950. // checked
  46951. tNode.outputs = generatePropertyAliases(node.tNode.flags, 1 /* Output */);
  46952. }
  46953. var outputs = tNode.outputs;
  46954. var outputData;
  46955. if (outputs && (outputData = outputs[eventName])) {
  46956. createOutput(outputData, listenerFn);
  46957. }
  46958. }
  46959. /**
  46960. * Iterates through the outputs associated with a particular event name and subscribes to
  46961. * each output.
  46962. */
  46963. function createOutput(outputs, listener) {
  46964. for (var i = 0; i < outputs.length; i += 2) {
  46965. ngDevMode && assertDataInRange(outputs[i], directives);
  46966. var subscription = directives[outputs[i]][outputs[i + 1]].subscribe(listener);
  46967. storeCleanupWithContext(viewData, subscription, subscription.unsubscribe);
  46968. }
  46969. }
  46970. /**
  46971. * Saves context for this cleanup function in LView.cleanupInstances.
  46972. *
  46973. * On the first template pass, saves in TView:
  46974. * - Cleanup function
  46975. * - Index of context we just saved in LView.cleanupInstances
  46976. */
  46977. function storeCleanupWithContext(view, context, cleanupFn) {
  46978. if (!view)
  46979. view = viewData;
  46980. getCleanup(view).push(context);
  46981. if (view[TVIEW].firstTemplatePass) {
  46982. getTViewCleanup(view).push(cleanupFn, view[CLEANUP].length - 1);
  46983. }
  46984. }
  46985. /**
  46986. * Saves the cleanup function itself in LView.cleanupInstances.
  46987. *
  46988. * This is necessary for functions that are wrapped with their contexts, like in renderer2
  46989. * listeners.
  46990. *
  46991. * On the first template pass, the index of the cleanup function is saved in TView.
  46992. */
  46993. function storeCleanupFn(view, cleanupFn) {
  46994. getCleanup(view).push(cleanupFn);
  46995. if (view[TVIEW].firstTemplatePass) {
  46996. getTViewCleanup(view).push(view[CLEANUP].length - 1, null);
  46997. }
  46998. }
  46999. /** Mark the end of the element. */
  47000. function elementEnd() {
  47001. if (isParent) {
  47002. isParent = false;
  47003. }
  47004. else {
  47005. ngDevMode && assertHasParent();
  47006. previousOrParentNode = getParentLNode(previousOrParentNode);
  47007. }
  47008. ngDevMode && assertNodeType(previousOrParentNode, 3 /* Element */);
  47009. var queries = previousOrParentNode.queries;
  47010. queries && queries.addNode(previousOrParentNode);
  47011. queueLifecycleHooks(previousOrParentNode.tNode.flags, tView);
  47012. currentElementNode = null;
  47013. }
  47014. /**
  47015. * Updates the value of removes an attribute on an Element.
  47016. *
  47017. * @param number index The index of the element in the data array
  47018. * @param name name The name of the attribute.
  47019. * @param value value The attribute is removed when value is `null` or `undefined`.
  47020. * Otherwise the attribute value is set to the stringified value.
  47021. * @param sanitizer An optional function used to sanitize the value.
  47022. */
  47023. function elementAttribute(index, name, value, sanitizer) {
  47024. if (value !== NO_CHANGE) {
  47025. var element_1 = loadElement(index);
  47026. if (value == null) {
  47027. ngDevMode && ngDevMode.rendererRemoveAttribute++;
  47028. isProceduralRenderer(renderer) ? renderer.removeAttribute(element_1.native, name) :
  47029. element_1.native.removeAttribute(name);
  47030. }
  47031. else {
  47032. ngDevMode && ngDevMode.rendererSetAttribute++;
  47033. var strValue = sanitizer == null ? stringify$1(value) : sanitizer(value);
  47034. isProceduralRenderer(renderer) ? renderer.setAttribute(element_1.native, name, strValue) :
  47035. element_1.native.setAttribute(name, strValue);
  47036. }
  47037. }
  47038. }
  47039. /**
  47040. * Update a property on an Element.
  47041. *
  47042. * If the property name also exists as an input property on one of the element's directives,
  47043. * the component property will be set instead of the element property. This check must
  47044. * be conducted at runtime so child components that add new @Inputs don't have to be re-compiled.
  47045. *
  47046. * @param index The index of the element to update in the data array
  47047. * @param propName Name of property. Because it is going to DOM, this is not subject to
  47048. * renaming as part of minification.
  47049. * @param value New value to write.
  47050. * @param sanitizer An optional function used to sanitize the value.
  47051. */
  47052. function elementProperty(index, propName, value, sanitizer) {
  47053. if (value === NO_CHANGE)
  47054. return;
  47055. var node = loadElement(index);
  47056. var tNode = node.tNode;
  47057. // if tNode.inputs is undefined, a listener has created outputs, but inputs haven't
  47058. // yet been checked
  47059. if (tNode && tNode.inputs === undefined) {
  47060. // mark inputs as checked
  47061. tNode.inputs = generatePropertyAliases(node.tNode.flags, 0 /* Input */);
  47062. }
  47063. var inputData = tNode && tNode.inputs;
  47064. var dataValue;
  47065. if (inputData && (dataValue = inputData[propName])) {
  47066. setInputsForProperty(dataValue, value);
  47067. markDirtyIfOnPush(node);
  47068. }
  47069. else {
  47070. // It is assumed that the sanitizer is only added when the compiler determines that the property
  47071. // is risky, so sanitization can be done without further checks.
  47072. value = sanitizer != null ? sanitizer(value) : value;
  47073. var native = node.native;
  47074. ngDevMode && ngDevMode.rendererSetProperty++;
  47075. isProceduralRenderer(renderer) ? renderer.setProperty(native, propName, value) :
  47076. (native.setProperty ? native.setProperty(propName, value) :
  47077. native[propName] = value);
  47078. }
  47079. }
  47080. /**
  47081. * Constructs a TNode object from the arguments.
  47082. *
  47083. * @param type The type of the node
  47084. * @param adjustedIndex The index of the TNode in TView.data, adjusted for HEADER_OFFSET
  47085. * @param tagName The tag name of the node
  47086. * @param attrs The attributes defined on this node
  47087. * @param parent The parent of this node
  47088. * @param tViews Any TViews attached to this node
  47089. * @returns the TNode object
  47090. */
  47091. function createTNode(type, adjustedIndex, tagName, attrs, parent, tViews) {
  47092. ngDevMode && ngDevMode.tNode++;
  47093. return {
  47094. type: type,
  47095. index: adjustedIndex,
  47096. flags: 0,
  47097. tagName: tagName,
  47098. attrs: attrs,
  47099. localNames: null,
  47100. initialInputs: undefined,
  47101. inputs: undefined,
  47102. outputs: undefined,
  47103. tViews: tViews,
  47104. next: null,
  47105. child: null,
  47106. parent: parent,
  47107. dynamicContainerNode: null,
  47108. detached: null,
  47109. stylingTemplate: null,
  47110. projection: null
  47111. };
  47112. }
  47113. /**
  47114. * Given a list of directive indices and minified input names, sets the
  47115. * input properties on the corresponding directives.
  47116. */
  47117. function setInputsForProperty(inputs, value) {
  47118. for (var i = 0; i < inputs.length; i += 2) {
  47119. ngDevMode && assertDataInRange(inputs[i], directives);
  47120. directives[inputs[i]][inputs[i + 1]] = value;
  47121. }
  47122. }
  47123. /**
  47124. * Consolidates all inputs or outputs of all directives on this logical node.
  47125. *
  47126. * @param number lNodeFlags logical node flags
  47127. * @param Direction direction whether to consider inputs or outputs
  47128. * @returns PropertyAliases|null aggregate of all properties if any, `null` otherwise
  47129. */
  47130. function generatePropertyAliases(tNodeFlags, direction) {
  47131. var count = tNodeFlags & 4095 /* DirectiveCountMask */;
  47132. var propStore = null;
  47133. if (count > 0) {
  47134. var start = tNodeFlags >> 14 /* DirectiveStartingIndexShift */;
  47135. var end = start + count;
  47136. var isInput = direction === 0 /* Input */;
  47137. var defs = tView.directives;
  47138. for (var i = start; i < end; i++) {
  47139. var directiveDef = defs[i];
  47140. var propertyAliasMap = isInput ? directiveDef.inputs : directiveDef.outputs;
  47141. for (var publicName in propertyAliasMap) {
  47142. if (propertyAliasMap.hasOwnProperty(publicName)) {
  47143. propStore = propStore || {};
  47144. var internalName = propertyAliasMap[publicName];
  47145. var hasProperty = propStore.hasOwnProperty(publicName);
  47146. hasProperty ? propStore[publicName].push(i, internalName) :
  47147. (propStore[publicName] = [i, internalName]);
  47148. }
  47149. }
  47150. }
  47151. }
  47152. return propStore;
  47153. }
  47154. /**
  47155. * Add or remove a class in a `classList` on a DOM element.
  47156. *
  47157. * This instruction is meant to handle the [class.foo]="exp" case
  47158. *
  47159. * @param index The index of the element to update in the data array
  47160. * @param className Name of class to toggle. Because it is going to DOM, this is not subject to
  47161. * renaming as part of minification.
  47162. * @param value A value indicating if a given class should be added or removed.
  47163. */
  47164. function elementClassProp(index, stylingIndex, value) {
  47165. updateClassProp(getStylingContext(index), stylingIndex, value ? true : false);
  47166. }
  47167. /**
  47168. * Assign any inline style values to the element during creation mode.
  47169. *
  47170. * This instruction is meant to be called during creation mode to apply all styling
  47171. * (e.g. `style="..."`) values to the element. This is also where the provided index
  47172. * value is allocated for the styling details for its corresponding element (the element
  47173. * index is the previous index value from this one).
  47174. *
  47175. * (Note this function calls `elementStylingApply` immediately when called.)
  47176. *
  47177. *
  47178. * @param index Index value which will be allocated to store styling data for the element.
  47179. * (Note that this is not the element index, but rather an index value allocated
  47180. * specifically for element styling--the index must be the next index after the element
  47181. * index.)
  47182. * @param classDeclarations A key/value array of CSS classes that will be registered on the element.
  47183. * Each individual style will be used on the element as long as it is not overridden
  47184. * by any classes placed on the element by multiple (`[class]`) or singular (`[class.named]`)
  47185. * bindings. If a class binding changes its value to a falsy value then the matching initial
  47186. * class value that are passed in here will be applied to the element (if matched).
  47187. * @param styleDeclarations A key/value array of CSS styles that will be registered on the element.
  47188. * Each individual style will be used on the element as long as it is not overridden
  47189. * by any styles placed on the element by multiple (`[style]`) or singular (`[style.prop]`)
  47190. * bindings. If a style binding changes its value to null then the initial styling
  47191. * values that are passed in here will be applied to the element (if matched).
  47192. * @param styleSanitizer An optional sanitizer function that will be used (if provided)
  47193. * to sanitize the any CSS property values that are applied to the element (during rendering).
  47194. */
  47195. function elementStyling(classDeclarations, styleDeclarations, styleSanitizer) {
  47196. var lElement = currentElementNode;
  47197. var tNode = lElement.tNode;
  47198. if (!tNode.stylingTemplate) {
  47199. // initialize the styling template.
  47200. tNode.stylingTemplate =
  47201. createStylingContextTemplate(classDeclarations, styleDeclarations, styleSanitizer);
  47202. }
  47203. if (styleDeclarations && styleDeclarations.length ||
  47204. classDeclarations && classDeclarations.length) {
  47205. elementStylingApply(tNode.index - HEADER_OFFSET);
  47206. }
  47207. }
  47208. /**
  47209. * Retrieve the `StylingContext` at a given index.
  47210. *
  47211. * This method lazily creates the `StylingContext`. This is because in most cases
  47212. * we have styling without any bindings. Creating `StylingContext` eagerly would mean that
  47213. * every style declaration such as `<div style="color: red">` would result `StyleContext`
  47214. * which would create unnecessary memory pressure.
  47215. *
  47216. * @param index Index of the style allocation. See: `elementStyling`.
  47217. */
  47218. function getStylingContext(index) {
  47219. var stylingContext = load(index);
  47220. if (!Array.isArray(stylingContext)) {
  47221. var lElement = stylingContext;
  47222. var tNode = lElement.tNode;
  47223. ngDevMode &&
  47224. assertDefined(tNode.stylingTemplate, 'getStylingContext() called before elementStyling()');
  47225. stylingContext = viewData[index + HEADER_OFFSET] =
  47226. allocStylingContext(lElement, tNode.stylingTemplate);
  47227. }
  47228. return stylingContext;
  47229. }
  47230. /**
  47231. * Apply all styling values to the element which have been queued by any styling instructions.
  47232. *
  47233. * This instruction is meant to be run once one or more `elementStyle` and/or `elementStyleProp`
  47234. * have been issued against the element. This function will also determine if any styles have
  47235. * changed and will then skip the operation if there is nothing new to render.
  47236. *
  47237. * Once called then all queued styles will be flushed.
  47238. *
  47239. * @param index Index of the element's styling storage that will be rendered.
  47240. * (Note that this is not the element index, but rather an index value allocated
  47241. * specifically for element styling--the index must be the next index after the element
  47242. * index.)
  47243. */
  47244. function elementStylingApply(index) {
  47245. renderStyling(getStylingContext(index), renderer);
  47246. }
  47247. /**
  47248. * Queue a given style to be rendered on an Element.
  47249. *
  47250. * If the style value is `null` then it will be removed from the element
  47251. * (or assigned a different value depending if there are any styles placed
  47252. * on the element with `elementStyle` or any styles that are present
  47253. * from when the element was created (with `elementStyling`).
  47254. *
  47255. * (Note that the styling instruction will not be applied until `elementStylingApply` is called.)
  47256. *
  47257. * @param index Index of the element's styling storage to change in the data array.
  47258. * (Note that this is not the element index, but rather an index value allocated
  47259. * specifically for element styling--the index must be the next index after the element
  47260. * index.)
  47261. * @param styleIndex Index of the style property on this element. (Monotonically increasing.)
  47262. * @param styleName Name of property. Because it is going to DOM this is not subject to
  47263. * renaming as part of minification.
  47264. * @param value New value to write (null to remove).
  47265. * @param suffix Optional suffix. Used with scalar values to add unit such as `px`.
  47266. * Note that when a suffix is provided then the underlying sanitizer will
  47267. * be ignored.
  47268. */
  47269. function elementStyleProp(index, styleIndex, value, suffix) {
  47270. var valueToAdd = null;
  47271. if (value) {
  47272. if (suffix) {
  47273. // when a suffix is applied then it will bypass
  47274. // sanitization entirely (b/c a new string is created)
  47275. valueToAdd = stringify$1(value) + suffix;
  47276. }
  47277. else {
  47278. // sanitization happens by dealing with a String value
  47279. // this means that the string value will be passed through
  47280. // into the style rendering later (which is where the value
  47281. // will be sanitized before it is applied)
  47282. valueToAdd = value;
  47283. }
  47284. }
  47285. updateStyleProp(getStylingContext(index), styleIndex, valueToAdd);
  47286. }
  47287. /**
  47288. * Queue a key/value map of styles to be rendered on an Element.
  47289. *
  47290. * This instruction is meant to handle the `[style]="exp"` usage. When styles are applied to
  47291. * the Element they will then be placed with respect to any styles set with `elementStyleProp`.
  47292. * If any styles are set to `null` then they will be removed from the element (unless the same
  47293. * style properties have been assigned to the element during creation using `elementStyling`).
  47294. *
  47295. * (Note that the styling instruction will not be applied until `elementStylingApply` is called.)
  47296. *
  47297. * @param index Index of the element's styling storage to change in the data array.
  47298. * (Note that this is not the element index, but rather an index value allocated
  47299. * specifically for element styling--the index must be the next index after the element
  47300. * index.)
  47301. * @param classes A key/value style map of CSS classes that will be added to the given element.
  47302. * Any missing classes (that have already been applied to the element beforehand) will be
  47303. * removed (unset) from the element's list of CSS classes.
  47304. * @param styles A key/value style map of the styles that will be applied to the given element.
  47305. * Any missing styles (that have already been applied to the element beforehand) will be
  47306. * removed (unset) from the element's styling.
  47307. */
  47308. function elementStylingMap(index, classes, styles) {
  47309. updateStylingMap(getStylingContext(index), classes, styles);
  47310. }
  47311. //////////////////////////
  47312. //// Text
  47313. //////////////////////////
  47314. /**
  47315. * Create static text node
  47316. *
  47317. * @param index Index of the node in the data array
  47318. * @param value Value to write. This value will be stringified.
  47319. */
  47320. function text(index, value) {
  47321. ngDevMode &&
  47322. assertEqual(viewData[BINDING_INDEX], -1, 'text nodes should be created before bindings');
  47323. ngDevMode && ngDevMode.rendererCreateTextNode++;
  47324. var textNode = createTextNode(value, renderer);
  47325. var node = createLNode(index, 3 /* Element */, textNode, null, null);
  47326. // Text nodes are self closing.
  47327. isParent = false;
  47328. appendChild(getParentLNode(node), textNode, viewData);
  47329. }
  47330. /**
  47331. * Create text node with binding
  47332. * Bindings should be handled externally with the proper interpolation(1-8) method
  47333. *
  47334. * @param index Index of the node in the data array.
  47335. * @param value Stringified value to write.
  47336. */
  47337. function textBinding(index, value) {
  47338. if (value !== NO_CHANGE) {
  47339. ngDevMode && assertDataInRange(index + HEADER_OFFSET);
  47340. var existingNode = loadElement(index);
  47341. ngDevMode && assertDefined(existingNode, 'LNode should exist');
  47342. ngDevMode && assertDefined(existingNode.native, 'native element should exist');
  47343. ngDevMode && ngDevMode.rendererSetText++;
  47344. isProceduralRenderer(renderer) ? renderer.setValue(existingNode.native, stringify$1(value)) :
  47345. existingNode.native.textContent = stringify$1(value);
  47346. }
  47347. }
  47348. //////////////////////////
  47349. //// Directive
  47350. //////////////////////////
  47351. /**
  47352. * Create a directive and their associated content queries.
  47353. *
  47354. * NOTE: directives can be created in order other than the index order. They can also
  47355. * be retrieved before they are created in which case the value will be null.
  47356. *
  47357. * @param directive The directive instance.
  47358. * @param directiveDef DirectiveDef object which contains information about the template.
  47359. */
  47360. function directiveCreate(directiveDefIdx, directive, directiveDef) {
  47361. var instance = baseDirectiveCreate(directiveDefIdx, directive, directiveDef);
  47362. ngDevMode && assertDefined(previousOrParentNode.tNode, 'previousOrParentNode.tNode');
  47363. var tNode = previousOrParentNode.tNode;
  47364. var isComponent = directiveDef.template;
  47365. if (isComponent) {
  47366. addComponentLogic(directiveDefIdx, directive, directiveDef);
  47367. }
  47368. if (firstTemplatePass) {
  47369. // Init hooks are queued now so ngOnInit is called in host components before
  47370. // any projected components.
  47371. queueInitHooks(directiveDefIdx, directiveDef.onInit, directiveDef.doCheck, tView);
  47372. if (directiveDef.hostBindings)
  47373. queueHostBindingForCheck(directiveDefIdx);
  47374. }
  47375. if (tNode && tNode.attrs) {
  47376. setInputsFromAttrs(directiveDefIdx, instance, directiveDef.inputs, tNode);
  47377. }
  47378. if (directiveDef.contentQueries) {
  47379. directiveDef.contentQueries();
  47380. }
  47381. return instance;
  47382. }
  47383. function addComponentLogic(directiveIndex, instance, def) {
  47384. var tView = getOrCreateTView(def.template, def.directiveDefs, def.pipeDefs, def.viewQuery);
  47385. // Only component views should be added to the view tree directly. Embedded views are
  47386. // accessed through their containers because they may be removed / re-added later.
  47387. var componentView = addToViewTree(viewData, previousOrParentNode.tNode.index, createLViewData(rendererFactory.createRenderer(previousOrParentNode.native, def.rendererType), tView, null, def.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */, getCurrentSanitizer()));
  47388. // We need to set the host node/data here because when the component LNode was created,
  47389. // we didn't yet know it was a component (just an element).
  47390. previousOrParentNode.data = componentView;
  47391. componentView[HOST_NODE] = previousOrParentNode;
  47392. initChangeDetectorIfExisting(previousOrParentNode.nodeInjector, instance, componentView);
  47393. if (firstTemplatePass)
  47394. queueComponentIndexForCheck(directiveIndex);
  47395. }
  47396. /**
  47397. * A lighter version of directiveCreate() that is used for the root component
  47398. *
  47399. * This version does not contain features that we don't already support at root in
  47400. * current Angular. Example: local refs and inputs on root component.
  47401. */
  47402. function baseDirectiveCreate(index, directive, directiveDef) {
  47403. ngDevMode &&
  47404. assertEqual(viewData[BINDING_INDEX], -1, 'directives should be created before any bindings');
  47405. ngDevMode && assertPreviousIsParent();
  47406. Object.defineProperty(directive, NG_HOST_SYMBOL, { enumerable: false, value: previousOrParentNode });
  47407. if (directives == null)
  47408. viewData[DIRECTIVES] = directives = [];
  47409. ngDevMode && assertDataNext(index, directives);
  47410. directives[index] = directive;
  47411. if (firstTemplatePass) {
  47412. var flags = previousOrParentNode.tNode.flags;
  47413. if ((flags & 4095 /* DirectiveCountMask */) === 0) {
  47414. // When the first directive is created:
  47415. // - save the index,
  47416. // - set the number of directives to 1
  47417. previousOrParentNode.tNode.flags =
  47418. index << 14 /* DirectiveStartingIndexShift */ | flags & 4096 /* isComponent */ | 1;
  47419. }
  47420. else {
  47421. // Only need to bump the size when subsequent directives are created
  47422. ngDevMode && assertNotEqual(flags & 4095 /* DirectiveCountMask */, 4095 /* DirectiveCountMask */, 'Reached the max number of directives');
  47423. previousOrParentNode.tNode.flags++;
  47424. }
  47425. }
  47426. else {
  47427. var diPublic = directiveDef.diPublic;
  47428. if (diPublic)
  47429. diPublic(directiveDef);
  47430. }
  47431. if (directiveDef.attributes != null && previousOrParentNode.tNode.type == 3 /* Element */) {
  47432. setUpAttributes(previousOrParentNode.native, directiveDef.attributes);
  47433. }
  47434. return directive;
  47435. }
  47436. /**
  47437. * Sets initial input properties on directive instances from attribute data
  47438. *
  47439. * @param directiveIndex Index of the directive in directives array
  47440. * @param instance Instance of the directive on which to set the initial inputs
  47441. * @param inputs The list of inputs from the directive def
  47442. * @param tNode The static data for this node
  47443. */
  47444. function setInputsFromAttrs(directiveIndex, instance, inputs, tNode) {
  47445. var initialInputData = tNode.initialInputs;
  47446. if (initialInputData === undefined || directiveIndex >= initialInputData.length) {
  47447. initialInputData = generateInitialInputs(directiveIndex, inputs, tNode);
  47448. }
  47449. var initialInputs = initialInputData[directiveIndex];
  47450. if (initialInputs) {
  47451. for (var i = 0; i < initialInputs.length; i += 2) {
  47452. instance[initialInputs[i]] = initialInputs[i + 1];
  47453. }
  47454. }
  47455. }
  47456. /**
  47457. * Generates initialInputData for a node and stores it in the template's static storage
  47458. * so subsequent template invocations don't have to recalculate it.
  47459. *
  47460. * initialInputData is an array containing values that need to be set as input properties
  47461. * for directives on this node, but only once on creation. We need this array to support
  47462. * the case where you set an @Input property of a directive using attribute-like syntax.
  47463. * e.g. if you have a `name` @Input, you can set it once like this:
  47464. *
  47465. * <my-component name="Bess"></my-component>
  47466. *
  47467. * @param directiveIndex Index to store the initial input data
  47468. * @param inputs The list of inputs from the directive def
  47469. * @param tNode The static data on this node
  47470. */
  47471. function generateInitialInputs(directiveIndex, inputs, tNode) {
  47472. var initialInputData = tNode.initialInputs || (tNode.initialInputs = []);
  47473. initialInputData[directiveIndex] = null;
  47474. var attrs = tNode.attrs;
  47475. var i = 0;
  47476. while (i < attrs.length) {
  47477. var attrName = attrs[i];
  47478. if (attrName === 1 /* SelectOnly */)
  47479. break;
  47480. if (attrName === 0 /* NamespaceURI */) {
  47481. // We do not allow inputs on namespaced attributes.
  47482. i += 4;
  47483. continue;
  47484. }
  47485. var minifiedInputName = inputs[attrName];
  47486. var attrValue = attrs[i + 1];
  47487. if (minifiedInputName !== undefined) {
  47488. var inputsToStore = initialInputData[directiveIndex] || (initialInputData[directiveIndex] = []);
  47489. inputsToStore.push(minifiedInputName, attrValue);
  47490. }
  47491. i += 2;
  47492. }
  47493. return initialInputData;
  47494. }
  47495. //////////////////////////
  47496. //// ViewContainer & View
  47497. //////////////////////////
  47498. /**
  47499. * Creates a LContainer, either from a container instruction, or for a ViewContainerRef.
  47500. *
  47501. * @param parentLNode the LNode in which the container's content will be rendered
  47502. * @param currentView The parent view of the LContainer
  47503. * @param isForViewContainerRef Optional a flag indicating the ViewContainerRef case
  47504. * @returns LContainer
  47505. */
  47506. function createLContainer(parentLNode, currentView, isForViewContainerRef) {
  47507. ngDevMode && assertDefined(parentLNode, 'containers should have a parent');
  47508. var renderParent = canInsertNativeNode(parentLNode, currentView) ?
  47509. parentLNode :
  47510. null;
  47511. if (renderParent && renderParent.tNode.type === 2 /* View */) {
  47512. renderParent = getParentLNode(renderParent).data[RENDER_PARENT];
  47513. }
  47514. return [
  47515. isForViewContainerRef ? null : 0,
  47516. currentView,
  47517. null,
  47518. null,
  47519. [],
  47520. renderParent
  47521. ];
  47522. }
  47523. /**
  47524. * Creates an LContainerNode.
  47525. *
  47526. * Only `LViewNodes` can go into `LContainerNodes`.
  47527. *
  47528. * @param index The index of the container in the data array
  47529. * @param template Optional inline template
  47530. * @param tagName The name of the container element, if applicable
  47531. * @param attrs The attrs attached to the container, if applicable
  47532. * @param localRefs A set of local reference bindings on the element.
  47533. */
  47534. function container(index, template, tagName, attrs, localRefs) {
  47535. ngDevMode &&
  47536. assertEqual(viewData[BINDING_INDEX], -1, 'container nodes should be created before any bindings');
  47537. var currentParent = isParent ? previousOrParentNode : getParentLNode(previousOrParentNode);
  47538. var lContainer = createLContainer(currentParent, viewData);
  47539. var comment = renderer.createComment(ngDevMode ? 'container' : '');
  47540. var node = createLNode(index, 0 /* Container */, comment, tagName || null, attrs || null, lContainer);
  47541. appendChild(getParentLNode(node), comment, viewData);
  47542. if (firstTemplatePass) {
  47543. node.tNode.tViews = template ?
  47544. createTView(-1, template, tView.directiveRegistry, tView.pipeRegistry, null) :
  47545. [];
  47546. }
  47547. // Containers are added to the current view tree instead of their embedded views
  47548. // because views can be removed and re-inserted.
  47549. addToViewTree(viewData, index + HEADER_OFFSET, node.data);
  47550. var queries = node.queries;
  47551. if (queries) {
  47552. // prepare place for matching nodes from views inserted into a given container
  47553. lContainer[QUERIES] = queries.container();
  47554. }
  47555. createDirectivesAndLocals(localRefs);
  47556. isParent = false;
  47557. ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
  47558. queries && queries.addNode(node); // check if a given container node matches
  47559. queueLifecycleHooks(node.tNode.flags, tView);
  47560. }
  47561. /**
  47562. * Sets a container up to receive views.
  47563. *
  47564. * @param index The index of the container in the data array
  47565. */
  47566. function containerRefreshStart(index) {
  47567. previousOrParentNode = loadElement(index);
  47568. ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
  47569. isParent = true;
  47570. previousOrParentNode.data[ACTIVE_INDEX] = 0;
  47571. if (!checkNoChangesMode) {
  47572. // We need to execute init hooks here so ngOnInit hooks are called in top level views
  47573. // before they are called in embedded views (for backwards compatibility).
  47574. executeInitHooks(viewData, tView, creationMode);
  47575. }
  47576. }
  47577. /**
  47578. * Marks the end of the LContainerNode.
  47579. *
  47580. * Marking the end of LContainerNode is the time when to child Views get inserted or removed.
  47581. */
  47582. function containerRefreshEnd() {
  47583. if (isParent) {
  47584. isParent = false;
  47585. }
  47586. else {
  47587. ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
  47588. ngDevMode && assertHasParent();
  47589. previousOrParentNode = getParentLNode(previousOrParentNode);
  47590. }
  47591. ngDevMode && assertNodeType(previousOrParentNode, 0 /* Container */);
  47592. var container = previousOrParentNode;
  47593. ngDevMode && assertNodeType(container, 0 /* Container */);
  47594. var nextIndex = container.data[ACTIVE_INDEX];
  47595. // remove extra views at the end of the container
  47596. while (nextIndex < container.data[VIEWS].length) {
  47597. removeView(container, nextIndex);
  47598. }
  47599. }
  47600. /**
  47601. * Goes over dynamic embedded views (ones created through ViewContainerRef APIs) and refreshes them
  47602. * by executing an associated template function.
  47603. */
  47604. function refreshDynamicEmbeddedViews(lViewData) {
  47605. for (var current = getLViewChild(lViewData); current !== null; current = current[NEXT]) {
  47606. // Note: current can be an LViewData or an LContainer instance, but here we are only interested
  47607. // in LContainer. We can tell it's an LContainer because its length is less than the LViewData
  47608. // header.
  47609. if (current.length < HEADER_OFFSET && current[ACTIVE_INDEX] === null) {
  47610. var container_1 = current;
  47611. for (var i = 0; i < container_1[VIEWS].length; i++) {
  47612. var lViewNode = container_1[VIEWS][i];
  47613. // The directives and pipes are not needed here as an existing view is only being refreshed.
  47614. var dynamicViewData = lViewNode.data;
  47615. ngDevMode && assertDefined(dynamicViewData[TVIEW], 'TView must be allocated');
  47616. renderEmbeddedTemplate(lViewNode, dynamicViewData[TVIEW], dynamicViewData[CONTEXT], 2 /* Update */);
  47617. }
  47618. }
  47619. }
  47620. }
  47621. /**
  47622. * Looks for a view with a given view block id inside a provided LContainer.
  47623. * Removes views that need to be deleted in the process.
  47624. *
  47625. * @param containerNode where to search for views
  47626. * @param startIdx starting index in the views array to search from
  47627. * @param viewBlockId exact view block id to look for
  47628. * @returns index of a found view or -1 if not found
  47629. */
  47630. function scanForView(containerNode, startIdx, viewBlockId) {
  47631. var views = containerNode.data[VIEWS];
  47632. for (var i = startIdx; i < views.length; i++) {
  47633. var viewAtPositionId = views[i].data[TVIEW].id;
  47634. if (viewAtPositionId === viewBlockId) {
  47635. return views[i];
  47636. }
  47637. else if (viewAtPositionId < viewBlockId) {
  47638. // found a view that should not be at this position - remove
  47639. removeView(containerNode, i);
  47640. }
  47641. else {
  47642. // found a view with id greater than the one we are searching for
  47643. // which means that required view doesn't exist and can't be found at
  47644. // later positions in the views array - stop the search here
  47645. break;
  47646. }
  47647. }
  47648. return null;
  47649. }
  47650. /**
  47651. * Marks the start of an embedded view.
  47652. *
  47653. * @param viewBlockId The ID of this view
  47654. * @return boolean Whether or not this view is in creation mode
  47655. */
  47656. function embeddedViewStart(viewBlockId) {
  47657. var container = (isParent ? previousOrParentNode : getParentLNode(previousOrParentNode));
  47658. ngDevMode && assertNodeType(container, 0 /* Container */);
  47659. var lContainer = container.data;
  47660. var viewNode = scanForView(container, lContainer[ACTIVE_INDEX], viewBlockId);
  47661. if (viewNode) {
  47662. previousOrParentNode = viewNode;
  47663. ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
  47664. isParent = true;
  47665. enterView(viewNode.data, viewNode);
  47666. }
  47667. else {
  47668. // When we create a new LView, we always reset the state of the instructions.
  47669. var newView = createLViewData(renderer, getOrCreateEmbeddedTView(viewBlockId, container), null, 2 /* CheckAlways */, getCurrentSanitizer());
  47670. if (lContainer[QUERIES]) {
  47671. newView[QUERIES] = lContainer[QUERIES].createView();
  47672. }
  47673. enterView(newView, viewNode = createLNode(viewBlockId, 2 /* View */, null, null, null, newView));
  47674. }
  47675. if (container) {
  47676. if (creationMode) {
  47677. // it is a new view, insert it into collection of views for a given container
  47678. insertView(container, viewNode, lContainer[ACTIVE_INDEX]);
  47679. }
  47680. lContainer[ACTIVE_INDEX]++;
  47681. }
  47682. return getRenderFlags(viewNode.data);
  47683. }
  47684. /**
  47685. * Initialize the TView (e.g. static data) for the active embedded view.
  47686. *
  47687. * Each embedded view block must create or retrieve its own TView. Otherwise, the embedded view's
  47688. * static data for a particular node would overwrite the static data for a node in the view above
  47689. * it with the same index (since it's in the same template).
  47690. *
  47691. * @param viewIndex The index of the TView in TNode.tViews
  47692. * @param parent The parent container in which to look for the view's static data
  47693. * @returns TView
  47694. */
  47695. function getOrCreateEmbeddedTView(viewIndex, parent) {
  47696. ngDevMode && assertNodeType(parent, 0 /* Container */);
  47697. var containerTViews = parent.tNode.tViews;
  47698. ngDevMode && assertDefined(containerTViews, 'TView expected');
  47699. ngDevMode && assertEqual(Array.isArray(containerTViews), true, 'TViews should be in an array');
  47700. if (viewIndex >= containerTViews.length || containerTViews[viewIndex] == null) {
  47701. containerTViews[viewIndex] =
  47702. createTView(viewIndex, null, tView.directiveRegistry, tView.pipeRegistry, null);
  47703. }
  47704. return containerTViews[viewIndex];
  47705. }
  47706. /** Marks the end of an embedded view. */
  47707. function embeddedViewEnd() {
  47708. refreshView();
  47709. isParent = false;
  47710. previousOrParentNode = viewData[HOST_NODE];
  47711. leaveView(viewData[PARENT]);
  47712. ngDevMode && assertEqual(isParent, false, 'isParent');
  47713. ngDevMode && assertNodeType(previousOrParentNode, 2 /* View */);
  47714. }
  47715. /////////////
  47716. /**
  47717. * Refreshes components by entering the component view and processing its bindings, queries, etc.
  47718. *
  47719. * @param directiveIndex Directive index in LViewData[DIRECTIVES]
  47720. * @param adjustedElementIndex Element index in LViewData[] (adjusted for HEADER_OFFSET)
  47721. */
  47722. function componentRefresh(directiveIndex, adjustedElementIndex) {
  47723. ngDevMode && assertDataInRange(adjustedElementIndex);
  47724. var element = viewData[adjustedElementIndex];
  47725. ngDevMode && assertNodeType(element, 3 /* Element */);
  47726. ngDevMode &&
  47727. assertDefined(element.data, "Component's host node should have an LViewData attached.");
  47728. var hostView = element.data;
  47729. // Only attached CheckAlways components or attached, dirty OnPush components should be checked
  47730. if (viewAttached(hostView) && hostView[FLAGS] & (2 /* CheckAlways */ | 4 /* Dirty */)) {
  47731. ngDevMode && assertDataInRange(directiveIndex, directives);
  47732. detectChangesInternal(hostView, element, directives[directiveIndex]);
  47733. }
  47734. }
  47735. /** Returns a boolean for whether the view is attached */
  47736. function viewAttached(view) {
  47737. return (view[FLAGS] & 8 /* Attached */) === 8 /* Attached */;
  47738. }
  47739. /**
  47740. * Instruction to distribute projectable nodes among <ng-content> occurrences in a given template.
  47741. * It takes all the selectors from the entire component's template and decides where
  47742. * each projected node belongs (it re-distributes nodes among "buckets" where each "bucket" is
  47743. * backed by a selector).
  47744. *
  47745. * This function requires CSS selectors to be provided in 2 forms: parsed (by a compiler) and text,
  47746. * un-parsed form.
  47747. *
  47748. * The parsed form is needed for efficient matching of a node against a given CSS selector.
  47749. * The un-parsed, textual form is needed for support of the ngProjectAs attribute.
  47750. *
  47751. * Having a CSS selector in 2 different formats is not ideal, but alternatives have even more
  47752. * drawbacks:
  47753. * - having only a textual form would require runtime parsing of CSS selectors;
  47754. * - we can't have only a parsed as we can't re-construct textual form from it (as entered by a
  47755. * template author).
  47756. *
  47757. * @param selectors A collection of parsed CSS selectors
  47758. * @param rawSelectors A collection of CSS selectors in the raw, un-parsed form
  47759. */
  47760. function projectionDef(selectors, textSelectors) {
  47761. var componentNode = findComponentHost(viewData);
  47762. if (!componentNode.tNode.projection) {
  47763. var noOfNodeBuckets = selectors ? selectors.length + 1 : 1;
  47764. var pData = componentNode.tNode.projection =
  47765. new Array(noOfNodeBuckets).fill(null);
  47766. var tails = pData.slice();
  47767. var componentChild = componentNode.tNode.child;
  47768. while (componentChild !== null) {
  47769. var bucketIndex = selectors ? matchingSelectorIndex(componentChild, selectors, textSelectors) : 0;
  47770. var nextNode = componentChild.next;
  47771. if (tails[bucketIndex]) {
  47772. tails[bucketIndex].next = componentChild;
  47773. }
  47774. else {
  47775. pData[bucketIndex] = componentChild;
  47776. componentChild.next = null;
  47777. }
  47778. tails[bucketIndex] = componentChild;
  47779. componentChild = nextNode;
  47780. }
  47781. }
  47782. }
  47783. /**
  47784. * Stack used to keep track of projection nodes in projection() instruction.
  47785. *
  47786. * This is deliberately created outside of projection() to avoid allocating
  47787. * a new array each time the function is called. Instead the array will be
  47788. * re-used by each invocation. This works because the function is not reentrant.
  47789. */
  47790. var projectionNodeStack$1 = [];
  47791. /**
  47792. * Inserts previously re-distributed projected nodes. This instruction must be preceded by a call
  47793. * to the projectionDef instruction.
  47794. *
  47795. * @param nodeIndex
  47796. * @param selectorIndex:
  47797. * - 0 when the selector is `*` (or unspecified as this is the default value),
  47798. * - 1 based index of the selector from the {@link projectionDef}
  47799. */
  47800. function projection(nodeIndex, selectorIndex, attrs) {
  47801. if (selectorIndex === void 0) { selectorIndex = 0; }
  47802. var node = createLNode(nodeIndex, 1 /* Projection */, null, null, attrs || null, null);
  47803. // We can't use viewData[HOST_NODE] because projection nodes can be nested in embedded views.
  47804. if (node.tNode.projection === null)
  47805. node.tNode.projection = selectorIndex;
  47806. // `<ng-content>` has no content
  47807. isParent = false;
  47808. // re-distribution of projectable nodes is stored on a component's view level
  47809. var parent = getParentLNode(node);
  47810. if (canInsertNativeNode(parent, viewData)) {
  47811. var componentNode = findComponentHost(viewData);
  47812. var nodeToProject = componentNode.tNode.projection[selectorIndex];
  47813. var projectedView = componentNode.view;
  47814. var projectionNodeIndex = -1;
  47815. var grandparent = void 0;
  47816. var renderParent = parent.tNode.type === 2 /* View */ ?
  47817. (grandparent = getParentLNode(parent)) &&
  47818. grandparent.data[RENDER_PARENT] :
  47819. parent;
  47820. while (nodeToProject) {
  47821. if (nodeToProject.type === 1 /* Projection */) {
  47822. // This node is re-projected, so we must go up the tree to get its projected nodes.
  47823. var currentComponentHost = findComponentHost(projectedView);
  47824. var firstProjectedNode = currentComponentHost.tNode.projection[nodeToProject.projection];
  47825. if (firstProjectedNode) {
  47826. projectionNodeStack$1[++projectionNodeIndex] = projectedView[nodeToProject.index];
  47827. nodeToProject = firstProjectedNode;
  47828. projectedView = currentComponentHost.view;
  47829. continue;
  47830. }
  47831. }
  47832. else {
  47833. var lNode = projectedView[nodeToProject.index];
  47834. lNode.tNode.flags |= 8192 /* isProjected */;
  47835. appendProjectedNode(lNode, parent, viewData, renderParent);
  47836. }
  47837. // If we are finished with a list of re-projected nodes, we need to get
  47838. // back to the root projection node that was re-projected.
  47839. if (nodeToProject.next === null && projectedView !== componentNode.view) {
  47840. // move down into the view of the component we're projecting right now
  47841. var lNode = projectionNodeStack$1[projectionNodeIndex--];
  47842. nodeToProject = lNode.tNode;
  47843. projectedView = lNode.view;
  47844. }
  47845. nodeToProject = nodeToProject.next;
  47846. }
  47847. }
  47848. }
  47849. /**
  47850. * Adds LViewData or LContainer to the end of the current view tree.
  47851. *
  47852. * This structure will be used to traverse through nested views to remove listeners
  47853. * and call onDestroy callbacks.
  47854. *
  47855. * @param currentView The view where LViewData or LContainer should be added
  47856. * @param adjustedHostIndex Index of the view's host node in LViewData[], adjusted for header
  47857. * @param state The LViewData or LContainer to add to the view tree
  47858. * @returns The state passed in
  47859. */
  47860. function addToViewTree(currentView, adjustedHostIndex, state) {
  47861. if (currentView[TAIL]) {
  47862. currentView[TAIL][NEXT] = state;
  47863. }
  47864. else if (firstTemplatePass) {
  47865. tView.childIndex = adjustedHostIndex;
  47866. }
  47867. currentView[TAIL] = state;
  47868. return state;
  47869. }
  47870. ///////////////////////////////
  47871. //// Change detection
  47872. ///////////////////////////////
  47873. /** If node is an OnPush component, marks its LViewData dirty. */
  47874. function markDirtyIfOnPush(node) {
  47875. // Because data flows down the component tree, ancestors do not need to be marked dirty
  47876. if (node.data && !(node.data[FLAGS] & 2 /* CheckAlways */)) {
  47877. node.data[FLAGS] |= 4 /* Dirty */;
  47878. }
  47879. }
  47880. /**
  47881. * Wraps an event listener so its host view and its ancestor views will be marked dirty
  47882. * whenever the event fires. Necessary to support OnPush components.
  47883. */
  47884. function wrapListenerWithDirtyLogic(view, listenerFn) {
  47885. return function (e) {
  47886. markViewDirty(view);
  47887. return listenerFn(e);
  47888. };
  47889. }
  47890. /**
  47891. * Wraps an event listener so its host view and its ancestor views will be marked dirty
  47892. * whenever the event fires. Also wraps with preventDefault behavior.
  47893. */
  47894. function wrapListenerWithDirtyAndDefault(view, listenerFn) {
  47895. return function wrapListenerIn_markViewDirty(e) {
  47896. markViewDirty(view);
  47897. if (listenerFn(e) === false) {
  47898. e.preventDefault();
  47899. // Necessary for legacy browsers that don't support preventDefault (e.g. IE)
  47900. e.returnValue = false;
  47901. }
  47902. };
  47903. }
  47904. /** Marks current view and all ancestors dirty */
  47905. function markViewDirty(view) {
  47906. var currentView = view;
  47907. while (currentView[PARENT] != null) {
  47908. currentView[FLAGS] |= 4 /* Dirty */;
  47909. currentView = currentView[PARENT];
  47910. }
  47911. currentView[FLAGS] |= 4 /* Dirty */;
  47912. ngDevMode && assertDefined(currentView[CONTEXT], 'rootContext');
  47913. scheduleTick(currentView[CONTEXT]);
  47914. }
  47915. /**
  47916. * Used to schedule change detection on the whole application.
  47917. *
  47918. * Unlike `tick`, `scheduleTick` coalesces multiple calls into one change detection run.
  47919. * It is usually called indirectly by calling `markDirty` when the view needs to be
  47920. * re-rendered.
  47921. *
  47922. * Typically `scheduleTick` uses `requestAnimationFrame` to coalesce multiple
  47923. * `scheduleTick` requests. The scheduling function can be overridden in
  47924. * `renderComponent`'s `scheduler` option.
  47925. */
  47926. function scheduleTick(rootContext) {
  47927. if (rootContext.clean == _CLEAN_PROMISE) {
  47928. var res_1;
  47929. rootContext.clean = new Promise(function (r) { return res_1 = r; });
  47930. rootContext.scheduler(function () {
  47931. tickRootContext(rootContext);
  47932. res_1(null);
  47933. rootContext.clean = _CLEAN_PROMISE;
  47934. });
  47935. }
  47936. }
  47937. function tickRootContext(rootContext) {
  47938. for (var i = 0; i < rootContext.components.length; i++) {
  47939. var rootComponent = rootContext.components[i];
  47940. var hostNode = _getComponentHostLElementNode(rootComponent);
  47941. ngDevMode && assertDefined(hostNode.data, 'Component host node should be attached to an LView');
  47942. renderComponentOrTemplate(hostNode, getRootView(rootComponent), rootComponent);
  47943. }
  47944. }
  47945. /**
  47946. * Retrieve the root view from any component by walking the parent `LViewData` until
  47947. * reaching the root `LViewData`.
  47948. *
  47949. * @param component any component
  47950. */
  47951. function getRootView(component) {
  47952. ngDevMode && assertDefined(component, 'component');
  47953. var lElementNode = _getComponentHostLElementNode(component);
  47954. var lViewData = lElementNode.view;
  47955. while (lViewData[PARENT]) {
  47956. lViewData = lViewData[PARENT];
  47957. }
  47958. return lViewData;
  47959. }
  47960. /**
  47961. * Synchronously perform change detection on a component (and possibly its sub-components).
  47962. *
  47963. * This function triggers change detection in a synchronous way on a component. There should
  47964. * be very little reason to call this function directly since a preferred way to do change
  47965. * detection is to {@link markDirty} the component and wait for the scheduler to call this method
  47966. * at some future point in time. This is because a single user action often results in many
  47967. * components being invalidated and calling change detection on each component synchronously
  47968. * would be inefficient. It is better to wait until all components are marked as dirty and
  47969. * then perform single change detection across all of the components
  47970. *
  47971. * @param component The component which the change detection should be performed on.
  47972. */
  47973. function detectChanges(component) {
  47974. var hostNode = _getComponentHostLElementNode(component);
  47975. ngDevMode &&
  47976. assertDefined(hostNode.data, 'Component host node should be attached to an LViewData instance.');
  47977. detectChangesInternal(hostNode.data, hostNode, component);
  47978. }
  47979. /**
  47980. * Checks the change detector and its children, and throws if any changes are detected.
  47981. *
  47982. * This is used in development mode to verify that running change detection doesn't
  47983. * introduce other changes.
  47984. */
  47985. function checkNoChanges(component) {
  47986. checkNoChangesMode = true;
  47987. try {
  47988. detectChanges(component);
  47989. }
  47990. finally {
  47991. checkNoChangesMode = false;
  47992. }
  47993. }
  47994. /** Checks the view of the component provided. Does not gate on dirty checks or execute doCheck. */
  47995. function detectChangesInternal(hostView, hostNode, component) {
  47996. var oldView = enterView(hostView, hostNode);
  47997. var hostTView = hostView[TVIEW];
  47998. var template = hostTView.template;
  47999. var viewQuery = hostTView.viewQuery;
  48000. try {
  48001. namespaceHTML();
  48002. createViewQuery(viewQuery, hostView[FLAGS], component);
  48003. template(getRenderFlags(hostView), component);
  48004. refreshView();
  48005. updateViewQuery(viewQuery, component);
  48006. }
  48007. finally {
  48008. leaveView(oldView);
  48009. }
  48010. }
  48011. function createViewQuery(viewQuery, flags, component) {
  48012. if (viewQuery && (flags & 1 /* CreationMode */)) {
  48013. viewQuery(1 /* Create */, component);
  48014. }
  48015. }
  48016. function updateViewQuery(viewQuery, component) {
  48017. if (viewQuery) {
  48018. viewQuery(2 /* Update */, component);
  48019. }
  48020. }
  48021. /**
  48022. * Mark the component as dirty (needing change detection).
  48023. *
  48024. * Marking a component dirty will schedule a change detection on this
  48025. * component at some point in the future. Marking an already dirty
  48026. * component as dirty is a noop. Only one outstanding change detection
  48027. * can be scheduled per component tree. (Two components bootstrapped with
  48028. * separate `renderComponent` will have separate schedulers)
  48029. *
  48030. * When the root component is bootstrapped with `renderComponent`, a scheduler
  48031. * can be provided.
  48032. *
  48033. * @param component Component to mark as dirty.
  48034. */
  48035. function markDirty(component) {
  48036. ngDevMode && assertDefined(component, 'component');
  48037. var lElementNode = _getComponentHostLElementNode(component);
  48038. markViewDirty(lElementNode.view);
  48039. }
  48040. /** A special value which designates that a value has not changed. */
  48041. var NO_CHANGE = {};
  48042. /**
  48043. * Initializes the binding start index. Will get inlined.
  48044. *
  48045. * This function must be called before any binding related function is called
  48046. * (ie `bind()`, `interpolationX()`, `pureFunctionX()`)
  48047. */
  48048. function initBindings() {
  48049. ngDevMode && assertEqual(viewData[BINDING_INDEX], -1, 'Binding index should not yet be set ' + viewData[BINDING_INDEX]);
  48050. if (tView.bindingStartIndex === -1) {
  48051. tView.bindingStartIndex = viewData.length;
  48052. }
  48053. viewData[BINDING_INDEX] = tView.bindingStartIndex;
  48054. }
  48055. /**
  48056. * Creates a single value binding.
  48057. *
  48058. * @param value Value to diff
  48059. */
  48060. function bind(value) {
  48061. return bindingUpdated(value) ? value : NO_CHANGE;
  48062. }
  48063. /**
  48064. * Reserves slots for pure functions (`pureFunctionX` instructions)
  48065. *
  48066. * Bindings for pure functions are stored after the LNodes in the data array but before the binding.
  48067. *
  48068. * ----------------------------------------------------------------------------
  48069. * | LNodes ... | pure function bindings | regular bindings / interpolations |
  48070. * ----------------------------------------------------------------------------
  48071. * ^
  48072. * TView.bindingStartIndex
  48073. *
  48074. * Pure function instructions are given an offset from TView.bindingStartIndex.
  48075. * Subtracting the offset from TView.bindingStartIndex gives the first index where the bindings
  48076. * are stored.
  48077. *
  48078. * NOTE: reserveSlots instructions are only ever allowed at the very end of the creation block
  48079. */
  48080. function reserveSlots(numSlots) {
  48081. // Init the slots with a unique `NO_CHANGE` value so that the first change is always detected
  48082. // whether it happens or not during the first change detection pass - pure functions checks
  48083. // might be skipped when short-circuited.
  48084. viewData.length += numSlots;
  48085. viewData.fill(NO_CHANGE, -numSlots);
  48086. // We need to initialize the binding in case a `pureFunctionX` kind of binding instruction is
  48087. // called first in the update section.
  48088. initBindings();
  48089. }
  48090. /**
  48091. * Sets up the binding index before executing any `pureFunctionX` instructions.
  48092. *
  48093. * The index must be restored after the pure function is executed
  48094. *
  48095. * {@link reserveSlots}
  48096. */
  48097. function moveBindingIndexToReservedSlot(offset) {
  48098. var currentSlot = viewData[BINDING_INDEX];
  48099. viewData[BINDING_INDEX] = tView.bindingStartIndex - offset;
  48100. return currentSlot;
  48101. }
  48102. /**
  48103. * Restores the binding index to the given value.
  48104. *
  48105. * This function is typically used to restore the index after a `pureFunctionX` has
  48106. * been executed.
  48107. */
  48108. function restoreBindingIndex(index) {
  48109. viewData[BINDING_INDEX] = index;
  48110. }
  48111. /**
  48112. * Create interpolation bindings with a variable number of expressions.
  48113. *
  48114. * If there are 1 to 8 expressions `interpolation1()` to `interpolation8()` should be used instead.
  48115. * Those are faster because there is no need to create an array of expressions and iterate over it.
  48116. *
  48117. * `values`:
  48118. * - has static text at even indexes,
  48119. * - has evaluated expressions at odd indexes.
  48120. *
  48121. * Returns the concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  48122. */
  48123. function interpolationV(values) {
  48124. ngDevMode && assertLessThan(2, values.length, 'should have at least 3 values');
  48125. ngDevMode && assertEqual(values.length % 2, 1, 'should have an odd number of values');
  48126. var different = false;
  48127. for (var i = 1; i < values.length; i += 2) {
  48128. // Check if bindings (odd indexes) have changed
  48129. bindingUpdated(values[i]) && (different = true);
  48130. }
  48131. if (!different) {
  48132. return NO_CHANGE;
  48133. }
  48134. // Build the updated content
  48135. var content = values[0];
  48136. for (var i = 1; i < values.length; i += 2) {
  48137. content += stringify$1(values[i]) + values[i + 1];
  48138. }
  48139. return content;
  48140. }
  48141. /**
  48142. * Creates an interpolation binding with 1 expression.
  48143. *
  48144. * @param prefix static value used for concatenation only.
  48145. * @param v0 value checked for change.
  48146. * @param suffix static value used for concatenation only.
  48147. */
  48148. function interpolation1(prefix, v0, suffix) {
  48149. var different = bindingUpdated(v0);
  48150. return different ? prefix + stringify$1(v0) + suffix : NO_CHANGE;
  48151. }
  48152. /** Creates an interpolation binding with 2 expressions. */
  48153. function interpolation2(prefix, v0, i0, v1, suffix) {
  48154. var different = bindingUpdated2(v0, v1);
  48155. return different ? prefix + stringify$1(v0) + i0 + stringify$1(v1) + suffix : NO_CHANGE;
  48156. }
  48157. /** Creates an interpolation binding with 3 expressions. */
  48158. function interpolation3(prefix, v0, i0, v1, i1, v2, suffix) {
  48159. var different = bindingUpdated2(v0, v1);
  48160. different = bindingUpdated(v2) || different;
  48161. return different ? prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + suffix :
  48162. NO_CHANGE;
  48163. }
  48164. /** Create an interpolation binding with 4 expressions. */
  48165. function interpolation4(prefix, v0, i0, v1, i1, v2, i2, v3, suffix) {
  48166. var different = bindingUpdated4(v0, v1, v2, v3);
  48167. return different ?
  48168. prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + i2 + stringify$1(v3) +
  48169. suffix :
  48170. NO_CHANGE;
  48171. }
  48172. /** Creates an interpolation binding with 5 expressions. */
  48173. function interpolation5(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, suffix) {
  48174. var different = bindingUpdated4(v0, v1, v2, v3);
  48175. different = bindingUpdated(v4) || different;
  48176. return different ?
  48177. prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + i2 + stringify$1(v3) + i3 +
  48178. stringify$1(v4) + suffix :
  48179. NO_CHANGE;
  48180. }
  48181. /** Creates an interpolation binding with 6 expressions. */
  48182. function interpolation6(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, suffix) {
  48183. var different = bindingUpdated4(v0, v1, v2, v3);
  48184. different = bindingUpdated2(v4, v5) || different;
  48185. return different ?
  48186. prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + i2 + stringify$1(v3) + i3 +
  48187. stringify$1(v4) + i4 + stringify$1(v5) + suffix :
  48188. NO_CHANGE;
  48189. }
  48190. /** Creates an interpolation binding with 7 expressions. */
  48191. function interpolation7(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, suffix) {
  48192. var different = bindingUpdated4(v0, v1, v2, v3);
  48193. different = bindingUpdated2(v4, v5) || different;
  48194. different = bindingUpdated(v6) || different;
  48195. return different ?
  48196. prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + i2 + stringify$1(v3) + i3 +
  48197. stringify$1(v4) + i4 + stringify$1(v5) + i5 + stringify$1(v6) + suffix :
  48198. NO_CHANGE;
  48199. }
  48200. /** Creates an interpolation binding with 8 expressions. */
  48201. function interpolation8(prefix, v0, i0, v1, i1, v2, i2, v3, i3, v4, i4, v5, i5, v6, i6, v7, suffix) {
  48202. var different = bindingUpdated4(v0, v1, v2, v3);
  48203. different = bindingUpdated4(v4, v5, v6, v7) || different;
  48204. return different ?
  48205. prefix + stringify$1(v0) + i0 + stringify$1(v1) + i1 + stringify$1(v2) + i2 + stringify$1(v3) + i3 +
  48206. stringify$1(v4) + i4 + stringify$1(v5) + i5 + stringify$1(v6) + i6 + stringify$1(v7) + suffix :
  48207. NO_CHANGE;
  48208. }
  48209. /** Store a value in the `data` at a given `index`. */
  48210. function store(index, value) {
  48211. // We don't store any static data for local variables, so the first time
  48212. // we see the template, we should store as null to avoid a sparse array
  48213. var adjustedIndex = index + HEADER_OFFSET;
  48214. if (adjustedIndex >= tView.data.length) {
  48215. tView.data[adjustedIndex] = null;
  48216. }
  48217. viewData[adjustedIndex] = value;
  48218. }
  48219. /** Retrieves a value from the `directives` array. */
  48220. function loadDirective(index) {
  48221. ngDevMode && assertDefined(directives, 'Directives array should be defined if reading a dir.');
  48222. ngDevMode && assertDataInRange(index, directives);
  48223. return directives[index];
  48224. }
  48225. function loadQueryList(queryListIdx) {
  48226. ngDevMode && assertDefined(viewData[CONTENT_QUERIES], 'Content QueryList array should be defined if reading a query.');
  48227. ngDevMode && assertDataInRange(queryListIdx, viewData[CONTENT_QUERIES]);
  48228. return viewData[CONTENT_QUERIES][queryListIdx];
  48229. }
  48230. /** Retrieves a value from current `viewData`. */
  48231. function load(index) {
  48232. return loadInternal(index, viewData);
  48233. }
  48234. function loadElement(index) {
  48235. return loadElementInternal(index, viewData);
  48236. }
  48237. /** Gets the current binding value and increments the binding index. */
  48238. function consumeBinding() {
  48239. ngDevMode && assertDataInRange(viewData[BINDING_INDEX]);
  48240. ngDevMode &&
  48241. assertNotEqual(viewData[viewData[BINDING_INDEX]], NO_CHANGE, 'Stored value should never be NO_CHANGE.');
  48242. return viewData[viewData[BINDING_INDEX]++];
  48243. }
  48244. /** Updates binding if changed, then returns whether it was updated. */
  48245. function bindingUpdated(value) {
  48246. ngDevMode && assertNotEqual(value, NO_CHANGE, 'Incoming value should never be NO_CHANGE.');
  48247. if (viewData[BINDING_INDEX] === -1)
  48248. initBindings();
  48249. var bindingIndex = viewData[BINDING_INDEX];
  48250. if (bindingIndex >= viewData.length) {
  48251. viewData[viewData[BINDING_INDEX]++] = value;
  48252. }
  48253. else if (isDifferent(viewData[bindingIndex], value)) {
  48254. throwErrorIfNoChangesMode(creationMode, checkNoChangesMode, viewData[bindingIndex], value);
  48255. viewData[viewData[BINDING_INDEX]++] = value;
  48256. }
  48257. else {
  48258. viewData[BINDING_INDEX]++;
  48259. return false;
  48260. }
  48261. return true;
  48262. }
  48263. /** Updates binding if changed, then returns the latest value. */
  48264. function checkAndUpdateBinding$1(value) {
  48265. bindingUpdated(value);
  48266. return value;
  48267. }
  48268. /** Updates 2 bindings if changed, then returns whether either was updated. */
  48269. function bindingUpdated2(exp1, exp2) {
  48270. var different = bindingUpdated(exp1);
  48271. return bindingUpdated(exp2) || different;
  48272. }
  48273. /** Updates 4 bindings if changed, then returns whether any was updated. */
  48274. function bindingUpdated4(exp1, exp2, exp3, exp4) {
  48275. var different = bindingUpdated2(exp1, exp2);
  48276. return bindingUpdated2(exp3, exp4) || different;
  48277. }
  48278. function getTView() {
  48279. return tView;
  48280. }
  48281. /**
  48282. * Registers a QueryList, associated with a content query, for later refresh (part of a view
  48283. * refresh).
  48284. */
  48285. function registerContentQuery(queryList) {
  48286. var savedContentQueriesLength = (viewData[CONTENT_QUERIES] || (viewData[CONTENT_QUERIES] = [])).push(queryList);
  48287. if (firstTemplatePass) {
  48288. var currentDirectiveIndex = directives.length - 1;
  48289. var tViewContentQueries = tView.contentQueries || (tView.contentQueries = []);
  48290. var lastSavedDirectiveIndex = tView.contentQueries.length ? tView.contentQueries[tView.contentQueries.length - 2] : -1;
  48291. if (currentDirectiveIndex !== lastSavedDirectiveIndex) {
  48292. tViewContentQueries.push(currentDirectiveIndex, savedContentQueriesLength - 1);
  48293. }
  48294. }
  48295. }
  48296. function assertPreviousIsParent() {
  48297. assertEqual(isParent, true, 'previousOrParentNode should be a parent');
  48298. }
  48299. function assertHasParent() {
  48300. assertDefined(getParentLNode(previousOrParentNode), 'previousOrParentNode should have a parent');
  48301. }
  48302. function assertDataInRange(index, arr) {
  48303. if (arr == null)
  48304. arr = viewData;
  48305. assertDataInRangeInternal(index, arr || viewData);
  48306. }
  48307. function assertDataNext(index, arr) {
  48308. if (arr == null)
  48309. arr = viewData;
  48310. assertEqual(arr.length, index, "index " + index + " expected to be at the end of arr (length " + arr.length + ")");
  48311. }
  48312. /**
  48313. * On the first template pass, the reserved slots should be set `NO_CHANGE`.
  48314. *
  48315. * If not, they might not have been actually reserved.
  48316. */
  48317. function assertReservedSlotInitialized(slotOffset, numSlots) {
  48318. if (firstTemplatePass) {
  48319. var startIndex = tView.bindingStartIndex - slotOffset;
  48320. for (var i = 0; i < numSlots; i++) {
  48321. assertEqual(viewData[startIndex + i], NO_CHANGE, 'The reserved slots should be set to `NO_CHANGE` on first template pass');
  48322. }
  48323. }
  48324. }
  48325. function _getComponentHostLElementNode(component) {
  48326. ngDevMode && assertDefined(component, 'expecting component got null');
  48327. var lElementNode = component[NG_HOST_SYMBOL];
  48328. ngDevMode && assertDefined(component, 'object is not a component');
  48329. return lElementNode;
  48330. }
  48331. var CLEAN_PROMISE = _CLEAN_PROMISE;
  48332. var ROOT_DIRECTIVE_INDICES = _ROOT_DIRECTIVE_INDICES;
  48333. /**
  48334. * @license
  48335. * Copyright Google Inc. All Rights Reserved.
  48336. *
  48337. * Use of this source code is governed by an MIT-style license that can be
  48338. * found in the LICENSE file at https://angular.io/license
  48339. */
  48340. /**
  48341. * Bootstraps a Component into an existing host element and returns an instance
  48342. * of the component.
  48343. *
  48344. * Use this function to bootstrap a component into the DOM tree. Each invocation
  48345. * of this function will create a separate tree of components, injectors and
  48346. * change detection cycles and lifetimes. To dynamically insert a new component
  48347. * into an existing tree such that it shares the same injection, change detection
  48348. * and object lifetime, use {@link ViewContainer#createComponent}.
  48349. *
  48350. * @param componentType Component to bootstrap
  48351. * @param options Optional parameters which control bootstrapping
  48352. */
  48353. function renderComponent(componentType /* Type as workaround for: Microsoft/TypeScript/issues/4881 */, opts) {
  48354. if (opts === void 0) { opts = {}; }
  48355. ngDevMode && assertComponentType(componentType);
  48356. var rendererFactory = opts.rendererFactory || domRendererFactory3;
  48357. var sanitizer = opts.sanitizer || null;
  48358. var componentDef = componentType.ngComponentDef;
  48359. if (componentDef.type != componentType)
  48360. componentDef.type = componentType;
  48361. var component;
  48362. // The first index of the first selector is the tag name.
  48363. var componentTag = componentDef.selectors[0][0];
  48364. var hostNode = locateHostElement(rendererFactory, opts.host || componentTag);
  48365. var rootContext = createRootContext(opts.scheduler || requestAnimationFrame.bind(window));
  48366. var rootView = createLViewData(rendererFactory.createRenderer(hostNode, componentDef.rendererType), createTView(-1, null, null, null, null), rootContext, componentDef.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */);
  48367. rootView[INJECTOR$1] = opts.injector || null;
  48368. var oldView = enterView(rootView, null);
  48369. var elementNode;
  48370. try {
  48371. if (rendererFactory.begin)
  48372. rendererFactory.begin();
  48373. // Create element node at index 0 in data array
  48374. elementNode = hostElement(componentTag, hostNode, componentDef, sanitizer);
  48375. // Create directive instance with factory() and store at index 0 in directives array
  48376. rootContext.components.push(component = baseDirectiveCreate(0, componentDef.factory(), componentDef));
  48377. initChangeDetectorIfExisting(elementNode.nodeInjector, component, elementNode.data);
  48378. opts.hostFeatures && opts.hostFeatures.forEach(function (feature) { return feature(component, componentDef); });
  48379. executeInitAndContentHooks();
  48380. setHostBindings(ROOT_DIRECTIVE_INDICES);
  48381. detectChangesInternal(elementNode.data, elementNode, component);
  48382. }
  48383. finally {
  48384. leaveView(oldView);
  48385. if (rendererFactory.end)
  48386. rendererFactory.end();
  48387. }
  48388. return component;
  48389. }
  48390. function createRootContext(scheduler) {
  48391. return {
  48392. components: [],
  48393. scheduler: scheduler,
  48394. clean: CLEAN_PROMISE,
  48395. };
  48396. }
  48397. /**
  48398. * Used to enable lifecycle hooks on the root component.
  48399. *
  48400. * Include this feature when calling `renderComponent` if the root component
  48401. * you are rendering has lifecycle hooks defined. Otherwise, the hooks won't
  48402. * be called properly.
  48403. *
  48404. * Example:
  48405. *
  48406. * ```
  48407. * renderComponent(AppComponent, {features: [RootLifecycleHooks]});
  48408. * ```
  48409. */
  48410. function LifecycleHooksFeature(component, def) {
  48411. var elementNode = _getComponentHostLElementNode(component);
  48412. // Root component is always created at dir index 0
  48413. var tView = elementNode.view[TVIEW];
  48414. queueInitHooks(0, def.onInit, def.doCheck, tView);
  48415. queueLifecycleHooks(elementNode.tNode.flags, tView);
  48416. }
  48417. /**
  48418. * Retrieve the root context for any component by walking the parent `LView` until
  48419. * reaching the root `LView`.
  48420. *
  48421. * @param component any component
  48422. */
  48423. function getRootContext(component) {
  48424. var rootContext = getRootView(component)[CONTEXT];
  48425. ngDevMode && assertDefined(rootContext, 'rootContext');
  48426. return rootContext;
  48427. }
  48428. /**
  48429. * Wait on component until it is rendered.
  48430. *
  48431. * This function returns a `Promise` which is resolved when the component's
  48432. * change detection is executed. This is determined by finding the scheduler
  48433. * associated with the `component`'s render tree and waiting until the scheduler
  48434. * flushes. If nothing is scheduled, the function returns a resolved promise.
  48435. *
  48436. * Example:
  48437. * ```
  48438. * await whenRendered(myComponent);
  48439. * ```
  48440. *
  48441. * @param component Component to wait upon
  48442. * @returns Promise which resolves when the component is rendered.
  48443. */
  48444. function whenRendered(component) {
  48445. return getRootContext(component).clean;
  48446. }
  48447. /**
  48448. * @license
  48449. * Copyright Google Inc. All Rights Reserved.
  48450. *
  48451. * Use of this source code is governed by an MIT-style license that can be
  48452. * found in the LICENSE file at https://angular.io/license
  48453. */
  48454. /**
  48455. * Create a component definition object.
  48456. *
  48457. *
  48458. * # Example
  48459. * ```
  48460. * class MyDirective {
  48461. * // Generated by Angular Template Compiler
  48462. * // [Symbol] syntax will not be supported by TypeScript until v2.7
  48463. * static ngComponentDef = defineComponent({
  48464. * ...
  48465. * });
  48466. * }
  48467. * ```
  48468. */
  48469. function defineComponent(componentDefinition) {
  48470. var type = componentDefinition.type;
  48471. var pipeTypes = componentDefinition.pipes;
  48472. var directiveTypes = componentDefinition.directives;
  48473. var declaredInputs = {};
  48474. var def = {
  48475. type: type,
  48476. diPublic: null,
  48477. factory: componentDefinition.factory,
  48478. template: componentDefinition.template || null,
  48479. hostBindings: componentDefinition.hostBindings || null,
  48480. contentQueries: componentDefinition.contentQueries || null,
  48481. contentQueriesRefresh: componentDefinition.contentQueriesRefresh || null,
  48482. attributes: componentDefinition.attributes || null,
  48483. inputs: invertObject(componentDefinition.inputs, declaredInputs),
  48484. declaredInputs: declaredInputs,
  48485. outputs: invertObject(componentDefinition.outputs),
  48486. rendererType: resolveRendererType2(componentDefinition.rendererType) || null,
  48487. exportAs: componentDefinition.exportAs || null,
  48488. onInit: type.prototype.ngOnInit || null,
  48489. doCheck: type.prototype.ngDoCheck || null,
  48490. afterContentInit: type.prototype.ngAfterContentInit || null,
  48491. afterContentChecked: type.prototype.ngAfterContentChecked || null,
  48492. afterViewInit: type.prototype.ngAfterViewInit || null,
  48493. afterViewChecked: type.prototype.ngAfterViewChecked || null,
  48494. onDestroy: type.prototype.ngOnDestroy || null,
  48495. onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
  48496. directiveDefs: directiveTypes ?
  48497. function () { return (typeof directiveTypes === 'function' ? directiveTypes() : directiveTypes)
  48498. .map(extractDirectiveDef); } :
  48499. null,
  48500. pipeDefs: pipeTypes ?
  48501. function () { return (typeof pipeTypes === 'function' ? pipeTypes() : pipeTypes).map(extractPipeDef); } :
  48502. null,
  48503. selectors: componentDefinition.selectors,
  48504. viewQuery: componentDefinition.viewQuery || null,
  48505. features: componentDefinition.features || null,
  48506. };
  48507. var feature = componentDefinition.features;
  48508. feature && feature.forEach(function (fn) { return fn(def); });
  48509. return def;
  48510. }
  48511. function extractDirectiveDef(type) {
  48512. var def = type.ngComponentDef || type.ngDirectiveDef;
  48513. if (ngDevMode && !def) {
  48514. throw new Error("'" + type.name + "' is neither 'ComponentType' or 'DirectiveType'.");
  48515. }
  48516. return def;
  48517. }
  48518. function extractPipeDef(type) {
  48519. var def = type.ngPipeDef;
  48520. if (ngDevMode && !def) {
  48521. throw new Error("'" + type.name + "' is not a 'PipeType'.");
  48522. }
  48523. return def;
  48524. }
  48525. function defineNgModule(def) {
  48526. var res = {
  48527. type: def.type,
  48528. bootstrap: def.bootstrap || [],
  48529. declarations: def.declarations || [],
  48530. imports: def.imports || [],
  48531. exports: def.exports || [],
  48532. transitiveCompileScopes: null,
  48533. };
  48534. return res;
  48535. }
  48536. var EMPTY$1 = {};
  48537. /**
  48538. * Inverts an inputs or outputs lookup such that the keys, which were the
  48539. * minified keys, are part of the values, and the values are parsed so that
  48540. * the publicName of the property is the new key
  48541. *
  48542. * e.g. for
  48543. *
  48544. * ```
  48545. * class Comp {
  48546. * @Input()
  48547. * propName1: string;
  48548. *
  48549. * @Input('publicName')
  48550. * propName2: number;
  48551. * }
  48552. * ```
  48553. *
  48554. * will be serialized as
  48555. *
  48556. * ```
  48557. * {
  48558. * a0: 'propName1',
  48559. * b1: ['publicName', 'propName2'],
  48560. * }
  48561. * ```
  48562. *
  48563. * becomes
  48564. *
  48565. * ```
  48566. * {
  48567. * 'propName1': 'a0',
  48568. * 'publicName': 'b1'
  48569. * }
  48570. * ```
  48571. *
  48572. * Optionally the function can take `secondary` which will result in:
  48573. *
  48574. * ```
  48575. * {
  48576. * 'propName1': 'a0',
  48577. * 'propName2': 'b1'
  48578. * }
  48579. * ```
  48580. *
  48581. */
  48582. function invertObject(obj, secondary) {
  48583. if (obj == null)
  48584. return EMPTY$1;
  48585. var newLookup = {};
  48586. for (var minifiedKey in obj) {
  48587. if (obj.hasOwnProperty(minifiedKey)) {
  48588. var publicName = obj[minifiedKey];
  48589. var declaredName = publicName;
  48590. if (Array.isArray(publicName)) {
  48591. declaredName = publicName[1];
  48592. publicName = publicName[0];
  48593. }
  48594. newLookup[publicName] = minifiedKey;
  48595. if (secondary) {
  48596. (secondary[declaredName] = minifiedKey);
  48597. }
  48598. }
  48599. }
  48600. return newLookup;
  48601. }
  48602. /**
  48603. * Create a directive definition object.
  48604. *
  48605. * # Example
  48606. * ```
  48607. * class MyDirective {
  48608. * // Generated by Angular Template Compiler
  48609. * // [Symbol] syntax will not be supported by TypeScript until v2.7
  48610. * static ngDirectiveDef = defineDirective({
  48611. * ...
  48612. * });
  48613. * }
  48614. * ```
  48615. */
  48616. var defineDirective = defineComponent;
  48617. /**
  48618. * Create a pipe definition object.
  48619. *
  48620. * # Example
  48621. * ```
  48622. * class MyPipe implements PipeTransform {
  48623. * // Generated by Angular Template Compiler
  48624. * static ngPipeDef = definePipe({
  48625. * ...
  48626. * });
  48627. * }
  48628. * ```
  48629. * @param pipeDef Pipe definition generated by the compiler
  48630. */
  48631. function definePipe(pipeDef) {
  48632. return {
  48633. name: pipeDef.name,
  48634. factory: pipeDef.factory,
  48635. pure: pipeDef.pure !== false,
  48636. onDestroy: pipeDef.type.prototype.ngOnDestroy || null
  48637. };
  48638. }
  48639. /**
  48640. * @license
  48641. * Copyright Google Inc. All Rights Reserved.
  48642. *
  48643. * Use of this source code is governed by an MIT-style license that can be
  48644. * found in the LICENSE file at https://angular.io/license
  48645. */
  48646. /**
  48647. * Sets properties on a target object from a source object, but only if
  48648. * the property doesn't already exist on the target object.
  48649. * @param target The target to set properties on
  48650. * @param source The source of the property keys and values to set
  48651. */
  48652. function fillProperties(target, source) {
  48653. for (var key in source) {
  48654. if (source.hasOwnProperty(key) && !target.hasOwnProperty(key)) {
  48655. target[key] = source[key];
  48656. }
  48657. }
  48658. }
  48659. /**
  48660. * Determines if a definition is a {@link ComponentDefInternal} or a {@link DirectiveDefInternal}
  48661. * @param definition The definition to examine
  48662. */
  48663. function isComponentDef(definition) {
  48664. var def = definition;
  48665. return typeof def.template === 'function';
  48666. }
  48667. function getSuperType(type) {
  48668. return Object.getPrototypeOf(type.prototype).constructor;
  48669. }
  48670. /**
  48671. * Merges the definition from a super class to a sub class.
  48672. * @param definition The definition that is a SubClass of another directive of component
  48673. */
  48674. function InheritDefinitionFeature(definition) {
  48675. var superType = getSuperType(definition.type);
  48676. var superDef = undefined;
  48677. var _loop_1 = function () {
  48678. var e_1, _a;
  48679. if (isComponentDef(definition)) {
  48680. superDef = superType.ngComponentDef || superType.ngDirectiveDef;
  48681. }
  48682. else {
  48683. if (superType.ngComponentDef) {
  48684. throw new Error('Directives cannot inherit Components');
  48685. }
  48686. superDef = superType.ngDirectiveDef;
  48687. }
  48688. if (superDef) {
  48689. // Merge inputs and outputs
  48690. fillProperties(definition.inputs, superDef.inputs);
  48691. fillProperties(definition.declaredInputs, superDef.declaredInputs);
  48692. fillProperties(definition.outputs, superDef.outputs);
  48693. // Merge hostBindings
  48694. var prevHostBindings_1 = definition.hostBindings;
  48695. var superHostBindings_1 = superDef.hostBindings;
  48696. if (superHostBindings_1) {
  48697. if (prevHostBindings_1) {
  48698. definition.hostBindings = function (directiveIndex, elementIndex) {
  48699. superHostBindings_1(directiveIndex, elementIndex);
  48700. prevHostBindings_1(directiveIndex, elementIndex);
  48701. };
  48702. }
  48703. else {
  48704. definition.hostBindings = superHostBindings_1;
  48705. }
  48706. }
  48707. // Inherit hooks
  48708. // Assume super class inheritance feature has already run.
  48709. definition.afterContentChecked =
  48710. definition.afterContentChecked || superDef.afterContentChecked;
  48711. definition.afterContentInit = definition.afterContentInit || superDef.afterContentInit;
  48712. definition.afterViewChecked = definition.afterViewChecked || superDef.afterViewChecked;
  48713. definition.afterViewInit = definition.afterViewInit || superDef.afterViewInit;
  48714. definition.doCheck = definition.doCheck || superDef.doCheck;
  48715. definition.onDestroy = definition.onDestroy || superDef.onDestroy;
  48716. definition.onInit = definition.onInit || superDef.onInit;
  48717. // Run parent features
  48718. var features = superDef.features;
  48719. if (features) {
  48720. try {
  48721. for (var features_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(features), features_1_1 = features_1.next(); !features_1_1.done; features_1_1 = features_1.next()) {
  48722. var feature = features_1_1.value;
  48723. if (feature && feature !== InheritDefinitionFeature) {
  48724. feature(definition);
  48725. }
  48726. }
  48727. }
  48728. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  48729. finally {
  48730. try {
  48731. if (features_1_1 && !features_1_1.done && (_a = features_1.return)) _a.call(features_1);
  48732. }
  48733. finally { if (e_1) throw e_1.error; }
  48734. }
  48735. }
  48736. }
  48737. else {
  48738. // Even if we don't have a definition, check the type for the hooks and use those if need be
  48739. var superPrototype = superType.prototype;
  48740. if (superPrototype) {
  48741. definition.afterContentChecked =
  48742. definition.afterContentChecked || superPrototype.afterContentChecked;
  48743. definition.afterContentInit =
  48744. definition.afterContentInit || superPrototype.afterContentInit;
  48745. definition.afterViewChecked =
  48746. definition.afterViewChecked || superPrototype.afterViewChecked;
  48747. definition.afterViewInit = definition.afterViewInit || superPrototype.afterViewInit;
  48748. definition.doCheck = definition.doCheck || superPrototype.doCheck;
  48749. definition.onDestroy = definition.onDestroy || superPrototype.onDestroy;
  48750. definition.onInit = definition.onInit || superPrototype.onInit;
  48751. }
  48752. }
  48753. superType = Object.getPrototypeOf(superType);
  48754. };
  48755. while (superType && !superDef) {
  48756. _loop_1();
  48757. }
  48758. }
  48759. /**
  48760. * @license
  48761. * Copyright Google Inc. All Rights Reserved.
  48762. *
  48763. * Use of this source code is governed by an MIT-style license that can be
  48764. * found in the LICENSE file at https://angular.io/license
  48765. */
  48766. var PRIVATE_PREFIX = '__ngOnChanges_';
  48767. /**
  48768. * The NgOnChangesFeature decorates a component with support for the ngOnChanges
  48769. * lifecycle hook, so it should be included in any component that implements
  48770. * that hook.
  48771. *
  48772. * If the component or directive uses inheritance, the NgOnChangesFeature MUST
  48773. * be included as a feature AFTER {@link InheritDefinitionFeature}, otherwise
  48774. * inherited properties will not be propagated to the ngOnChanges lifecycle
  48775. * hook.
  48776. *
  48777. * Example usage:
  48778. *
  48779. * ```
  48780. * static ngComponentDef = defineComponent({
  48781. * ...
  48782. * inputs: {name: 'publicName'},
  48783. * features: [NgOnChangesFeature]
  48784. * });
  48785. * ```
  48786. */
  48787. function NgOnChangesFeature(definition) {
  48788. var declaredToMinifiedInputs = definition.declaredInputs;
  48789. var proto = definition.type.prototype;
  48790. var _loop_1 = function (declaredName) {
  48791. if (declaredToMinifiedInputs.hasOwnProperty(declaredName)) {
  48792. var minifiedKey = declaredToMinifiedInputs[declaredName];
  48793. var privateMinKey_1 = PRIVATE_PREFIX + minifiedKey;
  48794. // Walk the prototype chain to see if we find a property descriptor
  48795. // That way we can honor setters and getters that were inherited.
  48796. var originalProperty = undefined;
  48797. var checkProto = proto;
  48798. while (!originalProperty && checkProto &&
  48799. Object.getPrototypeOf(checkProto) !== Object.getPrototypeOf(Object.prototype)) {
  48800. originalProperty = Object.getOwnPropertyDescriptor(checkProto, minifiedKey);
  48801. checkProto = Object.getPrototypeOf(checkProto);
  48802. }
  48803. var getter = originalProperty && originalProperty.get;
  48804. var setter_1 = originalProperty && originalProperty.set;
  48805. // create a getter and setter for property
  48806. Object.defineProperty(proto, minifiedKey, {
  48807. get: getter ||
  48808. (setter_1 ? undefined : function () { return this[privateMinKey_1]; }),
  48809. set: function (value) {
  48810. var simpleChanges = this[PRIVATE_PREFIX];
  48811. if (!simpleChanges) {
  48812. simpleChanges = {};
  48813. // Place where we will store SimpleChanges if there is a change
  48814. Object.defineProperty(this, PRIVATE_PREFIX, { value: simpleChanges, writable: true });
  48815. }
  48816. var isFirstChange = !this.hasOwnProperty(privateMinKey_1);
  48817. var currentChange = simpleChanges[declaredName];
  48818. if (currentChange) {
  48819. currentChange.currentValue = value;
  48820. }
  48821. else {
  48822. simpleChanges[declaredName] =
  48823. new SimpleChange(this[privateMinKey_1], value, isFirstChange);
  48824. }
  48825. if (isFirstChange) {
  48826. // Create a place where the actual value will be stored and make it non-enumerable
  48827. Object.defineProperty(this, privateMinKey_1, { value: value, writable: true });
  48828. }
  48829. else {
  48830. this[privateMinKey_1] = value;
  48831. }
  48832. if (setter_1)
  48833. setter_1.call(this, value);
  48834. }
  48835. });
  48836. }
  48837. };
  48838. for (var declaredName in declaredToMinifiedInputs) {
  48839. _loop_1(declaredName);
  48840. }
  48841. // If an onInit hook is defined, it will need to wrap the ngOnChanges call
  48842. // so the call order is changes-init-check in creation mode. In subsequent
  48843. // change detection runs, only the check wrapper will be called.
  48844. if (definition.onInit != null) {
  48845. definition.onInit = onChangesWrapper(definition.onInit);
  48846. }
  48847. definition.doCheck = onChangesWrapper(definition.doCheck);
  48848. }
  48849. function onChangesWrapper(delegateHook) {
  48850. return function () {
  48851. var simpleChanges = this[PRIVATE_PREFIX];
  48852. if (simpleChanges != null) {
  48853. this.ngOnChanges(simpleChanges);
  48854. this[PRIVATE_PREFIX] = null;
  48855. }
  48856. if (delegateHook)
  48857. delegateHook.apply(this);
  48858. };
  48859. }
  48860. /**
  48861. * @license
  48862. * Copyright Google Inc. All Rights Reserved.
  48863. *
  48864. * Use of this source code is governed by an MIT-style license that can be
  48865. * found in the LICENSE file at https://angular.io/license
  48866. */
  48867. var ViewRef$1 = /** @class */ (function () {
  48868. function ViewRef(_view, context) {
  48869. this._view = _view;
  48870. this._appRef = null;
  48871. this._viewContainerRef = null;
  48872. /**
  48873. * @internal
  48874. */
  48875. this._lViewNode = null;
  48876. this.context = context;
  48877. }
  48878. /** @internal */
  48879. ViewRef.prototype._setComponentContext = function (view, context) {
  48880. this._view = view;
  48881. this.context = context;
  48882. };
  48883. Object.defineProperty(ViewRef.prototype, "destroyed", {
  48884. get: function () {
  48885. return (this._view[FLAGS] & 32 /* Destroyed */) === 32 /* Destroyed */;
  48886. },
  48887. enumerable: true,
  48888. configurable: true
  48889. });
  48890. ViewRef.prototype.destroy = function () {
  48891. if (this._viewContainerRef && viewAttached(this._view)) {
  48892. this._viewContainerRef.detach(this._viewContainerRef.indexOf(this));
  48893. this._viewContainerRef = null;
  48894. }
  48895. destroyLView(this._view);
  48896. };
  48897. ViewRef.prototype.onDestroy = function (callback) { storeCleanupFn(this._view, callback); };
  48898. /**
  48899. * Marks a view and all of its ancestors dirty.
  48900. *
  48901. * It also triggers change detection by calling `scheduleTick` internally, which coalesces
  48902. * multiple `markForCheck` calls to into one change detection run.
  48903. *
  48904. * This can be used to ensure an {@link ChangeDetectionStrategy#OnPush OnPush} component is
  48905. * checked when it needs to be re-rendered but the two normal triggers haven't marked it
  48906. * dirty (i.e. inputs haven't changed and events haven't fired in the view).
  48907. *
  48908. * <!-- TODO: Add a link to a chapter on OnPush components -->
  48909. *
  48910. * @usageNotes
  48911. * ### Example
  48912. *
  48913. * ```typescript
  48914. * @Component({
  48915. * selector: 'my-app',
  48916. * template: `Number of ticks: {{numberOfTicks}}`
  48917. * changeDetection: ChangeDetectionStrategy.OnPush,
  48918. * })
  48919. * class AppComponent {
  48920. * numberOfTicks = 0;
  48921. *
  48922. * constructor(private ref: ChangeDetectorRef) {
  48923. * setInterval(() => {
  48924. * this.numberOfTicks++;
  48925. * // the following is required, otherwise the view will not be updated
  48926. * this.ref.markForCheck();
  48927. * }, 1000);
  48928. * }
  48929. * }
  48930. * ```
  48931. */
  48932. ViewRef.prototype.markForCheck = function () { markViewDirty(this._view); };
  48933. /**
  48934. * Detaches the view from the change detection tree.
  48935. *
  48936. * Detached views will not be checked during change detection runs until they are
  48937. * re-attached, even if they are dirty. `detach` can be used in combination with
  48938. * {@link ChangeDetectorRef#detectChanges detectChanges} to implement local change
  48939. * detection checks.
  48940. *
  48941. * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
  48942. * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
  48943. *
  48944. * @usageNotes
  48945. * ### Example
  48946. *
  48947. * The following example defines a component with a large list of readonly data.
  48948. * Imagine the data changes constantly, many times per second. For performance reasons,
  48949. * we want to check and update the list every five seconds. We can do that by detaching
  48950. * the component's change detector and doing a local check every five seconds.
  48951. *
  48952. * ```typescript
  48953. * class DataProvider {
  48954. * // in a real application the returned data will be different every time
  48955. * get data() {
  48956. * return [1,2,3,4,5];
  48957. * }
  48958. * }
  48959. *
  48960. * @Component({
  48961. * selector: 'giant-list',
  48962. * template: `
  48963. * <li *ngFor="let d of dataProvider.data">Data {{d}}</li>
  48964. * `,
  48965. * })
  48966. * class GiantList {
  48967. * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {
  48968. * ref.detach();
  48969. * setInterval(() => {
  48970. * this.ref.detectChanges();
  48971. * }, 5000);
  48972. * }
  48973. * }
  48974. *
  48975. * @Component({
  48976. * selector: 'app',
  48977. * providers: [DataProvider],
  48978. * template: `
  48979. * <giant-list><giant-list>
  48980. * `,
  48981. * })
  48982. * class App {
  48983. * }
  48984. * ```
  48985. */
  48986. ViewRef.prototype.detach = function () { this._view[FLAGS] &= ~8 /* Attached */; };
  48987. /**
  48988. * Re-attaches a view to the change detection tree.
  48989. *
  48990. * This can be used to re-attach views that were previously detached from the tree
  48991. * using {@link ChangeDetectorRef#detach detach}. Views are attached to the tree by default.
  48992. *
  48993. * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
  48994. *
  48995. * @usageNotes
  48996. * ### Example
  48997. *
  48998. * The following example creates a component displaying `live` data. The component will detach
  48999. * its change detector from the main change detector tree when the component's live property
  49000. * is set to false.
  49001. *
  49002. * ```typescript
  49003. * class DataProvider {
  49004. * data = 1;
  49005. *
  49006. * constructor() {
  49007. * setInterval(() => {
  49008. * this.data = this.data * 2;
  49009. * }, 500);
  49010. * }
  49011. * }
  49012. *
  49013. * @Component({
  49014. * selector: 'live-data',
  49015. * inputs: ['live'],
  49016. * template: 'Data: {{dataProvider.data}}'
  49017. * })
  49018. * class LiveData {
  49019. * constructor(private ref: ChangeDetectorRef, private dataProvider: DataProvider) {}
  49020. *
  49021. * set live(value) {
  49022. * if (value) {
  49023. * this.ref.reattach();
  49024. * } else {
  49025. * this.ref.detach();
  49026. * }
  49027. * }
  49028. * }
  49029. *
  49030. * @Component({
  49031. * selector: 'my-app',
  49032. * providers: [DataProvider],
  49033. * template: `
  49034. * Live Update: <input type="checkbox" [(ngModel)]="live">
  49035. * <live-data [live]="live"><live-data>
  49036. * `,
  49037. * })
  49038. * class AppComponent {
  49039. * live = true;
  49040. * }
  49041. * ```
  49042. */
  49043. ViewRef.prototype.reattach = function () { this._view[FLAGS] |= 8 /* Attached */; };
  49044. /**
  49045. * Checks the view and its children.
  49046. *
  49047. * This can also be used in combination with {@link ChangeDetectorRef#detach detach} to implement
  49048. * local change detection checks.
  49049. *
  49050. * <!-- TODO: Add a link to a chapter on detach/reattach/local digest -->
  49051. * <!-- TODO: Add a live demo once ref.detectChanges is merged into master -->
  49052. *
  49053. * @usageNotes
  49054. * ### Example
  49055. *
  49056. * The following example defines a component with a large list of readonly data.
  49057. * Imagine, the data changes constantly, many times per second. For performance reasons,
  49058. * we want to check and update the list every five seconds.
  49059. *
  49060. * We can do that by detaching the component's change detector and doing a local change detection
  49061. * check every five seconds.
  49062. *
  49063. * See {@link ChangeDetectorRef#detach detach} for more information.
  49064. */
  49065. ViewRef.prototype.detectChanges = function () { detectChanges(this.context); };
  49066. /**
  49067. * Checks the change detector and its children, and throws if any changes are detected.
  49068. *
  49069. * This is used in development mode to verify that running change detection doesn't
  49070. * introduce other changes.
  49071. */
  49072. ViewRef.prototype.checkNoChanges = function () { checkNoChanges(this.context); };
  49073. ViewRef.prototype.attachToViewContainerRef = function (vcRef) { this._viewContainerRef = vcRef; };
  49074. ViewRef.prototype.detachFromAppRef = function () { this._appRef = null; };
  49075. ViewRef.prototype.attachToAppRef = function (appRef) { this._appRef = appRef; };
  49076. return ViewRef;
  49077. }());
  49078. /**
  49079. * @license
  49080. * Copyright Google Inc. All Rights Reserved.
  49081. *
  49082. * Use of this source code is governed by an MIT-style license that can be
  49083. * found in the LICENSE file at https://angular.io/license
  49084. */
  49085. var ComponentFactoryResolver$1 = /** @class */ (function (_super) {
  49086. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentFactoryResolver$$1, _super);
  49087. function ComponentFactoryResolver$$1() {
  49088. return _super !== null && _super.apply(this, arguments) || this;
  49089. }
  49090. ComponentFactoryResolver$$1.prototype.resolveComponentFactory = function (component) {
  49091. ngDevMode && assertComponentType(component);
  49092. var componentDef = component.ngComponentDef;
  49093. return new ComponentFactory$1(componentDef);
  49094. };
  49095. return ComponentFactoryResolver$$1;
  49096. }(ComponentFactoryResolver));
  49097. function toRefArray(map) {
  49098. var array = [];
  49099. for (var nonMinified in map) {
  49100. if (map.hasOwnProperty(nonMinified)) {
  49101. var minified = map[nonMinified];
  49102. array.push({ propName: minified, templateName: nonMinified });
  49103. }
  49104. }
  49105. return array;
  49106. }
  49107. /**
  49108. * Default {@link RootContext} for all components rendered with {@link renderComponent}.
  49109. */
  49110. var ROOT_CONTEXT = new InjectionToken('ROOT_CONTEXT_TOKEN', { providedIn: 'root', factory: function () { return createRootContext(inject(SCHEDULER)); } });
  49111. /**
  49112. * A change detection scheduler token for {@link RootContext}. This token is the default value used
  49113. * for the default `RootContext` found in the {@link ROOT_CONTEXT} token.
  49114. */
  49115. var SCHEDULER = new InjectionToken('SCHEDULER_TOKEN', { providedIn: 'root', factory: function () { return requestAnimationFrame.bind(window); } });
  49116. /**
  49117. * Render3 implementation of {@link viewEngine_ComponentFactory}.
  49118. */
  49119. var ComponentFactory$1 = /** @class */ (function (_super) {
  49120. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentFactory$$1, _super);
  49121. function ComponentFactory$$1(componentDef) {
  49122. var _this = _super.call(this) || this;
  49123. _this.componentDef = componentDef;
  49124. _this.componentType = componentDef.type;
  49125. _this.selector = componentDef.selectors[0][0];
  49126. _this.ngContentSelectors = [];
  49127. return _this;
  49128. }
  49129. Object.defineProperty(ComponentFactory$$1.prototype, "inputs", {
  49130. get: function () {
  49131. return toRefArray(this.componentDef.inputs);
  49132. },
  49133. enumerable: true,
  49134. configurable: true
  49135. });
  49136. Object.defineProperty(ComponentFactory$$1.prototype, "outputs", {
  49137. get: function () {
  49138. return toRefArray(this.componentDef.outputs);
  49139. },
  49140. enumerable: true,
  49141. configurable: true
  49142. });
  49143. ComponentFactory$$1.prototype.create = function (injector, projectableNodes, rootSelectorOrNode, ngModule) {
  49144. var isInternalRootView = rootSelectorOrNode === undefined;
  49145. var rendererFactory = ngModule ? ngModule.injector.get(RendererFactory2) : domRendererFactory3;
  49146. var hostNode = isInternalRootView ?
  49147. elementCreate(this.selector, rendererFactory.createRenderer(null, this.componentDef.rendererType)) :
  49148. locateHostElement(rendererFactory, rootSelectorOrNode);
  49149. // The first index of the first selector is the tag name.
  49150. var componentTag = this.componentDef.selectors[0][0];
  49151. var rootContext = ngModule && !isInternalRootView ?
  49152. ngModule.injector.get(ROOT_CONTEXT) :
  49153. createRootContext(requestAnimationFrame.bind(window));
  49154. // Create the root view. Uses empty TView and ContentTemplate.
  49155. var rootView = createLViewData(rendererFactory.createRenderer(hostNode, this.componentDef.rendererType), createTView(-1, null, null, null, null), rootContext, this.componentDef.onPush ? 4 /* Dirty */ : 2 /* CheckAlways */);
  49156. rootView[INJECTOR$1] = ngModule && ngModule.injector || null;
  49157. // rootView is the parent when bootstrapping
  49158. var oldView = enterView(rootView, null);
  49159. var component;
  49160. var elementNode;
  49161. try {
  49162. if (rendererFactory.begin)
  49163. rendererFactory.begin();
  49164. // Create element node at index 0 in data array
  49165. elementNode = hostElement(componentTag, hostNode, this.componentDef);
  49166. // Create directive instance with factory() and store at index 0 in directives array
  49167. rootContext.components.push(component = baseDirectiveCreate(0, this.componentDef.factory(), this.componentDef));
  49168. initChangeDetectorIfExisting(elementNode.nodeInjector, component, elementNode.data);
  49169. // TODO: should LifecycleHooksFeature and other host features be generated by the compiler and
  49170. // executed here?
  49171. // Angular 5 reference: https://stackblitz.com/edit/lifecycle-hooks-vcref
  49172. LifecycleHooksFeature(component, this.componentDef);
  49173. // Transform the arrays of native nodes into a LNode structure that can be consumed by the
  49174. // projection instruction. This is needed to support the reprojection of these nodes.
  49175. if (projectableNodes) {
  49176. var index = 0;
  49177. var projection$$1 = elementNode.tNode.projection = [];
  49178. for (var i = 0; i < projectableNodes.length; i++) {
  49179. var nodeList = projectableNodes[i];
  49180. var firstTNode = null;
  49181. var previousTNode = null;
  49182. for (var j = 0; j < nodeList.length; j++) {
  49183. var lNode = createLNode(++index, 3 /* Element */, nodeList[j], null, null);
  49184. if (previousTNode) {
  49185. previousTNode.next = lNode.tNode;
  49186. }
  49187. else {
  49188. firstTNode = lNode.tNode;
  49189. }
  49190. previousTNode = lNode.tNode;
  49191. }
  49192. projection$$1.push(firstTNode);
  49193. }
  49194. }
  49195. // Execute the template in creation mode only, and then turn off the CreationMode flag
  49196. renderEmbeddedTemplate(elementNode, elementNode.data[TVIEW], component, 1 /* Create */);
  49197. elementNode.data[FLAGS] &= ~1 /* CreationMode */;
  49198. }
  49199. finally {
  49200. enterView(oldView, null);
  49201. if (rendererFactory.end)
  49202. rendererFactory.end();
  49203. }
  49204. var componentRef = new ComponentRef$1(this.componentType, component, rootView, injector, hostNode);
  49205. if (isInternalRootView) {
  49206. // The host element of the internal root view is attached to the component's host view node
  49207. componentRef.hostView._lViewNode.tNode.child = elementNode.tNode;
  49208. }
  49209. return componentRef;
  49210. };
  49211. return ComponentFactory$$1;
  49212. }(ComponentFactory));
  49213. /**
  49214. * Represents an instance of a Component created via a {@link ComponentFactory}.
  49215. *
  49216. * `ComponentRef` provides access to the Component Instance as well other objects related to this
  49217. * Component Instance and allows you to destroy the Component Instance via the {@link #destroy}
  49218. * method.
  49219. *
  49220. */
  49221. var ComponentRef$1 = /** @class */ (function (_super) {
  49222. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ComponentRef$$1, _super);
  49223. function ComponentRef$$1(componentType, instance, rootView, injector, hostNode) {
  49224. var _this = _super.call(this) || this;
  49225. _this.destroyCbs = [];
  49226. _this.instance = instance;
  49227. /* TODO(jasonaden): This is incomplete, to be adjusted in follow-up PR. Notes from Kara:When
  49228. * ViewRef.detectChanges is called from ApplicationRef.tick, it will call detectChanges at the
  49229. * component instance level. I suspect this means that lifecycle hooks and host bindings on the
  49230. * given component won't work (as these are always called at the level above a component).
  49231. *
  49232. * In render2, ViewRef.detectChanges uses the root view instance for view checks, not the
  49233. * component instance. So passing in the root view (1 level above the component) is sufficient.
  49234. * We might want to think about creating a fake component for the top level? Or overwrite
  49235. * detectChanges with a function that calls tickRootContext? */
  49236. _this.hostView = _this.changeDetectorRef = new ViewRef$1(rootView, instance);
  49237. _this.hostView._lViewNode = createLNode(-1, 2 /* View */, null, null, null, rootView);
  49238. _this.injector = injector;
  49239. _this.location = new ElementRef(hostNode);
  49240. _this.componentType = componentType;
  49241. return _this;
  49242. }
  49243. ComponentRef$$1.prototype.destroy = function () {
  49244. ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
  49245. this.destroyCbs.forEach(function (fn) { return fn(); });
  49246. this.destroyCbs = null;
  49247. };
  49248. ComponentRef$$1.prototype.onDestroy = function (callback) {
  49249. ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
  49250. this.destroyCbs.push(callback);
  49251. };
  49252. return ComponentRef$$1;
  49253. }(ComponentRef));
  49254. /**
  49255. * @license
  49256. * Copyright Google Inc. All Rights Reserved.
  49257. *
  49258. * Use of this source code is governed by an MIT-style license that can be
  49259. * found in the LICENSE file at https://angular.io/license
  49260. */
  49261. /**
  49262. * If a directive is diPublic, bloomAdd sets a property on the instance with this constant as
  49263. * the key and the directive's unique ID as the value. This allows us to map directives to their
  49264. * bloom filter bit for DI.
  49265. */
  49266. var NG_ELEMENT_ID = '__NG_ELEMENT_ID__';
  49267. /**
  49268. * The number of slots in each bloom filter (used by DI). The larger this number, the fewer
  49269. * directives that will share slots, and thus, the fewer false positives when checking for
  49270. * the existence of a directive.
  49271. */
  49272. var BLOOM_SIZE = 256;
  49273. /** Counter used to generate unique IDs for directives. */
  49274. var nextNgElementId = 0;
  49275. /**
  49276. * Registers this directive as present in its node's injector by flipping the directive's
  49277. * corresponding bit in the injector's bloom filter.
  49278. *
  49279. * @param injector The node injector in which the directive should be registered
  49280. * @param type The directive to register
  49281. */
  49282. function bloomAdd(injector, type) {
  49283. var id = type[NG_ELEMENT_ID];
  49284. // Set a unique ID on the directive type, so if something tries to inject the directive,
  49285. // we can easily retrieve the ID and hash it into the bloom bit that should be checked.
  49286. if (id == null) {
  49287. id = type[NG_ELEMENT_ID] = nextNgElementId++;
  49288. }
  49289. // We only have BLOOM_SIZE (256) slots in our bloom filter (8 buckets * 32 bits each),
  49290. // so all unique IDs must be modulo-ed into a number from 0 - 255 to fit into the filter.
  49291. // This means that after 255, some directives will share slots, leading to some false positives
  49292. // when checking for a directive's presence.
  49293. var bloomBit = id % BLOOM_SIZE;
  49294. // Create a mask that targets the specific bit associated with the directive.
  49295. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
  49296. // to bit positions 0 - 31 in a 32 bit integer.
  49297. var mask = 1 << bloomBit;
  49298. // Use the raw bloomBit number to determine which bloom filter bucket we should check
  49299. // e.g: bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc
  49300. if (bloomBit < 128) {
  49301. // Then use the mask to flip on the bit (0-31) associated with the directive in that bucket
  49302. bloomBit < 64 ? (bloomBit < 32 ? (injector.bf0 |= mask) : (injector.bf1 |= mask)) :
  49303. (bloomBit < 96 ? (injector.bf2 |= mask) : (injector.bf3 |= mask));
  49304. }
  49305. else {
  49306. bloomBit < 192 ? (bloomBit < 160 ? (injector.bf4 |= mask) : (injector.bf5 |= mask)) :
  49307. (bloomBit < 224 ? (injector.bf6 |= mask) : (injector.bf7 |= mask));
  49308. }
  49309. }
  49310. function getOrCreateNodeInjector() {
  49311. ngDevMode && assertPreviousIsParent();
  49312. return getOrCreateNodeInjectorForNode(getPreviousOrParentNode());
  49313. }
  49314. /**
  49315. * Creates (or gets an existing) injector for a given element or container.
  49316. *
  49317. * @param node for which an injector should be retrieved / created.
  49318. * @returns Node injector
  49319. */
  49320. function getOrCreateNodeInjectorForNode(node) {
  49321. var nodeInjector = node.nodeInjector;
  49322. var parent = getParentLNode(node);
  49323. var parentInjector = parent && parent.nodeInjector;
  49324. if (nodeInjector != parentInjector) {
  49325. return nodeInjector;
  49326. }
  49327. return node.nodeInjector = {
  49328. parent: parentInjector,
  49329. node: node,
  49330. bf0: 0,
  49331. bf1: 0,
  49332. bf2: 0,
  49333. bf3: 0,
  49334. bf4: 0,
  49335. bf5: 0,
  49336. bf6: 0,
  49337. bf7: 0,
  49338. cbf0: parentInjector == null ? 0 : parentInjector.cbf0 | parentInjector.bf0,
  49339. cbf1: parentInjector == null ? 0 : parentInjector.cbf1 | parentInjector.bf1,
  49340. cbf2: parentInjector == null ? 0 : parentInjector.cbf2 | parentInjector.bf2,
  49341. cbf3: parentInjector == null ? 0 : parentInjector.cbf3 | parentInjector.bf3,
  49342. cbf4: parentInjector == null ? 0 : parentInjector.cbf4 | parentInjector.bf4,
  49343. cbf5: parentInjector == null ? 0 : parentInjector.cbf5 | parentInjector.bf5,
  49344. cbf6: parentInjector == null ? 0 : parentInjector.cbf6 | parentInjector.bf6,
  49345. cbf7: parentInjector == null ? 0 : parentInjector.cbf7 | parentInjector.bf7,
  49346. templateRef: null,
  49347. viewContainerRef: null,
  49348. elementRef: null,
  49349. changeDetectorRef: null,
  49350. };
  49351. }
  49352. /**
  49353. * Makes a directive public to the DI system by adding it to an injector's bloom filter.
  49354. *
  49355. * @param di The node injector in which a directive will be added
  49356. * @param def The definition of the directive to be made public
  49357. */
  49358. function diPublicInInjector(di, def) {
  49359. bloomAdd(di, def.type);
  49360. }
  49361. /**
  49362. * Makes a directive public to the DI system by adding it to an injector's bloom filter.
  49363. *
  49364. * @param def The definition of the directive to be made public
  49365. */
  49366. function diPublic(def) {
  49367. diPublicInInjector(getOrCreateNodeInjector(), def);
  49368. }
  49369. function directiveInject(token, flags) {
  49370. if (flags === void 0) { flags = 0 /* Default */; }
  49371. return getOrCreateInjectable(getOrCreateNodeInjector(), token, flags);
  49372. }
  49373. /**
  49374. * Creates an ElementRef and stores it on the injector.
  49375. * Or, if the ElementRef already exists, retrieves the existing ElementRef.
  49376. *
  49377. * @returns The ElementRef instance to use
  49378. */
  49379. function injectElementRef() {
  49380. return getOrCreateElementRef(getOrCreateNodeInjector());
  49381. }
  49382. /**
  49383. * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already
  49384. * exists, retrieves the existing TemplateRef.
  49385. *
  49386. * @returns The TemplateRef instance to use
  49387. */
  49388. function injectTemplateRef() {
  49389. return getOrCreateTemplateRef(getOrCreateNodeInjector());
  49390. }
  49391. /**
  49392. * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef
  49393. * already exists, retrieves the existing ViewContainerRef.
  49394. *
  49395. * @returns The ViewContainerRef instance to use
  49396. */
  49397. function injectViewContainerRef() {
  49398. return getOrCreateContainerRef(getOrCreateNodeInjector());
  49399. }
  49400. /** Returns a ChangeDetectorRef (a.k.a. a ViewRef) */
  49401. function injectChangeDetectorRef() {
  49402. return getOrCreateChangeDetectorRef(getOrCreateNodeInjector(), null);
  49403. }
  49404. var componentFactoryResolver = new ComponentFactoryResolver$1();
  49405. /**
  49406. * Inject static attribute value into directive constructor.
  49407. *
  49408. * This method is used with `factory` functions which are generated as part of
  49409. * `defineDirective` or `defineComponent`. The method retrieves the static value
  49410. * of an attribute. (Dynamic attributes are not supported since they are not resolved
  49411. * at the time of injection and can change over time.)
  49412. *
  49413. * # Example
  49414. * Given:
  49415. * ```
  49416. * @Component(...)
  49417. * class MyComponent {
  49418. * constructor(@Attribute('title') title: string) { ... }
  49419. * }
  49420. * ```
  49421. * When instantiated with
  49422. * ```
  49423. * <my-component title="Hello"></my-component>
  49424. * ```
  49425. *
  49426. * Then factory method generated is:
  49427. * ```
  49428. * MyComponent.ngComponentDef = defineComponent({
  49429. * factory: () => new MyComponent(injectAttribute('title'))
  49430. * ...
  49431. * })
  49432. * ```
  49433. *
  49434. * @experimental
  49435. */
  49436. function injectAttribute(attrNameToInject) {
  49437. ngDevMode && assertPreviousIsParent();
  49438. var lElement = getPreviousOrParentNode();
  49439. ngDevMode && assertNodeType(lElement, 3 /* Element */);
  49440. var tElement = lElement.tNode;
  49441. ngDevMode && assertDefined(tElement, 'expecting tNode');
  49442. var attrs = tElement.attrs;
  49443. if (attrs) {
  49444. for (var i = 0; i < attrs.length; i = i + 2) {
  49445. var attrName = attrs[i];
  49446. if (attrName === 1 /* SelectOnly */)
  49447. break;
  49448. if (attrName == attrNameToInject) {
  49449. return attrs[i + 1];
  49450. }
  49451. }
  49452. }
  49453. return undefined;
  49454. }
  49455. /**
  49456. * Creates a ViewRef and stores it on the injector as ChangeDetectorRef (public alias).
  49457. * Or, if it already exists, retrieves the existing instance.
  49458. *
  49459. * @returns The ChangeDetectorRef to use
  49460. */
  49461. function getOrCreateChangeDetectorRef(di, context) {
  49462. if (di.changeDetectorRef)
  49463. return di.changeDetectorRef;
  49464. var currentNode = di.node;
  49465. if (isComponent(currentNode.tNode)) {
  49466. return di.changeDetectorRef = new ViewRef$1(currentNode.data, context);
  49467. }
  49468. else if (currentNode.tNode.type === 3 /* Element */) {
  49469. return di.changeDetectorRef = getOrCreateHostChangeDetector(currentNode.view[HOST_NODE]);
  49470. }
  49471. return null;
  49472. }
  49473. /** Gets or creates ChangeDetectorRef for the closest host component */
  49474. function getOrCreateHostChangeDetector(currentNode) {
  49475. var hostNode = getClosestComponentAncestor(currentNode);
  49476. var hostInjector = hostNode.nodeInjector;
  49477. var existingRef = hostInjector && hostInjector.changeDetectorRef;
  49478. return existingRef ?
  49479. existingRef :
  49480. new ViewRef$1(hostNode.data, hostNode
  49481. .view[DIRECTIVES][hostNode.tNode.flags >> 14 /* DirectiveStartingIndexShift */]);
  49482. }
  49483. /**
  49484. * If the node is an embedded view, traverses up the view tree to return the closest
  49485. * ancestor view that is attached to a component. If it's already a component node,
  49486. * returns itself.
  49487. */
  49488. function getClosestComponentAncestor(node) {
  49489. while (node.tNode.type === 2 /* View */) {
  49490. node = node.view[HOST_NODE];
  49491. }
  49492. return node;
  49493. }
  49494. /**
  49495. * Searches for an instance of the given directive type up the injector tree and returns
  49496. * that instance if found.
  49497. *
  49498. * Specifically, it gets the bloom filter bit associated with the directive (see bloomHashBit),
  49499. * checks that bit against the bloom filter structure to identify an injector that might have
  49500. * the directive (see bloomFindPossibleInjector), then searches the directives on that injector
  49501. * for a match.
  49502. *
  49503. * If not found, it will propagate up to the next parent injector until the token
  49504. * is found or the top is reached.
  49505. *
  49506. * @param di Node injector where the search should start
  49507. * @param token The directive type to search for
  49508. * @param flags Injection flags (e.g. CheckParent)
  49509. * @returns The instance found
  49510. */
  49511. function getOrCreateInjectable(di, token, flags) {
  49512. if (flags === void 0) { flags = 0 /* Default */; }
  49513. var bloomHash = bloomHashBit(token);
  49514. // If the token has a bloom hash, then it is a directive that is public to the injection system
  49515. // (diPublic). If there is no hash, fall back to the module injector.
  49516. if (bloomHash === null) {
  49517. var moduleInjector = getPreviousOrParentNode().view[INJECTOR$1];
  49518. var formerInjector = setCurrentInjector(moduleInjector);
  49519. try {
  49520. return inject(token, flags);
  49521. }
  49522. finally {
  49523. setCurrentInjector(formerInjector);
  49524. }
  49525. }
  49526. else {
  49527. var injector = di;
  49528. while (injector) {
  49529. // Get the closest potential matching injector (upwards in the injector tree) that
  49530. // *potentially* has the token.
  49531. injector = bloomFindPossibleInjector(injector, bloomHash, flags);
  49532. // If no injector is found, we *know* that there is no ancestor injector that contains the
  49533. // token, so we abort.
  49534. if (!injector) {
  49535. break;
  49536. }
  49537. // At this point, we have an injector which *may* contain the token, so we step through the
  49538. // directives associated with the injector's corresponding node to get the directive instance.
  49539. var node = injector.node;
  49540. var nodeFlags = node.tNode.flags;
  49541. var count = nodeFlags & 4095 /* DirectiveCountMask */;
  49542. if (count !== 0) {
  49543. var start = nodeFlags >> 14 /* DirectiveStartingIndexShift */;
  49544. var end = start + count;
  49545. var defs = node.view[TVIEW].directives;
  49546. for (var i = start; i < end; i++) {
  49547. // Get the definition for the directive at this index and, if it is injectable (diPublic),
  49548. // and matches the given token, return the directive instance.
  49549. var directiveDef = defs[i];
  49550. if (directiveDef.type === token && directiveDef.diPublic) {
  49551. return node.view[DIRECTIVES][i];
  49552. }
  49553. }
  49554. }
  49555. // If we *didn't* find the directive for the token and we are searching the current node's
  49556. // injector, it's possible the directive is on this node and hasn't been created yet.
  49557. var instance = void 0;
  49558. if (injector === di && (instance = searchMatchesQueuedForCreation(node, token))) {
  49559. return instance;
  49560. }
  49561. // The def wasn't found anywhere on this node, so it was a false positive.
  49562. // If flags permit, traverse up the tree and continue searching.
  49563. if (flags & 2 /* Self */ || flags & 1 /* Host */ && !sameHostView(injector)) {
  49564. injector = null;
  49565. }
  49566. else {
  49567. injector = injector.parent;
  49568. }
  49569. }
  49570. }
  49571. // No directive was found for the given token.
  49572. if (flags & 8 /* Optional */)
  49573. return null;
  49574. throw new Error("Injector: NOT_FOUND [" + stringify$1(token) + "]");
  49575. }
  49576. function searchMatchesQueuedForCreation(node, token) {
  49577. var matches = node.view[TVIEW].currentMatches;
  49578. if (matches) {
  49579. for (var i = 0; i < matches.length; i += 2) {
  49580. var def = matches[i];
  49581. if (def.type === token) {
  49582. return resolveDirective(def, i + 1, matches, node.view[TVIEW]);
  49583. }
  49584. }
  49585. }
  49586. return null;
  49587. }
  49588. /**
  49589. * Given a directive type, this function returns the bit in an injector's bloom filter
  49590. * that should be used to determine whether or not the directive is present.
  49591. *
  49592. * When the directive was added to the bloom filter, it was given a unique ID that can be
  49593. * retrieved on the class. Since there are only BLOOM_SIZE slots per bloom filter, the directive's
  49594. * ID must be modulo-ed by BLOOM_SIZE to get the correct bloom bit (directives share slots after
  49595. * BLOOM_SIZE is reached).
  49596. *
  49597. * @param type The directive type
  49598. * @returns The bloom bit to check for the directive
  49599. */
  49600. function bloomHashBit(type) {
  49601. var id = type[NG_ELEMENT_ID];
  49602. return typeof id === 'number' ? id % BLOOM_SIZE : null;
  49603. }
  49604. /**
  49605. * Finds the closest injector that might have a certain directive.
  49606. *
  49607. * Each directive corresponds to a bit in an injector's bloom filter. Given the bloom bit to
  49608. * check and a starting injector, this function traverses up injectors until it finds an
  49609. * injector that contains a 1 for that bit in its bloom filter. A 1 indicates that the
  49610. * injector may have that directive. It only *may* have the directive because directives begin
  49611. * to share bloom filter bits after the BLOOM_SIZE is reached, and it could correspond to a
  49612. * different directive sharing the bit.
  49613. *
  49614. * Note: We can skip checking further injectors up the tree if an injector's cbf structure
  49615. * has a 0 for that bloom bit. Since cbf contains the merged value of all the parent
  49616. * injectors, a 0 in the bloom bit indicates that the parents definitely do not contain
  49617. * the directive and do not need to be checked.
  49618. *
  49619. * @param injector The starting node injector to check
  49620. * @param bloomBit The bit to check in each injector's bloom filter
  49621. * @param flags The injection flags for this injection site (e.g. Optional or SkipSelf)
  49622. * @returns An injector that might have the directive
  49623. */
  49624. function bloomFindPossibleInjector(startInjector, bloomBit, flags) {
  49625. // Create a mask that targets the specific bit associated with the directive we're looking for.
  49626. // JS bit operations are 32 bits, so this will be a number between 2^0 and 2^31, corresponding
  49627. // to bit positions 0 - 31 in a 32 bit integer.
  49628. var mask = 1 << bloomBit;
  49629. // Traverse up the injector tree until we find a potential match or until we know there *isn't* a
  49630. // match.
  49631. var injector = flags & 4 /* SkipSelf */ ? startInjector.parent : startInjector;
  49632. while (injector) {
  49633. // Our bloom filter size is 256 bits, which is eight 32-bit bloom filter buckets:
  49634. // bf0 = [0 - 31], bf1 = [32 - 63], bf2 = [64 - 95], bf3 = [96 - 127], etc.
  49635. // Get the bloom filter value from the appropriate bucket based on the directive's bloomBit.
  49636. var value = void 0;
  49637. if (bloomBit < 128) {
  49638. value = bloomBit < 64 ? (bloomBit < 32 ? injector.bf0 : injector.bf1) :
  49639. (bloomBit < 96 ? injector.bf2 : injector.bf3);
  49640. }
  49641. else {
  49642. value = bloomBit < 192 ? (bloomBit < 160 ? injector.bf4 : injector.bf5) :
  49643. (bloomBit < 224 ? injector.bf6 : injector.bf7);
  49644. }
  49645. // If the bloom filter value has the bit corresponding to the directive's bloomBit flipped on,
  49646. // this injector is a potential match.
  49647. if ((value & mask) === mask) {
  49648. return injector;
  49649. }
  49650. else if (flags & 2 /* Self */ || flags & 1 /* Host */ && !sameHostView(injector)) {
  49651. return null;
  49652. }
  49653. // If the current injector does not have the directive, check the bloom filters for the ancestor
  49654. // injectors (cbf0 - cbf7). These filters capture *all* ancestor injectors.
  49655. if (bloomBit < 128) {
  49656. value = bloomBit < 64 ? (bloomBit < 32 ? injector.cbf0 : injector.cbf1) :
  49657. (bloomBit < 96 ? injector.cbf2 : injector.cbf3);
  49658. }
  49659. else {
  49660. value = bloomBit < 192 ? (bloomBit < 160 ? injector.cbf4 : injector.cbf5) :
  49661. (bloomBit < 224 ? injector.cbf6 : injector.cbf7);
  49662. }
  49663. // If the ancestor bloom filter value has the bit corresponding to the directive, traverse up to
  49664. // find the specific injector. If the ancestor bloom filter does not have the bit, we can abort.
  49665. injector = (value & mask) ? injector.parent : null;
  49666. }
  49667. return null;
  49668. }
  49669. /**
  49670. * Checks whether the current injector and its parent are in the same host view.
  49671. *
  49672. * This is necessary to support @Host() decorators. If @Host() is set, we should stop searching once
  49673. * the injector and its parent view don't match because it means we'd cross the view boundary.
  49674. */
  49675. function sameHostView(injector) {
  49676. return !!injector.parent && injector.parent.node.view === injector.node.view;
  49677. }
  49678. var ReadFromInjectorFn = /** @class */ (function () {
  49679. function ReadFromInjectorFn(read) {
  49680. this.read = read;
  49681. }
  49682. return ReadFromInjectorFn;
  49683. }());
  49684. /**
  49685. * Creates an ElementRef for a given node injector and stores it on the injector.
  49686. * Or, if the ElementRef already exists, retrieves the existing ElementRef.
  49687. *
  49688. * @param di The node injector where we should store a created ElementRef
  49689. * @returns The ElementRef instance to use
  49690. */
  49691. function getOrCreateElementRef(di) {
  49692. return di.elementRef || (di.elementRef = new ElementRef$1(di.node.native));
  49693. }
  49694. /** A ref to a node's native element. */
  49695. var ElementRef$1 = /** @class */ (function () {
  49696. function ElementRef(nativeElement) {
  49697. this.nativeElement = nativeElement;
  49698. }
  49699. return ElementRef;
  49700. }());
  49701. /**
  49702. * Creates a ViewContainerRef and stores it on the injector. Or, if the ViewContainerRef
  49703. * already exists, retrieves the existing ViewContainerRef.
  49704. *
  49705. * @returns The ViewContainerRef instance to use
  49706. */
  49707. function getOrCreateContainerRef(di) {
  49708. if (!di.viewContainerRef) {
  49709. var vcRefHost = di.node;
  49710. ngDevMode && assertNodeOfPossibleTypes(vcRefHost, 0 /* Container */, 3 /* Element */);
  49711. var hostParent = getParentLNode(vcRefHost);
  49712. var lContainer = createLContainer(hostParent, vcRefHost.view, true);
  49713. var comment = vcRefHost.view[RENDERER].createComment(ngDevMode ? 'container' : '');
  49714. var lContainerNode = createLNodeObject(0 /* Container */, vcRefHost.view, hostParent, comment, lContainer, null);
  49715. appendChild(hostParent, comment, vcRefHost.view);
  49716. if (vcRefHost.queries) {
  49717. lContainerNode.queries = vcRefHost.queries.container();
  49718. }
  49719. var hostTNode = vcRefHost.tNode;
  49720. if (!hostTNode.dynamicContainerNode) {
  49721. hostTNode.dynamicContainerNode =
  49722. createTNode(0 /* Container */, -1, null, null, hostTNode, null);
  49723. }
  49724. lContainerNode.tNode = hostTNode.dynamicContainerNode;
  49725. vcRefHost.dynamicLContainerNode = lContainerNode;
  49726. addToViewTree(vcRefHost.view, hostTNode.index, lContainer);
  49727. di.viewContainerRef = new ViewContainerRef$1(lContainerNode);
  49728. }
  49729. return di.viewContainerRef;
  49730. }
  49731. /**
  49732. * A ref to a container that enables adding and removing views from that container
  49733. * imperatively.
  49734. */
  49735. var ViewContainerRef$1 = /** @class */ (function () {
  49736. function ViewContainerRef(_lContainerNode) {
  49737. this._lContainerNode = _lContainerNode;
  49738. this._viewRefs = [];
  49739. }
  49740. ViewContainerRef.prototype.clear = function () {
  49741. var lContainer = this._lContainerNode.data;
  49742. while (lContainer[VIEWS].length) {
  49743. this.remove(0);
  49744. }
  49745. };
  49746. ViewContainerRef.prototype.get = function (index) { return this._viewRefs[index] || null; };
  49747. Object.defineProperty(ViewContainerRef.prototype, "length", {
  49748. get: function () {
  49749. var lContainer = this._lContainerNode.data;
  49750. return lContainer[VIEWS].length;
  49751. },
  49752. enumerable: true,
  49753. configurable: true
  49754. });
  49755. ViewContainerRef.prototype.createEmbeddedView = function (templateRef, context, index) {
  49756. var adjustedIdx = this._adjustIndex(index);
  49757. var viewRef = templateRef
  49758. .createEmbeddedView(context || {}, this._lContainerNode, adjustedIdx);
  49759. viewRef.attachToViewContainerRef(this);
  49760. this._viewRefs.splice(adjustedIdx, 0, viewRef);
  49761. return viewRef;
  49762. };
  49763. ViewContainerRef.prototype.createComponent = function (componentFactory, index, injector, projectableNodes, ngModuleRef) {
  49764. var contextInjector = injector || this.parentInjector;
  49765. if (!ngModuleRef && contextInjector) {
  49766. ngModuleRef = contextInjector.get(NgModuleRef);
  49767. }
  49768. var componentRef = componentFactory.create(contextInjector, projectableNodes, undefined, ngModuleRef);
  49769. this.insert(componentRef.hostView, index);
  49770. return componentRef;
  49771. };
  49772. ViewContainerRef.prototype.insert = function (viewRef, index) {
  49773. if (viewRef.destroyed) {
  49774. throw new Error('Cannot insert a destroyed View in a ViewContainer!');
  49775. }
  49776. var lViewNode = viewRef._lViewNode;
  49777. var adjustedIdx = this._adjustIndex(index);
  49778. insertView(this._lContainerNode, lViewNode, adjustedIdx);
  49779. var views = this._lContainerNode.data[VIEWS];
  49780. var beforeNode = adjustedIdx + 1 < views.length ?
  49781. (getChildLNode(views[adjustedIdx + 1])).native :
  49782. this._lContainerNode.native;
  49783. addRemoveViewFromContainer(this._lContainerNode, lViewNode, true, beforeNode);
  49784. viewRef.attachToViewContainerRef(this);
  49785. this._viewRefs.splice(adjustedIdx, 0, viewRef);
  49786. return viewRef;
  49787. };
  49788. ViewContainerRef.prototype.move = function (viewRef, newIndex) {
  49789. var index = this.indexOf(viewRef);
  49790. this.detach(index);
  49791. this.insert(viewRef, this._adjustIndex(newIndex));
  49792. return viewRef;
  49793. };
  49794. ViewContainerRef.prototype.indexOf = function (viewRef) { return this._viewRefs.indexOf(viewRef); };
  49795. ViewContainerRef.prototype.remove = function (index) {
  49796. var adjustedIdx = this._adjustIndex(index, -1);
  49797. removeView(this._lContainerNode, adjustedIdx);
  49798. this._viewRefs.splice(adjustedIdx, 1);
  49799. };
  49800. ViewContainerRef.prototype.detach = function (index) {
  49801. var adjustedIdx = this._adjustIndex(index, -1);
  49802. var lViewNode = detachView(this._lContainerNode, adjustedIdx);
  49803. return this._viewRefs.splice(adjustedIdx, 1)[0] || null;
  49804. };
  49805. ViewContainerRef.prototype._adjustIndex = function (index, shift) {
  49806. if (shift === void 0) { shift = 0; }
  49807. if (index == null) {
  49808. return this._lContainerNode.data[VIEWS].length + shift;
  49809. }
  49810. if (ngDevMode) {
  49811. assertGreaterThan(index, -1, 'index must be positive');
  49812. // +1 because it's legal to insert at the end.
  49813. assertLessThan(index, this._lContainerNode.data[VIEWS].length + 1 + shift, 'index');
  49814. }
  49815. return index;
  49816. };
  49817. return ViewContainerRef;
  49818. }());
  49819. /**
  49820. * Creates a TemplateRef and stores it on the injector. Or, if the TemplateRef already
  49821. * exists, retrieves the existing TemplateRef.
  49822. *
  49823. * @param di The node injector where we should store a created TemplateRef
  49824. * @returns The TemplateRef instance to use
  49825. */
  49826. function getOrCreateTemplateRef(di) {
  49827. if (!di.templateRef) {
  49828. ngDevMode && assertNodeType(di.node, 0 /* Container */);
  49829. var hostNode = di.node;
  49830. var hostTNode = hostNode.tNode;
  49831. ngDevMode && assertDefined(hostTNode.tViews, 'TView must be allocated');
  49832. di.templateRef = new TemplateRef$1(getOrCreateElementRef(di), hostTNode.tViews, getRenderer(), hostNode.data[QUERIES]);
  49833. }
  49834. return di.templateRef;
  49835. }
  49836. var TemplateRef$1 = /** @class */ (function () {
  49837. function TemplateRef(elementRef, _tView, _renderer, _queries) {
  49838. this._tView = _tView;
  49839. this._renderer = _renderer;
  49840. this._queries = _queries;
  49841. this.elementRef = elementRef;
  49842. }
  49843. TemplateRef.prototype.createEmbeddedView = function (context, containerNode, index) {
  49844. var viewNode = createEmbeddedViewNode(this._tView, context, this._renderer, this._queries);
  49845. if (containerNode) {
  49846. insertView(containerNode, viewNode, index);
  49847. }
  49848. renderEmbeddedTemplate(viewNode, this._tView, context, 1 /* Create */);
  49849. var viewRef = new ViewRef$1(viewNode.data, context);
  49850. viewRef._lViewNode = viewNode;
  49851. return viewRef;
  49852. };
  49853. return TemplateRef;
  49854. }());
  49855. /**
  49856. * @license
  49857. * Copyright Google Inc. All Rights Reserved.
  49858. *
  49859. * Use of this source code is governed by an MIT-style license that can be
  49860. * found in the LICENSE file at https://angular.io/license
  49861. */
  49862. /**
  49863. * This feature publishes the directive (or component) into the DI system, making it visible to
  49864. * others for injection.
  49865. *
  49866. * @param definition
  49867. */
  49868. function PublicFeature(definition) {
  49869. definition.diPublic = diPublic;
  49870. }
  49871. /**
  49872. * @license
  49873. * Copyright Google Inc. All Rights Reserved.
  49874. *
  49875. * Use of this source code is governed by an MIT-style license that can be
  49876. * found in the LICENSE file at https://angular.io/license
  49877. */
  49878. var i18nTagRegex = /{\$([^}]+)}/g;
  49879. /**
  49880. * Takes a translation string, the initial list of placeholders (elements and expressions) and the
  49881. * indexes of their corresponding expression nodes to return a list of instructions for each
  49882. * template function.
  49883. *
  49884. * Because embedded templates have different indexes for each placeholder, each parameter (except
  49885. * the translation) is an array, where each value corresponds to a different template, by order of
  49886. * appearance.
  49887. *
  49888. * @param translation A translation string where placeholders are represented by `{$name}`
  49889. * @param elements An array containing, for each template, the maps of element placeholders and
  49890. * their indexes.
  49891. * @param expressions An array containing, for each template, the maps of expression placeholders
  49892. * and their indexes.
  49893. * @param templateRoots An array of template roots whose content should be ignored when
  49894. * generating the instructions for their parent template.
  49895. * @param lastChildIndex The index of the last child of the i18n node. Used when the i18n block is
  49896. * an ng-container.
  49897. *
  49898. * @returns A list of instructions used to translate each template.
  49899. */
  49900. function i18nMapping(translation, elements, expressions, templateRoots, lastChildIndex) {
  49901. var translationParts = translation.split(i18nTagRegex);
  49902. var nbTemplates = templateRoots ? templateRoots.length + 1 : 1;
  49903. var instructions = (new Array(nbTemplates)).fill(undefined);
  49904. generateMappingInstructions(0, 0, translationParts, instructions, elements, expressions, templateRoots, lastChildIndex);
  49905. return instructions;
  49906. }
  49907. /**
  49908. * Internal function that reads the translation parts and generates a set of instructions for each
  49909. * template.
  49910. *
  49911. * See `i18nMapping()` for more details.
  49912. *
  49913. * @param tmplIndex The order of appearance of the template.
  49914. * 0 for the root template, following indexes match the order in `templateRoots`.
  49915. * @param partIndex The current index in `translationParts`.
  49916. * @param translationParts The translation string split into an array of placeholders and text
  49917. * elements.
  49918. * @param instructions The current list of instructions to update.
  49919. * @param elements An array containing, for each template, the maps of element placeholders and
  49920. * their indexes.
  49921. * @param expressions An array containing, for each template, the maps of expression placeholders
  49922. * and their indexes.
  49923. * @param templateRoots An array of template roots whose content should be ignored when
  49924. * generating the instructions for their parent template.
  49925. * @param lastChildIndex The index of the last child of the i18n node. Used when the i18n block is
  49926. * an ng-container.
  49927. *
  49928. * @returns the current index in `translationParts`
  49929. */
  49930. function generateMappingInstructions(tmplIndex, partIndex, translationParts, instructions, elements, expressions, templateRoots, lastChildIndex) {
  49931. var tmplInstructions = [];
  49932. var phVisited = [];
  49933. var openedTagCount = 0;
  49934. var maxIndex = 0;
  49935. var currentElements = elements && elements[tmplIndex] ? elements[tmplIndex] : null;
  49936. var currentExpressions = expressions && expressions[tmplIndex] ? expressions[tmplIndex] : null;
  49937. instructions[tmplIndex] = tmplInstructions;
  49938. for (; partIndex < translationParts.length; partIndex++) {
  49939. // The value can either be text or the name of a placeholder (element/template root/expression)
  49940. var value = translationParts[partIndex];
  49941. // Odd indexes are placeholders
  49942. if (partIndex & 1) {
  49943. var phIndex = void 0;
  49944. if (currentElements && currentElements[value] !== undefined) {
  49945. phIndex = currentElements[value];
  49946. // The placeholder represents a DOM element, add an instruction to move it
  49947. var templateRootIndex = templateRoots ? templateRoots.indexOf(value) : -1;
  49948. if (templateRootIndex !== -1 && (templateRootIndex + 1) !== tmplIndex) {
  49949. // This is a template root, it has no closing tag, not treating it as an element
  49950. tmplInstructions.push(phIndex | -2147483648 /* TemplateRoot */);
  49951. }
  49952. else {
  49953. tmplInstructions.push(phIndex | 1073741824 /* Element */);
  49954. openedTagCount++;
  49955. }
  49956. phVisited.push(value);
  49957. }
  49958. else if (currentExpressions && currentExpressions[value] !== undefined) {
  49959. phIndex = currentExpressions[value];
  49960. // The placeholder represents an expression, add an instruction to move it
  49961. tmplInstructions.push(phIndex | 1610612736 /* Expression */);
  49962. phVisited.push(value);
  49963. }
  49964. else {
  49965. // It is a closing tag
  49966. tmplInstructions.push(-1073741824 /* CloseNode */);
  49967. if (tmplIndex > 0) {
  49968. openedTagCount--;
  49969. // If we have reached the closing tag for this template, exit the loop
  49970. if (openedTagCount === 0) {
  49971. break;
  49972. }
  49973. }
  49974. }
  49975. if (phIndex !== undefined && phIndex > maxIndex) {
  49976. maxIndex = phIndex;
  49977. }
  49978. if (templateRoots) {
  49979. var newTmplIndex = templateRoots.indexOf(value) + 1;
  49980. if (newTmplIndex !== 0 && newTmplIndex !== tmplIndex) {
  49981. partIndex = generateMappingInstructions(newTmplIndex, partIndex, translationParts, instructions, elements, expressions, templateRoots, lastChildIndex);
  49982. }
  49983. }
  49984. }
  49985. else if (value) {
  49986. // It's a non-empty string, create a text node
  49987. tmplInstructions.push(536870912 /* Text */, value);
  49988. }
  49989. }
  49990. // Add instructions to remove elements that are not used in the translation
  49991. if (elements) {
  49992. var tmplElements = elements[tmplIndex];
  49993. if (tmplElements) {
  49994. var phKeys = Object.keys(tmplElements);
  49995. for (var i = 0; i < phKeys.length; i++) {
  49996. var ph = phKeys[i];
  49997. if (phVisited.indexOf(ph) === -1) {
  49998. var index = tmplElements[ph];
  49999. // Add an instruction to remove the element
  50000. tmplInstructions.push(index | -536870912 /* RemoveNode */);
  50001. if (index > maxIndex) {
  50002. maxIndex = index;
  50003. }
  50004. }
  50005. }
  50006. }
  50007. }
  50008. // Add instructions to remove expressions that are not used in the translation
  50009. if (expressions) {
  50010. var tmplExpressions = expressions[tmplIndex];
  50011. if (tmplExpressions) {
  50012. var phKeys = Object.keys(tmplExpressions);
  50013. for (var i = 0; i < phKeys.length; i++) {
  50014. var ph = phKeys[i];
  50015. if (phVisited.indexOf(ph) === -1) {
  50016. var index = tmplExpressions[ph];
  50017. if (ngDevMode) {
  50018. assertLessThan(index.toString(2).length, 28, "Index " + index + " is too big and will overflow");
  50019. }
  50020. // Add an instruction to remove the expression
  50021. tmplInstructions.push(index | -536870912 /* RemoveNode */);
  50022. if (index > maxIndex) {
  50023. maxIndex = index;
  50024. }
  50025. }
  50026. }
  50027. }
  50028. }
  50029. if (tmplIndex === 0 && typeof lastChildIndex === 'number') {
  50030. // The current parent is an ng-container and it has more children after the translation that we
  50031. // need to append to keep the order of the DOM nodes correct
  50032. for (var i = maxIndex + 1; i <= lastChildIndex; i++) {
  50033. if (ngDevMode) {
  50034. assertLessThan(i.toString(2).length, 28, "Index " + i + " is too big and will overflow");
  50035. }
  50036. tmplInstructions.push(i | -1610612736 /* Any */);
  50037. }
  50038. }
  50039. return partIndex;
  50040. }
  50041. function appendI18nNode(node, parentNode, previousNode) {
  50042. if (ngDevMode) {
  50043. ngDevMode.rendererMoveNode++;
  50044. }
  50045. var viewData = getViewData();
  50046. appendChild(parentNode, node.native || null, viewData);
  50047. // On first pass, re-organize node tree to put this node in the correct position.
  50048. var firstTemplatePass = node.view[TVIEW].firstTemplatePass;
  50049. if (firstTemplatePass) {
  50050. if (previousNode === parentNode && node.tNode !== parentNode.tNode.child) {
  50051. node.tNode.next = parentNode.tNode.child;
  50052. parentNode.tNode.child = node.tNode;
  50053. }
  50054. else if (previousNode !== parentNode && node.tNode !== previousNode.tNode.next) {
  50055. node.tNode.next = previousNode.tNode.next;
  50056. previousNode.tNode.next = node.tNode;
  50057. }
  50058. else {
  50059. node.tNode.next = null;
  50060. }
  50061. if (parentNode.view === node.view)
  50062. node.tNode.parent = parentNode.tNode;
  50063. }
  50064. // Template containers also have a comment node for the `ViewContainerRef` that should be moved
  50065. if (node.tNode.type === 0 /* Container */ && node.dynamicLContainerNode) {
  50066. appendChild(parentNode, node.dynamicLContainerNode.native || null, viewData);
  50067. if (firstTemplatePass) {
  50068. node.tNode.dynamicContainerNode = node.dynamicLContainerNode.tNode;
  50069. node.dynamicLContainerNode.tNode.parent = node.tNode;
  50070. }
  50071. return node.dynamicLContainerNode;
  50072. }
  50073. return node;
  50074. }
  50075. /**
  50076. * Takes a list of instructions generated by `i18nMapping()` to transform the template accordingly.
  50077. *
  50078. * @param startIndex Index of the first element to translate (for instance the first child of the
  50079. * element with the i18n attribute).
  50080. * @param instructions The list of instructions to apply on the current view.
  50081. */
  50082. function i18nApply(startIndex, instructions) {
  50083. var viewData = getViewData();
  50084. if (ngDevMode) {
  50085. assertEqual(viewData[BINDING_INDEX], -1, 'i18nApply should be called before any binding');
  50086. }
  50087. if (!instructions) {
  50088. return;
  50089. }
  50090. var renderer = getRenderer();
  50091. var localParentNode = getParentLNode(load(startIndex)) || getPreviousOrParentNode();
  50092. var localPreviousNode = localParentNode;
  50093. resetApplicationState(); // We don't want to add to the tree with the wrong previous node
  50094. for (var i = 0; i < instructions.length; i++) {
  50095. var instruction = instructions[i];
  50096. switch (instruction & -536870912 /* InstructionMask */) {
  50097. case 1073741824 /* Element */:
  50098. var element$$1 = load(instruction & 536870911 /* IndexMask */);
  50099. localPreviousNode = appendI18nNode(element$$1, localParentNode, localPreviousNode);
  50100. localParentNode = element$$1;
  50101. break;
  50102. case 1610612736 /* Expression */:
  50103. case -2147483648 /* TemplateRoot */:
  50104. case -1610612736 /* Any */:
  50105. var node = load(instruction & 536870911 /* IndexMask */);
  50106. localPreviousNode = appendI18nNode(node, localParentNode, localPreviousNode);
  50107. break;
  50108. case 536870912 /* Text */:
  50109. if (ngDevMode) {
  50110. ngDevMode.rendererCreateTextNode++;
  50111. }
  50112. var value = instructions[++i];
  50113. var textRNode = createTextNode(value, renderer);
  50114. // If we were to only create a `RNode` then projections won't move the text.
  50115. // Create text node at the current end of viewData. Must subtract header offset because
  50116. // createLNode takes a raw index (not adjusted by header offset).
  50117. var textLNode = createLNode(viewData.length - HEADER_OFFSET, 3 /* Element */, textRNode, null, null);
  50118. localPreviousNode = appendI18nNode(textLNode, localParentNode, localPreviousNode);
  50119. resetApplicationState();
  50120. break;
  50121. case -1073741824 /* CloseNode */:
  50122. localPreviousNode = localParentNode;
  50123. localParentNode = getParentLNode(localParentNode);
  50124. break;
  50125. case -536870912 /* RemoveNode */:
  50126. if (ngDevMode) {
  50127. ngDevMode.rendererRemoveNode++;
  50128. }
  50129. var index = instruction & 536870911 /* IndexMask */;
  50130. var removedNode = load(index);
  50131. var parentNode = getParentLNode(removedNode);
  50132. removeChild(parentNode, removedNode.native || null, viewData);
  50133. // For template containers we also need to remove their `ViewContainerRef` from the DOM
  50134. if (removedNode.tNode.type === 0 /* Container */ && removedNode.dynamicLContainerNode) {
  50135. removeChild(parentNode, removedNode.dynamicLContainerNode.native || null, viewData);
  50136. removedNode.dynamicLContainerNode.tNode.detached = true;
  50137. removedNode.dynamicLContainerNode.data[RENDER_PARENT] = null;
  50138. }
  50139. break;
  50140. }
  50141. }
  50142. }
  50143. /**
  50144. * Takes a translation string and the initial list of expressions and returns a list of instructions
  50145. * that will be used to translate an attribute.
  50146. * Even indexes contain static strings, while odd indexes contain the index of the expression whose
  50147. * value will be concatenated into the final translation.
  50148. */
  50149. function i18nExpMapping(translation, placeholders) {
  50150. var staticText = translation.split(i18nTagRegex);
  50151. // odd indexes are placeholders
  50152. for (var i = 1; i < staticText.length; i += 2) {
  50153. staticText[i] = placeholders[staticText[i]];
  50154. }
  50155. return staticText;
  50156. }
  50157. /**
  50158. * Checks if the value of an expression has changed and replaces it by its value in a translation,
  50159. * or returns NO_CHANGE.
  50160. *
  50161. * @param instructions A list of instructions that will be used to translate an attribute.
  50162. * @param v0 value checked for change.
  50163. *
  50164. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50165. */
  50166. function i18nInterpolation1(instructions, v0) {
  50167. var different = bindingUpdated(v0);
  50168. if (!different) {
  50169. return NO_CHANGE;
  50170. }
  50171. var res = '';
  50172. for (var i = 0; i < instructions.length; i++) {
  50173. // Odd indexes are bindings
  50174. if (i & 1) {
  50175. res += stringify$1(v0);
  50176. }
  50177. else {
  50178. res += instructions[i];
  50179. }
  50180. }
  50181. return res;
  50182. }
  50183. /**
  50184. * Checks if the values of up to 2 expressions have changed and replaces them by their values in a
  50185. * translation, or returns NO_CHANGE.
  50186. *
  50187. * @param instructions A list of instructions that will be used to translate an attribute.
  50188. * @param v0 value checked for change.
  50189. * @param v1 value checked for change.
  50190. *
  50191. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50192. */
  50193. function i18nInterpolation2(instructions, v0, v1) {
  50194. var different = bindingUpdated2(v0, v1);
  50195. if (!different) {
  50196. return NO_CHANGE;
  50197. }
  50198. var res = '';
  50199. for (var i = 0; i < instructions.length; i++) {
  50200. // Odd indexes are bindings
  50201. if (i & 1) {
  50202. // Extract bits
  50203. var idx = instructions[i];
  50204. var b1 = idx & 1;
  50205. // Get the value from the argument vx where x = idx
  50206. var value = b1 ? v1 : v0;
  50207. res += stringify$1(value);
  50208. }
  50209. else {
  50210. res += instructions[i];
  50211. }
  50212. }
  50213. return res;
  50214. }
  50215. /**
  50216. * Checks if the values of up to 3 expressions have changed and replaces them by their values in a
  50217. * translation, or returns NO_CHANGE.
  50218. *
  50219. * @param instructions A list of instructions that will be used to translate an attribute.
  50220. * @param v0 value checked for change.
  50221. * @param v1 value checked for change.
  50222. * @param v2 value checked for change.
  50223. *
  50224. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50225. */
  50226. function i18nInterpolation3(instructions, v0, v1, v2) {
  50227. var different = bindingUpdated2(v0, v1);
  50228. different = bindingUpdated(v2) || different;
  50229. if (!different) {
  50230. return NO_CHANGE;
  50231. }
  50232. var res = '';
  50233. for (var i = 0; i < instructions.length; i++) {
  50234. // Odd indexes are bindings
  50235. if (i & 1) {
  50236. // Extract bits
  50237. var idx = instructions[i];
  50238. var b2 = idx & 2;
  50239. var b1 = idx & 1;
  50240. // Get the value from the argument vx where x = idx
  50241. var value = b2 ? v2 : (b1 ? v1 : v0);
  50242. res += stringify$1(value);
  50243. }
  50244. else {
  50245. res += instructions[i];
  50246. }
  50247. }
  50248. return res;
  50249. }
  50250. /**
  50251. * Checks if the values of up to 4 expressions have changed and replaces them by their values in a
  50252. * translation, or returns NO_CHANGE.
  50253. *
  50254. * @param instructions A list of instructions that will be used to translate an attribute.
  50255. * @param v0 value checked for change.
  50256. * @param v1 value checked for change.
  50257. * @param v2 value checked for change.
  50258. * @param v3 value checked for change.
  50259. *
  50260. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50261. */
  50262. function i18nInterpolation4(instructions, v0, v1, v2, v3) {
  50263. var different = bindingUpdated4(v0, v1, v2, v3);
  50264. if (!different) {
  50265. return NO_CHANGE;
  50266. }
  50267. var res = '';
  50268. for (var i = 0; i < instructions.length; i++) {
  50269. // Odd indexes are bindings
  50270. if (i & 1) {
  50271. // Extract bits
  50272. var idx = instructions[i];
  50273. var b2 = idx & 2;
  50274. var b1 = idx & 1;
  50275. // Get the value from the argument vx where x = idx
  50276. var value = b2 ? (b1 ? v3 : v2) : (b1 ? v1 : v0);
  50277. res += stringify$1(value);
  50278. }
  50279. else {
  50280. res += instructions[i];
  50281. }
  50282. }
  50283. return res;
  50284. }
  50285. /**
  50286. * Checks if the values of up to 5 expressions have changed and replaces them by their values in a
  50287. * translation, or returns NO_CHANGE.
  50288. *
  50289. * @param instructions A list of instructions that will be used to translate an attribute.
  50290. * @param v0 value checked for change.
  50291. * @param v1 value checked for change.
  50292. * @param v2 value checked for change.
  50293. * @param v3 value checked for change.
  50294. * @param v4 value checked for change.
  50295. *
  50296. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50297. */
  50298. function i18nInterpolation5(instructions, v0, v1, v2, v3, v4) {
  50299. var different = bindingUpdated4(v0, v1, v2, v3);
  50300. different = bindingUpdated(v4) || different;
  50301. if (!different) {
  50302. return NO_CHANGE;
  50303. }
  50304. var res = '';
  50305. for (var i = 0; i < instructions.length; i++) {
  50306. // Odd indexes are bindings
  50307. if (i & 1) {
  50308. // Extract bits
  50309. var idx = instructions[i];
  50310. var b4 = idx & 4;
  50311. var b2 = idx & 2;
  50312. var b1 = idx & 1;
  50313. // Get the value from the argument vx where x = idx
  50314. var value = b4 ? v4 : (b2 ? (b1 ? v3 : v2) : (b1 ? v1 : v0));
  50315. res += stringify$1(value);
  50316. }
  50317. else {
  50318. res += instructions[i];
  50319. }
  50320. }
  50321. return res;
  50322. }
  50323. /**
  50324. * Checks if the values of up to 6 expressions have changed and replaces them by their values in a
  50325. * translation, or returns NO_CHANGE.
  50326. *
  50327. * @param instructions A list of instructions that will be used to translate an attribute.
  50328. * @param v0 value checked for change.
  50329. * @param v1 value checked for change.
  50330. * @param v2 value checked for change.
  50331. * @param v3 value checked for change.
  50332. * @param v4 value checked for change.
  50333. * @param v5 value checked for change.
  50334. *
  50335. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50336. */ function i18nInterpolation6(instructions, v0, v1, v2, v3, v4, v5) {
  50337. var different = bindingUpdated4(v0, v1, v2, v3);
  50338. different = bindingUpdated2(v4, v5) || different;
  50339. if (!different) {
  50340. return NO_CHANGE;
  50341. }
  50342. var res = '';
  50343. for (var i = 0; i < instructions.length; i++) {
  50344. // Odd indexes are bindings
  50345. if (i & 1) {
  50346. // Extract bits
  50347. var idx = instructions[i];
  50348. var b4 = idx & 4;
  50349. var b2 = idx & 2;
  50350. var b1 = idx & 1;
  50351. // Get the value from the argument vx where x = idx
  50352. var value = b4 ? (b1 ? v5 : v4) : (b2 ? (b1 ? v3 : v2) : (b1 ? v1 : v0));
  50353. res += stringify$1(value);
  50354. }
  50355. else {
  50356. res += instructions[i];
  50357. }
  50358. }
  50359. return res;
  50360. }
  50361. /**
  50362. * Checks if the values of up to 7 expressions have changed and replaces them by their values in a
  50363. * translation, or returns NO_CHANGE.
  50364. *
  50365. * @param instructions A list of instructions that will be used to translate an attribute.
  50366. * @param v0 value checked for change.
  50367. * @param v1 value checked for change.
  50368. * @param v2 value checked for change.
  50369. * @param v3 value checked for change.
  50370. * @param v4 value checked for change.
  50371. * @param v5 value checked for change.
  50372. * @param v6 value checked for change.
  50373. *
  50374. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50375. */
  50376. function i18nInterpolation7(instructions, v0, v1, v2, v3, v4, v5, v6) {
  50377. var different = bindingUpdated4(v0, v1, v2, v3);
  50378. different = bindingUpdated2(v4, v5) || different;
  50379. different = bindingUpdated(v6) || different;
  50380. if (!different) {
  50381. return NO_CHANGE;
  50382. }
  50383. var res = '';
  50384. for (var i = 0; i < instructions.length; i++) {
  50385. // Odd indexes are bindings
  50386. if (i & 1) {
  50387. // Extract bits
  50388. var idx = instructions[i];
  50389. var b4 = idx & 4;
  50390. var b2 = idx & 2;
  50391. var b1 = idx & 1;
  50392. // Get the value from the argument vx where x = idx
  50393. var value = b4 ? (b2 ? v6 : (b1 ? v5 : v4)) : (b2 ? (b1 ? v3 : v2) : (b1 ? v1 : v0));
  50394. res += stringify$1(value);
  50395. }
  50396. else {
  50397. res += instructions[i];
  50398. }
  50399. }
  50400. return res;
  50401. }
  50402. /**
  50403. * Checks if the values of up to 8 expressions have changed and replaces them by their values in a
  50404. * translation, or returns NO_CHANGE.
  50405. *
  50406. * @param instructions A list of instructions that will be used to translate an attribute.
  50407. * @param v0 value checked for change.
  50408. * @param v1 value checked for change.
  50409. * @param v2 value checked for change.
  50410. * @param v3 value checked for change.
  50411. * @param v4 value checked for change.
  50412. * @param v5 value checked for change.
  50413. * @param v6 value checked for change.
  50414. * @param v7 value checked for change.
  50415. *
  50416. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50417. */
  50418. function i18nInterpolation8(instructions, v0, v1, v2, v3, v4, v5, v6, v7) {
  50419. var different = bindingUpdated4(v0, v1, v2, v3);
  50420. different = bindingUpdated4(v4, v5, v6, v7) || different;
  50421. if (!different) {
  50422. return NO_CHANGE;
  50423. }
  50424. var res = '';
  50425. for (var i = 0; i < instructions.length; i++) {
  50426. // Odd indexes are bindings
  50427. if (i & 1) {
  50428. // Extract bits
  50429. var idx = instructions[i];
  50430. var b4 = idx & 4;
  50431. var b2 = idx & 2;
  50432. var b1 = idx & 1;
  50433. // Get the value from the argument vx where x = idx
  50434. var value = b4 ? (b2 ? (b1 ? v7 : v6) : (b1 ? v5 : v4)) : (b2 ? (b1 ? v3 : v2) : (b1 ? v1 : v0));
  50435. res += stringify$1(value);
  50436. }
  50437. else {
  50438. res += instructions[i];
  50439. }
  50440. }
  50441. return res;
  50442. }
  50443. /**
  50444. * Create a translated interpolation binding with a variable number of expressions.
  50445. *
  50446. * If there are 1 to 8 expressions then `i18nInterpolation()` should be used instead. It is faster
  50447. * because there is no need to create an array of expressions and iterate over it.
  50448. *
  50449. * @returns The concatenated string when any of the arguments changes, `NO_CHANGE` otherwise.
  50450. */
  50451. function i18nInterpolationV(instructions, values) {
  50452. var different = false;
  50453. for (var i = 0; i < values.length; i++) {
  50454. // Check if bindings have changed
  50455. bindingUpdated(values[i]) && (different = true);
  50456. }
  50457. if (!different) {
  50458. return NO_CHANGE;
  50459. }
  50460. var res = '';
  50461. for (var i = 0; i < instructions.length; i++) {
  50462. // Odd indexes are placeholders
  50463. if (i & 1) {
  50464. res += stringify$1(values[instructions[i]]);
  50465. }
  50466. else {
  50467. res += instructions[i];
  50468. }
  50469. }
  50470. return res;
  50471. }
  50472. /**
  50473. * @license
  50474. * Copyright Google Inc. All Rights Reserved.
  50475. *
  50476. * Use of this source code is governed by an MIT-style license that can be
  50477. * found in the LICENSE file at https://angular.io/license
  50478. */
  50479. var COMPONENT_FACTORY_RESOLVER = {
  50480. provide: ComponentFactoryResolver,
  50481. useFactory: function () { return new ComponentFactoryResolver$1(); },
  50482. deps: [],
  50483. };
  50484. var NgModuleRef$1 = /** @class */ (function (_super) {
  50485. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgModuleRef$$1, _super);
  50486. function NgModuleRef$$1(ngModuleType, parentInjector) {
  50487. var _this = _super.call(this) || this;
  50488. // tslint:disable-next-line:require-internal-with-underscore
  50489. _this._bootstrapComponents = [];
  50490. _this.destroyCbs = [];
  50491. var ngModuleDef = ngModuleType.ngModuleDef;
  50492. ngDevMode && assertDefined(ngModuleDef, "NgModule '" + stringify(ngModuleType) + "' is not a subtype of 'NgModuleType'.");
  50493. _this._bootstrapComponents = ngModuleDef.bootstrap;
  50494. var additionalProviders = [
  50495. COMPONENT_FACTORY_RESOLVER, {
  50496. provide: NgModuleRef,
  50497. useValue: _this,
  50498. }
  50499. ];
  50500. _this.injector = createInjector(ngModuleType, parentInjector, additionalProviders);
  50501. _this.instance = _this.injector.get(ngModuleType);
  50502. _this.componentFactoryResolver = new ComponentFactoryResolver$1();
  50503. return _this;
  50504. }
  50505. NgModuleRef$$1.prototype.destroy = function () {
  50506. ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
  50507. this.destroyCbs.forEach(function (fn) { return fn(); });
  50508. this.destroyCbs = null;
  50509. };
  50510. NgModuleRef$$1.prototype.onDestroy = function (callback) {
  50511. ngDevMode && assertDefined(this.destroyCbs, 'NgModule already destroyed');
  50512. this.destroyCbs.push(callback);
  50513. };
  50514. return NgModuleRef$$1;
  50515. }(NgModuleRef));
  50516. var NgModuleFactory$1 = /** @class */ (function (_super) {
  50517. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgModuleFactory$$1, _super);
  50518. function NgModuleFactory$$1(moduleType) {
  50519. var _this = _super.call(this) || this;
  50520. _this.moduleType = moduleType;
  50521. return _this;
  50522. }
  50523. NgModuleFactory$$1.prototype.create = function (parentInjector) {
  50524. return new NgModuleRef$1(this.moduleType, parentInjector);
  50525. };
  50526. return NgModuleFactory$$1;
  50527. }(NgModuleFactory));
  50528. /**
  50529. * @license
  50530. * Copyright Google Inc. All Rights Reserved.
  50531. *
  50532. * Use of this source code is governed by an MIT-style license that can be
  50533. * found in the LICENSE file at https://angular.io/license
  50534. */
  50535. /**
  50536. * If the value hasn't been saved, calls the pure function to store and return the
  50537. * value. If it has been saved, returns the saved value.
  50538. *
  50539. * @param pureFn Function that returns a value
  50540. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50541. * @param thisArg Optional calling context of pureFn
  50542. * @returns value
  50543. */
  50544. function pureFunction0(slotOffset, pureFn, thisArg) {
  50545. ngDevMode && assertReservedSlotInitialized(slotOffset, 1);
  50546. var index = moveBindingIndexToReservedSlot(slotOffset);
  50547. var value = getCreationMode() ?
  50548. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg) : pureFn()) :
  50549. consumeBinding();
  50550. restoreBindingIndex(index);
  50551. return value;
  50552. }
  50553. /**
  50554. * If the value of the provided exp has changed, calls the pure function to return
  50555. * an updated value. Or if the value has not changed, returns cached value.
  50556. *
  50557. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50558. * @param pureFn Function that returns an updated value
  50559. * @param exp Updated expression value
  50560. * @param thisArg Optional calling context of pureFn
  50561. * @returns Updated or cached value
  50562. */
  50563. function pureFunction1(slotOffset, pureFn, exp, thisArg) {
  50564. ngDevMode && assertReservedSlotInitialized(slotOffset, 2);
  50565. var index = moveBindingIndexToReservedSlot(slotOffset);
  50566. var value = bindingUpdated(exp) ?
  50567. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp) : pureFn(exp)) :
  50568. consumeBinding();
  50569. restoreBindingIndex(index);
  50570. return value;
  50571. }
  50572. /**
  50573. * If the value of any provided exp has changed, calls the pure function to return
  50574. * an updated value. Or if no values have changed, returns cached value.
  50575. *
  50576. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50577. * @param pureFn
  50578. * @param exp1
  50579. * @param exp2
  50580. * @param thisArg Optional calling context of pureFn
  50581. * @returns Updated or cached value
  50582. */
  50583. function pureFunction2(slotOffset, pureFn, exp1, exp2, thisArg) {
  50584. ngDevMode && assertReservedSlotInitialized(slotOffset, 3);
  50585. var index = moveBindingIndexToReservedSlot(slotOffset);
  50586. var value = bindingUpdated2(exp1, exp2) ?
  50587. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2) : pureFn(exp1, exp2)) :
  50588. consumeBinding();
  50589. restoreBindingIndex(index);
  50590. return value;
  50591. }
  50592. /**
  50593. * If the value of any provided exp has changed, calls the pure function to return
  50594. * an updated value. Or if no values have changed, returns cached value.
  50595. *
  50596. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50597. * @param pureFn
  50598. * @param exp1
  50599. * @param exp2
  50600. * @param exp3
  50601. * @param thisArg Optional calling context of pureFn
  50602. * @returns Updated or cached value
  50603. */
  50604. function pureFunction3(slotOffset, pureFn, exp1, exp2, exp3, thisArg) {
  50605. ngDevMode && assertReservedSlotInitialized(slotOffset, 4);
  50606. var index = moveBindingIndexToReservedSlot(slotOffset);
  50607. var different = bindingUpdated2(exp1, exp2);
  50608. var value = bindingUpdated(exp3) || different ?
  50609. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2, exp3) : pureFn(exp1, exp2, exp3)) :
  50610. consumeBinding();
  50611. restoreBindingIndex(index);
  50612. return value;
  50613. }
  50614. /**
  50615. * If the value of any provided exp has changed, calls the pure function to return
  50616. * an updated value. Or if no values have changed, returns cached value.
  50617. *
  50618. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50619. * @param pureFn
  50620. * @param exp1
  50621. * @param exp2
  50622. * @param exp3
  50623. * @param exp4
  50624. * @param thisArg Optional calling context of pureFn
  50625. * @returns Updated or cached value
  50626. */
  50627. function pureFunction4(slotOffset, pureFn, exp1, exp2, exp3, exp4, thisArg) {
  50628. ngDevMode && assertReservedSlotInitialized(slotOffset, 5);
  50629. var index = moveBindingIndexToReservedSlot(slotOffset);
  50630. var value = bindingUpdated4(exp1, exp2, exp3, exp4) ?
  50631. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4) : pureFn(exp1, exp2, exp3, exp4)) :
  50632. consumeBinding();
  50633. restoreBindingIndex(index);
  50634. return value;
  50635. }
  50636. /**
  50637. * If the value of any provided exp has changed, calls the pure function to return
  50638. * an updated value. Or if no values have changed, returns cached value.
  50639. *
  50640. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50641. * @param pureFn
  50642. * @param exp1
  50643. * @param exp2
  50644. * @param exp3
  50645. * @param exp4
  50646. * @param exp5
  50647. * @param thisArg Optional calling context of pureFn
  50648. * @returns Updated or cached value
  50649. */
  50650. function pureFunction5(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, thisArg) {
  50651. ngDevMode && assertReservedSlotInitialized(slotOffset, 6);
  50652. var index = moveBindingIndexToReservedSlot(slotOffset);
  50653. var different = bindingUpdated4(exp1, exp2, exp3, exp4);
  50654. var value = bindingUpdated(exp5) || different ?
  50655. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5) :
  50656. pureFn(exp1, exp2, exp3, exp4, exp5)) :
  50657. consumeBinding();
  50658. restoreBindingIndex(index);
  50659. return value;
  50660. }
  50661. /**
  50662. * If the value of any provided exp has changed, calls the pure function to return
  50663. * an updated value. Or if no values have changed, returns cached value.
  50664. *
  50665. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50666. * @param pureFn
  50667. * @param exp1
  50668. * @param exp2
  50669. * @param exp3
  50670. * @param exp4
  50671. * @param exp5
  50672. * @param exp6
  50673. * @param thisArg Optional calling context of pureFn
  50674. * @returns Updated or cached value
  50675. */
  50676. function pureFunction6(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, thisArg) {
  50677. ngDevMode && assertReservedSlotInitialized(slotOffset, 7);
  50678. var index = moveBindingIndexToReservedSlot(slotOffset);
  50679. var different = bindingUpdated4(exp1, exp2, exp3, exp4);
  50680. var value = bindingUpdated2(exp5, exp6) || different ?
  50681. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6) :
  50682. pureFn(exp1, exp2, exp3, exp4, exp5, exp6)) :
  50683. consumeBinding();
  50684. restoreBindingIndex(index);
  50685. return value;
  50686. }
  50687. /**
  50688. * If the value of any provided exp has changed, calls the pure function to return
  50689. * an updated value. Or if no values have changed, returns cached value.
  50690. *
  50691. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50692. * @param pureFn
  50693. * @param exp1
  50694. * @param exp2
  50695. * @param exp3
  50696. * @param exp4
  50697. * @param exp5
  50698. * @param exp6
  50699. * @param exp7
  50700. * @param thisArg Optional calling context of pureFn
  50701. * @returns Updated or cached value
  50702. */
  50703. function pureFunction7(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, thisArg) {
  50704. ngDevMode && assertReservedSlotInitialized(slotOffset, 8);
  50705. var index = moveBindingIndexToReservedSlot(slotOffset);
  50706. var different = bindingUpdated4(exp1, exp2, exp3, exp4);
  50707. different = bindingUpdated2(exp5, exp6) || different;
  50708. var value = bindingUpdated(exp7) || different ?
  50709. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7) :
  50710. pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7)) :
  50711. consumeBinding();
  50712. restoreBindingIndex(index);
  50713. return value;
  50714. }
  50715. /**
  50716. * If the value of any provided exp has changed, calls the pure function to return
  50717. * an updated value. Or if no values have changed, returns cached value.
  50718. *
  50719. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50720. * @param pureFn
  50721. * @param exp1
  50722. * @param exp2
  50723. * @param exp3
  50724. * @param exp4
  50725. * @param exp5
  50726. * @param exp6
  50727. * @param exp7
  50728. * @param exp8
  50729. * @param thisArg Optional calling context of pureFn
  50730. * @returns Updated or cached value
  50731. */
  50732. function pureFunction8(slotOffset, pureFn, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8, thisArg) {
  50733. ngDevMode && assertReservedSlotInitialized(slotOffset, 9);
  50734. var index = moveBindingIndexToReservedSlot(slotOffset);
  50735. var different = bindingUpdated4(exp1, exp2, exp3, exp4);
  50736. var value = bindingUpdated4(exp5, exp6, exp7, exp8) || different ?
  50737. checkAndUpdateBinding$1(thisArg ? pureFn.call(thisArg, exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8) :
  50738. pureFn(exp1, exp2, exp3, exp4, exp5, exp6, exp7, exp8)) :
  50739. consumeBinding();
  50740. restoreBindingIndex(index);
  50741. return value;
  50742. }
  50743. /**
  50744. * pureFunction instruction that can support any number of bindings.
  50745. *
  50746. * If the value of any provided exp has changed, calls the pure function to return
  50747. * an updated value. Or if no values have changed, returns cached value.
  50748. *
  50749. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50750. * @param pureFn A pure function that takes binding values and builds an object or array
  50751. * containing those values.
  50752. * @param exps An array of binding values
  50753. * @param thisArg Optional calling context of pureFn
  50754. * @returns Updated or cached value
  50755. */
  50756. function pureFunctionV(slotOffset, pureFn, exps, thisArg) {
  50757. ngDevMode && assertReservedSlotInitialized(slotOffset, exps.length + 1);
  50758. var index = moveBindingIndexToReservedSlot(slotOffset);
  50759. var different = false;
  50760. for (var i = 0; i < exps.length; i++) {
  50761. bindingUpdated(exps[i]) && (different = true);
  50762. }
  50763. var value = different ? checkAndUpdateBinding$1(pureFn.apply(thisArg, exps)) : consumeBinding();
  50764. restoreBindingIndex(index);
  50765. return value;
  50766. }
  50767. /**
  50768. * @license
  50769. * Copyright Google Inc. All Rights Reserved.
  50770. *
  50771. * Use of this source code is governed by an MIT-style license that can be
  50772. * found in the LICENSE file at https://angular.io/license
  50773. */
  50774. /**
  50775. * Create a pipe.
  50776. *
  50777. * @param index Pipe index where the pipe will be stored.
  50778. * @param pipeName The name of the pipe
  50779. * @returns T the instance of the pipe.
  50780. */
  50781. function pipe(index, pipeName) {
  50782. var tView = getTView();
  50783. var pipeDef;
  50784. var adjustedIndex = index + HEADER_OFFSET;
  50785. if (tView.firstTemplatePass) {
  50786. pipeDef = getPipeDef(pipeName, tView.pipeRegistry);
  50787. tView.data[adjustedIndex] = pipeDef;
  50788. if (pipeDef.onDestroy) {
  50789. (tView.pipeDestroyHooks || (tView.pipeDestroyHooks = [])).push(adjustedIndex, pipeDef.onDestroy);
  50790. }
  50791. }
  50792. else {
  50793. pipeDef = tView.data[adjustedIndex];
  50794. }
  50795. var pipeInstance = pipeDef.factory();
  50796. store(index, pipeInstance);
  50797. return pipeInstance;
  50798. }
  50799. /**
  50800. * Searches the pipe registry for a pipe with the given name. If one is found,
  50801. * returns the pipe. Otherwise, an error is thrown because the pipe cannot be resolved.
  50802. *
  50803. * @param name Name of pipe to resolve
  50804. * @param registry Full list of available pipes
  50805. * @returns Matching PipeDef
  50806. */
  50807. function getPipeDef(name, registry) {
  50808. if (registry) {
  50809. for (var i = 0; i < registry.length; i++) {
  50810. var pipeDef = registry[i];
  50811. if (name === pipeDef.name) {
  50812. return pipeDef;
  50813. }
  50814. }
  50815. }
  50816. throw new Error("Pipe with name '" + name + "' not found!");
  50817. }
  50818. /**
  50819. * Invokes a pipe with 1 arguments.
  50820. *
  50821. * This instruction acts as a guard to {@link PipeTransform#transform} invoking
  50822. * the pipe only when an input to the pipe changes.
  50823. *
  50824. * @param index Pipe index where the pipe was stored on creation.
  50825. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50826. * @param v1 1st argument to {@link PipeTransform#transform}.
  50827. */
  50828. function pipeBind1(index, slotOffset, v1) {
  50829. var pipeInstance = load(index);
  50830. return isPure(index) ? pureFunction1(slotOffset, pipeInstance.transform, v1, pipeInstance) :
  50831. pipeInstance.transform(v1);
  50832. }
  50833. /**
  50834. * Invokes a pipe with 2 arguments.
  50835. *
  50836. * This instruction acts as a guard to {@link PipeTransform#transform} invoking
  50837. * the pipe only when an input to the pipe changes.
  50838. *
  50839. * @param index Pipe index where the pipe was stored on creation.
  50840. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50841. * @param v1 1st argument to {@link PipeTransform#transform}.
  50842. * @param v2 2nd argument to {@link PipeTransform#transform}.
  50843. */
  50844. function pipeBind2(index, slotOffset, v1, v2) {
  50845. var pipeInstance = load(index);
  50846. return isPure(index) ? pureFunction2(slotOffset, pipeInstance.transform, v1, v2, pipeInstance) :
  50847. pipeInstance.transform(v1, v2);
  50848. }
  50849. /**
  50850. * Invokes a pipe with 3 arguments.
  50851. *
  50852. * This instruction acts as a guard to {@link PipeTransform#transform} invoking
  50853. * the pipe only when an input to the pipe changes.
  50854. *
  50855. * @param index Pipe index where the pipe was stored on creation.
  50856. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50857. * @param v1 1st argument to {@link PipeTransform#transform}.
  50858. * @param v2 2nd argument to {@link PipeTransform#transform}.
  50859. * @param v3 4rd argument to {@link PipeTransform#transform}.
  50860. */
  50861. function pipeBind3(index, slotOffset, v1, v2, v3) {
  50862. var pipeInstance = load(index);
  50863. return isPure(index) ?
  50864. pureFunction3(slotOffset, pipeInstance.transform, v1, v2, v3, pipeInstance) :
  50865. pipeInstance.transform(v1, v2, v3);
  50866. }
  50867. /**
  50868. * Invokes a pipe with 4 arguments.
  50869. *
  50870. * This instruction acts as a guard to {@link PipeTransform#transform} invoking
  50871. * the pipe only when an input to the pipe changes.
  50872. *
  50873. * @param index Pipe index where the pipe was stored on creation.
  50874. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50875. * @param v1 1st argument to {@link PipeTransform#transform}.
  50876. * @param v2 2nd argument to {@link PipeTransform#transform}.
  50877. * @param v3 3rd argument to {@link PipeTransform#transform}.
  50878. * @param v4 4th argument to {@link PipeTransform#transform}.
  50879. */
  50880. function pipeBind4(index, slotOffset, v1, v2, v3, v4) {
  50881. var pipeInstance = load(index);
  50882. return isPure(index) ?
  50883. pureFunction4(slotOffset, pipeInstance.transform, v1, v2, v3, v4, pipeInstance) :
  50884. pipeInstance.transform(v1, v2, v3, v4);
  50885. }
  50886. /**
  50887. * Invokes a pipe with variable number of arguments.
  50888. *
  50889. * This instruction acts as a guard to {@link PipeTransform#transform} invoking
  50890. * the pipe only when an input to the pipe changes.
  50891. *
  50892. * @param index Pipe index where the pipe was stored on creation.
  50893. * @param slotOffset the offset in the reserved slot space {@link reserveSlots}
  50894. * @param values Array of arguments to pass to {@link PipeTransform#transform} method.
  50895. */
  50896. function pipeBindV(index, slotOffset, values) {
  50897. var pipeInstance = load(index);
  50898. return isPure(index) ? pureFunctionV(slotOffset, pipeInstance.transform, values, pipeInstance) :
  50899. pipeInstance.transform.apply(pipeInstance, values);
  50900. }
  50901. function isPure(index) {
  50902. return getTView().data[index + HEADER_OFFSET].pure;
  50903. }
  50904. /**
  50905. * @license
  50906. * Copyright Google Inc. All Rights Reserved.
  50907. *
  50908. * Use of this source code is governed by an MIT-style license that can be
  50909. * found in the LICENSE file at https://angular.io/license
  50910. */
  50911. /**
  50912. * @license
  50913. * Copyright Google Inc. All Rights Reserved.
  50914. *
  50915. * Use of this source code is governed by an MIT-style license that can be
  50916. * found in the LICENSE file at https://angular.io/license
  50917. */
  50918. /**
  50919. * @license
  50920. * Copyright Google Inc. All Rights Reserved.
  50921. *
  50922. * Use of this source code is governed by an MIT-style license that can be
  50923. * found in the LICENSE file at https://angular.io/license
  50924. */
  50925. /**
  50926. * @license
  50927. * Copyright Google Inc. All Rights Reserved.
  50928. *
  50929. * Use of this source code is governed by an MIT-style license that can be
  50930. * found in the LICENSE file at https://angular.io/license
  50931. */
  50932. var LQueries_ = /** @class */ (function () {
  50933. function LQueries_(deep) {
  50934. this.shallow = null;
  50935. this.deep = null;
  50936. this.deep = deep == null ? null : deep;
  50937. }
  50938. LQueries_.prototype.track = function (queryList, predicate, descend, read) {
  50939. if (descend) {
  50940. this.deep = createQuery$1(this.deep, queryList, predicate, read != null ? read : null);
  50941. }
  50942. else {
  50943. this.shallow = createQuery$1(this.shallow, queryList, predicate, read != null ? read : null);
  50944. }
  50945. };
  50946. LQueries_.prototype.clone = function () { return this.deep ? new LQueries_(this.deep) : null; };
  50947. LQueries_.prototype.child = function () {
  50948. if (this.deep === null) {
  50949. // if we don't have any deep queries then no need to track anything more.
  50950. return null;
  50951. }
  50952. if (this.shallow === null) {
  50953. // DeepQuery: We can reuse the current state if the child state would be same as current
  50954. // state.
  50955. return this;
  50956. }
  50957. else {
  50958. // We need to create new state
  50959. return new LQueries_(this.deep);
  50960. }
  50961. };
  50962. LQueries_.prototype.container = function () {
  50963. var result = null;
  50964. var query = this.deep;
  50965. while (query) {
  50966. var containerValues = []; // prepare room for views
  50967. query.values.push(containerValues);
  50968. var clonedQuery = {
  50969. next: null,
  50970. list: query.list,
  50971. predicate: query.predicate,
  50972. values: containerValues,
  50973. containerValues: null
  50974. };
  50975. clonedQuery.next = result;
  50976. result = clonedQuery;
  50977. query = query.next;
  50978. }
  50979. return result ? new LQueries_(result) : null;
  50980. };
  50981. LQueries_.prototype.createView = function () {
  50982. var result = null;
  50983. var query = this.deep;
  50984. while (query) {
  50985. var clonedQuery = {
  50986. next: null,
  50987. list: query.list,
  50988. predicate: query.predicate,
  50989. values: [],
  50990. containerValues: query.values
  50991. };
  50992. clonedQuery.next = result;
  50993. result = clonedQuery;
  50994. query = query.next;
  50995. }
  50996. return result ? new LQueries_(result) : null;
  50997. };
  50998. LQueries_.prototype.insertView = function (index) {
  50999. var query = this.deep;
  51000. while (query) {
  51001. ngDevMode &&
  51002. assertDefined(query.containerValues, 'View queries need to have a pointer to container values.');
  51003. query.containerValues.splice(index, 0, query.values);
  51004. query = query.next;
  51005. }
  51006. };
  51007. LQueries_.prototype.addNode = function (node) {
  51008. add(this.shallow, node);
  51009. add(this.deep, node);
  51010. };
  51011. LQueries_.prototype.removeView = function () {
  51012. var query = this.deep;
  51013. while (query) {
  51014. ngDevMode &&
  51015. assertDefined(query.containerValues, 'View queries need to have a pointer to container values.');
  51016. var containerValues = query.containerValues;
  51017. var viewValuesIdx = containerValues.indexOf(query.values);
  51018. var removed = containerValues.splice(viewValuesIdx, 1);
  51019. // mark a query as dirty only when removed view had matching modes
  51020. ngDevMode && assertEqual(removed.length, 1, 'removed.length');
  51021. if (removed[0].length) {
  51022. query.list.setDirty();
  51023. }
  51024. query = query.next;
  51025. }
  51026. };
  51027. return LQueries_;
  51028. }());
  51029. /**
  51030. * Iterates over local names for a given node and returns directive index
  51031. * (or -1 if a local name points to an element).
  51032. *
  51033. * @param tNode static data of a node to check
  51034. * @param selector selector to match
  51035. * @returns directive index, -1 or null if a selector didn't match any of the local names
  51036. */
  51037. function getIdxOfMatchingSelector(tNode, selector) {
  51038. var localNames = tNode.localNames;
  51039. if (localNames) {
  51040. for (var i = 0; i < localNames.length; i += 2) {
  51041. if (localNames[i] === selector) {
  51042. return localNames[i + 1];
  51043. }
  51044. }
  51045. }
  51046. return null;
  51047. }
  51048. /**
  51049. * Iterates over all the directives for a node and returns index of a directive for a given type.
  51050. *
  51051. * @param node Node on which directives are present.
  51052. * @param type Type of a directive to look for.
  51053. * @returns Index of a found directive or null when none found.
  51054. */
  51055. function getIdxOfMatchingDirective(node, type) {
  51056. var defs = node.view[TVIEW].directives;
  51057. var flags = node.tNode.flags;
  51058. var count = flags & 4095 /* DirectiveCountMask */;
  51059. var start = flags >> 14 /* DirectiveStartingIndexShift */;
  51060. var end = start + count;
  51061. for (var i = start; i < end; i++) {
  51062. var def = defs[i];
  51063. if (def.type === type && def.diPublic) {
  51064. return i;
  51065. }
  51066. }
  51067. return null;
  51068. }
  51069. function readFromNodeInjector(nodeInjector, node, read, directiveIdx) {
  51070. if (read instanceof ReadFromInjectorFn) {
  51071. return read.read(nodeInjector, node, directiveIdx);
  51072. }
  51073. else {
  51074. var matchingIdx = getIdxOfMatchingDirective(node, read);
  51075. if (matchingIdx !== null) {
  51076. return node.view[DIRECTIVES][matchingIdx];
  51077. }
  51078. }
  51079. return null;
  51080. }
  51081. function add(query, node) {
  51082. var nodeInjector = getOrCreateNodeInjectorForNode(node);
  51083. while (query) {
  51084. var predicate = query.predicate;
  51085. var type = predicate.type;
  51086. if (type) {
  51087. var directiveIdx = getIdxOfMatchingDirective(node, type);
  51088. if (directiveIdx !== null) {
  51089. // a node is matching a predicate - determine what to read
  51090. // if read token and / or strategy is not specified, use type as read token
  51091. var result = readFromNodeInjector(nodeInjector, node, predicate.read || type, directiveIdx);
  51092. if (result !== null) {
  51093. addMatch(query, result);
  51094. }
  51095. }
  51096. }
  51097. else {
  51098. var selector = predicate.selector;
  51099. for (var i = 0; i < selector.length; i++) {
  51100. var directiveIdx = getIdxOfMatchingSelector(node.tNode, selector[i]);
  51101. if (directiveIdx !== null) {
  51102. // a node is matching a predicate - determine what to read
  51103. // note that queries using name selector must specify read strategy
  51104. ngDevMode && assertDefined(predicate.read, 'the node should have a predicate');
  51105. var result = readFromNodeInjector(nodeInjector, node, predicate.read, directiveIdx);
  51106. if (result !== null) {
  51107. addMatch(query, result);
  51108. }
  51109. }
  51110. }
  51111. }
  51112. query = query.next;
  51113. }
  51114. }
  51115. function addMatch(query, matchingValue) {
  51116. query.values.push(matchingValue);
  51117. query.list.setDirty();
  51118. }
  51119. function createPredicate(predicate, read) {
  51120. var isArray = Array.isArray(predicate);
  51121. return {
  51122. type: isArray ? null : predicate,
  51123. selector: isArray ? predicate : null,
  51124. read: read
  51125. };
  51126. }
  51127. function createQuery$1(previous, queryList, predicate, read) {
  51128. return {
  51129. next: previous,
  51130. list: queryList,
  51131. predicate: createPredicate(predicate, read),
  51132. values: queryList._valuesTree,
  51133. containerValues: null
  51134. };
  51135. }
  51136. var QueryList_ = /** @class */ (function () {
  51137. function QueryList_() {
  51138. this.dirty = true;
  51139. this.changes = new EventEmitter();
  51140. this._values = [];
  51141. /** @internal */
  51142. this._valuesTree = [];
  51143. }
  51144. Object.defineProperty(QueryList_.prototype, "length", {
  51145. get: function () { return this._values.length; },
  51146. enumerable: true,
  51147. configurable: true
  51148. });
  51149. Object.defineProperty(QueryList_.prototype, "first", {
  51150. get: function () {
  51151. var values = this._values;
  51152. return values.length ? values[0] : null;
  51153. },
  51154. enumerable: true,
  51155. configurable: true
  51156. });
  51157. Object.defineProperty(QueryList_.prototype, "last", {
  51158. get: function () {
  51159. var values = this._values;
  51160. return values.length ? values[values.length - 1] : null;
  51161. },
  51162. enumerable: true,
  51163. configurable: true
  51164. });
  51165. /**
  51166. * See
  51167. * [Array.map](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/map)
  51168. */
  51169. QueryList_.prototype.map = function (fn) { return this._values.map(fn); };
  51170. /**
  51171. * See
  51172. * [Array.filter](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/filter)
  51173. */
  51174. QueryList_.prototype.filter = function (fn) {
  51175. return this._values.filter(fn);
  51176. };
  51177. /**
  51178. * See
  51179. * [Array.find](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/find)
  51180. */
  51181. QueryList_.prototype.find = function (fn) {
  51182. return this._values.find(fn);
  51183. };
  51184. /**
  51185. * See
  51186. * [Array.reduce](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/reduce)
  51187. */
  51188. QueryList_.prototype.reduce = function (fn, init) {
  51189. return this._values.reduce(fn, init);
  51190. };
  51191. /**
  51192. * See
  51193. * [Array.forEach](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/forEach)
  51194. */
  51195. QueryList_.prototype.forEach = function (fn) { this._values.forEach(fn); };
  51196. /**
  51197. * See
  51198. * [Array.some](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/some)
  51199. */
  51200. QueryList_.prototype.some = function (fn) {
  51201. return this._values.some(fn);
  51202. };
  51203. QueryList_.prototype.toArray = function () { return this._values.slice(0); };
  51204. QueryList_.prototype[getSymbolIterator()] = function () { return this._values[getSymbolIterator()](); };
  51205. QueryList_.prototype.toString = function () { return this._values.toString(); };
  51206. QueryList_.prototype.reset = function (res) {
  51207. this._values = flatten$1(res);
  51208. this.dirty = false;
  51209. };
  51210. QueryList_.prototype.notifyOnChanges = function () { this.changes.emit(this); };
  51211. QueryList_.prototype.setDirty = function () { this.dirty = true; };
  51212. QueryList_.prototype.destroy = function () {
  51213. this.changes.complete();
  51214. this.changes.unsubscribe();
  51215. };
  51216. return QueryList_;
  51217. }());
  51218. var QueryList$1 = QueryList_;
  51219. /**
  51220. * Creates and returns a QueryList.
  51221. *
  51222. * @param memoryIndex The index in memory where the QueryList should be saved. If null,
  51223. * this is is a content query and the QueryList will be saved later through directiveCreate.
  51224. * @param predicate The type for which the query will search
  51225. * @param descend Whether or not to descend into children
  51226. * @param read What to save in the query
  51227. * @returns QueryList<T>
  51228. */
  51229. function query(memoryIndex, predicate, descend, read) {
  51230. ngDevMode && assertPreviousIsParent();
  51231. var queryList = new QueryList$1();
  51232. var queries = getCurrentQueries(LQueries_);
  51233. queries.track(queryList, predicate, descend, read);
  51234. storeCleanupWithContext(null, queryList, queryList.destroy);
  51235. if (memoryIndex != null) {
  51236. store(memoryIndex, queryList);
  51237. }
  51238. return queryList;
  51239. }
  51240. /**
  51241. * Refreshes a query by combining matches from all active views and removing matches from deleted
  51242. * views.
  51243. * Returns true if a query got dirty during change detection, false otherwise.
  51244. */
  51245. function queryRefresh(queryList) {
  51246. var queryListImpl = queryList;
  51247. if (queryList.dirty) {
  51248. queryList.reset(queryListImpl._valuesTree);
  51249. queryList.notifyOnChanges();
  51250. return true;
  51251. }
  51252. return false;
  51253. }
  51254. /**
  51255. * @license
  51256. * Copyright Google Inc. All Rights Reserved.
  51257. *
  51258. * Use of this source code is governed by an MIT-style license that can be
  51259. * found in the LICENSE file at https://angular.io/license
  51260. */
  51261. /**
  51262. * @license
  51263. * Copyright Google Inc. All Rights Reserved.
  51264. *
  51265. * Use of this source code is governed by an MIT-style license that can be
  51266. * found in the LICENSE file at https://angular.io/license
  51267. */
  51268. var BRAND = '__SANITIZER_TRUSTED_BRAND__';
  51269. function allowSanitizationBypass(value, type) {
  51270. return (value instanceof String && value[BRAND] === type) ? true : false;
  51271. }
  51272. /**
  51273. * Mark `html` string as trusted.
  51274. *
  51275. * This function wraps the trusted string in `String` and brands it in a way which makes it
  51276. * recognizable to {@link htmlSanitizer} to be trusted implicitly.
  51277. *
  51278. * @param trustedHtml `html` string which needs to be implicitly trusted.
  51279. * @returns a `html` `String` which has been branded to be implicitly trusted.
  51280. */
  51281. function bypassSanitizationTrustHtml(trustedHtml) {
  51282. return bypassSanitizationTrustString(trustedHtml, "Html" /* Html */);
  51283. }
  51284. /**
  51285. * Mark `style` string as trusted.
  51286. *
  51287. * This function wraps the trusted string in `String` and brands it in a way which makes it
  51288. * recognizable to {@link styleSanitizer} to be trusted implicitly.
  51289. *
  51290. * @param trustedStyle `style` string which needs to be implicitly trusted.
  51291. * @returns a `style` `String` which has been branded to be implicitly trusted.
  51292. */
  51293. function bypassSanitizationTrustStyle(trustedStyle) {
  51294. return bypassSanitizationTrustString(trustedStyle, "Style" /* Style */);
  51295. }
  51296. /**
  51297. * Mark `script` string as trusted.
  51298. *
  51299. * This function wraps the trusted string in `String` and brands it in a way which makes it
  51300. * recognizable to {@link scriptSanitizer} to be trusted implicitly.
  51301. *
  51302. * @param trustedScript `script` string which needs to be implicitly trusted.
  51303. * @returns a `script` `String` which has been branded to be implicitly trusted.
  51304. */
  51305. function bypassSanitizationTrustScript(trustedScript) {
  51306. return bypassSanitizationTrustString(trustedScript, "Script" /* Script */);
  51307. }
  51308. /**
  51309. * Mark `url` string as trusted.
  51310. *
  51311. * This function wraps the trusted string in `String` and brands it in a way which makes it
  51312. * recognizable to {@link urlSanitizer} to be trusted implicitly.
  51313. *
  51314. * @param trustedUrl `url` string which needs to be implicitly trusted.
  51315. * @returns a `url` `String` which has been branded to be implicitly trusted.
  51316. */
  51317. function bypassSanitizationTrustUrl(trustedUrl) {
  51318. return bypassSanitizationTrustString(trustedUrl, "Url" /* Url */);
  51319. }
  51320. /**
  51321. * Mark `url` string as trusted.
  51322. *
  51323. * This function wraps the trusted string in `String` and brands it in a way which makes it
  51324. * recognizable to {@link resourceUrlSanitizer} to be trusted implicitly.
  51325. *
  51326. * @param trustedResourceUrl `url` string which needs to be implicitly trusted.
  51327. * @returns a `url` `String` which has been branded to be implicitly trusted.
  51328. */
  51329. function bypassSanitizationTrustResourceUrl(trustedResourceUrl) {
  51330. return bypassSanitizationTrustString(trustedResourceUrl, "ResourceUrl" /* ResourceUrl */);
  51331. }
  51332. function bypassSanitizationTrustString(trustedString, mode) {
  51333. var trusted = new String(trustedString);
  51334. trusted[BRAND] = mode;
  51335. return trusted;
  51336. }
  51337. /**
  51338. * @license
  51339. * Copyright Google Inc. All Rights Reserved.
  51340. *
  51341. * Use of this source code is governed by an MIT-style license that can be
  51342. * found in the LICENSE file at https://angular.io/license
  51343. */
  51344. /**
  51345. * An `html` sanitizer which converts untrusted `html` **string** into trusted string by removing
  51346. * dangerous content.
  51347. *
  51348. * This method parses the `html` and locates potentially dangerous content (such as urls and
  51349. * javascript) and removes it.
  51350. *
  51351. * It is possible to mark a string as trusted by calling {@link bypassSanitizationTrustHtml}.
  51352. *
  51353. * @param unsafeHtml untrusted `html`, typically from the user.
  51354. * @returns `html` string which is safe to display to user, because all of the dangerous javascript
  51355. * and urls have been removed.
  51356. */
  51357. function sanitizeHtml(unsafeHtml) {
  51358. var s = getCurrentSanitizer();
  51359. if (s) {
  51360. return s.sanitize(SecurityContext.HTML, unsafeHtml) || '';
  51361. }
  51362. if (allowSanitizationBypass(unsafeHtml, "Html" /* Html */)) {
  51363. return unsafeHtml.toString();
  51364. }
  51365. return _sanitizeHtml(document, stringify$1(unsafeHtml));
  51366. }
  51367. /**
  51368. * A `style` sanitizer which converts untrusted `style` **string** into trusted string by removing
  51369. * dangerous content.
  51370. *
  51371. * This method parses the `style` and locates potentially dangerous content (such as urls and
  51372. * javascript) and removes it.
  51373. *
  51374. * It is possible to mark a string as trusted by calling {@link bypassSanitizationTrustStyle}.
  51375. *
  51376. * @param unsafeStyle untrusted `style`, typically from the user.
  51377. * @returns `style` string which is safe to bind to the `style` properties, because all of the
  51378. * dangerous javascript and urls have been removed.
  51379. */
  51380. function sanitizeStyle(unsafeStyle) {
  51381. var s = getCurrentSanitizer();
  51382. if (s) {
  51383. return s.sanitize(SecurityContext.STYLE, unsafeStyle) || '';
  51384. }
  51385. if (allowSanitizationBypass(unsafeStyle, "Style" /* Style */)) {
  51386. return unsafeStyle.toString();
  51387. }
  51388. return _sanitizeStyle(stringify$1(unsafeStyle));
  51389. }
  51390. /**
  51391. * A `url` sanitizer which converts untrusted `url` **string** into trusted string by removing
  51392. * dangerous
  51393. * content.
  51394. *
  51395. * This method parses the `url` and locates potentially dangerous content (such as javascript) and
  51396. * removes it.
  51397. *
  51398. * It is possible to mark a string as trusted by calling {@link bypassSanitizationTrustUrl}.
  51399. *
  51400. * @param unsafeUrl untrusted `url`, typically from the user.
  51401. * @returns `url` string which is safe to bind to the `src` properties such as `<img src>`, because
  51402. * all of the dangerous javascript has been removed.
  51403. */
  51404. function sanitizeUrl(unsafeUrl) {
  51405. var s = getCurrentSanitizer();
  51406. if (s) {
  51407. return s.sanitize(SecurityContext.URL, unsafeUrl) || '';
  51408. }
  51409. if (allowSanitizationBypass(unsafeUrl, "Url" /* Url */)) {
  51410. return unsafeUrl.toString();
  51411. }
  51412. return _sanitizeUrl(stringify$1(unsafeUrl));
  51413. }
  51414. /**
  51415. * A `url` sanitizer which only lets trusted `url`s through.
  51416. *
  51417. * This passes only `url`s marked trusted by calling {@link bypassSanitizationTrustResourceUrl}.
  51418. *
  51419. * @param unsafeResourceUrl untrusted `url`, typically from the user.
  51420. * @returns `url` string which is safe to bind to the `src` properties such as `<img src>`, because
  51421. * only trusted `url`s have been allowed to pass.
  51422. */
  51423. function sanitizeResourceUrl(unsafeResourceUrl) {
  51424. var s = getCurrentSanitizer();
  51425. if (s) {
  51426. return s.sanitize(SecurityContext.RESOURCE_URL, unsafeResourceUrl) || '';
  51427. }
  51428. if (allowSanitizationBypass(unsafeResourceUrl, "ResourceUrl" /* ResourceUrl */)) {
  51429. return unsafeResourceUrl.toString();
  51430. }
  51431. throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
  51432. }
  51433. /**
  51434. * @license
  51435. * Copyright Google Inc. All Rights Reserved.
  51436. *
  51437. * Use of this source code is governed by an MIT-style license that can be
  51438. * found in the LICENSE file at https://angular.io/license
  51439. */
  51440. // clang-format on
  51441. /**
  51442. * @license
  51443. * Copyright Google Inc. All Rights Reserved.
  51444. *
  51445. * Use of this source code is governed by an MIT-style license that can be
  51446. * found in the LICENSE file at https://angular.io/license
  51447. */
  51448. /**
  51449. * @license
  51450. * Copyright Google Inc. All Rights Reserved.
  51451. *
  51452. * Use of this source code is governed by an MIT-style license that can be
  51453. * found in the LICENSE file at https://angular.io/license
  51454. */
  51455. /**
  51456. * @license
  51457. * Copyright Google Inc. All Rights Reserved.
  51458. *
  51459. * Use of this source code is governed by an MIT-style license that can be
  51460. * found in the LICENSE file at https://angular.io/license
  51461. */
  51462. // This file only reexports content of the `src` folder. Keep it that way.
  51463. /**
  51464. * @license
  51465. * Copyright Google Inc. All Rights Reserved.
  51466. *
  51467. * Use of this source code is governed by an MIT-style license that can be
  51468. * found in the LICENSE file at https://angular.io/license
  51469. */
  51470. /**
  51471. * Generated bundle index. Do not edit.
  51472. */
  51473. //# sourceMappingURL=core.js.map
  51474. /***/ }),
  51475. /***/ "./node_modules/@angular/forms/fesm5/forms.js":
  51476. /*!****************************************************!*\
  51477. !*** ./node_modules/@angular/forms/fesm5/forms.js ***!
  51478. \****************************************************/
  51479. /*! exports provided: ɵangular_packages_forms_forms_bb, ɵangular_packages_forms_forms_ba, ɵangular_packages_forms_forms_y, ɵangular_packages_forms_forms_z, ɵangular_packages_forms_forms_a, ɵangular_packages_forms_forms_b, ɵangular_packages_forms_forms_c, ɵangular_packages_forms_forms_d, ɵangular_packages_forms_forms_e, ɵangular_packages_forms_forms_f, ɵangular_packages_forms_forms_g, ɵangular_packages_forms_forms_bg, ɵangular_packages_forms_forms_bc, ɵangular_packages_forms_forms_bd, ɵangular_packages_forms_forms_h, ɵangular_packages_forms_forms_i, ɵangular_packages_forms_forms_be, ɵangular_packages_forms_forms_bf, ɵangular_packages_forms_forms_j, ɵangular_packages_forms_forms_k, ɵangular_packages_forms_forms_l, ɵangular_packages_forms_forms_m, ɵangular_packages_forms_forms_o, ɵangular_packages_forms_forms_n, ɵangular_packages_forms_forms_p, ɵangular_packages_forms_forms_r, ɵangular_packages_forms_forms_q, ɵangular_packages_forms_forms_t, ɵangular_packages_forms_forms_u, ɵangular_packages_forms_forms_w, ɵangular_packages_forms_forms_v, ɵangular_packages_forms_forms_x, ɵangular_packages_forms_forms_s, AbstractControlDirective, AbstractFormGroupDirective, CheckboxControlValueAccessor, ControlContainer, NG_VALUE_ACCESSOR, COMPOSITION_BUFFER_MODE, DefaultValueAccessor, NgControl, NgControlStatus, NgControlStatusGroup, NgForm, NgModel, NgModelGroup, RadioControlValueAccessor, FormControlDirective, FormControlName, FormGroupDirective, FormArrayName, FormGroupName, NgSelectOption, SelectControlValueAccessor, SelectMultipleControlValueAccessor, CheckboxRequiredValidator, EmailValidator, MaxLengthValidator, MinLengthValidator, PatternValidator, RequiredValidator, FormBuilder, AbstractControl, FormArray, FormControl, FormGroup, NG_ASYNC_VALIDATORS, NG_VALIDATORS, Validators, VERSION, FormsModule, ReactiveFormsModule */
  51480. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  51481. "use strict";
  51482. __webpack_require__.r(__webpack_exports__);
  51483. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bb", function() { return InternalFormsSharedModule; });
  51484. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_ba", function() { return REACTIVE_DRIVEN_DIRECTIVES; });
  51485. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_y", function() { return SHARED_FORM_DIRECTIVES; });
  51486. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_z", function() { return TEMPLATE_DRIVEN_DIRECTIVES; });
  51487. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_a", function() { return CHECKBOX_VALUE_ACCESSOR; });
  51488. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_b", function() { return DEFAULT_VALUE_ACCESSOR; });
  51489. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_c", function() { return AbstractControlStatus; });
  51490. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_d", function() { return ngControlStatusHost; });
  51491. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_e", function() { return formDirectiveProvider; });
  51492. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_f", function() { return formControlBinding; });
  51493. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_g", function() { return modelGroupProvider; });
  51494. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bg", function() { return NgNoValidate; });
  51495. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bc", function() { return NUMBER_VALUE_ACCESSOR; });
  51496. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bd", function() { return NumberValueAccessor; });
  51497. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_h", function() { return RADIO_VALUE_ACCESSOR; });
  51498. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_i", function() { return RadioControlRegistry; });
  51499. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_be", function() { return RANGE_VALUE_ACCESSOR; });
  51500. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_bf", function() { return RangeValueAccessor; });
  51501. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_j", function() { return NG_MODEL_WITH_FORM_CONTROL_WARNING; });
  51502. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_k", function() { return formControlBinding$1; });
  51503. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_l", function() { return controlNameBinding; });
  51504. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_m", function() { return formDirectiveProvider$1; });
  51505. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_o", function() { return formArrayNameProvider; });
  51506. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_n", function() { return formGroupNameProvider; });
  51507. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_p", function() { return SELECT_VALUE_ACCESSOR; });
  51508. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_r", function() { return NgSelectMultipleOption; });
  51509. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_q", function() { return SELECT_MULTIPLE_VALUE_ACCESSOR; });
  51510. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_t", function() { return CHECKBOX_REQUIRED_VALIDATOR; });
  51511. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_u", function() { return EMAIL_VALIDATOR; });
  51512. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_w", function() { return MAX_LENGTH_VALIDATOR; });
  51513. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_v", function() { return MIN_LENGTH_VALIDATOR; });
  51514. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_x", function() { return PATTERN_VALIDATOR; });
  51515. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_forms_forms_s", function() { return REQUIRED_VALIDATOR; });
  51516. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractControlDirective", function() { return AbstractControlDirective; });
  51517. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractFormGroupDirective", function() { return AbstractFormGroupDirective; });
  51518. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxControlValueAccessor", function() { return CheckboxControlValueAccessor; });
  51519. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ControlContainer", function() { return ControlContainer; });
  51520. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_VALUE_ACCESSOR", function() { return NG_VALUE_ACCESSOR; });
  51521. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "COMPOSITION_BUFFER_MODE", function() { return COMPOSITION_BUFFER_MODE; });
  51522. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultValueAccessor", function() { return DefaultValueAccessor; });
  51523. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControl", function() { return NgControl; });
  51524. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControlStatus", function() { return NgControlStatus; });
  51525. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgControlStatusGroup", function() { return NgControlStatusGroup; });
  51526. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgForm", function() { return NgForm; });
  51527. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModel", function() { return NgModel; });
  51528. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgModelGroup", function() { return NgModelGroup; });
  51529. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RadioControlValueAccessor", function() { return RadioControlValueAccessor; });
  51530. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControlDirective", function() { return FormControlDirective; });
  51531. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControlName", function() { return FormControlName; });
  51532. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroupDirective", function() { return FormGroupDirective; });
  51533. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormArrayName", function() { return FormArrayName; });
  51534. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroupName", function() { return FormGroupName; });
  51535. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgSelectOption", function() { return NgSelectOption; });
  51536. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectControlValueAccessor", function() { return SelectControlValueAccessor; });
  51537. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SelectMultipleControlValueAccessor", function() { return SelectMultipleControlValueAccessor; });
  51538. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CheckboxRequiredValidator", function() { return CheckboxRequiredValidator; });
  51539. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmailValidator", function() { return EmailValidator; });
  51540. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MaxLengthValidator", function() { return MaxLengthValidator; });
  51541. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MinLengthValidator", function() { return MinLengthValidator; });
  51542. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PatternValidator", function() { return PatternValidator; });
  51543. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RequiredValidator", function() { return RequiredValidator; });
  51544. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormBuilder", function() { return FormBuilder; });
  51545. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AbstractControl", function() { return AbstractControl; });
  51546. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormArray", function() { return FormArray; });
  51547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormControl", function() { return FormControl; });
  51548. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormGroup", function() { return FormGroup; });
  51549. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_ASYNC_VALIDATORS", function() { return NG_ASYNC_VALIDATORS; });
  51550. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NG_VALIDATORS", function() { return NG_VALIDATORS; });
  51551. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Validators", function() { return Validators; });
  51552. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  51553. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FormsModule", function() { return FormsModule; });
  51554. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReactiveFormsModule", function() { return ReactiveFormsModule; });
  51555. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  51556. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  51557. /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  51558. /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  51559. /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  51560. /**
  51561. * @license Angular v6.1.10
  51562. * (c) 2010-2018 Google, Inc. https://angular.io/
  51563. * License: MIT
  51564. */
  51565. /**
  51566. * @license
  51567. * Copyright Google Inc. All Rights Reserved.
  51568. *
  51569. * Use of this source code is governed by an MIT-style license that can be
  51570. * found in the LICENSE file at https://angular.io/license
  51571. */
  51572. /**
  51573. * @description
  51574. * Base class for control directives.
  51575. *
  51576. * This class is only used internally in the `ReactiveFormsModule` and the `FormsModule`.
  51577. *
  51578. */
  51579. var AbstractControlDirective = /** @class */ (function () {
  51580. function AbstractControlDirective() {
  51581. }
  51582. Object.defineProperty(AbstractControlDirective.prototype, "value", {
  51583. /**
  51584. * @description
  51585. * Reports the value of the control if it is present, otherwise null.
  51586. */
  51587. get: function () { return this.control ? this.control.value : null; },
  51588. enumerable: true,
  51589. configurable: true
  51590. });
  51591. Object.defineProperty(AbstractControlDirective.prototype, "valid", {
  51592. /**
  51593. * @description
  51594. * Reports whether the control is valid. A control is considered valid if no
  51595. * validation errors exist with the current value.
  51596. * If the control is not present, null is returned.
  51597. */
  51598. get: function () { return this.control ? this.control.valid : null; },
  51599. enumerable: true,
  51600. configurable: true
  51601. });
  51602. Object.defineProperty(AbstractControlDirective.prototype, "invalid", {
  51603. /**
  51604. * @description
  51605. * Reports whether the control is invalid, meaning that an error exists in the input value.
  51606. * If the control is not present, null is returned.
  51607. */
  51608. get: function () { return this.control ? this.control.invalid : null; },
  51609. enumerable: true,
  51610. configurable: true
  51611. });
  51612. Object.defineProperty(AbstractControlDirective.prototype, "pending", {
  51613. /**
  51614. * @description
  51615. * Reports whether a control is pending, meaning that that async validation is occurring and
  51616. * errors are not yet available for the input value. If the control is not present, null is
  51617. * returned.
  51618. */
  51619. get: function () { return this.control ? this.control.pending : null; },
  51620. enumerable: true,
  51621. configurable: true
  51622. });
  51623. Object.defineProperty(AbstractControlDirective.prototype, "disabled", {
  51624. /**
  51625. * @description
  51626. * Reports whether the control is disabled, meaning that the control is disabled
  51627. * in the UI and is exempt from validation checks and excluded from aggregate
  51628. * values of ancestor controls. If the control is not present, null is returned.
  51629. */
  51630. get: function () { return this.control ? this.control.disabled : null; },
  51631. enumerable: true,
  51632. configurable: true
  51633. });
  51634. Object.defineProperty(AbstractControlDirective.prototype, "enabled", {
  51635. /**
  51636. * @description
  51637. * Reports whether the control is enabled, meaning that the control is included in ancestor
  51638. * calculations of validity or value. If the control is not present, null is returned.
  51639. */
  51640. get: function () { return this.control ? this.control.enabled : null; },
  51641. enumerable: true,
  51642. configurable: true
  51643. });
  51644. Object.defineProperty(AbstractControlDirective.prototype, "errors", {
  51645. /**
  51646. * @description
  51647. * Reports the control's validation errors. If the control is not present, null is returned.
  51648. */
  51649. get: function () { return this.control ? this.control.errors : null; },
  51650. enumerable: true,
  51651. configurable: true
  51652. });
  51653. Object.defineProperty(AbstractControlDirective.prototype, "pristine", {
  51654. /**
  51655. * @description
  51656. * Reports whether the control is pristine, meaning that the user has not yet changed
  51657. * the value in the UI. If the control is not present, null is returned.
  51658. */
  51659. get: function () { return this.control ? this.control.pristine : null; },
  51660. enumerable: true,
  51661. configurable: true
  51662. });
  51663. Object.defineProperty(AbstractControlDirective.prototype, "dirty", {
  51664. /**
  51665. * @description
  51666. * Reports whether the control is dirty, meaning that the user has changed
  51667. * the value in the UI. If the control is not present, null is returned.
  51668. */
  51669. get: function () { return this.control ? this.control.dirty : null; },
  51670. enumerable: true,
  51671. configurable: true
  51672. });
  51673. Object.defineProperty(AbstractControlDirective.prototype, "touched", {
  51674. /**
  51675. * @description
  51676. * Reports whether the control is touched, meaning that the user has triggered
  51677. * a `blur` event on it. If the control is not present, null is returned.
  51678. */
  51679. get: function () { return this.control ? this.control.touched : null; },
  51680. enumerable: true,
  51681. configurable: true
  51682. });
  51683. Object.defineProperty(AbstractControlDirective.prototype, "status", {
  51684. /**
  51685. * @description
  51686. * Reports the validation status of the control. Possible values include:
  51687. * 'VALID', 'INVALID', 'DISABLED', and 'PENDING'.
  51688. * If the control is not present, null is returned.
  51689. */
  51690. get: function () { return this.control ? this.control.status : null; },
  51691. enumerable: true,
  51692. configurable: true
  51693. });
  51694. Object.defineProperty(AbstractControlDirective.prototype, "untouched", {
  51695. /**
  51696. * @description
  51697. * Reports whether the control is untouched, meaning that the user has not yet triggered
  51698. * a `blur` event on it. If the control is not present, null is returned.
  51699. */
  51700. get: function () { return this.control ? this.control.untouched : null; },
  51701. enumerable: true,
  51702. configurable: true
  51703. });
  51704. Object.defineProperty(AbstractControlDirective.prototype, "statusChanges", {
  51705. /**
  51706. * @description
  51707. * Returns a multicasting observable that emits a validation status whenever it is
  51708. * calculated for the control. If the control is not present, null is returned.
  51709. */
  51710. get: function () {
  51711. return this.control ? this.control.statusChanges : null;
  51712. },
  51713. enumerable: true,
  51714. configurable: true
  51715. });
  51716. Object.defineProperty(AbstractControlDirective.prototype, "valueChanges", {
  51717. /**
  51718. * @description
  51719. * Returns a multicasting observable of value changes for the control that emits every time the
  51720. * value of the control changes in the UI or programmatically.
  51721. * If the control is not present, null is returned.
  51722. */
  51723. get: function () {
  51724. return this.control ? this.control.valueChanges : null;
  51725. },
  51726. enumerable: true,
  51727. configurable: true
  51728. });
  51729. Object.defineProperty(AbstractControlDirective.prototype, "path", {
  51730. /**
  51731. * @description
  51732. * Returns an array that represents the path from the top-level form to this control.
  51733. * Each index is the string name of the control on that level.
  51734. */
  51735. get: function () { return null; },
  51736. enumerable: true,
  51737. configurable: true
  51738. });
  51739. /**
  51740. * @description
  51741. * Resets the control with the provided value if the control is present.
  51742. */
  51743. AbstractControlDirective.prototype.reset = function (value) {
  51744. if (value === void 0) { value = undefined; }
  51745. if (this.control)
  51746. this.control.reset(value);
  51747. };
  51748. /**
  51749. * @description
  51750. * Reports whether the control with the given path has the error specified.
  51751. * If no path is given, it checks for the error on the present control.
  51752. * If the control is not present, false is returned.
  51753. */
  51754. AbstractControlDirective.prototype.hasError = function (errorCode, path) {
  51755. return this.control ? this.control.hasError(errorCode, path) : false;
  51756. };
  51757. /**
  51758. * @description
  51759. * Reports error data for the control with the given path.
  51760. * If the control is not present, null is returned.
  51761. */
  51762. AbstractControlDirective.prototype.getError = function (errorCode, path) {
  51763. return this.control ? this.control.getError(errorCode, path) : null;
  51764. };
  51765. return AbstractControlDirective;
  51766. }());
  51767. /**
  51768. * @license
  51769. * Copyright Google Inc. All Rights Reserved.
  51770. *
  51771. * Use of this source code is governed by an MIT-style license that can be
  51772. * found in the LICENSE file at https://angular.io/license
  51773. */
  51774. /**
  51775. * @description
  51776. * A base class for directives that contain multiple registered instances of `NgControl`.
  51777. * Only used by the forms module.
  51778. */
  51779. var ControlContainer = /** @class */ (function (_super) {
  51780. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ControlContainer, _super);
  51781. function ControlContainer() {
  51782. return _super !== null && _super.apply(this, arguments) || this;
  51783. }
  51784. Object.defineProperty(ControlContainer.prototype, "formDirective", {
  51785. /**
  51786. * @description
  51787. * The top-level form directive for the control.
  51788. */
  51789. get: function () { return null; },
  51790. enumerable: true,
  51791. configurable: true
  51792. });
  51793. Object.defineProperty(ControlContainer.prototype, "path", {
  51794. /**
  51795. * @description
  51796. * The path to this group.
  51797. */
  51798. get: function () { return null; },
  51799. enumerable: true,
  51800. configurable: true
  51801. });
  51802. return ControlContainer;
  51803. }(AbstractControlDirective));
  51804. /**
  51805. * @license
  51806. * Copyright Google Inc. All Rights Reserved.
  51807. *
  51808. * Use of this source code is governed by an MIT-style license that can be
  51809. * found in the LICENSE file at https://angular.io/license
  51810. */
  51811. function isEmptyInputValue(value) {
  51812. // we don't check for string here so it also works with arrays
  51813. return value == null || value.length === 0;
  51814. }
  51815. /**
  51816. * @description
  51817. * An `InjectionToken` for registering additional synchronous validators used with `AbstractControl`s.
  51818. *
  51819. * @see `NG_ASYNC_VALIDATORS`
  51820. *
  51821. * @usageNotes
  51822. *
  51823. * ### Providing a custom validator
  51824. *
  51825. * The following example registers a custom validator directive. Adding the validator to the
  51826. * existing collection of validators requires the `multi: true` option.
  51827. *
  51828. * ```typescript
  51829. * @Directive({
  51830. * selector: '[customValidator]',
  51831. * providers: [{provide: NG_VALIDATORS, useExisting: CustomValidatorDirective, multi: true}]
  51832. * })
  51833. * class CustomValidatorDirective implements Validator {
  51834. * validate(control: AbstractControl): ValidationErrors | null {
  51835. * return { 'custom': true };
  51836. * }
  51837. * }
  51838. * ```
  51839. *
  51840. */
  51841. var NG_VALIDATORS = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('NgValidators');
  51842. /**
  51843. * @description
  51844. * An `InjectionToken` for registering additional asynchronous validators used with `AbstractControl`s.
  51845. *
  51846. * @see `NG_VALIDATORS`
  51847. *
  51848. */
  51849. var NG_ASYNC_VALIDATORS = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('NgAsyncValidators');
  51850. var 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])?)*$/;
  51851. /**
  51852. * @description
  51853. * Provides a set of built-in validators that can be used by form controls.
  51854. *
  51855. * A validator is a function that processes a `FormControl` or collection of
  51856. * controls and returns an error map or null. A null map means that validation has passed.
  51857. *
  51858. * @see [Form Validation](/guide/form-validation)
  51859. *
  51860. */
  51861. var Validators = /** @class */ (function () {
  51862. function Validators() {
  51863. }
  51864. /**
  51865. * @description
  51866. * Validator that requires the control's value to be greater than or equal to the provided number.
  51867. * The validator exists only as a function and not as a directive.
  51868. *
  51869. * @usageNotes
  51870. *
  51871. * ### Validate against a minimum of 3
  51872. *
  51873. * ```typescript
  51874. * const control = new FormControl(2, Validators.min(3));
  51875. *
  51876. * console.log(control.errors); // {min: {min: 3, actual: 2}}
  51877. * ```
  51878. *
  51879. * @returns A validator function that returns an error map with the
  51880. * `min` property if the validation check fails, otherwise `null`.
  51881. *
  51882. */
  51883. Validators.min = function (min) {
  51884. return function (control) {
  51885. if (isEmptyInputValue(control.value) || isEmptyInputValue(min)) {
  51886. return null; // don't validate empty values to allow optional controls
  51887. }
  51888. var value = parseFloat(control.value);
  51889. // Controls with NaN values after parsing should be treated as not having a
  51890. // minimum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-min
  51891. return !isNaN(value) && value < min ? { 'min': { 'min': min, 'actual': control.value } } : null;
  51892. };
  51893. };
  51894. /**
  51895. * @description
  51896. * Validator that requires the control's value to be less than or equal to the provided number.
  51897. * The validator exists only as a function and not as a directive.
  51898. *
  51899. * @usageNotes
  51900. *
  51901. * ### Validate against a maximum of 15
  51902. *
  51903. * ```typescript
  51904. * const control = new FormControl(16, Validators.max(15));
  51905. *
  51906. * console.log(control.errors); // {max: {max: 15, actual: 16}}
  51907. * ```
  51908. *
  51909. * @returns A validator function that returns an error map with the
  51910. * `max` property if the validation check fails, otherwise `null`.
  51911. *
  51912. */
  51913. Validators.max = function (max) {
  51914. return function (control) {
  51915. if (isEmptyInputValue(control.value) || isEmptyInputValue(max)) {
  51916. return null; // don't validate empty values to allow optional controls
  51917. }
  51918. var value = parseFloat(control.value);
  51919. // Controls with NaN values after parsing should be treated as not having a
  51920. // maximum, per the HTML forms spec: https://www.w3.org/TR/html5/forms.html#attr-input-max
  51921. return !isNaN(value) && value > max ? { 'max': { 'max': max, 'actual': control.value } } : null;
  51922. };
  51923. };
  51924. /**
  51925. * @description
  51926. * Validator that requires the control have a non-empty value.
  51927. *
  51928. * @usageNotes
  51929. *
  51930. * ### Validate that the field is non-empty
  51931. *
  51932. * ```typescript
  51933. * const control = new FormControl('', Validators.required);
  51934. *
  51935. * console.log(control.errors); // {required: true}
  51936. * ```
  51937. *
  51938. * @returns An error map with the `required` property
  51939. * if the validation check fails, otherwise `null`.
  51940. *
  51941. */
  51942. Validators.required = function (control) {
  51943. return isEmptyInputValue(control.value) ? { 'required': true } : null;
  51944. };
  51945. /**
  51946. * @description
  51947. * Validator that requires the control's value be true. This validator is commonly
  51948. * used for required checkboxes.
  51949. *
  51950. * @usageNotes
  51951. *
  51952. * ### Validate that the field value is true
  51953. *
  51954. * ```typescript
  51955. * const control = new FormControl('', Validators.requiredTrue);
  51956. *
  51957. * console.log(control.errors); // {required: true}
  51958. * ```
  51959. *
  51960. * @returns An error map that contains the `required` property
  51961. * set to `true` if the validation check fails, otherwise `null`.
  51962. */
  51963. Validators.requiredTrue = function (control) {
  51964. return control.value === true ? null : { 'required': true };
  51965. };
  51966. /**
  51967. * @description
  51968. * Validator that requires the control's value pass an email validation test.
  51969. *
  51970. * @usageNotes
  51971. *
  51972. * ### Validate that the field matches a valid email pattern
  51973. *
  51974. * ```typescript
  51975. * const control = new FormControl('bad@', Validators.email);
  51976. *
  51977. * console.log(control.errors); // {email: true}
  51978. * ```
  51979. *
  51980. * @returns An error map with the `email` property
  51981. * if the validation check fails, otherwise `null`.
  51982. *
  51983. */
  51984. Validators.email = function (control) {
  51985. if (isEmptyInputValue(control.value)) {
  51986. return null; // don't validate empty values to allow optional controls
  51987. }
  51988. return EMAIL_REGEXP.test(control.value) ? null : { 'email': true };
  51989. };
  51990. /**
  51991. * @description
  51992. * Validator that requires the length of the control's value to be greater than or equal
  51993. * to the provided minimum length. This validator is also provided by default if you use the
  51994. * the HTML5 `minlength` attribute.
  51995. *
  51996. * @usageNotes
  51997. *
  51998. * ### Validate that the field has a minimum of 3 characters
  51999. *
  52000. * ```typescript
  52001. * const control = new FormControl('ng', Validators.minLength(3));
  52002. *
  52003. * console.log(control.errors); // {minlength: {requiredLength: 3, actualLength: 2}}
  52004. * ```
  52005. *
  52006. * ```html
  52007. * <input minlength="5">
  52008. * ```
  52009. *
  52010. * @returns A validator function that returns an error map with the
  52011. * `minlength` if the validation check fails, otherwise `null`.
  52012. */
  52013. Validators.minLength = function (minLength) {
  52014. return function (control) {
  52015. if (isEmptyInputValue(control.value)) {
  52016. return null; // don't validate empty values to allow optional controls
  52017. }
  52018. var length = control.value ? control.value.length : 0;
  52019. return length < minLength ?
  52020. { 'minlength': { 'requiredLength': minLength, 'actualLength': length } } :
  52021. null;
  52022. };
  52023. };
  52024. /**
  52025. * @description
  52026. * Validator that requires the length of the control's value to be less than or equal
  52027. * to the provided maximum length. This validator is also provided by default if you use the
  52028. * the HTML5 `maxlength` attribute.
  52029. *
  52030. * @usageNotes
  52031. *
  52032. * ### Validate that the field has maximum of 5 characters
  52033. *
  52034. * ```typescript
  52035. * const control = new FormControl('Angular', Validators.maxLength(5));
  52036. *
  52037. * console.log(control.errors); // {maxlength: {requiredLength: 5, actualLength: 7}}
  52038. * ```
  52039. *
  52040. * ```html
  52041. * <input maxlength="5">
  52042. * ```
  52043. *
  52044. * @returns A validator function that returns an error map with the
  52045. * `maxlength` property if the validation check fails, otherwise `null`.
  52046. */
  52047. Validators.maxLength = function (maxLength) {
  52048. return function (control) {
  52049. var length = control.value ? control.value.length : 0;
  52050. return length > maxLength ?
  52051. { 'maxlength': { 'requiredLength': maxLength, 'actualLength': length } } :
  52052. null;
  52053. };
  52054. };
  52055. /**
  52056. * @description
  52057. * Validator that requires the control's value to match a regex pattern. This validator is also
  52058. * provided
  52059. * by default if you use the HTML5 `pattern` attribute.
  52060. *
  52061. * @usageNotes
  52062. *
  52063. * ### Validate that the field only contains letters or spaces
  52064. *
  52065. * ```typescript
  52066. * const control = new FormControl('1', Validators.pattern('[a-zA-Z ]*'));
  52067. *
  52068. * console.log(control.errors); // {pattern: {requiredPattern: '^[a-zA-Z ]*$', actualValue: '1'}}
  52069. * ```
  52070. *
  52071. * ```html
  52072. * <input pattern="[a-zA-Z ]*">
  52073. * ```
  52074. *
  52075. * @returns A validator function that returns an error map with the
  52076. * `pattern` property if the validation check fails, otherwise `null`.
  52077. */
  52078. Validators.pattern = function (pattern) {
  52079. if (!pattern)
  52080. return Validators.nullValidator;
  52081. var regex;
  52082. var regexStr;
  52083. if (typeof pattern === 'string') {
  52084. regexStr = '';
  52085. if (pattern.charAt(0) !== '^')
  52086. regexStr += '^';
  52087. regexStr += pattern;
  52088. if (pattern.charAt(pattern.length - 1) !== '$')
  52089. regexStr += '$';
  52090. regex = new RegExp(regexStr);
  52091. }
  52092. else {
  52093. regexStr = pattern.toString();
  52094. regex = pattern;
  52095. }
  52096. return function (control) {
  52097. if (isEmptyInputValue(control.value)) {
  52098. return null; // don't validate empty values to allow optional controls
  52099. }
  52100. var value = control.value;
  52101. return regex.test(value) ? null :
  52102. { 'pattern': { 'requiredPattern': regexStr, 'actualValue': value } };
  52103. };
  52104. };
  52105. /**
  52106. * @description
  52107. * Validator that performs no operation.
  52108. */
  52109. Validators.nullValidator = function (control) { return null; };
  52110. Validators.compose = function (validators) {
  52111. if (!validators)
  52112. return null;
  52113. var presentValidators = validators.filter(isPresent);
  52114. if (presentValidators.length == 0)
  52115. return null;
  52116. return function (control) {
  52117. return _mergeErrors(_executeValidators(control, presentValidators));
  52118. };
  52119. };
  52120. /**
  52121. * @description
  52122. * Compose multiple async validators into a single function that returns the union
  52123. * of the individual error objects for the provided control.
  52124. *
  52125. * @returns A validator function that returns an error map with the
  52126. * merged error objects of the async validators if the validation check fails, otherwise `null`.
  52127. */
  52128. Validators.composeAsync = function (validators) {
  52129. if (!validators)
  52130. return null;
  52131. var presentValidators = validators.filter(isPresent);
  52132. if (presentValidators.length == 0)
  52133. return null;
  52134. return function (control) {
  52135. var observables = _executeAsyncValidators(control, presentValidators).map(toObservable);
  52136. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["forkJoin"])(observables).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(_mergeErrors));
  52137. };
  52138. };
  52139. return Validators;
  52140. }());
  52141. function isPresent(o) {
  52142. return o != null;
  52143. }
  52144. function toObservable(r) {
  52145. var obs = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵisPromise"])(r) ? Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(r) : r;
  52146. if (!(Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵisObservable"])(obs))) {
  52147. throw new Error("Expected validator to return Promise or Observable.");
  52148. }
  52149. return obs;
  52150. }
  52151. function _executeValidators(control, validators) {
  52152. return validators.map(function (v) { return v(control); });
  52153. }
  52154. function _executeAsyncValidators(control, validators) {
  52155. return validators.map(function (v) { return v(control); });
  52156. }
  52157. function _mergeErrors(arrayOfErrors) {
  52158. var res = arrayOfErrors.reduce(function (res, errors) {
  52159. return errors != null ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, res, errors) : res;
  52160. }, {});
  52161. return Object.keys(res).length === 0 ? null : res;
  52162. }
  52163. /**
  52164. * @license
  52165. * Copyright Google Inc. All Rights Reserved.
  52166. *
  52167. * Use of this source code is governed by an MIT-style license that can be
  52168. * found in the LICENSE file at https://angular.io/license
  52169. */
  52170. /**
  52171. * Used to provide a `ControlValueAccessor` for form controls.
  52172. *
  52173. * See `DefaultValueAccessor` for how to implement one.
  52174. *
  52175. */
  52176. var NG_VALUE_ACCESSOR = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('NgValueAccessor');
  52177. /**
  52178. * @license
  52179. * Copyright Google Inc. All Rights Reserved.
  52180. *
  52181. * Use of this source code is governed by an MIT-style license that can be
  52182. * found in the LICENSE file at https://angular.io/license
  52183. */
  52184. var CHECKBOX_VALUE_ACCESSOR = {
  52185. provide: NG_VALUE_ACCESSOR,
  52186. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return CheckboxControlValueAccessor; }),
  52187. multi: true,
  52188. };
  52189. /**
  52190. * The accessor for writing a value and listening to changes on a checkbox input element.
  52191. *
  52192. * @usageNotes
  52193. * ### Example
  52194. *
  52195. * ```
  52196. * <input type="checkbox" name="rememberLogin" ngModel>
  52197. * ```
  52198. *
  52199. * @ngModule FormsModule
  52200. * @ngModule ReactiveFormsModule
  52201. */
  52202. var CheckboxControlValueAccessor = /** @class */ (function () {
  52203. function CheckboxControlValueAccessor(_renderer, _elementRef) {
  52204. this._renderer = _renderer;
  52205. this._elementRef = _elementRef;
  52206. this.onChange = function (_) { };
  52207. this.onTouched = function () { };
  52208. }
  52209. CheckboxControlValueAccessor.prototype.writeValue = function (value) {
  52210. this._renderer.setProperty(this._elementRef.nativeElement, 'checked', value);
  52211. };
  52212. CheckboxControlValueAccessor.prototype.registerOnChange = function (fn) { this.onChange = fn; };
  52213. CheckboxControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  52214. CheckboxControlValueAccessor.prototype.setDisabledState = function (isDisabled) {
  52215. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  52216. };
  52217. CheckboxControlValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52218. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  52219. selector: 'input[type=checkbox][formControlName],input[type=checkbox][formControl],input[type=checkbox][ngModel]',
  52220. host: { '(change)': 'onChange($event.target.checked)', '(blur)': 'onTouched()' },
  52221. providers: [CHECKBOX_VALUE_ACCESSOR]
  52222. }),
  52223. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]])
  52224. ], CheckboxControlValueAccessor);
  52225. return CheckboxControlValueAccessor;
  52226. }());
  52227. /**
  52228. * @license
  52229. * Copyright Google Inc. All Rights Reserved.
  52230. *
  52231. * Use of this source code is governed by an MIT-style license that can be
  52232. * found in the LICENSE file at https://angular.io/license
  52233. */
  52234. var DEFAULT_VALUE_ACCESSOR = {
  52235. provide: NG_VALUE_ACCESSOR,
  52236. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return DefaultValueAccessor; }),
  52237. multi: true
  52238. };
  52239. /**
  52240. * We must check whether the agent is Android because composition events
  52241. * behave differently between iOS and Android.
  52242. */
  52243. function _isAndroid() {
  52244. var userAgent = Object(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__["ɵgetDOM"])() ? Object(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__["ɵgetDOM"])().getUserAgent() : '';
  52245. return /android (\d+)/.test(userAgent.toLowerCase());
  52246. }
  52247. /**
  52248. * Turn this mode on if you want form directives to buffer IME input until compositionend
  52249. * @experimental
  52250. */
  52251. var COMPOSITION_BUFFER_MODE = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('CompositionEventMode');
  52252. /**
  52253. * The default accessor for writing a value and listening to changes that is used by the
  52254. * `NgModel`, `FormControlDirective`, and `FormControlName` directives.
  52255. *
  52256. * @usageNotes
  52257. * ### Example
  52258. *
  52259. * ```
  52260. * <input type="text" name="searchQuery" ngModel>
  52261. * ```
  52262. *
  52263. * @ngModule FormsModule
  52264. * @ngModule ReactiveFormsModule
  52265. */
  52266. var DefaultValueAccessor = /** @class */ (function () {
  52267. function DefaultValueAccessor(_renderer, _elementRef, _compositionMode) {
  52268. this._renderer = _renderer;
  52269. this._elementRef = _elementRef;
  52270. this._compositionMode = _compositionMode;
  52271. this.onChange = function (_) { };
  52272. this.onTouched = function () { };
  52273. /** Whether the user is creating a composition string (IME events). */
  52274. this._composing = false;
  52275. if (this._compositionMode == null) {
  52276. this._compositionMode = !_isAndroid();
  52277. }
  52278. }
  52279. DefaultValueAccessor.prototype.writeValue = function (value) {
  52280. var normalizedValue = value == null ? '' : value;
  52281. this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue);
  52282. };
  52283. DefaultValueAccessor.prototype.registerOnChange = function (fn) { this.onChange = fn; };
  52284. DefaultValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  52285. DefaultValueAccessor.prototype.setDisabledState = function (isDisabled) {
  52286. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  52287. };
  52288. /** @internal */
  52289. DefaultValueAccessor.prototype._handleInput = function (value) {
  52290. if (!this._compositionMode || (this._compositionMode && !this._composing)) {
  52291. this.onChange(value);
  52292. }
  52293. };
  52294. /** @internal */
  52295. DefaultValueAccessor.prototype._compositionStart = function () { this._composing = true; };
  52296. /** @internal */
  52297. DefaultValueAccessor.prototype._compositionEnd = function (value) {
  52298. this._composing = false;
  52299. this._compositionMode && this.onChange(value);
  52300. };
  52301. DefaultValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52302. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  52303. selector: 'input:not([type=checkbox])[formControlName],textarea[formControlName],input:not([type=checkbox])[formControl],textarea[formControl],input:not([type=checkbox])[ngModel],textarea[ngModel],[ngDefaultControl]',
  52304. // TODO: vsavkin replace the above selector with the one below it once
  52305. // https://github.com/angular/angular/issues/3011 is implemented
  52306. // selector: '[ngModel],[formControl],[formControlName]',
  52307. host: {
  52308. '(input)': '$any(this)._handleInput($event.target.value)',
  52309. '(blur)': 'onTouched()',
  52310. '(compositionstart)': '$any(this)._compositionStart()',
  52311. '(compositionend)': '$any(this)._compositionEnd($event.target.value)'
  52312. },
  52313. providers: [DEFAULT_VALUE_ACCESSOR]
  52314. }),
  52315. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(COMPOSITION_BUFFER_MODE)),
  52316. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"], Boolean])
  52317. ], DefaultValueAccessor);
  52318. return DefaultValueAccessor;
  52319. }());
  52320. /**
  52321. * @license
  52322. * Copyright Google Inc. All Rights Reserved.
  52323. *
  52324. * Use of this source code is governed by an MIT-style license that can be
  52325. * found in the LICENSE file at https://angular.io/license
  52326. */
  52327. function normalizeValidator(validator) {
  52328. if (validator.validate) {
  52329. return function (c) { return validator.validate(c); };
  52330. }
  52331. else {
  52332. return validator;
  52333. }
  52334. }
  52335. function normalizeAsyncValidator(validator) {
  52336. if (validator.validate) {
  52337. return function (c) { return validator.validate(c); };
  52338. }
  52339. else {
  52340. return validator;
  52341. }
  52342. }
  52343. /**
  52344. * @license
  52345. * Copyright Google Inc. All Rights Reserved.
  52346. *
  52347. * Use of this source code is governed by an MIT-style license that can be
  52348. * found in the LICENSE file at https://angular.io/license
  52349. */
  52350. var NUMBER_VALUE_ACCESSOR = {
  52351. provide: NG_VALUE_ACCESSOR,
  52352. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return NumberValueAccessor; }),
  52353. multi: true
  52354. };
  52355. /**
  52356. * The accessor for writing a number value and listening to changes that is used by the
  52357. * `NgModel`, `FormControlDirective`, and `FormControlName` directives.
  52358. *
  52359. * @usageNotes
  52360. * ### Example
  52361. *
  52362. * ```
  52363. * <input type="number" [(ngModel)]="age">
  52364. * ```
  52365. *
  52366. * @ngModule FormsModule
  52367. * @ngModule ReactiveFormsModule
  52368. */
  52369. var NumberValueAccessor = /** @class */ (function () {
  52370. function NumberValueAccessor(_renderer, _elementRef) {
  52371. this._renderer = _renderer;
  52372. this._elementRef = _elementRef;
  52373. this.onChange = function (_) { };
  52374. this.onTouched = function () { };
  52375. }
  52376. NumberValueAccessor.prototype.writeValue = function (value) {
  52377. // The value needs to be normalized for IE9, otherwise it is set to 'null' when null
  52378. var normalizedValue = value == null ? '' : value;
  52379. this._renderer.setProperty(this._elementRef.nativeElement, 'value', normalizedValue);
  52380. };
  52381. NumberValueAccessor.prototype.registerOnChange = function (fn) {
  52382. this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); };
  52383. };
  52384. NumberValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  52385. NumberValueAccessor.prototype.setDisabledState = function (isDisabled) {
  52386. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  52387. };
  52388. NumberValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52389. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  52390. selector: 'input[type=number][formControlName],input[type=number][formControl],input[type=number][ngModel]',
  52391. host: {
  52392. '(change)': 'onChange($event.target.value)',
  52393. '(input)': 'onChange($event.target.value)',
  52394. '(blur)': 'onTouched()'
  52395. },
  52396. providers: [NUMBER_VALUE_ACCESSOR]
  52397. }),
  52398. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]])
  52399. ], NumberValueAccessor);
  52400. return NumberValueAccessor;
  52401. }());
  52402. /**
  52403. * @license
  52404. * Copyright Google Inc. All Rights Reserved.
  52405. *
  52406. * Use of this source code is governed by an MIT-style license that can be
  52407. * found in the LICENSE file at https://angular.io/license
  52408. */
  52409. function unimplemented() {
  52410. throw new Error('unimplemented');
  52411. }
  52412. /**
  52413. * @description
  52414. * A base class that all control `FormControl`-based directives extend. It binds a `FormControl`
  52415. * object to a DOM element.
  52416. */
  52417. var NgControl = /** @class */ (function (_super) {
  52418. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgControl, _super);
  52419. function NgControl() {
  52420. var _this = _super !== null && _super.apply(this, arguments) || this;
  52421. /**
  52422. * @description
  52423. * The parent form for the control.
  52424. *
  52425. * @internal
  52426. */
  52427. _this._parent = null;
  52428. /**
  52429. * @description
  52430. * The name for the control
  52431. */
  52432. _this.name = null;
  52433. /**
  52434. * @description
  52435. * The value accessor for the control
  52436. */
  52437. _this.valueAccessor = null;
  52438. /**
  52439. * @description
  52440. * The uncomposed array of synchronous validators for the control
  52441. *
  52442. * @internal
  52443. */
  52444. _this._rawValidators = [];
  52445. /**
  52446. * @description
  52447. * The uncomposed array of async validators for the control
  52448. *
  52449. * @internal
  52450. */
  52451. _this._rawAsyncValidators = [];
  52452. return _this;
  52453. }
  52454. Object.defineProperty(NgControl.prototype, "validator", {
  52455. /**
  52456. * @description
  52457. * The registered synchronous validator function for the control
  52458. *
  52459. * @throws An exception that this method is not implemented
  52460. */
  52461. get: function () { return unimplemented(); },
  52462. enumerable: true,
  52463. configurable: true
  52464. });
  52465. Object.defineProperty(NgControl.prototype, "asyncValidator", {
  52466. /**
  52467. * @description
  52468. * The registered async validator function for the control
  52469. *
  52470. * @throws An exception that this method is not implemented
  52471. */
  52472. get: function () { return unimplemented(); },
  52473. enumerable: true,
  52474. configurable: true
  52475. });
  52476. return NgControl;
  52477. }(AbstractControlDirective));
  52478. /**
  52479. * @license
  52480. * Copyright Google Inc. All Rights Reserved.
  52481. *
  52482. * Use of this source code is governed by an MIT-style license that can be
  52483. * found in the LICENSE file at https://angular.io/license
  52484. */
  52485. var RADIO_VALUE_ACCESSOR = {
  52486. provide: NG_VALUE_ACCESSOR,
  52487. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return RadioControlValueAccessor; }),
  52488. multi: true
  52489. };
  52490. /**
  52491. * Internal class used by Angular to uncheck radio buttons with the matching name.
  52492. */
  52493. var RadioControlRegistry = /** @class */ (function () {
  52494. function RadioControlRegistry() {
  52495. this._accessors = [];
  52496. }
  52497. RadioControlRegistry.prototype.add = function (control, accessor) {
  52498. this._accessors.push([control, accessor]);
  52499. };
  52500. RadioControlRegistry.prototype.remove = function (accessor) {
  52501. for (var i = this._accessors.length - 1; i >= 0; --i) {
  52502. if (this._accessors[i][1] === accessor) {
  52503. this._accessors.splice(i, 1);
  52504. return;
  52505. }
  52506. }
  52507. };
  52508. RadioControlRegistry.prototype.select = function (accessor) {
  52509. var _this = this;
  52510. this._accessors.forEach(function (c) {
  52511. if (_this._isSameGroup(c, accessor) && c[1] !== accessor) {
  52512. c[1].fireUncheck(accessor.value);
  52513. }
  52514. });
  52515. };
  52516. RadioControlRegistry.prototype._isSameGroup = function (controlPair, accessor) {
  52517. if (!controlPair[0].control)
  52518. return false;
  52519. return controlPair[0]._parent === accessor._control._parent &&
  52520. controlPair[1].name === accessor.name;
  52521. };
  52522. RadioControlRegistry = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52523. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])()
  52524. ], RadioControlRegistry);
  52525. return RadioControlRegistry;
  52526. }());
  52527. /**
  52528. * @description
  52529. *
  52530. * Writes radio control values and listens to radio control changes.
  52531. *
  52532. * Used by `NgModel`, `FormControlDirective`, and `FormControlName`
  52533. * to keep the view synced with the `FormControl` model.
  52534. *
  52535. * If you have imported the `FormsModule` or the `ReactiveFormsModule`, this
  52536. * value accessor will be active on any radio control that has a form directive. You do
  52537. * **not** need to add a special selector to activate it.
  52538. *
  52539. * @usageNotes
  52540. * ### How to use radio buttons with form directives
  52541. *
  52542. * To use radio buttons in a template-driven form, you'll want to ensure that radio buttons
  52543. * in the same group have the same `name` attribute. Radio buttons with different `name`
  52544. * attributes do not affect each other.
  52545. *
  52546. * {@example forms/ts/radioButtons/radio_button_example.ts region='TemplateDriven'}
  52547. *
  52548. * When using radio buttons in a reactive form, radio buttons in the same group should have the
  52549. * same `formControlName`. You can also add a `name` attribute, but it's optional.
  52550. *
  52551. * {@example forms/ts/reactiveRadioButtons/reactive_radio_button_example.ts region='Reactive'}
  52552. *
  52553. * @ngModule FormsModule
  52554. * @ngModule ReactiveFormsModule
  52555. */
  52556. var RadioControlValueAccessor = /** @class */ (function () {
  52557. function RadioControlValueAccessor(_renderer, _elementRef, _registry, _injector) {
  52558. this._renderer = _renderer;
  52559. this._elementRef = _elementRef;
  52560. this._registry = _registry;
  52561. this._injector = _injector;
  52562. this.onChange = function () { };
  52563. this.onTouched = function () { };
  52564. }
  52565. RadioControlValueAccessor.prototype.ngOnInit = function () {
  52566. this._control = this._injector.get(NgControl);
  52567. this._checkName();
  52568. this._registry.add(this._control, this);
  52569. };
  52570. RadioControlValueAccessor.prototype.ngOnDestroy = function () { this._registry.remove(this); };
  52571. RadioControlValueAccessor.prototype.writeValue = function (value) {
  52572. this._state = value === this.value;
  52573. this._renderer.setProperty(this._elementRef.nativeElement, 'checked', this._state);
  52574. };
  52575. RadioControlValueAccessor.prototype.registerOnChange = function (fn) {
  52576. var _this = this;
  52577. this._fn = fn;
  52578. this.onChange = function () {
  52579. fn(_this.value);
  52580. _this._registry.select(_this);
  52581. };
  52582. };
  52583. RadioControlValueAccessor.prototype.fireUncheck = function (value) { this.writeValue(value); };
  52584. RadioControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  52585. RadioControlValueAccessor.prototype.setDisabledState = function (isDisabled) {
  52586. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  52587. };
  52588. RadioControlValueAccessor.prototype._checkName = function () {
  52589. if (this.name && this.formControlName && this.name !== this.formControlName) {
  52590. this._throwNameError();
  52591. }
  52592. if (!this.name && this.formControlName)
  52593. this.name = this.formControlName;
  52594. };
  52595. RadioControlValueAccessor.prototype._throwNameError = function () {
  52596. throw new Error("\n If you define both a name and a formControlName attribute on your radio button, their values\n must match. Ex: <input type=\"radio\" formControlName=\"food\" name=\"food\">\n ");
  52597. };
  52598. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52599. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  52600. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  52601. ], RadioControlValueAccessor.prototype, "name", void 0);
  52602. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52603. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  52604. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  52605. ], RadioControlValueAccessor.prototype, "formControlName", void 0);
  52606. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52607. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  52608. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  52609. ], RadioControlValueAccessor.prototype, "value", void 0);
  52610. RadioControlValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52611. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  52612. selector: 'input[type=radio][formControlName],input[type=radio][formControl],input[type=radio][ngModel]',
  52613. host: { '(change)': 'onChange()', '(blur)': 'onTouched()' },
  52614. providers: [RADIO_VALUE_ACCESSOR]
  52615. }),
  52616. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"],
  52617. RadioControlRegistry, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"]])
  52618. ], RadioControlValueAccessor);
  52619. return RadioControlValueAccessor;
  52620. }());
  52621. /**
  52622. * @license
  52623. * Copyright Google Inc. All Rights Reserved.
  52624. *
  52625. * Use of this source code is governed by an MIT-style license that can be
  52626. * found in the LICENSE file at https://angular.io/license
  52627. */
  52628. var RANGE_VALUE_ACCESSOR = {
  52629. provide: NG_VALUE_ACCESSOR,
  52630. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return RangeValueAccessor; }),
  52631. multi: true
  52632. };
  52633. /**
  52634. * The accessor for writing a range value and listening to changes that is used by the
  52635. * `NgModel`, `FormControlDirective`, and `FormControlName` directives.
  52636. *
  52637. * @usageNotes
  52638. * ### Example
  52639. *
  52640. * ```
  52641. * <input type="range" [(ngModel)]="age" >
  52642. * ```
  52643. *
  52644. * @ngModule FormsModule
  52645. * @ngModule ReactiveFormsModule
  52646. */
  52647. var RangeValueAccessor = /** @class */ (function () {
  52648. function RangeValueAccessor(_renderer, _elementRef) {
  52649. this._renderer = _renderer;
  52650. this._elementRef = _elementRef;
  52651. this.onChange = function (_) { };
  52652. this.onTouched = function () { };
  52653. }
  52654. RangeValueAccessor.prototype.writeValue = function (value) {
  52655. this._renderer.setProperty(this._elementRef.nativeElement, 'value', parseFloat(value));
  52656. };
  52657. RangeValueAccessor.prototype.registerOnChange = function (fn) {
  52658. this.onChange = function (value) { fn(value == '' ? null : parseFloat(value)); };
  52659. };
  52660. RangeValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  52661. RangeValueAccessor.prototype.setDisabledState = function (isDisabled) {
  52662. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  52663. };
  52664. RangeValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52665. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  52666. selector: 'input[type=range][formControlName],input[type=range][formControl],input[type=range][ngModel]',
  52667. host: {
  52668. '(change)': 'onChange($event.target.value)',
  52669. '(input)': 'onChange($event.target.value)',
  52670. '(blur)': 'onTouched()'
  52671. },
  52672. providers: [RANGE_VALUE_ACCESSOR]
  52673. }),
  52674. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]])
  52675. ], RangeValueAccessor);
  52676. return RangeValueAccessor;
  52677. }());
  52678. /**
  52679. * @license
  52680. * Copyright Google Inc. All Rights Reserved.
  52681. *
  52682. * Use of this source code is governed by an MIT-style license that can be
  52683. * found in the LICENSE file at https://angular.io/license
  52684. */
  52685. var FormErrorExamples = {
  52686. formControlName: "\n <div [formGroup]=\"myGroup\">\n <input formControlName=\"firstName\">\n </div>\n\n In your class:\n\n this.myGroup = new FormGroup({\n firstName: new FormControl()\n });",
  52687. formGroupName: "\n <div [formGroup]=\"myGroup\">\n <div formGroupName=\"person\">\n <input formControlName=\"firstName\">\n </div>\n </div>\n\n In your class:\n\n this.myGroup = new FormGroup({\n person: new FormGroup({ firstName: new FormControl() })\n });",
  52688. formArrayName: "\n <div [formGroup]=\"myGroup\">\n <div formArrayName=\"cities\">\n <div *ngFor=\"let city of cityArray.controls; index as i\">\n <input [formControlName]=\"i\">\n </div>\n </div>\n </div>\n\n In your class:\n\n this.cityArray = new FormArray([new FormControl('SF')]);\n this.myGroup = new FormGroup({\n cities: this.cityArray\n });",
  52689. ngModelGroup: "\n <form>\n <div ngModelGroup=\"person\">\n <input [(ngModel)]=\"person.name\" name=\"firstName\">\n </div>\n </form>",
  52690. ngModelWithFormGroup: "\n <div [formGroup]=\"myGroup\">\n <input formControlName=\"firstName\">\n <input [(ngModel)]=\"showMoreControls\" [ngModelOptions]=\"{standalone: true}\">\n </div>\n "
  52691. };
  52692. /**
  52693. * @license
  52694. * Copyright Google Inc. All Rights Reserved.
  52695. *
  52696. * Use of this source code is governed by an MIT-style license that can be
  52697. * found in the LICENSE file at https://angular.io/license
  52698. */
  52699. var ReactiveErrors = /** @class */ (function () {
  52700. function ReactiveErrors() {
  52701. }
  52702. ReactiveErrors.controlParentException = function () {
  52703. throw new Error("formControlName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n " + FormErrorExamples.formControlName);
  52704. };
  52705. ReactiveErrors.ngModelGroupException = function () {
  52706. throw new Error("formControlName cannot be used with an ngModelGroup parent. It is only compatible with parents\n that also have a \"form\" prefix: formGroupName, formArrayName, or formGroup.\n\n Option 1: Update the parent to be formGroupName (reactive form strategy)\n\n " + FormErrorExamples.formGroupName + "\n\n Option 2: Use ngModel instead of formControlName (template-driven strategy)\n\n " + FormErrorExamples.ngModelGroup);
  52707. };
  52708. ReactiveErrors.missingFormException = function () {
  52709. throw new Error("formGroup expects a FormGroup instance. Please pass one in.\n\n Example:\n\n " + FormErrorExamples.formControlName);
  52710. };
  52711. ReactiveErrors.groupParentException = function () {
  52712. throw new Error("formGroupName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n " + FormErrorExamples.formGroupName);
  52713. };
  52714. ReactiveErrors.arrayParentException = function () {
  52715. throw new Error("formArrayName must be used with a parent formGroup directive. You'll want to add a formGroup\n directive and pass it an existing FormGroup instance (you can create one in your class).\n\n Example:\n\n " + FormErrorExamples.formArrayName);
  52716. };
  52717. ReactiveErrors.disabledAttrWarning = function () {
  52718. console.warn("\n It looks like you're using the disabled attribute with a reactive form directive. If you set disabled to true\n when you set up this control in your component class, the disabled attribute will actually be set in the DOM for\n you. We recommend using this approach to avoid 'changed after checked' errors.\n \n Example: \n form = new FormGroup({\n first: new FormControl({value: 'Nancy', disabled: true}, Validators.required),\n last: new FormControl('Drew', Validators.required)\n });\n ");
  52719. };
  52720. ReactiveErrors.ngModelWarning = function (directiveName) {
  52721. console.warn("\n It looks like you're using ngModel on the same form field as " + directiveName + ". \n Support for using the ngModel input property and ngModelChange event with \n reactive form directives has been deprecated in Angular v6 and will be removed \n in Angular v7.\n \n For more information on this, see our API docs here:\n https://angular.io/api/forms/" + (directiveName === 'formControl' ? 'FormControlDirective'
  52722. : 'FormControlName') + "#use-with-ngmodel\n ");
  52723. };
  52724. return ReactiveErrors;
  52725. }());
  52726. /**
  52727. * @license
  52728. * Copyright Google Inc. All Rights Reserved.
  52729. *
  52730. * Use of this source code is governed by an MIT-style license that can be
  52731. * found in the LICENSE file at https://angular.io/license
  52732. */
  52733. var SELECT_VALUE_ACCESSOR = {
  52734. provide: NG_VALUE_ACCESSOR,
  52735. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return SelectControlValueAccessor; }),
  52736. multi: true
  52737. };
  52738. function _buildValueString(id, value) {
  52739. if (id == null)
  52740. return "" + value;
  52741. if (value && typeof value === 'object')
  52742. value = 'Object';
  52743. return (id + ": " + value).slice(0, 50);
  52744. }
  52745. function _extractId(valueString) {
  52746. return valueString.split(':')[0];
  52747. }
  52748. /**
  52749. * @description
  52750. *
  52751. * Writes values and listens to changes on a select element.
  52752. *
  52753. * Used by `NgModel`, `FormControlDirective`, and `FormControlName`
  52754. * to keep the view synced with the `FormControl` model.
  52755. *
  52756. * If you have imported the `FormsModule` or the `ReactiveFormsModule`, this
  52757. * value accessor will be active on any select control that has a form directive. You do
  52758. * **not** need to add a special selector to activate it.
  52759. *
  52760. * @usageNotes
  52761. * ### How to use select controls with form directives
  52762. *
  52763. * To use a select in a template-driven form, simply add an `ngModel` and a `name`
  52764. * attribute to the main `<select>` tag.
  52765. *
  52766. * If your option values are simple strings, you can bind to the normal `value` property
  52767. * on the option. If your option values happen to be objects (and you'd like to save the
  52768. * selection in your form as an object), use `ngValue` instead:
  52769. *
  52770. * {@example forms/ts/selectControl/select_control_example.ts region='Component'}
  52771. *
  52772. * In reactive forms, you'll also want to add your form directive (`formControlName` or
  52773. * `formControl`) on the main `<select>` tag. Like in the former example, you have the
  52774. * choice of binding to the `value` or `ngValue` property on the select's options.
  52775. *
  52776. * {@example forms/ts/reactiveSelectControl/reactive_select_control_example.ts region='Component'}
  52777. *
  52778. * ### Caveat: Option selection
  52779. *
  52780. * Angular uses object identity to select option. It's possible for the identities of items
  52781. * to change while the data does not. This can happen, for example, if the items are produced
  52782. * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
  52783. * second response will produce objects with different identities.
  52784. *
  52785. * To customize the default option comparison algorithm, `<select>` supports `compareWith` input.
  52786. * `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
  52787. * If `compareWith` is given, Angular selects option by the return value of the function.
  52788. *
  52789. * ### Syntax
  52790. *
  52791. * ```
  52792. * <select [compareWith]="compareFn" [(ngModel)]="selectedCountries">
  52793. * <option *ngFor="let country of countries" [ngValue]="country">
  52794. * {{country.name}}
  52795. * </option>
  52796. * </select>
  52797. *
  52798. * compareFn(c1: Country, c2: Country): boolean {
  52799. * return c1 && c2 ? c1.id === c2.id : c1 === c2;
  52800. * }
  52801. * ```
  52802. *
  52803. * Note: We listen to the 'change' event because 'input' events aren't fired
  52804. * for selects in Firefox and IE:
  52805. * https://bugzilla.mozilla.org/show_bug.cgi?id=1024350
  52806. * https://developer.microsoft.com/en-us/microsoft-edge/platform/issues/4660045/
  52807. *
  52808. * @ngModule FormsModule
  52809. * @ngModule ReactiveFormsModule
  52810. */
  52811. var SelectControlValueAccessor = /** @class */ (function () {
  52812. function SelectControlValueAccessor(_renderer, _elementRef) {
  52813. this._renderer = _renderer;
  52814. this._elementRef = _elementRef;
  52815. /** @internal */
  52816. this._optionMap = new Map();
  52817. /** @internal */
  52818. this._idCounter = 0;
  52819. this.onChange = function (_) { };
  52820. this.onTouched = function () { };
  52821. this._compareWith = _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵlooseIdentical"];
  52822. }
  52823. Object.defineProperty(SelectControlValueAccessor.prototype, "compareWith", {
  52824. set: function (fn) {
  52825. if (typeof fn !== 'function') {
  52826. throw new Error("compareWith must be a function, but received " + JSON.stringify(fn));
  52827. }
  52828. this._compareWith = fn;
  52829. },
  52830. enumerable: true,
  52831. configurable: true
  52832. });
  52833. SelectControlValueAccessor.prototype.writeValue = function (value) {
  52834. this.value = value;
  52835. var id = this._getOptionId(value);
  52836. if (id == null) {
  52837. this._renderer.setProperty(this._elementRef.nativeElement, 'selectedIndex', -1);
  52838. }
  52839. var valueString = _buildValueString(id, value);
  52840. this._renderer.setProperty(this._elementRef.nativeElement, 'value', valueString);
  52841. };
  52842. SelectControlValueAccessor.prototype.registerOnChange = function (fn) {
  52843. var _this = this;
  52844. this.onChange = function (valueString) {
  52845. _this.value = _this._getOptionValue(valueString);
  52846. fn(_this.value);
  52847. };
  52848. };
  52849. SelectControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  52850. SelectControlValueAccessor.prototype.setDisabledState = function (isDisabled) {
  52851. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  52852. };
  52853. /** @internal */
  52854. SelectControlValueAccessor.prototype._registerOption = function () { return (this._idCounter++).toString(); };
  52855. /** @internal */
  52856. SelectControlValueAccessor.prototype._getOptionId = function (value) {
  52857. var e_1, _a;
  52858. try {
  52859. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(Array.from(this._optionMap.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
  52860. var id = _c.value;
  52861. if (this._compareWith(this._optionMap.get(id), value))
  52862. return id;
  52863. }
  52864. }
  52865. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  52866. finally {
  52867. try {
  52868. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  52869. }
  52870. finally { if (e_1) throw e_1.error; }
  52871. }
  52872. return null;
  52873. };
  52874. /** @internal */
  52875. SelectControlValueAccessor.prototype._getOptionValue = function (valueString) {
  52876. var id = _extractId(valueString);
  52877. return this._optionMap.has(id) ? this._optionMap.get(id) : valueString;
  52878. };
  52879. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52880. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  52881. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Function),
  52882. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Function])
  52883. ], SelectControlValueAccessor.prototype, "compareWith", null);
  52884. SelectControlValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52885. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  52886. selector: 'select:not([multiple])[formControlName],select:not([multiple])[formControl],select:not([multiple])[ngModel]',
  52887. host: { '(change)': 'onChange($event.target.value)', '(blur)': 'onTouched()' },
  52888. providers: [SELECT_VALUE_ACCESSOR]
  52889. }),
  52890. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]])
  52891. ], SelectControlValueAccessor);
  52892. return SelectControlValueAccessor;
  52893. }());
  52894. /**
  52895. * @description
  52896. *
  52897. * Marks `<option>` as dynamic, so Angular can be notified when options change.
  52898. *
  52899. * See docs for `SelectControlValueAccessor` for usage examples.
  52900. *
  52901. * @ngModule FormsModule
  52902. * @ngModule ReactiveFormsModule
  52903. */
  52904. var NgSelectOption = /** @class */ (function () {
  52905. function NgSelectOption(_element, _renderer, _select) {
  52906. this._element = _element;
  52907. this._renderer = _renderer;
  52908. this._select = _select;
  52909. if (this._select)
  52910. this.id = this._select._registerOption();
  52911. }
  52912. Object.defineProperty(NgSelectOption.prototype, "ngValue", {
  52913. set: function (value) {
  52914. if (this._select == null)
  52915. return;
  52916. this._select._optionMap.set(this.id, value);
  52917. this._setElementValue(_buildValueString(this.id, value));
  52918. this._select.writeValue(this._select.value);
  52919. },
  52920. enumerable: true,
  52921. configurable: true
  52922. });
  52923. Object.defineProperty(NgSelectOption.prototype, "value", {
  52924. set: function (value) {
  52925. this._setElementValue(value);
  52926. if (this._select)
  52927. this._select.writeValue(this._select.value);
  52928. },
  52929. enumerable: true,
  52930. configurable: true
  52931. });
  52932. /** @internal */
  52933. NgSelectOption.prototype._setElementValue = function (value) {
  52934. this._renderer.setProperty(this._element.nativeElement, 'value', value);
  52935. };
  52936. NgSelectOption.prototype.ngOnDestroy = function () {
  52937. if (this._select) {
  52938. this._select._optionMap.delete(this.id);
  52939. this._select.writeValue(this._select.value);
  52940. }
  52941. };
  52942. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52943. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngValue'),
  52944. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  52945. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  52946. ], NgSelectOption.prototype, "ngValue", null);
  52947. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52948. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('value'),
  52949. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  52950. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  52951. ], NgSelectOption.prototype, "value", null);
  52952. NgSelectOption = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  52953. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: 'option' }),
  52954. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()),
  52955. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"],
  52956. SelectControlValueAccessor])
  52957. ], NgSelectOption);
  52958. return NgSelectOption;
  52959. }());
  52960. /**
  52961. * @license
  52962. * Copyright Google Inc. All Rights Reserved.
  52963. *
  52964. * Use of this source code is governed by an MIT-style license that can be
  52965. * found in the LICENSE file at https://angular.io/license
  52966. */
  52967. var SELECT_MULTIPLE_VALUE_ACCESSOR = {
  52968. provide: NG_VALUE_ACCESSOR,
  52969. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return SelectMultipleControlValueAccessor; }),
  52970. multi: true
  52971. };
  52972. function _buildValueString$1(id, value) {
  52973. if (id == null)
  52974. return "" + value;
  52975. if (typeof value === 'string')
  52976. value = "'" + value + "'";
  52977. if (value && typeof value === 'object')
  52978. value = 'Object';
  52979. return (id + ": " + value).slice(0, 50);
  52980. }
  52981. function _extractId$1(valueString) {
  52982. return valueString.split(':')[0];
  52983. }
  52984. /**
  52985. * The accessor for writing a value and listening to changes on a select element.
  52986. *
  52987. * @usageNotes
  52988. * ### Caveat: Options selection
  52989. *
  52990. * Angular uses object identity to select options. It's possible for the identities of items
  52991. * to change while the data does not. This can happen, for example, if the items are produced
  52992. * from an RPC to the server, and that RPC is re-run. Even if the data hasn't changed, the
  52993. * second response will produce objects with different identities.
  52994. *
  52995. * To customize the default option comparison algorithm, `<select multiple>` supports `compareWith`
  52996. * input. `compareWith` takes a **function** which has two arguments: `option1` and `option2`.
  52997. * If `compareWith` is given, Angular selects options by the return value of the function.
  52998. *
  52999. * ### Syntax
  53000. *
  53001. * ```
  53002. * <select multiple [compareWith]="compareFn" [(ngModel)]="selectedCountries">
  53003. * <option *ngFor="let country of countries" [ngValue]="country">
  53004. * {{country.name}}
  53005. * </option>
  53006. * </select>
  53007. *
  53008. * compareFn(c1: Country, c2: Country): boolean {
  53009. * return c1 && c2 ? c1.id === c2.id : c1 === c2;
  53010. * }
  53011. * ```
  53012. *
  53013. * @ngModule ReactiveFormsModule
  53014. * @ngModule FormsModule
  53015. */
  53016. var SelectMultipleControlValueAccessor = /** @class */ (function () {
  53017. function SelectMultipleControlValueAccessor(_renderer, _elementRef) {
  53018. this._renderer = _renderer;
  53019. this._elementRef = _elementRef;
  53020. /** @internal */
  53021. this._optionMap = new Map();
  53022. /** @internal */
  53023. this._idCounter = 0;
  53024. this.onChange = function (_) { };
  53025. this.onTouched = function () { };
  53026. this._compareWith = _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵlooseIdentical"];
  53027. }
  53028. Object.defineProperty(SelectMultipleControlValueAccessor.prototype, "compareWith", {
  53029. set: function (fn) {
  53030. if (typeof fn !== 'function') {
  53031. throw new Error("compareWith must be a function, but received " + JSON.stringify(fn));
  53032. }
  53033. this._compareWith = fn;
  53034. },
  53035. enumerable: true,
  53036. configurable: true
  53037. });
  53038. SelectMultipleControlValueAccessor.prototype.writeValue = function (value) {
  53039. var _this = this;
  53040. this.value = value;
  53041. var optionSelectedStateSetter;
  53042. if (Array.isArray(value)) {
  53043. // convert values to ids
  53044. var ids_1 = value.map(function (v) { return _this._getOptionId(v); });
  53045. optionSelectedStateSetter = function (opt, o) { opt._setSelected(ids_1.indexOf(o.toString()) > -1); };
  53046. }
  53047. else {
  53048. optionSelectedStateSetter = function (opt, o) { opt._setSelected(false); };
  53049. }
  53050. this._optionMap.forEach(optionSelectedStateSetter);
  53051. };
  53052. SelectMultipleControlValueAccessor.prototype.registerOnChange = function (fn) {
  53053. var _this = this;
  53054. this.onChange = function (_) {
  53055. var selected = [];
  53056. if (_.hasOwnProperty('selectedOptions')) {
  53057. var options = _.selectedOptions;
  53058. for (var i = 0; i < options.length; i++) {
  53059. var opt = options.item(i);
  53060. var val = _this._getOptionValue(opt.value);
  53061. selected.push(val);
  53062. }
  53063. }
  53064. // Degrade on IE
  53065. else {
  53066. var options = _.options;
  53067. for (var i = 0; i < options.length; i++) {
  53068. var opt = options.item(i);
  53069. if (opt.selected) {
  53070. var val = _this._getOptionValue(opt.value);
  53071. selected.push(val);
  53072. }
  53073. }
  53074. }
  53075. _this.value = selected;
  53076. fn(selected);
  53077. };
  53078. };
  53079. SelectMultipleControlValueAccessor.prototype.registerOnTouched = function (fn) { this.onTouched = fn; };
  53080. SelectMultipleControlValueAccessor.prototype.setDisabledState = function (isDisabled) {
  53081. this._renderer.setProperty(this._elementRef.nativeElement, 'disabled', isDisabled);
  53082. };
  53083. /** @internal */
  53084. SelectMultipleControlValueAccessor.prototype._registerOption = function (value) {
  53085. var id = (this._idCounter++).toString();
  53086. this._optionMap.set(id, value);
  53087. return id;
  53088. };
  53089. /** @internal */
  53090. SelectMultipleControlValueAccessor.prototype._getOptionId = function (value) {
  53091. var e_1, _a;
  53092. try {
  53093. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(Array.from(this._optionMap.keys())), _c = _b.next(); !_c.done; _c = _b.next()) {
  53094. var id = _c.value;
  53095. if (this._compareWith(this._optionMap.get(id)._value, value))
  53096. return id;
  53097. }
  53098. }
  53099. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  53100. finally {
  53101. try {
  53102. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  53103. }
  53104. finally { if (e_1) throw e_1.error; }
  53105. }
  53106. return null;
  53107. };
  53108. /** @internal */
  53109. SelectMultipleControlValueAccessor.prototype._getOptionValue = function (valueString) {
  53110. var id = _extractId$1(valueString);
  53111. return this._optionMap.has(id) ? this._optionMap.get(id)._value : valueString;
  53112. };
  53113. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53114. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  53115. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Function),
  53116. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Function])
  53117. ], SelectMultipleControlValueAccessor.prototype, "compareWith", null);
  53118. SelectMultipleControlValueAccessor = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53119. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  53120. selector: 'select[multiple][formControlName],select[multiple][formControl],select[multiple][ngModel]',
  53121. host: { '(change)': 'onChange($event.target)', '(blur)': 'onTouched()' },
  53122. providers: [SELECT_MULTIPLE_VALUE_ACCESSOR]
  53123. }),
  53124. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]])
  53125. ], SelectMultipleControlValueAccessor);
  53126. return SelectMultipleControlValueAccessor;
  53127. }());
  53128. /**
  53129. * Marks `<option>` as dynamic, so Angular can be notified when options change.
  53130. *
  53131. * @usageNotes
  53132. * ### Example
  53133. *
  53134. * ```
  53135. * <select multiple name="city" ngModel>
  53136. * <option *ngFor="let c of cities" [value]="c"></option>
  53137. * </select>
  53138. * ```
  53139. * @ngModule FormsModule
  53140. * @ngModule ReactiveFormsModule
  53141. */
  53142. var NgSelectMultipleOption = /** @class */ (function () {
  53143. function NgSelectMultipleOption(_element, _renderer, _select) {
  53144. this._element = _element;
  53145. this._renderer = _renderer;
  53146. this._select = _select;
  53147. if (this._select) {
  53148. this.id = this._select._registerOption(this);
  53149. }
  53150. }
  53151. Object.defineProperty(NgSelectMultipleOption.prototype, "ngValue", {
  53152. set: function (value) {
  53153. if (this._select == null)
  53154. return;
  53155. this._value = value;
  53156. this._setElementValue(_buildValueString$1(this.id, value));
  53157. this._select.writeValue(this._select.value);
  53158. },
  53159. enumerable: true,
  53160. configurable: true
  53161. });
  53162. Object.defineProperty(NgSelectMultipleOption.prototype, "value", {
  53163. set: function (value) {
  53164. if (this._select) {
  53165. this._value = value;
  53166. this._setElementValue(_buildValueString$1(this.id, value));
  53167. this._select.writeValue(this._select.value);
  53168. }
  53169. else {
  53170. this._setElementValue(value);
  53171. }
  53172. },
  53173. enumerable: true,
  53174. configurable: true
  53175. });
  53176. /** @internal */
  53177. NgSelectMultipleOption.prototype._setElementValue = function (value) {
  53178. this._renderer.setProperty(this._element.nativeElement, 'value', value);
  53179. };
  53180. /** @internal */
  53181. NgSelectMultipleOption.prototype._setSelected = function (selected) {
  53182. this._renderer.setProperty(this._element.nativeElement, 'selected', selected);
  53183. };
  53184. NgSelectMultipleOption.prototype.ngOnDestroy = function () {
  53185. if (this._select) {
  53186. this._select._optionMap.delete(this.id);
  53187. this._select.writeValue(this._select.value);
  53188. }
  53189. };
  53190. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53191. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngValue'),
  53192. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  53193. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  53194. ], NgSelectMultipleOption.prototype, "ngValue", null);
  53195. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53196. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('value'),
  53197. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  53198. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  53199. ], NgSelectMultipleOption.prototype, "value", null);
  53200. NgSelectMultipleOption = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53201. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: 'option' }),
  53202. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()),
  53203. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"],
  53204. SelectMultipleControlValueAccessor])
  53205. ], NgSelectMultipleOption);
  53206. return NgSelectMultipleOption;
  53207. }());
  53208. /**
  53209. * @license
  53210. * Copyright Google Inc. All Rights Reserved.
  53211. *
  53212. * Use of this source code is governed by an MIT-style license that can be
  53213. * found in the LICENSE file at https://angular.io/license
  53214. */
  53215. function controlPath(name, parent) {
  53216. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(parent.path, [name]);
  53217. }
  53218. function setUpControl(control, dir) {
  53219. if (!control)
  53220. _throwError(dir, 'Cannot find control with');
  53221. if (!dir.valueAccessor)
  53222. _throwError(dir, 'No value accessor for form control with');
  53223. control.validator = Validators.compose([control.validator, dir.validator]);
  53224. control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]);
  53225. dir.valueAccessor.writeValue(control.value);
  53226. setUpViewChangePipeline(control, dir);
  53227. setUpModelChangePipeline(control, dir);
  53228. setUpBlurPipeline(control, dir);
  53229. if (dir.valueAccessor.setDisabledState) {
  53230. control.registerOnDisabledChange(function (isDisabled) { dir.valueAccessor.setDisabledState(isDisabled); });
  53231. }
  53232. // re-run validation when validator binding changes, e.g. minlength=3 -> minlength=4
  53233. dir._rawValidators.forEach(function (validator) {
  53234. if (validator.registerOnValidatorChange)
  53235. validator.registerOnValidatorChange(function () { return control.updateValueAndValidity(); });
  53236. });
  53237. dir._rawAsyncValidators.forEach(function (validator) {
  53238. if (validator.registerOnValidatorChange)
  53239. validator.registerOnValidatorChange(function () { return control.updateValueAndValidity(); });
  53240. });
  53241. }
  53242. function cleanUpControl(control, dir) {
  53243. dir.valueAccessor.registerOnChange(function () { return _noControlError(dir); });
  53244. dir.valueAccessor.registerOnTouched(function () { return _noControlError(dir); });
  53245. dir._rawValidators.forEach(function (validator) {
  53246. if (validator.registerOnValidatorChange) {
  53247. validator.registerOnValidatorChange(null);
  53248. }
  53249. });
  53250. dir._rawAsyncValidators.forEach(function (validator) {
  53251. if (validator.registerOnValidatorChange) {
  53252. validator.registerOnValidatorChange(null);
  53253. }
  53254. });
  53255. if (control)
  53256. control._clearChangeFns();
  53257. }
  53258. function setUpViewChangePipeline(control, dir) {
  53259. dir.valueAccessor.registerOnChange(function (newValue) {
  53260. control._pendingValue = newValue;
  53261. control._pendingChange = true;
  53262. control._pendingDirty = true;
  53263. if (control.updateOn === 'change')
  53264. updateControl(control, dir);
  53265. });
  53266. }
  53267. function setUpBlurPipeline(control, dir) {
  53268. dir.valueAccessor.registerOnTouched(function () {
  53269. control._pendingTouched = true;
  53270. if (control.updateOn === 'blur' && control._pendingChange)
  53271. updateControl(control, dir);
  53272. if (control.updateOn !== 'submit')
  53273. control.markAsTouched();
  53274. });
  53275. }
  53276. function updateControl(control, dir) {
  53277. if (control._pendingDirty)
  53278. control.markAsDirty();
  53279. control.setValue(control._pendingValue, { emitModelToViewChange: false });
  53280. dir.viewToModelUpdate(control._pendingValue);
  53281. control._pendingChange = false;
  53282. }
  53283. function setUpModelChangePipeline(control, dir) {
  53284. control.registerOnChange(function (newValue, emitModelEvent) {
  53285. // control -> view
  53286. dir.valueAccessor.writeValue(newValue);
  53287. // control -> ngModel
  53288. if (emitModelEvent)
  53289. dir.viewToModelUpdate(newValue);
  53290. });
  53291. }
  53292. function setUpFormContainer(control, dir) {
  53293. if (control == null)
  53294. _throwError(dir, 'Cannot find control with');
  53295. control.validator = Validators.compose([control.validator, dir.validator]);
  53296. control.asyncValidator = Validators.composeAsync([control.asyncValidator, dir.asyncValidator]);
  53297. }
  53298. function _noControlError(dir) {
  53299. return _throwError(dir, 'There is no FormControl instance attached to form control element with');
  53300. }
  53301. function _throwError(dir, message) {
  53302. var messageEnd;
  53303. if (dir.path.length > 1) {
  53304. messageEnd = "path: '" + dir.path.join(' -> ') + "'";
  53305. }
  53306. else if (dir.path[0]) {
  53307. messageEnd = "name: '" + dir.path + "'";
  53308. }
  53309. else {
  53310. messageEnd = 'unspecified name attribute';
  53311. }
  53312. throw new Error(message + " " + messageEnd);
  53313. }
  53314. function composeValidators(validators) {
  53315. return validators != null ? Validators.compose(validators.map(normalizeValidator)) : null;
  53316. }
  53317. function composeAsyncValidators(validators) {
  53318. return validators != null ? Validators.composeAsync(validators.map(normalizeAsyncValidator)) :
  53319. null;
  53320. }
  53321. function isPropertyUpdated(changes, viewModel) {
  53322. if (!changes.hasOwnProperty('model'))
  53323. return false;
  53324. var change = changes['model'];
  53325. if (change.isFirstChange())
  53326. return true;
  53327. return !Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵlooseIdentical"])(viewModel, change.currentValue);
  53328. }
  53329. var BUILTIN_ACCESSORS = [
  53330. CheckboxControlValueAccessor,
  53331. RangeValueAccessor,
  53332. NumberValueAccessor,
  53333. SelectControlValueAccessor,
  53334. SelectMultipleControlValueAccessor,
  53335. RadioControlValueAccessor,
  53336. ];
  53337. function isBuiltInAccessor(valueAccessor) {
  53338. return BUILTIN_ACCESSORS.some(function (a) { return valueAccessor.constructor === a; });
  53339. }
  53340. function syncPendingControls(form, directives) {
  53341. form._syncPendingControls();
  53342. directives.forEach(function (dir) {
  53343. var control = dir.control;
  53344. if (control.updateOn === 'submit' && control._pendingChange) {
  53345. dir.viewToModelUpdate(control._pendingValue);
  53346. control._pendingChange = false;
  53347. }
  53348. });
  53349. }
  53350. // TODO: vsavkin remove it once https://github.com/angular/angular/issues/3011 is implemented
  53351. function selectValueAccessor(dir, valueAccessors) {
  53352. if (!valueAccessors)
  53353. return null;
  53354. if (!Array.isArray(valueAccessors))
  53355. _throwError(dir, 'Value accessor was not provided as an array for form control with');
  53356. var defaultAccessor = undefined;
  53357. var builtinAccessor = undefined;
  53358. var customAccessor = undefined;
  53359. valueAccessors.forEach(function (v) {
  53360. if (v.constructor === DefaultValueAccessor) {
  53361. defaultAccessor = v;
  53362. }
  53363. else if (isBuiltInAccessor(v)) {
  53364. if (builtinAccessor)
  53365. _throwError(dir, 'More than one built-in value accessor matches form control with');
  53366. builtinAccessor = v;
  53367. }
  53368. else {
  53369. if (customAccessor)
  53370. _throwError(dir, 'More than one custom value accessor matches form control with');
  53371. customAccessor = v;
  53372. }
  53373. });
  53374. if (customAccessor)
  53375. return customAccessor;
  53376. if (builtinAccessor)
  53377. return builtinAccessor;
  53378. if (defaultAccessor)
  53379. return defaultAccessor;
  53380. _throwError(dir, 'No valid value accessor for form control with');
  53381. return null;
  53382. }
  53383. function removeDir(list, el) {
  53384. var index = list.indexOf(el);
  53385. if (index > -1)
  53386. list.splice(index, 1);
  53387. }
  53388. // TODO(kara): remove after deprecation period
  53389. function _ngModelWarning(name, type, instance, warningConfig) {
  53390. if (!Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() || warningConfig === 'never')
  53391. return;
  53392. if (((warningConfig === null || warningConfig === 'once') && !type._ngModelWarningSentOnce) ||
  53393. (warningConfig === 'always' && !instance._ngModelWarningSent)) {
  53394. ReactiveErrors.ngModelWarning(name);
  53395. type._ngModelWarningSentOnce = true;
  53396. instance._ngModelWarningSent = true;
  53397. }
  53398. }
  53399. /**
  53400. * @license
  53401. * Copyright Google Inc. All Rights Reserved.
  53402. *
  53403. * Use of this source code is governed by an MIT-style license that can be
  53404. * found in the LICENSE file at https://angular.io/license
  53405. */
  53406. /**
  53407. * @description
  53408. * A base class for code shared between the `NgModelGroup` and `FormGroupName` directives.
  53409. *
  53410. */
  53411. var AbstractFormGroupDirective = /** @class */ (function (_super) {
  53412. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(AbstractFormGroupDirective, _super);
  53413. function AbstractFormGroupDirective() {
  53414. return _super !== null && _super.apply(this, arguments) || this;
  53415. }
  53416. /**
  53417. * @description
  53418. * An internal callback method triggered on the instance after the inputs are set.
  53419. * Registers the group with its parent group.
  53420. */
  53421. AbstractFormGroupDirective.prototype.ngOnInit = function () {
  53422. this._checkParentType();
  53423. this.formDirective.addFormGroup(this);
  53424. };
  53425. /**
  53426. * @description
  53427. * An internal callback method triggered before the instance is destroyed.
  53428. * Removes the group from its parent group.
  53429. */
  53430. AbstractFormGroupDirective.prototype.ngOnDestroy = function () {
  53431. if (this.formDirective) {
  53432. this.formDirective.removeFormGroup(this);
  53433. }
  53434. };
  53435. Object.defineProperty(AbstractFormGroupDirective.prototype, "control", {
  53436. /**
  53437. * @description
  53438. * The `FormGroup` bound to this directive.
  53439. */
  53440. get: function () { return this.formDirective.getFormGroup(this); },
  53441. enumerable: true,
  53442. configurable: true
  53443. });
  53444. Object.defineProperty(AbstractFormGroupDirective.prototype, "path", {
  53445. /**
  53446. * @description
  53447. * The path to this group from the top-level directive.
  53448. */
  53449. get: function () { return controlPath(this.name, this._parent); },
  53450. enumerable: true,
  53451. configurable: true
  53452. });
  53453. Object.defineProperty(AbstractFormGroupDirective.prototype, "formDirective", {
  53454. /**
  53455. * @description
  53456. * The top-level directive for this group if present, otherwise null.
  53457. */
  53458. get: function () { return this._parent ? this._parent.formDirective : null; },
  53459. enumerable: true,
  53460. configurable: true
  53461. });
  53462. Object.defineProperty(AbstractFormGroupDirective.prototype, "validator", {
  53463. /**
  53464. * @description
  53465. * The synchronous validators registered with this group.
  53466. */
  53467. get: function () { return composeValidators(this._validators); },
  53468. enumerable: true,
  53469. configurable: true
  53470. });
  53471. Object.defineProperty(AbstractFormGroupDirective.prototype, "asyncValidator", {
  53472. /**
  53473. * @description
  53474. * The async validators registered with this group.
  53475. */
  53476. get: function () {
  53477. return composeAsyncValidators(this._asyncValidators);
  53478. },
  53479. enumerable: true,
  53480. configurable: true
  53481. });
  53482. /** @internal */
  53483. AbstractFormGroupDirective.prototype._checkParentType = function () { };
  53484. return AbstractFormGroupDirective;
  53485. }(ControlContainer));
  53486. /**
  53487. * @license
  53488. * Copyright Google Inc. All Rights Reserved.
  53489. *
  53490. * Use of this source code is governed by an MIT-style license that can be
  53491. * found in the LICENSE file at https://angular.io/license
  53492. */
  53493. var AbstractControlStatus = /** @class */ (function () {
  53494. function AbstractControlStatus(cd) {
  53495. this._cd = cd;
  53496. }
  53497. Object.defineProperty(AbstractControlStatus.prototype, "ngClassUntouched", {
  53498. get: function () { return this._cd.control ? this._cd.control.untouched : false; },
  53499. enumerable: true,
  53500. configurable: true
  53501. });
  53502. Object.defineProperty(AbstractControlStatus.prototype, "ngClassTouched", {
  53503. get: function () { return this._cd.control ? this._cd.control.touched : false; },
  53504. enumerable: true,
  53505. configurable: true
  53506. });
  53507. Object.defineProperty(AbstractControlStatus.prototype, "ngClassPristine", {
  53508. get: function () { return this._cd.control ? this._cd.control.pristine : false; },
  53509. enumerable: true,
  53510. configurable: true
  53511. });
  53512. Object.defineProperty(AbstractControlStatus.prototype, "ngClassDirty", {
  53513. get: function () { return this._cd.control ? this._cd.control.dirty : false; },
  53514. enumerable: true,
  53515. configurable: true
  53516. });
  53517. Object.defineProperty(AbstractControlStatus.prototype, "ngClassValid", {
  53518. get: function () { return this._cd.control ? this._cd.control.valid : false; },
  53519. enumerable: true,
  53520. configurable: true
  53521. });
  53522. Object.defineProperty(AbstractControlStatus.prototype, "ngClassInvalid", {
  53523. get: function () { return this._cd.control ? this._cd.control.invalid : false; },
  53524. enumerable: true,
  53525. configurable: true
  53526. });
  53527. Object.defineProperty(AbstractControlStatus.prototype, "ngClassPending", {
  53528. get: function () { return this._cd.control ? this._cd.control.pending : false; },
  53529. enumerable: true,
  53530. configurable: true
  53531. });
  53532. return AbstractControlStatus;
  53533. }());
  53534. var ngControlStatusHost = {
  53535. '[class.ng-untouched]': 'ngClassUntouched',
  53536. '[class.ng-touched]': 'ngClassTouched',
  53537. '[class.ng-pristine]': 'ngClassPristine',
  53538. '[class.ng-dirty]': 'ngClassDirty',
  53539. '[class.ng-valid]': 'ngClassValid',
  53540. '[class.ng-invalid]': 'ngClassInvalid',
  53541. '[class.ng-pending]': 'ngClassPending',
  53542. };
  53543. /**
  53544. * Directive automatically applied to Angular form controls that sets CSS classes
  53545. * based on control status. The following classes are applied as the properties
  53546. * become true:
  53547. *
  53548. * * ng-valid
  53549. * * ng-invalid
  53550. * * ng-pending
  53551. * * ng-pristine
  53552. * * ng-dirty
  53553. * * ng-untouched
  53554. * * ng-touched
  53555. *
  53556. * @ngModule FormsModule
  53557. * @ngModule ReactiveFormsModule
  53558. */
  53559. var NgControlStatus = /** @class */ (function (_super) {
  53560. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgControlStatus, _super);
  53561. function NgControlStatus(cd) {
  53562. return _super.call(this, cd) || this;
  53563. }
  53564. NgControlStatus = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53565. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: '[formControlName],[ngModel],[formControl]', host: ngControlStatusHost }),
  53566. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()),
  53567. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [NgControl])
  53568. ], NgControlStatus);
  53569. return NgControlStatus;
  53570. }(AbstractControlStatus));
  53571. /**
  53572. * Directive automatically applied to Angular form groups that sets CSS classes
  53573. * based on control status (valid/invalid/dirty/etc).
  53574. *
  53575. * @ngModule FormsModule
  53576. * @ngModule ReactiveFormsModule
  53577. */
  53578. var NgControlStatusGroup = /** @class */ (function (_super) {
  53579. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgControlStatusGroup, _super);
  53580. function NgControlStatusGroup(cd) {
  53581. return _super.call(this, cd) || this;
  53582. }
  53583. NgControlStatusGroup = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  53584. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  53585. selector: '[formGroupName],[formArrayName],[ngModelGroup],[formGroup],form:not([ngNoForm]),[ngForm]',
  53586. host: ngControlStatusHost
  53587. }),
  53588. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()),
  53589. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ControlContainer])
  53590. ], NgControlStatusGroup);
  53591. return NgControlStatusGroup;
  53592. }(AbstractControlStatus));
  53593. /**
  53594. * @license
  53595. * Copyright Google Inc. All Rights Reserved.
  53596. *
  53597. * Use of this source code is governed by an MIT-style license that can be
  53598. * found in the LICENSE file at https://angular.io/license
  53599. */
  53600. /**
  53601. * Reports that a FormControl is valid, meaning that no errors exist in the input value.
  53602. *
  53603. * @see `status`
  53604. */
  53605. var VALID = 'VALID';
  53606. /**
  53607. * Reports that a FormControl is invalid, meaning that an error exists in the input value.
  53608. *
  53609. * @see `status`
  53610. */
  53611. var INVALID = 'INVALID';
  53612. /**
  53613. * Reports that a FormControl is pending, meaning that that async validation is occurring and
  53614. * errors are not yet available for the input value.
  53615. *
  53616. * @see `markAsPending`
  53617. * @see `status`
  53618. */
  53619. var PENDING = 'PENDING';
  53620. /**
  53621. * Reports that a FormControl is disabled, meaning that the control is exempt from ancestor
  53622. * calculations of validity or value.
  53623. *
  53624. * @see `markAsDisabled`
  53625. * @see `status`
  53626. */
  53627. var DISABLED = 'DISABLED';
  53628. function _find(control, path, delimiter) {
  53629. if (path == null)
  53630. return null;
  53631. if (!(path instanceof Array)) {
  53632. path = path.split(delimiter);
  53633. }
  53634. if (path instanceof Array && (path.length === 0))
  53635. return null;
  53636. return path.reduce(function (v, name) {
  53637. if (v instanceof FormGroup) {
  53638. return v.controls.hasOwnProperty(name) ? v.controls[name] : null;
  53639. }
  53640. if (v instanceof FormArray) {
  53641. return v.at(name) || null;
  53642. }
  53643. return null;
  53644. }, control);
  53645. }
  53646. function coerceToValidator(validatorOrOpts) {
  53647. var validator = (isOptionsObj(validatorOrOpts) ? validatorOrOpts.validators :
  53648. validatorOrOpts);
  53649. return Array.isArray(validator) ? composeValidators(validator) : validator || null;
  53650. }
  53651. function coerceToAsyncValidator(asyncValidator, validatorOrOpts) {
  53652. var origAsyncValidator = (isOptionsObj(validatorOrOpts) ? validatorOrOpts.asyncValidators :
  53653. asyncValidator);
  53654. return Array.isArray(origAsyncValidator) ? composeAsyncValidators(origAsyncValidator) :
  53655. origAsyncValidator || null;
  53656. }
  53657. function isOptionsObj(validatorOrOpts) {
  53658. return validatorOrOpts != null && !Array.isArray(validatorOrOpts) &&
  53659. typeof validatorOrOpts === 'object';
  53660. }
  53661. /**
  53662. * This is the base class for `FormControl`, `FormGroup`, and `FormArray`.
  53663. *
  53664. * It provides some of the shared behavior that all controls and groups of controls have, like
  53665. * running validators, calculating status, and resetting state. It also defines the properties
  53666. * that are shared between all sub-classes, like `value`, `valid`, and `dirty`. It shouldn't be
  53667. * instantiated directly.
  53668. *
  53669. * @see [Forms Guide](/guide/forms)
  53670. * @see [Reactive Forms Guide](/guide/reactive-forms)
  53671. * @see [Dynamic Forms Guide](/guide/dynamic-form)
  53672. *
  53673. */
  53674. var AbstractControl = /** @class */ (function () {
  53675. /**
  53676. * Initialize the AbstractControl instance.
  53677. *
  53678. * @param validator The function that determines the synchronous validity of this control.
  53679. * @param asyncValidator The function that determines the asynchronous validity of this
  53680. * control.
  53681. */
  53682. function AbstractControl(validator, asyncValidator) {
  53683. this.validator = validator;
  53684. this.asyncValidator = asyncValidator;
  53685. /** @internal */
  53686. this._onCollectionChange = function () { };
  53687. /**
  53688. * A control is `pristine` if the user has not yet changed
  53689. * the value in the UI.
  53690. *
  53691. * @returns True if the user has not yet changed the value in the UI; compare `dirty`.
  53692. * Programmatic changes to a control's value do not mark it dirty.
  53693. */
  53694. this.pristine = true;
  53695. /**
  53696. * True if the control is marked as `touched`.
  53697. *
  53698. * A control is marked `touched` once the user has triggered
  53699. * a `blur` event on it.
  53700. */
  53701. this.touched = false;
  53702. /** @internal */
  53703. this._onDisabledChange = [];
  53704. }
  53705. Object.defineProperty(AbstractControl.prototype, "parent", {
  53706. /**
  53707. * The parent control.
  53708. */
  53709. get: function () { return this._parent; },
  53710. enumerable: true,
  53711. configurable: true
  53712. });
  53713. Object.defineProperty(AbstractControl.prototype, "valid", {
  53714. /**
  53715. * A control is `valid` when its `status` is `VALID`.
  53716. *
  53717. * @see `status`
  53718. *
  53719. * @returns True if the control has passed all of its validation tests,
  53720. * false otherwise.
  53721. */
  53722. get: function () { return this.status === VALID; },
  53723. enumerable: true,
  53724. configurable: true
  53725. });
  53726. Object.defineProperty(AbstractControl.prototype, "invalid", {
  53727. /**
  53728. * A control is `invalid` when its `status` is `INVALID`.
  53729. *
  53730. * @see `status`
  53731. *
  53732. * @returns True if this control has failed one or more of its validation checks,
  53733. * false otherwise.
  53734. */
  53735. get: function () { return this.status === INVALID; },
  53736. enumerable: true,
  53737. configurable: true
  53738. });
  53739. Object.defineProperty(AbstractControl.prototype, "pending", {
  53740. /**
  53741. * A control is `pending` when its `status` is `PENDING`.
  53742. *
  53743. * @see `status`
  53744. *
  53745. * @returns True if this control is in the process of conducting a validation check,
  53746. * false otherwise.
  53747. */
  53748. get: function () { return this.status == PENDING; },
  53749. enumerable: true,
  53750. configurable: true
  53751. });
  53752. Object.defineProperty(AbstractControl.prototype, "disabled", {
  53753. /**
  53754. * A control is `disabled` when its `status` is `DISABLED`.
  53755. *
  53756. * @see `status`
  53757. *
  53758. * Disabled controls are exempt from validation checks and
  53759. * are not included in the aggregate value of their ancestor
  53760. * controls.
  53761. *
  53762. * @returns True if the control is disabled, false otherwise.
  53763. */
  53764. get: function () { return this.status === DISABLED; },
  53765. enumerable: true,
  53766. configurable: true
  53767. });
  53768. Object.defineProperty(AbstractControl.prototype, "enabled", {
  53769. /**
  53770. * A control is `enabled` as long as its `status` is not `DISABLED`.
  53771. *
  53772. * @see `status`
  53773. *
  53774. * @returns True if the control has any status other than 'DISABLED',
  53775. * false if the status is 'DISABLED'.
  53776. *
  53777. */
  53778. get: function () { return this.status !== DISABLED; },
  53779. enumerable: true,
  53780. configurable: true
  53781. });
  53782. Object.defineProperty(AbstractControl.prototype, "dirty", {
  53783. /**
  53784. * A control is `dirty` if the user has changed the value
  53785. * in the UI.
  53786. *
  53787. * @returns True if the user has changed the value of this control in the UI; compare `pristine`.
  53788. * Programmatic changes to a control's value do not mark it dirty.
  53789. */
  53790. get: function () { return !this.pristine; },
  53791. enumerable: true,
  53792. configurable: true
  53793. });
  53794. Object.defineProperty(AbstractControl.prototype, "untouched", {
  53795. /**
  53796. * True if the control has not been marked as touched
  53797. *
  53798. * A control is `untouched` if the user has not yet triggered
  53799. * a `blur` event on it.
  53800. */
  53801. get: function () { return !this.touched; },
  53802. enumerable: true,
  53803. configurable: true
  53804. });
  53805. Object.defineProperty(AbstractControl.prototype, "updateOn", {
  53806. /**
  53807. * Reports the update strategy of the `AbstractControl` (meaning
  53808. * the event on which the control updates itself).
  53809. * Possible values: `'change'` | `'blur'` | `'submit'`
  53810. * Default value: `'change'`
  53811. */
  53812. get: function () {
  53813. return this._updateOn ? this._updateOn : (this.parent ? this.parent.updateOn : 'change');
  53814. },
  53815. enumerable: true,
  53816. configurable: true
  53817. });
  53818. /**
  53819. * Sets the synchronous validators that are active on this control. Calling
  53820. * this overwrites any existing sync validators.
  53821. */
  53822. AbstractControl.prototype.setValidators = function (newValidator) {
  53823. this.validator = coerceToValidator(newValidator);
  53824. };
  53825. /**
  53826. * Sets the async validators that are active on this control. Calling this
  53827. * overwrites any existing async validators.
  53828. */
  53829. AbstractControl.prototype.setAsyncValidators = function (newValidator) {
  53830. this.asyncValidator = coerceToAsyncValidator(newValidator);
  53831. };
  53832. /**
  53833. * Empties out the sync validator list.
  53834. */
  53835. AbstractControl.prototype.clearValidators = function () { this.validator = null; };
  53836. /**
  53837. * Empties out the async validator list.
  53838. */
  53839. AbstractControl.prototype.clearAsyncValidators = function () { this.asyncValidator = null; };
  53840. /**
  53841. * Marks the control as `touched`. A control is touched by focus and
  53842. * blur events that do not change the value; compare `markAsDirty`;
  53843. *
  53844. * @param opts Configuration options that determine how the control propagates changes
  53845. * and emits events events after marking is applied.
  53846. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53847. * marks all direct ancestors. Default is false.
  53848. */
  53849. AbstractControl.prototype.markAsTouched = function (opts) {
  53850. if (opts === void 0) { opts = {}; }
  53851. this.touched = true;
  53852. if (this._parent && !opts.onlySelf) {
  53853. this._parent.markAsTouched(opts);
  53854. }
  53855. };
  53856. /**
  53857. * Marks the control as `untouched`.
  53858. *
  53859. * If the control has any children, also marks all children as `untouched`
  53860. * and recalculates the `touched` status of all parent controls.
  53861. *
  53862. * @param opts Configuration options that determine how the control propagates changes
  53863. * and emits events after the marking is applied.
  53864. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53865. * marks all direct ancestors. Default is false.
  53866. */
  53867. AbstractControl.prototype.markAsUntouched = function (opts) {
  53868. if (opts === void 0) { opts = {}; }
  53869. this.touched = false;
  53870. this._pendingTouched = false;
  53871. this._forEachChild(function (control) { control.markAsUntouched({ onlySelf: true }); });
  53872. if (this._parent && !opts.onlySelf) {
  53873. this._parent._updateTouched(opts);
  53874. }
  53875. };
  53876. /**
  53877. * Marks the control as `dirty`. A control becomes dirty when
  53878. * the control's is changed through the UI; compare `markAsTouched`.
  53879. *
  53880. * @param opts Configuration options that determine how the control propagates changes
  53881. * and emits events after marking is applied.
  53882. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53883. * marks all direct ancestors. Default is false.
  53884. */
  53885. AbstractControl.prototype.markAsDirty = function (opts) {
  53886. if (opts === void 0) { opts = {}; }
  53887. this.pristine = false;
  53888. if (this._parent && !opts.onlySelf) {
  53889. this._parent.markAsDirty(opts);
  53890. }
  53891. };
  53892. /**
  53893. * Marks the control as `pristine`.
  53894. *
  53895. * If the control has any children, marks all children as `pristine`,
  53896. * and recalculates the `pristine` status of all parent
  53897. * controls.
  53898. *
  53899. * @param opts Configuration options that determine how the control emits events after
  53900. * marking is applied.
  53901. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53902. * marks all direct ancestors. Default is false..
  53903. */
  53904. AbstractControl.prototype.markAsPristine = function (opts) {
  53905. if (opts === void 0) { opts = {}; }
  53906. this.pristine = true;
  53907. this._pendingDirty = false;
  53908. this._forEachChild(function (control) { control.markAsPristine({ onlySelf: true }); });
  53909. if (this._parent && !opts.onlySelf) {
  53910. this._parent._updatePristine(opts);
  53911. }
  53912. };
  53913. /**
  53914. * Marks the control as `pending`.
  53915. *
  53916. * A control is pending while the control performs async validation.
  53917. *
  53918. * @param opts Configuration options that determine how the control propagates changes and
  53919. * emits events after marking is applied.
  53920. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53921. * marks all direct ancestors. Default is false..
  53922. * * `emitEvent`: When true or not supplied (the default), the `statusChanges`
  53923. * observable emits an event with the latest status the control is marked pending.
  53924. * When false, no events are emitted.
  53925. *
  53926. */
  53927. AbstractControl.prototype.markAsPending = function (opts) {
  53928. if (opts === void 0) { opts = {}; }
  53929. this.status = PENDING;
  53930. if (opts.emitEvent !== false) {
  53931. this.statusChanges.emit(this.status);
  53932. }
  53933. if (this._parent && !opts.onlySelf) {
  53934. this._parent.markAsPending(opts);
  53935. }
  53936. };
  53937. /**
  53938. * Disables the control. This means the control is exempt from validation checks and
  53939. * excluded from the aggregate value of any parent. Its status is `DISABLED`.
  53940. *
  53941. * If the control has children, all children are also disabled.
  53942. *
  53943. * @param opts Configuration options that determine how the control propagates
  53944. * changes and emits events after the control is disabled.
  53945. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53946. * marks all direct ancestors. Default is false..
  53947. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  53948. * `valueChanges`
  53949. * observables emit events with the latest status and value when the control is disabled.
  53950. * When false, no events are emitted.
  53951. */
  53952. AbstractControl.prototype.disable = function (opts) {
  53953. if (opts === void 0) { opts = {}; }
  53954. this.status = DISABLED;
  53955. this.errors = null;
  53956. this._forEachChild(function (control) { control.disable(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, opts, { onlySelf: true })); });
  53957. this._updateValue();
  53958. if (opts.emitEvent !== false) {
  53959. this.valueChanges.emit(this.value);
  53960. this.statusChanges.emit(this.status);
  53961. }
  53962. this._updateAncestors(opts);
  53963. this._onDisabledChange.forEach(function (changeFn) { return changeFn(true); });
  53964. };
  53965. /**
  53966. * Enables the control. This means the control is included in validation checks and
  53967. * the aggregate value of its parent. Its status recalculates based on its value and
  53968. * its validators.
  53969. *
  53970. * By default, if the control has children, all children are enabled.
  53971. *
  53972. * @param opts Configure options that control how the control propagates changes and
  53973. * emits events when marked as untouched
  53974. * * `onlySelf`: When true, mark only this control. When false or not supplied,
  53975. * marks all direct ancestors. Default is false..
  53976. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  53977. * `valueChanges`
  53978. * observables emit events with the latest status and value when the control is enabled.
  53979. * When false, no events are emitted.
  53980. */
  53981. AbstractControl.prototype.enable = function (opts) {
  53982. if (opts === void 0) { opts = {}; }
  53983. this.status = VALID;
  53984. this._forEachChild(function (control) { control.enable(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, opts, { onlySelf: true })); });
  53985. this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
  53986. this._updateAncestors(opts);
  53987. this._onDisabledChange.forEach(function (changeFn) { return changeFn(false); });
  53988. };
  53989. AbstractControl.prototype._updateAncestors = function (opts) {
  53990. if (this._parent && !opts.onlySelf) {
  53991. this._parent.updateValueAndValidity(opts);
  53992. this._parent._updatePristine();
  53993. this._parent._updateTouched();
  53994. }
  53995. };
  53996. /**
  53997. * @param parent Sets the parent of the control
  53998. */
  53999. AbstractControl.prototype.setParent = function (parent) { this._parent = parent; };
  54000. /**
  54001. * Recalculates the value and validation status of the control.
  54002. *
  54003. * By default, it also updates the value and validity of its ancestors.
  54004. *
  54005. * @param opts Configuration options determine how the control propagates changes and emits events
  54006. * after updates and validity checks are applied.
  54007. * * `onlySelf`: When true, only update this control. When false or not supplied,
  54008. * update all direct ancestors. Default is false..
  54009. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  54010. * `valueChanges`
  54011. * observables emit events with the latest status and value when the control is updated.
  54012. * When false, no events are emitted.
  54013. */
  54014. AbstractControl.prototype.updateValueAndValidity = function (opts) {
  54015. if (opts === void 0) { opts = {}; }
  54016. this._setInitialStatus();
  54017. this._updateValue();
  54018. if (this.enabled) {
  54019. this._cancelExistingSubscription();
  54020. this.errors = this._runValidator();
  54021. this.status = this._calculateStatus();
  54022. if (this.status === VALID || this.status === PENDING) {
  54023. this._runAsyncValidator(opts.emitEvent);
  54024. }
  54025. }
  54026. if (opts.emitEvent !== false) {
  54027. this.valueChanges.emit(this.value);
  54028. this.statusChanges.emit(this.status);
  54029. }
  54030. if (this._parent && !opts.onlySelf) {
  54031. this._parent.updateValueAndValidity(opts);
  54032. }
  54033. };
  54034. /** @internal */
  54035. AbstractControl.prototype._updateTreeValidity = function (opts) {
  54036. if (opts === void 0) { opts = { emitEvent: true }; }
  54037. this._forEachChild(function (ctrl) { return ctrl._updateTreeValidity(opts); });
  54038. this.updateValueAndValidity({ onlySelf: true, emitEvent: opts.emitEvent });
  54039. };
  54040. AbstractControl.prototype._setInitialStatus = function () {
  54041. this.status = this._allControlsDisabled() ? DISABLED : VALID;
  54042. };
  54043. AbstractControl.prototype._runValidator = function () {
  54044. return this.validator ? this.validator(this) : null;
  54045. };
  54046. AbstractControl.prototype._runAsyncValidator = function (emitEvent) {
  54047. var _this = this;
  54048. if (this.asyncValidator) {
  54049. this.status = PENDING;
  54050. var obs = toObservable(this.asyncValidator(this));
  54051. this._asyncValidationSubscription =
  54052. obs.subscribe(function (errors) { return _this.setErrors(errors, { emitEvent: emitEvent }); });
  54053. }
  54054. };
  54055. AbstractControl.prototype._cancelExistingSubscription = function () {
  54056. if (this._asyncValidationSubscription) {
  54057. this._asyncValidationSubscription.unsubscribe();
  54058. }
  54059. };
  54060. /**
  54061. * Sets errors on a form control when running validations manually, rather than automatically.
  54062. *
  54063. * Calling `setErrors` also updates the validity of the parent control.
  54064. *
  54065. * @usageNotes
  54066. * ### Manually set the errors for a control
  54067. *
  54068. * ```
  54069. * const login = new FormControl('someLogin');
  54070. * login.setErrors({
  54071. * notUnique: true
  54072. * });
  54073. *
  54074. * expect(login.valid).toEqual(false);
  54075. * expect(login.errors).toEqual({ notUnique: true });
  54076. *
  54077. * login.setValue('someOtherLogin');
  54078. *
  54079. * expect(login.valid).toEqual(true);
  54080. * ```
  54081. */
  54082. AbstractControl.prototype.setErrors = function (errors, opts) {
  54083. if (opts === void 0) { opts = {}; }
  54084. this.errors = errors;
  54085. this._updateControlsErrors(opts.emitEvent !== false);
  54086. };
  54087. /**
  54088. * Retrieves a child control given the control's name or path.
  54089. *
  54090. * @param path A dot-delimited string or array of string/number values that define the path to the
  54091. * control.
  54092. *
  54093. * @usageNotes
  54094. * ### Retrieve a nested control
  54095. *
  54096. * For example, to get a `name` control nested within a `person` sub-group:
  54097. *
  54098. * * `this.form.get('person.name');`
  54099. *
  54100. * -OR-
  54101. *
  54102. * * `this.form.get(['person', 'name']);`
  54103. */
  54104. AbstractControl.prototype.get = function (path) { return _find(this, path, '.'); };
  54105. /**
  54106. * Reports error data for a specific error occurring in this control or in another control.
  54107. *
  54108. * @param errorCode The error code for which to retrieve data
  54109. * @param path The path to a control to check. If not supplied, checks for the error in this
  54110. * control.
  54111. *
  54112. * @returns The error data if the control with the given path has the given error, otherwise null
  54113. * or undefined.
  54114. */
  54115. AbstractControl.prototype.getError = function (errorCode, path) {
  54116. var control = path ? this.get(path) : this;
  54117. return control && control.errors ? control.errors[errorCode] : null;
  54118. };
  54119. /**
  54120. * Reports whether the control with the given path has the error specified.
  54121. *
  54122. * @param errorCode The error code for which to retrieve data
  54123. * @param path The path to a control to check. If not supplied, checks for the error in this
  54124. * control.
  54125. * @returns True when the control with the given path has the error, otherwise false.
  54126. */
  54127. AbstractControl.prototype.hasError = function (errorCode, path) { return !!this.getError(errorCode, path); };
  54128. Object.defineProperty(AbstractControl.prototype, "root", {
  54129. /**
  54130. * Retrieves the top-level ancestor of this control.
  54131. */
  54132. get: function () {
  54133. var x = this;
  54134. while (x._parent) {
  54135. x = x._parent;
  54136. }
  54137. return x;
  54138. },
  54139. enumerable: true,
  54140. configurable: true
  54141. });
  54142. /** @internal */
  54143. AbstractControl.prototype._updateControlsErrors = function (emitEvent) {
  54144. this.status = this._calculateStatus();
  54145. if (emitEvent) {
  54146. this.statusChanges.emit(this.status);
  54147. }
  54148. if (this._parent) {
  54149. this._parent._updateControlsErrors(emitEvent);
  54150. }
  54151. };
  54152. /** @internal */
  54153. AbstractControl.prototype._initObservables = function () {
  54154. this.valueChanges = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  54155. this.statusChanges = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  54156. };
  54157. AbstractControl.prototype._calculateStatus = function () {
  54158. if (this._allControlsDisabled())
  54159. return DISABLED;
  54160. if (this.errors)
  54161. return INVALID;
  54162. if (this._anyControlsHaveStatus(PENDING))
  54163. return PENDING;
  54164. if (this._anyControlsHaveStatus(INVALID))
  54165. return INVALID;
  54166. return VALID;
  54167. };
  54168. /** @internal */
  54169. AbstractControl.prototype._anyControlsHaveStatus = function (status) {
  54170. return this._anyControls(function (control) { return control.status === status; });
  54171. };
  54172. /** @internal */
  54173. AbstractControl.prototype._anyControlsDirty = function () {
  54174. return this._anyControls(function (control) { return control.dirty; });
  54175. };
  54176. /** @internal */
  54177. AbstractControl.prototype._anyControlsTouched = function () {
  54178. return this._anyControls(function (control) { return control.touched; });
  54179. };
  54180. /** @internal */
  54181. AbstractControl.prototype._updatePristine = function (opts) {
  54182. if (opts === void 0) { opts = {}; }
  54183. this.pristine = !this._anyControlsDirty();
  54184. if (this._parent && !opts.onlySelf) {
  54185. this._parent._updatePristine(opts);
  54186. }
  54187. };
  54188. /** @internal */
  54189. AbstractControl.prototype._updateTouched = function (opts) {
  54190. if (opts === void 0) { opts = {}; }
  54191. this.touched = this._anyControlsTouched();
  54192. if (this._parent && !opts.onlySelf) {
  54193. this._parent._updateTouched(opts);
  54194. }
  54195. };
  54196. /** @internal */
  54197. AbstractControl.prototype._isBoxedValue = function (formState) {
  54198. return typeof formState === 'object' && formState !== null &&
  54199. Object.keys(formState).length === 2 && 'value' in formState && 'disabled' in formState;
  54200. };
  54201. /** @internal */
  54202. AbstractControl.prototype._registerOnCollectionChange = function (fn) { this._onCollectionChange = fn; };
  54203. /** @internal */
  54204. AbstractControl.prototype._setUpdateStrategy = function (opts) {
  54205. if (isOptionsObj(opts) && opts.updateOn != null) {
  54206. this._updateOn = opts.updateOn;
  54207. }
  54208. };
  54209. return AbstractControl;
  54210. }());
  54211. /**
  54212. * Tracks the value and validation status of an individual form control.
  54213. *
  54214. * This is one of the three fundamental building blocks of Angular forms, along with
  54215. * `FormGroup` and `FormArray`. It extends the `AbstractControl` class that
  54216. * implements most of the base functionality for accessing the value, validation status,
  54217. * user interactions and events.
  54218. *
  54219. * @see `AbstractControl`
  54220. * @see [Reactive Forms Guide](guide/reactive-forms)
  54221. * @see [Usage Notes](#usage-notes)
  54222. *
  54223. * @usageNotes
  54224. *
  54225. * ### Initializing Form Controls
  54226. *
  54227. * Instantiate a `FormControl`, with an initial value.
  54228. *
  54229. * ```ts
  54230. * const control = new FormControl('some value');
  54231. * console.log(control.value); // 'some value'
  54232. *```
  54233. *
  54234. * The following example initializes the control with a form state object. The `value`
  54235. * and `disabled` keys are required in this case.
  54236. *
  54237. * ```ts
  54238. * const control = new FormControl({ value: 'n/a', disabled: true });
  54239. * console.log(control.value); // 'n/a'
  54240. * console.log(control.status); // 'DISABLED'
  54241. * ```
  54242. *
  54243. * The following example initializes the control with a sync validator.
  54244. *
  54245. * ```ts
  54246. * const control = new FormControl('', Validators.required);
  54247. * console.log(control.value); // ''
  54248. * console.log(control.status); // 'INVALID'
  54249. * ```
  54250. *
  54251. * The following example initializes the control using an options object.
  54252. *
  54253. * ```ts
  54254. * const control = new FormControl('', {
  54255. * validators: Validators.required,
  54256. * asyncValidators: myAsyncValidator
  54257. * });
  54258. * ```
  54259. *
  54260. * ### Configure the control to update on a blur event
  54261. *
  54262. * Set the `updateOn` option to `'blur'` to update on the blur `event`.
  54263. *
  54264. * ```ts
  54265. * const control = new FormControl('', { updateOn: 'blur' });
  54266. * ```
  54267. *
  54268. * ### Configure the control to update on a submit event
  54269. *
  54270. * Set the `updateOn` option to `'submit'` to update on a submit `event`.
  54271. *
  54272. * ```ts
  54273. * const control = new FormControl('', { updateOn: 'submit' });
  54274. * ```
  54275. *
  54276. * ### Reset the control back to an initial value
  54277. *
  54278. * You reset to a specific form state by passing through a standalone
  54279. * value or a form state object that contains both a value and a disabled state
  54280. * (these are the only two properties that cannot be calculated).
  54281. *
  54282. * ```ts
  54283. * const control = new FormControl('Nancy');
  54284. *
  54285. * console.log(control.value); // 'Nancy'
  54286. *
  54287. * control.reset('Drew');
  54288. *
  54289. * console.log(control.value); // 'Drew'
  54290. * ```
  54291. *
  54292. * ### Reset the control back to an initial value and disabled
  54293. *
  54294. * ```
  54295. * const control = new FormControl('Nancy');
  54296. *
  54297. * console.log(control.value); // 'Nancy'
  54298. * console.log(control.status); // 'VALID'
  54299. *
  54300. * control.reset({ value: 'Drew', disabled: true });
  54301. *
  54302. * console.log(control.value); // 'Drew'
  54303. * console.log(control.status); // 'DISABLED'
  54304. *
  54305. */
  54306. var FormControl = /** @class */ (function (_super) {
  54307. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormControl, _super);
  54308. /**
  54309. * Creates a new `FormControl` instance.
  54310. *
  54311. * @param formState Initializes the control with an initial value,
  54312. * or an object that defines the initial value and disabled state.
  54313. *
  54314. * @param validatorOrOpts A synchronous validator function, or an array of
  54315. * such functions, or an `AbstractControlOptions` object that contains validation functions
  54316. * and a validation trigger.
  54317. *
  54318. * @param asyncValidator A single async validator or array of async validator functions
  54319. *
  54320. */
  54321. function FormControl(formState, validatorOrOpts, asyncValidator) {
  54322. if (formState === void 0) { formState = null; }
  54323. var _this = _super.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)) || this;
  54324. /** @internal */
  54325. _this._onChange = [];
  54326. _this._applyFormState(formState);
  54327. _this._setUpdateStrategy(validatorOrOpts);
  54328. _this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
  54329. _this._initObservables();
  54330. return _this;
  54331. }
  54332. /**
  54333. * Sets a new value for the form control.
  54334. *
  54335. * @param value The new value for the control.
  54336. * @param options Configuration options that determine how the control proopagates changes
  54337. * and emits events when the value changes.
  54338. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  54339. * updateValueAndValidity} method.
  54340. *
  54341. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
  54342. * false.
  54343. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  54344. * `valueChanges`
  54345. * observables emit events with the latest status and value when the control value is updated.
  54346. * When false, no events are emitted.
  54347. * * `emitModelToViewChange`: When true or not supplied (the default), each change triggers an
  54348. * `onChange` event to
  54349. * update the view.
  54350. * * `emitViewToModelChange`: When true or not supplied (the default), each change triggers an
  54351. * `ngModelChange`
  54352. * event to update the model.
  54353. *
  54354. */
  54355. FormControl.prototype.setValue = function (value, options) {
  54356. var _this = this;
  54357. if (options === void 0) { options = {}; }
  54358. this.value = this._pendingValue = value;
  54359. if (this._onChange.length && options.emitModelToViewChange !== false) {
  54360. this._onChange.forEach(function (changeFn) { return changeFn(_this.value, options.emitViewToModelChange !== false); });
  54361. }
  54362. this.updateValueAndValidity(options);
  54363. };
  54364. /**
  54365. * Patches the value of a control.
  54366. *
  54367. * This function is functionally the same as {@link FormControl#setValue setValue} at this level.
  54368. * It exists for symmetry with {@link FormGroup#patchValue patchValue} on `FormGroups` and
  54369. * `FormArrays`, where it does behave differently.
  54370. *
  54371. * @see `setValue` for options
  54372. */
  54373. FormControl.prototype.patchValue = function (value, options) {
  54374. if (options === void 0) { options = {}; }
  54375. this.setValue(value, options);
  54376. };
  54377. /**
  54378. * Resets the form control, marking it `pristine` and `untouched`, and setting
  54379. * the value to null.
  54380. *
  54381. * @param formState Resets the control with an initial value,
  54382. * or an object that defines the initial value and disabled state.
  54383. *
  54384. * @param options Configuration options that determine how the control propagates changes
  54385. * and emits events after the value changes.
  54386. *
  54387. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
  54388. * false.
  54389. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  54390. * `valueChanges`
  54391. * observables emit events with the latest status and value when the control is reset.
  54392. * When false, no events are emitted.
  54393. *
  54394. */
  54395. FormControl.prototype.reset = function (formState, options) {
  54396. if (formState === void 0) { formState = null; }
  54397. if (options === void 0) { options = {}; }
  54398. this._applyFormState(formState);
  54399. this.markAsPristine(options);
  54400. this.markAsUntouched(options);
  54401. this.setValue(this.value, options);
  54402. this._pendingChange = false;
  54403. };
  54404. /**
  54405. * @internal
  54406. */
  54407. FormControl.prototype._updateValue = function () { };
  54408. /**
  54409. * @internal
  54410. */
  54411. FormControl.prototype._anyControls = function (condition) { return false; };
  54412. /**
  54413. * @internal
  54414. */
  54415. FormControl.prototype._allControlsDisabled = function () { return this.disabled; };
  54416. /**
  54417. * Register a listener for change events.
  54418. *
  54419. * @param fn The method that is called when the value changes
  54420. */
  54421. FormControl.prototype.registerOnChange = function (fn) { this._onChange.push(fn); };
  54422. /**
  54423. * @internal
  54424. */
  54425. FormControl.prototype._clearChangeFns = function () {
  54426. this._onChange = [];
  54427. this._onDisabledChange = [];
  54428. this._onCollectionChange = function () { };
  54429. };
  54430. /**
  54431. * Register a listener for disabled events.
  54432. *
  54433. * @param fn The method that is called when the disabled status changes.
  54434. */
  54435. FormControl.prototype.registerOnDisabledChange = function (fn) {
  54436. this._onDisabledChange.push(fn);
  54437. };
  54438. /**
  54439. * @internal
  54440. */
  54441. FormControl.prototype._forEachChild = function (cb) { };
  54442. /** @internal */
  54443. FormControl.prototype._syncPendingControls = function () {
  54444. if (this.updateOn === 'submit') {
  54445. if (this._pendingDirty)
  54446. this.markAsDirty();
  54447. if (this._pendingTouched)
  54448. this.markAsTouched();
  54449. if (this._pendingChange) {
  54450. this.setValue(this._pendingValue, { onlySelf: true, emitModelToViewChange: false });
  54451. return true;
  54452. }
  54453. }
  54454. return false;
  54455. };
  54456. FormControl.prototype._applyFormState = function (formState) {
  54457. if (this._isBoxedValue(formState)) {
  54458. this.value = this._pendingValue = formState.value;
  54459. formState.disabled ? this.disable({ onlySelf: true, emitEvent: false }) :
  54460. this.enable({ onlySelf: true, emitEvent: false });
  54461. }
  54462. else {
  54463. this.value = this._pendingValue = formState;
  54464. }
  54465. };
  54466. return FormControl;
  54467. }(AbstractControl));
  54468. /**
  54469. * Tracks the value and validity state of a group of `FormControl` instances.
  54470. *
  54471. * A `FormGroup` aggregates the values of each child `FormControl` into one object,
  54472. * with each control name as the key. It calculates its status by reducing the status values
  54473. * of its children. For example, if one of the controls in a group is invalid, the entire
  54474. * group becomes invalid.
  54475. *
  54476. * `FormGroup` is one of the three fundamental building blocks used to define forms in Angular,
  54477. * along with `FormControl` and `FormArray`.
  54478. *
  54479. * When instantiating a `FormGroup`, pass in a collection of child controls as the first
  54480. * argument. The key for each child registers the name for the control.
  54481. *
  54482. * @usageNotes
  54483. *
  54484. * ### Create a form group with 2 controls
  54485. *
  54486. * ```
  54487. * const form = new FormGroup({
  54488. * first: new FormControl('Nancy', Validators.minLength(2)),
  54489. * last: new FormControl('Drew'),
  54490. * });
  54491. *
  54492. * console.log(form.value); // {first: 'Nancy', last; 'Drew'}
  54493. * console.log(form.status); // 'VALID'
  54494. * ```
  54495. *
  54496. * ### Create a form group with a group-level validator
  54497. *
  54498. * You include group-level validators as the second arg, or group-level async
  54499. * validators as the third arg. These come in handy when you want to perform validation
  54500. * that considers the value of more than one child control.
  54501. *
  54502. * ```
  54503. * const form = new FormGroup({
  54504. * password: new FormControl('', Validators.minLength(2)),
  54505. * passwordConfirm: new FormControl('', Validators.minLength(2)),
  54506. * }, passwordMatchValidator);
  54507. *
  54508. *
  54509. * function passwordMatchValidator(g: FormGroup) {
  54510. * return g.get('password').value === g.get('passwordConfirm').value
  54511. * ? null : {'mismatch': true};
  54512. * }
  54513. * ```
  54514. *
  54515. * Like `FormControl` instances, you choose to pass in
  54516. * validators and async validators as part of an options object.
  54517. *
  54518. * ```
  54519. * const form = new FormGroup({
  54520. * password: new FormControl('')
  54521. * passwordConfirm: new FormControl('')
  54522. * }, { validators: passwordMatchValidator, asyncValidators: otherValidator });
  54523. * ```
  54524. *
  54525. * ### Set the updateOn property for all controls in a form group
  54526. *
  54527. * The options object is used to set a default value for each child
  54528. * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
  54529. * group level, all child controls default to 'blur', unless the child
  54530. * has explicitly specified a different `updateOn` value.
  54531. *
  54532. * ```ts
  54533. * const c = new FormGroup({
  54534. * one: new FormControl()
  54535. * }, { updateOn: 'blur' });
  54536. * ```
  54537. */
  54538. var FormGroup = /** @class */ (function (_super) {
  54539. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormGroup, _super);
  54540. /**
  54541. * Creates a new `FormGroup` instance.
  54542. *
  54543. * @param controls A collection of child controls. The key for each child is the name
  54544. * under which it is registered.
  54545. *
  54546. * @param validatorOrOpts A synchronous validator function, or an array of
  54547. * such functions, or an `AbstractControlOptions` object that contains validation functions
  54548. * and a validation trigger.
  54549. *
  54550. * @param asyncValidator A single async validator or array of async validator functions
  54551. *
  54552. */
  54553. function FormGroup(controls, validatorOrOpts, asyncValidator) {
  54554. var _this = _super.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)) || this;
  54555. _this.controls = controls;
  54556. _this._initObservables();
  54557. _this._setUpdateStrategy(validatorOrOpts);
  54558. _this._setUpControls();
  54559. _this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
  54560. return _this;
  54561. }
  54562. /**
  54563. * Registers a control with the group's list of controls.
  54564. *
  54565. * This method does not update the value or validity of the control.
  54566. * Use {@link FormGroup#addControl addControl} instead.
  54567. *
  54568. * @param name The control name to register in the collection
  54569. * @param control Provides the control for the given name
  54570. */
  54571. FormGroup.prototype.registerControl = function (name, control) {
  54572. if (this.controls[name])
  54573. return this.controls[name];
  54574. this.controls[name] = control;
  54575. control.setParent(this);
  54576. control._registerOnCollectionChange(this._onCollectionChange);
  54577. return control;
  54578. };
  54579. /**
  54580. * Add a control to this group.
  54581. *
  54582. * This method also updates the value and validity of the control.
  54583. *
  54584. * @param name The control name to add to the collection
  54585. * @param control Provides the control for the given name
  54586. */
  54587. FormGroup.prototype.addControl = function (name, control) {
  54588. this.registerControl(name, control);
  54589. this.updateValueAndValidity();
  54590. this._onCollectionChange();
  54591. };
  54592. /**
  54593. * Remove a control from this group.
  54594. *
  54595. * @param name The control name to remove from the collection
  54596. */
  54597. FormGroup.prototype.removeControl = function (name) {
  54598. if (this.controls[name])
  54599. this.controls[name]._registerOnCollectionChange(function () { });
  54600. delete (this.controls[name]);
  54601. this.updateValueAndValidity();
  54602. this._onCollectionChange();
  54603. };
  54604. /**
  54605. * Replace an existing control.
  54606. *
  54607. * @param name The control name to replace in the collection
  54608. * @param control Provides the control for the given name
  54609. */
  54610. FormGroup.prototype.setControl = function (name, control) {
  54611. if (this.controls[name])
  54612. this.controls[name]._registerOnCollectionChange(function () { });
  54613. delete (this.controls[name]);
  54614. if (control)
  54615. this.registerControl(name, control);
  54616. this.updateValueAndValidity();
  54617. this._onCollectionChange();
  54618. };
  54619. /**
  54620. * Check whether there is an enabled control with the given name in the group.
  54621. *
  54622. * Reports false for disabled controls. If you'd like to check for existence in the group
  54623. * only, use {@link AbstractControl#get get} instead.
  54624. *
  54625. * @param name The control name to check for existence in the collection
  54626. *
  54627. * @returns false for disabled controls, true otherwise.
  54628. */
  54629. FormGroup.prototype.contains = function (controlName) {
  54630. return this.controls.hasOwnProperty(controlName) && this.controls[controlName].enabled;
  54631. };
  54632. /**
  54633. * Sets the value of the `FormGroup`. It accepts an object that matches
  54634. * the structure of the group, with control names as keys.
  54635. *
  54636. * @usageNotes
  54637. * ### Set the complete value for the form group
  54638. *
  54639. * ```
  54640. * const form = new FormGroup({
  54641. * first: new FormControl(),
  54642. * last: new FormControl()
  54643. * });
  54644. *
  54645. * console.log(form.value); // {first: null, last: null}
  54646. *
  54647. * form.setValue({first: 'Nancy', last: 'Drew'});
  54648. * console.log(form.value); // {first: 'Nancy', last: 'Drew'}
  54649. * ```
  54650. *
  54651. * @throws When strict checks fail, such as setting the value of a control
  54652. * that doesn't exist or if you excluding the value of a control.
  54653. *
  54654. * @param value The new value for the control that matches the structure of the group.
  54655. * @param options Configuration options that determine how the control propagates changes
  54656. * and emits events after the value changes.
  54657. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  54658. * updateValueAndValidity} method.
  54659. *
  54660. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
  54661. * false.
  54662. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  54663. * `valueChanges`
  54664. * observables emit events with the latest status and value when the control value is updated.
  54665. * When false, no events are emitted.
  54666. */
  54667. FormGroup.prototype.setValue = function (value, options) {
  54668. var _this = this;
  54669. if (options === void 0) { options = {}; }
  54670. this._checkAllValuesPresent(value);
  54671. Object.keys(value).forEach(function (name) {
  54672. _this._throwIfControlMissing(name);
  54673. _this.controls[name].setValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
  54674. });
  54675. this.updateValueAndValidity(options);
  54676. };
  54677. /**
  54678. * Patches the value of the `FormGroup`. It accepts an object with control
  54679. * names as keys, and does its best to match the values to the correct controls
  54680. * in the group.
  54681. *
  54682. * It accepts both super-sets and sub-sets of the group without throwing an error.
  54683. *
  54684. * @usageNotes
  54685. * ### Patch the value for a form group
  54686. *
  54687. * ```
  54688. * const form = new FormGroup({
  54689. * first: new FormControl(),
  54690. * last: new FormControl()
  54691. * });
  54692. * console.log(form.value); // {first: null, last: null}
  54693. *
  54694. * form.patchValue({first: 'Nancy'});
  54695. * console.log(form.value); // {first: 'Nancy', last: null}
  54696. * ```
  54697. *
  54698. * @param value The object that matches the structure of the group.
  54699. * @param options Configuration options that determine how the control propagates changes and
  54700. * emits events after the value is patched.
  54701. * * `onlySelf`: When true, each change only affects this control and not its parent. Default is
  54702. * true.
  54703. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  54704. * `valueChanges`
  54705. * observables emit events with the latest status and value when the control value is updated.
  54706. * When false, no events are emitted.
  54707. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  54708. * updateValueAndValidity} method.
  54709. */
  54710. FormGroup.prototype.patchValue = function (value, options) {
  54711. var _this = this;
  54712. if (options === void 0) { options = {}; }
  54713. Object.keys(value).forEach(function (name) {
  54714. if (_this.controls[name]) {
  54715. _this.controls[name].patchValue(value[name], { onlySelf: true, emitEvent: options.emitEvent });
  54716. }
  54717. });
  54718. this.updateValueAndValidity(options);
  54719. };
  54720. /**
  54721. * Resets the `FormGroup`, marks all descendants are marked `pristine` and `untouched`, and
  54722. * the value of all descendants to null.
  54723. *
  54724. * You reset to a specific form state by passing in a map of states
  54725. * that matches the structure of your form, with control names as keys. The state
  54726. * is a standalone value or a form state object with both a value and a disabled
  54727. * status.
  54728. *
  54729. * @param formState Resets the control with an initial value,
  54730. * or an object that defines the initial value and disabled state.
  54731. *
  54732. * @param options Configuration options that determine how the control propagates changes
  54733. * and emits events when the group is reset.
  54734. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default is
  54735. * false.
  54736. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  54737. * `valueChanges`
  54738. * observables emit events with the latest status and value when the control is reset.
  54739. * When false, no events are emitted.
  54740. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  54741. * updateValueAndValidity} method.
  54742. *
  54743. * @usageNotes
  54744. *
  54745. * ### Reset the form group values
  54746. *
  54747. * ```ts
  54748. * const form = new FormGroup({
  54749. * first: new FormControl('first name'),
  54750. * last: new FormControl('last name')
  54751. * });
  54752. *
  54753. * console.log(form.value); // {first: 'first name', last: 'last name'}
  54754. *
  54755. * form.reset({ first: 'name', last: 'last name' });
  54756. *
  54757. * console.log(form.value); // {first: 'name', last: 'last name'}
  54758. * ```
  54759. *
  54760. * ### Reset the form group values and disabled status
  54761. *
  54762. * ```
  54763. * const form = new FormGroup({
  54764. * first: new FormControl('first name'),
  54765. * last: new FormControl('last name')
  54766. * });
  54767. *
  54768. * form.reset({
  54769. * first: {value: 'name', disabled: true},
  54770. * last: 'last'
  54771. * });
  54772. *
  54773. * console.log(this.form.value); // {first: 'name', last: 'last name'}
  54774. * console.log(this.form.get('first').status); // 'DISABLED'
  54775. * ```
  54776. */
  54777. FormGroup.prototype.reset = function (value, options) {
  54778. if (value === void 0) { value = {}; }
  54779. if (options === void 0) { options = {}; }
  54780. this._forEachChild(function (control, name) {
  54781. control.reset(value[name], { onlySelf: true, emitEvent: options.emitEvent });
  54782. });
  54783. this.updateValueAndValidity(options);
  54784. this._updatePristine(options);
  54785. this._updateTouched(options);
  54786. };
  54787. /**
  54788. * The aggregate value of the `FormGroup`, including any disabled controls.
  54789. *
  54790. * Retrieves all values regardless of disabled status.
  54791. * The `value` property is the best way to get the value of the group, because
  54792. * it excludes disabled controls in the `FormGroup`.
  54793. */
  54794. FormGroup.prototype.getRawValue = function () {
  54795. return this._reduceChildren({}, function (acc, control, name) {
  54796. acc[name] = control instanceof FormControl ? control.value : control.getRawValue();
  54797. return acc;
  54798. });
  54799. };
  54800. /** @internal */
  54801. FormGroup.prototype._syncPendingControls = function () {
  54802. var subtreeUpdated = this._reduceChildren(false, function (updated, child) {
  54803. return child._syncPendingControls() ? true : updated;
  54804. });
  54805. if (subtreeUpdated)
  54806. this.updateValueAndValidity({ onlySelf: true });
  54807. return subtreeUpdated;
  54808. };
  54809. /** @internal */
  54810. FormGroup.prototype._throwIfControlMissing = function (name) {
  54811. if (!Object.keys(this.controls).length) {
  54812. throw new Error("\n There are no form controls registered with this group yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");
  54813. }
  54814. if (!this.controls[name]) {
  54815. throw new Error("Cannot find form control with name: " + name + ".");
  54816. }
  54817. };
  54818. /** @internal */
  54819. FormGroup.prototype._forEachChild = function (cb) {
  54820. var _this = this;
  54821. Object.keys(this.controls).forEach(function (k) { return cb(_this.controls[k], k); });
  54822. };
  54823. /** @internal */
  54824. FormGroup.prototype._setUpControls = function () {
  54825. var _this = this;
  54826. this._forEachChild(function (control) {
  54827. control.setParent(_this);
  54828. control._registerOnCollectionChange(_this._onCollectionChange);
  54829. });
  54830. };
  54831. /** @internal */
  54832. FormGroup.prototype._updateValue = function () { this.value = this._reduceValue(); };
  54833. /** @internal */
  54834. FormGroup.prototype._anyControls = function (condition) {
  54835. var _this = this;
  54836. var res = false;
  54837. this._forEachChild(function (control, name) {
  54838. res = res || (_this.contains(name) && condition(control));
  54839. });
  54840. return res;
  54841. };
  54842. /** @internal */
  54843. FormGroup.prototype._reduceValue = function () {
  54844. var _this = this;
  54845. return this._reduceChildren({}, function (acc, control, name) {
  54846. if (control.enabled || _this.disabled) {
  54847. acc[name] = control.value;
  54848. }
  54849. return acc;
  54850. });
  54851. };
  54852. /** @internal */
  54853. FormGroup.prototype._reduceChildren = function (initValue, fn) {
  54854. var res = initValue;
  54855. this._forEachChild(function (control, name) { res = fn(res, control, name); });
  54856. return res;
  54857. };
  54858. /** @internal */
  54859. FormGroup.prototype._allControlsDisabled = function () {
  54860. var e_1, _a;
  54861. try {
  54862. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(Object.keys(this.controls)), _c = _b.next(); !_c.done; _c = _b.next()) {
  54863. var controlName = _c.value;
  54864. if (this.controls[controlName].enabled) {
  54865. return false;
  54866. }
  54867. }
  54868. }
  54869. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  54870. finally {
  54871. try {
  54872. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  54873. }
  54874. finally { if (e_1) throw e_1.error; }
  54875. }
  54876. return Object.keys(this.controls).length > 0 || this.disabled;
  54877. };
  54878. /** @internal */
  54879. FormGroup.prototype._checkAllValuesPresent = function (value) {
  54880. this._forEachChild(function (control, name) {
  54881. if (value[name] === undefined) {
  54882. throw new Error("Must supply a value for form control with name: '" + name + "'.");
  54883. }
  54884. });
  54885. };
  54886. return FormGroup;
  54887. }(AbstractControl));
  54888. /**
  54889. * Tracks the value and validity state of an array of `FormControl`,
  54890. * `FormGroup` or `FormArray` instances.
  54891. *
  54892. * A `FormArray` aggregates the values of each child `FormControl` into an array.
  54893. * It calculates its status by reducing the status values of its children. For example, if one of
  54894. * the controls in a `FormArray` is invalid, the entire array becomes invalid.
  54895. *
  54896. * `FormArray` is one of the three fundamental building blocks used to define forms in Angular,
  54897. * along with `FormControl` and `FormGroup`.
  54898. *
  54899. * @usageNotes
  54900. *
  54901. * ### Create an array of form controls
  54902. *
  54903. * ```
  54904. * const arr = new FormArray([
  54905. * new FormControl('Nancy', Validators.minLength(2)),
  54906. * new FormControl('Drew'),
  54907. * ]);
  54908. *
  54909. * console.log(arr.value); // ['Nancy', 'Drew']
  54910. * console.log(arr.status); // 'VALID'
  54911. * ```
  54912. *
  54913. * ### Create a form array with array-level validators
  54914. *
  54915. * You include array-level validators and async validators. These come in handy
  54916. * when you want to perform validation that considers the value of more than one child
  54917. * control.
  54918. *
  54919. * The two types of validators are passed in separately as the second and third arg
  54920. * respectively, or together as part of an options object.
  54921. *
  54922. * ```
  54923. * const arr = new FormArray([
  54924. * new FormControl('Nancy'),
  54925. * new FormControl('Drew')
  54926. * ], {validators: myValidator, asyncValidators: myAsyncValidator});
  54927. * ```
  54928. *
  54929. * ### Set the updateOn property for all controls in a form array
  54930. *
  54931. * The options object is used to set a default value for each child
  54932. * control's `updateOn` property. If you set `updateOn` to `'blur'` at the
  54933. * array level, all child controls default to 'blur', unless the child
  54934. * has explicitly specified a different `updateOn` value.
  54935. *
  54936. * ```ts
  54937. * const arr = new FormArray([
  54938. * new FormControl()
  54939. * ], {updateOn: 'blur'});
  54940. * ```
  54941. *
  54942. * ### Adding or removing controls from a form array
  54943. *
  54944. * To change the controls in the array, use the `push`, `insert`, or `removeAt` methods
  54945. * in `FormArray` itself. These methods ensure the controls are properly tracked in the
  54946. * form's hierarchy. Do not modify the array of `AbstractControl`s used to instantiate
  54947. * the `FormArray` directly, as that result in strange and unexpected behavior such
  54948. * as broken change detection.
  54949. *
  54950. *
  54951. */
  54952. var FormArray = /** @class */ (function (_super) {
  54953. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormArray, _super);
  54954. /**
  54955. * Creates a new `FormArray` instance.
  54956. *
  54957. * @param controls An array of child controls. Each child control is given an index
  54958. * where it is registered.
  54959. *
  54960. * @param validatorOrOpts A synchronous validator function, or an array of
  54961. * such functions, or an `AbstractControlOptions` object that contains validation functions
  54962. * and a validation trigger.
  54963. *
  54964. * @param asyncValidator A single async validator or array of async validator functions
  54965. *
  54966. */
  54967. function FormArray(controls, validatorOrOpts, asyncValidator) {
  54968. var _this = _super.call(this, coerceToValidator(validatorOrOpts), coerceToAsyncValidator(asyncValidator, validatorOrOpts)) || this;
  54969. _this.controls = controls;
  54970. _this._initObservables();
  54971. _this._setUpdateStrategy(validatorOrOpts);
  54972. _this._setUpControls();
  54973. _this.updateValueAndValidity({ onlySelf: true, emitEvent: false });
  54974. return _this;
  54975. }
  54976. /**
  54977. * Get the `AbstractControl` at the given `index` in the array.
  54978. *
  54979. * @param index Index in the array to retrieve the control
  54980. */
  54981. FormArray.prototype.at = function (index) { return this.controls[index]; };
  54982. /**
  54983. * Insert a new `AbstractControl` at the end of the array.
  54984. *
  54985. * @param control Form control to be inserted
  54986. */
  54987. FormArray.prototype.push = function (control) {
  54988. this.controls.push(control);
  54989. this._registerControl(control);
  54990. this.updateValueAndValidity();
  54991. this._onCollectionChange();
  54992. };
  54993. /**
  54994. * Insert a new `AbstractControl` at the given `index` in the array.
  54995. *
  54996. * @param index Index in the array to insert the control
  54997. * @param control Form control to be inserted
  54998. */
  54999. FormArray.prototype.insert = function (index, control) {
  55000. this.controls.splice(index, 0, control);
  55001. this._registerControl(control);
  55002. this.updateValueAndValidity();
  55003. };
  55004. /**
  55005. * Remove the control at the given `index` in the array.
  55006. *
  55007. * @param index Index in the array to remove the control
  55008. */
  55009. FormArray.prototype.removeAt = function (index) {
  55010. if (this.controls[index])
  55011. this.controls[index]._registerOnCollectionChange(function () { });
  55012. this.controls.splice(index, 1);
  55013. this.updateValueAndValidity();
  55014. };
  55015. /**
  55016. * Replace an existing control.
  55017. *
  55018. * @param index Index in the array to replace the control
  55019. * @param control The `AbstractControl` control to replace the existing control
  55020. */
  55021. FormArray.prototype.setControl = function (index, control) {
  55022. if (this.controls[index])
  55023. this.controls[index]._registerOnCollectionChange(function () { });
  55024. this.controls.splice(index, 1);
  55025. if (control) {
  55026. this.controls.splice(index, 0, control);
  55027. this._registerControl(control);
  55028. }
  55029. this.updateValueAndValidity();
  55030. this._onCollectionChange();
  55031. };
  55032. Object.defineProperty(FormArray.prototype, "length", {
  55033. /**
  55034. * Length of the control array.
  55035. */
  55036. get: function () { return this.controls.length; },
  55037. enumerable: true,
  55038. configurable: true
  55039. });
  55040. /**
  55041. * Sets the value of the `FormArray`. It accepts an array that matches
  55042. * the structure of the control.
  55043. *
  55044. * This method performs strict checks, and throws an error if you try
  55045. * to set the value of a control that doesn't exist or if you exclude the
  55046. * value of a control.
  55047. *
  55048. * @usageNotes
  55049. * ### Set the values for the controls in the form array
  55050. *
  55051. * ```
  55052. * const arr = new FormArray([
  55053. * new FormControl(),
  55054. * new FormControl()
  55055. * ]);
  55056. * console.log(arr.value); // [null, null]
  55057. *
  55058. * arr.setValue(['Nancy', 'Drew']);
  55059. * console.log(arr.value); // ['Nancy', 'Drew']
  55060. * ```
  55061. *
  55062. * @param value Array of values for the controls
  55063. * @param options Configure options that determine how the control propagates changes and
  55064. * emits events after the value changes
  55065. *
  55066. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
  55067. * is false.
  55068. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  55069. * `valueChanges`
  55070. * observables emit events with the latest status and value when the control value is updated.
  55071. * When false, no events are emitted.
  55072. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  55073. * updateValueAndValidity} method.
  55074. */
  55075. FormArray.prototype.setValue = function (value, options) {
  55076. var _this = this;
  55077. if (options === void 0) { options = {}; }
  55078. this._checkAllValuesPresent(value);
  55079. value.forEach(function (newValue, index) {
  55080. _this._throwIfControlMissing(index);
  55081. _this.at(index).setValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
  55082. });
  55083. this.updateValueAndValidity(options);
  55084. };
  55085. /**
  55086. * Patches the value of the `FormArray`. It accepts an array that matches the
  55087. * structure of the control, and does its best to match the values to the correct
  55088. * controls in the group.
  55089. *
  55090. * It accepts both super-sets and sub-sets of the array without throwing an error.
  55091. *
  55092. * @usageNotes
  55093. * ### Patch the values for controls in a form array
  55094. *
  55095. * ```
  55096. * const arr = new FormArray([
  55097. * new FormControl(),
  55098. * new FormControl()
  55099. * ]);
  55100. * console.log(arr.value); // [null, null]
  55101. *
  55102. * arr.patchValue(['Nancy']);
  55103. * console.log(arr.value); // ['Nancy', null]
  55104. * ```
  55105. *
  55106. * @param value Array of latest values for the controls
  55107. * @param options Configure options that determine how the control propagates changes and
  55108. * emits events after the value changes
  55109. *
  55110. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
  55111. * is false.
  55112. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  55113. * `valueChanges`
  55114. * observables emit events with the latest status and value when the control value is updated.
  55115. * When false, no events are emitted.
  55116. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  55117. * updateValueAndValidity} method.
  55118. */
  55119. FormArray.prototype.patchValue = function (value, options) {
  55120. var _this = this;
  55121. if (options === void 0) { options = {}; }
  55122. value.forEach(function (newValue, index) {
  55123. if (_this.at(index)) {
  55124. _this.at(index).patchValue(newValue, { onlySelf: true, emitEvent: options.emitEvent });
  55125. }
  55126. });
  55127. this.updateValueAndValidity(options);
  55128. };
  55129. /**
  55130. * Resets the `FormArray` and all descendants are marked `pristine` and `untouched`, and the
  55131. * value of all descendants to null or null maps.
  55132. *
  55133. * You reset to a specific form state by passing in an array of states
  55134. * that matches the structure of the control. The state is a standalone value
  55135. * or a form state object with both a value and a disabled status.
  55136. *
  55137. * @usageNotes
  55138. * ### Reset the values in a form array
  55139. *
  55140. * ```ts
  55141. * const arr = new FormArray([
  55142. * new FormControl(),
  55143. * new FormControl()
  55144. * ]);
  55145. * arr.reset(['name', 'last name']);
  55146. *
  55147. * console.log(this.arr.value); // ['name', 'last name']
  55148. * ```
  55149. *
  55150. * ### Reset the values in a form array and the disabled status for the first control
  55151. *
  55152. * ```
  55153. * this.arr.reset([
  55154. * {value: 'name', disabled: true},
  55155. * 'last'
  55156. * ]);
  55157. *
  55158. * console.log(this.arr.value); // ['name', 'last name']
  55159. * console.log(this.arr.get(0).status); // 'DISABLED'
  55160. * ```
  55161. *
  55162. * @param value Array of values for the controls
  55163. * @param options Configure options that determine how the control propagates changes and
  55164. * emits events after the value changes
  55165. *
  55166. * * `onlySelf`: When true, each change only affects this control, and not its parent. Default
  55167. * is false.
  55168. * * `emitEvent`: When true or not supplied (the default), both the `statusChanges` and
  55169. * `valueChanges`
  55170. * observables emit events with the latest status and value when the control is reset.
  55171. * When false, no events are emitted.
  55172. * The configuration options are passed to the {@link AbstractControl#updateValueAndValidity
  55173. * updateValueAndValidity} method.
  55174. */
  55175. FormArray.prototype.reset = function (value, options) {
  55176. if (value === void 0) { value = []; }
  55177. if (options === void 0) { options = {}; }
  55178. this._forEachChild(function (control, index) {
  55179. control.reset(value[index], { onlySelf: true, emitEvent: options.emitEvent });
  55180. });
  55181. this.updateValueAndValidity(options);
  55182. this._updatePristine(options);
  55183. this._updateTouched(options);
  55184. };
  55185. /**
  55186. * The aggregate value of the array, including any disabled controls.
  55187. *
  55188. * Reports all values regardless of disabled status.
  55189. * For enabled controls only, the `value` property is the best way to get the value of the array.
  55190. */
  55191. FormArray.prototype.getRawValue = function () {
  55192. return this.controls.map(function (control) {
  55193. return control instanceof FormControl ? control.value : control.getRawValue();
  55194. });
  55195. };
  55196. /** @internal */
  55197. FormArray.prototype._syncPendingControls = function () {
  55198. var subtreeUpdated = this.controls.reduce(function (updated, child) {
  55199. return child._syncPendingControls() ? true : updated;
  55200. }, false);
  55201. if (subtreeUpdated)
  55202. this.updateValueAndValidity({ onlySelf: true });
  55203. return subtreeUpdated;
  55204. };
  55205. /** @internal */
  55206. FormArray.prototype._throwIfControlMissing = function (index) {
  55207. if (!this.controls.length) {
  55208. throw new Error("\n There are no form controls registered with this array yet. If you're using ngModel,\n you may want to check next tick (e.g. use setTimeout).\n ");
  55209. }
  55210. if (!this.at(index)) {
  55211. throw new Error("Cannot find form control at index " + index);
  55212. }
  55213. };
  55214. /** @internal */
  55215. FormArray.prototype._forEachChild = function (cb) {
  55216. this.controls.forEach(function (control, index) { cb(control, index); });
  55217. };
  55218. /** @internal */
  55219. FormArray.prototype._updateValue = function () {
  55220. var _this = this;
  55221. this.value =
  55222. this.controls.filter(function (control) { return control.enabled || _this.disabled; })
  55223. .map(function (control) { return control.value; });
  55224. };
  55225. /** @internal */
  55226. FormArray.prototype._anyControls = function (condition) {
  55227. return this.controls.some(function (control) { return control.enabled && condition(control); });
  55228. };
  55229. /** @internal */
  55230. FormArray.prototype._setUpControls = function () {
  55231. var _this = this;
  55232. this._forEachChild(function (control) { return _this._registerControl(control); });
  55233. };
  55234. /** @internal */
  55235. FormArray.prototype._checkAllValuesPresent = function (value) {
  55236. this._forEachChild(function (control, i) {
  55237. if (value[i] === undefined) {
  55238. throw new Error("Must supply a value for form control at index: " + i + ".");
  55239. }
  55240. });
  55241. };
  55242. /** @internal */
  55243. FormArray.prototype._allControlsDisabled = function () {
  55244. var e_2, _a;
  55245. try {
  55246. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(this.controls), _c = _b.next(); !_c.done; _c = _b.next()) {
  55247. var control = _c.value;
  55248. if (control.enabled)
  55249. return false;
  55250. }
  55251. }
  55252. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  55253. finally {
  55254. try {
  55255. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  55256. }
  55257. finally { if (e_2) throw e_2.error; }
  55258. }
  55259. return this.controls.length > 0 || this.disabled;
  55260. };
  55261. FormArray.prototype._registerControl = function (control) {
  55262. control.setParent(this);
  55263. control._registerOnCollectionChange(this._onCollectionChange);
  55264. };
  55265. return FormArray;
  55266. }(AbstractControl));
  55267. /**
  55268. * @license
  55269. * Copyright Google Inc. All Rights Reserved.
  55270. *
  55271. * Use of this source code is governed by an MIT-style license that can be
  55272. * found in the LICENSE file at https://angular.io/license
  55273. */
  55274. var formDirectiveProvider = {
  55275. provide: ControlContainer,
  55276. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return NgForm; })
  55277. };
  55278. var resolvedPromise = Promise.resolve(null);
  55279. /**
  55280. * @description
  55281. *
  55282. * Creates a top-level `FormGroup` instance and binds it to a form
  55283. * to track aggregate form value and validation status.
  55284. *
  55285. * As soon as you import the `FormsModule`, this directive becomes active by default on
  55286. * all `<form>` tags. You don't need to add a special selector.
  55287. *
  55288. * You can export the directive into a local template variable using `ngForm` as the key
  55289. * (ex: `#myForm="ngForm"`). This is optional, but useful. Many properties from the underlying
  55290. * `FormGroup` instance are duplicated on the directive itself, so a reference to it
  55291. * will give you access to the aggregate value and validity status of the form, as well as
  55292. * user interaction properties like `dirty` and `touched`.
  55293. *
  55294. * To register child controls with the form, you'll want to use `NgModel` with a
  55295. * `name` attribute. You can also use `NgModelGroup` if you'd like to create
  55296. * sub-groups within the form.
  55297. *
  55298. * You can listen to the directive's `ngSubmit` event to be notified when the user has
  55299. * triggered a form submission. The `ngSubmit` event will be emitted with the original form
  55300. * submission event.
  55301. *
  55302. * In template driven forms, all `<form>` tags are automatically tagged as `NgForm`.
  55303. * If you want to import the `FormsModule` but skip its usage in some forms,
  55304. * for example, to use native HTML5 validation, you can add `ngNoForm` and the `<form>`
  55305. * tags won't create an `NgForm` directive. In reactive forms, using `ngNoForm` is
  55306. * unnecessary because the `<form>` tags are inert. In that case, you would
  55307. * refrain from using the `formGroup` directive.
  55308. *
  55309. * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
  55310. *
  55311. * **npm package**: `@angular/forms`
  55312. *
  55313. * @ngModule FormsModule
  55314. */
  55315. var NgForm = /** @class */ (function (_super) {
  55316. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgForm, _super);
  55317. function NgForm(validators, asyncValidators) {
  55318. var _this = _super.call(this) || this;
  55319. _this.submitted = false;
  55320. _this._directives = [];
  55321. _this.ngSubmit = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  55322. _this.form =
  55323. new FormGroup({}, composeValidators(validators), composeAsyncValidators(asyncValidators));
  55324. return _this;
  55325. }
  55326. NgForm.prototype.ngAfterViewInit = function () { this._setUpdateStrategy(); };
  55327. Object.defineProperty(NgForm.prototype, "formDirective", {
  55328. get: function () { return this; },
  55329. enumerable: true,
  55330. configurable: true
  55331. });
  55332. Object.defineProperty(NgForm.prototype, "control", {
  55333. get: function () { return this.form; },
  55334. enumerable: true,
  55335. configurable: true
  55336. });
  55337. Object.defineProperty(NgForm.prototype, "path", {
  55338. get: function () { return []; },
  55339. enumerable: true,
  55340. configurable: true
  55341. });
  55342. Object.defineProperty(NgForm.prototype, "controls", {
  55343. get: function () { return this.form.controls; },
  55344. enumerable: true,
  55345. configurable: true
  55346. });
  55347. NgForm.prototype.addControl = function (dir) {
  55348. var _this = this;
  55349. resolvedPromise.then(function () {
  55350. var container = _this._findContainer(dir.path);
  55351. dir.control =
  55352. container.registerControl(dir.name, dir.control);
  55353. setUpControl(dir.control, dir);
  55354. dir.control.updateValueAndValidity({ emitEvent: false });
  55355. _this._directives.push(dir);
  55356. });
  55357. };
  55358. NgForm.prototype.getControl = function (dir) { return this.form.get(dir.path); };
  55359. NgForm.prototype.removeControl = function (dir) {
  55360. var _this = this;
  55361. resolvedPromise.then(function () {
  55362. var container = _this._findContainer(dir.path);
  55363. if (container) {
  55364. container.removeControl(dir.name);
  55365. }
  55366. removeDir(_this._directives, dir);
  55367. });
  55368. };
  55369. NgForm.prototype.addFormGroup = function (dir) {
  55370. var _this = this;
  55371. resolvedPromise.then(function () {
  55372. var container = _this._findContainer(dir.path);
  55373. var group = new FormGroup({});
  55374. setUpFormContainer(group, dir);
  55375. container.registerControl(dir.name, group);
  55376. group.updateValueAndValidity({ emitEvent: false });
  55377. });
  55378. };
  55379. NgForm.prototype.removeFormGroup = function (dir) {
  55380. var _this = this;
  55381. resolvedPromise.then(function () {
  55382. var container = _this._findContainer(dir.path);
  55383. if (container) {
  55384. container.removeControl(dir.name);
  55385. }
  55386. });
  55387. };
  55388. NgForm.prototype.getFormGroup = function (dir) { return this.form.get(dir.path); };
  55389. NgForm.prototype.updateModel = function (dir, value) {
  55390. var _this = this;
  55391. resolvedPromise.then(function () {
  55392. var ctrl = _this.form.get(dir.path);
  55393. ctrl.setValue(value);
  55394. });
  55395. };
  55396. NgForm.prototype.setValue = function (value) { this.control.setValue(value); };
  55397. NgForm.prototype.onSubmit = function ($event) {
  55398. this.submitted = true;
  55399. syncPendingControls(this.form, this._directives);
  55400. this.ngSubmit.emit($event);
  55401. return false;
  55402. };
  55403. NgForm.prototype.onReset = function () { this.resetForm(); };
  55404. NgForm.prototype.resetForm = function (value) {
  55405. if (value === void 0) { value = undefined; }
  55406. this.form.reset(value);
  55407. this.submitted = false;
  55408. };
  55409. NgForm.prototype._setUpdateStrategy = function () {
  55410. if (this.options && this.options.updateOn != null) {
  55411. this.form._updateOn = this.options.updateOn;
  55412. }
  55413. };
  55414. /** @internal */
  55415. NgForm.prototype._findContainer = function (path) {
  55416. path.pop();
  55417. return path.length ? this.form.get(path) : this.form;
  55418. };
  55419. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55420. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngFormOptions'),
  55421. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  55422. ], NgForm.prototype, "options", void 0);
  55423. NgForm = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55424. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  55425. selector: 'form:not([ngNoForm]):not([formGroup]),ngForm,[ngForm]',
  55426. providers: [formDirectiveProvider],
  55427. host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' },
  55428. outputs: ['ngSubmit'],
  55429. exportAs: 'ngForm'
  55430. }),
  55431. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  55432. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  55433. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Array, Array])
  55434. ], NgForm);
  55435. return NgForm;
  55436. }(ControlContainer));
  55437. /**
  55438. * @license
  55439. * Copyright Google Inc. All Rights Reserved.
  55440. *
  55441. * Use of this source code is governed by an MIT-style license that can be
  55442. * found in the LICENSE file at https://angular.io/license
  55443. */
  55444. var TemplateDrivenErrors = /** @class */ (function () {
  55445. function TemplateDrivenErrors() {
  55446. }
  55447. TemplateDrivenErrors.modelParentException = function () {
  55448. throw new Error("\n ngModel cannot be used to register form controls with a parent formGroup directive. Try using\n formGroup's partner directive \"formControlName\" instead. Example:\n\n " + FormErrorExamples.formControlName + "\n\n Or, if you'd like to avoid registering this form control, indicate that it's standalone in ngModelOptions:\n\n Example:\n\n " + FormErrorExamples.ngModelWithFormGroup);
  55449. };
  55450. TemplateDrivenErrors.formGroupNameException = function () {
  55451. throw new Error("\n ngModel cannot be used to register form controls with a parent formGroupName or formArrayName directive.\n\n Option 1: Use formControlName instead of ngModel (reactive strategy):\n\n " + FormErrorExamples.formGroupName + "\n\n Option 2: Update ngModel's parent be ngModelGroup (template-driven strategy):\n\n " + FormErrorExamples.ngModelGroup);
  55452. };
  55453. TemplateDrivenErrors.missingNameException = function () {
  55454. throw new Error("If ngModel is used within a form tag, either the name attribute must be set or the form\n control must be defined as 'standalone' in ngModelOptions.\n\n Example 1: <input [(ngModel)]=\"person.firstName\" name=\"first\">\n Example 2: <input [(ngModel)]=\"person.firstName\" [ngModelOptions]=\"{standalone: true}\">");
  55455. };
  55456. TemplateDrivenErrors.modelGroupParentException = function () {
  55457. throw new Error("\n ngModelGroup cannot be used with a parent formGroup directive.\n\n Option 1: Use formGroupName instead of ngModelGroup (reactive strategy):\n\n " + FormErrorExamples.formGroupName + "\n\n Option 2: Use a regular form tag instead of the formGroup directive (template-driven strategy):\n\n " + FormErrorExamples.ngModelGroup);
  55458. };
  55459. return TemplateDrivenErrors;
  55460. }());
  55461. /**
  55462. * @license
  55463. * Copyright Google Inc. All Rights Reserved.
  55464. *
  55465. * Use of this source code is governed by an MIT-style license that can be
  55466. * found in the LICENSE file at https://angular.io/license
  55467. */
  55468. var modelGroupProvider = {
  55469. provide: ControlContainer,
  55470. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return NgModelGroup; })
  55471. };
  55472. /**
  55473. * @description
  55474. *
  55475. * Creates and binds a `FormGroup` instance to a DOM element.
  55476. *
  55477. * This directive can only be used as a child of `NgForm` (or in other words,
  55478. * within `<form>` tags).
  55479. *
  55480. * Use this directive if you'd like to create a sub-group within a form. This can
  55481. * come in handy if you want to validate a sub-group of your form separately from
  55482. * the rest of your form, or if some values in your domain model make more sense to
  55483. * consume together in a nested object.
  55484. *
  55485. * Pass in the name you'd like this sub-group to have and it will become the key
  55486. * for the sub-group in the form's full value. You can also export the directive into
  55487. * a local template variable using `ngModelGroup` (ex: `#myGroup="ngModelGroup"`).
  55488. *
  55489. * {@example forms/ts/ngModelGroup/ng_model_group_example.ts region='Component'}
  55490. *
  55491. * @ngModule FormsModule
  55492. */
  55493. var NgModelGroup = /** @class */ (function (_super) {
  55494. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgModelGroup, _super);
  55495. function NgModelGroup(parent, validators, asyncValidators) {
  55496. var _this = _super.call(this) || this;
  55497. _this._parent = parent;
  55498. _this._validators = validators;
  55499. _this._asyncValidators = asyncValidators;
  55500. return _this;
  55501. }
  55502. NgModelGroup_1 = NgModelGroup;
  55503. /** @internal */
  55504. NgModelGroup.prototype._checkParentType = function () {
  55505. if (!(this._parent instanceof NgModelGroup_1) && !(this._parent instanceof NgForm)) {
  55506. TemplateDrivenErrors.modelGroupParentException();
  55507. }
  55508. };
  55509. var NgModelGroup_1;
  55510. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55511. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngModelGroup'),
  55512. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  55513. ], NgModelGroup.prototype, "name", void 0);
  55514. NgModelGroup = NgModelGroup_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55515. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: '[ngModelGroup]', providers: [modelGroupProvider], exportAs: 'ngModelGroup' }),
  55516. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"])()),
  55517. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  55518. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  55519. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ControlContainer, Array, Array])
  55520. ], NgModelGroup);
  55521. return NgModelGroup;
  55522. }(AbstractFormGroupDirective));
  55523. /**
  55524. * @license
  55525. * Copyright Google Inc. All Rights Reserved.
  55526. *
  55527. * Use of this source code is governed by an MIT-style license that can be
  55528. * found in the LICENSE file at https://angular.io/license
  55529. */
  55530. var formControlBinding = {
  55531. provide: NgControl,
  55532. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return NgModel; })
  55533. };
  55534. /**
  55535. * `ngModel` forces an additional change detection run when its inputs change:
  55536. * E.g.:
  55537. * ```
  55538. * <div>{{myModel.valid}}</div>
  55539. * <input [(ngModel)]="myValue" #myModel="ngModel">
  55540. * ```
  55541. * I.e. `ngModel` can export itself on the element and then be used in the template.
  55542. * Normally, this would result in expressions before the `input` that use the exported directive
  55543. * to have and old value as they have been
  55544. * dirty checked before. As this is a very common case for `ngModel`, we added this second change
  55545. * detection run.
  55546. *
  55547. * Notes:
  55548. * - this is just one extra run no matter how many `ngModel` have been changed.
  55549. * - this is a general problem when using `exportAs` for directives!
  55550. */
  55551. var resolvedPromise$1 = Promise.resolve(null);
  55552. /**
  55553. * @description
  55554. *
  55555. * Creates a `FormControl` instance from a domain model and binds it
  55556. * to a form control element.
  55557. *
  55558. * The `FormControl` instance will track the value, user interaction, and
  55559. * validation status of the control and keep the view synced with the model. If used
  55560. * within a parent form, the directive will also register itself with the form as a child
  55561. * control.
  55562. *
  55563. * This directive can be used by itself or as part of a larger form. All you need is the
  55564. * `ngModel` selector to activate it.
  55565. *
  55566. * It accepts a domain model as an optional `Input`. If you have a one-way binding
  55567. * to `ngModel` with `[]` syntax, changing the value of the domain model in the component
  55568. * class will set the value in the view. If you have a two-way binding with `[()]` syntax
  55569. * (also known as 'banana-box syntax'), the value in the UI will always be synced back to
  55570. * the domain model in your class as well.
  55571. *
  55572. * If you wish to inspect the properties of the associated `FormControl` (like
  55573. * validity state), you can also export the directive into a local template variable using
  55574. * `ngModel` as the key (ex: `#myVar="ngModel"`). You can then access the control using the
  55575. * directive's `control` property, but most properties you'll need (like `valid` and `dirty`)
  55576. * will fall through to the control anyway, so you can access them directly. You can see a
  55577. * full list of properties directly available in `AbstractControlDirective`.
  55578. *
  55579. * The following is an example of a simple standalone control using `ngModel`:
  55580. *
  55581. * {@example forms/ts/simpleNgModel/simple_ng_model_example.ts region='Component'}
  55582. *
  55583. * When using the `ngModel` within `<form>` tags, you'll also need to supply a `name` attribute
  55584. * so that the control can be registered with the parent form under that name.
  55585. *
  55586. * It's worth noting that in the context of a parent form, you often can skip one-way or
  55587. * two-way binding because the parent form will sync the value for you. You can access
  55588. * its properties by exporting it into a local template variable using `ngForm` (ex:
  55589. * `#f="ngForm"`). Then you can pass it where it needs to go on submit.
  55590. *
  55591. * If you do need to populate initial values into your form, using a one-way binding for
  55592. * `ngModel` tends to be sufficient as long as you use the exported form's value rather
  55593. * than the domain model's value on submit.
  55594. *
  55595. * Take a look at an example of using `ngModel` within a form:
  55596. *
  55597. * {@example forms/ts/simpleForm/simple_form_example.ts region='Component'}
  55598. *
  55599. * To see `ngModel` examples with different form control types, see:
  55600. *
  55601. * * Radio buttons: `RadioControlValueAccessor`
  55602. * * Selects: `SelectControlValueAccessor`
  55603. *
  55604. * @ngModule FormsModule
  55605. */
  55606. var NgModel = /** @class */ (function (_super) {
  55607. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NgModel, _super);
  55608. function NgModel(parent, validators, asyncValidators, valueAccessors) {
  55609. var _this = _super.call(this) || this;
  55610. _this.control = new FormControl();
  55611. /** @internal */
  55612. _this._registered = false;
  55613. _this.update = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  55614. _this._parent = parent;
  55615. _this._rawValidators = validators || [];
  55616. _this._rawAsyncValidators = asyncValidators || [];
  55617. _this.valueAccessor = selectValueAccessor(_this, valueAccessors);
  55618. return _this;
  55619. }
  55620. NgModel.prototype.ngOnChanges = function (changes) {
  55621. this._checkForErrors();
  55622. if (!this._registered)
  55623. this._setUpControl();
  55624. if ('isDisabled' in changes) {
  55625. this._updateDisabled(changes);
  55626. }
  55627. if (isPropertyUpdated(changes, this.viewModel)) {
  55628. this._updateValue(this.model);
  55629. this.viewModel = this.model;
  55630. }
  55631. };
  55632. NgModel.prototype.ngOnDestroy = function () { this.formDirective && this.formDirective.removeControl(this); };
  55633. Object.defineProperty(NgModel.prototype, "path", {
  55634. get: function () {
  55635. return this._parent ? controlPath(this.name, this._parent) : [this.name];
  55636. },
  55637. enumerable: true,
  55638. configurable: true
  55639. });
  55640. Object.defineProperty(NgModel.prototype, "formDirective", {
  55641. get: function () { return this._parent ? this._parent.formDirective : null; },
  55642. enumerable: true,
  55643. configurable: true
  55644. });
  55645. Object.defineProperty(NgModel.prototype, "validator", {
  55646. get: function () { return composeValidators(this._rawValidators); },
  55647. enumerable: true,
  55648. configurable: true
  55649. });
  55650. Object.defineProperty(NgModel.prototype, "asyncValidator", {
  55651. get: function () {
  55652. return composeAsyncValidators(this._rawAsyncValidators);
  55653. },
  55654. enumerable: true,
  55655. configurable: true
  55656. });
  55657. NgModel.prototype.viewToModelUpdate = function (newValue) {
  55658. this.viewModel = newValue;
  55659. this.update.emit(newValue);
  55660. };
  55661. NgModel.prototype._setUpControl = function () {
  55662. this._setUpdateStrategy();
  55663. this._isStandalone() ? this._setUpStandalone() :
  55664. this.formDirective.addControl(this);
  55665. this._registered = true;
  55666. };
  55667. NgModel.prototype._setUpdateStrategy = function () {
  55668. if (this.options && this.options.updateOn != null) {
  55669. this.control._updateOn = this.options.updateOn;
  55670. }
  55671. };
  55672. NgModel.prototype._isStandalone = function () {
  55673. return !this._parent || !!(this.options && this.options.standalone);
  55674. };
  55675. NgModel.prototype._setUpStandalone = function () {
  55676. setUpControl(this.control, this);
  55677. this.control.updateValueAndValidity({ emitEvent: false });
  55678. };
  55679. NgModel.prototype._checkForErrors = function () {
  55680. if (!this._isStandalone()) {
  55681. this._checkParentType();
  55682. }
  55683. this._checkName();
  55684. };
  55685. NgModel.prototype._checkParentType = function () {
  55686. if (!(this._parent instanceof NgModelGroup) &&
  55687. this._parent instanceof AbstractFormGroupDirective) {
  55688. TemplateDrivenErrors.formGroupNameException();
  55689. }
  55690. else if (!(this._parent instanceof NgModelGroup) && !(this._parent instanceof NgForm)) {
  55691. TemplateDrivenErrors.modelParentException();
  55692. }
  55693. };
  55694. NgModel.prototype._checkName = function () {
  55695. if (this.options && this.options.name)
  55696. this.name = this.options.name;
  55697. if (!this._isStandalone() && !this.name) {
  55698. TemplateDrivenErrors.missingNameException();
  55699. }
  55700. };
  55701. NgModel.prototype._updateValue = function (value) {
  55702. var _this = this;
  55703. resolvedPromise$1.then(function () { _this.control.setValue(value, { emitViewToModelChange: false }); });
  55704. };
  55705. NgModel.prototype._updateDisabled = function (changes) {
  55706. var _this = this;
  55707. var disabledValue = changes['isDisabled'].currentValue;
  55708. var isDisabled = disabledValue === '' || (disabledValue && disabledValue !== 'false');
  55709. resolvedPromise$1.then(function () {
  55710. if (isDisabled && !_this.control.disabled) {
  55711. _this.control.disable();
  55712. }
  55713. else if (!isDisabled && _this.control.disabled) {
  55714. _this.control.enable();
  55715. }
  55716. });
  55717. };
  55718. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55719. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  55720. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  55721. ], NgModel.prototype, "name", void 0);
  55722. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55723. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('disabled'),
  55724. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  55725. ], NgModel.prototype, "isDisabled", void 0);
  55726. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55727. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngModel'),
  55728. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  55729. ], NgModel.prototype, "model", void 0);
  55730. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55731. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngModelOptions'),
  55732. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  55733. ], NgModel.prototype, "options", void 0);
  55734. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55735. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])('ngModelChange'),
  55736. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  55737. ], NgModel.prototype, "update", void 0);
  55738. NgModel = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55739. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  55740. selector: '[ngModel]:not([formControlName]):not([formControl])',
  55741. providers: [formControlBinding],
  55742. exportAs: 'ngModel'
  55743. }),
  55744. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()),
  55745. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  55746. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  55747. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALUE_ACCESSOR)),
  55748. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ControlContainer,
  55749. Array,
  55750. Array, Array])
  55751. ], NgModel);
  55752. return NgModel;
  55753. }(NgControl));
  55754. /**
  55755. * @license
  55756. * Copyright Google Inc. All Rights Reserved.
  55757. *
  55758. * Use of this source code is governed by an MIT-style license that can be
  55759. * found in the LICENSE file at https://angular.io/license
  55760. */
  55761. /**
  55762. * Token to provide to turn off the ngModel warning on formControl and formControlName.
  55763. */
  55764. var NG_MODEL_WITH_FORM_CONTROL_WARNING = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('NgModelWithFormControlWarning');
  55765. var formControlBinding$1 = {
  55766. provide: NgControl,
  55767. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return FormControlDirective; })
  55768. };
  55769. /**
  55770. * @description
  55771. *
  55772. * Syncs a standalone `FormControl` instance to a form control element.
  55773. *
  55774. * This directive ensures that any values written to the `FormControl`
  55775. * instance programmatically will be written to the DOM element (model -> view). Conversely,
  55776. * any values written to the DOM element through user input will be reflected in the
  55777. * `FormControl` instance (view -> model).
  55778. *
  55779. * @usageNotes
  55780. * Use this directive if you'd like to create and manage a `FormControl` instance directly.
  55781. * Simply create a `FormControl`, save it to your component class, and pass it into the
  55782. * `FormControlDirective`.
  55783. *
  55784. * This directive is designed to be used as a standalone control. Unlike `FormControlName`,
  55785. * it does not require that your `FormControl` instance be part of any parent
  55786. * `FormGroup`, and it won't be registered to any `FormGroupDirective` that
  55787. * exists above it.
  55788. *
  55789. * **Get the value**: the `value` property is always synced and available on the
  55790. * `FormControl` instance. See a full list of available properties in
  55791. * `AbstractControl`.
  55792. *
  55793. * **Set the value**: You can pass in an initial value when instantiating the `FormControl`,
  55794. * or you can set it programmatically later using {@link AbstractControl#setValue setValue} or
  55795. * {@link AbstractControl#patchValue patchValue}.
  55796. *
  55797. * **Listen to value**: If you want to listen to changes in the value of the control, you can
  55798. * subscribe to the {@link AbstractControl#valueChanges valueChanges} event. You can also listen to
  55799. * {@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
  55800. * re-calculated.
  55801. *
  55802. * ### Example
  55803. *
  55804. * {@example forms/ts/simpleFormControl/simple_form_control_example.ts region='Component'}
  55805. *
  55806. * ### Use with ngModel
  55807. *
  55808. * Support for using the `ngModel` input property and `ngModelChange` event with reactive
  55809. * form directives has been deprecated in Angular v6 and will be removed in Angular v7.
  55810. *
  55811. * Now deprecated:
  55812. *
  55813. * ```html
  55814. * <input [formControl]="control" [(ngModel)]="value">
  55815. * ```
  55816. *
  55817. * ```ts
  55818. * this.value = 'some value';
  55819. * ```
  55820. *
  55821. * This has been deprecated for a few reasons. First, developers have found this pattern
  55822. * confusing. It seems like the actual `ngModel` directive is being used, but in fact it's
  55823. * an input/output property named `ngModel` on the reactive form directive that simply
  55824. * approximates (some of) its behavior. Specifically, it allows getting/setting the value
  55825. * and intercepting value events. However, some of `ngModel`'s other features - like
  55826. * delaying updates with`ngModelOptions` or exporting the directive - simply don't work,
  55827. * which has understandably caused some confusion.
  55828. *
  55829. * In addition, this pattern mixes template-driven and reactive forms strategies, which
  55830. * we generally don't recommend because it doesn't take advantage of the full benefits of
  55831. * either strategy. Setting the value in the template violates the template-agnostic
  55832. * principles behind reactive forms, whereas adding a `FormControl`/`FormGroup` layer in
  55833. * the class removes the convenience of defining forms in the template.
  55834. *
  55835. * To update your code before v7, you'll want to decide whether to stick with reactive form
  55836. * directives (and get/set values using reactive forms patterns) or switch over to
  55837. * template-driven directives.
  55838. *
  55839. * After (choice 1 - use reactive forms):
  55840. *
  55841. * ```html
  55842. * <input [formControl]="control">
  55843. * ```
  55844. *
  55845. * ```ts
  55846. * this.control.setValue('some value');
  55847. * ```
  55848. *
  55849. * After (choice 2 - use template-driven forms):
  55850. *
  55851. * ```html
  55852. * <input [(ngModel)]="value">
  55853. * ```
  55854. *
  55855. * ```ts
  55856. * this.value = 'some value';
  55857. * ```
  55858. *
  55859. * By default, when you use this pattern, you will see a deprecation warning once in dev
  55860. * mode. You can choose to silence this warning by providing a config for
  55861. * `ReactiveFormsModule` at import time:
  55862. *
  55863. * ```ts
  55864. * imports: [
  55865. * ReactiveFormsModule.withConfig({warnOnNgModelWithFormControl: 'never'});
  55866. * ]
  55867. * ```
  55868. *
  55869. * Alternatively, you can choose to surface a separate warning for each instance of this
  55870. * pattern with a config value of `"always"`. This may help to track down where in the code
  55871. * the pattern is being used as the code is being updated.
  55872. *
  55873. * @ngModule ReactiveFormsModule
  55874. */
  55875. var FormControlDirective = /** @class */ (function (_super) {
  55876. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormControlDirective, _super);
  55877. function FormControlDirective(validators, asyncValidators, valueAccessors, _ngModelWarningConfig) {
  55878. var _this = _super.call(this) || this;
  55879. _this._ngModelWarningConfig = _ngModelWarningConfig;
  55880. /** @deprecated as of v6 */
  55881. _this.update = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  55882. /**
  55883. * Instance property used to track whether an ngModel warning has been sent out for this
  55884. * particular FormControlDirective instance. Used to support warning config of "always".
  55885. *
  55886. * @internal
  55887. */
  55888. _this._ngModelWarningSent = false;
  55889. _this._rawValidators = validators || [];
  55890. _this._rawAsyncValidators = asyncValidators || [];
  55891. _this.valueAccessor = selectValueAccessor(_this, valueAccessors);
  55892. return _this;
  55893. }
  55894. FormControlDirective_1 = FormControlDirective;
  55895. Object.defineProperty(FormControlDirective.prototype, "isDisabled", {
  55896. set: function (isDisabled) { ReactiveErrors.disabledAttrWarning(); },
  55897. enumerable: true,
  55898. configurable: true
  55899. });
  55900. FormControlDirective.prototype.ngOnChanges = function (changes) {
  55901. if (this._isControlChanged(changes)) {
  55902. setUpControl(this.form, this);
  55903. if (this.control.disabled && this.valueAccessor.setDisabledState) {
  55904. this.valueAccessor.setDisabledState(true);
  55905. }
  55906. this.form.updateValueAndValidity({ emitEvent: false });
  55907. }
  55908. if (isPropertyUpdated(changes, this.viewModel)) {
  55909. _ngModelWarning('formControl', FormControlDirective_1, this, this._ngModelWarningConfig);
  55910. this.form.setValue(this.model);
  55911. this.viewModel = this.model;
  55912. }
  55913. };
  55914. Object.defineProperty(FormControlDirective.prototype, "path", {
  55915. get: function () { return []; },
  55916. enumerable: true,
  55917. configurable: true
  55918. });
  55919. Object.defineProperty(FormControlDirective.prototype, "validator", {
  55920. get: function () { return composeValidators(this._rawValidators); },
  55921. enumerable: true,
  55922. configurable: true
  55923. });
  55924. Object.defineProperty(FormControlDirective.prototype, "asyncValidator", {
  55925. get: function () {
  55926. return composeAsyncValidators(this._rawAsyncValidators);
  55927. },
  55928. enumerable: true,
  55929. configurable: true
  55930. });
  55931. Object.defineProperty(FormControlDirective.prototype, "control", {
  55932. get: function () { return this.form; },
  55933. enumerable: true,
  55934. configurable: true
  55935. });
  55936. FormControlDirective.prototype.viewToModelUpdate = function (newValue) {
  55937. this.viewModel = newValue;
  55938. this.update.emit(newValue);
  55939. };
  55940. FormControlDirective.prototype._isControlChanged = function (changes) {
  55941. return changes.hasOwnProperty('form');
  55942. };
  55943. var FormControlDirective_1;
  55944. /**
  55945. * Static property used to track whether any ngModel warnings have been sent across
  55946. * all instances of FormControlDirective. Used to support warning config of "once".
  55947. *
  55948. * @internal
  55949. */
  55950. FormControlDirective._ngModelWarningSentOnce = false;
  55951. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55952. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('formControl'),
  55953. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", FormControl)
  55954. ], FormControlDirective.prototype, "form", void 0);
  55955. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55956. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('disabled'),
  55957. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean),
  55958. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Boolean])
  55959. ], FormControlDirective.prototype, "isDisabled", null);
  55960. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55961. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngModel'),
  55962. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  55963. ], FormControlDirective.prototype, "model", void 0);
  55964. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55965. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])('ngModelChange'),
  55966. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  55967. ], FormControlDirective.prototype, "update", void 0);
  55968. FormControlDirective = FormControlDirective_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  55969. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: '[formControl]', providers: [formControlBinding$1], exportAs: 'ngForm' }),
  55970. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  55971. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  55972. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALUE_ACCESSOR)),
  55973. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_MODEL_WITH_FORM_CONTROL_WARNING)),
  55974. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Array,
  55975. Array, Array, Object])
  55976. ], FormControlDirective);
  55977. return FormControlDirective;
  55978. }(NgControl));
  55979. /**
  55980. * @license
  55981. * Copyright Google Inc. All Rights Reserved.
  55982. *
  55983. * Use of this source code is governed by an MIT-style license that can be
  55984. * found in the LICENSE file at https://angular.io/license
  55985. */
  55986. var formDirectiveProvider$1 = {
  55987. provide: ControlContainer,
  55988. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return FormGroupDirective; })
  55989. };
  55990. /**
  55991. * @description
  55992. *
  55993. * Binds an existing `FormGroup` to a DOM element.
  55994. *
  55995. * This directive accepts an existing `FormGroup` instance. It will then use this
  55996. * `FormGroup` instance to match any child `FormControl`, `FormGroup`,
  55997. * and `FormArray` instances to child `FormControlName`, `FormGroupName`,
  55998. * and `FormArrayName` directives.
  55999. *
  56000. * @usageNotes
  56001. * **Set value**: You can set the form's initial value when instantiating the
  56002. * `FormGroup`, or you can set it programmatically later using the `FormGroup`'s
  56003. * {@link AbstractControl#setValue setValue} or {@link AbstractControl#patchValue patchValue}
  56004. * methods.
  56005. *
  56006. * **Listen to value**: If you want to listen to changes in the value of the form, you can subscribe
  56007. * to the `FormGroup`'s {@link AbstractControl#valueChanges valueChanges} event. You can also
  56008. * listen to its {@link AbstractControl#statusChanges statusChanges} event to be notified when the
  56009. * validation status is re-calculated.
  56010. *
  56011. * Furthermore, you can listen to the directive's `ngSubmit` event to be notified when the user has
  56012. * triggered a form submission. The `ngSubmit` event will be emitted with the original form
  56013. * submission event.
  56014. *
  56015. * ### Example
  56016. *
  56017. * In this example, we create form controls for first name and last name.
  56018. *
  56019. * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
  56020. *
  56021. * @ngModule ReactiveFormsModule
  56022. */
  56023. var FormGroupDirective = /** @class */ (function (_super) {
  56024. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormGroupDirective, _super);
  56025. function FormGroupDirective(_validators, _asyncValidators) {
  56026. var _this = _super.call(this) || this;
  56027. _this._validators = _validators;
  56028. _this._asyncValidators = _asyncValidators;
  56029. _this.submitted = false;
  56030. _this.directives = [];
  56031. _this.form = null;
  56032. _this.ngSubmit = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  56033. return _this;
  56034. }
  56035. FormGroupDirective.prototype.ngOnChanges = function (changes) {
  56036. this._checkFormPresent();
  56037. if (changes.hasOwnProperty('form')) {
  56038. this._updateValidators();
  56039. this._updateDomValue();
  56040. this._updateRegistrations();
  56041. }
  56042. };
  56043. Object.defineProperty(FormGroupDirective.prototype, "formDirective", {
  56044. get: function () { return this; },
  56045. enumerable: true,
  56046. configurable: true
  56047. });
  56048. Object.defineProperty(FormGroupDirective.prototype, "control", {
  56049. get: function () { return this.form; },
  56050. enumerable: true,
  56051. configurable: true
  56052. });
  56053. Object.defineProperty(FormGroupDirective.prototype, "path", {
  56054. get: function () { return []; },
  56055. enumerable: true,
  56056. configurable: true
  56057. });
  56058. FormGroupDirective.prototype.addControl = function (dir) {
  56059. var ctrl = this.form.get(dir.path);
  56060. setUpControl(ctrl, dir);
  56061. ctrl.updateValueAndValidity({ emitEvent: false });
  56062. this.directives.push(dir);
  56063. return ctrl;
  56064. };
  56065. FormGroupDirective.prototype.getControl = function (dir) { return this.form.get(dir.path); };
  56066. FormGroupDirective.prototype.removeControl = function (dir) { removeDir(this.directives, dir); };
  56067. FormGroupDirective.prototype.addFormGroup = function (dir) {
  56068. var ctrl = this.form.get(dir.path);
  56069. setUpFormContainer(ctrl, dir);
  56070. ctrl.updateValueAndValidity({ emitEvent: false });
  56071. };
  56072. FormGroupDirective.prototype.removeFormGroup = function (dir) { };
  56073. FormGroupDirective.prototype.getFormGroup = function (dir) { return this.form.get(dir.path); };
  56074. FormGroupDirective.prototype.addFormArray = function (dir) {
  56075. var ctrl = this.form.get(dir.path);
  56076. setUpFormContainer(ctrl, dir);
  56077. ctrl.updateValueAndValidity({ emitEvent: false });
  56078. };
  56079. FormGroupDirective.prototype.removeFormArray = function (dir) { };
  56080. FormGroupDirective.prototype.getFormArray = function (dir) { return this.form.get(dir.path); };
  56081. FormGroupDirective.prototype.updateModel = function (dir, value) {
  56082. var ctrl = this.form.get(dir.path);
  56083. ctrl.setValue(value);
  56084. };
  56085. FormGroupDirective.prototype.onSubmit = function ($event) {
  56086. this.submitted = true;
  56087. syncPendingControls(this.form, this.directives);
  56088. this.ngSubmit.emit($event);
  56089. return false;
  56090. };
  56091. FormGroupDirective.prototype.onReset = function () { this.resetForm(); };
  56092. FormGroupDirective.prototype.resetForm = function (value) {
  56093. if (value === void 0) { value = undefined; }
  56094. this.form.reset(value);
  56095. this.submitted = false;
  56096. };
  56097. /** @internal */
  56098. FormGroupDirective.prototype._updateDomValue = function () {
  56099. var _this = this;
  56100. this.directives.forEach(function (dir) {
  56101. var newCtrl = _this.form.get(dir.path);
  56102. if (dir.control !== newCtrl) {
  56103. cleanUpControl(dir.control, dir);
  56104. if (newCtrl)
  56105. setUpControl(newCtrl, dir);
  56106. dir.control = newCtrl;
  56107. }
  56108. });
  56109. this.form._updateTreeValidity({ emitEvent: false });
  56110. };
  56111. FormGroupDirective.prototype._updateRegistrations = function () {
  56112. var _this = this;
  56113. this.form._registerOnCollectionChange(function () { return _this._updateDomValue(); });
  56114. if (this._oldForm)
  56115. this._oldForm._registerOnCollectionChange(function () { });
  56116. this._oldForm = this.form;
  56117. };
  56118. FormGroupDirective.prototype._updateValidators = function () {
  56119. var sync = composeValidators(this._validators);
  56120. this.form.validator = Validators.compose([this.form.validator, sync]);
  56121. var async = composeAsyncValidators(this._asyncValidators);
  56122. this.form.asyncValidator = Validators.composeAsync([this.form.asyncValidator, async]);
  56123. };
  56124. FormGroupDirective.prototype._checkFormPresent = function () {
  56125. if (!this.form) {
  56126. ReactiveErrors.missingFormException();
  56127. }
  56128. };
  56129. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56130. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('formGroup'),
  56131. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", FormGroup)
  56132. ], FormGroupDirective.prototype, "form", void 0);
  56133. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56134. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])(),
  56135. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  56136. ], FormGroupDirective.prototype, "ngSubmit", void 0);
  56137. FormGroupDirective = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56138. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56139. selector: '[formGroup]',
  56140. providers: [formDirectiveProvider$1],
  56141. host: { '(submit)': 'onSubmit($event)', '(reset)': 'onReset()' },
  56142. exportAs: 'ngForm'
  56143. }),
  56144. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  56145. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  56146. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Array, Array])
  56147. ], FormGroupDirective);
  56148. return FormGroupDirective;
  56149. }(ControlContainer));
  56150. /**
  56151. * @license
  56152. * Copyright Google Inc. All Rights Reserved.
  56153. *
  56154. * Use of this source code is governed by an MIT-style license that can be
  56155. * found in the LICENSE file at https://angular.io/license
  56156. */
  56157. var formGroupNameProvider = {
  56158. provide: ControlContainer,
  56159. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return FormGroupName; })
  56160. };
  56161. /**
  56162. * @description
  56163. *
  56164. * Syncs a nested `FormGroup` to a DOM element.
  56165. *
  56166. * This directive can only be used with a parent `FormGroupDirective` (selector:
  56167. * `[formGroup]`).
  56168. *
  56169. * It accepts the string name of the nested `FormGroup` you want to link, and
  56170. * will look for a `FormGroup` registered with that name in the parent
  56171. * `FormGroup` instance you passed into `FormGroupDirective`.
  56172. *
  56173. * Nested form groups can come in handy when you want to validate a sub-group of a
  56174. * form separately from the rest or when you'd like to group the values of certain
  56175. * controls into their own nested object.
  56176. *
  56177. * @usageNotes
  56178. * **Access the group**: You can access the associated `FormGroup` using the
  56179. * {@link AbstractControl#get get} method. Ex: `this.form.get('name')`.
  56180. *
  56181. * You can also access individual controls within the group using dot syntax.
  56182. * Ex: `this.form.get('name.first')`
  56183. *
  56184. * **Get the value**: the `value` property is always synced and available on the
  56185. * `FormGroup`. See a full list of available properties in `AbstractControl`.
  56186. *
  56187. * **Set the value**: You can set an initial value for each child control when instantiating
  56188. * the `FormGroup`, or you can set it programmatically later using
  56189. * {@link AbstractControl#setValue setValue} or {@link AbstractControl#patchValue patchValue}.
  56190. *
  56191. * **Listen to value**: If you want to listen to changes in the value of the group, you can
  56192. * subscribe to the {@link AbstractControl#valueChanges valueChanges} event. You can also listen to
  56193. * {@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
  56194. * re-calculated.
  56195. *
  56196. * ### Example
  56197. *
  56198. * {@example forms/ts/nestedFormGroup/nested_form_group_example.ts region='Component'}
  56199. *
  56200. * @ngModule ReactiveFormsModule
  56201. */
  56202. var FormGroupName = /** @class */ (function (_super) {
  56203. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormGroupName, _super);
  56204. function FormGroupName(parent, validators, asyncValidators) {
  56205. var _this = _super.call(this) || this;
  56206. _this._parent = parent;
  56207. _this._validators = validators;
  56208. _this._asyncValidators = asyncValidators;
  56209. return _this;
  56210. }
  56211. /** @internal */
  56212. FormGroupName.prototype._checkParentType = function () {
  56213. if (_hasInvalidParent(this._parent)) {
  56214. ReactiveErrors.groupParentException();
  56215. }
  56216. };
  56217. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56218. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('formGroupName'),
  56219. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  56220. ], FormGroupName.prototype, "name", void 0);
  56221. FormGroupName = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56222. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: '[formGroupName]', providers: [formGroupNameProvider] }),
  56223. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"])()),
  56224. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  56225. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  56226. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ControlContainer, Array, Array])
  56227. ], FormGroupName);
  56228. return FormGroupName;
  56229. }(AbstractFormGroupDirective));
  56230. var formArrayNameProvider = {
  56231. provide: ControlContainer,
  56232. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return FormArrayName; })
  56233. };
  56234. /**
  56235. * @description
  56236. *
  56237. * Syncs a nested `FormArray` to a DOM element.
  56238. *
  56239. * This directive is designed to be used with a parent `FormGroupDirective` (selector:
  56240. * `[formGroup]`).
  56241. *
  56242. * It accepts the string name of the nested `FormArray` you want to link, and
  56243. * will look for a `FormArray` registered with that name in the parent
  56244. * `FormGroup` instance you passed into `FormGroupDirective`.
  56245. *
  56246. * Nested form arrays can come in handy when you have a group of form controls but
  56247. * you're not sure how many there will be. Form arrays allow you to create new
  56248. * form controls dynamically.
  56249. *
  56250. * @usageNotes
  56251. * **Access the array**: You can access the associated `FormArray` using the
  56252. * {@link AbstractControl#get get} method on the parent `FormGroup`.
  56253. * Ex: `this.form.get('cities')`.
  56254. *
  56255. * **Get the value**: the `value` property is always synced and available on the
  56256. * `FormArray`. See a full list of available properties in `AbstractControl`.
  56257. *
  56258. * **Set the value**: You can set an initial value for each child control when instantiating
  56259. * the `FormArray`, or you can set the value programmatically later using the
  56260. * `FormArray`'s {@link AbstractControl#setValue setValue} or
  56261. * {@link AbstractControl#patchValue patchValue} methods.
  56262. *
  56263. * **Listen to value**: If you want to listen to changes in the value of the array, you can
  56264. * subscribe to the `FormArray`'s {@link AbstractControl#valueChanges valueChanges} event.
  56265. * You can also listen to its {@link AbstractControl#statusChanges statusChanges} event to be
  56266. * notified when the validation status is re-calculated.
  56267. *
  56268. * **Add new controls**: You can add new controls to the `FormArray` dynamically by calling
  56269. * its {@link FormArray#push push} method.
  56270. * Ex: `this.form.get('cities').push(new FormControl());`
  56271. *
  56272. * ### Example
  56273. *
  56274. * {@example forms/ts/nestedFormArray/nested_form_array_example.ts region='Component'}
  56275. *
  56276. * @ngModule ReactiveFormsModule
  56277. */
  56278. var FormArrayName = /** @class */ (function (_super) {
  56279. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormArrayName, _super);
  56280. function FormArrayName(parent, validators, asyncValidators) {
  56281. var _this = _super.call(this) || this;
  56282. _this._parent = parent;
  56283. _this._validators = validators;
  56284. _this._asyncValidators = asyncValidators;
  56285. return _this;
  56286. }
  56287. FormArrayName.prototype.ngOnInit = function () {
  56288. this._checkParentType();
  56289. this.formDirective.addFormArray(this);
  56290. };
  56291. FormArrayName.prototype.ngOnDestroy = function () {
  56292. if (this.formDirective) {
  56293. this.formDirective.removeFormArray(this);
  56294. }
  56295. };
  56296. Object.defineProperty(FormArrayName.prototype, "control", {
  56297. get: function () { return this.formDirective.getFormArray(this); },
  56298. enumerable: true,
  56299. configurable: true
  56300. });
  56301. Object.defineProperty(FormArrayName.prototype, "formDirective", {
  56302. get: function () {
  56303. return this._parent ? this._parent.formDirective : null;
  56304. },
  56305. enumerable: true,
  56306. configurable: true
  56307. });
  56308. Object.defineProperty(FormArrayName.prototype, "path", {
  56309. get: function () { return controlPath(this.name, this._parent); },
  56310. enumerable: true,
  56311. configurable: true
  56312. });
  56313. Object.defineProperty(FormArrayName.prototype, "validator", {
  56314. get: function () { return composeValidators(this._validators); },
  56315. enumerable: true,
  56316. configurable: true
  56317. });
  56318. Object.defineProperty(FormArrayName.prototype, "asyncValidator", {
  56319. get: function () {
  56320. return composeAsyncValidators(this._asyncValidators);
  56321. },
  56322. enumerable: true,
  56323. configurable: true
  56324. });
  56325. FormArrayName.prototype._checkParentType = function () {
  56326. if (_hasInvalidParent(this._parent)) {
  56327. ReactiveErrors.arrayParentException();
  56328. }
  56329. };
  56330. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56331. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('formArrayName'),
  56332. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  56333. ], FormArrayName.prototype, "name", void 0);
  56334. FormArrayName = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56335. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: '[formArrayName]', providers: [formArrayNameProvider] }),
  56336. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"])()),
  56337. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  56338. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  56339. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ControlContainer, Array, Array])
  56340. ], FormArrayName);
  56341. return FormArrayName;
  56342. }(ControlContainer));
  56343. function _hasInvalidParent(parent) {
  56344. return !(parent instanceof FormGroupName) && !(parent instanceof FormGroupDirective) &&
  56345. !(parent instanceof FormArrayName);
  56346. }
  56347. /**
  56348. * @license
  56349. * Copyright Google Inc. All Rights Reserved.
  56350. *
  56351. * Use of this source code is governed by an MIT-style license that can be
  56352. * found in the LICENSE file at https://angular.io/license
  56353. */
  56354. var controlNameBinding = {
  56355. provide: NgControl,
  56356. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return FormControlName; })
  56357. };
  56358. /**
  56359. * @description
  56360. *
  56361. * Syncs a `FormControl` in an existing `FormGroup` to a form control
  56362. * element by name.
  56363. *
  56364. * This directive ensures that any values written to the `FormControl`
  56365. * instance programmatically will be written to the DOM element (model -> view). Conversely,
  56366. * any values written to the DOM element through user input will be reflected in the
  56367. * `FormControl` instance (view -> model).
  56368. *
  56369. * @usageNotes
  56370. * This directive is designed to be used with a parent `FormGroupDirective` (selector:
  56371. * `[formGroup]`).
  56372. *
  56373. * It accepts the string name of the `FormControl` instance you want to
  56374. * link, and will look for a `FormControl` registered with that name in the
  56375. * closest `FormGroup` or `FormArray` above it.
  56376. *
  56377. * **Access the control**: You can access the `FormControl` associated with
  56378. * this directive by using the {@link AbstractControl#get get} method.
  56379. * Ex: `this.form.get('first');`
  56380. *
  56381. * **Get value**: the `value` property is always synced and available on the `FormControl`.
  56382. * See a full list of available properties in `AbstractControl`.
  56383. *
  56384. * **Set value**: You can set an initial value for the control when instantiating the
  56385. * `FormControl`, or you can set it programmatically later using
  56386. * {@link AbstractControl#setValue setValue} or {@link AbstractControl#patchValue patchValue}.
  56387. *
  56388. * **Listen to value**: If you want to listen to changes in the value of the control, you can
  56389. * subscribe to the {@link AbstractControl#valueChanges valueChanges} event. You can also listen to
  56390. * {@link AbstractControl#statusChanges statusChanges} to be notified when the validation status is
  56391. * re-calculated.
  56392. *
  56393. * ### Example
  56394. *
  56395. * In this example, we create form controls for first name and last name.
  56396. *
  56397. * {@example forms/ts/simpleFormGroup/simple_form_group_example.ts region='Component'}
  56398. *
  56399. * To see `formControlName` examples with different form control types, see:
  56400. *
  56401. * * Radio buttons: `RadioControlValueAccessor`
  56402. * * Selects: `SelectControlValueAccessor`
  56403. *
  56404. * ### Use with ngModel
  56405. *
  56406. * Support for using the `ngModel` input property and `ngModelChange` event with reactive
  56407. * form directives has been deprecated in Angular v6 and will be removed in Angular v7.
  56408. *
  56409. * Now deprecated:
  56410. *
  56411. * ```html
  56412. * <form [formGroup]="form">
  56413. * <input formControlName="first" [(ngModel)]="value">
  56414. * </form>
  56415. * ```
  56416. *
  56417. * ```ts
  56418. * this.value = 'some value';
  56419. * ```
  56420. *
  56421. * This has been deprecated for a few reasons. First, developers have found this pattern
  56422. * confusing. It seems like the actual `ngModel` directive is being used, but in fact it's
  56423. * an input/output property named `ngModel` on the reactive form directive that simply
  56424. * approximates (some of) its behavior. Specifically, it allows getting/setting the value
  56425. * and intercepting value events. However, some of `ngModel`'s other features - like
  56426. * delaying updates with`ngModelOptions` or exporting the directive - simply don't work,
  56427. * which has understandably caused some confusion.
  56428. *
  56429. * In addition, this pattern mixes template-driven and reactive forms strategies, which
  56430. * we generally don't recommend because it doesn't take advantage of the full benefits of
  56431. * either strategy. Setting the value in the template violates the template-agnostic
  56432. * principles behind reactive forms, whereas adding a `FormControl`/`FormGroup` layer in
  56433. * the class removes the convenience of defining forms in the template.
  56434. *
  56435. * To update your code before v7, you'll want to decide whether to stick with reactive form
  56436. * directives (and get/set values using reactive forms patterns) or switch over to
  56437. * template-driven directives.
  56438. *
  56439. * After (choice 1 - use reactive forms):
  56440. *
  56441. * ```html
  56442. * <form [formGroup]="form">
  56443. * <input formControlName="first">
  56444. * </form>
  56445. * ```
  56446. *
  56447. * ```ts
  56448. * this.form.get('first').setValue('some value');
  56449. * ```
  56450. *
  56451. * After (choice 2 - use template-driven forms):
  56452. *
  56453. * ```html
  56454. * <input [(ngModel)]="value">
  56455. * ```
  56456. *
  56457. * ```ts
  56458. * this.value = 'some value';
  56459. * ```
  56460. *
  56461. * By default, when you use this pattern, you will see a deprecation warning once in dev
  56462. * mode. You can choose to silence this warning by providing a config for
  56463. * `ReactiveFormsModule` at import time:
  56464. *
  56465. * ```ts
  56466. * imports: [
  56467. * ReactiveFormsModule.withConfig({warnOnNgModelWithFormControl: 'never'});
  56468. * ]
  56469. * ```
  56470. *
  56471. * Alternatively, you can choose to surface a separate warning for each instance of this
  56472. * pattern with a config value of `"always"`. This may help to track down where in the code
  56473. * the pattern is being used as the code is being updated.
  56474. *
  56475. * @ngModule ReactiveFormsModule
  56476. */
  56477. var FormControlName = /** @class */ (function (_super) {
  56478. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(FormControlName, _super);
  56479. function FormControlName(parent, validators, asyncValidators, valueAccessors, _ngModelWarningConfig) {
  56480. var _this = _super.call(this) || this;
  56481. _this._ngModelWarningConfig = _ngModelWarningConfig;
  56482. _this._added = false;
  56483. /** @deprecated as of v6 */
  56484. _this.update = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  56485. /**
  56486. * Instance property used to track whether an ngModel warning has been sent out for this
  56487. * particular FormControlName instance. Used to support warning config of "always".
  56488. *
  56489. * @internal
  56490. */
  56491. _this._ngModelWarningSent = false;
  56492. _this._parent = parent;
  56493. _this._rawValidators = validators || [];
  56494. _this._rawAsyncValidators = asyncValidators || [];
  56495. _this.valueAccessor = selectValueAccessor(_this, valueAccessors);
  56496. return _this;
  56497. }
  56498. FormControlName_1 = FormControlName;
  56499. Object.defineProperty(FormControlName.prototype, "isDisabled", {
  56500. set: function (isDisabled) { ReactiveErrors.disabledAttrWarning(); },
  56501. enumerable: true,
  56502. configurable: true
  56503. });
  56504. FormControlName.prototype.ngOnChanges = function (changes) {
  56505. if (!this._added)
  56506. this._setUpControl();
  56507. if (isPropertyUpdated(changes, this.viewModel)) {
  56508. _ngModelWarning('formControlName', FormControlName_1, this, this._ngModelWarningConfig);
  56509. this.viewModel = this.model;
  56510. this.formDirective.updateModel(this, this.model);
  56511. }
  56512. };
  56513. FormControlName.prototype.ngOnDestroy = function () {
  56514. if (this.formDirective) {
  56515. this.formDirective.removeControl(this);
  56516. }
  56517. };
  56518. FormControlName.prototype.viewToModelUpdate = function (newValue) {
  56519. this.viewModel = newValue;
  56520. this.update.emit(newValue);
  56521. };
  56522. Object.defineProperty(FormControlName.prototype, "path", {
  56523. get: function () { return controlPath(this.name, this._parent); },
  56524. enumerable: true,
  56525. configurable: true
  56526. });
  56527. Object.defineProperty(FormControlName.prototype, "formDirective", {
  56528. get: function () { return this._parent ? this._parent.formDirective : null; },
  56529. enumerable: true,
  56530. configurable: true
  56531. });
  56532. Object.defineProperty(FormControlName.prototype, "validator", {
  56533. get: function () { return composeValidators(this._rawValidators); },
  56534. enumerable: true,
  56535. configurable: true
  56536. });
  56537. Object.defineProperty(FormControlName.prototype, "asyncValidator", {
  56538. get: function () {
  56539. return composeAsyncValidators(this._rawAsyncValidators);
  56540. },
  56541. enumerable: true,
  56542. configurable: true
  56543. });
  56544. FormControlName.prototype._checkParentType = function () {
  56545. if (!(this._parent instanceof FormGroupName) &&
  56546. this._parent instanceof AbstractFormGroupDirective) {
  56547. ReactiveErrors.ngModelGroupException();
  56548. }
  56549. else if (!(this._parent instanceof FormGroupName) && !(this._parent instanceof FormGroupDirective) &&
  56550. !(this._parent instanceof FormArrayName)) {
  56551. ReactiveErrors.controlParentException();
  56552. }
  56553. };
  56554. FormControlName.prototype._setUpControl = function () {
  56555. this._checkParentType();
  56556. this.control = this.formDirective.addControl(this);
  56557. if (this.control.disabled && this.valueAccessor.setDisabledState) {
  56558. this.valueAccessor.setDisabledState(true);
  56559. }
  56560. this._added = true;
  56561. };
  56562. var FormControlName_1;
  56563. /**
  56564. * Static property used to track whether any ngModel warnings have been sent across
  56565. * all instances of FormControlName. Used to support warning config of "once".
  56566. *
  56567. * @internal
  56568. */
  56569. FormControlName._ngModelWarningSentOnce = false;
  56570. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56571. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('formControlName'),
  56572. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  56573. ], FormControlName.prototype, "name", void 0);
  56574. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56575. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('disabled'),
  56576. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean),
  56577. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Boolean])
  56578. ], FormControlName.prototype, "isDisabled", null);
  56579. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56580. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])('ngModel'),
  56581. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  56582. ], FormControlName.prototype, "model", void 0);
  56583. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56584. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])('ngModelChange'),
  56585. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  56586. ], FormControlName.prototype, "update", void 0);
  56587. FormControlName = FormControlName_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56588. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: '[formControlName]', providers: [controlNameBinding] }),
  56589. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Host"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"])()),
  56590. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALIDATORS)),
  56591. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_ASYNC_VALIDATORS)),
  56592. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Self"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_VALUE_ACCESSOR)),
  56593. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(4, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(4, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(NG_MODEL_WITH_FORM_CONTROL_WARNING)),
  56594. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ControlContainer,
  56595. Array,
  56596. Array, Array, Object])
  56597. ], FormControlName);
  56598. return FormControlName;
  56599. }(NgControl));
  56600. /**
  56601. * @license
  56602. * Copyright Google Inc. All Rights Reserved.
  56603. *
  56604. * Use of this source code is governed by an MIT-style license that can be
  56605. * found in the LICENSE file at https://angular.io/license
  56606. */
  56607. var REQUIRED_VALIDATOR = {
  56608. provide: NG_VALIDATORS,
  56609. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return RequiredValidator; }),
  56610. multi: true
  56611. };
  56612. var CHECKBOX_REQUIRED_VALIDATOR = {
  56613. provide: NG_VALIDATORS,
  56614. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return CheckboxRequiredValidator; }),
  56615. multi: true
  56616. };
  56617. /**
  56618. * A Directive that adds the `required` validator to any controls marked with the
  56619. * `required` attribute, via the `NG_VALIDATORS` binding.
  56620. *
  56621. * @usageNotes
  56622. * ### Example
  56623. *
  56624. * ```
  56625. * <input name="fullName" ngModel required>
  56626. * ```
  56627. *
  56628. * @ngModule FormsModule
  56629. * @ngModule ReactiveFormsModule
  56630. */
  56631. var RequiredValidator = /** @class */ (function () {
  56632. function RequiredValidator() {
  56633. }
  56634. Object.defineProperty(RequiredValidator.prototype, "required", {
  56635. get: function () { return this._required; },
  56636. set: function (value) {
  56637. this._required = value != null && value !== false && "" + value !== 'false';
  56638. if (this._onChange)
  56639. this._onChange();
  56640. },
  56641. enumerable: true,
  56642. configurable: true
  56643. });
  56644. RequiredValidator.prototype.validate = function (control) {
  56645. return this.required ? Validators.required(control) : null;
  56646. };
  56647. RequiredValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
  56648. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56649. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  56650. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  56651. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  56652. ], RequiredValidator.prototype, "required", null);
  56653. RequiredValidator = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56654. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56655. selector: ':not([type=checkbox])[required][formControlName],:not([type=checkbox])[required][formControl],:not([type=checkbox])[required][ngModel]',
  56656. providers: [REQUIRED_VALIDATOR],
  56657. host: { '[attr.required]': 'required ? "" : null' }
  56658. })
  56659. ], RequiredValidator);
  56660. return RequiredValidator;
  56661. }());
  56662. /**
  56663. * A Directive that adds the `required` validator to checkbox controls marked with the
  56664. * `required` attribute, via the `NG_VALIDATORS` binding.
  56665. *
  56666. * @usageNotes
  56667. * ### Example
  56668. *
  56669. * ```
  56670. * <input type="checkbox" name="active" ngModel required>
  56671. * ```
  56672. *
  56673. * @experimental
  56674. * @ngModule FormsModule
  56675. * @ngModule ReactiveFormsModule
  56676. */
  56677. var CheckboxRequiredValidator = /** @class */ (function (_super) {
  56678. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(CheckboxRequiredValidator, _super);
  56679. function CheckboxRequiredValidator() {
  56680. return _super !== null && _super.apply(this, arguments) || this;
  56681. }
  56682. CheckboxRequiredValidator.prototype.validate = function (control) {
  56683. return this.required ? Validators.requiredTrue(control) : null;
  56684. };
  56685. CheckboxRequiredValidator = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56686. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56687. selector: 'input[type=checkbox][required][formControlName],input[type=checkbox][required][formControl],input[type=checkbox][required][ngModel]',
  56688. providers: [CHECKBOX_REQUIRED_VALIDATOR],
  56689. host: { '[attr.required]': 'required ? "" : null' }
  56690. })
  56691. ], CheckboxRequiredValidator);
  56692. return CheckboxRequiredValidator;
  56693. }(RequiredValidator));
  56694. /**
  56695. * Provider which adds `EmailValidator` to `NG_VALIDATORS`.
  56696. */
  56697. var EMAIL_VALIDATOR = {
  56698. provide: NG_VALIDATORS,
  56699. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return EmailValidator; }),
  56700. multi: true
  56701. };
  56702. /**
  56703. * A Directive that adds the `email` validator to controls marked with the
  56704. * `email` attribute, via the `NG_VALIDATORS` binding.
  56705. *
  56706. * @usageNotes
  56707. * ### Example
  56708. *
  56709. * ```
  56710. * <input type="email" name="email" ngModel email>
  56711. * <input type="email" name="email" ngModel email="true">
  56712. * <input type="email" name="email" ngModel [email]="true">
  56713. * ```
  56714. *
  56715. * @experimental
  56716. * @ngModule FormsModule
  56717. * @ngModule ReactiveFormsModule
  56718. */
  56719. var EmailValidator = /** @class */ (function () {
  56720. function EmailValidator() {
  56721. }
  56722. Object.defineProperty(EmailValidator.prototype, "email", {
  56723. set: function (value) {
  56724. this._enabled = value === '' || value === true || value === 'true';
  56725. if (this._onChange)
  56726. this._onChange();
  56727. },
  56728. enumerable: true,
  56729. configurable: true
  56730. });
  56731. EmailValidator.prototype.validate = function (control) {
  56732. return this._enabled ? Validators.email(control) : null;
  56733. };
  56734. EmailValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
  56735. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56736. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  56737. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  56738. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  56739. ], EmailValidator.prototype, "email", null);
  56740. EmailValidator = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56741. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56742. selector: '[email][formControlName],[email][formControl],[email][ngModel]',
  56743. providers: [EMAIL_VALIDATOR]
  56744. })
  56745. ], EmailValidator);
  56746. return EmailValidator;
  56747. }());
  56748. /**
  56749. * Provider which adds `MinLengthValidator` to `NG_VALIDATORS`.
  56750. *
  56751. * @usageNotes
  56752. * ### Example:
  56753. *
  56754. * {@example common/forms/ts/validators/validators.ts region='min'}
  56755. */
  56756. var MIN_LENGTH_VALIDATOR = {
  56757. provide: NG_VALIDATORS,
  56758. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return MinLengthValidator; }),
  56759. multi: true
  56760. };
  56761. /**
  56762. * A directive which installs the `MinLengthValidator` for any `formControlName`,
  56763. * `formControl`, or control with `ngModel` that also has a `minlength` attribute.
  56764. *
  56765. * @ngModule FormsModule
  56766. * @ngModule ReactiveFormsModule
  56767. */
  56768. var MinLengthValidator = /** @class */ (function () {
  56769. function MinLengthValidator() {
  56770. }
  56771. MinLengthValidator.prototype.ngOnChanges = function (changes) {
  56772. if ('minlength' in changes) {
  56773. this._createValidator();
  56774. if (this._onChange)
  56775. this._onChange();
  56776. }
  56777. };
  56778. MinLengthValidator.prototype.validate = function (control) {
  56779. return this.minlength == null ? null : this._validator(control);
  56780. };
  56781. MinLengthValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
  56782. MinLengthValidator.prototype._createValidator = function () {
  56783. this._validator = Validators.minLength(parseInt(this.minlength, 10));
  56784. };
  56785. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56786. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  56787. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  56788. ], MinLengthValidator.prototype, "minlength", void 0);
  56789. MinLengthValidator = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56790. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56791. selector: '[minlength][formControlName],[minlength][formControl],[minlength][ngModel]',
  56792. providers: [MIN_LENGTH_VALIDATOR],
  56793. host: { '[attr.minlength]': 'minlength ? minlength : null' }
  56794. })
  56795. ], MinLengthValidator);
  56796. return MinLengthValidator;
  56797. }());
  56798. /**
  56799. * Provider which adds `MaxLengthValidator` to `NG_VALIDATORS`.
  56800. *
  56801. * @usageNotes
  56802. * ### Example:
  56803. *
  56804. * {@example common/forms/ts/validators/validators.ts region='max'}
  56805. */
  56806. var MAX_LENGTH_VALIDATOR = {
  56807. provide: NG_VALIDATORS,
  56808. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return MaxLengthValidator; }),
  56809. multi: true
  56810. };
  56811. /**
  56812. * A directive which installs the `MaxLengthValidator` for any `formControlName`,
  56813. * `formControl`, or control with `ngModel` that also has a `maxlength` attribute.
  56814. *
  56815. * @ngModule FormsModule
  56816. * @ngModule ReactiveFormsModule
  56817. */
  56818. var MaxLengthValidator = /** @class */ (function () {
  56819. function MaxLengthValidator() {
  56820. }
  56821. MaxLengthValidator.prototype.ngOnChanges = function (changes) {
  56822. if ('maxlength' in changes) {
  56823. this._createValidator();
  56824. if (this._onChange)
  56825. this._onChange();
  56826. }
  56827. };
  56828. MaxLengthValidator.prototype.validate = function (control) {
  56829. return this.maxlength != null ? this._validator(control) : null;
  56830. };
  56831. MaxLengthValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
  56832. MaxLengthValidator.prototype._createValidator = function () {
  56833. this._validator = Validators.maxLength(parseInt(this.maxlength, 10));
  56834. };
  56835. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56836. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  56837. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  56838. ], MaxLengthValidator.prototype, "maxlength", void 0);
  56839. MaxLengthValidator = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56840. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56841. selector: '[maxlength][formControlName],[maxlength][formControl],[maxlength][ngModel]',
  56842. providers: [MAX_LENGTH_VALIDATOR],
  56843. host: { '[attr.maxlength]': 'maxlength ? maxlength : null' }
  56844. })
  56845. ], MaxLengthValidator);
  56846. return MaxLengthValidator;
  56847. }());
  56848. var PATTERN_VALIDATOR = {
  56849. provide: NG_VALIDATORS,
  56850. useExisting: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["forwardRef"])(function () { return PatternValidator; }),
  56851. multi: true
  56852. };
  56853. /**
  56854. * A Directive that adds the `pattern` validator to any controls marked with the
  56855. * `pattern` attribute, via the `NG_VALIDATORS` binding. Uses attribute value
  56856. * as the regex to validate Control value against. Follows pattern attribute
  56857. * semantics; i.e. regex must match entire Control value.
  56858. *
  56859. * @usageNotes
  56860. * ### Example
  56861. *
  56862. * ```
  56863. * <input [name]="fullName" pattern="[a-zA-Z ]*" ngModel>
  56864. * ```
  56865. *
  56866. * @ngModule FormsModule
  56867. * @ngModule ReactiveFormsModule
  56868. */
  56869. var PatternValidator = /** @class */ (function () {
  56870. function PatternValidator() {
  56871. }
  56872. PatternValidator.prototype.ngOnChanges = function (changes) {
  56873. if ('pattern' in changes) {
  56874. this._createValidator();
  56875. if (this._onChange)
  56876. this._onChange();
  56877. }
  56878. };
  56879. PatternValidator.prototype.validate = function (control) { return this._validator(control); };
  56880. PatternValidator.prototype.registerOnValidatorChange = function (fn) { this._onChange = fn; };
  56881. PatternValidator.prototype._createValidator = function () { this._validator = Validators.pattern(this.pattern); };
  56882. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56883. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  56884. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  56885. ], PatternValidator.prototype, "pattern", void 0);
  56886. PatternValidator = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  56887. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  56888. selector: '[pattern][formControlName],[pattern][formControl],[pattern][ngModel]',
  56889. providers: [PATTERN_VALIDATOR],
  56890. host: { '[attr.pattern]': 'pattern ? pattern : null' }
  56891. })
  56892. ], PatternValidator);
  56893. return PatternValidator;
  56894. }());
  56895. /**
  56896. * @license
  56897. * Copyright Google Inc. All Rights Reserved.
  56898. *
  56899. * Use of this source code is governed by an MIT-style license that can be
  56900. * found in the LICENSE file at https://angular.io/license
  56901. */
  56902. /**
  56903. * @description
  56904. * Creates an `AbstractControl` from a user-specified configuration.
  56905. *
  56906. * The `FormBuilder` provides syntactic sugar that shortens creating instances of a `FormControl`,
  56907. * `FormGroup`, or `FormArray`. It reduces the amount of boilerplate needed to build complex
  56908. * forms.
  56909. *
  56910. * @see [Reactive Forms Guide](/guide/reactive-forms)
  56911. *
  56912. */
  56913. var FormBuilder = /** @class */ (function () {
  56914. function FormBuilder() {
  56915. }
  56916. /**
  56917. * @description
  56918. * Construct a new `FormGroup` instance.
  56919. *
  56920. * @param controlsConfig A collection of child controls. The key for each child is the name
  56921. * under which it is registered.
  56922. *
  56923. * @param extra An object of configuration options for the `FormGroup`.
  56924. * * `validator`: A synchronous validator function, or an array of validator functions
  56925. * * `asyncValidator`: A single async validator or array of async validator functions
  56926. *
  56927. */
  56928. FormBuilder.prototype.group = function (controlsConfig, extra) {
  56929. if (extra === void 0) { extra = null; }
  56930. var controls = this._reduceControls(controlsConfig);
  56931. var validator = extra != null ? extra['validator'] : null;
  56932. var asyncValidator = extra != null ? extra['asyncValidator'] : null;
  56933. return new FormGroup(controls, validator, asyncValidator);
  56934. };
  56935. /**
  56936. * @description
  56937. * Construct a new `FormControl` instance.
  56938. *
  56939. * @param formState Initializes the control with an initial value,
  56940. * or an object that defines the initial value and disabled state.
  56941. *
  56942. * @param validator A synchronous validator function, or an array of synchronous validator
  56943. * functions.
  56944. *
  56945. * @param asyncValidator A single async validator or array of async validator functions
  56946. *
  56947. * @usageNotes
  56948. *
  56949. * ### Initialize a control as disabled
  56950. *
  56951. * The following example returns a control with an initial value in a disabled state.
  56952. *
  56953. * <code-example path="forms/ts/formBuilder/form_builder_example.ts"
  56954. * linenums="false" region="disabled-control">
  56955. * </code-example>
  56956. *
  56957. */
  56958. FormBuilder.prototype.control = function (formState, validator, asyncValidator) {
  56959. return new FormControl(formState, validator, asyncValidator);
  56960. };
  56961. /**
  56962. * @description
  56963. * Construct a new `FormArray` instance.
  56964. *
  56965. * @param controlsConfig An array of child controls. The key for each child control is its index
  56966. * in the array.
  56967. *
  56968. * @param validator A synchronous validator function, or an array of synchronous validator
  56969. * functions.
  56970. *
  56971. * @param asyncValidator A single async validator or array of async validator functions
  56972. */
  56973. FormBuilder.prototype.array = function (controlsConfig, validator, asyncValidator) {
  56974. var _this = this;
  56975. var controls = controlsConfig.map(function (c) { return _this._createControl(c); });
  56976. return new FormArray(controls, validator, asyncValidator);
  56977. };
  56978. /** @internal */
  56979. FormBuilder.prototype._reduceControls = function (controlsConfig) {
  56980. var _this = this;
  56981. var controls = {};
  56982. Object.keys(controlsConfig).forEach(function (controlName) {
  56983. controls[controlName] = _this._createControl(controlsConfig[controlName]);
  56984. });
  56985. return controls;
  56986. };
  56987. /** @internal */
  56988. FormBuilder.prototype._createControl = function (controlConfig) {
  56989. if (controlConfig instanceof FormControl || controlConfig instanceof FormGroup ||
  56990. controlConfig instanceof FormArray) {
  56991. return controlConfig;
  56992. }
  56993. else if (Array.isArray(controlConfig)) {
  56994. var value = controlConfig[0];
  56995. var validator = controlConfig.length > 1 ? controlConfig[1] : null;
  56996. var asyncValidator = controlConfig.length > 2 ? controlConfig[2] : null;
  56997. return this.control(value, validator, asyncValidator);
  56998. }
  56999. else {
  57000. return this.control(controlConfig);
  57001. }
  57002. };
  57003. FormBuilder = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  57004. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])()
  57005. ], FormBuilder);
  57006. return FormBuilder;
  57007. }());
  57008. /**
  57009. * @license
  57010. * Copyright Google Inc. All Rights Reserved.
  57011. *
  57012. * Use of this source code is governed by an MIT-style license that can be
  57013. * found in the LICENSE file at https://angular.io/license
  57014. */
  57015. var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Version"]('6.1.10');
  57016. /**
  57017. * @license
  57018. * Copyright Google Inc. All Rights Reserved.
  57019. *
  57020. * Use of this source code is governed by an MIT-style license that can be
  57021. * found in the LICENSE file at https://angular.io/license
  57022. */
  57023. /**
  57024. * @description
  57025. *
  57026. * Adds `novalidate` attribute to all forms by default.
  57027. *
  57028. * `novalidate` is used to disable browser's native form validation.
  57029. *
  57030. * If you want to use native validation with Angular forms, just add `ngNativeValidate` attribute:
  57031. *
  57032. * ```
  57033. * <form ngNativeValidate></form>
  57034. * ```
  57035. *
  57036. * @experimental
  57037. * @ngModule ReactiveFormsModule
  57038. * @ngModule FormsModule
  57039. */
  57040. var NgNoValidate = /** @class */ (function () {
  57041. function NgNoValidate() {
  57042. }
  57043. NgNoValidate = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  57044. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  57045. selector: 'form:not([ngNoForm]):not([ngNativeValidate])',
  57046. host: { 'novalidate': '' },
  57047. })
  57048. ], NgNoValidate);
  57049. return NgNoValidate;
  57050. }());
  57051. /**
  57052. * @license
  57053. * Copyright Google Inc. All Rights Reserved.
  57054. *
  57055. * Use of this source code is governed by an MIT-style license that can be
  57056. * found in the LICENSE file at https://angular.io/license
  57057. */
  57058. var SHARED_FORM_DIRECTIVES = [
  57059. NgNoValidate,
  57060. NgSelectOption,
  57061. NgSelectMultipleOption,
  57062. DefaultValueAccessor,
  57063. NumberValueAccessor,
  57064. RangeValueAccessor,
  57065. CheckboxControlValueAccessor,
  57066. SelectControlValueAccessor,
  57067. SelectMultipleControlValueAccessor,
  57068. RadioControlValueAccessor,
  57069. NgControlStatus,
  57070. NgControlStatusGroup,
  57071. RequiredValidator,
  57072. MinLengthValidator,
  57073. MaxLengthValidator,
  57074. PatternValidator,
  57075. CheckboxRequiredValidator,
  57076. EmailValidator,
  57077. ];
  57078. var TEMPLATE_DRIVEN_DIRECTIVES = [NgModel, NgModelGroup, NgForm];
  57079. var REACTIVE_DRIVEN_DIRECTIVES = [FormControlDirective, FormGroupDirective, FormControlName, FormGroupName, FormArrayName];
  57080. /**
  57081. * Internal module used for sharing directives between FormsModule and ReactiveFormsModule
  57082. */
  57083. var InternalFormsSharedModule = /** @class */ (function () {
  57084. function InternalFormsSharedModule() {
  57085. }
  57086. InternalFormsSharedModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  57087. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  57088. declarations: SHARED_FORM_DIRECTIVES,
  57089. exports: SHARED_FORM_DIRECTIVES,
  57090. })
  57091. ], InternalFormsSharedModule);
  57092. return InternalFormsSharedModule;
  57093. }());
  57094. /**
  57095. * @license
  57096. * Copyright Google Inc. All Rights Reserved.
  57097. *
  57098. * Use of this source code is governed by an MIT-style license that can be
  57099. * found in the LICENSE file at https://angular.io/license
  57100. */
  57101. /**
  57102. * Exports the required providers and directives for template-driven forms,
  57103. * making them available for import by NgModules that import this module.
  57104. * @see [Forms](guide/forms)
  57105. *
  57106. * @see [Forms Guide](/guide/forms)
  57107. */
  57108. var FormsModule = /** @class */ (function () {
  57109. function FormsModule() {
  57110. }
  57111. FormsModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  57112. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  57113. declarations: TEMPLATE_DRIVEN_DIRECTIVES,
  57114. providers: [RadioControlRegistry],
  57115. exports: [InternalFormsSharedModule, TEMPLATE_DRIVEN_DIRECTIVES]
  57116. })
  57117. ], FormsModule);
  57118. return FormsModule;
  57119. }());
  57120. /**
  57121. * Exports the required infrastructure and directives for reactive forms,
  57122. * making them available for import by NgModules that import this module.
  57123. * @see [Forms](guide/reactive-forms)
  57124. *
  57125. * @see [Reactive Forms Guide](/guide/reactive-forms)
  57126. *
  57127. */
  57128. var ReactiveFormsModule = /** @class */ (function () {
  57129. function ReactiveFormsModule() {
  57130. }
  57131. ReactiveFormsModule_1 = ReactiveFormsModule;
  57132. /**
  57133. * @description
  57134. * Provides options for configuring the reactive forms module.
  57135. *
  57136. * @param opts An object of configuration options `warnOnNgModelWithFormControl` Configures when
  57137. * to emit a warning when an `ngModel binding is used with reactive form directives.
  57138. */
  57139. ReactiveFormsModule.withConfig = function (opts) {
  57140. return {
  57141. ngModule: ReactiveFormsModule_1,
  57142. providers: [{
  57143. provide: NG_MODEL_WITH_FORM_CONTROL_WARNING,
  57144. useValue: opts.warnOnNgModelWithFormControl
  57145. }]
  57146. };
  57147. };
  57148. var ReactiveFormsModule_1;
  57149. ReactiveFormsModule = ReactiveFormsModule_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  57150. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  57151. declarations: [REACTIVE_DRIVEN_DIRECTIVES],
  57152. providers: [FormBuilder, RadioControlRegistry],
  57153. exports: [InternalFormsSharedModule, REACTIVE_DRIVEN_DIRECTIVES]
  57154. })
  57155. ], ReactiveFormsModule);
  57156. return ReactiveFormsModule;
  57157. }());
  57158. /**
  57159. * @license
  57160. * Copyright Google Inc. All Rights Reserved.
  57161. *
  57162. * Use of this source code is governed by an MIT-style license that can be
  57163. * found in the LICENSE file at https://angular.io/license
  57164. */
  57165. /**
  57166. * @license
  57167. * Copyright Google Inc. All Rights Reserved.
  57168. *
  57169. * Use of this source code is governed by an MIT-style license that can be
  57170. * found in the LICENSE file at https://angular.io/license
  57171. */
  57172. // This file only reexports content of the `src` folder. Keep it that way.
  57173. /**
  57174. * @license
  57175. * Copyright Google Inc. All Rights Reserved.
  57176. *
  57177. * Use of this source code is governed by an MIT-style license that can be
  57178. * found in the LICENSE file at https://angular.io/license
  57179. */
  57180. /**
  57181. * Generated bundle index. Do not edit.
  57182. */
  57183. //# sourceMappingURL=forms.js.map
  57184. /***/ }),
  57185. /***/ "./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js":
  57186. /*!******************************************************************************************!*\
  57187. !*** ./node_modules/@angular/platform-browser-dynamic/fesm5/platform-browser-dynamic.js ***!
  57188. \******************************************************************************************/
  57189. /*! exports provided: ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a, RESOURCE_CACHE_PROVIDER, platformBrowserDynamic, VERSION, JitCompilerFactory, ɵCompilerImpl, ɵplatformCoreDynamic, ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS, ɵResourceLoaderImpl */
  57190. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57191. "use strict";
  57192. __webpack_require__.r(__webpack_exports__);
  57193. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_dynamic_platform_browser_dynamic_a", function() { return CachedResourceLoader; });
  57194. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RESOURCE_CACHE_PROVIDER", function() { return RESOURCE_CACHE_PROVIDER; });
  57195. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformBrowserDynamic", function() { return platformBrowserDynamic; });
  57196. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  57197. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "JitCompilerFactory", function() { return JitCompilerFactory; });
  57198. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵCompilerImpl", function() { return CompilerImpl; });
  57199. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵplatformCoreDynamic", function() { return platformCoreDynamic; });
  57200. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS", function() { return INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS; });
  57201. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵResourceLoaderImpl", function() { return ResourceLoaderImpl; });
  57202. /* harmony import */ var _angular_compiler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/compiler */ "./node_modules/@angular/compiler/fesm5/compiler.js");
  57203. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  57204. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  57205. /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js");
  57206. /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  57207. /**
  57208. * @license Angular v6.1.10
  57209. * (c) 2010-2018 Google, Inc. https://angular.io/
  57210. * License: MIT
  57211. */
  57212. /**
  57213. * @license
  57214. * Copyright Google Inc. All Rights Reserved.
  57215. *
  57216. * Use of this source code is governed by an MIT-style license that can be
  57217. * found in the LICENSE file at https://angular.io/license
  57218. */
  57219. var MODULE_SUFFIX = '';
  57220. var builtinExternalReferences = createBuiltinExternalReferencesMap();
  57221. var JitReflector = /** @class */ (function () {
  57222. function JitReflector() {
  57223. this.builtinExternalReferences = new Map();
  57224. this.reflectionCapabilities = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵReflectionCapabilities"]();
  57225. }
  57226. JitReflector.prototype.componentModuleUrl = function (type, cmpMetadata) {
  57227. var moduleId = cmpMetadata.moduleId;
  57228. if (typeof moduleId === 'string') {
  57229. var scheme = Object(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["getUrlScheme"])(moduleId);
  57230. return scheme ? moduleId : "package:" + moduleId + MODULE_SUFFIX;
  57231. }
  57232. else if (moduleId !== null && moduleId !== void 0) {
  57233. throw Object(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["syntaxError"])("moduleId should be a string in \"" + Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵstringify"])(type) + "\". See https://goo.gl/wIDDiL for more information.\n" +
  57234. "If you're using Webpack you should inline the template and the styles, see https://goo.gl/X2J8zc.");
  57235. }
  57236. return "./" + Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵstringify"])(type);
  57237. };
  57238. JitReflector.prototype.parameters = function (typeOrFunc) {
  57239. return this.reflectionCapabilities.parameters(typeOrFunc);
  57240. };
  57241. JitReflector.prototype.tryAnnotations = function (typeOrFunc) { return this.annotations(typeOrFunc); };
  57242. JitReflector.prototype.annotations = function (typeOrFunc) {
  57243. return this.reflectionCapabilities.annotations(typeOrFunc);
  57244. };
  57245. JitReflector.prototype.shallowAnnotations = function (typeOrFunc) {
  57246. throw new Error('Not supported in JIT mode');
  57247. };
  57248. JitReflector.prototype.propMetadata = function (typeOrFunc) {
  57249. return this.reflectionCapabilities.propMetadata(typeOrFunc);
  57250. };
  57251. JitReflector.prototype.hasLifecycleHook = function (type, lcProperty) {
  57252. return this.reflectionCapabilities.hasLifecycleHook(type, lcProperty);
  57253. };
  57254. JitReflector.prototype.guards = function (type) { return this.reflectionCapabilities.guards(type); };
  57255. JitReflector.prototype.resolveExternalReference = function (ref) {
  57256. return builtinExternalReferences.get(ref) || ref.runtime;
  57257. };
  57258. return JitReflector;
  57259. }());
  57260. function createBuiltinExternalReferencesMap() {
  57261. var map = new Map();
  57262. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ANALYZE_FOR_ENTRY_COMPONENTS, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ANALYZE_FOR_ENTRY_COMPONENTS"]);
  57263. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ElementRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]);
  57264. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].NgModuleRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]);
  57265. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ViewContainerRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewContainerRef"]);
  57266. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ChangeDetectorRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"]);
  57267. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].QueryList, _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"]);
  57268. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].TemplateRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["TemplateRef"]);
  57269. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].CodegenComponentFactoryResolver, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵCodegenComponentFactoryResolver"]);
  57270. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ComponentFactoryResolver, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactoryResolver"]);
  57271. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ComponentFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactory"]);
  57272. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ComponentRef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentRef"]);
  57273. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].NgModuleFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactory"]);
  57274. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].createModuleFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵcmf"]);
  57275. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].moduleDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵmod"]);
  57276. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].moduleProviderDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵmpd"]);
  57277. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].RegisterModuleFactoryFn, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵregisterModuleFactory"]);
  57278. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].Injector, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"]);
  57279. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ViewEncapsulation, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"]);
  57280. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ChangeDetectionStrategy, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectionStrategy"]);
  57281. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].SecurityContext, _angular_core__WEBPACK_IMPORTED_MODULE_1__["SecurityContext"]);
  57282. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].LOCALE_ID, _angular_core__WEBPACK_IMPORTED_MODULE_1__["LOCALE_ID"]);
  57283. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].TRANSLATIONS_FORMAT, _angular_core__WEBPACK_IMPORTED_MODULE_1__["TRANSLATIONS_FORMAT"]);
  57284. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].inlineInterpolate, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵinlineInterpolate"]);
  57285. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].interpolate, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵinterpolate"]);
  57286. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].EMPTY_ARRAY, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵEMPTY_ARRAY"]);
  57287. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].EMPTY_MAP, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵEMPTY_MAP"]);
  57288. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].Renderer, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer"]);
  57289. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].viewDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵvid"]);
  57290. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].elementDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵeld"]);
  57291. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].anchorDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵand"]);
  57292. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].textDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵted"]);
  57293. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].directiveDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵdid"]);
  57294. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].providerDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵprd"]);
  57295. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].queryDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵqud"]);
  57296. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].pureArrayDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵpad"]);
  57297. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].pureObjectDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵpod"]);
  57298. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].purePipeDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵppd"]);
  57299. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].pipeDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵpid"]);
  57300. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].nodeValue, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵnov"]);
  57301. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].ngContentDef, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵncd"]);
  57302. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].unwrapValue, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵunv"]);
  57303. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].createRendererType2, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵcrt"]);
  57304. map.set(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Identifiers"].createComponentFactory, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵccf"]);
  57305. return map;
  57306. }
  57307. /**
  57308. * @license
  57309. * Copyright Google Inc. All Rights Reserved.
  57310. *
  57311. * Use of this source code is governed by an MIT-style license that can be
  57312. * found in the LICENSE file at https://angular.io/license
  57313. */
  57314. var ERROR_COLLECTOR_TOKEN = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ErrorCollector');
  57315. /**
  57316. * A default provider for {@link PACKAGE_ROOT_URL} that maps to '/'.
  57317. */
  57318. var DEFAULT_PACKAGE_URL_PROVIDER = {
  57319. provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["PACKAGE_ROOT_URL"],
  57320. useValue: '/'
  57321. };
  57322. var _NO_RESOURCE_LOADER = {
  57323. get: function (url) {
  57324. throw new Error("No ResourceLoader implementation has been provided. Can't read the url \"" + url + "\"");
  57325. }
  57326. };
  57327. var baseHtmlParser = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('HtmlParser');
  57328. var CompilerImpl = /** @class */ (function () {
  57329. function CompilerImpl(injector, _metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console) {
  57330. this._metadataResolver = _metadataResolver;
  57331. this._delegate = new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitCompiler"](_metadataResolver, templateParser, styleCompiler, viewCompiler, ngModuleCompiler, summaryResolver, compileReflector, compilerConfig, console, this.getExtraNgModuleProviders.bind(this));
  57332. this.injector = injector;
  57333. }
  57334. CompilerImpl.prototype.getExtraNgModuleProviders = function () {
  57335. return [this._metadataResolver.getProviderMetadata(new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ProviderMeta"](_angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"], { useValue: this }))];
  57336. };
  57337. CompilerImpl.prototype.compileModuleSync = function (moduleType) {
  57338. return this._delegate.compileModuleSync(moduleType);
  57339. };
  57340. CompilerImpl.prototype.compileModuleAsync = function (moduleType) {
  57341. return this._delegate.compileModuleAsync(moduleType);
  57342. };
  57343. CompilerImpl.prototype.compileModuleAndAllComponentsSync = function (moduleType) {
  57344. var result = this._delegate.compileModuleAndAllComponentsSync(moduleType);
  57345. return {
  57346. ngModuleFactory: result.ngModuleFactory,
  57347. componentFactories: result.componentFactories,
  57348. };
  57349. };
  57350. CompilerImpl.prototype.compileModuleAndAllComponentsAsync = function (moduleType) {
  57351. return this._delegate.compileModuleAndAllComponentsAsync(moduleType)
  57352. .then(function (result) { return ({
  57353. ngModuleFactory: result.ngModuleFactory,
  57354. componentFactories: result.componentFactories,
  57355. }); });
  57356. };
  57357. CompilerImpl.prototype.loadAotSummaries = function (summaries) { this._delegate.loadAotSummaries(summaries); };
  57358. CompilerImpl.prototype.hasAotSummary = function (ref) { return this._delegate.hasAotSummary(ref); };
  57359. CompilerImpl.prototype.getComponentFactory = function (component) {
  57360. return this._delegate.getComponentFactory(component);
  57361. };
  57362. CompilerImpl.prototype.clearCache = function () { this._delegate.clearCache(); };
  57363. CompilerImpl.prototype.clearCacheFor = function (type) { this._delegate.clearCacheFor(type); };
  57364. CompilerImpl.prototype.getModuleId = function (moduleType) {
  57365. var meta = this._metadataResolver.getNgModuleMetadata(moduleType);
  57366. return meta && meta.id || undefined;
  57367. };
  57368. return CompilerImpl;
  57369. }());
  57370. /**
  57371. * A set of providers that provide `JitCompiler` and its dependencies to use for
  57372. * template compilation.
  57373. */
  57374. var COMPILER_PROVIDERS = [
  57375. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"], useValue: new JitReflector() },
  57376. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], useValue: _NO_RESOURCE_LOADER },
  57377. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitSummaryResolver"], deps: [] },
  57378. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["SummaryResolver"], useExisting: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["JitSummaryResolver"] },
  57379. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"], deps: [] },
  57380. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Lexer"], deps: [] },
  57381. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Parser"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Lexer"]] },
  57382. {
  57383. provide: baseHtmlParser,
  57384. useClass: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"],
  57385. deps: [],
  57386. },
  57387. {
  57388. provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"],
  57389. useFactory: function (parser, translations, format, config, console) {
  57390. translations = translations || '';
  57391. var missingTranslation = translations ? config.missingTranslation : _angular_core__WEBPACK_IMPORTED_MODULE_1__["MissingTranslationStrategy"].Ignore;
  57392. return new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"](parser, translations, format, missingTranslation, console);
  57393. },
  57394. deps: [
  57395. baseHtmlParser,
  57396. [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"](_angular_core__WEBPACK_IMPORTED_MODULE_1__["TRANSLATIONS"])],
  57397. [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"](_angular_core__WEBPACK_IMPORTED_MODULE_1__["TRANSLATIONS_FORMAT"])],
  57398. [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]],
  57399. [_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]],
  57400. ]
  57401. },
  57402. {
  57403. provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"],
  57404. useExisting: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"],
  57405. },
  57406. {
  57407. provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["TemplateParser"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"],
  57408. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["Parser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ElementSchemaRegistry"],
  57409. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["I18NHtmlParser"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]]
  57410. },
  57411. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveNormalizer"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["UrlResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]] },
  57412. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileMetadataResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["HtmlParser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleResolver"],
  57413. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["PipeResolver"],
  57414. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["SummaryResolver"],
  57415. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ElementSchemaRegistry"],
  57416. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveNormalizer"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"],
  57417. [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["StaticSymbolCache"]],
  57418. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"],
  57419. [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"], ERROR_COLLECTOR_TOKEN]] },
  57420. DEFAULT_PACKAGE_URL_PROVIDER,
  57421. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["StyleCompiler"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["UrlResolver"]] },
  57422. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ViewCompiler"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] },
  57423. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleCompiler"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] },
  57424. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"], useValue: new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]() },
  57425. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"], useClass: CompilerImpl, deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileMetadataResolver"],
  57426. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["TemplateParser"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["StyleCompiler"],
  57427. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ViewCompiler"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleCompiler"],
  57428. _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["SummaryResolver"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"], _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"],
  57429. _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]] },
  57430. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DomElementSchemaRegistry"], deps: [] },
  57431. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ElementSchemaRegistry"], useExisting: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DomElementSchemaRegistry"] },
  57432. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["UrlResolver"], deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["PACKAGE_ROOT_URL"]] },
  57433. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["DirectiveResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] },
  57434. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["PipeResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] },
  57435. { provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["NgModuleResolver"], deps: [_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompileReflector"]] },
  57436. ];
  57437. /**
  57438. * @experimental
  57439. */
  57440. var JitCompilerFactory = /** @class */ (function () {
  57441. /* @internal */
  57442. function JitCompilerFactory(defaultOptions) {
  57443. var compilerOptions = {
  57444. useJit: true,
  57445. defaultEncapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewEncapsulation"].Emulated,
  57446. missingTranslation: _angular_core__WEBPACK_IMPORTED_MODULE_1__["MissingTranslationStrategy"].Warning,
  57447. };
  57448. this._defaultOptions = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])([compilerOptions], defaultOptions);
  57449. }
  57450. JitCompilerFactory.prototype.createCompiler = function (options) {
  57451. if (options === void 0) { options = []; }
  57452. var opts = _mergeOptions(this._defaultOptions.concat(options));
  57453. var injector = _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"].create([
  57454. COMPILER_PROVIDERS, {
  57455. provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"],
  57456. useFactory: function () {
  57457. return new _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["CompilerConfig"]({
  57458. // let explicit values from the compiler options overwrite options
  57459. // from the app providers
  57460. useJit: opts.useJit,
  57461. jitDevMode: Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])(),
  57462. // let explicit values from the compiler options overwrite options
  57463. // from the app providers
  57464. defaultEncapsulation: opts.defaultEncapsulation,
  57465. missingTranslation: opts.missingTranslation,
  57466. preserveWhitespaces: opts.preserveWhitespaces,
  57467. });
  57468. },
  57469. deps: []
  57470. },
  57471. opts.providers
  57472. ]);
  57473. return injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"]);
  57474. };
  57475. return JitCompilerFactory;
  57476. }());
  57477. function _mergeOptions(optionsArr) {
  57478. return {
  57479. useJit: _lastDefined(optionsArr.map(function (options) { return options.useJit; })),
  57480. defaultEncapsulation: _lastDefined(optionsArr.map(function (options) { return options.defaultEncapsulation; })),
  57481. providers: _mergeArrays(optionsArr.map(function (options) { return options.providers; })),
  57482. missingTranslation: _lastDefined(optionsArr.map(function (options) { return options.missingTranslation; })),
  57483. preserveWhitespaces: _lastDefined(optionsArr.map(function (options) { return options.preserveWhitespaces; })),
  57484. };
  57485. }
  57486. function _lastDefined(args) {
  57487. for (var i = args.length - 1; i >= 0; i--) {
  57488. if (args[i] !== undefined) {
  57489. return args[i];
  57490. }
  57491. }
  57492. return undefined;
  57493. }
  57494. function _mergeArrays(parts) {
  57495. var result = [];
  57496. parts.forEach(function (part) { return part && result.push.apply(result, Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__spread"])(part)); });
  57497. return result;
  57498. }
  57499. /**
  57500. * @license
  57501. * Copyright Google Inc. All Rights Reserved.
  57502. *
  57503. * Use of this source code is governed by an MIT-style license that can be
  57504. * found in the LICENSE file at https://angular.io/license
  57505. */
  57506. /**
  57507. * A platform that included corePlatform and the compiler.
  57508. *
  57509. * @experimental
  57510. */
  57511. var platformCoreDynamic = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["createPlatformFactory"])(_angular_core__WEBPACK_IMPORTED_MODULE_1__["platformCore"], 'coreDynamic', [
  57512. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["COMPILER_OPTIONS"], useValue: {}, multi: true },
  57513. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["CompilerFactory"], useClass: JitCompilerFactory, deps: [_angular_core__WEBPACK_IMPORTED_MODULE_1__["COMPILER_OPTIONS"]] },
  57514. ]);
  57515. var ResourceLoaderImpl = /** @class */ (function (_super) {
  57516. Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(ResourceLoaderImpl, _super);
  57517. function ResourceLoaderImpl() {
  57518. return _super !== null && _super.apply(this, arguments) || this;
  57519. }
  57520. ResourceLoaderImpl.prototype.get = function (url) {
  57521. var resolve;
  57522. var reject;
  57523. var promise = new Promise(function (res, rej) {
  57524. resolve = res;
  57525. reject = rej;
  57526. });
  57527. var xhr = new XMLHttpRequest();
  57528. xhr.open('GET', url, true);
  57529. xhr.responseType = 'text';
  57530. xhr.onload = function () {
  57531. // responseText is the old-school way of retrieving response (supported by IE8 & 9)
  57532. // response/responseType properties were introduced in ResourceLoader Level2 spec (supported
  57533. // by IE10)
  57534. var response = xhr.response || xhr.responseText;
  57535. // normalize IE9 bug (http://bugs.jquery.com/ticket/1450)
  57536. var status = xhr.status === 1223 ? 204 : xhr.status;
  57537. // fix status code when it is 0 (0 status is undocumented).
  57538. // Occurs when accessing file resources or on Android 4.1 stock browser
  57539. // while retrieving files from application cache.
  57540. if (status === 0) {
  57541. status = response ? 200 : 0;
  57542. }
  57543. if (200 <= status && status <= 300) {
  57544. resolve(response);
  57545. }
  57546. else {
  57547. reject("Failed to load " + url);
  57548. }
  57549. };
  57550. xhr.onerror = function () { reject("Failed to load " + url); };
  57551. xhr.send();
  57552. return promise;
  57553. };
  57554. ResourceLoaderImpl = Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__decorate"])([
  57555. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])()
  57556. ], ResourceLoaderImpl);
  57557. return ResourceLoaderImpl;
  57558. }(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"]));
  57559. /**
  57560. * @license
  57561. * Copyright Google Inc. All Rights Reserved.
  57562. *
  57563. * Use of this source code is governed by an MIT-style license that can be
  57564. * found in the LICENSE file at https://angular.io/license
  57565. */
  57566. var INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS = [
  57567. _angular_platform_browser__WEBPACK_IMPORTED_MODULE_4__["ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS"],
  57568. {
  57569. provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["COMPILER_OPTIONS"],
  57570. useValue: { providers: [{ provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], useClass: ResourceLoaderImpl, deps: [] }] },
  57571. multi: true
  57572. },
  57573. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["PLATFORM_ID"], useValue: _angular_common__WEBPACK_IMPORTED_MODULE_3__["ɵPLATFORM_BROWSER_ID"] },
  57574. ];
  57575. /**
  57576. * @license
  57577. * Copyright Google Inc. All Rights Reserved.
  57578. *
  57579. * Use of this source code is governed by an MIT-style license that can be
  57580. * found in the LICENSE file at https://angular.io/license
  57581. */
  57582. /**
  57583. * An implementation of ResourceLoader that uses a template cache to avoid doing an actual
  57584. * ResourceLoader.
  57585. *
  57586. * The template cache needs to be built and loaded into window.$templateCache
  57587. * via a separate mechanism.
  57588. */
  57589. var CachedResourceLoader = /** @class */ (function (_super) {
  57590. Object(tslib__WEBPACK_IMPORTED_MODULE_2__["__extends"])(CachedResourceLoader, _super);
  57591. function CachedResourceLoader() {
  57592. var _this = _super.call(this) || this;
  57593. _this._cache = _angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵglobal"].$templateCache;
  57594. if (_this._cache == null) {
  57595. throw new Error('CachedResourceLoader: Template cache was not found in $templateCache.');
  57596. }
  57597. return _this;
  57598. }
  57599. CachedResourceLoader.prototype.get = function (url) {
  57600. if (this._cache.hasOwnProperty(url)) {
  57601. return Promise.resolve(this._cache[url]);
  57602. }
  57603. else {
  57604. return Promise.reject('CachedResourceLoader: Did not find cached template for ' + url);
  57605. }
  57606. };
  57607. return CachedResourceLoader;
  57608. }(_angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"]));
  57609. /**
  57610. * @license
  57611. * Copyright Google Inc. All Rights Reserved.
  57612. *
  57613. * Use of this source code is governed by an MIT-style license that can be
  57614. * found in the LICENSE file at https://angular.io/license
  57615. */
  57616. /**
  57617. * @license
  57618. * Copyright Google Inc. All Rights Reserved.
  57619. *
  57620. * Use of this source code is governed by an MIT-style license that can be
  57621. * found in the LICENSE file at https://angular.io/license
  57622. */
  57623. var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Version"]('6.1.10');
  57624. /**
  57625. * @license
  57626. * Copyright Google Inc. All Rights Reserved.
  57627. *
  57628. * Use of this source code is governed by an MIT-style license that can be
  57629. * found in the LICENSE file at https://angular.io/license
  57630. */
  57631. /**
  57632. * @experimental
  57633. */
  57634. var RESOURCE_CACHE_PROVIDER = [{ provide: _angular_compiler__WEBPACK_IMPORTED_MODULE_0__["ResourceLoader"], useClass: CachedResourceLoader, deps: [] }];
  57635. var platformBrowserDynamic = Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["createPlatformFactory"])(platformCoreDynamic, 'browserDynamic', INTERNAL_BROWSER_DYNAMIC_PLATFORM_PROVIDERS);
  57636. /**
  57637. * @license
  57638. * Copyright Google Inc. All Rights Reserved.
  57639. *
  57640. * Use of this source code is governed by an MIT-style license that can be
  57641. * found in the LICENSE file at https://angular.io/license
  57642. */
  57643. // This file only reexports content of the `src` folder. Keep it that way.
  57644. /**
  57645. * @license
  57646. * Copyright Google Inc. All Rights Reserved.
  57647. *
  57648. * Use of this source code is governed by an MIT-style license that can be
  57649. * found in the LICENSE file at https://angular.io/license
  57650. */
  57651. /**
  57652. * Generated bundle index. Do not edit.
  57653. */
  57654. //# sourceMappingURL=platform-browser-dynamic.js.map
  57655. /***/ }),
  57656. /***/ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js":
  57657. /*!**************************************************************************!*\
  57658. !*** ./node_modules/@angular/platform-browser/fesm5/platform-browser.js ***!
  57659. \**************************************************************************/
  57660. /*! exports provided: ɵangular_packages_platform_browser_platform_browser_c, ɵangular_packages_platform_browser_platform_browser_b, ɵangular_packages_platform_browser_platform_browser_a, ɵangular_packages_platform_browser_platform_browser_k, ɵangular_packages_platform_browser_platform_browser_d, ɵangular_packages_platform_browser_platform_browser_i, ɵangular_packages_platform_browser_platform_browser_h, ɵangular_packages_platform_browser_platform_browser_e, ɵangular_packages_platform_browser_platform_browser_f, ɵangular_packages_platform_browser_platform_browser_j, ɵangular_packages_platform_browser_platform_browser_g, BrowserModule, platformBrowser, Meta, Title, disableDebugTools, enableDebugTools, BrowserTransferStateModule, TransferState, makeStateKey, By, DOCUMENT, EVENT_MANAGER_PLUGINS, EventManager, HAMMER_GESTURE_CONFIG, HAMMER_LOADER, HammerGestureConfig, DomSanitizer, VERSION, ɵBROWSER_SANITIZATION_PROVIDERS, ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS, ɵinitDomAdapter, ɵBrowserDomAdapter, ɵBrowserPlatformLocation, ɵTRANSITION_ID, ɵBrowserGetTestability, ɵescapeHtml, ɵELEMENT_PROBE_PROVIDERS, ɵDomAdapter, ɵgetDOM, ɵsetRootDomAdapter, ɵDomRendererFactory2, ɵNAMESPACE_URIS, ɵflattenStyles, ɵshimContentAttribute, ɵshimHostAttribute, ɵDomEventsPlugin, ɵHammerGesturesPlugin, ɵKeyEventsPlugin, ɵDomSharedStylesHost, ɵSharedStylesHost, ɵDomSanitizerImpl */
  57661. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  57662. "use strict";
  57663. __webpack_require__.r(__webpack_exports__);
  57664. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_c", function() { return BROWSER_MODULE_PROVIDERS; });
  57665. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_b", function() { return _document; });
  57666. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_a", function() { return errorHandler; });
  57667. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_k", function() { return GenericBrowserDomAdapter; });
  57668. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_d", function() { return createMeta; });
  57669. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_i", function() { return SERVER_TRANSITION_PROVIDERS; });
  57670. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_h", function() { return appInitializerFactory; });
  57671. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_e", function() { return createTitle; });
  57672. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_f", function() { return initTransferState; });
  57673. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_j", function() { return _createNgProbe; });
  57674. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_platform_browser_platform_browser_g", function() { return EventManagerPlugin; });
  57675. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserModule", function() { return BrowserModule; });
  57676. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "platformBrowser", function() { return platformBrowser; });
  57677. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Meta", function() { return Meta; });
  57678. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Title", function() { return Title; });
  57679. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "disableDebugTools", function() { return disableDebugTools; });
  57680. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "enableDebugTools", function() { return enableDebugTools; });
  57681. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BrowserTransferStateModule", function() { return BrowserTransferStateModule; });
  57682. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TransferState", function() { return TransferState; });
  57683. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "makeStateKey", function() { return makeStateKey; });
  57684. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "By", function() { return By; });
  57685. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DOCUMENT", function() { return DOCUMENT$1; });
  57686. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EVENT_MANAGER_PLUGINS", function() { return EVENT_MANAGER_PLUGINS; });
  57687. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EventManager", function() { return EventManager; });
  57688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAMMER_GESTURE_CONFIG", function() { return HAMMER_GESTURE_CONFIG; });
  57689. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HAMMER_LOADER", function() { return HAMMER_LOADER; });
  57690. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "HammerGestureConfig", function() { return HammerGestureConfig; });
  57691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DomSanitizer", function() { return DomSanitizer; });
  57692. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  57693. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBROWSER_SANITIZATION_PROVIDERS", function() { return BROWSER_SANITIZATION_PROVIDERS; });
  57694. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵINTERNAL_BROWSER_PLATFORM_PROVIDERS", function() { return INTERNAL_BROWSER_PLATFORM_PROVIDERS; });
  57695. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵinitDomAdapter", function() { return initDomAdapter; });
  57696. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserDomAdapter", function() { return BrowserDomAdapter; });
  57697. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserPlatformLocation", function() { return BrowserPlatformLocation; });
  57698. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵTRANSITION_ID", function() { return TRANSITION_ID; });
  57699. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵBrowserGetTestability", function() { return BrowserGetTestability; });
  57700. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵescapeHtml", function() { return escapeHtml; });
  57701. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵELEMENT_PROBE_PROVIDERS", function() { return ELEMENT_PROBE_PROVIDERS; });
  57702. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomAdapter", function() { return DomAdapter; });
  57703. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵgetDOM", function() { return getDOM; });
  57704. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵsetRootDomAdapter", function() { return setRootDomAdapter; });
  57705. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomRendererFactory2", function() { return DomRendererFactory2; });
  57706. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵNAMESPACE_URIS", function() { return NAMESPACE_URIS; });
  57707. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflattenStyles", function() { return flattenStyles; });
  57708. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimContentAttribute", function() { return shimContentAttribute; });
  57709. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵshimHostAttribute", function() { return shimHostAttribute; });
  57710. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomEventsPlugin", function() { return DomEventsPlugin; });
  57711. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵHammerGesturesPlugin", function() { return HammerGesturesPlugin; });
  57712. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵKeyEventsPlugin", function() { return KeyEventsPlugin; });
  57713. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomSharedStylesHost", function() { return DomSharedStylesHost; });
  57714. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵSharedStylesHost", function() { return SharedStylesHost; });
  57715. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵDomSanitizerImpl", function() { return DomSanitizerImpl; });
  57716. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  57717. /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js");
  57718. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  57719. /**
  57720. * @license Angular v6.1.10
  57721. * (c) 2010-2018 Google, Inc. https://angular.io/
  57722. * License: MIT
  57723. */
  57724. /**
  57725. * @license
  57726. * Copyright Google Inc. All Rights Reserved.
  57727. *
  57728. * Use of this source code is governed by an MIT-style license that can be
  57729. * found in the LICENSE file at https://angular.io/license
  57730. */
  57731. var _DOM = null;
  57732. function getDOM() {
  57733. return _DOM;
  57734. }
  57735. function setRootDomAdapter(adapter) {
  57736. if (!_DOM) {
  57737. _DOM = adapter;
  57738. }
  57739. }
  57740. /* tslint:disable:requireParameterType */
  57741. /**
  57742. * Provides DOM operations in an environment-agnostic way.
  57743. *
  57744. * @security Tread carefully! Interacting with the DOM directly is dangerous and
  57745. * can introduce XSS risks.
  57746. */
  57747. var DomAdapter = /** @class */ (function () {
  57748. function DomAdapter() {
  57749. this.resourceLoaderType = null;
  57750. }
  57751. Object.defineProperty(DomAdapter.prototype, "attrToPropMap", {
  57752. /**
  57753. * Maps attribute names to their corresponding property names for cases
  57754. * where attribute name doesn't match property name.
  57755. */
  57756. get: function () { return this._attrToPropMap; },
  57757. set: function (value) { this._attrToPropMap = value; },
  57758. enumerable: true,
  57759. configurable: true
  57760. });
  57761. return DomAdapter;
  57762. }());
  57763. /**
  57764. * @license
  57765. * Copyright Google Inc. All Rights Reserved.
  57766. *
  57767. * Use of this source code is governed by an MIT-style license that can be
  57768. * found in the LICENSE file at https://angular.io/license
  57769. */
  57770. /**
  57771. * Provides DOM operations in any browser environment.
  57772. *
  57773. * @security Tread carefully! Interacting with the DOM directly is dangerous and
  57774. * can introduce XSS risks.
  57775. */
  57776. var GenericBrowserDomAdapter = /** @class */ (function (_super) {
  57777. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GenericBrowserDomAdapter, _super);
  57778. function GenericBrowserDomAdapter() {
  57779. var _this = _super.call(this) || this;
  57780. _this._animationPrefix = null;
  57781. _this._transitionEnd = null;
  57782. try {
  57783. var element_1 = _this.createElement('div', document);
  57784. if (_this.getStyle(element_1, 'animationName') != null) {
  57785. _this._animationPrefix = '';
  57786. }
  57787. else {
  57788. var domPrefixes = ['Webkit', 'Moz', 'O', 'ms'];
  57789. for (var i = 0; i < domPrefixes.length; i++) {
  57790. if (_this.getStyle(element_1, domPrefixes[i] + 'AnimationName') != null) {
  57791. _this._animationPrefix = '-' + domPrefixes[i].toLowerCase() + '-';
  57792. break;
  57793. }
  57794. }
  57795. }
  57796. var transEndEventNames_1 = {
  57797. WebkitTransition: 'webkitTransitionEnd',
  57798. MozTransition: 'transitionend',
  57799. OTransition: 'oTransitionEnd otransitionend',
  57800. transition: 'transitionend'
  57801. };
  57802. Object.keys(transEndEventNames_1).forEach(function (key) {
  57803. if (_this.getStyle(element_1, key) != null) {
  57804. _this._transitionEnd = transEndEventNames_1[key];
  57805. }
  57806. });
  57807. }
  57808. catch (e) {
  57809. _this._animationPrefix = null;
  57810. _this._transitionEnd = null;
  57811. }
  57812. return _this;
  57813. }
  57814. GenericBrowserDomAdapter.prototype.getDistributedNodes = function (el) { return el.getDistributedNodes(); };
  57815. GenericBrowserDomAdapter.prototype.resolveAndSetHref = function (el, baseUrl, href) {
  57816. el.href = href == null ? baseUrl : baseUrl + '/../' + href;
  57817. };
  57818. GenericBrowserDomAdapter.prototype.supportsDOMEvents = function () { return true; };
  57819. GenericBrowserDomAdapter.prototype.supportsNativeShadowDOM = function () {
  57820. return typeof document.body.createShadowRoot === 'function';
  57821. };
  57822. GenericBrowserDomAdapter.prototype.getAnimationPrefix = function () { return this._animationPrefix ? this._animationPrefix : ''; };
  57823. GenericBrowserDomAdapter.prototype.getTransitionEnd = function () { return this._transitionEnd ? this._transitionEnd : ''; };
  57824. GenericBrowserDomAdapter.prototype.supportsAnimation = function () {
  57825. return this._animationPrefix != null && this._transitionEnd != null;
  57826. };
  57827. return GenericBrowserDomAdapter;
  57828. }(DomAdapter));
  57829. /**
  57830. * @license
  57831. * Copyright Google Inc. All Rights Reserved.
  57832. *
  57833. * Use of this source code is governed by an MIT-style license that can be
  57834. * found in the LICENSE file at https://angular.io/license
  57835. */
  57836. var _attrToPropMap = {
  57837. 'class': 'className',
  57838. 'innerHtml': 'innerHTML',
  57839. 'readonly': 'readOnly',
  57840. 'tabindex': 'tabIndex',
  57841. };
  57842. var DOM_KEY_LOCATION_NUMPAD = 3;
  57843. // Map to convert some key or keyIdentifier values to what will be returned by getEventKey
  57844. var _keyMap = {
  57845. // The following values are here for cross-browser compatibility and to match the W3C standard
  57846. // cf http://www.w3.org/TR/DOM-Level-3-Events-key/
  57847. '\b': 'Backspace',
  57848. '\t': 'Tab',
  57849. '\x7F': 'Delete',
  57850. '\x1B': 'Escape',
  57851. 'Del': 'Delete',
  57852. 'Esc': 'Escape',
  57853. 'Left': 'ArrowLeft',
  57854. 'Right': 'ArrowRight',
  57855. 'Up': 'ArrowUp',
  57856. 'Down': 'ArrowDown',
  57857. 'Menu': 'ContextMenu',
  57858. 'Scroll': 'ScrollLock',
  57859. 'Win': 'OS'
  57860. };
  57861. // There is a bug in Chrome for numeric keypad keys:
  57862. // https://code.google.com/p/chromium/issues/detail?id=155654
  57863. // 1, 2, 3 ... are reported as A, B, C ...
  57864. var _chromeNumKeyPadMap = {
  57865. 'A': '1',
  57866. 'B': '2',
  57867. 'C': '3',
  57868. 'D': '4',
  57869. 'E': '5',
  57870. 'F': '6',
  57871. 'G': '7',
  57872. 'H': '8',
  57873. 'I': '9',
  57874. 'J': '*',
  57875. 'K': '+',
  57876. 'M': '-',
  57877. 'N': '.',
  57878. 'O': '/',
  57879. '\x60': '0',
  57880. '\x90': 'NumLock'
  57881. };
  57882. var nodeContains;
  57883. if (_angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['Node']) {
  57884. nodeContains = _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['Node'].prototype.contains || function (node) {
  57885. return !!(this.compareDocumentPosition(node) & 16);
  57886. };
  57887. }
  57888. /**
  57889. * A `DomAdapter` powered by full browser DOM APIs.
  57890. *
  57891. * @security Tread carefully! Interacting with the DOM directly is dangerous and
  57892. * can introduce XSS risks.
  57893. */
  57894. /* tslint:disable:requireParameterType no-console */
  57895. var BrowserDomAdapter = /** @class */ (function (_super) {
  57896. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BrowserDomAdapter, _super);
  57897. function BrowserDomAdapter() {
  57898. return _super !== null && _super.apply(this, arguments) || this;
  57899. }
  57900. BrowserDomAdapter.prototype.parse = function (templateHtml) { throw new Error('parse not implemented'); };
  57901. BrowserDomAdapter.makeCurrent = function () { setRootDomAdapter(new BrowserDomAdapter()); };
  57902. BrowserDomAdapter.prototype.hasProperty = function (element, name) { return name in element; };
  57903. BrowserDomAdapter.prototype.setProperty = function (el, name, value) { el[name] = value; };
  57904. BrowserDomAdapter.prototype.getProperty = function (el, name) { return el[name]; };
  57905. BrowserDomAdapter.prototype.invoke = function (el, methodName, args) {
  57906. var _a;
  57907. (_a = el)[methodName].apply(_a, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(args));
  57908. };
  57909. // TODO(tbosch): move this into a separate environment class once we have it
  57910. BrowserDomAdapter.prototype.logError = function (error) {
  57911. if (window.console) {
  57912. if (console.error) {
  57913. console.error(error);
  57914. }
  57915. else {
  57916. console.log(error);
  57917. }
  57918. }
  57919. };
  57920. BrowserDomAdapter.prototype.log = function (error) {
  57921. if (window.console) {
  57922. window.console.log && window.console.log(error);
  57923. }
  57924. };
  57925. BrowserDomAdapter.prototype.logGroup = function (error) {
  57926. if (window.console) {
  57927. window.console.group && window.console.group(error);
  57928. }
  57929. };
  57930. BrowserDomAdapter.prototype.logGroupEnd = function () {
  57931. if (window.console) {
  57932. window.console.groupEnd && window.console.groupEnd();
  57933. }
  57934. };
  57935. Object.defineProperty(BrowserDomAdapter.prototype, "attrToPropMap", {
  57936. get: function () { return _attrToPropMap; },
  57937. enumerable: true,
  57938. configurable: true
  57939. });
  57940. BrowserDomAdapter.prototype.contains = function (nodeA, nodeB) { return nodeContains.call(nodeA, nodeB); };
  57941. BrowserDomAdapter.prototype.querySelector = function (el, selector) { return el.querySelector(selector); };
  57942. BrowserDomAdapter.prototype.querySelectorAll = function (el, selector) { return el.querySelectorAll(selector); };
  57943. BrowserDomAdapter.prototype.on = function (el, evt, listener) { el.addEventListener(evt, listener, false); };
  57944. BrowserDomAdapter.prototype.onAndCancel = function (el, evt, listener) {
  57945. el.addEventListener(evt, listener, false);
  57946. // Needed to follow Dart's subscription semantic, until fix of
  57947. // https://code.google.com/p/dart/issues/detail?id=17406
  57948. return function () { el.removeEventListener(evt, listener, false); };
  57949. };
  57950. BrowserDomAdapter.prototype.dispatchEvent = function (el, evt) { el.dispatchEvent(evt); };
  57951. BrowserDomAdapter.prototype.createMouseEvent = function (eventType) {
  57952. var evt = this.getDefaultDocument().createEvent('MouseEvent');
  57953. evt.initEvent(eventType, true, true);
  57954. return evt;
  57955. };
  57956. BrowserDomAdapter.prototype.createEvent = function (eventType) {
  57957. var evt = this.getDefaultDocument().createEvent('Event');
  57958. evt.initEvent(eventType, true, true);
  57959. return evt;
  57960. };
  57961. BrowserDomAdapter.prototype.preventDefault = function (evt) {
  57962. evt.preventDefault();
  57963. evt.returnValue = false;
  57964. };
  57965. BrowserDomAdapter.prototype.isPrevented = function (evt) {
  57966. return evt.defaultPrevented || evt.returnValue != null && !evt.returnValue;
  57967. };
  57968. BrowserDomAdapter.prototype.getInnerHTML = function (el) { return el.innerHTML; };
  57969. BrowserDomAdapter.prototype.getTemplateContent = function (el) {
  57970. return 'content' in el && this.isTemplateElement(el) ? el.content : null;
  57971. };
  57972. BrowserDomAdapter.prototype.getOuterHTML = function (el) { return el.outerHTML; };
  57973. BrowserDomAdapter.prototype.nodeName = function (node) { return node.nodeName; };
  57974. BrowserDomAdapter.prototype.nodeValue = function (node) { return node.nodeValue; };
  57975. BrowserDomAdapter.prototype.type = function (node) { return node.type; };
  57976. BrowserDomAdapter.prototype.content = function (node) {
  57977. if (this.hasProperty(node, 'content')) {
  57978. return node.content;
  57979. }
  57980. else {
  57981. return node;
  57982. }
  57983. };
  57984. BrowserDomAdapter.prototype.firstChild = function (el) { return el.firstChild; };
  57985. BrowserDomAdapter.prototype.nextSibling = function (el) { return el.nextSibling; };
  57986. BrowserDomAdapter.prototype.parentElement = function (el) { return el.parentNode; };
  57987. BrowserDomAdapter.prototype.childNodes = function (el) { return el.childNodes; };
  57988. BrowserDomAdapter.prototype.childNodesAsList = function (el) {
  57989. var childNodes = el.childNodes;
  57990. var res = new Array(childNodes.length);
  57991. for (var i = 0; i < childNodes.length; i++) {
  57992. res[i] = childNodes[i];
  57993. }
  57994. return res;
  57995. };
  57996. BrowserDomAdapter.prototype.clearNodes = function (el) {
  57997. while (el.firstChild) {
  57998. el.removeChild(el.firstChild);
  57999. }
  58000. };
  58001. BrowserDomAdapter.prototype.appendChild = function (el, node) { el.appendChild(node); };
  58002. BrowserDomAdapter.prototype.removeChild = function (el, node) { el.removeChild(node); };
  58003. BrowserDomAdapter.prototype.replaceChild = function (el, newChild, oldChild) { el.replaceChild(newChild, oldChild); };
  58004. BrowserDomAdapter.prototype.remove = function (node) {
  58005. if (node.parentNode) {
  58006. node.parentNode.removeChild(node);
  58007. }
  58008. return node;
  58009. };
  58010. BrowserDomAdapter.prototype.insertBefore = function (parent, ref, node) { parent.insertBefore(node, ref); };
  58011. BrowserDomAdapter.prototype.insertAllBefore = function (parent, ref, nodes) {
  58012. nodes.forEach(function (n) { return parent.insertBefore(n, ref); });
  58013. };
  58014. BrowserDomAdapter.prototype.insertAfter = function (parent, ref, node) { parent.insertBefore(node, ref.nextSibling); };
  58015. BrowserDomAdapter.prototype.setInnerHTML = function (el, value) { el.innerHTML = value; };
  58016. BrowserDomAdapter.prototype.getText = function (el) { return el.textContent; };
  58017. BrowserDomAdapter.prototype.setText = function (el, value) { el.textContent = value; };
  58018. BrowserDomAdapter.prototype.getValue = function (el) { return el.value; };
  58019. BrowserDomAdapter.prototype.setValue = function (el, value) { el.value = value; };
  58020. BrowserDomAdapter.prototype.getChecked = function (el) { return el.checked; };
  58021. BrowserDomAdapter.prototype.setChecked = function (el, value) { el.checked = value; };
  58022. BrowserDomAdapter.prototype.createComment = function (text) { return this.getDefaultDocument().createComment(text); };
  58023. BrowserDomAdapter.prototype.createTemplate = function (html) {
  58024. var t = this.getDefaultDocument().createElement('template');
  58025. t.innerHTML = html;
  58026. return t;
  58027. };
  58028. BrowserDomAdapter.prototype.createElement = function (tagName, doc) {
  58029. doc = doc || this.getDefaultDocument();
  58030. return doc.createElement(tagName);
  58031. };
  58032. BrowserDomAdapter.prototype.createElementNS = function (ns, tagName, doc) {
  58033. doc = doc || this.getDefaultDocument();
  58034. return doc.createElementNS(ns, tagName);
  58035. };
  58036. BrowserDomAdapter.prototype.createTextNode = function (text, doc) {
  58037. doc = doc || this.getDefaultDocument();
  58038. return doc.createTextNode(text);
  58039. };
  58040. BrowserDomAdapter.prototype.createScriptTag = function (attrName, attrValue, doc) {
  58041. doc = doc || this.getDefaultDocument();
  58042. var el = doc.createElement('SCRIPT');
  58043. el.setAttribute(attrName, attrValue);
  58044. return el;
  58045. };
  58046. BrowserDomAdapter.prototype.createStyleElement = function (css, doc) {
  58047. doc = doc || this.getDefaultDocument();
  58048. var style = doc.createElement('style');
  58049. this.appendChild(style, this.createTextNode(css, doc));
  58050. return style;
  58051. };
  58052. BrowserDomAdapter.prototype.createShadowRoot = function (el) { return el.createShadowRoot(); };
  58053. BrowserDomAdapter.prototype.getShadowRoot = function (el) { return el.shadowRoot; };
  58054. BrowserDomAdapter.prototype.getHost = function (el) { return el.host; };
  58055. BrowserDomAdapter.prototype.clone = function (node) { return node.cloneNode(true); };
  58056. BrowserDomAdapter.prototype.getElementsByClassName = function (element, name) {
  58057. return element.getElementsByClassName(name);
  58058. };
  58059. BrowserDomAdapter.prototype.getElementsByTagName = function (element, name) {
  58060. return element.getElementsByTagName(name);
  58061. };
  58062. BrowserDomAdapter.prototype.classList = function (element) { return Array.prototype.slice.call(element.classList, 0); };
  58063. BrowserDomAdapter.prototype.addClass = function (element, className) { element.classList.add(className); };
  58064. BrowserDomAdapter.prototype.removeClass = function (element, className) { element.classList.remove(className); };
  58065. BrowserDomAdapter.prototype.hasClass = function (element, className) {
  58066. return element.classList.contains(className);
  58067. };
  58068. BrowserDomAdapter.prototype.setStyle = function (element, styleName, styleValue) {
  58069. element.style[styleName] = styleValue;
  58070. };
  58071. BrowserDomAdapter.prototype.removeStyle = function (element, stylename) {
  58072. // IE requires '' instead of null
  58073. // see https://github.com/angular/angular/issues/7916
  58074. element.style[stylename] = '';
  58075. };
  58076. BrowserDomAdapter.prototype.getStyle = function (element, stylename) { return element.style[stylename]; };
  58077. BrowserDomAdapter.prototype.hasStyle = function (element, styleName, styleValue) {
  58078. var value = this.getStyle(element, styleName) || '';
  58079. return styleValue ? value == styleValue : value.length > 0;
  58080. };
  58081. BrowserDomAdapter.prototype.tagName = function (element) { return element.tagName; };
  58082. BrowserDomAdapter.prototype.attributeMap = function (element) {
  58083. var res = new Map();
  58084. var elAttrs = element.attributes;
  58085. for (var i = 0; i < elAttrs.length; i++) {
  58086. var attrib = elAttrs.item(i);
  58087. res.set(attrib.name, attrib.value);
  58088. }
  58089. return res;
  58090. };
  58091. BrowserDomAdapter.prototype.hasAttribute = function (element, attribute) {
  58092. return element.hasAttribute(attribute);
  58093. };
  58094. BrowserDomAdapter.prototype.hasAttributeNS = function (element, ns, attribute) {
  58095. return element.hasAttributeNS(ns, attribute);
  58096. };
  58097. BrowserDomAdapter.prototype.getAttribute = function (element, attribute) {
  58098. return element.getAttribute(attribute);
  58099. };
  58100. BrowserDomAdapter.prototype.getAttributeNS = function (element, ns, name) {
  58101. return element.getAttributeNS(ns, name);
  58102. };
  58103. BrowserDomAdapter.prototype.setAttribute = function (element, name, value) { element.setAttribute(name, value); };
  58104. BrowserDomAdapter.prototype.setAttributeNS = function (element, ns, name, value) {
  58105. element.setAttributeNS(ns, name, value);
  58106. };
  58107. BrowserDomAdapter.prototype.removeAttribute = function (element, attribute) { element.removeAttribute(attribute); };
  58108. BrowserDomAdapter.prototype.removeAttributeNS = function (element, ns, name) {
  58109. element.removeAttributeNS(ns, name);
  58110. };
  58111. BrowserDomAdapter.prototype.templateAwareRoot = function (el) { return this.isTemplateElement(el) ? this.content(el) : el; };
  58112. BrowserDomAdapter.prototype.createHtmlDocument = function () {
  58113. return document.implementation.createHTMLDocument('fakeTitle');
  58114. };
  58115. BrowserDomAdapter.prototype.getDefaultDocument = function () { return document; };
  58116. BrowserDomAdapter.prototype.getBoundingClientRect = function (el) {
  58117. try {
  58118. return el.getBoundingClientRect();
  58119. }
  58120. catch (e) {
  58121. return { top: 0, bottom: 0, left: 0, right: 0, width: 0, height: 0 };
  58122. }
  58123. };
  58124. BrowserDomAdapter.prototype.getTitle = function (doc) { return doc.title; };
  58125. BrowserDomAdapter.prototype.setTitle = function (doc, newTitle) { doc.title = newTitle || ''; };
  58126. BrowserDomAdapter.prototype.elementMatches = function (n, selector) {
  58127. if (this.isElementNode(n)) {
  58128. return n.matches && n.matches(selector) ||
  58129. n.msMatchesSelector && n.msMatchesSelector(selector) ||
  58130. n.webkitMatchesSelector && n.webkitMatchesSelector(selector);
  58131. }
  58132. return false;
  58133. };
  58134. BrowserDomAdapter.prototype.isTemplateElement = function (el) {
  58135. return this.isElementNode(el) && el.nodeName === 'TEMPLATE';
  58136. };
  58137. BrowserDomAdapter.prototype.isTextNode = function (node) { return node.nodeType === Node.TEXT_NODE; };
  58138. BrowserDomAdapter.prototype.isCommentNode = function (node) { return node.nodeType === Node.COMMENT_NODE; };
  58139. BrowserDomAdapter.prototype.isElementNode = function (node) { return node.nodeType === Node.ELEMENT_NODE; };
  58140. BrowserDomAdapter.prototype.hasShadowRoot = function (node) {
  58141. return node.shadowRoot != null && node instanceof HTMLElement;
  58142. };
  58143. BrowserDomAdapter.prototype.isShadowRoot = function (node) { return node instanceof DocumentFragment; };
  58144. BrowserDomAdapter.prototype.importIntoDoc = function (node) { return document.importNode(this.templateAwareRoot(node), true); };
  58145. BrowserDomAdapter.prototype.adoptNode = function (node) { return document.adoptNode(node); };
  58146. BrowserDomAdapter.prototype.getHref = function (el) { return el.getAttribute('href'); };
  58147. BrowserDomAdapter.prototype.getEventKey = function (event) {
  58148. var key = event.key;
  58149. if (key == null) {
  58150. key = event.keyIdentifier;
  58151. // keyIdentifier is defined in the old draft of DOM Level 3 Events implemented by Chrome and
  58152. // Safari cf
  58153. // http://www.w3.org/TR/2007/WD-DOM-Level-3-Events-20071221/events.html#Events-KeyboardEvents-Interfaces
  58154. if (key == null) {
  58155. return 'Unidentified';
  58156. }
  58157. if (key.startsWith('U+')) {
  58158. key = String.fromCharCode(parseInt(key.substring(2), 16));
  58159. if (event.location === DOM_KEY_LOCATION_NUMPAD && _chromeNumKeyPadMap.hasOwnProperty(key)) {
  58160. // There is a bug in Chrome for numeric keypad keys:
  58161. // https://code.google.com/p/chromium/issues/detail?id=155654
  58162. // 1, 2, 3 ... are reported as A, B, C ...
  58163. key = _chromeNumKeyPadMap[key];
  58164. }
  58165. }
  58166. }
  58167. return _keyMap[key] || key;
  58168. };
  58169. BrowserDomAdapter.prototype.getGlobalEventTarget = function (doc, target) {
  58170. if (target === 'window') {
  58171. return window;
  58172. }
  58173. if (target === 'document') {
  58174. return doc;
  58175. }
  58176. if (target === 'body') {
  58177. return doc.body;
  58178. }
  58179. return null;
  58180. };
  58181. BrowserDomAdapter.prototype.getHistory = function () { return window.history; };
  58182. BrowserDomAdapter.prototype.getLocation = function () { return window.location; };
  58183. BrowserDomAdapter.prototype.getBaseHref = function (doc) {
  58184. var href = getBaseElementHref();
  58185. return href == null ? null : relativePath(href);
  58186. };
  58187. BrowserDomAdapter.prototype.resetBaseElement = function () { baseElement = null; };
  58188. BrowserDomAdapter.prototype.getUserAgent = function () { return window.navigator.userAgent; };
  58189. BrowserDomAdapter.prototype.setData = function (element, name, value) {
  58190. this.setAttribute(element, 'data-' + name, value);
  58191. };
  58192. BrowserDomAdapter.prototype.getData = function (element, name) {
  58193. return this.getAttribute(element, 'data-' + name);
  58194. };
  58195. BrowserDomAdapter.prototype.getComputedStyle = function (element) { return getComputedStyle(element); };
  58196. // TODO(tbosch): move this into a separate environment class once we have it
  58197. BrowserDomAdapter.prototype.supportsWebAnimation = function () {
  58198. return typeof Element.prototype['animate'] === 'function';
  58199. };
  58200. BrowserDomAdapter.prototype.performanceNow = function () {
  58201. // performance.now() is not available in all browsers, see
  58202. // http://caniuse.com/#search=performance.now
  58203. return window.performance && window.performance.now ? window.performance.now() :
  58204. new Date().getTime();
  58205. };
  58206. BrowserDomAdapter.prototype.supportsCookies = function () { return true; };
  58207. BrowserDomAdapter.prototype.getCookie = function (name) { return Object(_angular_common__WEBPACK_IMPORTED_MODULE_1__["ɵparseCookieValue"])(document.cookie, name); };
  58208. BrowserDomAdapter.prototype.setCookie = function (name, value) {
  58209. // document.cookie is magical, assigning into it assigns/overrides one cookie value, but does
  58210. // not clear other cookies.
  58211. document.cookie = encodeURIComponent(name) + '=' + encodeURIComponent(value);
  58212. };
  58213. return BrowserDomAdapter;
  58214. }(GenericBrowserDomAdapter));
  58215. var baseElement = null;
  58216. function getBaseElementHref() {
  58217. if (!baseElement) {
  58218. baseElement = document.querySelector('base');
  58219. if (!baseElement) {
  58220. return null;
  58221. }
  58222. }
  58223. return baseElement.getAttribute('href');
  58224. }
  58225. // based on urlUtils.js in AngularJS 1
  58226. var urlParsingNode;
  58227. function relativePath(url) {
  58228. if (!urlParsingNode) {
  58229. urlParsingNode = document.createElement('a');
  58230. }
  58231. urlParsingNode.setAttribute('href', url);
  58232. return (urlParsingNode.pathname.charAt(0) === '/') ? urlParsingNode.pathname :
  58233. '/' + urlParsingNode.pathname;
  58234. }
  58235. /**
  58236. * @license
  58237. * Copyright Google Inc. All Rights Reserved.
  58238. *
  58239. * Use of this source code is governed by an MIT-style license that can be
  58240. * found in the LICENSE file at https://angular.io/license
  58241. */
  58242. /**
  58243. * A DI Token representing the main rendering context. In a browser this is the DOM Document.
  58244. *
  58245. * Note: Document might not be available in the Application Context when Application and Rendering
  58246. * Contexts are not the same (e.g. when running the application into a Web Worker).
  58247. *
  58248. * @deprecated import from `@angular/common` instead.
  58249. */
  58250. var DOCUMENT$1 = _angular_common__WEBPACK_IMPORTED_MODULE_1__["DOCUMENT"];
  58251. /**
  58252. * @license
  58253. * Copyright Google Inc. All Rights Reserved.
  58254. *
  58255. * Use of this source code is governed by an MIT-style license that can be
  58256. * found in the LICENSE file at https://angular.io/license
  58257. */
  58258. function supportsState() {
  58259. return !!window.history.pushState;
  58260. }
  58261. /**
  58262. * @license
  58263. * Copyright Google Inc. All Rights Reserved.
  58264. *
  58265. * Use of this source code is governed by an MIT-style license that can be
  58266. * found in the LICENSE file at https://angular.io/license
  58267. */
  58268. /**
  58269. * `PlatformLocation` encapsulates all of the direct calls to platform APIs.
  58270. * This class should not be used directly by an application developer. Instead, use
  58271. * {@link Location}.
  58272. */
  58273. var BrowserPlatformLocation = /** @class */ (function (_super) {
  58274. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(BrowserPlatformLocation, _super);
  58275. function BrowserPlatformLocation(_doc) {
  58276. var _this = _super.call(this) || this;
  58277. _this._doc = _doc;
  58278. _this._init();
  58279. return _this;
  58280. }
  58281. // This is moved to its own method so that `MockPlatformLocationStrategy` can overwrite it
  58282. /** @internal */
  58283. BrowserPlatformLocation.prototype._init = function () {
  58284. this.location = getDOM().getLocation();
  58285. this._history = getDOM().getHistory();
  58286. };
  58287. BrowserPlatformLocation.prototype.getBaseHrefFromDOM = function () { return getDOM().getBaseHref(this._doc); };
  58288. BrowserPlatformLocation.prototype.onPopState = function (fn) {
  58289. getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('popstate', fn, false);
  58290. };
  58291. BrowserPlatformLocation.prototype.onHashChange = function (fn) {
  58292. getDOM().getGlobalEventTarget(this._doc, 'window').addEventListener('hashchange', fn, false);
  58293. };
  58294. Object.defineProperty(BrowserPlatformLocation.prototype, "pathname", {
  58295. get: function () { return this.location.pathname; },
  58296. set: function (newPath) { this.location.pathname = newPath; },
  58297. enumerable: true,
  58298. configurable: true
  58299. });
  58300. Object.defineProperty(BrowserPlatformLocation.prototype, "search", {
  58301. get: function () { return this.location.search; },
  58302. enumerable: true,
  58303. configurable: true
  58304. });
  58305. Object.defineProperty(BrowserPlatformLocation.prototype, "hash", {
  58306. get: function () { return this.location.hash; },
  58307. enumerable: true,
  58308. configurable: true
  58309. });
  58310. BrowserPlatformLocation.prototype.pushState = function (state, title, url) {
  58311. if (supportsState()) {
  58312. this._history.pushState(state, title, url);
  58313. }
  58314. else {
  58315. this.location.hash = url;
  58316. }
  58317. };
  58318. BrowserPlatformLocation.prototype.replaceState = function (state, title, url) {
  58319. if (supportsState()) {
  58320. this._history.replaceState(state, title, url);
  58321. }
  58322. else {
  58323. this.location.hash = url;
  58324. }
  58325. };
  58326. BrowserPlatformLocation.prototype.forward = function () { this._history.forward(); };
  58327. BrowserPlatformLocation.prototype.back = function () { this._history.back(); };
  58328. BrowserPlatformLocation = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  58329. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  58330. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  58331. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  58332. ], BrowserPlatformLocation);
  58333. return BrowserPlatformLocation;
  58334. }(_angular_common__WEBPACK_IMPORTED_MODULE_1__["PlatformLocation"]));
  58335. /**
  58336. * @license
  58337. * Copyright Google Inc. All Rights Reserved.
  58338. *
  58339. * Use of this source code is governed by an MIT-style license that can be
  58340. * found in the LICENSE file at https://angular.io/license
  58341. */
  58342. /**
  58343. * An id that identifies a particular application being bootstrapped, that should
  58344. * match across the client/server boundary.
  58345. */
  58346. var TRANSITION_ID = new _angular_core__WEBPACK_IMPORTED_MODULE_2__["InjectionToken"]('TRANSITION_ID');
  58347. function appInitializerFactory(transitionId, document, injector) {
  58348. return function () {
  58349. // Wait for all application initializers to be completed before removing the styles set by
  58350. // the server.
  58351. injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_2__["ApplicationInitStatus"]).donePromise.then(function () {
  58352. var dom = getDOM();
  58353. var styles = Array.prototype.slice.apply(dom.querySelectorAll(document, "style[ng-transition]"));
  58354. styles.filter(function (el) { return dom.getAttribute(el, 'ng-transition') === transitionId; })
  58355. .forEach(function (el) { return dom.remove(el); });
  58356. });
  58357. };
  58358. }
  58359. var SERVER_TRANSITION_PROVIDERS = [
  58360. {
  58361. provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["APP_INITIALIZER"],
  58362. useFactory: appInitializerFactory,
  58363. deps: [TRANSITION_ID, DOCUMENT$1, _angular_core__WEBPACK_IMPORTED_MODULE_2__["Injector"]],
  58364. multi: true
  58365. },
  58366. ];
  58367. /**
  58368. * @license
  58369. * Copyright Google Inc. All Rights Reserved.
  58370. *
  58371. * Use of this source code is governed by an MIT-style license that can be
  58372. * found in the LICENSE file at https://angular.io/license
  58373. */
  58374. var BrowserGetTestability = /** @class */ (function () {
  58375. function BrowserGetTestability() {
  58376. }
  58377. BrowserGetTestability.init = function () { Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["setTestabilityGetter"])(new BrowserGetTestability()); };
  58378. BrowserGetTestability.prototype.addToWindow = function (registry) {
  58379. _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['getAngularTestability'] = function (elem, findInAncestors) {
  58380. if (findInAncestors === void 0) { findInAncestors = true; }
  58381. var testability = registry.findTestabilityInTree(elem, findInAncestors);
  58382. if (testability == null) {
  58383. throw new Error('Could not find testability for element.');
  58384. }
  58385. return testability;
  58386. };
  58387. _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['getAllAngularTestabilities'] = function () { return registry.getAllTestabilities(); };
  58388. _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['getAllAngularRootElements'] = function () { return registry.getAllRootElements(); };
  58389. var whenAllStable = function (callback /** TODO #9100 */) {
  58390. var testabilities = _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['getAllAngularTestabilities']();
  58391. var count = testabilities.length;
  58392. var didWork = false;
  58393. var decrement = function (didWork_ /** TODO #9100 */) {
  58394. didWork = didWork || didWork_;
  58395. count--;
  58396. if (count == 0) {
  58397. callback(didWork);
  58398. }
  58399. };
  58400. testabilities.forEach(function (testability /** TODO #9100 */) {
  58401. testability.whenStable(decrement);
  58402. });
  58403. };
  58404. if (!_angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['frameworkStabilizers']) {
  58405. _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['frameworkStabilizers'] = [];
  58406. }
  58407. _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['frameworkStabilizers'].push(whenAllStable);
  58408. };
  58409. BrowserGetTestability.prototype.findTestabilityInTree = function (registry, elem, findInAncestors) {
  58410. if (elem == null) {
  58411. return null;
  58412. }
  58413. var t = registry.getTestability(elem);
  58414. if (t != null) {
  58415. return t;
  58416. }
  58417. else if (!findInAncestors) {
  58418. return null;
  58419. }
  58420. if (getDOM().isShadowRoot(elem)) {
  58421. return this.findTestabilityInTree(registry, getDOM().getHost(elem), true);
  58422. }
  58423. return this.findTestabilityInTree(registry, getDOM().parentElement(elem), true);
  58424. };
  58425. return BrowserGetTestability;
  58426. }());
  58427. /**
  58428. * @license
  58429. * Copyright Google Inc. All Rights Reserved.
  58430. *
  58431. * Use of this source code is governed by an MIT-style license that can be
  58432. * found in the LICENSE file at https://angular.io/license
  58433. */
  58434. /**
  58435. * Exports the value under a given `name` in the global property `ng`. For example `ng.probe` if
  58436. * `name` is `'probe'`.
  58437. * @param name Name under which it will be exported. Keep in mind this will be a property of the
  58438. * global `ng` object.
  58439. * @param value The value to export.
  58440. */
  58441. function exportNgVar(name, value) {
  58442. if (typeof COMPILED === 'undefined' || !COMPILED) {
  58443. // Note: we can't export `ng` when using closure enhanced optimization as:
  58444. // - closure declares globals itself for minified names, which sometimes clobber our `ng` global
  58445. // - we can't declare a closure extern as the namespace `ng` is already used within Google
  58446. // for typings for angularJS (via `goog.provide('ng....')`).
  58447. var ng = _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['ng'] = _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵglobal"]['ng'] || {};
  58448. ng[name] = value;
  58449. }
  58450. }
  58451. /**
  58452. * @license
  58453. * Copyright Google Inc. All Rights Reserved.
  58454. *
  58455. * Use of this source code is governed by an MIT-style license that can be
  58456. * found in the LICENSE file at https://angular.io/license
  58457. */
  58458. var CORE_TOKENS = {
  58459. 'ApplicationRef': _angular_core__WEBPACK_IMPORTED_MODULE_2__["ApplicationRef"],
  58460. 'NgZone': _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"],
  58461. };
  58462. var INSPECT_GLOBAL_NAME = 'probe';
  58463. var CORE_TOKENS_GLOBAL_NAME = 'coreTokens';
  58464. /**
  58465. * Returns a {@link DebugElement} for the given native DOM element, or
  58466. * null if the given native element does not have an Angular view associated
  58467. * with it.
  58468. */
  58469. function inspectNativeElement(element) {
  58470. return Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["getDebugNode"])(element);
  58471. }
  58472. function _createNgProbe(coreTokens) {
  58473. exportNgVar(INSPECT_GLOBAL_NAME, inspectNativeElement);
  58474. exportNgVar(CORE_TOKENS_GLOBAL_NAME, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, CORE_TOKENS, _ngProbeTokensToMap(coreTokens || [])));
  58475. return function () { return inspectNativeElement; };
  58476. }
  58477. function _ngProbeTokensToMap(tokens) {
  58478. return tokens.reduce(function (prev, t) { return (prev[t.name] = t.token, prev); }, {});
  58479. }
  58480. /**
  58481. * Providers which support debugging Angular applications (e.g. via `ng.probe`).
  58482. */
  58483. var ELEMENT_PROBE_PROVIDERS = [
  58484. {
  58485. provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["APP_INITIALIZER"],
  58486. useFactory: _createNgProbe,
  58487. deps: [
  58488. [_angular_core__WEBPACK_IMPORTED_MODULE_2__["NgProbeToken"], new _angular_core__WEBPACK_IMPORTED_MODULE_2__["Optional"]()],
  58489. ],
  58490. multi: true,
  58491. },
  58492. ];
  58493. /**
  58494. * @license
  58495. * Copyright Google Inc. All Rights Reserved.
  58496. *
  58497. * Use of this source code is governed by an MIT-style license that can be
  58498. * found in the LICENSE file at https://angular.io/license
  58499. */
  58500. /**
  58501. * The injection token for the event-manager plug-in service.
  58502. */
  58503. var EVENT_MANAGER_PLUGINS = new _angular_core__WEBPACK_IMPORTED_MODULE_2__["InjectionToken"]('EventManagerPlugins');
  58504. /**
  58505. * An injectable service that provides event management for Angular
  58506. * through a browser plug-in.
  58507. */
  58508. var EventManager = /** @class */ (function () {
  58509. /**
  58510. * Initializes an instance of the event-manager service.
  58511. */
  58512. function EventManager(plugins, _zone) {
  58513. var _this = this;
  58514. this._zone = _zone;
  58515. this._eventNameToPlugin = new Map();
  58516. plugins.forEach(function (p) { return p.manager = _this; });
  58517. this._plugins = plugins.slice().reverse();
  58518. }
  58519. /**
  58520. * Registers a handler for a specific element and event.
  58521. *
  58522. * @param element The HTML element to receive event notifications.
  58523. * @param eventName The name of the event to listen for.
  58524. * @param handler A function to call when the notification occurs. Receives the
  58525. * event object as an argument.
  58526. * @returns A callback function that can be used to remove the handler.
  58527. */
  58528. EventManager.prototype.addEventListener = function (element, eventName, handler) {
  58529. var plugin = this._findPluginFor(eventName);
  58530. return plugin.addEventListener(element, eventName, handler);
  58531. };
  58532. /**
  58533. * Registers a global handler for an event in a target view.
  58534. *
  58535. * @param target A target for global event notifications. One of "window", "document", or "body".
  58536. * @param eventName The name of the event to listen for.
  58537. * @param handler A function to call when the notification occurs. Receives the
  58538. * event object as an argument.
  58539. * @returns A callback function that can be used to remove the handler.
  58540. */
  58541. EventManager.prototype.addGlobalEventListener = function (target, eventName, handler) {
  58542. var plugin = this._findPluginFor(eventName);
  58543. return plugin.addGlobalEventListener(target, eventName, handler);
  58544. };
  58545. /**
  58546. * Retrieves the compilation zone in which event listeners are registered.
  58547. */
  58548. EventManager.prototype.getZone = function () { return this._zone; };
  58549. /** @internal */
  58550. EventManager.prototype._findPluginFor = function (eventName) {
  58551. var plugin = this._eventNameToPlugin.get(eventName);
  58552. if (plugin) {
  58553. return plugin;
  58554. }
  58555. var plugins = this._plugins;
  58556. for (var i = 0; i < plugins.length; i++) {
  58557. var plugin_1 = plugins[i];
  58558. if (plugin_1.supports(eventName)) {
  58559. this._eventNameToPlugin.set(eventName, plugin_1);
  58560. return plugin_1;
  58561. }
  58562. }
  58563. throw new Error("No event manager plugin found for event " + eventName);
  58564. };
  58565. EventManager = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  58566. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  58567. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(EVENT_MANAGER_PLUGINS)),
  58568. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Array, _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"]])
  58569. ], EventManager);
  58570. return EventManager;
  58571. }());
  58572. var EventManagerPlugin = /** @class */ (function () {
  58573. function EventManagerPlugin(_doc) {
  58574. this._doc = _doc;
  58575. }
  58576. EventManagerPlugin.prototype.addGlobalEventListener = function (element, eventName, handler) {
  58577. var target = getDOM().getGlobalEventTarget(this._doc, element);
  58578. if (!target) {
  58579. throw new Error("Unsupported event target " + target + " for event " + eventName);
  58580. }
  58581. return this.addEventListener(target, eventName, handler);
  58582. };
  58583. return EventManagerPlugin;
  58584. }());
  58585. /**
  58586. * @license
  58587. * Copyright Google Inc. All Rights Reserved.
  58588. *
  58589. * Use of this source code is governed by an MIT-style license that can be
  58590. * found in the LICENSE file at https://angular.io/license
  58591. */
  58592. var SharedStylesHost = /** @class */ (function () {
  58593. function SharedStylesHost() {
  58594. /** @internal */
  58595. this._stylesSet = new Set();
  58596. }
  58597. SharedStylesHost.prototype.addStyles = function (styles) {
  58598. var _this = this;
  58599. var additions = new Set();
  58600. styles.forEach(function (style) {
  58601. if (!_this._stylesSet.has(style)) {
  58602. _this._stylesSet.add(style);
  58603. additions.add(style);
  58604. }
  58605. });
  58606. this.onStylesAdded(additions);
  58607. };
  58608. SharedStylesHost.prototype.onStylesAdded = function (additions) { };
  58609. SharedStylesHost.prototype.getAllStyles = function () { return Array.from(this._stylesSet); };
  58610. SharedStylesHost = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  58611. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])()
  58612. ], SharedStylesHost);
  58613. return SharedStylesHost;
  58614. }());
  58615. var DomSharedStylesHost = /** @class */ (function (_super) {
  58616. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DomSharedStylesHost, _super);
  58617. function DomSharedStylesHost(_doc) {
  58618. var _this = _super.call(this) || this;
  58619. _this._doc = _doc;
  58620. _this._hostNodes = new Set();
  58621. _this._styleNodes = new Set();
  58622. _this._hostNodes.add(_doc.head);
  58623. return _this;
  58624. }
  58625. DomSharedStylesHost.prototype._addStylesToHost = function (styles, host) {
  58626. var _this = this;
  58627. styles.forEach(function (style) {
  58628. var styleEl = _this._doc.createElement('style');
  58629. styleEl.textContent = style;
  58630. _this._styleNodes.add(host.appendChild(styleEl));
  58631. });
  58632. };
  58633. DomSharedStylesHost.prototype.addHost = function (hostNode) {
  58634. this._addStylesToHost(this._stylesSet, hostNode);
  58635. this._hostNodes.add(hostNode);
  58636. };
  58637. DomSharedStylesHost.prototype.removeHost = function (hostNode) { this._hostNodes.delete(hostNode); };
  58638. DomSharedStylesHost.prototype.onStylesAdded = function (additions) {
  58639. var _this = this;
  58640. this._hostNodes.forEach(function (hostNode) { return _this._addStylesToHost(additions, hostNode); });
  58641. };
  58642. DomSharedStylesHost.prototype.ngOnDestroy = function () { this._styleNodes.forEach(function (styleNode) { return getDOM().remove(styleNode); }); };
  58643. DomSharedStylesHost = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  58644. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  58645. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  58646. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  58647. ], DomSharedStylesHost);
  58648. return DomSharedStylesHost;
  58649. }(SharedStylesHost));
  58650. /**
  58651. * @license
  58652. * Copyright Google Inc. All Rights Reserved.
  58653. *
  58654. * Use of this source code is governed by an MIT-style license that can be
  58655. * found in the LICENSE file at https://angular.io/license
  58656. */
  58657. var NAMESPACE_URIS = {
  58658. 'svg': 'http://www.w3.org/2000/svg',
  58659. 'xhtml': 'http://www.w3.org/1999/xhtml',
  58660. 'xlink': 'http://www.w3.org/1999/xlink',
  58661. 'xml': 'http://www.w3.org/XML/1998/namespace',
  58662. 'xmlns': 'http://www.w3.org/2000/xmlns/',
  58663. };
  58664. var COMPONENT_REGEX = /%COMP%/g;
  58665. var COMPONENT_VARIABLE = '%COMP%';
  58666. var HOST_ATTR = "_nghost-" + COMPONENT_VARIABLE;
  58667. var CONTENT_ATTR = "_ngcontent-" + COMPONENT_VARIABLE;
  58668. function shimContentAttribute(componentShortId) {
  58669. return CONTENT_ATTR.replace(COMPONENT_REGEX, componentShortId);
  58670. }
  58671. function shimHostAttribute(componentShortId) {
  58672. return HOST_ATTR.replace(COMPONENT_REGEX, componentShortId);
  58673. }
  58674. function flattenStyles(compId, styles, target) {
  58675. for (var i = 0; i < styles.length; i++) {
  58676. var style = styles[i];
  58677. if (Array.isArray(style)) {
  58678. flattenStyles(compId, style, target);
  58679. }
  58680. else {
  58681. style = style.replace(COMPONENT_REGEX, compId);
  58682. target.push(style);
  58683. }
  58684. }
  58685. return target;
  58686. }
  58687. function decoratePreventDefault(eventHandler) {
  58688. return function (event) {
  58689. var allowDefaultBehavior = eventHandler(event);
  58690. if (allowDefaultBehavior === false) {
  58691. // TODO(tbosch): move preventDefault into event plugins...
  58692. event.preventDefault();
  58693. event.returnValue = false;
  58694. }
  58695. };
  58696. }
  58697. var DomRendererFactory2 = /** @class */ (function () {
  58698. function DomRendererFactory2(eventManager, sharedStylesHost) {
  58699. this.eventManager = eventManager;
  58700. this.sharedStylesHost = sharedStylesHost;
  58701. this.rendererByCompId = new Map();
  58702. this.defaultRenderer = new DefaultDomRenderer2(eventManager);
  58703. }
  58704. DomRendererFactory2.prototype.createRenderer = function (element, type) {
  58705. if (!element || !type) {
  58706. return this.defaultRenderer;
  58707. }
  58708. switch (type.encapsulation) {
  58709. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewEncapsulation"].Emulated: {
  58710. var renderer = this.rendererByCompId.get(type.id);
  58711. if (!renderer) {
  58712. renderer =
  58713. new EmulatedEncapsulationDomRenderer2(this.eventManager, this.sharedStylesHost, type);
  58714. this.rendererByCompId.set(type.id, renderer);
  58715. }
  58716. renderer.applyToHost(element);
  58717. return renderer;
  58718. }
  58719. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewEncapsulation"].Native:
  58720. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewEncapsulation"].ShadowDom:
  58721. return new ShadowDomRenderer(this.eventManager, this.sharedStylesHost, element, type);
  58722. default: {
  58723. if (!this.rendererByCompId.has(type.id)) {
  58724. var styles = flattenStyles(type.id, type.styles, []);
  58725. this.sharedStylesHost.addStyles(styles);
  58726. this.rendererByCompId.set(type.id, this.defaultRenderer);
  58727. }
  58728. return this.defaultRenderer;
  58729. }
  58730. }
  58731. };
  58732. DomRendererFactory2.prototype.begin = function () { };
  58733. DomRendererFactory2.prototype.end = function () { };
  58734. DomRendererFactory2 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  58735. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  58736. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [EventManager, DomSharedStylesHost])
  58737. ], DomRendererFactory2);
  58738. return DomRendererFactory2;
  58739. }());
  58740. var DefaultDomRenderer2 = /** @class */ (function () {
  58741. function DefaultDomRenderer2(eventManager) {
  58742. this.eventManager = eventManager;
  58743. this.data = Object.create(null);
  58744. }
  58745. DefaultDomRenderer2.prototype.destroy = function () { };
  58746. DefaultDomRenderer2.prototype.createElement = function (name, namespace) {
  58747. if (namespace) {
  58748. return document.createElementNS(NAMESPACE_URIS[namespace], name);
  58749. }
  58750. return document.createElement(name);
  58751. };
  58752. DefaultDomRenderer2.prototype.createComment = function (value) { return document.createComment(value); };
  58753. DefaultDomRenderer2.prototype.createText = function (value) { return document.createTextNode(value); };
  58754. DefaultDomRenderer2.prototype.appendChild = function (parent, newChild) { parent.appendChild(newChild); };
  58755. DefaultDomRenderer2.prototype.insertBefore = function (parent, newChild, refChild) {
  58756. if (parent) {
  58757. parent.insertBefore(newChild, refChild);
  58758. }
  58759. };
  58760. DefaultDomRenderer2.prototype.removeChild = function (parent, oldChild) {
  58761. if (parent) {
  58762. parent.removeChild(oldChild);
  58763. }
  58764. };
  58765. DefaultDomRenderer2.prototype.selectRootElement = function (selectorOrNode) {
  58766. var el = typeof selectorOrNode === 'string' ? document.querySelector(selectorOrNode) :
  58767. selectorOrNode;
  58768. if (!el) {
  58769. throw new Error("The selector \"" + selectorOrNode + "\" did not match any elements");
  58770. }
  58771. el.textContent = '';
  58772. return el;
  58773. };
  58774. DefaultDomRenderer2.prototype.parentNode = function (node) { return node.parentNode; };
  58775. DefaultDomRenderer2.prototype.nextSibling = function (node) { return node.nextSibling; };
  58776. DefaultDomRenderer2.prototype.setAttribute = function (el, name, value, namespace) {
  58777. if (namespace) {
  58778. name = namespace + ":" + name;
  58779. var namespaceUri = NAMESPACE_URIS[namespace];
  58780. if (namespaceUri) {
  58781. el.setAttributeNS(namespaceUri, name, value);
  58782. }
  58783. else {
  58784. el.setAttribute(name, value);
  58785. }
  58786. }
  58787. else {
  58788. el.setAttribute(name, value);
  58789. }
  58790. };
  58791. DefaultDomRenderer2.prototype.removeAttribute = function (el, name, namespace) {
  58792. if (namespace) {
  58793. var namespaceUri = NAMESPACE_URIS[namespace];
  58794. if (namespaceUri) {
  58795. el.removeAttributeNS(namespaceUri, name);
  58796. }
  58797. else {
  58798. el.removeAttribute(namespace + ":" + name);
  58799. }
  58800. }
  58801. else {
  58802. el.removeAttribute(name);
  58803. }
  58804. };
  58805. DefaultDomRenderer2.prototype.addClass = function (el, name) { el.classList.add(name); };
  58806. DefaultDomRenderer2.prototype.removeClass = function (el, name) { el.classList.remove(name); };
  58807. DefaultDomRenderer2.prototype.setStyle = function (el, style, value, flags) {
  58808. if (flags & _angular_core__WEBPACK_IMPORTED_MODULE_2__["RendererStyleFlags2"].DashCase) {
  58809. el.style.setProperty(style, value, !!(flags & _angular_core__WEBPACK_IMPORTED_MODULE_2__["RendererStyleFlags2"].Important) ? 'important' : '');
  58810. }
  58811. else {
  58812. el.style[style] = value;
  58813. }
  58814. };
  58815. DefaultDomRenderer2.prototype.removeStyle = function (el, style, flags) {
  58816. if (flags & _angular_core__WEBPACK_IMPORTED_MODULE_2__["RendererStyleFlags2"].DashCase) {
  58817. el.style.removeProperty(style);
  58818. }
  58819. else {
  58820. // IE requires '' instead of null
  58821. // see https://github.com/angular/angular/issues/7916
  58822. el.style[style] = '';
  58823. }
  58824. };
  58825. DefaultDomRenderer2.prototype.setProperty = function (el, name, value) {
  58826. checkNoSyntheticProp(name, 'property');
  58827. el[name] = value;
  58828. };
  58829. DefaultDomRenderer2.prototype.setValue = function (node, value) { node.nodeValue = value; };
  58830. DefaultDomRenderer2.prototype.listen = function (target, event, callback) {
  58831. checkNoSyntheticProp(event, 'listener');
  58832. if (typeof target === 'string') {
  58833. return this.eventManager.addGlobalEventListener(target, event, decoratePreventDefault(callback));
  58834. }
  58835. return this.eventManager.addEventListener(target, event, decoratePreventDefault(callback));
  58836. };
  58837. return DefaultDomRenderer2;
  58838. }());
  58839. var AT_CHARCODE = '@'.charCodeAt(0);
  58840. function checkNoSyntheticProp(name, nameKind) {
  58841. if (name.charCodeAt(0) === AT_CHARCODE) {
  58842. throw new Error("Found the synthetic " + nameKind + " " + name + ". Please include either \"BrowserAnimationsModule\" or \"NoopAnimationsModule\" in your application.");
  58843. }
  58844. }
  58845. var EmulatedEncapsulationDomRenderer2 = /** @class */ (function (_super) {
  58846. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(EmulatedEncapsulationDomRenderer2, _super);
  58847. function EmulatedEncapsulationDomRenderer2(eventManager, sharedStylesHost, component) {
  58848. var _this = _super.call(this, eventManager) || this;
  58849. _this.component = component;
  58850. var styles = flattenStyles(component.id, component.styles, []);
  58851. sharedStylesHost.addStyles(styles);
  58852. _this.contentAttr = shimContentAttribute(component.id);
  58853. _this.hostAttr = shimHostAttribute(component.id);
  58854. return _this;
  58855. }
  58856. EmulatedEncapsulationDomRenderer2.prototype.applyToHost = function (element) { _super.prototype.setAttribute.call(this, element, this.hostAttr, ''); };
  58857. EmulatedEncapsulationDomRenderer2.prototype.createElement = function (parent, name) {
  58858. var el = _super.prototype.createElement.call(this, parent, name);
  58859. _super.prototype.setAttribute.call(this, el, this.contentAttr, '');
  58860. return el;
  58861. };
  58862. return EmulatedEncapsulationDomRenderer2;
  58863. }(DefaultDomRenderer2));
  58864. var ShadowDomRenderer = /** @class */ (function (_super) {
  58865. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ShadowDomRenderer, _super);
  58866. function ShadowDomRenderer(eventManager, sharedStylesHost, hostEl, component) {
  58867. var _this = _super.call(this, eventManager) || this;
  58868. _this.sharedStylesHost = sharedStylesHost;
  58869. _this.hostEl = hostEl;
  58870. _this.component = component;
  58871. if (component.encapsulation === _angular_core__WEBPACK_IMPORTED_MODULE_2__["ViewEncapsulation"].ShadowDom) {
  58872. _this.shadowRoot = hostEl.attachShadow({ mode: 'open' });
  58873. }
  58874. else {
  58875. _this.shadowRoot = hostEl.createShadowRoot();
  58876. }
  58877. _this.sharedStylesHost.addHost(_this.shadowRoot);
  58878. var styles = flattenStyles(component.id, component.styles, []);
  58879. for (var i = 0; i < styles.length; i++) {
  58880. var styleEl = document.createElement('style');
  58881. styleEl.textContent = styles[i];
  58882. _this.shadowRoot.appendChild(styleEl);
  58883. }
  58884. return _this;
  58885. }
  58886. ShadowDomRenderer.prototype.nodeOrShadowRoot = function (node) { return node === this.hostEl ? this.shadowRoot : node; };
  58887. ShadowDomRenderer.prototype.destroy = function () { this.sharedStylesHost.removeHost(this.shadowRoot); };
  58888. ShadowDomRenderer.prototype.appendChild = function (parent, newChild) {
  58889. return _super.prototype.appendChild.call(this, this.nodeOrShadowRoot(parent), newChild);
  58890. };
  58891. ShadowDomRenderer.prototype.insertBefore = function (parent, newChild, refChild) {
  58892. return _super.prototype.insertBefore.call(this, this.nodeOrShadowRoot(parent), newChild, refChild);
  58893. };
  58894. ShadowDomRenderer.prototype.removeChild = function (parent, oldChild) {
  58895. return _super.prototype.removeChild.call(this, this.nodeOrShadowRoot(parent), oldChild);
  58896. };
  58897. ShadowDomRenderer.prototype.parentNode = function (node) {
  58898. return this.nodeOrShadowRoot(_super.prototype.parentNode.call(this, this.nodeOrShadowRoot(node)));
  58899. };
  58900. return ShadowDomRenderer;
  58901. }(DefaultDomRenderer2));
  58902. /**
  58903. * @license
  58904. * Copyright Google Inc. All Rights Reserved.
  58905. *
  58906. * Use of this source code is governed by an MIT-style license that can be
  58907. * found in the LICENSE file at https://angular.io/license
  58908. */
  58909. var ɵ0 = function (v) {
  58910. return '__zone_symbol__' + v;
  58911. };
  58912. /**
  58913. * Detect if Zone is present. If it is then use simple zone aware 'addEventListener'
  58914. * since Angular can do much more
  58915. * efficient bookkeeping than Zone can, because we have additional information. This speeds up
  58916. * addEventListener by 3x.
  58917. */
  58918. var __symbol__ = (typeof Zone !== 'undefined') && Zone['__symbol__'] || ɵ0;
  58919. var ADD_EVENT_LISTENER = __symbol__('addEventListener');
  58920. var REMOVE_EVENT_LISTENER = __symbol__('removeEventListener');
  58921. var symbolNames = {};
  58922. var FALSE = 'FALSE';
  58923. var ANGULAR = 'ANGULAR';
  58924. var NATIVE_ADD_LISTENER = 'addEventListener';
  58925. var NATIVE_REMOVE_LISTENER = 'removeEventListener';
  58926. // use the same symbol string which is used in zone.js
  58927. var stopSymbol = '__zone_symbol__propagationStopped';
  58928. var stopMethodSymbol = '__zone_symbol__stopImmediatePropagation';
  58929. var blackListedEvents = (typeof Zone !== 'undefined') && Zone[__symbol__('BLACK_LISTED_EVENTS')];
  58930. var blackListedMap;
  58931. if (blackListedEvents) {
  58932. blackListedMap = {};
  58933. blackListedEvents.forEach(function (eventName) { blackListedMap[eventName] = eventName; });
  58934. }
  58935. var isBlackListedEvent = function (eventName) {
  58936. if (!blackListedMap) {
  58937. return false;
  58938. }
  58939. return blackListedMap.hasOwnProperty(eventName);
  58940. };
  58941. // a global listener to handle all dom event,
  58942. // so we do not need to create a closure every time
  58943. var globalListener = function (event) {
  58944. var symbolName = symbolNames[event.type];
  58945. if (!symbolName) {
  58946. return;
  58947. }
  58948. var taskDatas = this[symbolName];
  58949. if (!taskDatas) {
  58950. return;
  58951. }
  58952. var args = [event];
  58953. if (taskDatas.length === 1) {
  58954. // if taskDatas only have one element, just invoke it
  58955. var taskData = taskDatas[0];
  58956. if (taskData.zone !== Zone.current) {
  58957. // only use Zone.run when Zone.current not equals to stored zone
  58958. return taskData.zone.run(taskData.handler, this, args);
  58959. }
  58960. else {
  58961. return taskData.handler.apply(this, args);
  58962. }
  58963. }
  58964. else {
  58965. // copy tasks as a snapshot to avoid event handlers remove
  58966. // itself or others
  58967. var copiedTasks = taskDatas.slice();
  58968. for (var i = 0; i < copiedTasks.length; i++) {
  58969. // if other listener call event.stopImmediatePropagation
  58970. // just break
  58971. if (event[stopSymbol] === true) {
  58972. break;
  58973. }
  58974. var taskData = copiedTasks[i];
  58975. if (taskData.zone !== Zone.current) {
  58976. // only use Zone.run when Zone.current not equals to stored zone
  58977. taskData.zone.run(taskData.handler, this, args);
  58978. }
  58979. else {
  58980. taskData.handler.apply(this, args);
  58981. }
  58982. }
  58983. }
  58984. };
  58985. var DomEventsPlugin = /** @class */ (function (_super) {
  58986. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DomEventsPlugin, _super);
  58987. function DomEventsPlugin(doc, ngZone, platformId) {
  58988. var _this = _super.call(this, doc) || this;
  58989. _this.ngZone = ngZone;
  58990. if (!platformId || !Object(_angular_common__WEBPACK_IMPORTED_MODULE_1__["isPlatformServer"])(platformId)) {
  58991. _this.patchEvent();
  58992. }
  58993. return _this;
  58994. }
  58995. DomEventsPlugin.prototype.patchEvent = function () {
  58996. if (typeof Event === 'undefined' || !Event || !Event.prototype) {
  58997. return;
  58998. }
  58999. if (Event.prototype[stopMethodSymbol]) {
  59000. // already patched by zone.js
  59001. return;
  59002. }
  59003. var delegate = Event.prototype[stopMethodSymbol] =
  59004. Event.prototype.stopImmediatePropagation;
  59005. Event.prototype.stopImmediatePropagation = function () {
  59006. if (this) {
  59007. this[stopSymbol] = true;
  59008. }
  59009. // should call native delegate in case
  59010. // in some environment part of the application
  59011. // will not use the patched Event
  59012. delegate && delegate.apply(this, arguments);
  59013. };
  59014. };
  59015. // This plugin should come last in the list of plugins, because it accepts all
  59016. // events.
  59017. DomEventsPlugin.prototype.supports = function (eventName) { return true; };
  59018. DomEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
  59019. var _this = this;
  59020. var zoneJsLoaded = element[ADD_EVENT_LISTENER];
  59021. var callback = handler;
  59022. // if zonejs is loaded and current zone is not ngZone
  59023. // we keep Zone.current on target for later restoration.
  59024. if (zoneJsLoaded && (!_angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"].isInAngularZone() || isBlackListedEvent(eventName))) {
  59025. var symbolName = symbolNames[eventName];
  59026. if (!symbolName) {
  59027. symbolName = symbolNames[eventName] = __symbol__(ANGULAR + eventName + FALSE);
  59028. }
  59029. var taskDatas = element[symbolName];
  59030. var globalListenerRegistered = taskDatas && taskDatas.length > 0;
  59031. if (!taskDatas) {
  59032. taskDatas = element[symbolName] = [];
  59033. }
  59034. var zone = isBlackListedEvent(eventName) ? Zone.root : Zone.current;
  59035. if (taskDatas.length === 0) {
  59036. taskDatas.push({ zone: zone, handler: callback });
  59037. }
  59038. else {
  59039. var callbackRegistered = false;
  59040. for (var i = 0; i < taskDatas.length; i++) {
  59041. if (taskDatas[i].handler === callback) {
  59042. callbackRegistered = true;
  59043. break;
  59044. }
  59045. }
  59046. if (!callbackRegistered) {
  59047. taskDatas.push({ zone: zone, handler: callback });
  59048. }
  59049. }
  59050. if (!globalListenerRegistered) {
  59051. element[ADD_EVENT_LISTENER](eventName, globalListener, false);
  59052. }
  59053. }
  59054. else {
  59055. element[NATIVE_ADD_LISTENER](eventName, callback, false);
  59056. }
  59057. return function () { return _this.removeEventListener(element, eventName, callback); };
  59058. };
  59059. DomEventsPlugin.prototype.removeEventListener = function (target, eventName, callback) {
  59060. var underlyingRemove = target[REMOVE_EVENT_LISTENER];
  59061. // zone.js not loaded, use native removeEventListener
  59062. if (!underlyingRemove) {
  59063. return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
  59064. }
  59065. var symbolName = symbolNames[eventName];
  59066. var taskDatas = symbolName && target[symbolName];
  59067. if (!taskDatas) {
  59068. // addEventListener not using patched version
  59069. // just call native removeEventListener
  59070. return target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
  59071. }
  59072. // fix issue 20532, should be able to remove
  59073. // listener which was added inside of ngZone
  59074. var found = false;
  59075. for (var i = 0; i < taskDatas.length; i++) {
  59076. // remove listener from taskDatas if the callback equals
  59077. if (taskDatas[i].handler === callback) {
  59078. found = true;
  59079. taskDatas.splice(i, 1);
  59080. break;
  59081. }
  59082. }
  59083. if (found) {
  59084. if (taskDatas.length === 0) {
  59085. // all listeners are removed, we can remove the globalListener from target
  59086. underlyingRemove.apply(target, [eventName, globalListener, false]);
  59087. }
  59088. }
  59089. else {
  59090. // not found in taskDatas, the callback may be added inside of ngZone
  59091. // use native remove listener to remove the callback
  59092. target[NATIVE_REMOVE_LISTENER].apply(target, [eventName, callback, false]);
  59093. }
  59094. };
  59095. DomEventsPlugin = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59096. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  59097. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  59098. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(_angular_core__WEBPACK_IMPORTED_MODULE_2__["PLATFORM_ID"])),
  59099. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object, _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"], Object])
  59100. ], DomEventsPlugin);
  59101. return DomEventsPlugin;
  59102. }(EventManagerPlugin));
  59103. /**
  59104. * @license
  59105. * Copyright Google Inc. All Rights Reserved.
  59106. *
  59107. * Use of this source code is governed by an MIT-style license that can be
  59108. * found in the LICENSE file at https://angular.io/license
  59109. */
  59110. /**
  59111. * Supported HammerJS recognizer event names.
  59112. */
  59113. var EVENT_NAMES = {
  59114. // pan
  59115. 'pan': true,
  59116. 'panstart': true,
  59117. 'panmove': true,
  59118. 'panend': true,
  59119. 'pancancel': true,
  59120. 'panleft': true,
  59121. 'panright': true,
  59122. 'panup': true,
  59123. 'pandown': true,
  59124. // pinch
  59125. 'pinch': true,
  59126. 'pinchstart': true,
  59127. 'pinchmove': true,
  59128. 'pinchend': true,
  59129. 'pinchcancel': true,
  59130. 'pinchin': true,
  59131. 'pinchout': true,
  59132. // press
  59133. 'press': true,
  59134. 'pressup': true,
  59135. // rotate
  59136. 'rotate': true,
  59137. 'rotatestart': true,
  59138. 'rotatemove': true,
  59139. 'rotateend': true,
  59140. 'rotatecancel': true,
  59141. // swipe
  59142. 'swipe': true,
  59143. 'swipeleft': true,
  59144. 'swiperight': true,
  59145. 'swipeup': true,
  59146. 'swipedown': true,
  59147. // tap
  59148. 'tap': true,
  59149. };
  59150. /**
  59151. * DI token for providing [HammerJS](http://hammerjs.github.io/) support to Angular.
  59152. * @see `HammerGestureConfig`
  59153. *
  59154. * @experimental
  59155. */
  59156. var HAMMER_GESTURE_CONFIG = new _angular_core__WEBPACK_IMPORTED_MODULE_2__["InjectionToken"]('HammerGestureConfig');
  59157. /** Injection token used to provide a {@link HammerLoader} to Angular. */
  59158. var HAMMER_LOADER = new _angular_core__WEBPACK_IMPORTED_MODULE_2__["InjectionToken"]('HammerLoader');
  59159. /**
  59160. * An injectable [HammerJS Manager](http://hammerjs.github.io/api/#hammer.manager)
  59161. * for gesture recognition. Configures specific event recognition.
  59162. * @experimental
  59163. */
  59164. var HammerGestureConfig = /** @class */ (function () {
  59165. function HammerGestureConfig() {
  59166. /**
  59167. * A set of supported event names for gestures to be used in Angular.
  59168. * Angular supports all built-in recognizers, as listed in
  59169. * [HammerJS documentation](http://hammerjs.github.io/).
  59170. */
  59171. this.events = [];
  59172. /**
  59173. * Maps gesture event names to a set of configuration options
  59174. * that specify overrides to the default values for specific properties.
  59175. *
  59176. * The key is a supported event name to be configured,
  59177. * and the options object contains a set of properties, with override values
  59178. * to be applied to the named recognizer event.
  59179. * For example, to disable recognition of the rotate event, specify
  59180. * `{"rotate": {"enable": false}}`.
  59181. *
  59182. * Properties that are not present take the HammerJS default values.
  59183. * For information about which properties are supported for which events,
  59184. * and their allowed and default values, see
  59185. * [HammerJS documentation](http://hammerjs.github.io/).
  59186. *
  59187. */
  59188. this.overrides = {};
  59189. }
  59190. /**
  59191. * Creates a [HammerJS Manager](http://hammerjs.github.io/api/#hammer.manager)
  59192. * and attaches it to a given HTML element.
  59193. * @param element The element that will recognize gestures.
  59194. * @returns A HammerJS event-manager object.
  59195. */
  59196. HammerGestureConfig.prototype.buildHammer = function (element) {
  59197. var mc = new Hammer(element, this.options);
  59198. mc.get('pinch').set({ enable: true });
  59199. mc.get('rotate').set({ enable: true });
  59200. for (var eventName in this.overrides) {
  59201. mc.get(eventName).set(this.overrides[eventName]);
  59202. }
  59203. return mc;
  59204. };
  59205. HammerGestureConfig = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59206. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])()
  59207. ], HammerGestureConfig);
  59208. return HammerGestureConfig;
  59209. }());
  59210. var HammerGesturesPlugin = /** @class */ (function (_super) {
  59211. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(HammerGesturesPlugin, _super);
  59212. function HammerGesturesPlugin(doc, _config, console, loader) {
  59213. var _this = _super.call(this, doc) || this;
  59214. _this._config = _config;
  59215. _this.console = console;
  59216. _this.loader = loader;
  59217. return _this;
  59218. }
  59219. HammerGesturesPlugin.prototype.supports = function (eventName) {
  59220. if (!EVENT_NAMES.hasOwnProperty(eventName.toLowerCase()) && !this.isCustomEvent(eventName)) {
  59221. return false;
  59222. }
  59223. if (!window.Hammer && !this.loader) {
  59224. this.console.warn("The \"" + eventName + "\" event cannot be bound because Hammer.JS is not " +
  59225. "loaded and no custom loader has been specified.");
  59226. return false;
  59227. }
  59228. return true;
  59229. };
  59230. HammerGesturesPlugin.prototype.addEventListener = function (element, eventName, handler) {
  59231. var _this = this;
  59232. var zone = this.manager.getZone();
  59233. eventName = eventName.toLowerCase();
  59234. // If Hammer is not present but a loader is specified, we defer adding the event listener
  59235. // until Hammer is loaded.
  59236. if (!window.Hammer && this.loader) {
  59237. // This `addEventListener` method returns a function to remove the added listener.
  59238. // Until Hammer is loaded, the returned function needs to *cancel* the registration rather
  59239. // than remove anything.
  59240. var cancelRegistration_1 = false;
  59241. var deregister_1 = function () { cancelRegistration_1 = true; };
  59242. this.loader()
  59243. .then(function () {
  59244. // If Hammer isn't actually loaded when the custom loader resolves, give up.
  59245. if (!window.Hammer) {
  59246. _this.console.warn("The custom HAMMER_LOADER completed, but Hammer.JS is not present.");
  59247. deregister_1 = function () { };
  59248. return;
  59249. }
  59250. if (!cancelRegistration_1) {
  59251. // Now that Hammer is loaded and the listener is being loaded for real,
  59252. // the deregistration function changes from canceling registration to removal.
  59253. deregister_1 = _this.addEventListener(element, eventName, handler);
  59254. }
  59255. })
  59256. .catch(function () {
  59257. _this.console.warn("The \"" + eventName + "\" event cannot be bound because the custom " +
  59258. "Hammer.JS loader failed.");
  59259. deregister_1 = function () { };
  59260. });
  59261. // Return a function that *executes* `deregister` (and not `deregister` itself) so that we
  59262. // can change the behavior of `deregister` once the listener is added. Using a closure in
  59263. // this way allows us to avoid any additional data structures to track listener removal.
  59264. return function () { deregister_1(); };
  59265. }
  59266. return zone.runOutsideAngular(function () {
  59267. // Creating the manager bind events, must be done outside of angular
  59268. var mc = _this._config.buildHammer(element);
  59269. var callback = function (eventObj) {
  59270. zone.runGuarded(function () { handler(eventObj); });
  59271. };
  59272. mc.on(eventName, callback);
  59273. return function () {
  59274. mc.off(eventName, callback);
  59275. // destroy mc to prevent memory leak
  59276. if (typeof mc.destroy === 'function') {
  59277. mc.destroy();
  59278. }
  59279. };
  59280. });
  59281. };
  59282. HammerGesturesPlugin.prototype.isCustomEvent = function (eventName) { return this._config.events.indexOf(eventName) > -1; };
  59283. HammerGesturesPlugin = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59284. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  59285. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  59286. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(HAMMER_GESTURE_CONFIG)),
  59287. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(HAMMER_LOADER)),
  59288. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object, HammerGestureConfig, _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵConsole"], Object])
  59289. ], HammerGesturesPlugin);
  59290. return HammerGesturesPlugin;
  59291. }(EventManagerPlugin));
  59292. /**
  59293. * @license
  59294. * Copyright Google Inc. All Rights Reserved.
  59295. *
  59296. * Use of this source code is governed by an MIT-style license that can be
  59297. * found in the LICENSE file at https://angular.io/license
  59298. */
  59299. /**
  59300. * Defines supported modifiers for key events.
  59301. */
  59302. var MODIFIER_KEYS = ['alt', 'control', 'meta', 'shift'];
  59303. var ɵ0$1 = function (event) { return event.altKey; }, ɵ1$1 = function (event) { return event.ctrlKey; }, ɵ2$1 = function (event) { return event.metaKey; }, ɵ3 = function (event) { return event.shiftKey; };
  59304. /**
  59305. * Retrieves modifiers from key-event objects.
  59306. */
  59307. var MODIFIER_KEY_GETTERS = {
  59308. 'alt': ɵ0$1,
  59309. 'control': ɵ1$1,
  59310. 'meta': ɵ2$1,
  59311. 'shift': ɵ3
  59312. };
  59313. /**
  59314. * @experimental
  59315. * A browser plug-in that provides support for handling of key events in Angular.
  59316. */
  59317. var KeyEventsPlugin = /** @class */ (function (_super) {
  59318. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(KeyEventsPlugin, _super);
  59319. /**
  59320. * Initializes an instance of the browser plug-in.
  59321. * @param doc The document in which key events will be detected.
  59322. */
  59323. function KeyEventsPlugin(doc) {
  59324. return _super.call(this, doc) || this;
  59325. }
  59326. KeyEventsPlugin_1 = KeyEventsPlugin;
  59327. /**
  59328. * Reports whether a named key event is supported.
  59329. * @param eventName The event name to query.
  59330. * @return True if the named key event is supported.
  59331. */
  59332. KeyEventsPlugin.prototype.supports = function (eventName) { return KeyEventsPlugin_1.parseEventName(eventName) != null; };
  59333. /**
  59334. * Registers a handler for a specific element and key event.
  59335. * @param element The HTML element to receive event notifications.
  59336. * @param eventName The name of the key event to listen for.
  59337. * @param handler A function to call when the notification occurs. Receives the
  59338. * event object as an argument.
  59339. * @returns The key event that was registered.
  59340. */
  59341. KeyEventsPlugin.prototype.addEventListener = function (element, eventName, handler) {
  59342. var parsedEvent = KeyEventsPlugin_1.parseEventName(eventName);
  59343. var outsideHandler = KeyEventsPlugin_1.eventCallback(parsedEvent['fullKey'], handler, this.manager.getZone());
  59344. return this.manager.getZone().runOutsideAngular(function () {
  59345. return getDOM().onAndCancel(element, parsedEvent['domEventName'], outsideHandler);
  59346. });
  59347. };
  59348. KeyEventsPlugin.parseEventName = function (eventName) {
  59349. var parts = eventName.toLowerCase().split('.');
  59350. var domEventName = parts.shift();
  59351. if ((parts.length === 0) || !(domEventName === 'keydown' || domEventName === 'keyup')) {
  59352. return null;
  59353. }
  59354. var key = KeyEventsPlugin_1._normalizeKey(parts.pop());
  59355. var fullKey = '';
  59356. MODIFIER_KEYS.forEach(function (modifierName) {
  59357. var index = parts.indexOf(modifierName);
  59358. if (index > -1) {
  59359. parts.splice(index, 1);
  59360. fullKey += modifierName + '.';
  59361. }
  59362. });
  59363. fullKey += key;
  59364. if (parts.length != 0 || key.length === 0) {
  59365. // returning null instead of throwing to let another plugin process the event
  59366. return null;
  59367. }
  59368. var result = {};
  59369. result['domEventName'] = domEventName;
  59370. result['fullKey'] = fullKey;
  59371. return result;
  59372. };
  59373. KeyEventsPlugin.getEventFullKey = function (event) {
  59374. var fullKey = '';
  59375. var key = getDOM().getEventKey(event);
  59376. key = key.toLowerCase();
  59377. if (key === ' ') {
  59378. key = 'space'; // for readability
  59379. }
  59380. else if (key === '.') {
  59381. key = 'dot'; // because '.' is used as a separator in event names
  59382. }
  59383. MODIFIER_KEYS.forEach(function (modifierName) {
  59384. if (modifierName != key) {
  59385. var modifierGetter = MODIFIER_KEY_GETTERS[modifierName];
  59386. if (modifierGetter(event)) {
  59387. fullKey += modifierName + '.';
  59388. }
  59389. }
  59390. });
  59391. fullKey += key;
  59392. return fullKey;
  59393. };
  59394. /**
  59395. * Configures a handler callback for a key event.
  59396. * @param fullKey The event name that combines all simultaneous keystrokes.
  59397. * @param handler The function that responds to the key event.
  59398. * @param zone The zone in which the event occurred.
  59399. * @returns A callback function.
  59400. */
  59401. KeyEventsPlugin.eventCallback = function (fullKey, handler, zone) {
  59402. return function (event /** TODO #9100 */) {
  59403. if (KeyEventsPlugin_1.getEventFullKey(event) === fullKey) {
  59404. zone.runGuarded(function () { return handler(event); });
  59405. }
  59406. };
  59407. };
  59408. /** @internal */
  59409. KeyEventsPlugin._normalizeKey = function (keyName) {
  59410. // TODO: switch to a Map if the mapping grows too much
  59411. switch (keyName) {
  59412. case 'esc':
  59413. return 'escape';
  59414. default:
  59415. return keyName;
  59416. }
  59417. };
  59418. var KeyEventsPlugin_1;
  59419. KeyEventsPlugin = KeyEventsPlugin_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59420. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  59421. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  59422. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  59423. ], KeyEventsPlugin);
  59424. return KeyEventsPlugin;
  59425. }(EventManagerPlugin));
  59426. /**
  59427. * @license
  59428. * Copyright Google Inc. All Rights Reserved.
  59429. *
  59430. * Use of this source code is governed by an MIT-style license that can be
  59431. * found in the LICENSE file at https://angular.io/license
  59432. */
  59433. /**
  59434. * DomSanitizer helps preventing Cross Site Scripting Security bugs (XSS) by sanitizing
  59435. * values to be safe to use in the different DOM contexts.
  59436. *
  59437. * For example, when binding a URL in an `<a [href]="someValue">` hyperlink, `someValue` will be
  59438. * sanitized so that an attacker cannot inject e.g. a `javascript:` URL that would execute code on
  59439. * the website.
  59440. *
  59441. * In specific situations, it might be necessary to disable sanitization, for example if the
  59442. * application genuinely needs to produce a `javascript:` style link with a dynamic value in it.
  59443. * Users can bypass security by constructing a value with one of the `bypassSecurityTrust...`
  59444. * methods, and then binding to that value from the template.
  59445. *
  59446. * These situations should be very rare, and extraordinary care must be taken to avoid creating a
  59447. * Cross Site Scripting (XSS) security bug!
  59448. *
  59449. * When using `bypassSecurityTrust...`, make sure to call the method as early as possible and as
  59450. * close as possible to the source of the value, to make it easy to verify no security bug is
  59451. * created by its use.
  59452. *
  59453. * It is not required (and not recommended) to bypass security if the value is safe, e.g. a URL that
  59454. * does not start with a suspicious protocol, or an HTML snippet that does not contain dangerous
  59455. * code. The sanitizer leaves safe values intact.
  59456. *
  59457. * @security Calling any of the `bypassSecurityTrust...` APIs disables Angular's built-in
  59458. * sanitization for the value passed in. Carefully check and audit all values and code paths going
  59459. * into this call. Make sure any user data is appropriately escaped for this security context.
  59460. * For more detail, see the [Security Guide](http://g.co/ng/security).
  59461. *
  59462. *
  59463. */
  59464. var DomSanitizer = /** @class */ (function () {
  59465. function DomSanitizer() {
  59466. }
  59467. return DomSanitizer;
  59468. }());
  59469. var DomSanitizerImpl = /** @class */ (function (_super) {
  59470. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(DomSanitizerImpl, _super);
  59471. function DomSanitizerImpl(_doc) {
  59472. var _this = _super.call(this) || this;
  59473. _this._doc = _doc;
  59474. return _this;
  59475. }
  59476. DomSanitizerImpl.prototype.sanitize = function (ctx, value) {
  59477. if (value == null)
  59478. return null;
  59479. switch (ctx) {
  59480. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["SecurityContext"].NONE:
  59481. return value;
  59482. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["SecurityContext"].HTML:
  59483. if (value instanceof SafeHtmlImpl)
  59484. return value.changingThisBreaksApplicationSecurity;
  59485. this.checkNotSafeValue(value, 'HTML');
  59486. return Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵ_sanitizeHtml"])(this._doc, String(value));
  59487. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["SecurityContext"].STYLE:
  59488. if (value instanceof SafeStyleImpl)
  59489. return value.changingThisBreaksApplicationSecurity;
  59490. this.checkNotSafeValue(value, 'Style');
  59491. return Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵ_sanitizeStyle"])(value);
  59492. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["SecurityContext"].SCRIPT:
  59493. if (value instanceof SafeScriptImpl)
  59494. return value.changingThisBreaksApplicationSecurity;
  59495. this.checkNotSafeValue(value, 'Script');
  59496. throw new Error('unsafe value used in a script context');
  59497. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["SecurityContext"].URL:
  59498. if (value instanceof SafeResourceUrlImpl || value instanceof SafeUrlImpl) {
  59499. // Allow resource URLs in URL contexts, they are strictly more trusted.
  59500. return value.changingThisBreaksApplicationSecurity;
  59501. }
  59502. this.checkNotSafeValue(value, 'URL');
  59503. return Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵ_sanitizeUrl"])(String(value));
  59504. case _angular_core__WEBPACK_IMPORTED_MODULE_2__["SecurityContext"].RESOURCE_URL:
  59505. if (value instanceof SafeResourceUrlImpl) {
  59506. return value.changingThisBreaksApplicationSecurity;
  59507. }
  59508. this.checkNotSafeValue(value, 'ResourceURL');
  59509. throw new Error('unsafe value used in a resource URL context (see http://g.co/ng/security#xss)');
  59510. default:
  59511. throw new Error("Unexpected SecurityContext " + ctx + " (see http://g.co/ng/security#xss)");
  59512. }
  59513. };
  59514. DomSanitizerImpl.prototype.checkNotSafeValue = function (value, expectedType) {
  59515. if (value instanceof SafeValueImpl) {
  59516. throw new Error("Required a safe " + expectedType + ", got a " + value.getTypeName() + " " +
  59517. "(see http://g.co/ng/security#xss)");
  59518. }
  59519. };
  59520. DomSanitizerImpl.prototype.bypassSecurityTrustHtml = function (value) { return new SafeHtmlImpl(value); };
  59521. DomSanitizerImpl.prototype.bypassSecurityTrustStyle = function (value) { return new SafeStyleImpl(value); };
  59522. DomSanitizerImpl.prototype.bypassSecurityTrustScript = function (value) { return new SafeScriptImpl(value); };
  59523. DomSanitizerImpl.prototype.bypassSecurityTrustUrl = function (value) { return new SafeUrlImpl(value); };
  59524. DomSanitizerImpl.prototype.bypassSecurityTrustResourceUrl = function (value) {
  59525. return new SafeResourceUrlImpl(value);
  59526. };
  59527. DomSanitizerImpl = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59528. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])(),
  59529. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  59530. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  59531. ], DomSanitizerImpl);
  59532. return DomSanitizerImpl;
  59533. }(DomSanitizer));
  59534. var SafeValueImpl = /** @class */ (function () {
  59535. function SafeValueImpl(changingThisBreaksApplicationSecurity) {
  59536. this.changingThisBreaksApplicationSecurity = changingThisBreaksApplicationSecurity;
  59537. // empty
  59538. }
  59539. SafeValueImpl.prototype.toString = function () {
  59540. return "SafeValue must use [property]=binding: " + this.changingThisBreaksApplicationSecurity +
  59541. " (see http://g.co/ng/security#xss)";
  59542. };
  59543. return SafeValueImpl;
  59544. }());
  59545. var SafeHtmlImpl = /** @class */ (function (_super) {
  59546. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafeHtmlImpl, _super);
  59547. function SafeHtmlImpl() {
  59548. return _super !== null && _super.apply(this, arguments) || this;
  59549. }
  59550. SafeHtmlImpl.prototype.getTypeName = function () { return 'HTML'; };
  59551. return SafeHtmlImpl;
  59552. }(SafeValueImpl));
  59553. var SafeStyleImpl = /** @class */ (function (_super) {
  59554. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafeStyleImpl, _super);
  59555. function SafeStyleImpl() {
  59556. return _super !== null && _super.apply(this, arguments) || this;
  59557. }
  59558. SafeStyleImpl.prototype.getTypeName = function () { return 'Style'; };
  59559. return SafeStyleImpl;
  59560. }(SafeValueImpl));
  59561. var SafeScriptImpl = /** @class */ (function (_super) {
  59562. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafeScriptImpl, _super);
  59563. function SafeScriptImpl() {
  59564. return _super !== null && _super.apply(this, arguments) || this;
  59565. }
  59566. SafeScriptImpl.prototype.getTypeName = function () { return 'Script'; };
  59567. return SafeScriptImpl;
  59568. }(SafeValueImpl));
  59569. var SafeUrlImpl = /** @class */ (function (_super) {
  59570. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafeUrlImpl, _super);
  59571. function SafeUrlImpl() {
  59572. return _super !== null && _super.apply(this, arguments) || this;
  59573. }
  59574. SafeUrlImpl.prototype.getTypeName = function () { return 'URL'; };
  59575. return SafeUrlImpl;
  59576. }(SafeValueImpl));
  59577. var SafeResourceUrlImpl = /** @class */ (function (_super) {
  59578. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(SafeResourceUrlImpl, _super);
  59579. function SafeResourceUrlImpl() {
  59580. return _super !== null && _super.apply(this, arguments) || this;
  59581. }
  59582. SafeResourceUrlImpl.prototype.getTypeName = function () { return 'ResourceURL'; };
  59583. return SafeResourceUrlImpl;
  59584. }(SafeValueImpl));
  59585. /**
  59586. * @license
  59587. * Copyright Google Inc. All Rights Reserved.
  59588. *
  59589. * Use of this source code is governed by an MIT-style license that can be
  59590. * found in the LICENSE file at https://angular.io/license
  59591. */
  59592. var INTERNAL_BROWSER_PLATFORM_PROVIDERS = [
  59593. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["PLATFORM_ID"], useValue: _angular_common__WEBPACK_IMPORTED_MODULE_1__["ɵPLATFORM_BROWSER_ID"] },
  59594. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["PLATFORM_INITIALIZER"], useValue: initDomAdapter, multi: true },
  59595. { provide: _angular_common__WEBPACK_IMPORTED_MODULE_1__["PlatformLocation"], useClass: BrowserPlatformLocation, deps: [DOCUMENT$1] },
  59596. { provide: DOCUMENT$1, useFactory: _document, deps: [] },
  59597. ];
  59598. /**
  59599. * @security Replacing built-in sanitization providers exposes the application to XSS risks.
  59600. * Attacker-controlled data introduced by an unsanitized provider could expose your
  59601. * application to XSS risks. For more detail, see the [Security Guide](http://g.co/ng/security).
  59602. * @experimental
  59603. */
  59604. var BROWSER_SANITIZATION_PROVIDERS = [
  59605. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Sanitizer"], useExisting: DomSanitizer },
  59606. { provide: DomSanitizer, useClass: DomSanitizerImpl, deps: [DOCUMENT$1] },
  59607. ];
  59608. var platformBrowser = Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["createPlatformFactory"])(_angular_core__WEBPACK_IMPORTED_MODULE_2__["platformCore"], 'browser', INTERNAL_BROWSER_PLATFORM_PROVIDERS);
  59609. function initDomAdapter() {
  59610. BrowserDomAdapter.makeCurrent();
  59611. BrowserGetTestability.init();
  59612. }
  59613. function errorHandler() {
  59614. return new _angular_core__WEBPACK_IMPORTED_MODULE_2__["ErrorHandler"]();
  59615. }
  59616. function _document() {
  59617. return document;
  59618. }
  59619. var BROWSER_MODULE_PROVIDERS = [
  59620. BROWSER_SANITIZATION_PROVIDERS,
  59621. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵAPP_ROOT"], useValue: true },
  59622. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ErrorHandler"], useFactory: errorHandler, deps: [] },
  59623. {
  59624. provide: EVENT_MANAGER_PLUGINS,
  59625. useClass: DomEventsPlugin,
  59626. multi: true,
  59627. deps: [DOCUMENT$1, _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"], _angular_core__WEBPACK_IMPORTED_MODULE_2__["PLATFORM_ID"]]
  59628. },
  59629. { provide: EVENT_MANAGER_PLUGINS, useClass: KeyEventsPlugin, multi: true, deps: [DOCUMENT$1] },
  59630. {
  59631. provide: EVENT_MANAGER_PLUGINS,
  59632. useClass: HammerGesturesPlugin,
  59633. multi: true,
  59634. deps: [DOCUMENT$1, HAMMER_GESTURE_CONFIG, _angular_core__WEBPACK_IMPORTED_MODULE_2__["ɵConsole"], [new _angular_core__WEBPACK_IMPORTED_MODULE_2__["Optional"](), HAMMER_LOADER]]
  59635. },
  59636. { provide: HAMMER_GESTURE_CONFIG, useClass: HammerGestureConfig, deps: [] },
  59637. {
  59638. provide: DomRendererFactory2,
  59639. useClass: DomRendererFactory2,
  59640. deps: [EventManager, DomSharedStylesHost]
  59641. },
  59642. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["RendererFactory2"], useExisting: DomRendererFactory2 },
  59643. { provide: SharedStylesHost, useExisting: DomSharedStylesHost },
  59644. { provide: DomSharedStylesHost, useClass: DomSharedStylesHost, deps: [DOCUMENT$1] },
  59645. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Testability"], useClass: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Testability"], deps: [_angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"]] },
  59646. { provide: EventManager, useClass: EventManager, deps: [EVENT_MANAGER_PLUGINS, _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgZone"]] },
  59647. ELEMENT_PROBE_PROVIDERS,
  59648. ];
  59649. /**
  59650. * Exports required infrastructure for all Angular apps.
  59651. * Included by defaults in all Angular apps created with the CLI
  59652. * `new` command.
  59653. * Re-exports `CommonModule` and `ApplicationModule`, making their
  59654. * exports and providers available to all apps.
  59655. *
  59656. *
  59657. */
  59658. var BrowserModule = /** @class */ (function () {
  59659. function BrowserModule(parentModule) {
  59660. if (parentModule) {
  59661. 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.");
  59662. }
  59663. }
  59664. BrowserModule_1 = BrowserModule;
  59665. /**
  59666. * Configures a browser-based app to transition from a server-rendered app, if
  59667. * one is present on the page.
  59668. *
  59669. * @param params An object containing an identifier for the app to transition.
  59670. * The ID must match between the client and server versions of the app.
  59671. * @returns The reconfigured `BrowserModule` to import into the app's root `AppModule`.
  59672. *
  59673. * @experimental
  59674. */
  59675. BrowserModule.withServerTransition = function (params) {
  59676. return {
  59677. ngModule: BrowserModule_1,
  59678. providers: [
  59679. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_2__["APP_ID"], useValue: params.appId },
  59680. { provide: TRANSITION_ID, useExisting: _angular_core__WEBPACK_IMPORTED_MODULE_2__["APP_ID"] },
  59681. SERVER_TRANSITION_PROVIDERS,
  59682. ],
  59683. };
  59684. };
  59685. var BrowserModule_1;
  59686. BrowserModule = BrowserModule_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59687. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["NgModule"])({ providers: BROWSER_MODULE_PROVIDERS, exports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"], _angular_core__WEBPACK_IMPORTED_MODULE_2__["ApplicationModule"]] }),
  59688. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["SkipSelf"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(BrowserModule_1)),
  59689. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  59690. ], BrowserModule);
  59691. return BrowserModule;
  59692. }());
  59693. /**
  59694. * Factory to create Meta service.
  59695. */
  59696. function createMeta() {
  59697. return new Meta(Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["inject"])(DOCUMENT$1));
  59698. }
  59699. /**
  59700. * A service that can be used to get and add meta tags.
  59701. *
  59702. * @experimental
  59703. */
  59704. var Meta = /** @class */ (function () {
  59705. function Meta(_doc) {
  59706. this._doc = _doc;
  59707. this._dom = getDOM();
  59708. }
  59709. Meta.prototype.addTag = function (tag, forceCreation) {
  59710. if (forceCreation === void 0) { forceCreation = false; }
  59711. if (!tag)
  59712. return null;
  59713. return this._getOrCreateElement(tag, forceCreation);
  59714. };
  59715. Meta.prototype.addTags = function (tags, forceCreation) {
  59716. var _this = this;
  59717. if (forceCreation === void 0) { forceCreation = false; }
  59718. if (!tags)
  59719. return [];
  59720. return tags.reduce(function (result, tag) {
  59721. if (tag) {
  59722. result.push(_this._getOrCreateElement(tag, forceCreation));
  59723. }
  59724. return result;
  59725. }, []);
  59726. };
  59727. Meta.prototype.getTag = function (attrSelector) {
  59728. if (!attrSelector)
  59729. return null;
  59730. return this._dom.querySelector(this._doc, "meta[" + attrSelector + "]") || null;
  59731. };
  59732. Meta.prototype.getTags = function (attrSelector) {
  59733. if (!attrSelector)
  59734. return [];
  59735. var list /*NodeList*/ = this._dom.querySelectorAll(this._doc, "meta[" + attrSelector + "]");
  59736. return list ? [].slice.call(list) : [];
  59737. };
  59738. Meta.prototype.updateTag = function (tag, selector) {
  59739. if (!tag)
  59740. return null;
  59741. selector = selector || this._parseSelector(tag);
  59742. var meta = this.getTag(selector);
  59743. if (meta) {
  59744. return this._setMetaElementAttributes(tag, meta);
  59745. }
  59746. return this._getOrCreateElement(tag, true);
  59747. };
  59748. Meta.prototype.removeTag = function (attrSelector) { this.removeTagElement(this.getTag(attrSelector)); };
  59749. Meta.prototype.removeTagElement = function (meta) {
  59750. if (meta) {
  59751. this._dom.remove(meta);
  59752. }
  59753. };
  59754. Meta.prototype._getOrCreateElement = function (meta, forceCreation) {
  59755. if (forceCreation === void 0) { forceCreation = false; }
  59756. if (!forceCreation) {
  59757. var selector = this._parseSelector(meta);
  59758. var elem = this.getTag(selector);
  59759. // It's allowed to have multiple elements with the same name so it's not enough to
  59760. // just check that element with the same name already present on the page. We also need to
  59761. // check if element has tag attributes
  59762. if (elem && this._containsAttributes(meta, elem))
  59763. return elem;
  59764. }
  59765. var element = this._dom.createElement('meta');
  59766. this._setMetaElementAttributes(meta, element);
  59767. var head = this._dom.getElementsByTagName(this._doc, 'head')[0];
  59768. this._dom.appendChild(head, element);
  59769. return element;
  59770. };
  59771. Meta.prototype._setMetaElementAttributes = function (tag, el) {
  59772. var _this = this;
  59773. Object.keys(tag).forEach(function (prop) { return _this._dom.setAttribute(el, prop, tag[prop]); });
  59774. return el;
  59775. };
  59776. Meta.prototype._parseSelector = function (tag) {
  59777. var attr = tag.name ? 'name' : 'property';
  59778. return attr + "=\"" + tag[attr] + "\"";
  59779. };
  59780. Meta.prototype._containsAttributes = function (tag, elem) {
  59781. var _this = this;
  59782. return Object.keys(tag).every(function (key) { return _this._dom.getAttribute(elem, key) === tag[key]; });
  59783. };
  59784. Meta.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["defineInjectable"])({ factory: createMeta, token: Meta, providedIn: "root" });
  59785. Meta = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59786. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])({ providedIn: 'root', useFactory: createMeta, deps: [] }),
  59787. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  59788. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  59789. ], Meta);
  59790. return Meta;
  59791. }());
  59792. /**
  59793. * Factory to create Title service.
  59794. */
  59795. function createTitle() {
  59796. return new Title(Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["inject"])(DOCUMENT$1));
  59797. }
  59798. /**
  59799. * A service that can be used to get and set the title of a current HTML document.
  59800. *
  59801. * Since an Angular application can't be bootstrapped on the entire HTML document (`<html>` tag)
  59802. * it is not possible to bind to the `text` property of the `HTMLTitleElement` elements
  59803. * (representing the `<title>` tag). Instead, this service can be used to set and get the current
  59804. * title value.
  59805. *
  59806. * @experimental
  59807. */
  59808. var Title = /** @class */ (function () {
  59809. function Title(_doc) {
  59810. this._doc = _doc;
  59811. }
  59812. /**
  59813. * Get the title of the current HTML document.
  59814. */
  59815. Title.prototype.getTitle = function () { return getDOM().getTitle(this._doc); };
  59816. /**
  59817. * Set the title of the current HTML document.
  59818. * @param newTitle
  59819. */
  59820. Title.prototype.setTitle = function (newTitle) { getDOM().setTitle(this._doc, newTitle); };
  59821. Title.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["defineInjectable"])({ factory: createTitle, token: Title, providedIn: "root" });
  59822. Title = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  59823. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])({ providedIn: 'root', useFactory: createTitle, deps: [] }),
  59824. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Inject"])(DOCUMENT$1)),
  59825. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  59826. ], Title);
  59827. return Title;
  59828. }());
  59829. /**
  59830. * @license
  59831. * Copyright Google Inc. All Rights Reserved.
  59832. *
  59833. * Use of this source code is governed by an MIT-style license that can be
  59834. * found in the LICENSE file at https://angular.io/license
  59835. */
  59836. var win = typeof window !== 'undefined' && window || {};
  59837. /**
  59838. * @license
  59839. * Copyright Google Inc. All Rights Reserved.
  59840. *
  59841. * Use of this source code is governed by an MIT-style license that can be
  59842. * found in the LICENSE file at https://angular.io/license
  59843. */
  59844. var ChangeDetectionPerfRecord = /** @class */ (function () {
  59845. function ChangeDetectionPerfRecord(msPerTick, numTicks) {
  59846. this.msPerTick = msPerTick;
  59847. this.numTicks = numTicks;
  59848. }
  59849. return ChangeDetectionPerfRecord;
  59850. }());
  59851. /**
  59852. * Entry point for all Angular profiling-related debug tools. This object
  59853. * corresponds to the `ng.profiler` in the dev console.
  59854. */
  59855. var AngularProfiler = /** @class */ (function () {
  59856. function AngularProfiler(ref) {
  59857. this.appRef = ref.injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_2__["ApplicationRef"]);
  59858. }
  59859. // tslint:disable:no-console
  59860. /**
  59861. * Exercises change detection in a loop and then prints the average amount of
  59862. * time in milliseconds how long a single round of change detection takes for
  59863. * the current state of the UI. It runs a minimum of 5 rounds for a minimum
  59864. * of 500 milliseconds.
  59865. *
  59866. * Optionally, a user may pass a `config` parameter containing a map of
  59867. * options. Supported options are:
  59868. *
  59869. * `record` (boolean) - causes the profiler to record a CPU profile while
  59870. * it exercises the change detector. Example:
  59871. *
  59872. * ```
  59873. * ng.profiler.timeChangeDetection({record: true})
  59874. * ```
  59875. */
  59876. AngularProfiler.prototype.timeChangeDetection = function (config) {
  59877. var record = config && config['record'];
  59878. var profileName = 'Change Detection';
  59879. // Profiler is not available in Android browsers, nor in IE 9 without dev tools opened
  59880. var isProfilerAvailable = win.console.profile != null;
  59881. if (record && isProfilerAvailable) {
  59882. win.console.profile(profileName);
  59883. }
  59884. var start = getDOM().performanceNow();
  59885. var numTicks = 0;
  59886. while (numTicks < 5 || (getDOM().performanceNow() - start) < 500) {
  59887. this.appRef.tick();
  59888. numTicks++;
  59889. }
  59890. var end = getDOM().performanceNow();
  59891. if (record && isProfilerAvailable) {
  59892. // need to cast to <any> because type checker thinks there's no argument
  59893. // while in fact there is:
  59894. //
  59895. // https://developer.mozilla.org/en-US/docs/Web/API/Console/profileEnd
  59896. win.console.profileEnd(profileName);
  59897. }
  59898. var msPerTick = (end - start) / numTicks;
  59899. win.console.log("ran " + numTicks + " change detection cycles");
  59900. win.console.log(msPerTick.toFixed(2) + " ms per check");
  59901. return new ChangeDetectionPerfRecord(msPerTick, numTicks);
  59902. };
  59903. return AngularProfiler;
  59904. }());
  59905. /**
  59906. * @license
  59907. * Copyright Google Inc. All Rights Reserved.
  59908. *
  59909. * Use of this source code is governed by an MIT-style license that can be
  59910. * found in the LICENSE file at https://angular.io/license
  59911. */
  59912. var PROFILER_GLOBAL_NAME = 'profiler';
  59913. /**
  59914. * Enabled Angular debug tools that are accessible via your browser's
  59915. * developer console.
  59916. *
  59917. * Usage:
  59918. *
  59919. * 1. Open developer console (e.g. in Chrome Ctrl + Shift + j)
  59920. * 1. Type `ng.` (usually the console will show auto-complete suggestion)
  59921. * 1. Try the change detection profiler `ng.profiler.timeChangeDetection()`
  59922. * then hit Enter.
  59923. *
  59924. * @experimental All debugging apis are currently experimental.
  59925. */
  59926. function enableDebugTools(ref) {
  59927. exportNgVar(PROFILER_GLOBAL_NAME, new AngularProfiler(ref));
  59928. return ref;
  59929. }
  59930. /**
  59931. * Disables Angular tools.
  59932. *
  59933. * @experimental All debugging apis are currently experimental.
  59934. */
  59935. function disableDebugTools() {
  59936. exportNgVar(PROFILER_GLOBAL_NAME, null);
  59937. }
  59938. /**
  59939. * @license
  59940. * Copyright Google Inc. All Rights Reserved.
  59941. *
  59942. * Use of this source code is governed by an MIT-style license that can be
  59943. * found in the LICENSE file at https://angular.io/license
  59944. */
  59945. function escapeHtml(text) {
  59946. var escapedText = {
  59947. '&': '&a;',
  59948. '"': '&q;',
  59949. '\'': '&s;',
  59950. '<': '&l;',
  59951. '>': '&g;',
  59952. };
  59953. return text.replace(/[&"'<>]/g, function (s) { return escapedText[s]; });
  59954. }
  59955. function unescapeHtml(text) {
  59956. var unescapedText = {
  59957. '&a;': '&',
  59958. '&q;': '"',
  59959. '&s;': '\'',
  59960. '&l;': '<',
  59961. '&g;': '>',
  59962. };
  59963. return text.replace(/&[^;]+;/g, function (s) { return unescapedText[s]; });
  59964. }
  59965. /**
  59966. * Create a `StateKey<T>` that can be used to store value of type T with `TransferState`.
  59967. *
  59968. * Example:
  59969. *
  59970. * ```
  59971. * const COUNTER_KEY = makeStateKey<number>('counter');
  59972. * let value = 10;
  59973. *
  59974. * transferState.set(COUNTER_KEY, value);
  59975. * ```
  59976. *
  59977. * @experimental
  59978. */
  59979. function makeStateKey(key) {
  59980. return key;
  59981. }
  59982. /**
  59983. * A key value store that is transferred from the application on the server side to the application
  59984. * on the client side.
  59985. *
  59986. * `TransferState` will be available as an injectable token. To use it import
  59987. * `ServerTransferStateModule` on the server and `BrowserTransferStateModule` on the client.
  59988. *
  59989. * The values in the store are serialized/deserialized using JSON.stringify/JSON.parse. So only
  59990. * boolean, number, string, null and non-class objects will be serialized and deserialzied in a
  59991. * non-lossy manner.
  59992. *
  59993. * @experimental
  59994. */
  59995. var TransferState = /** @class */ (function () {
  59996. function TransferState() {
  59997. this.store = {};
  59998. this.onSerializeCallbacks = {};
  59999. }
  60000. TransferState_1 = TransferState;
  60001. /** @internal */
  60002. TransferState.init = function (initState) {
  60003. var transferState = new TransferState_1();
  60004. transferState.store = initState;
  60005. return transferState;
  60006. };
  60007. /**
  60008. * Get the value corresponding to a key. Return `defaultValue` if key is not found.
  60009. */
  60010. TransferState.prototype.get = function (key, defaultValue) {
  60011. return this.store[key] !== undefined ? this.store[key] : defaultValue;
  60012. };
  60013. /**
  60014. * Set the value corresponding to a key.
  60015. */
  60016. TransferState.prototype.set = function (key, value) { this.store[key] = value; };
  60017. /**
  60018. * Remove a key from the store.
  60019. */
  60020. TransferState.prototype.remove = function (key) { delete this.store[key]; };
  60021. /**
  60022. * Test whether a key exists in the store.
  60023. */
  60024. TransferState.prototype.hasKey = function (key) { return this.store.hasOwnProperty(key); };
  60025. /**
  60026. * Register a callback to provide the value for a key when `toJson` is called.
  60027. */
  60028. TransferState.prototype.onSerialize = function (key, callback) {
  60029. this.onSerializeCallbacks[key] = callback;
  60030. };
  60031. /**
  60032. * Serialize the current state of the store to JSON.
  60033. */
  60034. TransferState.prototype.toJson = function () {
  60035. // Call the onSerialize callbacks and put those values into the store.
  60036. for (var key in this.onSerializeCallbacks) {
  60037. if (this.onSerializeCallbacks.hasOwnProperty(key)) {
  60038. try {
  60039. this.store[key] = this.onSerializeCallbacks[key]();
  60040. }
  60041. catch (e) {
  60042. console.warn('Exception in onSerialize callback: ', e);
  60043. }
  60044. }
  60045. }
  60046. return JSON.stringify(this.store);
  60047. };
  60048. var TransferState_1;
  60049. TransferState = TransferState_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  60050. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"])()
  60051. ], TransferState);
  60052. return TransferState;
  60053. }());
  60054. function initTransferState(doc, appId) {
  60055. // Locate the script tag with the JSON data transferred from the server.
  60056. // The id of the script tag is set to the Angular appId + 'state'.
  60057. var script = doc.getElementById(appId + '-state');
  60058. var initialState = {};
  60059. if (script && script.textContent) {
  60060. try {
  60061. initialState = JSON.parse(unescapeHtml(script.textContent));
  60062. }
  60063. catch (e) {
  60064. console.warn('Exception while restoring TransferState for app ' + appId, e);
  60065. }
  60066. }
  60067. return TransferState.init(initialState);
  60068. }
  60069. /**
  60070. * NgModule to install on the client side while using the `TransferState` to transfer state from
  60071. * server to client.
  60072. *
  60073. * @experimental
  60074. */
  60075. var BrowserTransferStateModule = /** @class */ (function () {
  60076. function BrowserTransferStateModule() {
  60077. }
  60078. BrowserTransferStateModule = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  60079. Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["NgModule"])({
  60080. providers: [{ provide: TransferState, useFactory: initTransferState, deps: [DOCUMENT$1, _angular_core__WEBPACK_IMPORTED_MODULE_2__["APP_ID"]] }],
  60081. })
  60082. ], BrowserTransferStateModule);
  60083. return BrowserTransferStateModule;
  60084. }());
  60085. /**
  60086. * @license
  60087. * Copyright Google Inc. All Rights Reserved.
  60088. *
  60089. * Use of this source code is governed by an MIT-style license that can be
  60090. * found in the LICENSE file at https://angular.io/license
  60091. */
  60092. /**
  60093. * Predicates for use with {@link DebugElement}'s query functions.
  60094. *
  60095. * @experimental All debugging apis are currently experimental.
  60096. */
  60097. var By = /** @class */ (function () {
  60098. function By() {
  60099. }
  60100. /**
  60101. * Match all elements.
  60102. *
  60103. * @usageNotes
  60104. * ### Example
  60105. *
  60106. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_all'}
  60107. */
  60108. By.all = function () { return function (debugElement) { return true; }; };
  60109. /**
  60110. * Match elements by the given CSS selector.
  60111. *
  60112. * @usageNotes
  60113. * ### Example
  60114. *
  60115. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_css'}
  60116. */
  60117. By.css = function (selector) {
  60118. return function (debugElement) {
  60119. return debugElement.nativeElement != null ?
  60120. getDOM().elementMatches(debugElement.nativeElement, selector) :
  60121. false;
  60122. };
  60123. };
  60124. /**
  60125. * Match elements that have the given directive present.
  60126. *
  60127. * @usageNotes
  60128. * ### Example
  60129. *
  60130. * {@example platform-browser/dom/debug/ts/by/by.ts region='by_directive'}
  60131. */
  60132. By.directive = function (type) {
  60133. return function (debugElement) { return debugElement.providerTokens.indexOf(type) !== -1; };
  60134. };
  60135. return By;
  60136. }());
  60137. /**
  60138. * @license
  60139. * Copyright Google Inc. All Rights Reserved.
  60140. *
  60141. * Use of this source code is governed by an MIT-style license that can be
  60142. * found in the LICENSE file at https://angular.io/license
  60143. */
  60144. /**
  60145. * @license
  60146. * Copyright Google Inc. All Rights Reserved.
  60147. *
  60148. * Use of this source code is governed by an MIT-style license that can be
  60149. * found in the LICENSE file at https://angular.io/license
  60150. */
  60151. var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_2__["Version"]('6.1.10');
  60152. /**
  60153. * @license
  60154. * Copyright Google Inc. All Rights Reserved.
  60155. *
  60156. * Use of this source code is governed by an MIT-style license that can be
  60157. * found in the LICENSE file at https://angular.io/license
  60158. */
  60159. /**
  60160. * @license
  60161. * Copyright Google Inc. All Rights Reserved.
  60162. *
  60163. * Use of this source code is governed by an MIT-style license that can be
  60164. * found in the LICENSE file at https://angular.io/license
  60165. */
  60166. // This file only reexports content of the `src` folder. Keep it that way.
  60167. /**
  60168. * @license
  60169. * Copyright Google Inc. All Rights Reserved.
  60170. *
  60171. * Use of this source code is governed by an MIT-style license that can be
  60172. * found in the LICENSE file at https://angular.io/license
  60173. */
  60174. /**
  60175. * Generated bundle index. Do not edit.
  60176. */
  60177. //# sourceMappingURL=platform-browser.js.map
  60178. /***/ }),
  60179. /***/ "./node_modules/@angular/router/fesm5/router.js":
  60180. /*!******************************************************!*\
  60181. !*** ./node_modules/@angular/router/fesm5/router.js ***!
  60182. \******************************************************/
  60183. /*! exports provided: ɵangular_packages_router_router_a, ɵangular_packages_router_router_h, ɵangular_packages_router_router_c, ɵangular_packages_router_router_i, ɵangular_packages_router_router_j, ɵangular_packages_router_router_e, ɵangular_packages_router_router_d, ɵangular_packages_router_router_k, ɵangular_packages_router_router_g, ɵangular_packages_router_router_b, ɵangular_packages_router_router_f, ɵangular_packages_router_router_n, ɵangular_packages_router_router_l, ɵangular_packages_router_router_m, RouterLink, RouterLinkWithHref, RouterLinkActive, RouterOutlet, ActivationEnd, ActivationStart, ChildActivationEnd, ChildActivationStart, GuardsCheckEnd, GuardsCheckStart, NavigationCancel, NavigationEnd, NavigationError, NavigationStart, ResolveEnd, ResolveStart, RouteConfigLoadEnd, RouteConfigLoadStart, RouterEvent, RoutesRecognized, Scroll, RouteReuseStrategy, Router, ROUTES, ROUTER_CONFIGURATION, ROUTER_INITIALIZER, RouterModule, provideRoutes, ChildrenOutletContexts, OutletContext, NoPreloading, PreloadAllModules, PreloadingStrategy, RouterPreloader, ActivatedRoute, ActivatedRouteSnapshot, RouterState, RouterStateSnapshot, PRIMARY_OUTLET, convertToParamMap, UrlHandlingStrategy, DefaultUrlSerializer, UrlSegment, UrlSegmentGroup, UrlSerializer, UrlTree, VERSION, ɵEmptyOutletComponent, ɵROUTER_PROVIDERS, ɵflatten */
  60184. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  60185. "use strict";
  60186. __webpack_require__.r(__webpack_exports__);
  60187. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_a", function() { return ROUTER_FORROOT_GUARD; });
  60188. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_h", function() { return RouterInitializer; });
  60189. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_c", function() { return createRouterScroller; });
  60190. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_i", function() { return getAppInitializer; });
  60191. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_j", function() { return getBootstrapListener; });
  60192. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_e", function() { return provideForRootGuard; });
  60193. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_d", function() { return provideLocationStrategy; });
  60194. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_k", function() { return provideRouterInitializer; });
  60195. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_g", function() { return rootRoute; });
  60196. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_b", function() { return routerNgProbeToken; });
  60197. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_f", function() { return setupRouter; });
  60198. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_n", function() { return RouterScroller; });
  60199. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_l", function() { return Tree; });
  60200. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵangular_packages_router_router_m", function() { return TreeNode; });
  60201. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterLink", function() { return RouterLink; });
  60202. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterLinkWithHref", function() { return RouterLinkWithHref; });
  60203. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterLinkActive", function() { return RouterLinkActive; });
  60204. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterOutlet", function() { return RouterOutlet; });
  60205. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivationEnd", function() { return ActivationEnd; });
  60206. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivationStart", function() { return ActivationStart; });
  60207. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChildActivationEnd", function() { return ChildActivationEnd; });
  60208. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChildActivationStart", function() { return ChildActivationStart; });
  60209. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuardsCheckEnd", function() { return GuardsCheckEnd; });
  60210. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GuardsCheckStart", function() { return GuardsCheckStart; });
  60211. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationCancel", function() { return NavigationCancel; });
  60212. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationEnd", function() { return NavigationEnd; });
  60213. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationError", function() { return NavigationError; });
  60214. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NavigationStart", function() { return NavigationStart; });
  60215. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolveEnd", function() { return ResolveEnd; });
  60216. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ResolveStart", function() { return ResolveStart; });
  60217. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteConfigLoadEnd", function() { return RouteConfigLoadEnd; });
  60218. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteConfigLoadStart", function() { return RouteConfigLoadStart; });
  60219. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterEvent", function() { return RouterEvent; });
  60220. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RoutesRecognized", function() { return RoutesRecognized; });
  60221. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Scroll", function() { return Scroll; });
  60222. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouteReuseStrategy", function() { return RouteReuseStrategy; });
  60223. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Router", function() { return Router; });
  60224. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ROUTES", function() { return ROUTES; });
  60225. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ROUTER_CONFIGURATION", function() { return ROUTER_CONFIGURATION; });
  60226. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ROUTER_INITIALIZER", function() { return ROUTER_INITIALIZER; });
  60227. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterModule", function() { return RouterModule; });
  60228. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "provideRoutes", function() { return provideRoutes; });
  60229. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ChildrenOutletContexts", function() { return ChildrenOutletContexts; });
  60230. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OutletContext", function() { return OutletContext; });
  60231. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NoPreloading", function() { return NoPreloading; });
  60232. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PreloadAllModules", function() { return PreloadAllModules; });
  60233. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PreloadingStrategy", function() { return PreloadingStrategy; });
  60234. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterPreloader", function() { return RouterPreloader; });
  60235. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivatedRoute", function() { return ActivatedRoute; });
  60236. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ActivatedRouteSnapshot", function() { return ActivatedRouteSnapshot; });
  60237. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterState", function() { return RouterState; });
  60238. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RouterStateSnapshot", function() { return RouterStateSnapshot; });
  60239. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PRIMARY_OUTLET", function() { return PRIMARY_OUTLET; });
  60240. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "convertToParamMap", function() { return convertToParamMap; });
  60241. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlHandlingStrategy", function() { return UrlHandlingStrategy; });
  60242. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DefaultUrlSerializer", function() { return DefaultUrlSerializer; });
  60243. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlSegment", function() { return UrlSegment; });
  60244. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlSegmentGroup", function() { return UrlSegmentGroup; });
  60245. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlSerializer", function() { return UrlSerializer; });
  60246. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UrlTree", function() { return UrlTree; });
  60247. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VERSION", function() { return VERSION; });
  60248. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵEmptyOutletComponent", function() { return EmptyOutletComponent; });
  60249. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵROUTER_PROVIDERS", function() { return ROUTER_PROVIDERS; });
  60250. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵflatten", function() { return flatten; });
  60251. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  60252. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  60253. /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  60254. /* harmony import */ var rxjs_operators__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! rxjs/operators */ "./node_modules/rxjs/_esm5/operators/index.js");
  60255. /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js");
  60256. /* harmony import */ var _angular_platform_browser__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! @angular/platform-browser */ "./node_modules/@angular/platform-browser/fesm5/platform-browser.js");
  60257. /**
  60258. * @license Angular v6.1.10
  60259. * (c) 2010-2018 Google, Inc. https://angular.io/
  60260. * License: MIT
  60261. */
  60262. /**
  60263. * @license
  60264. * Copyright Google Inc. All Rights Reserved.
  60265. *
  60266. * Use of this source code is governed by an MIT-style license that can be
  60267. * found in the LICENSE file at https://angular.io/license
  60268. */
  60269. /**
  60270. * @description
  60271. *
  60272. * Base for events the Router goes through, as opposed to events tied to a specific
  60273. * Route. `RouterEvent`s will only be fired one time for any given navigation.
  60274. *
  60275. * Example:
  60276. *
  60277. * ```
  60278. * class MyService {
  60279. * constructor(public router: Router, logger: Logger) {
  60280. * router.events.filter(e => e instanceof RouterEvent).subscribe(e => {
  60281. * logger.log(e.id, e.url);
  60282. * });
  60283. * }
  60284. * }
  60285. * ```
  60286. *
  60287. * @experimental
  60288. */
  60289. var RouterEvent = /** @class */ (function () {
  60290. function RouterEvent(
  60291. /** @docsNotRequired */
  60292. id,
  60293. /** @docsNotRequired */
  60294. url) {
  60295. this.id = id;
  60296. this.url = url;
  60297. }
  60298. return RouterEvent;
  60299. }());
  60300. /**
  60301. * @description
  60302. *
  60303. * Represents an event triggered when a navigation starts.
  60304. *
  60305. *
  60306. */
  60307. var NavigationStart = /** @class */ (function (_super) {
  60308. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NavigationStart, _super);
  60309. function NavigationStart(
  60310. /** @docsNotRequired */
  60311. id,
  60312. /** @docsNotRequired */
  60313. url,
  60314. /** @docsNotRequired */
  60315. navigationTrigger,
  60316. /** @docsNotRequired */
  60317. restoredState) {
  60318. if (navigationTrigger === void 0) {
  60319. /** @docsNotRequired */
  60320. navigationTrigger = 'imperative'; }
  60321. if (restoredState === void 0) {
  60322. /** @docsNotRequired */
  60323. restoredState = null; }
  60324. var _this = _super.call(this, id, url) || this;
  60325. _this.navigationTrigger = navigationTrigger;
  60326. _this.restoredState = restoredState;
  60327. return _this;
  60328. }
  60329. /** @docsNotRequired */
  60330. NavigationStart.prototype.toString = function () { return "NavigationStart(id: " + this.id + ", url: '" + this.url + "')"; };
  60331. return NavigationStart;
  60332. }(RouterEvent));
  60333. /**
  60334. * @description
  60335. *
  60336. * Represents an event triggered when a navigation ends successfully.
  60337. *
  60338. *
  60339. */
  60340. var NavigationEnd = /** @class */ (function (_super) {
  60341. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NavigationEnd, _super);
  60342. function NavigationEnd(
  60343. /** @docsNotRequired */
  60344. id,
  60345. /** @docsNotRequired */
  60346. url,
  60347. /** @docsNotRequired */
  60348. urlAfterRedirects) {
  60349. var _this = _super.call(this, id, url) || this;
  60350. _this.urlAfterRedirects = urlAfterRedirects;
  60351. return _this;
  60352. }
  60353. /** @docsNotRequired */
  60354. NavigationEnd.prototype.toString = function () {
  60355. return "NavigationEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "')";
  60356. };
  60357. return NavigationEnd;
  60358. }(RouterEvent));
  60359. /**
  60360. * @description
  60361. *
  60362. * Represents an event triggered when a navigation is canceled.
  60363. *
  60364. *
  60365. */
  60366. var NavigationCancel = /** @class */ (function (_super) {
  60367. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NavigationCancel, _super);
  60368. function NavigationCancel(
  60369. /** @docsNotRequired */
  60370. id,
  60371. /** @docsNotRequired */
  60372. url,
  60373. /** @docsNotRequired */
  60374. reason) {
  60375. var _this = _super.call(this, id, url) || this;
  60376. _this.reason = reason;
  60377. return _this;
  60378. }
  60379. /** @docsNotRequired */
  60380. NavigationCancel.prototype.toString = function () { return "NavigationCancel(id: " + this.id + ", url: '" + this.url + "')"; };
  60381. return NavigationCancel;
  60382. }(RouterEvent));
  60383. /**
  60384. * @description
  60385. *
  60386. * Represents an event triggered when a navigation fails due to an unexpected error.
  60387. *
  60388. *
  60389. */
  60390. var NavigationError = /** @class */ (function (_super) {
  60391. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(NavigationError, _super);
  60392. function NavigationError(
  60393. /** @docsNotRequired */
  60394. id,
  60395. /** @docsNotRequired */
  60396. url,
  60397. /** @docsNotRequired */
  60398. error) {
  60399. var _this = _super.call(this, id, url) || this;
  60400. _this.error = error;
  60401. return _this;
  60402. }
  60403. /** @docsNotRequired */
  60404. NavigationError.prototype.toString = function () {
  60405. return "NavigationError(id: " + this.id + ", url: '" + this.url + "', error: " + this.error + ")";
  60406. };
  60407. return NavigationError;
  60408. }(RouterEvent));
  60409. /**
  60410. * @description
  60411. *
  60412. * Represents an event triggered when routes are recognized.
  60413. *
  60414. *
  60415. */
  60416. var RoutesRecognized = /** @class */ (function (_super) {
  60417. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(RoutesRecognized, _super);
  60418. function RoutesRecognized(
  60419. /** @docsNotRequired */
  60420. id,
  60421. /** @docsNotRequired */
  60422. url,
  60423. /** @docsNotRequired */
  60424. urlAfterRedirects,
  60425. /** @docsNotRequired */
  60426. state) {
  60427. var _this = _super.call(this, id, url) || this;
  60428. _this.urlAfterRedirects = urlAfterRedirects;
  60429. _this.state = state;
  60430. return _this;
  60431. }
  60432. /** @docsNotRequired */
  60433. RoutesRecognized.prototype.toString = function () {
  60434. return "RoutesRecognized(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
  60435. };
  60436. return RoutesRecognized;
  60437. }(RouterEvent));
  60438. /**
  60439. * @description
  60440. *
  60441. * Represents the start of the Guard phase of routing.
  60442. *
  60443. * @experimental
  60444. */
  60445. var GuardsCheckStart = /** @class */ (function (_super) {
  60446. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GuardsCheckStart, _super);
  60447. function GuardsCheckStart(
  60448. /** @docsNotRequired */
  60449. id,
  60450. /** @docsNotRequired */
  60451. url,
  60452. /** @docsNotRequired */
  60453. urlAfterRedirects,
  60454. /** @docsNotRequired */
  60455. state) {
  60456. var _this = _super.call(this, id, url) || this;
  60457. _this.urlAfterRedirects = urlAfterRedirects;
  60458. _this.state = state;
  60459. return _this;
  60460. }
  60461. GuardsCheckStart.prototype.toString = function () {
  60462. return "GuardsCheckStart(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
  60463. };
  60464. return GuardsCheckStart;
  60465. }(RouterEvent));
  60466. /**
  60467. * @description
  60468. *
  60469. * Represents the end of the Guard phase of routing.
  60470. *
  60471. * @experimental
  60472. */
  60473. var GuardsCheckEnd = /** @class */ (function (_super) {
  60474. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(GuardsCheckEnd, _super);
  60475. function GuardsCheckEnd(
  60476. /** @docsNotRequired */
  60477. id,
  60478. /** @docsNotRequired */
  60479. url,
  60480. /** @docsNotRequired */
  60481. urlAfterRedirects,
  60482. /** @docsNotRequired */
  60483. state,
  60484. /** @docsNotRequired */
  60485. shouldActivate) {
  60486. var _this = _super.call(this, id, url) || this;
  60487. _this.urlAfterRedirects = urlAfterRedirects;
  60488. _this.state = state;
  60489. _this.shouldActivate = shouldActivate;
  60490. return _this;
  60491. }
  60492. GuardsCheckEnd.prototype.toString = function () {
  60493. return "GuardsCheckEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ", shouldActivate: " + this.shouldActivate + ")";
  60494. };
  60495. return GuardsCheckEnd;
  60496. }(RouterEvent));
  60497. /**
  60498. * @description
  60499. *
  60500. * Represents the start of the Resolve phase of routing. The timing of this
  60501. * event may change, thus it's experimental. In the current iteration it will run
  60502. * in the "resolve" phase whether there's things to resolve or not. In the future this
  60503. * behavior may change to only run when there are things to be resolved.
  60504. *
  60505. * @experimental
  60506. */
  60507. var ResolveStart = /** @class */ (function (_super) {
  60508. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ResolveStart, _super);
  60509. function ResolveStart(
  60510. /** @docsNotRequired */
  60511. id,
  60512. /** @docsNotRequired */
  60513. url,
  60514. /** @docsNotRequired */
  60515. urlAfterRedirects,
  60516. /** @docsNotRequired */
  60517. state) {
  60518. var _this = _super.call(this, id, url) || this;
  60519. _this.urlAfterRedirects = urlAfterRedirects;
  60520. _this.state = state;
  60521. return _this;
  60522. }
  60523. ResolveStart.prototype.toString = function () {
  60524. return "ResolveStart(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
  60525. };
  60526. return ResolveStart;
  60527. }(RouterEvent));
  60528. /**
  60529. * @description
  60530. *
  60531. * Represents the end of the Resolve phase of routing. See note on
  60532. * `ResolveStart` for use of this experimental API.
  60533. *
  60534. * @experimental
  60535. */
  60536. var ResolveEnd = /** @class */ (function (_super) {
  60537. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(ResolveEnd, _super);
  60538. function ResolveEnd(
  60539. /** @docsNotRequired */
  60540. id,
  60541. /** @docsNotRequired */
  60542. url,
  60543. /** @docsNotRequired */
  60544. urlAfterRedirects,
  60545. /** @docsNotRequired */
  60546. state) {
  60547. var _this = _super.call(this, id, url) || this;
  60548. _this.urlAfterRedirects = urlAfterRedirects;
  60549. _this.state = state;
  60550. return _this;
  60551. }
  60552. ResolveEnd.prototype.toString = function () {
  60553. return "ResolveEnd(id: " + this.id + ", url: '" + this.url + "', urlAfterRedirects: '" + this.urlAfterRedirects + "', state: " + this.state + ")";
  60554. };
  60555. return ResolveEnd;
  60556. }(RouterEvent));
  60557. /**
  60558. * @description
  60559. *
  60560. * Represents an event triggered before lazy loading a route config.
  60561. *
  60562. * @experimental
  60563. */
  60564. var RouteConfigLoadStart = /** @class */ (function () {
  60565. function RouteConfigLoadStart(
  60566. /** @docsNotRequired */
  60567. route) {
  60568. this.route = route;
  60569. }
  60570. RouteConfigLoadStart.prototype.toString = function () { return "RouteConfigLoadStart(path: " + this.route.path + ")"; };
  60571. return RouteConfigLoadStart;
  60572. }());
  60573. /**
  60574. * @description
  60575. *
  60576. * Represents an event triggered when a route has been lazy loaded.
  60577. *
  60578. * @experimental
  60579. */
  60580. var RouteConfigLoadEnd = /** @class */ (function () {
  60581. function RouteConfigLoadEnd(
  60582. /** @docsNotRequired */
  60583. route) {
  60584. this.route = route;
  60585. }
  60586. RouteConfigLoadEnd.prototype.toString = function () { return "RouteConfigLoadEnd(path: " + this.route.path + ")"; };
  60587. return RouteConfigLoadEnd;
  60588. }());
  60589. /**
  60590. * @description
  60591. *
  60592. * Represents the start of end of the Resolve phase of routing. See note on
  60593. * `ChildActivationEnd` for use of this experimental API.
  60594. *
  60595. * @experimental
  60596. */
  60597. var ChildActivationStart = /** @class */ (function () {
  60598. function ChildActivationStart(
  60599. /** @docsNotRequired */
  60600. snapshot) {
  60601. this.snapshot = snapshot;
  60602. }
  60603. ChildActivationStart.prototype.toString = function () {
  60604. var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
  60605. return "ChildActivationStart(path: '" + path + "')";
  60606. };
  60607. return ChildActivationStart;
  60608. }());
  60609. /**
  60610. * @description
  60611. *
  60612. * Represents the start of end of the Resolve phase of routing. See note on
  60613. * `ChildActivationStart` for use of this experimental API.
  60614. *
  60615. * @experimental
  60616. */
  60617. var ChildActivationEnd = /** @class */ (function () {
  60618. function ChildActivationEnd(
  60619. /** @docsNotRequired */
  60620. snapshot) {
  60621. this.snapshot = snapshot;
  60622. }
  60623. ChildActivationEnd.prototype.toString = function () {
  60624. var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
  60625. return "ChildActivationEnd(path: '" + path + "')";
  60626. };
  60627. return ChildActivationEnd;
  60628. }());
  60629. /**
  60630. * @description
  60631. *
  60632. * Represents the start of end of the Resolve phase of routing. See note on
  60633. * `ActivationEnd` for use of this experimental API.
  60634. *
  60635. * @experimental
  60636. */
  60637. var ActivationStart = /** @class */ (function () {
  60638. function ActivationStart(
  60639. /** @docsNotRequired */
  60640. snapshot) {
  60641. this.snapshot = snapshot;
  60642. }
  60643. ActivationStart.prototype.toString = function () {
  60644. var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
  60645. return "ActivationStart(path: '" + path + "')";
  60646. };
  60647. return ActivationStart;
  60648. }());
  60649. /**
  60650. * @description
  60651. *
  60652. * Represents the start of end of the Resolve phase of routing. See note on
  60653. * `ActivationStart` for use of this experimental API.
  60654. *
  60655. * @experimental
  60656. */
  60657. var ActivationEnd = /** @class */ (function () {
  60658. function ActivationEnd(
  60659. /** @docsNotRequired */
  60660. snapshot) {
  60661. this.snapshot = snapshot;
  60662. }
  60663. ActivationEnd.prototype.toString = function () {
  60664. var path = this.snapshot.routeConfig && this.snapshot.routeConfig.path || '';
  60665. return "ActivationEnd(path: '" + path + "')";
  60666. };
  60667. return ActivationEnd;
  60668. }());
  60669. /**
  60670. * @description
  60671. *
  60672. * Represents a scrolling event.
  60673. */
  60674. var Scroll = /** @class */ (function () {
  60675. function Scroll(
  60676. /** @docsNotRequired */
  60677. routerEvent,
  60678. /** @docsNotRequired */
  60679. position,
  60680. /** @docsNotRequired */
  60681. anchor) {
  60682. this.routerEvent = routerEvent;
  60683. this.position = position;
  60684. this.anchor = anchor;
  60685. }
  60686. Scroll.prototype.toString = function () {
  60687. var pos = this.position ? this.position[0] + ", " + this.position[1] : null;
  60688. return "Scroll(anchor: '" + this.anchor + "', position: '" + pos + "')";
  60689. };
  60690. return Scroll;
  60691. }());
  60692. /**
  60693. * @license
  60694. * Copyright Google Inc. All Rights Reserved.
  60695. *
  60696. * Use of this source code is governed by an MIT-style license that can be
  60697. * found in the LICENSE file at https://angular.io/license
  60698. */
  60699. /**
  60700. * This component is used internally within the router to be a placeholder when an empty
  60701. * router-outlet is needed. For example, with a config such as:
  60702. *
  60703. * `{path: 'parent', outlet: 'nav', children: [...]}`
  60704. *
  60705. * In order to render, there needs to be a component on this config, which will default
  60706. * to this `EmptyOutletComponent`.
  60707. */
  60708. var EmptyOutletComponent = /** @class */ (function () {
  60709. function EmptyOutletComponent() {
  60710. }
  60711. EmptyOutletComponent = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  60712. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Component"])({ template: "<router-outlet></router-outlet>" })
  60713. ], EmptyOutletComponent);
  60714. return EmptyOutletComponent;
  60715. }());
  60716. /**
  60717. * @license
  60718. * Copyright Google Inc. All Rights Reserved.
  60719. *
  60720. * Use of this source code is governed by an MIT-style license that can be
  60721. * found in the LICENSE file at https://angular.io/license
  60722. */
  60723. /**
  60724. * @description
  60725. *
  60726. * Name of the primary outlet.
  60727. *
  60728. *
  60729. */
  60730. var PRIMARY_OUTLET = 'primary';
  60731. var ParamsAsMap = /** @class */ (function () {
  60732. function ParamsAsMap(params) {
  60733. this.params = params || {};
  60734. }
  60735. ParamsAsMap.prototype.has = function (name) { return this.params.hasOwnProperty(name); };
  60736. ParamsAsMap.prototype.get = function (name) {
  60737. if (this.has(name)) {
  60738. var v = this.params[name];
  60739. return Array.isArray(v) ? v[0] : v;
  60740. }
  60741. return null;
  60742. };
  60743. ParamsAsMap.prototype.getAll = function (name) {
  60744. if (this.has(name)) {
  60745. var v = this.params[name];
  60746. return Array.isArray(v) ? v : [v];
  60747. }
  60748. return [];
  60749. };
  60750. Object.defineProperty(ParamsAsMap.prototype, "keys", {
  60751. get: function () { return Object.keys(this.params); },
  60752. enumerable: true,
  60753. configurable: true
  60754. });
  60755. return ParamsAsMap;
  60756. }());
  60757. /**
  60758. * Convert a `Params` instance to a `ParamMap`.
  60759. *
  60760. *
  60761. */
  60762. function convertToParamMap(params) {
  60763. return new ParamsAsMap(params);
  60764. }
  60765. var NAVIGATION_CANCELING_ERROR = 'ngNavigationCancelingError';
  60766. function navigationCancelingError(message) {
  60767. var error = Error('NavigationCancelingError: ' + message);
  60768. error[NAVIGATION_CANCELING_ERROR] = true;
  60769. return error;
  60770. }
  60771. function isNavigationCancelingError(error) {
  60772. return error && error[NAVIGATION_CANCELING_ERROR];
  60773. }
  60774. // Matches the route configuration (`route`) against the actual URL (`segments`).
  60775. function defaultUrlMatcher(segments, segmentGroup, route) {
  60776. var parts = route.path.split('/');
  60777. if (parts.length > segments.length) {
  60778. // The actual URL is shorter than the config, no match
  60779. return null;
  60780. }
  60781. if (route.pathMatch === 'full' &&
  60782. (segmentGroup.hasChildren() || parts.length < segments.length)) {
  60783. // The config is longer than the actual URL but we are looking for a full match, return null
  60784. return null;
  60785. }
  60786. var posParams = {};
  60787. // Check each config part against the actual URL
  60788. for (var index = 0; index < parts.length; index++) {
  60789. var part = parts[index];
  60790. var segment = segments[index];
  60791. var isParameter = part.startsWith(':');
  60792. if (isParameter) {
  60793. posParams[part.substring(1)] = segment;
  60794. }
  60795. else if (part !== segment.path) {
  60796. // The actual URL part does not match the config, no match
  60797. return null;
  60798. }
  60799. }
  60800. return { consumed: segments.slice(0, parts.length), posParams: posParams };
  60801. }
  60802. /**
  60803. * @license
  60804. * Copyright Google Inc. All Rights Reserved.
  60805. *
  60806. * Use of this source code is governed by an MIT-style license that can be
  60807. * found in the LICENSE file at https://angular.io/license
  60808. */
  60809. var LoadedRouterConfig = /** @class */ (function () {
  60810. function LoadedRouterConfig(routes, module) {
  60811. this.routes = routes;
  60812. this.module = module;
  60813. }
  60814. return LoadedRouterConfig;
  60815. }());
  60816. function validateConfig(config, parentPath) {
  60817. if (parentPath === void 0) { parentPath = ''; }
  60818. // forEach doesn't iterate undefined values
  60819. for (var i = 0; i < config.length; i++) {
  60820. var route = config[i];
  60821. var fullPath = getFullPath(parentPath, route);
  60822. validateNode(route, fullPath);
  60823. }
  60824. }
  60825. function validateNode(route, fullPath) {
  60826. if (!route) {
  60827. throw new Error("\n Invalid configuration of route '" + fullPath + "': Encountered undefined route.\n The reason might be an extra comma.\n\n Example:\n const routes: Routes = [\n { path: '', redirectTo: '/dashboard', pathMatch: 'full' },\n { path: 'dashboard', component: DashboardComponent },, << two commas\n { path: 'detail/:id', component: HeroDetailComponent }\n ];\n ");
  60828. }
  60829. if (Array.isArray(route)) {
  60830. throw new Error("Invalid configuration of route '" + fullPath + "': Array cannot be specified");
  60831. }
  60832. if (!route.component && !route.children && !route.loadChildren &&
  60833. (route.outlet && route.outlet !== PRIMARY_OUTLET)) {
  60834. throw new Error("Invalid configuration of route '" + fullPath + "': a componentless route without children or loadChildren cannot have a named outlet set");
  60835. }
  60836. if (route.redirectTo && route.children) {
  60837. throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and children cannot be used together");
  60838. }
  60839. if (route.redirectTo && route.loadChildren) {
  60840. throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and loadChildren cannot be used together");
  60841. }
  60842. if (route.children && route.loadChildren) {
  60843. throw new Error("Invalid configuration of route '" + fullPath + "': children and loadChildren cannot be used together");
  60844. }
  60845. if (route.redirectTo && route.component) {
  60846. throw new Error("Invalid configuration of route '" + fullPath + "': redirectTo and component cannot be used together");
  60847. }
  60848. if (route.path && route.matcher) {
  60849. throw new Error("Invalid configuration of route '" + fullPath + "': path and matcher cannot be used together");
  60850. }
  60851. if (route.redirectTo === void 0 && !route.component && !route.children && !route.loadChildren) {
  60852. throw new Error("Invalid configuration of route '" + fullPath + "'. One of the following must be provided: component, redirectTo, children or loadChildren");
  60853. }
  60854. if (route.path === void 0 && route.matcher === void 0) {
  60855. throw new Error("Invalid configuration of route '" + fullPath + "': routes must have either a path or a matcher specified");
  60856. }
  60857. if (typeof route.path === 'string' && route.path.charAt(0) === '/') {
  60858. throw new Error("Invalid configuration of route '" + fullPath + "': path cannot start with a slash");
  60859. }
  60860. if (route.path === '' && route.redirectTo !== void 0 && route.pathMatch === void 0) {
  60861. var exp = "The default value of 'pathMatch' is 'prefix', but often the intent is to use 'full'.";
  60862. throw new Error("Invalid configuration of route '{path: \"" + fullPath + "\", redirectTo: \"" + route.redirectTo + "\"}': please provide 'pathMatch'. " + exp);
  60863. }
  60864. if (route.pathMatch !== void 0 && route.pathMatch !== 'full' && route.pathMatch !== 'prefix') {
  60865. throw new Error("Invalid configuration of route '" + fullPath + "': pathMatch can only be set to 'prefix' or 'full'");
  60866. }
  60867. if (route.children) {
  60868. validateConfig(route.children, fullPath);
  60869. }
  60870. }
  60871. function getFullPath(parentPath, currentRoute) {
  60872. if (!currentRoute) {
  60873. return parentPath;
  60874. }
  60875. if (!parentPath && !currentRoute.path) {
  60876. return '';
  60877. }
  60878. else if (parentPath && !currentRoute.path) {
  60879. return parentPath + "/";
  60880. }
  60881. else if (!parentPath && currentRoute.path) {
  60882. return currentRoute.path;
  60883. }
  60884. else {
  60885. return parentPath + "/" + currentRoute.path;
  60886. }
  60887. }
  60888. /**
  60889. * Makes a copy of the config and adds any default required properties.
  60890. */
  60891. function standardizeConfig(r) {
  60892. var children = r.children && r.children.map(standardizeConfig);
  60893. var c = children ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, r, { children: children }) : Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, r);
  60894. if (!c.component && (children || c.loadChildren) && (c.outlet && c.outlet !== PRIMARY_OUTLET)) {
  60895. c.component = EmptyOutletComponent;
  60896. }
  60897. return c;
  60898. }
  60899. /**
  60900. * @license
  60901. * Copyright Google Inc. All Rights Reserved.
  60902. *
  60903. * Use of this source code is governed by an MIT-style license that can be
  60904. * found in the LICENSE file at https://angular.io/license
  60905. */
  60906. function shallowEqualArrays(a, b) {
  60907. if (a.length !== b.length)
  60908. return false;
  60909. for (var i = 0; i < a.length; ++i) {
  60910. if (!shallowEqual(a[i], b[i]))
  60911. return false;
  60912. }
  60913. return true;
  60914. }
  60915. function shallowEqual(a, b) {
  60916. var k1 = Object.keys(a);
  60917. var k2 = Object.keys(b);
  60918. if (k1.length != k2.length) {
  60919. return false;
  60920. }
  60921. var key;
  60922. for (var i = 0; i < k1.length; i++) {
  60923. key = k1[i];
  60924. if (a[key] !== b[key]) {
  60925. return false;
  60926. }
  60927. }
  60928. return true;
  60929. }
  60930. /**
  60931. * Flattens single-level nested arrays.
  60932. */
  60933. function flatten(arr) {
  60934. return Array.prototype.concat.apply([], arr);
  60935. }
  60936. /**
  60937. * Return the last element of an array.
  60938. */
  60939. function last$1(a) {
  60940. return a.length > 0 ? a[a.length - 1] : null;
  60941. }
  60942. function forEach(map$$1, callback) {
  60943. for (var prop in map$$1) {
  60944. if (map$$1.hasOwnProperty(prop)) {
  60945. callback(map$$1[prop], prop);
  60946. }
  60947. }
  60948. }
  60949. function waitForMap(obj, fn) {
  60950. if (Object.keys(obj).length === 0) {
  60951. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])({});
  60952. }
  60953. var waitHead = [];
  60954. var waitTail = [];
  60955. var res = {};
  60956. forEach(obj, function (a, k) {
  60957. var mapped = fn(k, a).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (r) { return res[k] = r; }));
  60958. if (k === PRIMARY_OUTLET) {
  60959. waitHead.push(mapped);
  60960. }
  60961. else {
  60962. waitTail.push(mapped);
  60963. }
  60964. });
  60965. // Closure compiler has problem with using spread operator here. So just using Array.concat.
  60966. return rxjs__WEBPACK_IMPORTED_MODULE_2__["of"].apply(null, waitHead.concat(waitTail)).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["last"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function () { return res; }));
  60967. }
  60968. /**
  60969. * ANDs Observables by merging all input observables, reducing to an Observable verifying all
  60970. * input Observables return `true`.
  60971. */
  60972. function andObservables(observables) {
  60973. return observables.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["every"])(function (result) { return result === true; }));
  60974. }
  60975. function wrapIntoObservable(value) {
  60976. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵisObservable"])(value)) {
  60977. return value;
  60978. }
  60979. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵisPromise"])(value)) {
  60980. // Use `Promise.resolve()` to wrap promise-like instances.
  60981. // Required ie when a Resolver returns a AngularJS `$q` promise to correctly trigger the
  60982. // change detection.
  60983. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(Promise.resolve(value));
  60984. }
  60985. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(value);
  60986. }
  60987. /**
  60988. * @license
  60989. * Copyright Google Inc. All Rights Reserved.
  60990. *
  60991. * Use of this source code is governed by an MIT-style license that can be
  60992. * found in the LICENSE file at https://angular.io/license
  60993. */
  60994. function createEmptyUrlTree() {
  60995. return new UrlTree(new UrlSegmentGroup([], {}), {}, null);
  60996. }
  60997. function containsTree(container, containee, exact) {
  60998. if (exact) {
  60999. return equalQueryParams(container.queryParams, containee.queryParams) &&
  61000. equalSegmentGroups(container.root, containee.root);
  61001. }
  61002. return containsQueryParams(container.queryParams, containee.queryParams) &&
  61003. containsSegmentGroup(container.root, containee.root);
  61004. }
  61005. function equalQueryParams(container, containee) {
  61006. // TODO: This does not handle array params correctly.
  61007. return shallowEqual(container, containee);
  61008. }
  61009. function equalSegmentGroups(container, containee) {
  61010. if (!equalPath(container.segments, containee.segments))
  61011. return false;
  61012. if (container.numberOfChildren !== containee.numberOfChildren)
  61013. return false;
  61014. for (var c in containee.children) {
  61015. if (!container.children[c])
  61016. return false;
  61017. if (!equalSegmentGroups(container.children[c], containee.children[c]))
  61018. return false;
  61019. }
  61020. return true;
  61021. }
  61022. function containsQueryParams(container, containee) {
  61023. // TODO: This does not handle array params correctly.
  61024. return Object.keys(containee).length <= Object.keys(container).length &&
  61025. Object.keys(containee).every(function (key) { return containee[key] === container[key]; });
  61026. }
  61027. function containsSegmentGroup(container, containee) {
  61028. return containsSegmentGroupHelper(container, containee, containee.segments);
  61029. }
  61030. function containsSegmentGroupHelper(container, containee, containeePaths) {
  61031. if (container.segments.length > containeePaths.length) {
  61032. var current = container.segments.slice(0, containeePaths.length);
  61033. if (!equalPath(current, containeePaths))
  61034. return false;
  61035. if (containee.hasChildren())
  61036. return false;
  61037. return true;
  61038. }
  61039. else if (container.segments.length === containeePaths.length) {
  61040. if (!equalPath(container.segments, containeePaths))
  61041. return false;
  61042. for (var c in containee.children) {
  61043. if (!container.children[c])
  61044. return false;
  61045. if (!containsSegmentGroup(container.children[c], containee.children[c]))
  61046. return false;
  61047. }
  61048. return true;
  61049. }
  61050. else {
  61051. var current = containeePaths.slice(0, container.segments.length);
  61052. var next = containeePaths.slice(container.segments.length);
  61053. if (!equalPath(container.segments, current))
  61054. return false;
  61055. if (!container.children[PRIMARY_OUTLET])
  61056. return false;
  61057. return containsSegmentGroupHelper(container.children[PRIMARY_OUTLET], containee, next);
  61058. }
  61059. }
  61060. /**
  61061. * @description
  61062. *
  61063. * Represents the parsed URL.
  61064. *
  61065. * Since a router state is a tree, and the URL is nothing but a serialized state, the URL is a
  61066. * serialized tree.
  61067. * UrlTree is a data structure that provides a lot of affordances in dealing with URLs
  61068. *
  61069. * @usageNotes
  61070. * ### Example
  61071. *
  61072. * ```
  61073. * @Component({templateUrl:'template.html'})
  61074. * class MyComponent {
  61075. * constructor(router: Router) {
  61076. * const tree: UrlTree =
  61077. * router.parseUrl('/team/33/(user/victor//support:help)?debug=true#fragment');
  61078. * const f = tree.fragment; // return 'fragment'
  61079. * const q = tree.queryParams; // returns {debug: 'true'}
  61080. * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
  61081. * const s: UrlSegment[] = g.segments; // returns 2 segments 'team' and '33'
  61082. * g.children[PRIMARY_OUTLET].segments; // returns 2 segments 'user' and 'victor'
  61083. * g.children['support'].segments; // return 1 segment 'help'
  61084. * }
  61085. * }
  61086. * ```
  61087. *
  61088. *
  61089. */
  61090. var UrlTree = /** @class */ (function () {
  61091. /** @internal */
  61092. function UrlTree(
  61093. /** The root segment group of the URL tree */
  61094. root,
  61095. /** The query params of the URL */
  61096. queryParams,
  61097. /** The fragment of the URL */
  61098. fragment) {
  61099. this.root = root;
  61100. this.queryParams = queryParams;
  61101. this.fragment = fragment;
  61102. }
  61103. Object.defineProperty(UrlTree.prototype, "queryParamMap", {
  61104. get: function () {
  61105. if (!this._queryParamMap) {
  61106. this._queryParamMap = convertToParamMap(this.queryParams);
  61107. }
  61108. return this._queryParamMap;
  61109. },
  61110. enumerable: true,
  61111. configurable: true
  61112. });
  61113. /** @docsNotRequired */
  61114. UrlTree.prototype.toString = function () { return DEFAULT_SERIALIZER.serialize(this); };
  61115. return UrlTree;
  61116. }());
  61117. /**
  61118. * @description
  61119. *
  61120. * Represents the parsed URL segment group.
  61121. *
  61122. * See `UrlTree` for more information.
  61123. *
  61124. *
  61125. */
  61126. var UrlSegmentGroup = /** @class */ (function () {
  61127. function UrlSegmentGroup(
  61128. /** The URL segments of this group. See `UrlSegment` for more information */
  61129. segments,
  61130. /** The list of children of this group */
  61131. children) {
  61132. var _this = this;
  61133. this.segments = segments;
  61134. this.children = children;
  61135. /** The parent node in the url tree */
  61136. this.parent = null;
  61137. forEach(children, function (v, k) { return v.parent = _this; });
  61138. }
  61139. /** Whether the segment has child segments */
  61140. UrlSegmentGroup.prototype.hasChildren = function () { return this.numberOfChildren > 0; };
  61141. Object.defineProperty(UrlSegmentGroup.prototype, "numberOfChildren", {
  61142. /** Number of child segments */
  61143. get: function () { return Object.keys(this.children).length; },
  61144. enumerable: true,
  61145. configurable: true
  61146. });
  61147. /** @docsNotRequired */
  61148. UrlSegmentGroup.prototype.toString = function () { return serializePaths(this); };
  61149. return UrlSegmentGroup;
  61150. }());
  61151. /**
  61152. * @description
  61153. *
  61154. * Represents a single URL segment.
  61155. *
  61156. * A UrlSegment is a part of a URL between the two slashes. It contains a path and the matrix
  61157. * parameters associated with the segment.
  61158. *
  61159. * @usageNotes
  61160. * ### Example
  61161. *
  61162. * ```
  61163. * @Component({templateUrl:'template.html'})
  61164. * class MyComponent {
  61165. * constructor(router: Router) {
  61166. * const tree: UrlTree = router.parseUrl('/team;id=33');
  61167. * const g: UrlSegmentGroup = tree.root.children[PRIMARY_OUTLET];
  61168. * const s: UrlSegment[] = g.segments;
  61169. * s[0].path; // returns 'team'
  61170. * s[0].parameters; // returns {id: 33}
  61171. * }
  61172. * }
  61173. * ```
  61174. *
  61175. *
  61176. */
  61177. var UrlSegment = /** @class */ (function () {
  61178. function UrlSegment(
  61179. /** The path part of a URL segment */
  61180. path,
  61181. /** The matrix parameters associated with a segment */
  61182. parameters) {
  61183. this.path = path;
  61184. this.parameters = parameters;
  61185. }
  61186. Object.defineProperty(UrlSegment.prototype, "parameterMap", {
  61187. get: function () {
  61188. if (!this._parameterMap) {
  61189. this._parameterMap = convertToParamMap(this.parameters);
  61190. }
  61191. return this._parameterMap;
  61192. },
  61193. enumerable: true,
  61194. configurable: true
  61195. });
  61196. /** @docsNotRequired */
  61197. UrlSegment.prototype.toString = function () { return serializePath(this); };
  61198. return UrlSegment;
  61199. }());
  61200. function equalSegments(as, bs) {
  61201. return equalPath(as, bs) && as.every(function (a, i) { return shallowEqual(a.parameters, bs[i].parameters); });
  61202. }
  61203. function equalPath(as, bs) {
  61204. if (as.length !== bs.length)
  61205. return false;
  61206. return as.every(function (a, i) { return a.path === bs[i].path; });
  61207. }
  61208. function mapChildrenIntoArray(segment, fn) {
  61209. var res = [];
  61210. forEach(segment.children, function (child, childOutlet) {
  61211. if (childOutlet === PRIMARY_OUTLET) {
  61212. res = res.concat(fn(child, childOutlet));
  61213. }
  61214. });
  61215. forEach(segment.children, function (child, childOutlet) {
  61216. if (childOutlet !== PRIMARY_OUTLET) {
  61217. res = res.concat(fn(child, childOutlet));
  61218. }
  61219. });
  61220. return res;
  61221. }
  61222. /**
  61223. * @description
  61224. *
  61225. * Serializes and deserializes a URL string into a URL tree.
  61226. *
  61227. * The url serialization strategy is customizable. You can
  61228. * make all URLs case insensitive by providing a custom UrlSerializer.
  61229. *
  61230. * See `DefaultUrlSerializer` for an example of a URL serializer.
  61231. *
  61232. *
  61233. */
  61234. var UrlSerializer = /** @class */ (function () {
  61235. function UrlSerializer() {
  61236. }
  61237. return UrlSerializer;
  61238. }());
  61239. /**
  61240. * @description
  61241. *
  61242. * A default implementation of the `UrlSerializer`.
  61243. *
  61244. * Example URLs:
  61245. *
  61246. * ```
  61247. * /inbox/33(popup:compose)
  61248. * /inbox/33;open=true/messages/44
  61249. * ```
  61250. *
  61251. * DefaultUrlSerializer uses parentheses to serialize secondary segments (e.g., popup:compose), the
  61252. * colon syntax to specify the outlet, and the ';parameter=value' syntax (e.g., open=true) to
  61253. * specify route specific parameters.
  61254. *
  61255. *
  61256. */
  61257. var DefaultUrlSerializer = /** @class */ (function () {
  61258. function DefaultUrlSerializer() {
  61259. }
  61260. /** Parses a url into a `UrlTree` */
  61261. DefaultUrlSerializer.prototype.parse = function (url) {
  61262. var p = new UrlParser(url);
  61263. return new UrlTree(p.parseRootSegment(), p.parseQueryParams(), p.parseFragment());
  61264. };
  61265. /** Converts a `UrlTree` into a url */
  61266. DefaultUrlSerializer.prototype.serialize = function (tree) {
  61267. var segment = "/" + serializeSegment(tree.root, true);
  61268. var query = serializeQueryParams(tree.queryParams);
  61269. var fragment = typeof tree.fragment === "string" ? "#" + encodeUriFragment(tree.fragment) : '';
  61270. return "" + segment + query + fragment;
  61271. };
  61272. return DefaultUrlSerializer;
  61273. }());
  61274. var DEFAULT_SERIALIZER = new DefaultUrlSerializer();
  61275. function serializePaths(segment) {
  61276. return segment.segments.map(function (p) { return serializePath(p); }).join('/');
  61277. }
  61278. function serializeSegment(segment, root) {
  61279. if (!segment.hasChildren()) {
  61280. return serializePaths(segment);
  61281. }
  61282. if (root) {
  61283. var primary = segment.children[PRIMARY_OUTLET] ?
  61284. serializeSegment(segment.children[PRIMARY_OUTLET], false) :
  61285. '';
  61286. var children_1 = [];
  61287. forEach(segment.children, function (v, k) {
  61288. if (k !== PRIMARY_OUTLET) {
  61289. children_1.push(k + ":" + serializeSegment(v, false));
  61290. }
  61291. });
  61292. return children_1.length > 0 ? primary + "(" + children_1.join('//') + ")" : primary;
  61293. }
  61294. else {
  61295. var children = mapChildrenIntoArray(segment, function (v, k) {
  61296. if (k === PRIMARY_OUTLET) {
  61297. return [serializeSegment(segment.children[PRIMARY_OUTLET], false)];
  61298. }
  61299. return [k + ":" + serializeSegment(v, false)];
  61300. });
  61301. return serializePaths(segment) + "/(" + children.join('//') + ")";
  61302. }
  61303. }
  61304. /**
  61305. * Encodes a URI string with the default encoding. This function will only ever be called from
  61306. * `encodeUriQuery` or `encodeUriSegment` as it's the base set of encodings to be used. We need
  61307. * a custom encoding because encodeURIComponent is too aggressive and encodes stuff that doesn't
  61308. * have to be encoded per https://url.spec.whatwg.org.
  61309. */
  61310. function encodeUriString(s) {
  61311. return encodeURIComponent(s)
  61312. .replace(/%40/g, '@')
  61313. .replace(/%3A/gi, ':')
  61314. .replace(/%24/g, '$')
  61315. .replace(/%2C/gi, ',');
  61316. }
  61317. /**
  61318. * This function should be used to encode both keys and values in a query string key/value. In
  61319. * the following URL, you need to call encodeUriQuery on "k" and "v":
  61320. *
  61321. * http://www.site.org/html;mk=mv?k=v#f
  61322. */
  61323. function encodeUriQuery(s) {
  61324. return encodeUriString(s).replace(/%3B/gi, ';');
  61325. }
  61326. /**
  61327. * This function should be used to encode a URL fragment. In the following URL, you need to call
  61328. * encodeUriFragment on "f":
  61329. *
  61330. * http://www.site.org/html;mk=mv?k=v#f
  61331. */
  61332. function encodeUriFragment(s) {
  61333. return encodeURI(s);
  61334. }
  61335. /**
  61336. * This function should be run on any URI segment as well as the key and value in a key/value
  61337. * pair for matrix params. In the following URL, you need to call encodeUriSegment on "html",
  61338. * "mk", and "mv":
  61339. *
  61340. * http://www.site.org/html;mk=mv?k=v#f
  61341. */
  61342. function encodeUriSegment(s) {
  61343. return encodeUriString(s).replace(/\(/g, '%28').replace(/\)/g, '%29').replace(/%26/gi, '&');
  61344. }
  61345. function decode(s) {
  61346. return decodeURIComponent(s);
  61347. }
  61348. // Query keys/values should have the "+" replaced first, as "+" in a query string is " ".
  61349. // decodeURIComponent function will not decode "+" as a space.
  61350. function decodeQuery(s) {
  61351. return decode(s.replace(/\+/g, '%20'));
  61352. }
  61353. function serializePath(path) {
  61354. return "" + encodeUriSegment(path.path) + serializeMatrixParams(path.parameters);
  61355. }
  61356. function serializeMatrixParams(params) {
  61357. return Object.keys(params)
  61358. .map(function (key) { return ";" + encodeUriSegment(key) + "=" + encodeUriSegment(params[key]); })
  61359. .join('');
  61360. }
  61361. function serializeQueryParams(params) {
  61362. var strParams = Object.keys(params).map(function (name) {
  61363. var value = params[name];
  61364. return Array.isArray(value) ?
  61365. value.map(function (v) { return encodeUriQuery(name) + "=" + encodeUriQuery(v); }).join('&') :
  61366. encodeUriQuery(name) + "=" + encodeUriQuery(value);
  61367. });
  61368. return strParams.length ? "?" + strParams.join("&") : '';
  61369. }
  61370. var SEGMENT_RE = /^[^\/()?;=#]+/;
  61371. function matchSegments(str) {
  61372. var match = str.match(SEGMENT_RE);
  61373. return match ? match[0] : '';
  61374. }
  61375. var QUERY_PARAM_RE = /^[^=?&#]+/;
  61376. // Return the name of the query param at the start of the string or an empty string
  61377. function matchQueryParams(str) {
  61378. var match = str.match(QUERY_PARAM_RE);
  61379. return match ? match[0] : '';
  61380. }
  61381. var QUERY_PARAM_VALUE_RE = /^[^?&#]+/;
  61382. // Return the value of the query param at the start of the string or an empty string
  61383. function matchUrlQueryParamValue(str) {
  61384. var match = str.match(QUERY_PARAM_VALUE_RE);
  61385. return match ? match[0] : '';
  61386. }
  61387. var UrlParser = /** @class */ (function () {
  61388. function UrlParser(url) {
  61389. this.url = url;
  61390. this.remaining = url;
  61391. }
  61392. UrlParser.prototype.parseRootSegment = function () {
  61393. this.consumeOptional('/');
  61394. if (this.remaining === '' || this.peekStartsWith('?') || this.peekStartsWith('#')) {
  61395. return new UrlSegmentGroup([], {});
  61396. }
  61397. // The root segment group never has segments
  61398. return new UrlSegmentGroup([], this.parseChildren());
  61399. };
  61400. UrlParser.prototype.parseQueryParams = function () {
  61401. var params = {};
  61402. if (this.consumeOptional('?')) {
  61403. do {
  61404. this.parseQueryParam(params);
  61405. } while (this.consumeOptional('&'));
  61406. }
  61407. return params;
  61408. };
  61409. UrlParser.prototype.parseFragment = function () {
  61410. return this.consumeOptional('#') ? decodeURIComponent(this.remaining) : null;
  61411. };
  61412. UrlParser.prototype.parseChildren = function () {
  61413. if (this.remaining === '') {
  61414. return {};
  61415. }
  61416. this.consumeOptional('/');
  61417. var segments = [];
  61418. if (!this.peekStartsWith('(')) {
  61419. segments.push(this.parseSegment());
  61420. }
  61421. while (this.peekStartsWith('/') && !this.peekStartsWith('//') && !this.peekStartsWith('/(')) {
  61422. this.capture('/');
  61423. segments.push(this.parseSegment());
  61424. }
  61425. var children = {};
  61426. if (this.peekStartsWith('/(')) {
  61427. this.capture('/');
  61428. children = this.parseParens(true);
  61429. }
  61430. var res = {};
  61431. if (this.peekStartsWith('(')) {
  61432. res = this.parseParens(false);
  61433. }
  61434. if (segments.length > 0 || Object.keys(children).length > 0) {
  61435. res[PRIMARY_OUTLET] = new UrlSegmentGroup(segments, children);
  61436. }
  61437. return res;
  61438. };
  61439. // parse a segment with its matrix parameters
  61440. // ie `name;k1=v1;k2`
  61441. UrlParser.prototype.parseSegment = function () {
  61442. var path = matchSegments(this.remaining);
  61443. if (path === '' && this.peekStartsWith(';')) {
  61444. throw new Error("Empty path url segment cannot have parameters: '" + this.remaining + "'.");
  61445. }
  61446. this.capture(path);
  61447. return new UrlSegment(decode(path), this.parseMatrixParams());
  61448. };
  61449. UrlParser.prototype.parseMatrixParams = function () {
  61450. var params = {};
  61451. while (this.consumeOptional(';')) {
  61452. this.parseParam(params);
  61453. }
  61454. return params;
  61455. };
  61456. UrlParser.prototype.parseParam = function (params) {
  61457. var key = matchSegments(this.remaining);
  61458. if (!key) {
  61459. return;
  61460. }
  61461. this.capture(key);
  61462. var value = '';
  61463. if (this.consumeOptional('=')) {
  61464. var valueMatch = matchSegments(this.remaining);
  61465. if (valueMatch) {
  61466. value = valueMatch;
  61467. this.capture(value);
  61468. }
  61469. }
  61470. params[decode(key)] = decode(value);
  61471. };
  61472. // Parse a single query parameter `name[=value]`
  61473. UrlParser.prototype.parseQueryParam = function (params) {
  61474. var key = matchQueryParams(this.remaining);
  61475. if (!key) {
  61476. return;
  61477. }
  61478. this.capture(key);
  61479. var value = '';
  61480. if (this.consumeOptional('=')) {
  61481. var valueMatch = matchUrlQueryParamValue(this.remaining);
  61482. if (valueMatch) {
  61483. value = valueMatch;
  61484. this.capture(value);
  61485. }
  61486. }
  61487. var decodedKey = decodeQuery(key);
  61488. var decodedVal = decodeQuery(value);
  61489. if (params.hasOwnProperty(decodedKey)) {
  61490. // Append to existing values
  61491. var currentVal = params[decodedKey];
  61492. if (!Array.isArray(currentVal)) {
  61493. currentVal = [currentVal];
  61494. params[decodedKey] = currentVal;
  61495. }
  61496. currentVal.push(decodedVal);
  61497. }
  61498. else {
  61499. // Create a new value
  61500. params[decodedKey] = decodedVal;
  61501. }
  61502. };
  61503. // parse `(a/b//outlet_name:c/d)`
  61504. UrlParser.prototype.parseParens = function (allowPrimary) {
  61505. var segments = {};
  61506. this.capture('(');
  61507. while (!this.consumeOptional(')') && this.remaining.length > 0) {
  61508. var path = matchSegments(this.remaining);
  61509. var next = this.remaining[path.length];
  61510. // if is is not one of these characters, then the segment was unescaped
  61511. // or the group was not closed
  61512. if (next !== '/' && next !== ')' && next !== ';') {
  61513. throw new Error("Cannot parse url '" + this.url + "'");
  61514. }
  61515. var outletName = undefined;
  61516. if (path.indexOf(':') > -1) {
  61517. outletName = path.substr(0, path.indexOf(':'));
  61518. this.capture(outletName);
  61519. this.capture(':');
  61520. }
  61521. else if (allowPrimary) {
  61522. outletName = PRIMARY_OUTLET;
  61523. }
  61524. var children = this.parseChildren();
  61525. segments[outletName] = Object.keys(children).length === 1 ? children[PRIMARY_OUTLET] :
  61526. new UrlSegmentGroup([], children);
  61527. this.consumeOptional('//');
  61528. }
  61529. return segments;
  61530. };
  61531. UrlParser.prototype.peekStartsWith = function (str) { return this.remaining.startsWith(str); };
  61532. // Consumes the prefix when it is present and returns whether it has been consumed
  61533. UrlParser.prototype.consumeOptional = function (str) {
  61534. if (this.peekStartsWith(str)) {
  61535. this.remaining = this.remaining.substring(str.length);
  61536. return true;
  61537. }
  61538. return false;
  61539. };
  61540. UrlParser.prototype.capture = function (str) {
  61541. if (!this.consumeOptional(str)) {
  61542. throw new Error("Expected \"" + str + "\".");
  61543. }
  61544. };
  61545. return UrlParser;
  61546. }());
  61547. /**
  61548. * @license
  61549. * Copyright Google Inc. All Rights Reserved.
  61550. *
  61551. * Use of this source code is governed by an MIT-style license that can be
  61552. * found in the LICENSE file at https://angular.io/license
  61553. */
  61554. var NoMatch = /** @class */ (function () {
  61555. function NoMatch(segmentGroup) {
  61556. this.segmentGroup = segmentGroup || null;
  61557. }
  61558. return NoMatch;
  61559. }());
  61560. var AbsoluteRedirect = /** @class */ (function () {
  61561. function AbsoluteRedirect(urlTree) {
  61562. this.urlTree = urlTree;
  61563. }
  61564. return AbsoluteRedirect;
  61565. }());
  61566. function noMatch(segmentGroup) {
  61567. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (obs) { return obs.error(new NoMatch(segmentGroup)); });
  61568. }
  61569. function absoluteRedirect(newTree) {
  61570. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (obs) { return obs.error(new AbsoluteRedirect(newTree)); });
  61571. }
  61572. function namedOutletsRedirect(redirectTo) {
  61573. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (obs) { return obs.error(new Error("Only absolute redirects can have named outlets. redirectTo: '" + redirectTo + "'")); });
  61574. }
  61575. function canLoadFails(route) {
  61576. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (obs) { return obs.error(navigationCancelingError("Cannot load children because the guard of the route \"path: '" + route.path + "'\" returned false")); });
  61577. }
  61578. /**
  61579. * Returns the `UrlTree` with the redirection applied.
  61580. *
  61581. * Lazy modules are loaded along the way.
  61582. */
  61583. function applyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {
  61584. return new ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config).apply();
  61585. }
  61586. var ApplyRedirects = /** @class */ (function () {
  61587. function ApplyRedirects(moduleInjector, configLoader, urlSerializer, urlTree, config) {
  61588. this.configLoader = configLoader;
  61589. this.urlSerializer = urlSerializer;
  61590. this.urlTree = urlTree;
  61591. this.config = config;
  61592. this.allowRedirects = true;
  61593. this.ngModule = moduleInjector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]);
  61594. }
  61595. ApplyRedirects.prototype.apply = function () {
  61596. var _this = this;
  61597. var expanded$ = this.expandSegmentGroup(this.ngModule, this.config, this.urlTree.root, PRIMARY_OUTLET);
  61598. var urlTrees$ = expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (rootSegmentGroup) { return _this.createUrlTree(rootSegmentGroup, _this.urlTree.queryParams, _this.urlTree.fragment); }));
  61599. return urlTrees$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])(function (e) {
  61600. if (e instanceof AbsoluteRedirect) {
  61601. // after an absolute redirect we do not apply any more redirects!
  61602. _this.allowRedirects = false;
  61603. // we need to run matching, so we can fetch all lazy-loaded modules
  61604. return _this.match(e.urlTree);
  61605. }
  61606. if (e instanceof NoMatch) {
  61607. throw _this.noMatchError(e);
  61608. }
  61609. throw e;
  61610. }));
  61611. };
  61612. ApplyRedirects.prototype.match = function (tree) {
  61613. var _this = this;
  61614. var expanded$ = this.expandSegmentGroup(this.ngModule, this.config, tree.root, PRIMARY_OUTLET);
  61615. var mapped$ = expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (rootSegmentGroup) {
  61616. return _this.createUrlTree(rootSegmentGroup, tree.queryParams, tree.fragment);
  61617. }));
  61618. return mapped$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])(function (e) {
  61619. if (e instanceof NoMatch) {
  61620. throw _this.noMatchError(e);
  61621. }
  61622. throw e;
  61623. }));
  61624. };
  61625. ApplyRedirects.prototype.noMatchError = function (e) {
  61626. return new Error("Cannot match any routes. URL Segment: '" + e.segmentGroup + "'");
  61627. };
  61628. ApplyRedirects.prototype.createUrlTree = function (rootCandidate, queryParams, fragment) {
  61629. var _a;
  61630. var root = rootCandidate.segments.length > 0 ?
  61631. new UrlSegmentGroup([], (_a = {}, _a[PRIMARY_OUTLET] = rootCandidate, _a)) :
  61632. rootCandidate;
  61633. return new UrlTree(root, queryParams, fragment);
  61634. };
  61635. ApplyRedirects.prototype.expandSegmentGroup = function (ngModule, routes, segmentGroup, outlet) {
  61636. if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
  61637. return this.expandChildren(ngModule, routes, segmentGroup)
  61638. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (children) { return new UrlSegmentGroup([], children); }));
  61639. }
  61640. return this.expandSegment(ngModule, segmentGroup, routes, segmentGroup.segments, outlet, true);
  61641. };
  61642. // Recursively expand segment groups for all the child outlets
  61643. ApplyRedirects.prototype.expandChildren = function (ngModule, routes, segmentGroup) {
  61644. var _this = this;
  61645. return waitForMap(segmentGroup.children, function (childOutlet, child) { return _this.expandSegmentGroup(ngModule, routes, child, childOutlet); });
  61646. };
  61647. ApplyRedirects.prototype.expandSegment = function (ngModule, segmentGroup, routes, segments, outlet, allowRedirects) {
  61648. var _this = this;
  61649. return rxjs__WEBPACK_IMPORTED_MODULE_2__["of"].apply(void 0, Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(routes)).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (r) {
  61650. var expanded$ = _this.expandSegmentAgainstRoute(ngModule, segmentGroup, routes, r, segments, outlet, allowRedirects);
  61651. return expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])(function (e) {
  61652. if (e instanceof NoMatch) {
  61653. // TODO(i): this return type doesn't match the declared Observable<UrlSegmentGroup> -
  61654. // talk to Jason
  61655. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null);
  61656. }
  61657. throw e;
  61658. }));
  61659. }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])(function (s) { return !!s; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])(function (e, _) {
  61660. if (e instanceof rxjs__WEBPACK_IMPORTED_MODULE_2__["EmptyError"] || e.name === 'EmptyError') {
  61661. if (_this.noLeftoversInUrl(segmentGroup, segments, outlet)) {
  61662. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new UrlSegmentGroup([], {}));
  61663. }
  61664. throw new NoMatch(segmentGroup);
  61665. }
  61666. throw e;
  61667. }));
  61668. };
  61669. ApplyRedirects.prototype.noLeftoversInUrl = function (segmentGroup, segments, outlet) {
  61670. return segments.length === 0 && !segmentGroup.children[outlet];
  61671. };
  61672. ApplyRedirects.prototype.expandSegmentAgainstRoute = function (ngModule, segmentGroup, routes, route, paths, outlet, allowRedirects) {
  61673. if (getOutlet(route) !== outlet) {
  61674. return noMatch(segmentGroup);
  61675. }
  61676. if (route.redirectTo === undefined) {
  61677. return this.matchSegmentAgainstRoute(ngModule, segmentGroup, route, paths);
  61678. }
  61679. if (allowRedirects && this.allowRedirects) {
  61680. return this.expandSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, paths, outlet);
  61681. }
  61682. return noMatch(segmentGroup);
  61683. };
  61684. ApplyRedirects.prototype.expandSegmentAgainstRouteUsingRedirect = function (ngModule, segmentGroup, routes, route, segments, outlet) {
  61685. if (route.path === '**') {
  61686. return this.expandWildCardWithParamsAgainstRouteUsingRedirect(ngModule, routes, route, outlet);
  61687. }
  61688. return this.expandRegularSegmentAgainstRouteUsingRedirect(ngModule, segmentGroup, routes, route, segments, outlet);
  61689. };
  61690. ApplyRedirects.prototype.expandWildCardWithParamsAgainstRouteUsingRedirect = function (ngModule, routes, route, outlet) {
  61691. var _this = this;
  61692. var newTree = this.applyRedirectCommands([], route.redirectTo, {});
  61693. if (route.redirectTo.startsWith('/')) {
  61694. return absoluteRedirect(newTree);
  61695. }
  61696. return this.lineralizeSegments(route, newTree).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (newSegments) {
  61697. var group = new UrlSegmentGroup(newSegments, {});
  61698. return _this.expandSegment(ngModule, group, routes, newSegments, outlet, false);
  61699. }));
  61700. };
  61701. ApplyRedirects.prototype.expandRegularSegmentAgainstRouteUsingRedirect = function (ngModule, segmentGroup, routes, route, segments, outlet) {
  61702. var _this = this;
  61703. var _a = match(segmentGroup, route, segments), matched = _a.matched, consumedSegments = _a.consumedSegments, lastChild = _a.lastChild, positionalParamSegments = _a.positionalParamSegments;
  61704. if (!matched)
  61705. return noMatch(segmentGroup);
  61706. var newTree = this.applyRedirectCommands(consumedSegments, route.redirectTo, positionalParamSegments);
  61707. if (route.redirectTo.startsWith('/')) {
  61708. return absoluteRedirect(newTree);
  61709. }
  61710. return this.lineralizeSegments(route, newTree).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (newSegments) {
  61711. return _this.expandSegment(ngModule, segmentGroup, routes, newSegments.concat(segments.slice(lastChild)), outlet, false);
  61712. }));
  61713. };
  61714. ApplyRedirects.prototype.matchSegmentAgainstRoute = function (ngModule, rawSegmentGroup, route, segments) {
  61715. var _this = this;
  61716. if (route.path === '**') {
  61717. if (route.loadChildren) {
  61718. return this.configLoader.load(ngModule.injector, route)
  61719. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (cfg) {
  61720. route._loadedConfig = cfg;
  61721. return new UrlSegmentGroup(segments, {});
  61722. }));
  61723. }
  61724. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new UrlSegmentGroup(segments, {}));
  61725. }
  61726. var _a = match(rawSegmentGroup, route, segments), matched = _a.matched, consumedSegments = _a.consumedSegments, lastChild = _a.lastChild;
  61727. if (!matched)
  61728. return noMatch(rawSegmentGroup);
  61729. var rawSlicedSegments = segments.slice(lastChild);
  61730. var childConfig$ = this.getChildConfig(ngModule, route);
  61731. return childConfig$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (routerConfig) {
  61732. var childModule = routerConfig.module;
  61733. var childConfig = routerConfig.routes;
  61734. var _a = split(rawSegmentGroup, consumedSegments, rawSlicedSegments, childConfig), segmentGroup = _a.segmentGroup, slicedSegments = _a.slicedSegments;
  61735. if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
  61736. var expanded$_1 = _this.expandChildren(childModule, childConfig, segmentGroup);
  61737. return expanded$_1.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (children) { return new UrlSegmentGroup(consumedSegments, children); }));
  61738. }
  61739. if (childConfig.length === 0 && slicedSegments.length === 0) {
  61740. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new UrlSegmentGroup(consumedSegments, {}));
  61741. }
  61742. var expanded$ = _this.expandSegment(childModule, segmentGroup, childConfig, slicedSegments, PRIMARY_OUTLET, true);
  61743. return expanded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (cs) {
  61744. return new UrlSegmentGroup(consumedSegments.concat(cs.segments), cs.children);
  61745. }));
  61746. }));
  61747. };
  61748. ApplyRedirects.prototype.getChildConfig = function (ngModule, route) {
  61749. var _this = this;
  61750. if (route.children) {
  61751. // The children belong to the same module
  61752. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new LoadedRouterConfig(route.children, ngModule));
  61753. }
  61754. if (route.loadChildren) {
  61755. // lazy children belong to the loaded module
  61756. if (route._loadedConfig !== undefined) {
  61757. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(route._loadedConfig);
  61758. }
  61759. return runCanLoadGuard(ngModule.injector, route).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (shouldLoad) {
  61760. if (shouldLoad) {
  61761. return _this.configLoader.load(ngModule.injector, route)
  61762. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (cfg) {
  61763. route._loadedConfig = cfg;
  61764. return cfg;
  61765. }));
  61766. }
  61767. return canLoadFails(route);
  61768. }));
  61769. }
  61770. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(new LoadedRouterConfig([], ngModule));
  61771. };
  61772. ApplyRedirects.prototype.lineralizeSegments = function (route, urlTree) {
  61773. var res = [];
  61774. var c = urlTree.root;
  61775. while (true) {
  61776. res = res.concat(c.segments);
  61777. if (c.numberOfChildren === 0) {
  61778. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(res);
  61779. }
  61780. if (c.numberOfChildren > 1 || !c.children[PRIMARY_OUTLET]) {
  61781. return namedOutletsRedirect(route.redirectTo);
  61782. }
  61783. c = c.children[PRIMARY_OUTLET];
  61784. }
  61785. };
  61786. ApplyRedirects.prototype.applyRedirectCommands = function (segments, redirectTo, posParams) {
  61787. return this.applyRedirectCreatreUrlTree(redirectTo, this.urlSerializer.parse(redirectTo), segments, posParams);
  61788. };
  61789. ApplyRedirects.prototype.applyRedirectCreatreUrlTree = function (redirectTo, urlTree, segments, posParams) {
  61790. var newRoot = this.createSegmentGroup(redirectTo, urlTree.root, segments, posParams);
  61791. return new UrlTree(newRoot, this.createQueryParams(urlTree.queryParams, this.urlTree.queryParams), urlTree.fragment);
  61792. };
  61793. ApplyRedirects.prototype.createQueryParams = function (redirectToParams, actualParams) {
  61794. var res = {};
  61795. forEach(redirectToParams, function (v, k) {
  61796. var copySourceValue = typeof v === 'string' && v.startsWith(':');
  61797. if (copySourceValue) {
  61798. var sourceName = v.substring(1);
  61799. res[k] = actualParams[sourceName];
  61800. }
  61801. else {
  61802. res[k] = v;
  61803. }
  61804. });
  61805. return res;
  61806. };
  61807. ApplyRedirects.prototype.createSegmentGroup = function (redirectTo, group, segments, posParams) {
  61808. var _this = this;
  61809. var updatedSegments = this.createSegments(redirectTo, group.segments, segments, posParams);
  61810. var children = {};
  61811. forEach(group.children, function (child, name) {
  61812. children[name] = _this.createSegmentGroup(redirectTo, child, segments, posParams);
  61813. });
  61814. return new UrlSegmentGroup(updatedSegments, children);
  61815. };
  61816. ApplyRedirects.prototype.createSegments = function (redirectTo, redirectToSegments, actualSegments, posParams) {
  61817. var _this = this;
  61818. return redirectToSegments.map(function (s) { return s.path.startsWith(':') ? _this.findPosParam(redirectTo, s, posParams) :
  61819. _this.findOrReturn(s, actualSegments); });
  61820. };
  61821. ApplyRedirects.prototype.findPosParam = function (redirectTo, redirectToUrlSegment, posParams) {
  61822. var pos = posParams[redirectToUrlSegment.path.substring(1)];
  61823. if (!pos)
  61824. throw new Error("Cannot redirect to '" + redirectTo + "'. Cannot find '" + redirectToUrlSegment.path + "'.");
  61825. return pos;
  61826. };
  61827. ApplyRedirects.prototype.findOrReturn = function (redirectToUrlSegment, actualSegments) {
  61828. var e_1, _a;
  61829. var idx = 0;
  61830. try {
  61831. for (var actualSegments_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(actualSegments), actualSegments_1_1 = actualSegments_1.next(); !actualSegments_1_1.done; actualSegments_1_1 = actualSegments_1.next()) {
  61832. var s = actualSegments_1_1.value;
  61833. if (s.path === redirectToUrlSegment.path) {
  61834. actualSegments.splice(idx);
  61835. return s;
  61836. }
  61837. idx++;
  61838. }
  61839. }
  61840. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  61841. finally {
  61842. try {
  61843. if (actualSegments_1_1 && !actualSegments_1_1.done && (_a = actualSegments_1.return)) _a.call(actualSegments_1);
  61844. }
  61845. finally { if (e_1) throw e_1.error; }
  61846. }
  61847. return redirectToUrlSegment;
  61848. };
  61849. return ApplyRedirects;
  61850. }());
  61851. function runCanLoadGuard(moduleInjector, route) {
  61852. var canLoad = route.canLoad;
  61853. if (!canLoad || canLoad.length === 0)
  61854. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true);
  61855. var obs = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(canLoad).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (injectionToken) {
  61856. var guard = moduleInjector.get(injectionToken);
  61857. return wrapIntoObservable(guard.canLoad ? guard.canLoad(route) : guard(route));
  61858. }));
  61859. return andObservables(obs);
  61860. }
  61861. function match(segmentGroup, route, segments) {
  61862. if (route.path === '') {
  61863. if ((route.pathMatch === 'full') && (segmentGroup.hasChildren() || segments.length > 0)) {
  61864. return { matched: false, consumedSegments: [], lastChild: 0, positionalParamSegments: {} };
  61865. }
  61866. return { matched: true, consumedSegments: [], lastChild: 0, positionalParamSegments: {} };
  61867. }
  61868. var matcher = route.matcher || defaultUrlMatcher;
  61869. var res = matcher(segments, segmentGroup, route);
  61870. if (!res) {
  61871. return {
  61872. matched: false,
  61873. consumedSegments: [],
  61874. lastChild: 0,
  61875. positionalParamSegments: {},
  61876. };
  61877. }
  61878. return {
  61879. matched: true,
  61880. consumedSegments: res.consumed,
  61881. lastChild: res.consumed.length,
  61882. positionalParamSegments: res.posParams,
  61883. };
  61884. }
  61885. function split(segmentGroup, consumedSegments, slicedSegments, config) {
  61886. if (slicedSegments.length > 0 &&
  61887. containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, slicedSegments, config)) {
  61888. var s = new UrlSegmentGroup(consumedSegments, createChildrenForEmptySegments(config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
  61889. return { segmentGroup: mergeTrivialChildren(s), slicedSegments: [] };
  61890. }
  61891. if (slicedSegments.length === 0 &&
  61892. containsEmptyPathRedirects(segmentGroup, slicedSegments, config)) {
  61893. var s = new UrlSegmentGroup(segmentGroup.segments, addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, config, segmentGroup.children));
  61894. return { segmentGroup: mergeTrivialChildren(s), slicedSegments: slicedSegments };
  61895. }
  61896. return { segmentGroup: segmentGroup, slicedSegments: slicedSegments };
  61897. }
  61898. function mergeTrivialChildren(s) {
  61899. if (s.numberOfChildren === 1 && s.children[PRIMARY_OUTLET]) {
  61900. var c = s.children[PRIMARY_OUTLET];
  61901. return new UrlSegmentGroup(s.segments.concat(c.segments), c.children);
  61902. }
  61903. return s;
  61904. }
  61905. function addEmptySegmentsToChildrenIfNeeded(segmentGroup, slicedSegments, routes, children) {
  61906. var e_2, _a;
  61907. var res = {};
  61908. try {
  61909. for (var routes_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
  61910. var r = routes_1_1.value;
  61911. if (isEmptyPathRedirect(segmentGroup, slicedSegments, r) && !children[getOutlet(r)]) {
  61912. res[getOutlet(r)] = new UrlSegmentGroup([], {});
  61913. }
  61914. }
  61915. }
  61916. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  61917. finally {
  61918. try {
  61919. if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
  61920. }
  61921. finally { if (e_2) throw e_2.error; }
  61922. }
  61923. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, children, res);
  61924. }
  61925. function createChildrenForEmptySegments(routes, primarySegmentGroup) {
  61926. var e_3, _a;
  61927. var res = {};
  61928. res[PRIMARY_OUTLET] = primarySegmentGroup;
  61929. try {
  61930. for (var routes_2 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(routes), routes_2_1 = routes_2.next(); !routes_2_1.done; routes_2_1 = routes_2.next()) {
  61931. var r = routes_2_1.value;
  61932. if (r.path === '' && getOutlet(r) !== PRIMARY_OUTLET) {
  61933. res[getOutlet(r)] = new UrlSegmentGroup([], {});
  61934. }
  61935. }
  61936. }
  61937. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  61938. finally {
  61939. try {
  61940. if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
  61941. }
  61942. finally { if (e_3) throw e_3.error; }
  61943. }
  61944. return res;
  61945. }
  61946. function containsEmptyPathRedirectsWithNamedOutlets(segmentGroup, segments, routes) {
  61947. return routes.some(function (r) { return isEmptyPathRedirect(segmentGroup, segments, r) && getOutlet(r) !== PRIMARY_OUTLET; });
  61948. }
  61949. function containsEmptyPathRedirects(segmentGroup, segments, routes) {
  61950. return routes.some(function (r) { return isEmptyPathRedirect(segmentGroup, segments, r); });
  61951. }
  61952. function isEmptyPathRedirect(segmentGroup, segments, r) {
  61953. if ((segmentGroup.hasChildren() || segments.length > 0) && r.pathMatch === 'full') {
  61954. return false;
  61955. }
  61956. return r.path === '' && r.redirectTo !== undefined;
  61957. }
  61958. function getOutlet(route) {
  61959. return route.outlet || PRIMARY_OUTLET;
  61960. }
  61961. /**
  61962. * @license
  61963. * Copyright Google Inc. All Rights Reserved.
  61964. *
  61965. * Use of this source code is governed by an MIT-style license that can be
  61966. * found in the LICENSE file at https://angular.io/license
  61967. */
  61968. var Tree = /** @class */ (function () {
  61969. function Tree(root) {
  61970. this._root = root;
  61971. }
  61972. Object.defineProperty(Tree.prototype, "root", {
  61973. get: function () { return this._root.value; },
  61974. enumerable: true,
  61975. configurable: true
  61976. });
  61977. /**
  61978. * @internal
  61979. */
  61980. Tree.prototype.parent = function (t) {
  61981. var p = this.pathFromRoot(t);
  61982. return p.length > 1 ? p[p.length - 2] : null;
  61983. };
  61984. /**
  61985. * @internal
  61986. */
  61987. Tree.prototype.children = function (t) {
  61988. var n = findNode(t, this._root);
  61989. return n ? n.children.map(function (t) { return t.value; }) : [];
  61990. };
  61991. /**
  61992. * @internal
  61993. */
  61994. Tree.prototype.firstChild = function (t) {
  61995. var n = findNode(t, this._root);
  61996. return n && n.children.length > 0 ? n.children[0].value : null;
  61997. };
  61998. /**
  61999. * @internal
  62000. */
  62001. Tree.prototype.siblings = function (t) {
  62002. var p = findPath(t, this._root);
  62003. if (p.length < 2)
  62004. return [];
  62005. var c = p[p.length - 2].children.map(function (c) { return c.value; });
  62006. return c.filter(function (cc) { return cc !== t; });
  62007. };
  62008. /**
  62009. * @internal
  62010. */
  62011. Tree.prototype.pathFromRoot = function (t) { return findPath(t, this._root).map(function (s) { return s.value; }); };
  62012. return Tree;
  62013. }());
  62014. // DFS for the node matching the value
  62015. function findNode(value, node) {
  62016. var e_1, _a;
  62017. if (value === node.value)
  62018. return node;
  62019. try {
  62020. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
  62021. var child = _c.value;
  62022. var node_1 = findNode(value, child);
  62023. if (node_1)
  62024. return node_1;
  62025. }
  62026. }
  62027. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  62028. finally {
  62029. try {
  62030. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  62031. }
  62032. finally { if (e_1) throw e_1.error; }
  62033. }
  62034. return null;
  62035. }
  62036. // Return the path to the node with the given value using DFS
  62037. function findPath(value, node) {
  62038. var e_2, _a;
  62039. if (value === node.value)
  62040. return [node];
  62041. try {
  62042. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(node.children), _c = _b.next(); !_c.done; _c = _b.next()) {
  62043. var child = _c.value;
  62044. var path = findPath(value, child);
  62045. if (path.length) {
  62046. path.unshift(node);
  62047. return path;
  62048. }
  62049. }
  62050. }
  62051. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  62052. finally {
  62053. try {
  62054. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  62055. }
  62056. finally { if (e_2) throw e_2.error; }
  62057. }
  62058. return [];
  62059. }
  62060. var TreeNode = /** @class */ (function () {
  62061. function TreeNode(value, children) {
  62062. this.value = value;
  62063. this.children = children;
  62064. }
  62065. TreeNode.prototype.toString = function () { return "TreeNode(" + this.value + ")"; };
  62066. return TreeNode;
  62067. }());
  62068. // Return the list of T indexed by outlet name
  62069. function nodeChildrenAsMap(node) {
  62070. var map$$1 = {};
  62071. if (node) {
  62072. node.children.forEach(function (child) { return map$$1[child.value.outlet] = child; });
  62073. }
  62074. return map$$1;
  62075. }
  62076. /**
  62077. * @license
  62078. * Copyright Google Inc. All Rights Reserved.
  62079. *
  62080. * Use of this source code is governed by an MIT-style license that can be
  62081. * found in the LICENSE file at https://angular.io/license
  62082. */
  62083. /**
  62084. * @description
  62085. *
  62086. * Represents the state of the router.
  62087. *
  62088. * RouterState is a tree of activated routes. Every node in this tree knows about the "consumed" URL
  62089. * segments, the extracted parameters, and the resolved data.
  62090. *
  62091. * @usageNotes
  62092. * ### Example
  62093. *
  62094. * ```
  62095. * @Component({templateUrl:'template.html'})
  62096. * class MyComponent {
  62097. * constructor(router: Router) {
  62098. * const state: RouterState = router.routerState;
  62099. * const root: ActivatedRoute = state.root;
  62100. * const child = root.firstChild;
  62101. * const id: Observable<string> = child.params.map(p => p.id);
  62102. * //...
  62103. * }
  62104. * }
  62105. * ```
  62106. *
  62107. * See `ActivatedRoute` for more information.
  62108. *
  62109. *
  62110. */
  62111. var RouterState = /** @class */ (function (_super) {
  62112. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(RouterState, _super);
  62113. /** @internal */
  62114. function RouterState(root,
  62115. /** The current snapshot of the router state */
  62116. snapshot) {
  62117. var _this = _super.call(this, root) || this;
  62118. _this.snapshot = snapshot;
  62119. setRouterState(_this, root);
  62120. return _this;
  62121. }
  62122. RouterState.prototype.toString = function () { return this.snapshot.toString(); };
  62123. return RouterState;
  62124. }(Tree));
  62125. function createEmptyState(urlTree, rootComponent) {
  62126. var snapshot = createEmptyStateSnapshot(urlTree, rootComponent);
  62127. var emptyUrl = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]([new UrlSegment('', {})]);
  62128. var emptyParams = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({});
  62129. var emptyData = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({});
  62130. var emptyQueryParams = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]({});
  62131. var fragment = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"]('');
  62132. var activated = new ActivatedRoute(emptyUrl, emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, snapshot.root);
  62133. activated.snapshot = snapshot.root;
  62134. return new RouterState(new TreeNode(activated, []), snapshot);
  62135. }
  62136. function createEmptyStateSnapshot(urlTree, rootComponent) {
  62137. var emptyParams = {};
  62138. var emptyData = {};
  62139. var emptyQueryParams = {};
  62140. var fragment = '';
  62141. var activated = new ActivatedRouteSnapshot([], emptyParams, emptyQueryParams, fragment, emptyData, PRIMARY_OUTLET, rootComponent, null, urlTree.root, -1, {});
  62142. return new RouterStateSnapshot('', new TreeNode(activated, []));
  62143. }
  62144. /**
  62145. * @description
  62146. *
  62147. * Contains the information about a route associated with a component loaded in an
  62148. * outlet. An `ActivatedRoute` can also be used to traverse the router state tree.
  62149. *
  62150. * ```
  62151. * @Component({...})
  62152. * class MyComponent {
  62153. * constructor(route: ActivatedRoute) {
  62154. * const id: Observable<string> = route.params.map(p => p.id);
  62155. * const url: Observable<string> = route.url.map(segments => segments.join(''));
  62156. * // route.data includes both `data` and `resolve`
  62157. * const user = route.data.map(d => d.user);
  62158. * }
  62159. * }
  62160. * ```
  62161. *
  62162. *
  62163. */
  62164. var ActivatedRoute = /** @class */ (function () {
  62165. /** @internal */
  62166. function ActivatedRoute(
  62167. /** An observable of the URL segments matched by this route */
  62168. url,
  62169. /** An observable of the matrix parameters scoped to this route */
  62170. params,
  62171. /** An observable of the query parameters shared by all the routes */
  62172. queryParams,
  62173. /** An observable of the URL fragment shared by all the routes */
  62174. fragment,
  62175. /** An observable of the static and resolved data of this route. */
  62176. data,
  62177. /** The outlet name of the route. It's a constant */
  62178. outlet,
  62179. /** The component of the route. It's a constant */
  62180. // TODO(vsavkin): remove |string
  62181. component, futureSnapshot) {
  62182. this.url = url;
  62183. this.params = params;
  62184. this.queryParams = queryParams;
  62185. this.fragment = fragment;
  62186. this.data = data;
  62187. this.outlet = outlet;
  62188. this.component = component;
  62189. this._futureSnapshot = futureSnapshot;
  62190. }
  62191. Object.defineProperty(ActivatedRoute.prototype, "routeConfig", {
  62192. /** The configuration used to match this route */
  62193. get: function () { return this._futureSnapshot.routeConfig; },
  62194. enumerable: true,
  62195. configurable: true
  62196. });
  62197. Object.defineProperty(ActivatedRoute.prototype, "root", {
  62198. /** The root of the router state */
  62199. get: function () { return this._routerState.root; },
  62200. enumerable: true,
  62201. configurable: true
  62202. });
  62203. Object.defineProperty(ActivatedRoute.prototype, "parent", {
  62204. /** The parent of this route in the router state tree */
  62205. get: function () { return this._routerState.parent(this); },
  62206. enumerable: true,
  62207. configurable: true
  62208. });
  62209. Object.defineProperty(ActivatedRoute.prototype, "firstChild", {
  62210. /** The first child of this route in the router state tree */
  62211. get: function () { return this._routerState.firstChild(this); },
  62212. enumerable: true,
  62213. configurable: true
  62214. });
  62215. Object.defineProperty(ActivatedRoute.prototype, "children", {
  62216. /** The children of this route in the router state tree */
  62217. get: function () { return this._routerState.children(this); },
  62218. enumerable: true,
  62219. configurable: true
  62220. });
  62221. Object.defineProperty(ActivatedRoute.prototype, "pathFromRoot", {
  62222. /** The path from the root of the router state tree to this route */
  62223. get: function () { return this._routerState.pathFromRoot(this); },
  62224. enumerable: true,
  62225. configurable: true
  62226. });
  62227. Object.defineProperty(ActivatedRoute.prototype, "paramMap", {
  62228. get: function () {
  62229. if (!this._paramMap) {
  62230. this._paramMap = this.params.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (p) { return convertToParamMap(p); }));
  62231. }
  62232. return this._paramMap;
  62233. },
  62234. enumerable: true,
  62235. configurable: true
  62236. });
  62237. Object.defineProperty(ActivatedRoute.prototype, "queryParamMap", {
  62238. get: function () {
  62239. if (!this._queryParamMap) {
  62240. this._queryParamMap =
  62241. this.queryParams.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (p) { return convertToParamMap(p); }));
  62242. }
  62243. return this._queryParamMap;
  62244. },
  62245. enumerable: true,
  62246. configurable: true
  62247. });
  62248. ActivatedRoute.prototype.toString = function () {
  62249. return this.snapshot ? this.snapshot.toString() : "Future(" + this._futureSnapshot + ")";
  62250. };
  62251. return ActivatedRoute;
  62252. }());
  62253. /**
  62254. * Returns the inherited params, data, and resolve for a given route.
  62255. * By default, this only inherits values up to the nearest path-less or component-less route.
  62256. * @internal
  62257. */
  62258. function inheritedParamsDataResolve(route, paramsInheritanceStrategy) {
  62259. if (paramsInheritanceStrategy === void 0) { paramsInheritanceStrategy = 'emptyOnly'; }
  62260. var pathFromRoot = route.pathFromRoot;
  62261. var inheritingStartingFrom = 0;
  62262. if (paramsInheritanceStrategy !== 'always') {
  62263. inheritingStartingFrom = pathFromRoot.length - 1;
  62264. while (inheritingStartingFrom >= 1) {
  62265. var current = pathFromRoot[inheritingStartingFrom];
  62266. var parent_1 = pathFromRoot[inheritingStartingFrom - 1];
  62267. // current route is an empty path => inherits its parent's params and data
  62268. if (current.routeConfig && current.routeConfig.path === '') {
  62269. inheritingStartingFrom--;
  62270. // parent is componentless => current route should inherit its params and data
  62271. }
  62272. else if (!parent_1.component) {
  62273. inheritingStartingFrom--;
  62274. }
  62275. else {
  62276. break;
  62277. }
  62278. }
  62279. }
  62280. return flattenInherited(pathFromRoot.slice(inheritingStartingFrom));
  62281. }
  62282. /** @internal */
  62283. function flattenInherited(pathFromRoot) {
  62284. return pathFromRoot.reduce(function (res, curr) {
  62285. var params = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, res.params, curr.params);
  62286. var data = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, res.data, curr.data);
  62287. var resolve = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, res.resolve, curr._resolvedData);
  62288. return { params: params, data: data, resolve: resolve };
  62289. }, { params: {}, data: {}, resolve: {} });
  62290. }
  62291. /**
  62292. * @description
  62293. *
  62294. * Contains the information about a route associated with a component loaded in an
  62295. * outlet at a particular moment in time. ActivatedRouteSnapshot can also be used to
  62296. * traverse the router state tree.
  62297. *
  62298. * ```
  62299. * @Component({templateUrl:'./my-component.html'})
  62300. * class MyComponent {
  62301. * constructor(route: ActivatedRoute) {
  62302. * const id: string = route.snapshot.params.id;
  62303. * const url: string = route.snapshot.url.join('');
  62304. * const user = route.snapshot.data.user;
  62305. * }
  62306. * }
  62307. * ```
  62308. *
  62309. *
  62310. */
  62311. var ActivatedRouteSnapshot = /** @class */ (function () {
  62312. /** @internal */
  62313. function ActivatedRouteSnapshot(
  62314. /** The URL segments matched by this route */
  62315. url,
  62316. /** The matrix parameters scoped to this route */
  62317. params,
  62318. /** The query parameters shared by all the routes */
  62319. queryParams,
  62320. /** The URL fragment shared by all the routes */
  62321. fragment,
  62322. /** The static and resolved data of this route */
  62323. data,
  62324. /** The outlet name of the route */
  62325. outlet,
  62326. /** The component of the route */
  62327. component, routeConfig, urlSegment, lastPathIndex, resolve) {
  62328. this.url = url;
  62329. this.params = params;
  62330. this.queryParams = queryParams;
  62331. this.fragment = fragment;
  62332. this.data = data;
  62333. this.outlet = outlet;
  62334. this.component = component;
  62335. this.routeConfig = routeConfig;
  62336. this._urlSegment = urlSegment;
  62337. this._lastPathIndex = lastPathIndex;
  62338. this._resolve = resolve;
  62339. }
  62340. Object.defineProperty(ActivatedRouteSnapshot.prototype, "root", {
  62341. /** The root of the router state */
  62342. get: function () { return this._routerState.root; },
  62343. enumerable: true,
  62344. configurable: true
  62345. });
  62346. Object.defineProperty(ActivatedRouteSnapshot.prototype, "parent", {
  62347. /** The parent of this route in the router state tree */
  62348. get: function () { return this._routerState.parent(this); },
  62349. enumerable: true,
  62350. configurable: true
  62351. });
  62352. Object.defineProperty(ActivatedRouteSnapshot.prototype, "firstChild", {
  62353. /** The first child of this route in the router state tree */
  62354. get: function () { return this._routerState.firstChild(this); },
  62355. enumerable: true,
  62356. configurable: true
  62357. });
  62358. Object.defineProperty(ActivatedRouteSnapshot.prototype, "children", {
  62359. /** The children of this route in the router state tree */
  62360. get: function () { return this._routerState.children(this); },
  62361. enumerable: true,
  62362. configurable: true
  62363. });
  62364. Object.defineProperty(ActivatedRouteSnapshot.prototype, "pathFromRoot", {
  62365. /** The path from the root of the router state tree to this route */
  62366. get: function () { return this._routerState.pathFromRoot(this); },
  62367. enumerable: true,
  62368. configurable: true
  62369. });
  62370. Object.defineProperty(ActivatedRouteSnapshot.prototype, "paramMap", {
  62371. get: function () {
  62372. if (!this._paramMap) {
  62373. this._paramMap = convertToParamMap(this.params);
  62374. }
  62375. return this._paramMap;
  62376. },
  62377. enumerable: true,
  62378. configurable: true
  62379. });
  62380. Object.defineProperty(ActivatedRouteSnapshot.prototype, "queryParamMap", {
  62381. get: function () {
  62382. if (!this._queryParamMap) {
  62383. this._queryParamMap = convertToParamMap(this.queryParams);
  62384. }
  62385. return this._queryParamMap;
  62386. },
  62387. enumerable: true,
  62388. configurable: true
  62389. });
  62390. ActivatedRouteSnapshot.prototype.toString = function () {
  62391. var url = this.url.map(function (segment) { return segment.toString(); }).join('/');
  62392. var matched = this.routeConfig ? this.routeConfig.path : '';
  62393. return "Route(url:'" + url + "', path:'" + matched + "')";
  62394. };
  62395. return ActivatedRouteSnapshot;
  62396. }());
  62397. /**
  62398. * @description
  62399. *
  62400. * Represents the state of the router at a moment in time.
  62401. *
  62402. * This is a tree of activated route snapshots. Every node in this tree knows about
  62403. * the "consumed" URL segments, the extracted parameters, and the resolved data.
  62404. *
  62405. * @usageNotes
  62406. * ### Example
  62407. *
  62408. * ```
  62409. * @Component({templateUrl:'template.html'})
  62410. * class MyComponent {
  62411. * constructor(router: Router) {
  62412. * const state: RouterState = router.routerState;
  62413. * const snapshot: RouterStateSnapshot = state.snapshot;
  62414. * const root: ActivatedRouteSnapshot = snapshot.root;
  62415. * const child = root.firstChild;
  62416. * const id: Observable<string> = child.params.map(p => p.id);
  62417. * //...
  62418. * }
  62419. * }
  62420. * ```
  62421. *
  62422. *
  62423. */
  62424. var RouterStateSnapshot = /** @class */ (function (_super) {
  62425. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"])(RouterStateSnapshot, _super);
  62426. /** @internal */
  62427. function RouterStateSnapshot(
  62428. /** The url from which this snapshot was created */
  62429. url, root) {
  62430. var _this = _super.call(this, root) || this;
  62431. _this.url = url;
  62432. setRouterState(_this, root);
  62433. return _this;
  62434. }
  62435. RouterStateSnapshot.prototype.toString = function () { return serializeNode(this._root); };
  62436. return RouterStateSnapshot;
  62437. }(Tree));
  62438. function setRouterState(state, node) {
  62439. node.value._routerState = state;
  62440. node.children.forEach(function (c) { return setRouterState(state, c); });
  62441. }
  62442. function serializeNode(node) {
  62443. var c = node.children.length > 0 ? " { " + node.children.map(serializeNode).join(', ') + " } " : '';
  62444. return "" + node.value + c;
  62445. }
  62446. /**
  62447. * The expectation is that the activate route is created with the right set of parameters.
  62448. * So we push new values into the observables only when they are not the initial values.
  62449. * And we detect that by checking if the snapshot field is set.
  62450. */
  62451. function advanceActivatedRoute(route) {
  62452. if (route.snapshot) {
  62453. var currentSnapshot = route.snapshot;
  62454. var nextSnapshot = route._futureSnapshot;
  62455. route.snapshot = nextSnapshot;
  62456. if (!shallowEqual(currentSnapshot.queryParams, nextSnapshot.queryParams)) {
  62457. route.queryParams.next(nextSnapshot.queryParams);
  62458. }
  62459. if (currentSnapshot.fragment !== nextSnapshot.fragment) {
  62460. route.fragment.next(nextSnapshot.fragment);
  62461. }
  62462. if (!shallowEqual(currentSnapshot.params, nextSnapshot.params)) {
  62463. route.params.next(nextSnapshot.params);
  62464. }
  62465. if (!shallowEqualArrays(currentSnapshot.url, nextSnapshot.url)) {
  62466. route.url.next(nextSnapshot.url);
  62467. }
  62468. if (!shallowEqual(currentSnapshot.data, nextSnapshot.data)) {
  62469. route.data.next(nextSnapshot.data);
  62470. }
  62471. }
  62472. else {
  62473. route.snapshot = route._futureSnapshot;
  62474. // this is for resolved data
  62475. route.data.next(route._futureSnapshot.data);
  62476. }
  62477. }
  62478. function equalParamsAndUrlSegments(a, b) {
  62479. var equalUrlParams = shallowEqual(a.params, b.params) && equalSegments(a.url, b.url);
  62480. var parentsMismatch = !a.parent !== !b.parent;
  62481. return equalUrlParams && !parentsMismatch &&
  62482. (!a.parent || equalParamsAndUrlSegments(a.parent, b.parent));
  62483. }
  62484. /**
  62485. * @license
  62486. * Copyright Google Inc. All Rights Reserved.
  62487. *
  62488. * Use of this source code is governed by an MIT-style license that can be
  62489. * found in the LICENSE file at https://angular.io/license
  62490. */
  62491. function createRouterState(routeReuseStrategy, curr, prevState) {
  62492. var root = createNode(routeReuseStrategy, curr._root, prevState ? prevState._root : undefined);
  62493. return new RouterState(root, curr);
  62494. }
  62495. function createNode(routeReuseStrategy, curr, prevState) {
  62496. // reuse an activated route that is currently displayed on the screen
  62497. if (prevState && routeReuseStrategy.shouldReuseRoute(curr.value, prevState.value.snapshot)) {
  62498. var value = prevState.value;
  62499. value._futureSnapshot = curr.value;
  62500. var children = createOrReuseChildren(routeReuseStrategy, curr, prevState);
  62501. return new TreeNode(value, children);
  62502. // retrieve an activated route that is used to be displayed, but is not currently displayed
  62503. }
  62504. else {
  62505. var detachedRouteHandle = routeReuseStrategy.retrieve(curr.value);
  62506. if (detachedRouteHandle) {
  62507. var tree = detachedRouteHandle.route;
  62508. setFutureSnapshotsOfActivatedRoutes(curr, tree);
  62509. return tree;
  62510. }
  62511. else {
  62512. var value = createActivatedRoute(curr.value);
  62513. var children = curr.children.map(function (c) { return createNode(routeReuseStrategy, c); });
  62514. return new TreeNode(value, children);
  62515. }
  62516. }
  62517. }
  62518. function setFutureSnapshotsOfActivatedRoutes(curr, result) {
  62519. if (curr.value.routeConfig !== result.value.routeConfig) {
  62520. throw new Error('Cannot reattach ActivatedRouteSnapshot created from a different route');
  62521. }
  62522. if (curr.children.length !== result.children.length) {
  62523. throw new Error('Cannot reattach ActivatedRouteSnapshot with a different number of children');
  62524. }
  62525. result.value._futureSnapshot = curr.value;
  62526. for (var i = 0; i < curr.children.length; ++i) {
  62527. setFutureSnapshotsOfActivatedRoutes(curr.children[i], result.children[i]);
  62528. }
  62529. }
  62530. function createOrReuseChildren(routeReuseStrategy, curr, prevState) {
  62531. return curr.children.map(function (child) {
  62532. var e_1, _a;
  62533. try {
  62534. for (var _b = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(prevState.children), _c = _b.next(); !_c.done; _c = _b.next()) {
  62535. var p = _c.value;
  62536. if (routeReuseStrategy.shouldReuseRoute(p.value.snapshot, child.value)) {
  62537. return createNode(routeReuseStrategy, child, p);
  62538. }
  62539. }
  62540. }
  62541. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  62542. finally {
  62543. try {
  62544. if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
  62545. }
  62546. finally { if (e_1) throw e_1.error; }
  62547. }
  62548. return createNode(routeReuseStrategy, child);
  62549. });
  62550. }
  62551. function createActivatedRoute(c) {
  62552. return new ActivatedRoute(new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.url), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.params), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.queryParams), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.fragment), new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](c.data), c.outlet, c.component, c);
  62553. }
  62554. /**
  62555. * @license
  62556. * Copyright Google Inc. All Rights Reserved.
  62557. *
  62558. * Use of this source code is governed by an MIT-style license that can be
  62559. * found in the LICENSE file at https://angular.io/license
  62560. */
  62561. function createUrlTree(route, urlTree, commands, queryParams, fragment) {
  62562. if (commands.length === 0) {
  62563. return tree(urlTree.root, urlTree.root, urlTree, queryParams, fragment);
  62564. }
  62565. var nav = computeNavigation(commands);
  62566. if (nav.toRoot()) {
  62567. return tree(urlTree.root, new UrlSegmentGroup([], {}), urlTree, queryParams, fragment);
  62568. }
  62569. var startingPosition = findStartingPosition(nav, urlTree, route);
  62570. var segmentGroup = startingPosition.processChildren ?
  62571. updateSegmentGroupChildren(startingPosition.segmentGroup, startingPosition.index, nav.commands) :
  62572. updateSegmentGroup(startingPosition.segmentGroup, startingPosition.index, nav.commands);
  62573. return tree(startingPosition.segmentGroup, segmentGroup, urlTree, queryParams, fragment);
  62574. }
  62575. function isMatrixParams(command) {
  62576. return typeof command === 'object' && command != null && !command.outlets && !command.segmentPath;
  62577. }
  62578. function tree(oldSegmentGroup, newSegmentGroup, urlTree, queryParams, fragment) {
  62579. var qp = {};
  62580. if (queryParams) {
  62581. forEach(queryParams, function (value, name) {
  62582. qp[name] = Array.isArray(value) ? value.map(function (v) { return "" + v; }) : "" + value;
  62583. });
  62584. }
  62585. if (urlTree.root === oldSegmentGroup) {
  62586. return new UrlTree(newSegmentGroup, qp, fragment);
  62587. }
  62588. return new UrlTree(replaceSegment(urlTree.root, oldSegmentGroup, newSegmentGroup), qp, fragment);
  62589. }
  62590. function replaceSegment(current, oldSegment, newSegment) {
  62591. var children = {};
  62592. forEach(current.children, function (c, outletName) {
  62593. if (c === oldSegment) {
  62594. children[outletName] = newSegment;
  62595. }
  62596. else {
  62597. children[outletName] = replaceSegment(c, oldSegment, newSegment);
  62598. }
  62599. });
  62600. return new UrlSegmentGroup(current.segments, children);
  62601. }
  62602. var Navigation = /** @class */ (function () {
  62603. function Navigation(isAbsolute, numberOfDoubleDots, commands) {
  62604. this.isAbsolute = isAbsolute;
  62605. this.numberOfDoubleDots = numberOfDoubleDots;
  62606. this.commands = commands;
  62607. if (isAbsolute && commands.length > 0 && isMatrixParams(commands[0])) {
  62608. throw new Error('Root segment cannot have matrix parameters');
  62609. }
  62610. var cmdWithOutlet = commands.find(function (c) { return typeof c === 'object' && c != null && c.outlets; });
  62611. if (cmdWithOutlet && cmdWithOutlet !== last$1(commands)) {
  62612. throw new Error('{outlets:{}} has to be the last command');
  62613. }
  62614. }
  62615. Navigation.prototype.toRoot = function () {
  62616. return this.isAbsolute && this.commands.length === 1 && this.commands[0] == '/';
  62617. };
  62618. return Navigation;
  62619. }());
  62620. /** Transforms commands to a normalized `Navigation` */
  62621. function computeNavigation(commands) {
  62622. if ((typeof commands[0] === 'string') && commands.length === 1 && commands[0] === '/') {
  62623. return new Navigation(true, 0, commands);
  62624. }
  62625. var numberOfDoubleDots = 0;
  62626. var isAbsolute = false;
  62627. var res = commands.reduce(function (res, cmd, cmdIdx) {
  62628. if (typeof cmd === 'object' && cmd != null) {
  62629. if (cmd.outlets) {
  62630. var outlets_1 = {};
  62631. forEach(cmd.outlets, function (commands, name) {
  62632. outlets_1[name] = typeof commands === 'string' ? commands.split('/') : commands;
  62633. });
  62634. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(res, [{ outlets: outlets_1 }]);
  62635. }
  62636. if (cmd.segmentPath) {
  62637. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(res, [cmd.segmentPath]);
  62638. }
  62639. }
  62640. if (!(typeof cmd === 'string')) {
  62641. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(res, [cmd]);
  62642. }
  62643. if (cmdIdx === 0) {
  62644. cmd.split('/').forEach(function (urlPart, partIndex) {
  62645. if (partIndex == 0 && urlPart === '.') ;
  62646. else if (partIndex == 0 && urlPart === '') { // '/a'
  62647. isAbsolute = true;
  62648. }
  62649. else if (urlPart === '..') { // '../a'
  62650. numberOfDoubleDots++;
  62651. }
  62652. else if (urlPart != '') {
  62653. res.push(urlPart);
  62654. }
  62655. });
  62656. return res;
  62657. }
  62658. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__spread"])(res, [cmd]);
  62659. }, []);
  62660. return new Navigation(isAbsolute, numberOfDoubleDots, res);
  62661. }
  62662. var Position = /** @class */ (function () {
  62663. function Position(segmentGroup, processChildren, index) {
  62664. this.segmentGroup = segmentGroup;
  62665. this.processChildren = processChildren;
  62666. this.index = index;
  62667. }
  62668. return Position;
  62669. }());
  62670. function findStartingPosition(nav, tree, route) {
  62671. if (nav.isAbsolute) {
  62672. return new Position(tree.root, true, 0);
  62673. }
  62674. if (route.snapshot._lastPathIndex === -1) {
  62675. return new Position(route.snapshot._urlSegment, true, 0);
  62676. }
  62677. var modifier = isMatrixParams(nav.commands[0]) ? 0 : 1;
  62678. var index = route.snapshot._lastPathIndex + modifier;
  62679. return createPositionApplyingDoubleDots(route.snapshot._urlSegment, index, nav.numberOfDoubleDots);
  62680. }
  62681. function createPositionApplyingDoubleDots(group, index, numberOfDoubleDots) {
  62682. var g = group;
  62683. var ci = index;
  62684. var dd = numberOfDoubleDots;
  62685. while (dd > ci) {
  62686. dd -= ci;
  62687. g = g.parent;
  62688. if (!g) {
  62689. throw new Error('Invalid number of \'../\'');
  62690. }
  62691. ci = g.segments.length;
  62692. }
  62693. return new Position(g, false, ci - dd);
  62694. }
  62695. function getPath(command) {
  62696. if (typeof command === 'object' && command != null && command.outlets) {
  62697. return command.outlets[PRIMARY_OUTLET];
  62698. }
  62699. return "" + command;
  62700. }
  62701. function getOutlets(commands) {
  62702. var _a, _b;
  62703. if (!(typeof commands[0] === 'object'))
  62704. return _a = {}, _a[PRIMARY_OUTLET] = commands, _a;
  62705. if (commands[0].outlets === undefined)
  62706. return _b = {}, _b[PRIMARY_OUTLET] = commands, _b;
  62707. return commands[0].outlets;
  62708. }
  62709. function updateSegmentGroup(segmentGroup, startIndex, commands) {
  62710. if (!segmentGroup) {
  62711. segmentGroup = new UrlSegmentGroup([], {});
  62712. }
  62713. if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
  62714. return updateSegmentGroupChildren(segmentGroup, startIndex, commands);
  62715. }
  62716. var m = prefixedWith(segmentGroup, startIndex, commands);
  62717. var slicedCommands = commands.slice(m.commandIndex);
  62718. if (m.match && m.pathIndex < segmentGroup.segments.length) {
  62719. var g = new UrlSegmentGroup(segmentGroup.segments.slice(0, m.pathIndex), {});
  62720. g.children[PRIMARY_OUTLET] =
  62721. new UrlSegmentGroup(segmentGroup.segments.slice(m.pathIndex), segmentGroup.children);
  62722. return updateSegmentGroupChildren(g, 0, slicedCommands);
  62723. }
  62724. else if (m.match && slicedCommands.length === 0) {
  62725. return new UrlSegmentGroup(segmentGroup.segments, {});
  62726. }
  62727. else if (m.match && !segmentGroup.hasChildren()) {
  62728. return createNewSegmentGroup(segmentGroup, startIndex, commands);
  62729. }
  62730. else if (m.match) {
  62731. return updateSegmentGroupChildren(segmentGroup, 0, slicedCommands);
  62732. }
  62733. else {
  62734. return createNewSegmentGroup(segmentGroup, startIndex, commands);
  62735. }
  62736. }
  62737. function updateSegmentGroupChildren(segmentGroup, startIndex, commands) {
  62738. if (commands.length === 0) {
  62739. return new UrlSegmentGroup(segmentGroup.segments, {});
  62740. }
  62741. else {
  62742. var outlets_2 = getOutlets(commands);
  62743. var children_1 = {};
  62744. forEach(outlets_2, function (commands, outlet) {
  62745. if (commands !== null) {
  62746. children_1[outlet] = updateSegmentGroup(segmentGroup.children[outlet], startIndex, commands);
  62747. }
  62748. });
  62749. forEach(segmentGroup.children, function (child, childOutlet) {
  62750. if (outlets_2[childOutlet] === undefined) {
  62751. children_1[childOutlet] = child;
  62752. }
  62753. });
  62754. return new UrlSegmentGroup(segmentGroup.segments, children_1);
  62755. }
  62756. }
  62757. function prefixedWith(segmentGroup, startIndex, commands) {
  62758. var currentCommandIndex = 0;
  62759. var currentPathIndex = startIndex;
  62760. var noMatch = { match: false, pathIndex: 0, commandIndex: 0 };
  62761. while (currentPathIndex < segmentGroup.segments.length) {
  62762. if (currentCommandIndex >= commands.length)
  62763. return noMatch;
  62764. var path = segmentGroup.segments[currentPathIndex];
  62765. var curr = getPath(commands[currentCommandIndex]);
  62766. var next = currentCommandIndex < commands.length - 1 ? commands[currentCommandIndex + 1] : null;
  62767. if (currentPathIndex > 0 && curr === undefined)
  62768. break;
  62769. if (curr && next && (typeof next === 'object') && next.outlets === undefined) {
  62770. if (!compare(curr, next, path))
  62771. return noMatch;
  62772. currentCommandIndex += 2;
  62773. }
  62774. else {
  62775. if (!compare(curr, {}, path))
  62776. return noMatch;
  62777. currentCommandIndex++;
  62778. }
  62779. currentPathIndex++;
  62780. }
  62781. return { match: true, pathIndex: currentPathIndex, commandIndex: currentCommandIndex };
  62782. }
  62783. function createNewSegmentGroup(segmentGroup, startIndex, commands) {
  62784. var paths = segmentGroup.segments.slice(0, startIndex);
  62785. var i = 0;
  62786. while (i < commands.length) {
  62787. if (typeof commands[i] === 'object' && commands[i].outlets !== undefined) {
  62788. var children = createNewSegmentChildren(commands[i].outlets);
  62789. return new UrlSegmentGroup(paths, children);
  62790. }
  62791. // if we start with an object literal, we need to reuse the path part from the segment
  62792. if (i === 0 && isMatrixParams(commands[0])) {
  62793. var p = segmentGroup.segments[startIndex];
  62794. paths.push(new UrlSegment(p.path, commands[0]));
  62795. i++;
  62796. continue;
  62797. }
  62798. var curr = getPath(commands[i]);
  62799. var next = (i < commands.length - 1) ? commands[i + 1] : null;
  62800. if (curr && next && isMatrixParams(next)) {
  62801. paths.push(new UrlSegment(curr, stringify(next)));
  62802. i += 2;
  62803. }
  62804. else {
  62805. paths.push(new UrlSegment(curr, {}));
  62806. i++;
  62807. }
  62808. }
  62809. return new UrlSegmentGroup(paths, {});
  62810. }
  62811. function createNewSegmentChildren(outlets) {
  62812. var children = {};
  62813. forEach(outlets, function (commands, outlet) {
  62814. if (commands !== null) {
  62815. children[outlet] = createNewSegmentGroup(new UrlSegmentGroup([], {}), 0, commands);
  62816. }
  62817. });
  62818. return children;
  62819. }
  62820. function stringify(params) {
  62821. var res = {};
  62822. forEach(params, function (v, k) { return res[k] = "" + v; });
  62823. return res;
  62824. }
  62825. function compare(path, params, segment) {
  62826. return path == segment.path && shallowEqual(params, segment.parameters);
  62827. }
  62828. /**
  62829. * @license
  62830. * Copyright Google Inc. All Rights Reserved.
  62831. *
  62832. * Use of this source code is governed by an MIT-style license that can be
  62833. * found in the LICENSE file at https://angular.io/license
  62834. */
  62835. var CanActivate = /** @class */ (function () {
  62836. function CanActivate(path) {
  62837. this.path = path;
  62838. this.route = this.path[this.path.length - 1];
  62839. }
  62840. return CanActivate;
  62841. }());
  62842. var CanDeactivate = /** @class */ (function () {
  62843. function CanDeactivate(component, route) {
  62844. this.component = component;
  62845. this.route = route;
  62846. }
  62847. return CanDeactivate;
  62848. }());
  62849. /**
  62850. * This class bundles the actions involved in preactivation of a route.
  62851. */
  62852. var PreActivation = /** @class */ (function () {
  62853. function PreActivation(future, curr, moduleInjector, forwardEvent) {
  62854. this.future = future;
  62855. this.curr = curr;
  62856. this.moduleInjector = moduleInjector;
  62857. this.forwardEvent = forwardEvent;
  62858. this.canActivateChecks = [];
  62859. this.canDeactivateChecks = [];
  62860. }
  62861. PreActivation.prototype.initialize = function (parentContexts) {
  62862. var futureRoot = this.future._root;
  62863. var currRoot = this.curr ? this.curr._root : null;
  62864. this.setupChildRouteGuards(futureRoot, currRoot, parentContexts, [futureRoot.value]);
  62865. };
  62866. PreActivation.prototype.checkGuards = function () {
  62867. var _this = this;
  62868. if (!this.isDeactivating() && !this.isActivating()) {
  62869. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true);
  62870. }
  62871. var canDeactivate$ = this.runCanDeactivateChecks();
  62872. return canDeactivate$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (canDeactivate) { return canDeactivate ? _this.runCanActivateChecks() : Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(false); }));
  62873. };
  62874. PreActivation.prototype.resolveData = function (paramsInheritanceStrategy) {
  62875. var _this = this;
  62876. if (!this.isActivating())
  62877. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null);
  62878. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(this.canActivateChecks)
  62879. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])(function (check) { return _this.runResolve(check.route, paramsInheritanceStrategy); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["reduce"])(function (_, __) { return _; }));
  62880. };
  62881. PreActivation.prototype.isDeactivating = function () { return this.canDeactivateChecks.length !== 0; };
  62882. PreActivation.prototype.isActivating = function () { return this.canActivateChecks.length !== 0; };
  62883. /**
  62884. * Iterates over child routes and calls recursive `setupRouteGuards` to get `this` instance in
  62885. * proper state to run `checkGuards()` method.
  62886. */
  62887. PreActivation.prototype.setupChildRouteGuards = function (futureNode, currNode, contexts, futurePath) {
  62888. var _this = this;
  62889. var prevChildren = nodeChildrenAsMap(currNode);
  62890. // Process the children of the future route
  62891. futureNode.children.forEach(function (c) {
  62892. _this.setupRouteGuards(c, prevChildren[c.value.outlet], contexts, futurePath.concat([c.value]));
  62893. delete prevChildren[c.value.outlet];
  62894. });
  62895. // Process any children left from the current route (not active for the future route)
  62896. forEach(prevChildren, function (v, k) {
  62897. return _this.deactivateRouteAndItsChildren(v, contexts.getContext(k));
  62898. });
  62899. };
  62900. /**
  62901. * Iterates over child routes and calls recursive `setupRouteGuards` to get `this` instance in
  62902. * proper state to run `checkGuards()` method.
  62903. */
  62904. PreActivation.prototype.setupRouteGuards = function (futureNode, currNode, parentContexts, futurePath) {
  62905. var future = futureNode.value;
  62906. var curr = currNode ? currNode.value : null;
  62907. var context = parentContexts ? parentContexts.getContext(futureNode.value.outlet) : null;
  62908. // reusing the node
  62909. if (curr && future.routeConfig === curr.routeConfig) {
  62910. var shouldRunGuardsAndResolvers = this.shouldRunGuardsAndResolvers(curr, future, future.routeConfig.runGuardsAndResolvers);
  62911. if (shouldRunGuardsAndResolvers) {
  62912. this.canActivateChecks.push(new CanActivate(futurePath));
  62913. }
  62914. else {
  62915. // we need to set the data
  62916. future.data = curr.data;
  62917. future._resolvedData = curr._resolvedData;
  62918. }
  62919. // If we have a component, we need to go through an outlet.
  62920. if (future.component) {
  62921. this.setupChildRouteGuards(futureNode, currNode, context ? context.children : null, futurePath);
  62922. // if we have a componentless route, we recurse but keep the same outlet map.
  62923. }
  62924. else {
  62925. this.setupChildRouteGuards(futureNode, currNode, parentContexts, futurePath);
  62926. }
  62927. if (shouldRunGuardsAndResolvers) {
  62928. var outlet = context.outlet;
  62929. this.canDeactivateChecks.push(new CanDeactivate(outlet.component, curr));
  62930. }
  62931. }
  62932. else {
  62933. if (curr) {
  62934. this.deactivateRouteAndItsChildren(currNode, context);
  62935. }
  62936. this.canActivateChecks.push(new CanActivate(futurePath));
  62937. // If we have a component, we need to go through an outlet.
  62938. if (future.component) {
  62939. this.setupChildRouteGuards(futureNode, null, context ? context.children : null, futurePath);
  62940. // if we have a componentless route, we recurse but keep the same outlet map.
  62941. }
  62942. else {
  62943. this.setupChildRouteGuards(futureNode, null, parentContexts, futurePath);
  62944. }
  62945. }
  62946. };
  62947. PreActivation.prototype.shouldRunGuardsAndResolvers = function (curr, future, mode) {
  62948. switch (mode) {
  62949. case 'always':
  62950. return true;
  62951. case 'paramsOrQueryParamsChange':
  62952. return !equalParamsAndUrlSegments(curr, future) ||
  62953. !shallowEqual(curr.queryParams, future.queryParams);
  62954. case 'paramsChange':
  62955. default:
  62956. return !equalParamsAndUrlSegments(curr, future);
  62957. }
  62958. };
  62959. PreActivation.prototype.deactivateRouteAndItsChildren = function (route, context) {
  62960. var _this = this;
  62961. var children = nodeChildrenAsMap(route);
  62962. var r = route.value;
  62963. forEach(children, function (node, childName) {
  62964. if (!r.component) {
  62965. _this.deactivateRouteAndItsChildren(node, context);
  62966. }
  62967. else if (context) {
  62968. _this.deactivateRouteAndItsChildren(node, context.children.getContext(childName));
  62969. }
  62970. else {
  62971. _this.deactivateRouteAndItsChildren(node, null);
  62972. }
  62973. });
  62974. if (!r.component) {
  62975. this.canDeactivateChecks.push(new CanDeactivate(null, r));
  62976. }
  62977. else if (context && context.outlet && context.outlet.isActivated) {
  62978. this.canDeactivateChecks.push(new CanDeactivate(context.outlet.component, r));
  62979. }
  62980. else {
  62981. this.canDeactivateChecks.push(new CanDeactivate(null, r));
  62982. }
  62983. };
  62984. PreActivation.prototype.runCanDeactivateChecks = function () {
  62985. var _this = this;
  62986. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(this.canDeactivateChecks)
  62987. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (check) { return _this.runCanDeactivate(check.component, check.route); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["every"])(function (result) { return result === true; }));
  62988. };
  62989. PreActivation.prototype.runCanActivateChecks = function () {
  62990. var _this = this;
  62991. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(this.canActivateChecks)
  62992. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])(function (check) { return andObservables(Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])([
  62993. _this.fireChildActivationStart(check.route.parent),
  62994. _this.fireActivationStart(check.route), _this.runCanActivateChild(check.path),
  62995. _this.runCanActivate(check.route)
  62996. ])); }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["every"])(function (result) { return result === true; }));
  62997. // this.fireChildActivationStart(check.path),
  62998. };
  62999. /**
  63000. * This should fire off `ActivationStart` events for each route being activated at this
  63001. * level.
  63002. * In other words, if you're activating `a` and `b` below, `path` will contain the
  63003. * `ActivatedRouteSnapshot`s for both and we will fire `ActivationStart` for both. Always
  63004. * return
  63005. * `true` so checks continue to run.
  63006. */
  63007. PreActivation.prototype.fireActivationStart = function (snapshot) {
  63008. if (snapshot !== null && this.forwardEvent) {
  63009. this.forwardEvent(new ActivationStart(snapshot));
  63010. }
  63011. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true);
  63012. };
  63013. /**
  63014. * This should fire off `ChildActivationStart` events for each route being activated at this
  63015. * level.
  63016. * In other words, if you're activating `a` and `b` below, `path` will contain the
  63017. * `ActivatedRouteSnapshot`s for both and we will fire `ChildActivationStart` for both. Always
  63018. * return
  63019. * `true` so checks continue to run.
  63020. */
  63021. PreActivation.prototype.fireChildActivationStart = function (snapshot) {
  63022. if (snapshot !== null && this.forwardEvent) {
  63023. this.forwardEvent(new ChildActivationStart(snapshot));
  63024. }
  63025. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true);
  63026. };
  63027. PreActivation.prototype.runCanActivate = function (future) {
  63028. var _this = this;
  63029. var canActivate = future.routeConfig ? future.routeConfig.canActivate : null;
  63030. if (!canActivate || canActivate.length === 0)
  63031. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true);
  63032. var obs = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(canActivate).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (c) {
  63033. var guard = _this.getToken(c, future);
  63034. var observable;
  63035. if (guard.canActivate) {
  63036. observable = wrapIntoObservable(guard.canActivate(future, _this.future));
  63037. }
  63038. else {
  63039. observable = wrapIntoObservable(guard(future, _this.future));
  63040. }
  63041. return observable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])());
  63042. }));
  63043. return andObservables(obs);
  63044. };
  63045. PreActivation.prototype.runCanActivateChild = function (path) {
  63046. var _this = this;
  63047. var future = path[path.length - 1];
  63048. var canActivateChildGuards = path.slice(0, path.length - 1)
  63049. .reverse()
  63050. .map(function (p) { return _this.extractCanActivateChild(p); })
  63051. .filter(function (_) { return _ !== null; });
  63052. return andObservables(Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(canActivateChildGuards).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (d) {
  63053. var obs = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(d.guards).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (c) {
  63054. var guard = _this.getToken(c, d.node);
  63055. var observable;
  63056. if (guard.canActivateChild) {
  63057. observable = wrapIntoObservable(guard.canActivateChild(future, _this.future));
  63058. }
  63059. else {
  63060. observable = wrapIntoObservable(guard(future, _this.future));
  63061. }
  63062. return observable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])());
  63063. }));
  63064. return andObservables(obs);
  63065. })));
  63066. };
  63067. PreActivation.prototype.extractCanActivateChild = function (p) {
  63068. var canActivateChild = p.routeConfig ? p.routeConfig.canActivateChild : null;
  63069. if (!canActivateChild || canActivateChild.length === 0)
  63070. return null;
  63071. return { node: p, guards: canActivateChild };
  63072. };
  63073. PreActivation.prototype.runCanDeactivate = function (component, curr) {
  63074. var _this = this;
  63075. var canDeactivate = curr && curr.routeConfig ? curr.routeConfig.canDeactivate : null;
  63076. if (!canDeactivate || canDeactivate.length === 0)
  63077. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(true);
  63078. var canDeactivate$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(canDeactivate).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (c) {
  63079. var guard = _this.getToken(c, curr);
  63080. var observable;
  63081. if (guard.canDeactivate) {
  63082. observable =
  63083. wrapIntoObservable(guard.canDeactivate(component, curr, _this.curr, _this.future));
  63084. }
  63085. else {
  63086. observable = wrapIntoObservable(guard(component, curr, _this.curr, _this.future));
  63087. }
  63088. return observable.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["first"])());
  63089. }));
  63090. return canDeactivate$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["every"])(function (result) { return result === true; }));
  63091. };
  63092. PreActivation.prototype.runResolve = function (future, paramsInheritanceStrategy) {
  63093. var resolve = future._resolve;
  63094. return this.resolveNode(resolve, future).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (resolvedData) {
  63095. future._resolvedData = resolvedData;
  63096. future.data = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, future.data, inheritedParamsDataResolve(future, paramsInheritanceStrategy).resolve);
  63097. return null;
  63098. }));
  63099. };
  63100. PreActivation.prototype.resolveNode = function (resolve, future) {
  63101. var _this = this;
  63102. var keys = Object.keys(resolve);
  63103. if (keys.length === 0) {
  63104. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])({});
  63105. }
  63106. if (keys.length === 1) {
  63107. var key_1 = keys[0];
  63108. return this.getResolver(resolve[key_1], future).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (value) {
  63109. var _a;
  63110. return _a = {}, _a[key_1] = value, _a;
  63111. }));
  63112. }
  63113. var data = {};
  63114. var runningResolvers$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(keys).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (key) {
  63115. return _this.getResolver(resolve[key], future).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (value) {
  63116. data[key] = value;
  63117. return value;
  63118. }));
  63119. }));
  63120. return runningResolvers$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["last"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function () { return data; }));
  63121. };
  63122. PreActivation.prototype.getResolver = function (injectionToken, future) {
  63123. var resolver = this.getToken(injectionToken, future);
  63124. return resolver.resolve ? wrapIntoObservable(resolver.resolve(future, this.future)) :
  63125. wrapIntoObservable(resolver(future, this.future));
  63126. };
  63127. PreActivation.prototype.getToken = function (token, snapshot) {
  63128. var config = closestLoadedConfig(snapshot);
  63129. var injector = config ? config.module.injector : this.moduleInjector;
  63130. return injector.get(token);
  63131. };
  63132. return PreActivation;
  63133. }());
  63134. function closestLoadedConfig(snapshot) {
  63135. if (!snapshot)
  63136. return null;
  63137. for (var s = snapshot.parent; s; s = s.parent) {
  63138. var route = s.routeConfig;
  63139. if (route && route._loadedConfig)
  63140. return route._loadedConfig;
  63141. }
  63142. return null;
  63143. }
  63144. /**
  63145. * @license
  63146. * Copyright Google Inc. All Rights Reserved.
  63147. *
  63148. * Use of this source code is governed by an MIT-style license that can be
  63149. * found in the LICENSE file at https://angular.io/license
  63150. */
  63151. var NoMatch$1 = /** @class */ (function () {
  63152. function NoMatch() {
  63153. }
  63154. return NoMatch;
  63155. }());
  63156. function recognize(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution) {
  63157. if (paramsInheritanceStrategy === void 0) { paramsInheritanceStrategy = 'emptyOnly'; }
  63158. if (relativeLinkResolution === void 0) { relativeLinkResolution = 'legacy'; }
  63159. return new Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution)
  63160. .recognize();
  63161. }
  63162. var Recognizer = /** @class */ (function () {
  63163. function Recognizer(rootComponentType, config, urlTree, url, paramsInheritanceStrategy, relativeLinkResolution) {
  63164. this.rootComponentType = rootComponentType;
  63165. this.config = config;
  63166. this.urlTree = urlTree;
  63167. this.url = url;
  63168. this.paramsInheritanceStrategy = paramsInheritanceStrategy;
  63169. this.relativeLinkResolution = relativeLinkResolution;
  63170. }
  63171. Recognizer.prototype.recognize = function () {
  63172. try {
  63173. var rootSegmentGroup = split$1(this.urlTree.root, [], [], this.config, this.relativeLinkResolution).segmentGroup;
  63174. var children = this.processSegmentGroup(this.config, rootSegmentGroup, PRIMARY_OUTLET);
  63175. var root = new ActivatedRouteSnapshot([], Object.freeze({}), Object.freeze(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.urlTree.queryParams)), this.urlTree.fragment, {}, PRIMARY_OUTLET, this.rootComponentType, null, this.urlTree.root, -1, {});
  63176. var rootNode = new TreeNode(root, children);
  63177. var routeState = new RouterStateSnapshot(this.url, rootNode);
  63178. this.inheritParamsAndData(routeState._root);
  63179. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(routeState);
  63180. }
  63181. catch (e) {
  63182. return new rxjs__WEBPACK_IMPORTED_MODULE_2__["Observable"](function (obs) { return obs.error(e); });
  63183. }
  63184. };
  63185. Recognizer.prototype.inheritParamsAndData = function (routeNode) {
  63186. var _this = this;
  63187. var route = routeNode.value;
  63188. var i = inheritedParamsDataResolve(route, this.paramsInheritanceStrategy);
  63189. route.params = Object.freeze(i.params);
  63190. route.data = Object.freeze(i.data);
  63191. routeNode.children.forEach(function (n) { return _this.inheritParamsAndData(n); });
  63192. };
  63193. Recognizer.prototype.processSegmentGroup = function (config, segmentGroup, outlet) {
  63194. if (segmentGroup.segments.length === 0 && segmentGroup.hasChildren()) {
  63195. return this.processChildren(config, segmentGroup);
  63196. }
  63197. return this.processSegment(config, segmentGroup, segmentGroup.segments, outlet);
  63198. };
  63199. Recognizer.prototype.processChildren = function (config, segmentGroup) {
  63200. var _this = this;
  63201. var children = mapChildrenIntoArray(segmentGroup, function (child, childOutlet) { return _this.processSegmentGroup(config, child, childOutlet); });
  63202. checkOutletNameUniqueness(children);
  63203. sortActivatedRouteSnapshots(children);
  63204. return children;
  63205. };
  63206. Recognizer.prototype.processSegment = function (config, segmentGroup, segments, outlet) {
  63207. var e_1, _a;
  63208. try {
  63209. for (var config_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(config), config_1_1 = config_1.next(); !config_1_1.done; config_1_1 = config_1.next()) {
  63210. var r = config_1_1.value;
  63211. try {
  63212. return this.processSegmentAgainstRoute(r, segmentGroup, segments, outlet);
  63213. }
  63214. catch (e) {
  63215. if (!(e instanceof NoMatch$1))
  63216. throw e;
  63217. }
  63218. }
  63219. }
  63220. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  63221. finally {
  63222. try {
  63223. if (config_1_1 && !config_1_1.done && (_a = config_1.return)) _a.call(config_1);
  63224. }
  63225. finally { if (e_1) throw e_1.error; }
  63226. }
  63227. if (this.noLeftoversInUrl(segmentGroup, segments, outlet)) {
  63228. return [];
  63229. }
  63230. throw new NoMatch$1();
  63231. };
  63232. Recognizer.prototype.noLeftoversInUrl = function (segmentGroup, segments, outlet) {
  63233. return segments.length === 0 && !segmentGroup.children[outlet];
  63234. };
  63235. Recognizer.prototype.processSegmentAgainstRoute = function (route, rawSegment, segments, outlet) {
  63236. if (route.redirectTo)
  63237. throw new NoMatch$1();
  63238. if ((route.outlet || PRIMARY_OUTLET) !== outlet)
  63239. throw new NoMatch$1();
  63240. var snapshot;
  63241. var consumedSegments = [];
  63242. var rawSlicedSegments = [];
  63243. if (route.path === '**') {
  63244. var params = segments.length > 0 ? last$1(segments).parameters : {};
  63245. snapshot = new ActivatedRouteSnapshot(segments, params, Object.freeze(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), outlet, route.component, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + segments.length, getResolve(route));
  63246. }
  63247. else {
  63248. var result = match$1(rawSegment, route, segments);
  63249. consumedSegments = result.consumedSegments;
  63250. rawSlicedSegments = segments.slice(result.lastChild);
  63251. snapshot = new ActivatedRouteSnapshot(consumedSegments, result.parameters, Object.freeze(Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.urlTree.queryParams)), this.urlTree.fragment, getData(route), outlet, route.component, route, getSourceSegmentGroup(rawSegment), getPathIndexShift(rawSegment) + consumedSegments.length, getResolve(route));
  63252. }
  63253. var childConfig = getChildConfig(route);
  63254. var _a = split$1(rawSegment, consumedSegments, rawSlicedSegments, childConfig, this.relativeLinkResolution), segmentGroup = _a.segmentGroup, slicedSegments = _a.slicedSegments;
  63255. if (slicedSegments.length === 0 && segmentGroup.hasChildren()) {
  63256. var children_1 = this.processChildren(childConfig, segmentGroup);
  63257. return [new TreeNode(snapshot, children_1)];
  63258. }
  63259. if (childConfig.length === 0 && slicedSegments.length === 0) {
  63260. return [new TreeNode(snapshot, [])];
  63261. }
  63262. var children = this.processSegment(childConfig, segmentGroup, slicedSegments, PRIMARY_OUTLET);
  63263. return [new TreeNode(snapshot, children)];
  63264. };
  63265. return Recognizer;
  63266. }());
  63267. function sortActivatedRouteSnapshots(nodes) {
  63268. nodes.sort(function (a, b) {
  63269. if (a.value.outlet === PRIMARY_OUTLET)
  63270. return -1;
  63271. if (b.value.outlet === PRIMARY_OUTLET)
  63272. return 1;
  63273. return a.value.outlet.localeCompare(b.value.outlet);
  63274. });
  63275. }
  63276. function getChildConfig(route) {
  63277. if (route.children) {
  63278. return route.children;
  63279. }
  63280. if (route.loadChildren) {
  63281. return route._loadedConfig.routes;
  63282. }
  63283. return [];
  63284. }
  63285. function match$1(segmentGroup, route, segments) {
  63286. if (route.path === '') {
  63287. if (route.pathMatch === 'full' && (segmentGroup.hasChildren() || segments.length > 0)) {
  63288. throw new NoMatch$1();
  63289. }
  63290. return { consumedSegments: [], lastChild: 0, parameters: {} };
  63291. }
  63292. var matcher = route.matcher || defaultUrlMatcher;
  63293. var res = matcher(segments, segmentGroup, route);
  63294. if (!res)
  63295. throw new NoMatch$1();
  63296. var posParams = {};
  63297. forEach(res.posParams, function (v, k) { posParams[k] = v.path; });
  63298. var parameters = res.consumed.length > 0 ? Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, posParams, res.consumed[res.consumed.length - 1].parameters) :
  63299. posParams;
  63300. return { consumedSegments: res.consumed, lastChild: res.consumed.length, parameters: parameters };
  63301. }
  63302. function checkOutletNameUniqueness(nodes) {
  63303. var names = {};
  63304. nodes.forEach(function (n) {
  63305. var routeWithSameOutletName = names[n.value.outlet];
  63306. if (routeWithSameOutletName) {
  63307. var p = routeWithSameOutletName.url.map(function (s) { return s.toString(); }).join('/');
  63308. var c = n.value.url.map(function (s) { return s.toString(); }).join('/');
  63309. throw new Error("Two segments cannot have the same outlet name: '" + p + "' and '" + c + "'.");
  63310. }
  63311. names[n.value.outlet] = n.value;
  63312. });
  63313. }
  63314. function getSourceSegmentGroup(segmentGroup) {
  63315. var s = segmentGroup;
  63316. while (s._sourceSegment) {
  63317. s = s._sourceSegment;
  63318. }
  63319. return s;
  63320. }
  63321. function getPathIndexShift(segmentGroup) {
  63322. var s = segmentGroup;
  63323. var res = (s._segmentIndexShift ? s._segmentIndexShift : 0);
  63324. while (s._sourceSegment) {
  63325. s = s._sourceSegment;
  63326. res += (s._segmentIndexShift ? s._segmentIndexShift : 0);
  63327. }
  63328. return res - 1;
  63329. }
  63330. function split$1(segmentGroup, consumedSegments, slicedSegments, config, relativeLinkResolution) {
  63331. if (slicedSegments.length > 0 &&
  63332. containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, config)) {
  63333. var s_1 = new UrlSegmentGroup(consumedSegments, createChildrenForEmptyPaths(segmentGroup, consumedSegments, config, new UrlSegmentGroup(slicedSegments, segmentGroup.children)));
  63334. s_1._sourceSegment = segmentGroup;
  63335. s_1._segmentIndexShift = consumedSegments.length;
  63336. return { segmentGroup: s_1, slicedSegments: [] };
  63337. }
  63338. if (slicedSegments.length === 0 &&
  63339. containsEmptyPathMatches(segmentGroup, slicedSegments, config)) {
  63340. var s_2 = new UrlSegmentGroup(segmentGroup.segments, addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, config, segmentGroup.children, relativeLinkResolution));
  63341. s_2._sourceSegment = segmentGroup;
  63342. s_2._segmentIndexShift = consumedSegments.length;
  63343. return { segmentGroup: s_2, slicedSegments: slicedSegments };
  63344. }
  63345. var s = new UrlSegmentGroup(segmentGroup.segments, segmentGroup.children);
  63346. s._sourceSegment = segmentGroup;
  63347. s._segmentIndexShift = consumedSegments.length;
  63348. return { segmentGroup: s, slicedSegments: slicedSegments };
  63349. }
  63350. function addEmptyPathsToChildrenIfNeeded(segmentGroup, consumedSegments, slicedSegments, routes, children, relativeLinkResolution) {
  63351. var e_2, _a;
  63352. var res = {};
  63353. try {
  63354. for (var routes_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
  63355. var r = routes_1_1.value;
  63356. if (emptyPathMatch(segmentGroup, slicedSegments, r) && !children[getOutlet$1(r)]) {
  63357. var s = new UrlSegmentGroup([], {});
  63358. s._sourceSegment = segmentGroup;
  63359. if (relativeLinkResolution === 'legacy') {
  63360. s._segmentIndexShift = segmentGroup.segments.length;
  63361. }
  63362. else {
  63363. s._segmentIndexShift = consumedSegments.length;
  63364. }
  63365. res[getOutlet$1(r)] = s;
  63366. }
  63367. }
  63368. }
  63369. catch (e_2_1) { e_2 = { error: e_2_1 }; }
  63370. finally {
  63371. try {
  63372. if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
  63373. }
  63374. finally { if (e_2) throw e_2.error; }
  63375. }
  63376. return Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, children, res);
  63377. }
  63378. function createChildrenForEmptyPaths(segmentGroup, consumedSegments, routes, primarySegment) {
  63379. var e_3, _a;
  63380. var res = {};
  63381. res[PRIMARY_OUTLET] = primarySegment;
  63382. primarySegment._sourceSegment = segmentGroup;
  63383. primarySegment._segmentIndexShift = consumedSegments.length;
  63384. try {
  63385. for (var routes_2 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(routes), routes_2_1 = routes_2.next(); !routes_2_1.done; routes_2_1 = routes_2.next()) {
  63386. var r = routes_2_1.value;
  63387. if (r.path === '' && getOutlet$1(r) !== PRIMARY_OUTLET) {
  63388. var s = new UrlSegmentGroup([], {});
  63389. s._sourceSegment = segmentGroup;
  63390. s._segmentIndexShift = consumedSegments.length;
  63391. res[getOutlet$1(r)] = s;
  63392. }
  63393. }
  63394. }
  63395. catch (e_3_1) { e_3 = { error: e_3_1 }; }
  63396. finally {
  63397. try {
  63398. if (routes_2_1 && !routes_2_1.done && (_a = routes_2.return)) _a.call(routes_2);
  63399. }
  63400. finally { if (e_3) throw e_3.error; }
  63401. }
  63402. return res;
  63403. }
  63404. function containsEmptyPathMatchesWithNamedOutlets(segmentGroup, slicedSegments, routes) {
  63405. return routes.some(function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r) && getOutlet$1(r) !== PRIMARY_OUTLET; });
  63406. }
  63407. function containsEmptyPathMatches(segmentGroup, slicedSegments, routes) {
  63408. return routes.some(function (r) { return emptyPathMatch(segmentGroup, slicedSegments, r); });
  63409. }
  63410. function emptyPathMatch(segmentGroup, slicedSegments, r) {
  63411. if ((segmentGroup.hasChildren() || slicedSegments.length > 0) && r.pathMatch === 'full') {
  63412. return false;
  63413. }
  63414. return r.path === '' && r.redirectTo === undefined;
  63415. }
  63416. function getOutlet$1(route) {
  63417. return route.outlet || PRIMARY_OUTLET;
  63418. }
  63419. function getData(route) {
  63420. return route.data || {};
  63421. }
  63422. function getResolve(route) {
  63423. return route.resolve || {};
  63424. }
  63425. /**
  63426. * @license
  63427. * Copyright Google Inc. All Rights Reserved.
  63428. *
  63429. * Use of this source code is governed by an MIT-style license that can be
  63430. * found in the LICENSE file at https://angular.io/license
  63431. */
  63432. /**
  63433. * @description
  63434. *
  63435. * Provides a way to customize when activated routes get reused.
  63436. *
  63437. * @experimental
  63438. */
  63439. var RouteReuseStrategy = /** @class */ (function () {
  63440. function RouteReuseStrategy() {
  63441. }
  63442. return RouteReuseStrategy;
  63443. }());
  63444. /**
  63445. * Does not detach any subtrees. Reuses routes as long as their route config is the same.
  63446. */
  63447. var DefaultRouteReuseStrategy = /** @class */ (function () {
  63448. function DefaultRouteReuseStrategy() {
  63449. }
  63450. DefaultRouteReuseStrategy.prototype.shouldDetach = function (route) { return false; };
  63451. DefaultRouteReuseStrategy.prototype.store = function (route, detachedTree) { };
  63452. DefaultRouteReuseStrategy.prototype.shouldAttach = function (route) { return false; };
  63453. DefaultRouteReuseStrategy.prototype.retrieve = function (route) { return null; };
  63454. DefaultRouteReuseStrategy.prototype.shouldReuseRoute = function (future, curr) {
  63455. return future.routeConfig === curr.routeConfig;
  63456. };
  63457. return DefaultRouteReuseStrategy;
  63458. }());
  63459. /**
  63460. * @license
  63461. * Copyright Google Inc. All Rights Reserved.
  63462. *
  63463. * Use of this source code is governed by an MIT-style license that can be
  63464. * found in the LICENSE file at https://angular.io/license
  63465. */
  63466. /**
  63467. * @docsNotRequired
  63468. * @experimental
  63469. */
  63470. var ROUTES = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ROUTES');
  63471. var RouterConfigLoader = /** @class */ (function () {
  63472. function RouterConfigLoader(loader, compiler, onLoadStartListener, onLoadEndListener) {
  63473. this.loader = loader;
  63474. this.compiler = compiler;
  63475. this.onLoadStartListener = onLoadStartListener;
  63476. this.onLoadEndListener = onLoadEndListener;
  63477. }
  63478. RouterConfigLoader.prototype.load = function (parentInjector, route) {
  63479. var _this = this;
  63480. if (this.onLoadStartListener) {
  63481. this.onLoadStartListener(route);
  63482. }
  63483. var moduleFactory$ = this.loadModuleFactory(route.loadChildren);
  63484. return moduleFactory$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (factory) {
  63485. if (_this.onLoadEndListener) {
  63486. _this.onLoadEndListener(route);
  63487. }
  63488. var module = factory.create(parentInjector);
  63489. return new LoadedRouterConfig(flatten(module.injector.get(ROUTES)).map(standardizeConfig), module);
  63490. }));
  63491. };
  63492. RouterConfigLoader.prototype.loadModuleFactory = function (loadChildren) {
  63493. var _this = this;
  63494. if (typeof loadChildren === 'string') {
  63495. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(this.loader.load(loadChildren));
  63496. }
  63497. else {
  63498. return wrapIntoObservable(loadChildren()).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (t) {
  63499. if (t instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactory"]) {
  63500. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(t);
  63501. }
  63502. else {
  63503. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(_this.compiler.compileModuleAsync(t));
  63504. }
  63505. }));
  63506. }
  63507. };
  63508. return RouterConfigLoader;
  63509. }());
  63510. /**
  63511. * @license
  63512. * Copyright Google Inc. All Rights Reserved.
  63513. *
  63514. * Use of this source code is governed by an MIT-style license that can be
  63515. * found in the LICENSE file at https://angular.io/license
  63516. */
  63517. /**
  63518. * @description
  63519. *
  63520. * Provides a way to migrate AngularJS applications to Angular.
  63521. *
  63522. * @experimental
  63523. */
  63524. var UrlHandlingStrategy = /** @class */ (function () {
  63525. function UrlHandlingStrategy() {
  63526. }
  63527. return UrlHandlingStrategy;
  63528. }());
  63529. /**
  63530. * @experimental
  63531. */
  63532. var DefaultUrlHandlingStrategy = /** @class */ (function () {
  63533. function DefaultUrlHandlingStrategy() {
  63534. }
  63535. DefaultUrlHandlingStrategy.prototype.shouldProcessUrl = function (url) { return true; };
  63536. DefaultUrlHandlingStrategy.prototype.extract = function (url) { return url; };
  63537. DefaultUrlHandlingStrategy.prototype.merge = function (newUrlPart, wholeUrl) { return newUrlPart; };
  63538. return DefaultUrlHandlingStrategy;
  63539. }());
  63540. /**
  63541. * @license
  63542. * Copyright Google Inc. All Rights Reserved.
  63543. *
  63544. * Use of this source code is governed by an MIT-style license that can be
  63545. * found in the LICENSE file at https://angular.io/license
  63546. */
  63547. function defaultErrorHandler(error) {
  63548. throw error;
  63549. }
  63550. function defaultMalformedUriErrorHandler(error, urlSerializer, url) {
  63551. return urlSerializer.parse('/');
  63552. }
  63553. /**
  63554. * @internal
  63555. */
  63556. function defaultRouterHook(snapshot, runExtras) {
  63557. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null);
  63558. }
  63559. /**
  63560. * @description
  63561. *
  63562. * Provides the navigation and url manipulation capabilities.
  63563. *
  63564. * See `Routes` for more details and examples.
  63565. *
  63566. * @ngModule RouterModule
  63567. *
  63568. *
  63569. */
  63570. var Router = /** @class */ (function () {
  63571. /**
  63572. * Creates the router service.
  63573. */
  63574. // TODO: vsavkin make internal after the final is out.
  63575. function Router(rootComponentType, urlSerializer, rootContexts, location, injector, loader, compiler, config) {
  63576. var _this = this;
  63577. this.rootComponentType = rootComponentType;
  63578. this.urlSerializer = urlSerializer;
  63579. this.rootContexts = rootContexts;
  63580. this.location = location;
  63581. this.config = config;
  63582. this.navigations = new rxjs__WEBPACK_IMPORTED_MODULE_2__["BehaviorSubject"](null);
  63583. this.navigationId = 0;
  63584. this.isNgZoneEnabled = false;
  63585. this.events = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"]();
  63586. /**
  63587. * Error handler that is invoked when a navigation errors.
  63588. *
  63589. * See `ErrorHandler` for more information.
  63590. */
  63591. this.errorHandler = defaultErrorHandler;
  63592. /**
  63593. * Malformed uri error handler is invoked when `Router.parseUrl(url)` throws an
  63594. * error due to containing an invalid character. The most common case would be a `%` sign
  63595. * that's not encoded and is not part of a percent encoded sequence.
  63596. */
  63597. this.malformedUriErrorHandler = defaultMalformedUriErrorHandler;
  63598. /**
  63599. * Indicates if at least one navigation happened.
  63600. */
  63601. this.navigated = false;
  63602. this.lastSuccessfulId = -1;
  63603. /**
  63604. * Used by RouterModule. This allows us to
  63605. * pause the navigation either before preactivation or after it.
  63606. * @internal
  63607. */
  63608. this.hooks = {
  63609. beforePreactivation: defaultRouterHook,
  63610. afterPreactivation: defaultRouterHook
  63611. };
  63612. /**
  63613. * Extracts and merges URLs. Used for AngularJS to Angular migrations.
  63614. */
  63615. this.urlHandlingStrategy = new DefaultUrlHandlingStrategy();
  63616. this.routeReuseStrategy = new DefaultRouteReuseStrategy();
  63617. /**
  63618. * Define what the router should do if it receives a navigation request to the current URL.
  63619. * By default, the router will ignore this navigation. However, this prevents features such
  63620. * as a "refresh" button. Use this option to configure the behavior when navigating to the
  63621. * current URL. Default is 'ignore'.
  63622. */
  63623. this.onSameUrlNavigation = 'ignore';
  63624. /**
  63625. * Defines how the router merges params, data and resolved data from parent to child
  63626. * routes. Available options are:
  63627. *
  63628. * - `'emptyOnly'`, the default, only inherits parent params for path-less or component-less
  63629. * routes.
  63630. * - `'always'`, enables unconditional inheritance of parent params.
  63631. */
  63632. this.paramsInheritanceStrategy = 'emptyOnly';
  63633. /**
  63634. * Defines when the router updates the browser URL. The default behavior is to update after
  63635. * successful navigation. However, some applications may prefer a mode where the URL gets
  63636. * updated at the beginning of navigation. The most common use case would be updating the
  63637. * URL early so if navigation fails, you can show an error message with the URL that failed.
  63638. * Available options are:
  63639. *
  63640. * - `'deferred'`, the default, updates the browser URL after navigation has finished.
  63641. * - `'eager'`, updates browser URL at the beginning of navigation.
  63642. */
  63643. this.urlUpdateStrategy = 'deferred';
  63644. /**
  63645. * See {@link RouterModule} for more information.
  63646. */
  63647. this.relativeLinkResolution = 'legacy';
  63648. var onLoadStart = function (r) { return _this.triggerEvent(new RouteConfigLoadStart(r)); };
  63649. var onLoadEnd = function (r) { return _this.triggerEvent(new RouteConfigLoadEnd(r)); };
  63650. this.ngModule = injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]);
  63651. this.console = injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ɵConsole"]);
  63652. var ngZone = injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"]);
  63653. this.isNgZoneEnabled = ngZone instanceof _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"];
  63654. this.resetConfig(config);
  63655. this.currentUrlTree = createEmptyUrlTree();
  63656. this.rawUrlTree = this.currentUrlTree;
  63657. this.configLoader = new RouterConfigLoader(loader, compiler, onLoadStart, onLoadEnd);
  63658. this.routerState = createEmptyState(this.currentUrlTree, this.rootComponentType);
  63659. this.processNavigations();
  63660. }
  63661. /**
  63662. * @internal
  63663. * TODO: this should be removed once the constructor of the router made internal
  63664. */
  63665. Router.prototype.resetRootComponentType = function (rootComponentType) {
  63666. this.rootComponentType = rootComponentType;
  63667. // TODO: vsavkin router 4.0 should make the root component set to null
  63668. // this will simplify the lifecycle of the router.
  63669. this.routerState.root.component = this.rootComponentType;
  63670. };
  63671. /**
  63672. * Sets up the location change listener and performs the initial navigation.
  63673. */
  63674. Router.prototype.initialNavigation = function () {
  63675. this.setUpLocationChangeListener();
  63676. if (this.navigationId === 0) {
  63677. this.navigateByUrl(this.location.path(true), { replaceUrl: true });
  63678. }
  63679. };
  63680. /**
  63681. * Sets up the location change listener.
  63682. */
  63683. Router.prototype.setUpLocationChangeListener = function () {
  63684. var _this = this;
  63685. // Don't need to use Zone.wrap any more, because zone.js
  63686. // already patch onPopState, so location change callback will
  63687. // run into ngZone
  63688. if (!this.locationSubscription) {
  63689. this.locationSubscription = this.location.subscribe(function (change) {
  63690. var rawUrlTree = _this.parseUrl(change['url']);
  63691. var source = change['type'] === 'popstate' ? 'popstate' : 'hashchange';
  63692. var state = change.state && change.state.navigationId ?
  63693. { navigationId: change.state.navigationId } :
  63694. null;
  63695. setTimeout(function () { _this.scheduleNavigation(rawUrlTree, source, state, { replaceUrl: true }); }, 0);
  63696. });
  63697. }
  63698. };
  63699. Object.defineProperty(Router.prototype, "url", {
  63700. /** The current url */
  63701. get: function () { return this.serializeUrl(this.currentUrlTree); },
  63702. enumerable: true,
  63703. configurable: true
  63704. });
  63705. /** @internal */
  63706. Router.prototype.triggerEvent = function (event) { this.events.next(event); };
  63707. /**
  63708. * Resets the configuration used for navigation and generating links.
  63709. *
  63710. * @usageNotes
  63711. *
  63712. * ### Example
  63713. *
  63714. * ```
  63715. * router.resetConfig([
  63716. * { path: 'team/:id', component: TeamCmp, children: [
  63717. * { path: 'simple', component: SimpleCmp },
  63718. * { path: 'user/:name', component: UserCmp }
  63719. * ]}
  63720. * ]);
  63721. * ```
  63722. */
  63723. Router.prototype.resetConfig = function (config) {
  63724. validateConfig(config);
  63725. this.config = config.map(standardizeConfig);
  63726. this.navigated = false;
  63727. this.lastSuccessfulId = -1;
  63728. };
  63729. /** @docsNotRequired */
  63730. Router.prototype.ngOnDestroy = function () { this.dispose(); };
  63731. /** Disposes of the router */
  63732. Router.prototype.dispose = function () {
  63733. if (this.locationSubscription) {
  63734. this.locationSubscription.unsubscribe();
  63735. this.locationSubscription = null;
  63736. }
  63737. };
  63738. /**
  63739. * Applies an array of commands to the current url tree and creates a new url tree.
  63740. *
  63741. * When given an activate route, applies the given commands starting from the route.
  63742. * When not given a route, applies the given command starting from the root.
  63743. *
  63744. * @usageNotes
  63745. *
  63746. * ### Example
  63747. *
  63748. * ```
  63749. * // create /team/33/user/11
  63750. * router.createUrlTree(['/team', 33, 'user', 11]);
  63751. *
  63752. * // create /team/33;expand=true/user/11
  63753. * router.createUrlTree(['/team', 33, {expand: true}, 'user', 11]);
  63754. *
  63755. * // you can collapse static segments like this (this works only with the first passed-in value):
  63756. * router.createUrlTree(['/team/33/user', userId]);
  63757. *
  63758. * // If the first segment can contain slashes, and you do not want the router to split it, you
  63759. * // can do the following:
  63760. *
  63761. * router.createUrlTree([{segmentPath: '/one/two'}]);
  63762. *
  63763. * // create /team/33/(user/11//right:chat)
  63764. * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: 'chat'}}]);
  63765. *
  63766. * // remove the right secondary node
  63767. * router.createUrlTree(['/team', 33, {outlets: {primary: 'user/11', right: null}}]);
  63768. *
  63769. * // assuming the current url is `/team/33/user/11` and the route points to `user/11`
  63770. *
  63771. * // navigate to /team/33/user/11/details
  63772. * router.createUrlTree(['details'], {relativeTo: route});
  63773. *
  63774. * // navigate to /team/33/user/22
  63775. * router.createUrlTree(['../22'], {relativeTo: route});
  63776. *
  63777. * // navigate to /team/44/user/22
  63778. * router.createUrlTree(['../../team/44/user/22'], {relativeTo: route});
  63779. * ```
  63780. */
  63781. Router.prototype.createUrlTree = function (commands, navigationExtras) {
  63782. if (navigationExtras === void 0) { navigationExtras = {}; }
  63783. var relativeTo = navigationExtras.relativeTo, queryParams = navigationExtras.queryParams, fragment = navigationExtras.fragment, preserveQueryParams = navigationExtras.preserveQueryParams, queryParamsHandling = navigationExtras.queryParamsHandling, preserveFragment = navigationExtras.preserveFragment;
  63784. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && preserveQueryParams && console && console.warn) {
  63785. console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.');
  63786. }
  63787. var a = relativeTo || this.routerState.root;
  63788. var f = preserveFragment ? this.currentUrlTree.fragment : fragment;
  63789. var q = null;
  63790. if (queryParamsHandling) {
  63791. switch (queryParamsHandling) {
  63792. case 'merge':
  63793. q = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__assign"])({}, this.currentUrlTree.queryParams, queryParams);
  63794. break;
  63795. case 'preserve':
  63796. q = this.currentUrlTree.queryParams;
  63797. break;
  63798. default:
  63799. q = queryParams || null;
  63800. }
  63801. }
  63802. else {
  63803. q = preserveQueryParams ? this.currentUrlTree.queryParams : queryParams || null;
  63804. }
  63805. if (q !== null) {
  63806. q = this.removeEmptyProps(q);
  63807. }
  63808. return createUrlTree(a, this.currentUrlTree, commands, q, f);
  63809. };
  63810. /**
  63811. * Navigate based on the provided url. This navigation is always absolute.
  63812. *
  63813. * Returns a promise that:
  63814. * - resolves to 'true' when navigation succeeds,
  63815. * - resolves to 'false' when navigation fails,
  63816. * - is rejected when an error happens.
  63817. *
  63818. * @usageNotes
  63819. *
  63820. * ### Example
  63821. *
  63822. * ```
  63823. * router.navigateByUrl("/team/33/user/11");
  63824. *
  63825. * // Navigate without updating the URL
  63826. * router.navigateByUrl("/team/33/user/11", { skipLocationChange: true });
  63827. * ```
  63828. *
  63829. * Since `navigateByUrl()` takes an absolute URL as the first parameter,
  63830. * it will not apply any delta to the current URL and ignores any properties
  63831. * in the second parameter (the `NavigationExtras`) that would change the
  63832. * provided URL.
  63833. */
  63834. Router.prototype.navigateByUrl = function (url, extras) {
  63835. if (extras === void 0) { extras = { skipLocationChange: false }; }
  63836. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && this.isNgZoneEnabled && !_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgZone"].isInAngularZone()) {
  63837. this.console.warn("Navigation triggered outside Angular zone, did you forget to call 'ngZone.run()'?");
  63838. }
  63839. var urlTree = url instanceof UrlTree ? url : this.parseUrl(url);
  63840. var mergedTree = this.urlHandlingStrategy.merge(urlTree, this.rawUrlTree);
  63841. return this.scheduleNavigation(mergedTree, 'imperative', null, extras);
  63842. };
  63843. /**
  63844. * Navigate based on the provided array of commands and a starting point.
  63845. * If no starting route is provided, the navigation is absolute.
  63846. *
  63847. * Returns a promise that:
  63848. * - resolves to 'true' when navigation succeeds,
  63849. * - resolves to 'false' when navigation fails,
  63850. * - is rejected when an error happens.
  63851. *
  63852. * @usageNotes
  63853. *
  63854. * ### Example
  63855. *
  63856. * ```
  63857. * router.navigate(['team', 33, 'user', 11], {relativeTo: route});
  63858. *
  63859. * // Navigate without updating the URL
  63860. * router.navigate(['team', 33, 'user', 11], {relativeTo: route, skipLocationChange: true});
  63861. * ```
  63862. *
  63863. * The first parameter of `navigate()` is a delta to be applied to the current URL
  63864. * or the one provided in the `relativeTo` property of the second parameter (the
  63865. * `NavigationExtras`).
  63866. */
  63867. Router.prototype.navigate = function (commands, extras) {
  63868. if (extras === void 0) { extras = { skipLocationChange: false }; }
  63869. validateCommands(commands);
  63870. return this.navigateByUrl(this.createUrlTree(commands, extras), extras);
  63871. };
  63872. /** Serializes a `UrlTree` into a string */
  63873. Router.prototype.serializeUrl = function (url) { return this.urlSerializer.serialize(url); };
  63874. /** Parses a string into a `UrlTree` */
  63875. Router.prototype.parseUrl = function (url) {
  63876. var urlTree;
  63877. try {
  63878. urlTree = this.urlSerializer.parse(url);
  63879. }
  63880. catch (e) {
  63881. urlTree = this.malformedUriErrorHandler(e, this.urlSerializer, url);
  63882. }
  63883. return urlTree;
  63884. };
  63885. /** Returns whether the url is activated */
  63886. Router.prototype.isActive = function (url, exact) {
  63887. if (url instanceof UrlTree) {
  63888. return containsTree(this.currentUrlTree, url, exact);
  63889. }
  63890. var urlTree = this.parseUrl(url);
  63891. return containsTree(this.currentUrlTree, urlTree, exact);
  63892. };
  63893. Router.prototype.removeEmptyProps = function (params) {
  63894. return Object.keys(params).reduce(function (result, key) {
  63895. var value = params[key];
  63896. if (value !== null && value !== undefined) {
  63897. result[key] = value;
  63898. }
  63899. return result;
  63900. }, {});
  63901. };
  63902. Router.prototype.processNavigations = function () {
  63903. var _this = this;
  63904. this.navigations
  63905. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])(function (nav) {
  63906. if (nav) {
  63907. _this.executeScheduledNavigation(nav);
  63908. // a failed navigation should not stop the router from processing
  63909. // further navigations => the catch
  63910. return nav.promise.catch(function () { });
  63911. }
  63912. else {
  63913. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null);
  63914. }
  63915. }))
  63916. .subscribe(function () { });
  63917. };
  63918. Router.prototype.scheduleNavigation = function (rawUrl, source, state, extras) {
  63919. var lastNavigation = this.navigations.value;
  63920. // If the user triggers a navigation imperatively (e.g., by using navigateByUrl),
  63921. // and that navigation results in 'replaceState' that leads to the same URL,
  63922. // we should skip those.
  63923. if (lastNavigation && source !== 'imperative' && lastNavigation.source === 'imperative' &&
  63924. lastNavigation.rawUrl.toString() === rawUrl.toString()) {
  63925. return Promise.resolve(true); // return value is not used
  63926. }
  63927. // Because of a bug in IE and Edge, the location class fires two events (popstate and
  63928. // hashchange) every single time. The second one should be ignored. Otherwise, the URL will
  63929. // flicker. Handles the case when a popstate was emitted first.
  63930. if (lastNavigation && source == 'hashchange' && lastNavigation.source === 'popstate' &&
  63931. lastNavigation.rawUrl.toString() === rawUrl.toString()) {
  63932. return Promise.resolve(true); // return value is not used
  63933. }
  63934. // Because of a bug in IE and Edge, the location class fires two events (popstate and
  63935. // hashchange) every single time. The second one should be ignored. Otherwise, the URL will
  63936. // flicker. Handles the case when a hashchange was emitted first.
  63937. if (lastNavigation && source == 'popstate' && lastNavigation.source === 'hashchange' &&
  63938. lastNavigation.rawUrl.toString() === rawUrl.toString()) {
  63939. return Promise.resolve(true); // return value is not used
  63940. }
  63941. var resolve = null;
  63942. var reject = null;
  63943. var promise = new Promise(function (res, rej) {
  63944. resolve = res;
  63945. reject = rej;
  63946. });
  63947. var id = ++this.navigationId;
  63948. this.navigations.next({ id: id, source: source, state: state, rawUrl: rawUrl, extras: extras, resolve: resolve, reject: reject, promise: promise });
  63949. // Make sure that the error is propagated even though `processNavigations` catch
  63950. // handler does not rethrow
  63951. return promise.catch(function (e) { return Promise.reject(e); });
  63952. };
  63953. Router.prototype.executeScheduledNavigation = function (_a) {
  63954. var _this = this;
  63955. var id = _a.id, rawUrl = _a.rawUrl, extras = _a.extras, resolve = _a.resolve, reject = _a.reject, source = _a.source, state = _a.state;
  63956. var url = this.urlHandlingStrategy.extract(rawUrl);
  63957. var urlTransition = !this.navigated || url.toString() !== this.currentUrlTree.toString();
  63958. if ((this.onSameUrlNavigation === 'reload' ? true : urlTransition) &&
  63959. this.urlHandlingStrategy.shouldProcessUrl(rawUrl)) {
  63960. if (this.urlUpdateStrategy === 'eager' && !extras.skipLocationChange) {
  63961. this.setBrowserUrl(rawUrl, !!extras.replaceUrl, id);
  63962. }
  63963. this.events
  63964. .next(new NavigationStart(id, this.serializeUrl(url), source, state));
  63965. Promise.resolve()
  63966. .then(function (_) { return _this.runNavigate(url, rawUrl, !!extras.skipLocationChange, !!extras.replaceUrl, id, null); })
  63967. .then(resolve, reject);
  63968. // we cannot process the current URL, but we could process the previous one =>
  63969. // we need to do some cleanup
  63970. }
  63971. else if (urlTransition && this.rawUrlTree &&
  63972. this.urlHandlingStrategy.shouldProcessUrl(this.rawUrlTree)) {
  63973. this.events
  63974. .next(new NavigationStart(id, this.serializeUrl(url), source, state));
  63975. Promise.resolve()
  63976. .then(function (_) { return _this.runNavigate(url, rawUrl, false, false, id, createEmptyState(url, _this.rootComponentType).snapshot); })
  63977. .then(resolve, reject);
  63978. }
  63979. else {
  63980. this.rawUrlTree = rawUrl;
  63981. resolve(null);
  63982. }
  63983. };
  63984. Router.prototype.runNavigate = function (url, rawUrl, skipLocationChange, replaceUrl, id, precreatedState) {
  63985. var _this = this;
  63986. if (id !== this.navigationId) {
  63987. this.events
  63988. .next(new NavigationCancel(id, this.serializeUrl(url), "Navigation ID " + id + " is not equal to the current navigation id " + this.navigationId));
  63989. return Promise.resolve(false);
  63990. }
  63991. return new Promise(function (resolvePromise, rejectPromise) {
  63992. // create an observable of the url and route state snapshot
  63993. // this operation do not result in any side effects
  63994. var urlAndSnapshot$;
  63995. if (!precreatedState) {
  63996. var moduleInjector = _this.ngModule.injector;
  63997. var redirectsApplied$ = applyRedirects(moduleInjector, _this.configLoader, _this.urlSerializer, url, _this.config);
  63998. urlAndSnapshot$ = redirectsApplied$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (appliedUrl) {
  63999. return recognize(_this.rootComponentType, _this.config, appliedUrl, _this.serializeUrl(appliedUrl), _this.paramsInheritanceStrategy, _this.relativeLinkResolution)
  64000. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (snapshot) {
  64001. _this.events
  64002. .next(new RoutesRecognized(id, _this.serializeUrl(url), _this.serializeUrl(appliedUrl), snapshot));
  64003. return { appliedUrl: appliedUrl, snapshot: snapshot };
  64004. }));
  64005. }));
  64006. }
  64007. else {
  64008. urlAndSnapshot$ = Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])({ appliedUrl: url, snapshot: precreatedState });
  64009. }
  64010. var beforePreactivationDone$ = urlAndSnapshot$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (p) {
  64011. if (typeof p === 'boolean')
  64012. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(p);
  64013. return _this.hooks
  64014. .beforePreactivation(p.snapshot, {
  64015. navigationId: id,
  64016. appliedUrlTree: url,
  64017. rawUrlTree: rawUrl, skipLocationChange: skipLocationChange, replaceUrl: replaceUrl,
  64018. })
  64019. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function () { return p; }));
  64020. }));
  64021. // run preactivation: guards and data resolvers
  64022. var preActivation;
  64023. var preactivationSetup$ = beforePreactivationDone$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (p) {
  64024. if (typeof p === 'boolean')
  64025. return p;
  64026. var appliedUrl = p.appliedUrl, snapshot = p.snapshot;
  64027. var moduleInjector = _this.ngModule.injector;
  64028. preActivation = new PreActivation(snapshot, _this.routerState.snapshot, moduleInjector, function (evt) { return _this.triggerEvent(evt); });
  64029. preActivation.initialize(_this.rootContexts);
  64030. return { appliedUrl: appliedUrl, snapshot: snapshot };
  64031. }));
  64032. var preactivationCheckGuards$ = preactivationSetup$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (p) {
  64033. if (typeof p === 'boolean' || _this.navigationId !== id)
  64034. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(false);
  64035. var appliedUrl = p.appliedUrl, snapshot = p.snapshot;
  64036. _this.triggerEvent(new GuardsCheckStart(id, _this.serializeUrl(url), _this.serializeUrl(appliedUrl), snapshot));
  64037. return preActivation.checkGuards().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (shouldActivate) {
  64038. _this.triggerEvent(new GuardsCheckEnd(id, _this.serializeUrl(url), _this.serializeUrl(appliedUrl), snapshot, shouldActivate));
  64039. return { appliedUrl: appliedUrl, snapshot: snapshot, shouldActivate: shouldActivate };
  64040. }));
  64041. }));
  64042. var preactivationResolveData$ = preactivationCheckGuards$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (p) {
  64043. if (typeof p === 'boolean' || _this.navigationId !== id)
  64044. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(false);
  64045. if (p.shouldActivate && preActivation.isActivating()) {
  64046. _this.triggerEvent(new ResolveStart(id, _this.serializeUrl(url), _this.serializeUrl(p.appliedUrl), p.snapshot));
  64047. return preActivation.resolveData(_this.paramsInheritanceStrategy).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function () {
  64048. _this.triggerEvent(new ResolveEnd(id, _this.serializeUrl(url), _this.serializeUrl(p.appliedUrl), p.snapshot));
  64049. return p;
  64050. }));
  64051. }
  64052. else {
  64053. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(p);
  64054. }
  64055. }));
  64056. var preactivationDone$ = preactivationResolveData$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (p) {
  64057. if (typeof p === 'boolean' || _this.navigationId !== id)
  64058. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(false);
  64059. return _this.hooks
  64060. .afterPreactivation(p.snapshot, {
  64061. navigationId: id,
  64062. appliedUrlTree: url,
  64063. rawUrlTree: rawUrl, skipLocationChange: skipLocationChange, replaceUrl: replaceUrl,
  64064. })
  64065. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function () { return p; }));
  64066. }));
  64067. // create router state
  64068. // this operation has side effects => route state is being affected
  64069. var routerState$ = preactivationDone$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (p) {
  64070. if (typeof p === 'boolean' || _this.navigationId !== id)
  64071. return false;
  64072. var appliedUrl = p.appliedUrl, snapshot = p.snapshot, shouldActivate = p.shouldActivate;
  64073. if (shouldActivate) {
  64074. var state = createRouterState(_this.routeReuseStrategy, snapshot, _this.routerState);
  64075. return { appliedUrl: appliedUrl, state: state, shouldActivate: shouldActivate };
  64076. }
  64077. else {
  64078. return { appliedUrl: appliedUrl, state: null, shouldActivate: shouldActivate };
  64079. }
  64080. }));
  64081. _this.activateRoutes(routerState$, _this.routerState, _this.currentUrlTree, id, url, rawUrl, skipLocationChange, replaceUrl, resolvePromise, rejectPromise);
  64082. });
  64083. };
  64084. /**
  64085. * Performs the logic of activating routes. This is a synchronous process by default. While this
  64086. * is a private method, it could be overridden to make activation asynchronous.
  64087. */
  64088. Router.prototype.activateRoutes = function (state, storedState, storedUrl, id, url, rawUrl, skipLocationChange, replaceUrl, resolvePromise, rejectPromise) {
  64089. var _this = this;
  64090. // applied the new router state
  64091. // this operation has side effects
  64092. var navigationIsSuccessful;
  64093. state
  64094. .forEach(function (p) {
  64095. if (typeof p === 'boolean' || !p.shouldActivate || id !== _this.navigationId || !p.state) {
  64096. navigationIsSuccessful = false;
  64097. return;
  64098. }
  64099. var appliedUrl = p.appliedUrl, state = p.state;
  64100. _this.currentUrlTree = appliedUrl;
  64101. _this.rawUrlTree = _this.urlHandlingStrategy.merge(_this.currentUrlTree, rawUrl);
  64102. _this.routerState = state;
  64103. if (_this.urlUpdateStrategy === 'deferred' && !skipLocationChange) {
  64104. _this.setBrowserUrl(_this.rawUrlTree, replaceUrl, id);
  64105. }
  64106. new ActivateRoutes(_this.routeReuseStrategy, state, storedState, function (evt) { return _this.triggerEvent(evt); })
  64107. .activate(_this.rootContexts);
  64108. navigationIsSuccessful = true;
  64109. })
  64110. .then(function () {
  64111. if (navigationIsSuccessful) {
  64112. _this.navigated = true;
  64113. _this.lastSuccessfulId = id;
  64114. _this.events
  64115. .next(new NavigationEnd(id, _this.serializeUrl(url), _this.serializeUrl(_this.currentUrlTree)));
  64116. resolvePromise(true);
  64117. }
  64118. else {
  64119. _this.resetUrlToCurrentUrlTree();
  64120. _this.events
  64121. .next(new NavigationCancel(id, _this.serializeUrl(url), ''));
  64122. resolvePromise(false);
  64123. }
  64124. }, function (e) {
  64125. if (isNavigationCancelingError(e)) {
  64126. _this.navigated = true;
  64127. _this.resetStateAndUrl(storedState, storedUrl, rawUrl);
  64128. _this.events
  64129. .next(new NavigationCancel(id, _this.serializeUrl(url), e.message));
  64130. resolvePromise(false);
  64131. }
  64132. else {
  64133. _this.resetStateAndUrl(storedState, storedUrl, rawUrl);
  64134. _this.events
  64135. .next(new NavigationError(id, _this.serializeUrl(url), e));
  64136. try {
  64137. resolvePromise(_this.errorHandler(e));
  64138. }
  64139. catch (ee) {
  64140. rejectPromise(ee);
  64141. }
  64142. }
  64143. });
  64144. };
  64145. Router.prototype.setBrowserUrl = function (url, replaceUrl, id) {
  64146. var path = this.urlSerializer.serialize(url);
  64147. if (this.location.isCurrentPathEqualTo(path) || replaceUrl) {
  64148. this.location.replaceState(path, '', { navigationId: id });
  64149. }
  64150. else {
  64151. this.location.go(path, '', { navigationId: id });
  64152. }
  64153. };
  64154. Router.prototype.resetStateAndUrl = function (storedState, storedUrl, rawUrl) {
  64155. this.routerState = storedState;
  64156. this.currentUrlTree = storedUrl;
  64157. this.rawUrlTree = this.urlHandlingStrategy.merge(this.currentUrlTree, rawUrl);
  64158. this.resetUrlToCurrentUrlTree();
  64159. };
  64160. Router.prototype.resetUrlToCurrentUrlTree = function () {
  64161. this.location.replaceState(this.urlSerializer.serialize(this.rawUrlTree), '', { navigationId: this.lastSuccessfulId });
  64162. };
  64163. return Router;
  64164. }());
  64165. var ActivateRoutes = /** @class */ (function () {
  64166. function ActivateRoutes(routeReuseStrategy, futureState, currState, forwardEvent) {
  64167. this.routeReuseStrategy = routeReuseStrategy;
  64168. this.futureState = futureState;
  64169. this.currState = currState;
  64170. this.forwardEvent = forwardEvent;
  64171. }
  64172. ActivateRoutes.prototype.activate = function (parentContexts) {
  64173. var futureRoot = this.futureState._root;
  64174. var currRoot = this.currState ? this.currState._root : null;
  64175. this.deactivateChildRoutes(futureRoot, currRoot, parentContexts);
  64176. advanceActivatedRoute(this.futureState.root);
  64177. this.activateChildRoutes(futureRoot, currRoot, parentContexts);
  64178. };
  64179. // De-activate the child route that are not re-used for the future state
  64180. ActivateRoutes.prototype.deactivateChildRoutes = function (futureNode, currNode, contexts) {
  64181. var _this = this;
  64182. var children = nodeChildrenAsMap(currNode);
  64183. // Recurse on the routes active in the future state to de-activate deeper children
  64184. futureNode.children.forEach(function (futureChild) {
  64185. var childOutletName = futureChild.value.outlet;
  64186. _this.deactivateRoutes(futureChild, children[childOutletName], contexts);
  64187. delete children[childOutletName];
  64188. });
  64189. // De-activate the routes that will not be re-used
  64190. forEach(children, function (v, childName) {
  64191. _this.deactivateRouteAndItsChildren(v, contexts);
  64192. });
  64193. };
  64194. ActivateRoutes.prototype.deactivateRoutes = function (futureNode, currNode, parentContext) {
  64195. var future = futureNode.value;
  64196. var curr = currNode ? currNode.value : null;
  64197. if (future === curr) {
  64198. // Reusing the node, check to see if the children need to be de-activated
  64199. if (future.component) {
  64200. // If we have a normal route, we need to go through an outlet.
  64201. var context = parentContext.getContext(future.outlet);
  64202. if (context) {
  64203. this.deactivateChildRoutes(futureNode, currNode, context.children);
  64204. }
  64205. }
  64206. else {
  64207. // if we have a componentless route, we recurse but keep the same outlet map.
  64208. this.deactivateChildRoutes(futureNode, currNode, parentContext);
  64209. }
  64210. }
  64211. else {
  64212. if (curr) {
  64213. // Deactivate the current route which will not be re-used
  64214. this.deactivateRouteAndItsChildren(currNode, parentContext);
  64215. }
  64216. }
  64217. };
  64218. ActivateRoutes.prototype.deactivateRouteAndItsChildren = function (route, parentContexts) {
  64219. if (this.routeReuseStrategy.shouldDetach(route.value.snapshot)) {
  64220. this.detachAndStoreRouteSubtree(route, parentContexts);
  64221. }
  64222. else {
  64223. this.deactivateRouteAndOutlet(route, parentContexts);
  64224. }
  64225. };
  64226. ActivateRoutes.prototype.detachAndStoreRouteSubtree = function (route, parentContexts) {
  64227. var context = parentContexts.getContext(route.value.outlet);
  64228. if (context && context.outlet) {
  64229. var componentRef = context.outlet.detach();
  64230. var contexts = context.children.onOutletDeactivated();
  64231. this.routeReuseStrategy.store(route.value.snapshot, { componentRef: componentRef, route: route, contexts: contexts });
  64232. }
  64233. };
  64234. ActivateRoutes.prototype.deactivateRouteAndOutlet = function (route, parentContexts) {
  64235. var _this = this;
  64236. var context = parentContexts.getContext(route.value.outlet);
  64237. if (context) {
  64238. var children = nodeChildrenAsMap(route);
  64239. var contexts_1 = route.value.component ? context.children : parentContexts;
  64240. forEach(children, function (v, k) { return _this.deactivateRouteAndItsChildren(v, contexts_1); });
  64241. if (context.outlet) {
  64242. // Destroy the component
  64243. context.outlet.deactivate();
  64244. // Destroy the contexts for all the outlets that were in the component
  64245. context.children.onOutletDeactivated();
  64246. }
  64247. }
  64248. };
  64249. ActivateRoutes.prototype.activateChildRoutes = function (futureNode, currNode, contexts) {
  64250. var _this = this;
  64251. var children = nodeChildrenAsMap(currNode);
  64252. futureNode.children.forEach(function (c) {
  64253. _this.activateRoutes(c, children[c.value.outlet], contexts);
  64254. _this.forwardEvent(new ActivationEnd(c.value.snapshot));
  64255. });
  64256. if (futureNode.children.length) {
  64257. this.forwardEvent(new ChildActivationEnd(futureNode.value.snapshot));
  64258. }
  64259. };
  64260. ActivateRoutes.prototype.activateRoutes = function (futureNode, currNode, parentContexts) {
  64261. var future = futureNode.value;
  64262. var curr = currNode ? currNode.value : null;
  64263. advanceActivatedRoute(future);
  64264. // reusing the node
  64265. if (future === curr) {
  64266. if (future.component) {
  64267. // If we have a normal route, we need to go through an outlet.
  64268. var context = parentContexts.getOrCreateContext(future.outlet);
  64269. this.activateChildRoutes(futureNode, currNode, context.children);
  64270. }
  64271. else {
  64272. // if we have a componentless route, we recurse but keep the same outlet map.
  64273. this.activateChildRoutes(futureNode, currNode, parentContexts);
  64274. }
  64275. }
  64276. else {
  64277. if (future.component) {
  64278. // if we have a normal route, we need to place the component into the outlet and recurse.
  64279. var context = parentContexts.getOrCreateContext(future.outlet);
  64280. if (this.routeReuseStrategy.shouldAttach(future.snapshot)) {
  64281. var stored = this.routeReuseStrategy.retrieve(future.snapshot);
  64282. this.routeReuseStrategy.store(future.snapshot, null);
  64283. context.children.onOutletReAttached(stored.contexts);
  64284. context.attachRef = stored.componentRef;
  64285. context.route = stored.route.value;
  64286. if (context.outlet) {
  64287. // Attach right away when the outlet has already been instantiated
  64288. // Otherwise attach from `RouterOutlet.ngOnInit` when it is instantiated
  64289. context.outlet.attach(stored.componentRef, stored.route.value);
  64290. }
  64291. advanceActivatedRouteNodeAndItsChildren(stored.route);
  64292. }
  64293. else {
  64294. var config = parentLoadedConfig(future.snapshot);
  64295. var cmpFactoryResolver = config ? config.module.componentFactoryResolver : null;
  64296. context.attachRef = null;
  64297. context.route = future;
  64298. context.resolver = cmpFactoryResolver;
  64299. if (context.outlet) {
  64300. // Activate the outlet when it has already been instantiated
  64301. // Otherwise it will get activated from its `ngOnInit` when instantiated
  64302. context.outlet.activateWith(future, cmpFactoryResolver);
  64303. }
  64304. this.activateChildRoutes(futureNode, null, context.children);
  64305. }
  64306. }
  64307. else {
  64308. // if we have a componentless route, we recurse but keep the same outlet map.
  64309. this.activateChildRoutes(futureNode, null, parentContexts);
  64310. }
  64311. }
  64312. };
  64313. return ActivateRoutes;
  64314. }());
  64315. function advanceActivatedRouteNodeAndItsChildren(node) {
  64316. advanceActivatedRoute(node.value);
  64317. node.children.forEach(advanceActivatedRouteNodeAndItsChildren);
  64318. }
  64319. function parentLoadedConfig(snapshot) {
  64320. for (var s = snapshot.parent; s; s = s.parent) {
  64321. var route = s.routeConfig;
  64322. if (route && route._loadedConfig)
  64323. return route._loadedConfig;
  64324. if (route && route.component)
  64325. return null;
  64326. }
  64327. return null;
  64328. }
  64329. function validateCommands(commands) {
  64330. for (var i = 0; i < commands.length; i++) {
  64331. var cmd = commands[i];
  64332. if (cmd == null) {
  64333. throw new Error("The requested path contains " + cmd + " segment at index " + i);
  64334. }
  64335. }
  64336. }
  64337. /**
  64338. * @license
  64339. * Copyright Google Inc. All Rights Reserved.
  64340. *
  64341. * Use of this source code is governed by an MIT-style license that can be
  64342. * found in the LICENSE file at https://angular.io/license
  64343. */
  64344. /**
  64345. * @description
  64346. *
  64347. * Lets you link to specific routes in your app.
  64348. *
  64349. * Consider the following route configuration:
  64350. * `[{ path: 'user/:name', component: UserCmp }]`.
  64351. * When linking to this `user/:name` route, you use the `RouterLink` directive.
  64352. *
  64353. * If the link is static, you can use the directive as follows:
  64354. * `<a routerLink="/user/bob">link to user component</a>`
  64355. *
  64356. * If you use dynamic values to generate the link, you can pass an array of path
  64357. * segments, followed by the params for each segment.
  64358. *
  64359. * For instance `['/team', teamId, 'user', userName, {details: true}]`
  64360. * means that we want to generate a link to `/team/11/user/bob;details=true`.
  64361. *
  64362. * Multiple static segments can be merged into one
  64363. * (e.g., `['/team/11/user', userName, {details: true}]`).
  64364. *
  64365. * The first segment name can be prepended with `/`, `./`, or `../`:
  64366. * * If the first segment begins with `/`, the router will look up the route from the root of the
  64367. * app.
  64368. * * If the first segment begins with `./`, or doesn't begin with a slash, the router will
  64369. * instead look in the children of the current activated route.
  64370. * * And if the first segment begins with `../`, the router will go up one level.
  64371. *
  64372. * You can set query params and fragment as follows:
  64373. *
  64374. * ```
  64375. * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" fragment="education">
  64376. * link to user component
  64377. * </a>
  64378. * ```
  64379. * RouterLink will use these to generate this link: `/user/bob#education?debug=true`.
  64380. *
  64381. * (Deprecated in v4.0.0 use `queryParamsHandling` instead) You can also tell the
  64382. * directive to preserve the current query params and fragment:
  64383. *
  64384. * ```
  64385. * <a [routerLink]="['/user/bob']" preserveQueryParams preserveFragment>
  64386. * link to user component
  64387. * </a>
  64388. * ```
  64389. *
  64390. * You can tell the directive to how to handle queryParams, available options are:
  64391. * - `'merge'`: merge the queryParams into the current queryParams
  64392. * - `'preserve'`: preserve the current queryParams
  64393. * - default/`''`: use the queryParams only
  64394. *
  64395. * Same options for {@link NavigationExtras#queryParamsHandling
  64396. * NavigationExtras#queryParamsHandling}.
  64397. *
  64398. * ```
  64399. * <a [routerLink]="['/user/bob']" [queryParams]="{debug: true}" queryParamsHandling="merge">
  64400. * link to user component
  64401. * </a>
  64402. * ```
  64403. *
  64404. * The router link directive always treats the provided input as a delta to the current url.
  64405. *
  64406. * For instance, if the current url is `/user/(box//aux:team)`.
  64407. *
  64408. * Then the following link `<a [routerLink]="['/user/jim']">Jim</a>` will generate the link
  64409. * `/user/(jim//aux:team)`.
  64410. *
  64411. * See {@link Router#createUrlTree createUrlTree} for more information.
  64412. *
  64413. * @ngModule RouterModule
  64414. *
  64415. *
  64416. */
  64417. var RouterLink = /** @class */ (function () {
  64418. function RouterLink(router, route, tabIndex, renderer, el) {
  64419. this.router = router;
  64420. this.route = route;
  64421. this.commands = [];
  64422. if (tabIndex == null) {
  64423. renderer.setAttribute(el.nativeElement, 'tabindex', '0');
  64424. }
  64425. }
  64426. Object.defineProperty(RouterLink.prototype, "routerLink", {
  64427. set: function (commands) {
  64428. if (commands != null) {
  64429. this.commands = Array.isArray(commands) ? commands : [commands];
  64430. }
  64431. else {
  64432. this.commands = [];
  64433. }
  64434. },
  64435. enumerable: true,
  64436. configurable: true
  64437. });
  64438. Object.defineProperty(RouterLink.prototype, "preserveQueryParams", {
  64439. /**
  64440. * @deprecated 4.0.0 use `queryParamsHandling` instead.
  64441. */
  64442. set: function (value) {
  64443. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && console && console.warn) {
  64444. console.warn('preserveQueryParams is deprecated!, use queryParamsHandling instead.');
  64445. }
  64446. this.preserve = value;
  64447. },
  64448. enumerable: true,
  64449. configurable: true
  64450. });
  64451. RouterLink.prototype.onClick = function () {
  64452. var extras = {
  64453. skipLocationChange: attrBoolValue(this.skipLocationChange),
  64454. replaceUrl: attrBoolValue(this.replaceUrl),
  64455. };
  64456. this.router.navigateByUrl(this.urlTree, extras);
  64457. return true;
  64458. };
  64459. Object.defineProperty(RouterLink.prototype, "urlTree", {
  64460. get: function () {
  64461. return this.router.createUrlTree(this.commands, {
  64462. relativeTo: this.route,
  64463. queryParams: this.queryParams,
  64464. fragment: this.fragment,
  64465. preserveQueryParams: attrBoolValue(this.preserve),
  64466. queryParamsHandling: this.queryParamsHandling,
  64467. preserveFragment: attrBoolValue(this.preserveFragment),
  64468. });
  64469. },
  64470. enumerable: true,
  64471. configurable: true
  64472. });
  64473. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64474. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64475. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  64476. ], RouterLink.prototype, "queryParams", void 0);
  64477. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64478. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64479. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  64480. ], RouterLink.prototype, "fragment", void 0);
  64481. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64482. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64483. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  64484. ], RouterLink.prototype, "queryParamsHandling", void 0);
  64485. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64486. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64487. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  64488. ], RouterLink.prototype, "preserveFragment", void 0);
  64489. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64490. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64491. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  64492. ], RouterLink.prototype, "skipLocationChange", void 0);
  64493. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64494. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64495. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  64496. ], RouterLink.prototype, "replaceUrl", void 0);
  64497. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64498. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64499. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  64500. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  64501. ], RouterLink.prototype, "routerLink", null);
  64502. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64503. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64504. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean),
  64505. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Boolean])
  64506. ], RouterLink.prototype, "preserveQueryParams", null);
  64507. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64508. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["HostListener"])('click'),
  64509. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Function),
  64510. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", []),
  64511. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:returntype", Boolean)
  64512. ], RouterLink.prototype, "onClick", null);
  64513. RouterLink = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64514. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: ':not(a)[routerLink]' }),
  64515. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(2, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Attribute"])('tabindex')),
  64516. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Router, ActivatedRoute, String, _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"]])
  64517. ], RouterLink);
  64518. return RouterLink;
  64519. }());
  64520. /**
  64521. * @description
  64522. *
  64523. * Lets you link to specific routes in your app.
  64524. *
  64525. * See `RouterLink` for more information.
  64526. *
  64527. * @ngModule RouterModule
  64528. *
  64529. *
  64530. */
  64531. var RouterLinkWithHref = /** @class */ (function () {
  64532. function RouterLinkWithHref(router, route, locationStrategy) {
  64533. var _this = this;
  64534. this.router = router;
  64535. this.route = route;
  64536. this.locationStrategy = locationStrategy;
  64537. this.commands = [];
  64538. this.subscription = router.events.subscribe(function (s) {
  64539. if (s instanceof NavigationEnd) {
  64540. _this.updateTargetUrlAndHref();
  64541. }
  64542. });
  64543. }
  64544. Object.defineProperty(RouterLinkWithHref.prototype, "routerLink", {
  64545. set: function (commands) {
  64546. if (commands != null) {
  64547. this.commands = Array.isArray(commands) ? commands : [commands];
  64548. }
  64549. else {
  64550. this.commands = [];
  64551. }
  64552. },
  64553. enumerable: true,
  64554. configurable: true
  64555. });
  64556. Object.defineProperty(RouterLinkWithHref.prototype, "preserveQueryParams", {
  64557. set: function (value) {
  64558. if (Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["isDevMode"])() && console && console.warn) {
  64559. console.warn('preserveQueryParams is deprecated, use queryParamsHandling instead.');
  64560. }
  64561. this.preserve = value;
  64562. },
  64563. enumerable: true,
  64564. configurable: true
  64565. });
  64566. RouterLinkWithHref.prototype.ngOnChanges = function (changes) { this.updateTargetUrlAndHref(); };
  64567. RouterLinkWithHref.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); };
  64568. RouterLinkWithHref.prototype.onClick = function (button, ctrlKey, metaKey, shiftKey) {
  64569. if (button !== 0 || ctrlKey || metaKey || shiftKey) {
  64570. return true;
  64571. }
  64572. if (typeof this.target === 'string' && this.target != '_self') {
  64573. return true;
  64574. }
  64575. var extras = {
  64576. skipLocationChange: attrBoolValue(this.skipLocationChange),
  64577. replaceUrl: attrBoolValue(this.replaceUrl),
  64578. };
  64579. this.router.navigateByUrl(this.urlTree, extras);
  64580. return false;
  64581. };
  64582. RouterLinkWithHref.prototype.updateTargetUrlAndHref = function () {
  64583. this.href = this.locationStrategy.prepareExternalUrl(this.router.serializeUrl(this.urlTree));
  64584. };
  64585. Object.defineProperty(RouterLinkWithHref.prototype, "urlTree", {
  64586. get: function () {
  64587. return this.router.createUrlTree(this.commands, {
  64588. relativeTo: this.route,
  64589. queryParams: this.queryParams,
  64590. fragment: this.fragment,
  64591. preserveQueryParams: attrBoolValue(this.preserve),
  64592. queryParamsHandling: this.queryParamsHandling,
  64593. preserveFragment: attrBoolValue(this.preserveFragment),
  64594. });
  64595. },
  64596. enumerable: true,
  64597. configurable: true
  64598. });
  64599. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64600. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["HostBinding"])('attr.target'), Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64601. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  64602. ], RouterLinkWithHref.prototype, "target", void 0);
  64603. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64604. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64605. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  64606. ], RouterLinkWithHref.prototype, "queryParams", void 0);
  64607. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64608. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64609. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  64610. ], RouterLinkWithHref.prototype, "fragment", void 0);
  64611. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64612. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64613. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  64614. ], RouterLinkWithHref.prototype, "queryParamsHandling", void 0);
  64615. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64616. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64617. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  64618. ], RouterLinkWithHref.prototype, "preserveFragment", void 0);
  64619. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64620. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64621. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  64622. ], RouterLinkWithHref.prototype, "skipLocationChange", void 0);
  64623. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64624. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64625. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean)
  64626. ], RouterLinkWithHref.prototype, "replaceUrl", void 0);
  64627. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64628. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["HostBinding"])(),
  64629. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", String)
  64630. ], RouterLinkWithHref.prototype, "href", void 0);
  64631. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64632. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64633. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  64634. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  64635. ], RouterLinkWithHref.prototype, "routerLink", null);
  64636. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64637. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64638. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Boolean),
  64639. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Boolean])
  64640. ], RouterLinkWithHref.prototype, "preserveQueryParams", null);
  64641. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64642. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["HostListener"])('click', ['$event.button', '$event.ctrlKey', '$event.metaKey', '$event.shiftKey']),
  64643. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Function),
  64644. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Number, Boolean, Boolean, Boolean]),
  64645. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:returntype", Boolean)
  64646. ], RouterLinkWithHref.prototype, "onClick", null);
  64647. RouterLinkWithHref = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64648. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: 'a[routerLink]' }),
  64649. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Router, ActivatedRoute,
  64650. _angular_common__WEBPACK_IMPORTED_MODULE_4__["LocationStrategy"]])
  64651. ], RouterLinkWithHref);
  64652. return RouterLinkWithHref;
  64653. }());
  64654. function attrBoolValue(s) {
  64655. return s === '' || !!s;
  64656. }
  64657. /**
  64658. * @license
  64659. * Copyright Google Inc. All Rights Reserved.
  64660. *
  64661. * Use of this source code is governed by an MIT-style license that can be
  64662. * found in the LICENSE file at https://angular.io/license
  64663. */
  64664. /**
  64665. *
  64666. * @description
  64667. *
  64668. * Lets you add a CSS class to an element when the link's route becomes active.
  64669. *
  64670. * This directive lets you add a CSS class to an element when the link's route
  64671. * becomes active.
  64672. *
  64673. * Consider the following example:
  64674. *
  64675. * ```
  64676. * <a routerLink="/user/bob" routerLinkActive="active-link">Bob</a>
  64677. * ```
  64678. *
  64679. * When the url is either '/user' or '/user/bob', the active-link class will
  64680. * be added to the `a` tag. If the url changes, the class will be removed.
  64681. *
  64682. * You can set more than one class, as follows:
  64683. *
  64684. * ```
  64685. * <a routerLink="/user/bob" routerLinkActive="class1 class2">Bob</a>
  64686. * <a routerLink="/user/bob" [routerLinkActive]="['class1', 'class2']">Bob</a>
  64687. * ```
  64688. *
  64689. * You can configure RouterLinkActive by passing `exact: true`. This will add the classes
  64690. * only when the url matches the link exactly.
  64691. *
  64692. * ```
  64693. * <a routerLink="/user/bob" routerLinkActive="active-link" [routerLinkActiveOptions]="{exact:
  64694. * true}">Bob</a>
  64695. * ```
  64696. *
  64697. * You can assign the RouterLinkActive instance to a template variable and directly check
  64698. * the `isActive` status.
  64699. * ```
  64700. * <a routerLink="/user/bob" routerLinkActive #rla="routerLinkActive">
  64701. * Bob {{ rla.isActive ? '(already open)' : ''}}
  64702. * </a>
  64703. * ```
  64704. *
  64705. * Finally, you can apply the RouterLinkActive directive to an ancestor of a RouterLink.
  64706. *
  64707. * ```
  64708. * <div routerLinkActive="active-link" [routerLinkActiveOptions]="{exact: true}">
  64709. * <a routerLink="/user/jim">Jim</a>
  64710. * <a routerLink="/user/bob">Bob</a>
  64711. * </div>
  64712. * ```
  64713. *
  64714. * This will set the active-link class on the div tag if the url is either '/user/jim' or
  64715. * '/user/bob'.
  64716. *
  64717. * @ngModule RouterModule
  64718. *
  64719. *
  64720. */
  64721. var RouterLinkActive = /** @class */ (function () {
  64722. function RouterLinkActive(router, element, renderer, cdr) {
  64723. var _this = this;
  64724. this.router = router;
  64725. this.element = element;
  64726. this.renderer = renderer;
  64727. this.cdr = cdr;
  64728. this.classes = [];
  64729. this.isActive = false;
  64730. this.routerLinkActiveOptions = { exact: false };
  64731. this.subscription = router.events.subscribe(function (s) {
  64732. if (s instanceof NavigationEnd) {
  64733. _this.update();
  64734. }
  64735. });
  64736. }
  64737. RouterLinkActive.prototype.ngAfterContentInit = function () {
  64738. var _this = this;
  64739. this.links.changes.subscribe(function (_) { return _this.update(); });
  64740. this.linksWithHrefs.changes.subscribe(function (_) { return _this.update(); });
  64741. this.update();
  64742. };
  64743. Object.defineProperty(RouterLinkActive.prototype, "routerLinkActive", {
  64744. set: function (data) {
  64745. var classes = Array.isArray(data) ? data : data.split(' ');
  64746. this.classes = classes.filter(function (c) { return !!c; });
  64747. },
  64748. enumerable: true,
  64749. configurable: true
  64750. });
  64751. RouterLinkActive.prototype.ngOnChanges = function (changes) { this.update(); };
  64752. RouterLinkActive.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); };
  64753. RouterLinkActive.prototype.update = function () {
  64754. var _this = this;
  64755. if (!this.links || !this.linksWithHrefs || !this.router.navigated)
  64756. return;
  64757. Promise.resolve().then(function () {
  64758. var hasActiveLinks = _this.hasActiveLinks();
  64759. if (_this.isActive !== hasActiveLinks) {
  64760. _this.isActive = hasActiveLinks;
  64761. _this.classes.forEach(function (c) {
  64762. if (hasActiveLinks) {
  64763. _this.renderer.addClass(_this.element.nativeElement, c);
  64764. }
  64765. else {
  64766. _this.renderer.removeClass(_this.element.nativeElement, c);
  64767. }
  64768. });
  64769. }
  64770. });
  64771. };
  64772. RouterLinkActive.prototype.isLinkActive = function (router) {
  64773. var _this = this;
  64774. return function (link) {
  64775. return router.isActive(link.urlTree, _this.routerLinkActiveOptions.exact);
  64776. };
  64777. };
  64778. RouterLinkActive.prototype.hasActiveLinks = function () {
  64779. return this.links.some(this.isLinkActive(this.router)) ||
  64780. this.linksWithHrefs.some(this.isLinkActive(this.router));
  64781. };
  64782. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64783. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChildren"])(RouterLink, { descendants: true }),
  64784. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"])
  64785. ], RouterLinkActive.prototype, "links", void 0);
  64786. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64787. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ContentChildren"])(RouterLinkWithHref, { descendants: true }),
  64788. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", _angular_core__WEBPACK_IMPORTED_MODULE_1__["QueryList"])
  64789. ], RouterLinkActive.prototype, "linksWithHrefs", void 0);
  64790. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64791. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64792. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  64793. ], RouterLinkActive.prototype, "routerLinkActiveOptions", void 0);
  64794. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64795. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Input"])(),
  64796. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object),
  64797. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object])
  64798. ], RouterLinkActive.prototype, "routerLinkActive", null);
  64799. RouterLinkActive = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  64800. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({
  64801. selector: '[routerLinkActive]',
  64802. exportAs: 'routerLinkActive',
  64803. }),
  64804. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Router, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ElementRef"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Renderer2"],
  64805. _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"]])
  64806. ], RouterLinkActive);
  64807. return RouterLinkActive;
  64808. }());
  64809. /**
  64810. * @license
  64811. * Copyright Google Inc. All Rights Reserved.
  64812. *
  64813. * Use of this source code is governed by an MIT-style license that can be
  64814. * found in the LICENSE file at https://angular.io/license
  64815. */
  64816. /**
  64817. * Store contextual information about a `RouterOutlet`
  64818. *
  64819. *
  64820. */
  64821. var OutletContext = /** @class */ (function () {
  64822. function OutletContext() {
  64823. this.outlet = null;
  64824. this.route = null;
  64825. this.resolver = null;
  64826. this.children = new ChildrenOutletContexts();
  64827. this.attachRef = null;
  64828. }
  64829. return OutletContext;
  64830. }());
  64831. /**
  64832. * Store contextual information about the children (= nested) `RouterOutlet`
  64833. *
  64834. *
  64835. */
  64836. var ChildrenOutletContexts = /** @class */ (function () {
  64837. function ChildrenOutletContexts() {
  64838. // contexts for child outlets, by name.
  64839. this.contexts = new Map();
  64840. }
  64841. /** Called when a `RouterOutlet` directive is instantiated */
  64842. ChildrenOutletContexts.prototype.onChildOutletCreated = function (childName, outlet) {
  64843. var context = this.getOrCreateContext(childName);
  64844. context.outlet = outlet;
  64845. this.contexts.set(childName, context);
  64846. };
  64847. /**
  64848. * Called when a `RouterOutlet` directive is destroyed.
  64849. * We need to keep the context as the outlet could be destroyed inside a NgIf and might be
  64850. * re-created later.
  64851. */
  64852. ChildrenOutletContexts.prototype.onChildOutletDestroyed = function (childName) {
  64853. var context = this.getContext(childName);
  64854. if (context) {
  64855. context.outlet = null;
  64856. }
  64857. };
  64858. /**
  64859. * Called when the corresponding route is deactivated during navigation.
  64860. * Because the component get destroyed, all children outlet are destroyed.
  64861. */
  64862. ChildrenOutletContexts.prototype.onOutletDeactivated = function () {
  64863. var contexts = this.contexts;
  64864. this.contexts = new Map();
  64865. return contexts;
  64866. };
  64867. ChildrenOutletContexts.prototype.onOutletReAttached = function (contexts) { this.contexts = contexts; };
  64868. ChildrenOutletContexts.prototype.getOrCreateContext = function (childName) {
  64869. var context = this.getContext(childName);
  64870. if (!context) {
  64871. context = new OutletContext();
  64872. this.contexts.set(childName, context);
  64873. }
  64874. return context;
  64875. };
  64876. ChildrenOutletContexts.prototype.getContext = function (childName) { return this.contexts.get(childName) || null; };
  64877. return ChildrenOutletContexts;
  64878. }());
  64879. /**
  64880. * @license
  64881. * Copyright Google Inc. All Rights Reserved.
  64882. *
  64883. * Use of this source code is governed by an MIT-style license that can be
  64884. * found in the LICENSE file at https://angular.io/license
  64885. */
  64886. /**
  64887. * @description
  64888. *
  64889. * Acts as a placeholder that Angular dynamically fills based on the current router state.
  64890. *
  64891. * ```
  64892. * <router-outlet></router-outlet>
  64893. * <router-outlet name='left'></router-outlet>
  64894. * <router-outlet name='right'></router-outlet>
  64895. * ```
  64896. *
  64897. * A router outlet will emit an activate event any time a new component is being instantiated,
  64898. * and a deactivate event when it is being destroyed.
  64899. *
  64900. * ```
  64901. * <router-outlet
  64902. * (activate)='onActivate($event)'
  64903. * (deactivate)='onDeactivate($event)'></router-outlet>
  64904. * ```
  64905. * @ngModule RouterModule
  64906. *
  64907. *
  64908. */
  64909. var RouterOutlet = /** @class */ (function () {
  64910. function RouterOutlet(parentContexts, location, resolver, name, changeDetector) {
  64911. this.parentContexts = parentContexts;
  64912. this.location = location;
  64913. this.resolver = resolver;
  64914. this.changeDetector = changeDetector;
  64915. this.activated = null;
  64916. this._activatedRoute = null;
  64917. this.activateEvents = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  64918. this.deactivateEvents = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["EventEmitter"]();
  64919. this.name = name || PRIMARY_OUTLET;
  64920. parentContexts.onChildOutletCreated(this.name, this);
  64921. }
  64922. RouterOutlet.prototype.ngOnDestroy = function () { this.parentContexts.onChildOutletDestroyed(this.name); };
  64923. RouterOutlet.prototype.ngOnInit = function () {
  64924. if (!this.activated) {
  64925. // If the outlet was not instantiated at the time the route got activated we need to populate
  64926. // the outlet when it is initialized (ie inside a NgIf)
  64927. var context = this.parentContexts.getContext(this.name);
  64928. if (context && context.route) {
  64929. if (context.attachRef) {
  64930. // `attachRef` is populated when there is an existing component to mount
  64931. this.attach(context.attachRef, context.route);
  64932. }
  64933. else {
  64934. // otherwise the component defined in the configuration is created
  64935. this.activateWith(context.route, context.resolver || null);
  64936. }
  64937. }
  64938. }
  64939. };
  64940. Object.defineProperty(RouterOutlet.prototype, "isActivated", {
  64941. get: function () { return !!this.activated; },
  64942. enumerable: true,
  64943. configurable: true
  64944. });
  64945. Object.defineProperty(RouterOutlet.prototype, "component", {
  64946. get: function () {
  64947. if (!this.activated)
  64948. throw new Error('Outlet is not activated');
  64949. return this.activated.instance;
  64950. },
  64951. enumerable: true,
  64952. configurable: true
  64953. });
  64954. Object.defineProperty(RouterOutlet.prototype, "activatedRoute", {
  64955. get: function () {
  64956. if (!this.activated)
  64957. throw new Error('Outlet is not activated');
  64958. return this._activatedRoute;
  64959. },
  64960. enumerable: true,
  64961. configurable: true
  64962. });
  64963. Object.defineProperty(RouterOutlet.prototype, "activatedRouteData", {
  64964. get: function () {
  64965. if (this._activatedRoute) {
  64966. return this._activatedRoute.snapshot.data;
  64967. }
  64968. return {};
  64969. },
  64970. enumerable: true,
  64971. configurable: true
  64972. });
  64973. /**
  64974. * Called when the `RouteReuseStrategy` instructs to detach the subtree
  64975. */
  64976. RouterOutlet.prototype.detach = function () {
  64977. if (!this.activated)
  64978. throw new Error('Outlet is not activated');
  64979. this.location.detach();
  64980. var cmp = this.activated;
  64981. this.activated = null;
  64982. this._activatedRoute = null;
  64983. return cmp;
  64984. };
  64985. /**
  64986. * Called when the `RouteReuseStrategy` instructs to re-attach a previously detached subtree
  64987. */
  64988. RouterOutlet.prototype.attach = function (ref, activatedRoute) {
  64989. this.activated = ref;
  64990. this._activatedRoute = activatedRoute;
  64991. this.location.insert(ref.hostView);
  64992. };
  64993. RouterOutlet.prototype.deactivate = function () {
  64994. if (this.activated) {
  64995. var c = this.component;
  64996. this.activated.destroy();
  64997. this.activated = null;
  64998. this._activatedRoute = null;
  64999. this.deactivateEvents.emit(c);
  65000. }
  65001. };
  65002. RouterOutlet.prototype.activateWith = function (activatedRoute, resolver) {
  65003. if (this.isActivated) {
  65004. throw new Error('Cannot activate an already activated outlet');
  65005. }
  65006. this._activatedRoute = activatedRoute;
  65007. var snapshot = activatedRoute._futureSnapshot;
  65008. var component = snapshot.routeConfig.component;
  65009. resolver = resolver || this.resolver;
  65010. var factory = resolver.resolveComponentFactory(component);
  65011. var childContexts = this.parentContexts.getOrCreateContext(this.name).children;
  65012. var injector = new OutletInjector(activatedRoute, childContexts, this.location.injector);
  65013. this.activated = this.location.createComponent(factory, this.location.length, injector);
  65014. // Calling `markForCheck` to make sure we will run the change detection when the
  65015. // `RouterOutlet` is inside a `ChangeDetectionStrategy.OnPush` component.
  65016. this.changeDetector.markForCheck();
  65017. this.activateEvents.emit(this.activated.instance);
  65018. };
  65019. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  65020. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])('activate'),
  65021. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  65022. ], RouterOutlet.prototype, "activateEvents", void 0);
  65023. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  65024. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Output"])('deactivate'),
  65025. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:type", Object)
  65026. ], RouterOutlet.prototype, "deactivateEvents", void 0);
  65027. RouterOutlet = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  65028. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Directive"])({ selector: 'router-outlet', exportAs: 'outlet' }),
  65029. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(3, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Attribute"])('name')),
  65030. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [ChildrenOutletContexts, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ViewContainerRef"],
  65031. _angular_core__WEBPACK_IMPORTED_MODULE_1__["ComponentFactoryResolver"], String, _angular_core__WEBPACK_IMPORTED_MODULE_1__["ChangeDetectorRef"]])
  65032. ], RouterOutlet);
  65033. return RouterOutlet;
  65034. }());
  65035. var OutletInjector = /** @class */ (function () {
  65036. function OutletInjector(route, childContexts, parent) {
  65037. this.route = route;
  65038. this.childContexts = childContexts;
  65039. this.parent = parent;
  65040. }
  65041. OutletInjector.prototype.get = function (token, notFoundValue) {
  65042. if (token === ActivatedRoute) {
  65043. return this.route;
  65044. }
  65045. if (token === ChildrenOutletContexts) {
  65046. return this.childContexts;
  65047. }
  65048. return this.parent.get(token, notFoundValue);
  65049. };
  65050. return OutletInjector;
  65051. }());
  65052. /**
  65053. *@license
  65054. *Copyright Google Inc. All Rights Reserved.
  65055. *
  65056. *Use of this source code is governed by an MIT-style license that can be
  65057. *found in the LICENSE file at https://angular.io/license
  65058. */
  65059. /**
  65060. * @description
  65061. *
  65062. * Provides a preloading strategy.
  65063. *
  65064. * @experimental
  65065. */
  65066. var PreloadingStrategy = /** @class */ (function () {
  65067. function PreloadingStrategy() {
  65068. }
  65069. return PreloadingStrategy;
  65070. }());
  65071. /**
  65072. * @description
  65073. *
  65074. * Provides a preloading strategy that preloads all modules as quickly as possible.
  65075. *
  65076. * ```
  65077. * RouteModule.forRoot(ROUTES, {preloadingStrategy: PreloadAllModules})
  65078. * ```
  65079. *
  65080. * @experimental
  65081. */
  65082. var PreloadAllModules = /** @class */ (function () {
  65083. function PreloadAllModules() {
  65084. }
  65085. PreloadAllModules.prototype.preload = function (route, fn) {
  65086. return fn().pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["catchError"])(function () { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null); }));
  65087. };
  65088. return PreloadAllModules;
  65089. }());
  65090. /**
  65091. * @description
  65092. *
  65093. * Provides a preloading strategy that does not preload any modules.
  65094. *
  65095. * This strategy is enabled by default.
  65096. *
  65097. * @experimental
  65098. */
  65099. var NoPreloading = /** @class */ (function () {
  65100. function NoPreloading() {
  65101. }
  65102. NoPreloading.prototype.preload = function (route, fn) { return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null); };
  65103. return NoPreloading;
  65104. }());
  65105. /**
  65106. * The preloader optimistically loads all router configurations to
  65107. * make navigations into lazily-loaded sections of the application faster.
  65108. *
  65109. * The preloader runs in the background. When the router bootstraps, the preloader
  65110. * starts listening to all navigation events. After every such event, the preloader
  65111. * will check if any configurations can be loaded lazily.
  65112. *
  65113. * If a route is protected by `canLoad` guards, the preloaded will not load it.
  65114. *
  65115. *
  65116. */
  65117. var RouterPreloader = /** @class */ (function () {
  65118. function RouterPreloader(router, moduleLoader, compiler, injector, preloadingStrategy) {
  65119. this.router = router;
  65120. this.injector = injector;
  65121. this.preloadingStrategy = preloadingStrategy;
  65122. var onStartLoad = function (r) { return router.triggerEvent(new RouteConfigLoadStart(r)); };
  65123. var onEndLoad = function (r) { return router.triggerEvent(new RouteConfigLoadEnd(r)); };
  65124. this.loader = new RouterConfigLoader(moduleLoader, compiler, onStartLoad, onEndLoad);
  65125. }
  65126. RouterPreloader.prototype.setUpPreloading = function () {
  65127. var _this = this;
  65128. this.subscription =
  65129. this.router.events
  65130. .pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["filter"])(function (e) { return e instanceof NavigationEnd; }), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["concatMap"])(function () { return _this.preload(); }))
  65131. .subscribe(function () { });
  65132. };
  65133. RouterPreloader.prototype.preload = function () {
  65134. var ngModule = this.injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleRef"]);
  65135. return this.processRoutes(ngModule, this.router.config);
  65136. };
  65137. // TODO(jasonaden): This class relies on code external to the class to call setUpPreloading. If
  65138. // this hasn't been done, ngOnDestroy will fail as this.subscription will be undefined. This
  65139. // should be refactored.
  65140. RouterPreloader.prototype.ngOnDestroy = function () { this.subscription.unsubscribe(); };
  65141. RouterPreloader.prototype.processRoutes = function (ngModule, routes) {
  65142. var e_1, _a;
  65143. var res = [];
  65144. try {
  65145. for (var routes_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__values"])(routes), routes_1_1 = routes_1.next(); !routes_1_1.done; routes_1_1 = routes_1.next()) {
  65146. var route = routes_1_1.value;
  65147. // we already have the config loaded, just recurse
  65148. if (route.loadChildren && !route.canLoad && route._loadedConfig) {
  65149. var childConfig = route._loadedConfig;
  65150. res.push(this.processRoutes(childConfig.module, childConfig.routes));
  65151. // no config loaded, fetch the config
  65152. }
  65153. else if (route.loadChildren && !route.canLoad) {
  65154. res.push(this.preloadConfig(ngModule, route));
  65155. // recurse into children
  65156. }
  65157. else if (route.children) {
  65158. res.push(this.processRoutes(ngModule, route.children));
  65159. }
  65160. }
  65161. }
  65162. catch (e_1_1) { e_1 = { error: e_1_1 }; }
  65163. finally {
  65164. try {
  65165. if (routes_1_1 && !routes_1_1.done && (_a = routes_1.return)) _a.call(routes_1);
  65166. }
  65167. finally { if (e_1) throw e_1.error; }
  65168. }
  65169. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["from"])(res).pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeAll"])(), Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["map"])(function (_) { return void 0; }));
  65170. };
  65171. RouterPreloader.prototype.preloadConfig = function (ngModule, route) {
  65172. var _this = this;
  65173. return this.preloadingStrategy.preload(route, function () {
  65174. var loaded$ = _this.loader.load(ngModule.injector, route);
  65175. return loaded$.pipe(Object(rxjs_operators__WEBPACK_IMPORTED_MODULE_3__["mergeMap"])(function (config) {
  65176. route._loadedConfig = config;
  65177. return _this.processRoutes(config.module, config.routes);
  65178. }));
  65179. });
  65180. };
  65181. RouterPreloader = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  65182. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  65183. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Router, _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactoryLoader"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"],
  65184. _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"], PreloadingStrategy])
  65185. ], RouterPreloader);
  65186. return RouterPreloader;
  65187. }());
  65188. /**
  65189. * @license
  65190. * Copyright Google Inc. All Rights Reserved.
  65191. *
  65192. * Use of this source code is governed by an MIT-style license that can be
  65193. * found in the LICENSE file at https://angular.io/license
  65194. */
  65195. var RouterScroller = /** @class */ (function () {
  65196. function RouterScroller(router,
  65197. /** @docsNotRequired */ viewportScroller, options) {
  65198. if (options === void 0) { options = {}; }
  65199. this.router = router;
  65200. this.viewportScroller = viewportScroller;
  65201. this.options = options;
  65202. this.lastId = 0;
  65203. this.lastSource = 'imperative';
  65204. this.restoredId = 0;
  65205. this.store = {};
  65206. // Default both options to 'disabled'
  65207. options.scrollPositionRestoration = options.scrollPositionRestoration || 'disabled';
  65208. options.anchorScrolling = options.anchorScrolling || 'disabled';
  65209. }
  65210. RouterScroller.prototype.init = function () {
  65211. // we want to disable the automatic scrolling because having two places
  65212. // responsible for scrolling results race conditions, especially given
  65213. // that browser don't implement this behavior consistently
  65214. if (this.options.scrollPositionRestoration !== 'disabled') {
  65215. this.viewportScroller.setHistoryScrollRestoration('manual');
  65216. }
  65217. this.routerEventsSubscription = this.createScrollEvents();
  65218. this.scrollEventsSubscription = this.consumeScrollEvents();
  65219. };
  65220. RouterScroller.prototype.createScrollEvents = function () {
  65221. var _this = this;
  65222. return this.router.events.subscribe(function (e) {
  65223. if (e instanceof NavigationStart) {
  65224. // store the scroll position of the current stable navigations.
  65225. _this.store[_this.lastId] = _this.viewportScroller.getScrollPosition();
  65226. _this.lastSource = e.navigationTrigger;
  65227. _this.restoredId = e.restoredState ? e.restoredState.navigationId : 0;
  65228. }
  65229. else if (e instanceof NavigationEnd) {
  65230. _this.lastId = e.id;
  65231. _this.scheduleScrollEvent(e, _this.router.parseUrl(e.urlAfterRedirects).fragment);
  65232. }
  65233. });
  65234. };
  65235. RouterScroller.prototype.consumeScrollEvents = function () {
  65236. var _this = this;
  65237. return this.router.events.subscribe(function (e) {
  65238. if (!(e instanceof Scroll))
  65239. return;
  65240. // a popstate event. The pop state event will always ignore anchor scrolling.
  65241. if (e.position) {
  65242. if (_this.options.scrollPositionRestoration === 'top') {
  65243. _this.viewportScroller.scrollToPosition([0, 0]);
  65244. }
  65245. else if (_this.options.scrollPositionRestoration === 'enabled') {
  65246. _this.viewportScroller.scrollToPosition(e.position);
  65247. }
  65248. // imperative navigation "forward"
  65249. }
  65250. else {
  65251. if (e.anchor && _this.options.anchorScrolling === 'enabled') {
  65252. _this.viewportScroller.scrollToAnchor(e.anchor);
  65253. }
  65254. else if (_this.options.scrollPositionRestoration !== 'disabled') {
  65255. _this.viewportScroller.scrollToPosition([0, 0]);
  65256. }
  65257. }
  65258. });
  65259. };
  65260. RouterScroller.prototype.scheduleScrollEvent = function (routerEvent, anchor) {
  65261. this.router.triggerEvent(new Scroll(routerEvent, this.lastSource === 'popstate' ? this.store[this.restoredId] : null, anchor));
  65262. };
  65263. RouterScroller.prototype.ngOnDestroy = function () {
  65264. if (this.routerEventsSubscription) {
  65265. this.routerEventsSubscription.unsubscribe();
  65266. }
  65267. if (this.scrollEventsSubscription) {
  65268. this.scrollEventsSubscription.unsubscribe();
  65269. }
  65270. };
  65271. return RouterScroller;
  65272. }());
  65273. /**
  65274. * @license
  65275. * Copyright Google Inc. All Rights Reserved.
  65276. *
  65277. * Use of this source code is governed by an MIT-style license that can be
  65278. * found in the LICENSE file at https://angular.io/license
  65279. */
  65280. /**
  65281. * @description
  65282. *
  65283. * Contains a list of directives
  65284. *
  65285. *
  65286. */
  65287. var ROUTER_DIRECTIVES = [RouterOutlet, RouterLink, RouterLinkWithHref, RouterLinkActive, EmptyOutletComponent];
  65288. /**
  65289. * @description
  65290. *
  65291. * Is used in DI to configure the router.
  65292. *
  65293. *
  65294. */
  65295. var ROUTER_CONFIGURATION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ROUTER_CONFIGURATION');
  65296. /**
  65297. * @docsNotRequired
  65298. */
  65299. var ROUTER_FORROOT_GUARD = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('ROUTER_FORROOT_GUARD');
  65300. var ROUTER_PROVIDERS = [
  65301. _angular_common__WEBPACK_IMPORTED_MODULE_4__["Location"],
  65302. { provide: UrlSerializer, useClass: DefaultUrlSerializer },
  65303. {
  65304. provide: Router,
  65305. useFactory: setupRouter,
  65306. deps: [
  65307. _angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationRef"], UrlSerializer, ChildrenOutletContexts, _angular_common__WEBPACK_IMPORTED_MODULE_4__["Location"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"],
  65308. _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactoryLoader"], _angular_core__WEBPACK_IMPORTED_MODULE_1__["Compiler"], ROUTES, ROUTER_CONFIGURATION,
  65309. [UrlHandlingStrategy, new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()], [RouteReuseStrategy, new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()]
  65310. ]
  65311. },
  65312. ChildrenOutletContexts,
  65313. { provide: ActivatedRoute, useFactory: rootRoute, deps: [Router] },
  65314. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModuleFactoryLoader"], useClass: _angular_core__WEBPACK_IMPORTED_MODULE_1__["SystemJsNgModuleLoader"] },
  65315. RouterPreloader,
  65316. NoPreloading,
  65317. PreloadAllModules,
  65318. { provide: ROUTER_CONFIGURATION, useValue: { enableTracing: false } },
  65319. ];
  65320. function routerNgProbeToken() {
  65321. return new _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgProbeToken"]('Router', Router);
  65322. }
  65323. /**
  65324. * @usageNotes
  65325. *
  65326. * RouterModule can be imported multiple times: once per lazily-loaded bundle.
  65327. * Since the router deals with a global shared resource--location, we cannot have
  65328. * more than one router service active.
  65329. *
  65330. * That is why there are two ways to create the module: `RouterModule.forRoot` and
  65331. * `RouterModule.forChild`.
  65332. *
  65333. * * `forRoot` creates a module that contains all the directives, the given routes, and the router
  65334. * service itself.
  65335. * * `forChild` creates a module that contains all the directives and the given routes, but does not
  65336. * include the router service.
  65337. *
  65338. * When registered at the root, the module should be used as follows
  65339. *
  65340. * ```
  65341. * @NgModule({
  65342. * imports: [RouterModule.forRoot(ROUTES)]
  65343. * })
  65344. * class MyNgModule {}
  65345. * ```
  65346. *
  65347. * For submodules and lazy loaded submodules the module should be used as follows:
  65348. *
  65349. * ```
  65350. * @NgModule({
  65351. * imports: [RouterModule.forChild(ROUTES)]
  65352. * })
  65353. * class MyNgModule {}
  65354. * ```
  65355. *
  65356. * @description
  65357. *
  65358. * Adds router directives and providers.
  65359. *
  65360. * Managing state transitions is one of the hardest parts of building applications. This is
  65361. * especially true on the web, where you also need to ensure that the state is reflected in the URL.
  65362. * In addition, we often want to split applications into multiple bundles and load them on demand.
  65363. * Doing this transparently is not trivial.
  65364. *
  65365. * The Angular router solves these problems. Using the router, you can declaratively specify
  65366. * application states, manage state transitions while taking care of the URL, and load bundles on
  65367. * demand.
  65368. *
  65369. * [Read this developer guide](https://angular.io/docs/ts/latest/guide/router.html) to get an
  65370. * overview of how the router should be used.
  65371. *
  65372. *
  65373. */
  65374. var RouterModule = /** @class */ (function () {
  65375. // Note: We are injecting the Router so it gets created eagerly...
  65376. function RouterModule(guard, router) {
  65377. }
  65378. RouterModule_1 = RouterModule;
  65379. /**
  65380. * Creates a module with all the router providers and directives. It also optionally sets up an
  65381. * application listener to perform an initial navigation.
  65382. *
  65383. * Options (see `ExtraOptions`):
  65384. * * `enableTracing` makes the router log all its internal events to the console.
  65385. * * `useHash` enables the location strategy that uses the URL fragment instead of the history
  65386. * API.
  65387. * * `initialNavigation` disables the initial navigation.
  65388. * * `errorHandler` provides a custom error handler.
  65389. * * `preloadingStrategy` configures a preloading strategy (see `PreloadAllModules`).
  65390. * * `onSameUrlNavigation` configures how the router handles navigation to the current URL. See
  65391. * `ExtraOptions` for more details.
  65392. * * `paramsInheritanceStrategy` defines how the router merges params, data and resolved data
  65393. * from parent to child routes.
  65394. */
  65395. RouterModule.forRoot = function (routes, config) {
  65396. return {
  65397. ngModule: RouterModule_1,
  65398. providers: [
  65399. ROUTER_PROVIDERS,
  65400. provideRoutes(routes),
  65401. {
  65402. provide: ROUTER_FORROOT_GUARD,
  65403. useFactory: provideForRootGuard,
  65404. deps: [[Router, new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"](), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["SkipSelf"]()]]
  65405. },
  65406. { provide: ROUTER_CONFIGURATION, useValue: config ? config : {} },
  65407. {
  65408. provide: _angular_common__WEBPACK_IMPORTED_MODULE_4__["LocationStrategy"],
  65409. useFactory: provideLocationStrategy,
  65410. deps: [
  65411. _angular_common__WEBPACK_IMPORTED_MODULE_4__["PlatformLocation"], [new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"](_angular_common__WEBPACK_IMPORTED_MODULE_4__["APP_BASE_HREF"]), new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"]()], ROUTER_CONFIGURATION
  65412. ]
  65413. },
  65414. {
  65415. provide: RouterScroller,
  65416. useFactory: createRouterScroller,
  65417. deps: [Router, _angular_common__WEBPACK_IMPORTED_MODULE_4__["ViewportScroller"], ROUTER_CONFIGURATION]
  65418. },
  65419. {
  65420. provide: PreloadingStrategy,
  65421. useExisting: config && config.preloadingStrategy ? config.preloadingStrategy :
  65422. NoPreloading
  65423. },
  65424. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["NgProbeToken"], multi: true, useFactory: routerNgProbeToken },
  65425. provideRouterInitializer(),
  65426. ],
  65427. };
  65428. };
  65429. /**
  65430. * Creates a module with all the router directives and a provider registering routes.
  65431. */
  65432. RouterModule.forChild = function (routes) {
  65433. return { ngModule: RouterModule_1, providers: [provideRoutes(routes)] };
  65434. };
  65435. var RouterModule_1;
  65436. RouterModule = RouterModule_1 = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  65437. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["NgModule"])({
  65438. declarations: ROUTER_DIRECTIVES,
  65439. exports: ROUTER_DIRECTIVES,
  65440. entryComponents: [EmptyOutletComponent]
  65441. }),
  65442. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(0, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Inject"])(ROUTER_FORROOT_GUARD)), Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__param"])(1, Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Optional"])()),
  65443. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [Object, Router])
  65444. ], RouterModule);
  65445. return RouterModule;
  65446. }());
  65447. function createRouterScroller(router, viewportScroller, config) {
  65448. if (config.scrollOffset) {
  65449. viewportScroller.setOffset(config.scrollOffset);
  65450. }
  65451. return new RouterScroller(router, viewportScroller, config);
  65452. }
  65453. function provideLocationStrategy(platformLocationStrategy, baseHref, options) {
  65454. if (options === void 0) { options = {}; }
  65455. return options.useHash ? new _angular_common__WEBPACK_IMPORTED_MODULE_4__["HashLocationStrategy"](platformLocationStrategy, baseHref) :
  65456. new _angular_common__WEBPACK_IMPORTED_MODULE_4__["PathLocationStrategy"](platformLocationStrategy, baseHref);
  65457. }
  65458. function provideForRootGuard(router) {
  65459. if (router) {
  65460. throw new Error("RouterModule.forRoot() called twice. Lazy loaded modules should use RouterModule.forChild() instead.");
  65461. }
  65462. return 'guarded';
  65463. }
  65464. /**
  65465. * @description
  65466. *
  65467. * Registers routes.
  65468. *
  65469. * @usageNotes
  65470. * ### Example
  65471. *
  65472. * ```
  65473. * @NgModule({
  65474. * imports: [RouterModule.forChild(ROUTES)],
  65475. * providers: [provideRoutes(EXTRA_ROUTES)]
  65476. * })
  65477. * class MyNgModule {}
  65478. * ```
  65479. *
  65480. *
  65481. */
  65482. function provideRoutes(routes) {
  65483. return [
  65484. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["ANALYZE_FOR_ENTRY_COMPONENTS"], multi: true, useValue: routes },
  65485. { provide: ROUTES, multi: true, useValue: routes },
  65486. ];
  65487. }
  65488. function setupRouter(ref, urlSerializer, contexts, location, injector, loader, compiler, config, opts, urlHandlingStrategy, routeReuseStrategy) {
  65489. if (opts === void 0) { opts = {}; }
  65490. var router = new Router(null, urlSerializer, contexts, location, injector, loader, compiler, flatten(config));
  65491. if (urlHandlingStrategy) {
  65492. router.urlHandlingStrategy = urlHandlingStrategy;
  65493. }
  65494. if (routeReuseStrategy) {
  65495. router.routeReuseStrategy = routeReuseStrategy;
  65496. }
  65497. if (opts.errorHandler) {
  65498. router.errorHandler = opts.errorHandler;
  65499. }
  65500. if (opts.malformedUriErrorHandler) {
  65501. router.malformedUriErrorHandler = opts.malformedUriErrorHandler;
  65502. }
  65503. if (opts.enableTracing) {
  65504. var dom_1 = Object(_angular_platform_browser__WEBPACK_IMPORTED_MODULE_5__["ɵgetDOM"])();
  65505. router.events.subscribe(function (e) {
  65506. dom_1.logGroup("Router Event: " + e.constructor.name);
  65507. dom_1.log(e.toString());
  65508. dom_1.log(e);
  65509. dom_1.logGroupEnd();
  65510. });
  65511. }
  65512. if (opts.onSameUrlNavigation) {
  65513. router.onSameUrlNavigation = opts.onSameUrlNavigation;
  65514. }
  65515. if (opts.paramsInheritanceStrategy) {
  65516. router.paramsInheritanceStrategy = opts.paramsInheritanceStrategy;
  65517. }
  65518. if (opts.urlUpdateStrategy) {
  65519. router.urlUpdateStrategy = opts.urlUpdateStrategy;
  65520. }
  65521. if (opts.relativeLinkResolution) {
  65522. router.relativeLinkResolution = opts.relativeLinkResolution;
  65523. }
  65524. return router;
  65525. }
  65526. function rootRoute(router) {
  65527. return router.routerState.root;
  65528. }
  65529. /**
  65530. * To initialize the router properly we need to do in two steps:
  65531. *
  65532. * We need to start the navigation in a APP_INITIALIZER to block the bootstrap if
  65533. * a resolver or a guards executes asynchronously. Second, we need to actually run
  65534. * activation in a BOOTSTRAP_LISTENER. We utilize the afterPreactivation
  65535. * hook provided by the router to do that.
  65536. *
  65537. * The router navigation starts, reaches the point when preactivation is done, and then
  65538. * pauses. It waits for the hook to be resolved. We then resolve it only in a bootstrap listener.
  65539. */
  65540. var RouterInitializer = /** @class */ (function () {
  65541. function RouterInitializer(injector) {
  65542. this.injector = injector;
  65543. this.initNavigation = false;
  65544. this.resultOfPreactivationDone = new rxjs__WEBPACK_IMPORTED_MODULE_2__["Subject"]();
  65545. }
  65546. RouterInitializer.prototype.appInitializer = function () {
  65547. var _this = this;
  65548. var p = this.injector.get(_angular_common__WEBPACK_IMPORTED_MODULE_4__["LOCATION_INITIALIZED"], Promise.resolve(null));
  65549. return p.then(function () {
  65550. var resolve = null;
  65551. var res = new Promise(function (r) { return resolve = r; });
  65552. var router = _this.injector.get(Router);
  65553. var opts = _this.injector.get(ROUTER_CONFIGURATION);
  65554. if (_this.isLegacyDisabled(opts) || _this.isLegacyEnabled(opts)) {
  65555. resolve(true);
  65556. }
  65557. else if (opts.initialNavigation === 'disabled') {
  65558. router.setUpLocationChangeListener();
  65559. resolve(true);
  65560. }
  65561. else if (opts.initialNavigation === 'enabled') {
  65562. router.hooks.afterPreactivation = function () {
  65563. // only the initial navigation should be delayed
  65564. if (!_this.initNavigation) {
  65565. _this.initNavigation = true;
  65566. resolve(true);
  65567. return _this.resultOfPreactivationDone;
  65568. // subsequent navigations should not be delayed
  65569. }
  65570. else {
  65571. return Object(rxjs__WEBPACK_IMPORTED_MODULE_2__["of"])(null);
  65572. }
  65573. };
  65574. router.initialNavigation();
  65575. }
  65576. else {
  65577. throw new Error("Invalid initialNavigation options: '" + opts.initialNavigation + "'");
  65578. }
  65579. return res;
  65580. });
  65581. };
  65582. RouterInitializer.prototype.bootstrapListener = function (bootstrappedComponentRef) {
  65583. var opts = this.injector.get(ROUTER_CONFIGURATION);
  65584. var preloader = this.injector.get(RouterPreloader);
  65585. var routerScroller = this.injector.get(RouterScroller);
  65586. var router = this.injector.get(Router);
  65587. var ref = this.injector.get(_angular_core__WEBPACK_IMPORTED_MODULE_1__["ApplicationRef"]);
  65588. if (bootstrappedComponentRef !== ref.components[0]) {
  65589. return;
  65590. }
  65591. if (this.isLegacyEnabled(opts)) {
  65592. router.initialNavigation();
  65593. }
  65594. else if (this.isLegacyDisabled(opts)) {
  65595. router.setUpLocationChangeListener();
  65596. }
  65597. preloader.setUpPreloading();
  65598. routerScroller.init();
  65599. router.resetRootComponentType(ref.componentTypes[0]);
  65600. this.resultOfPreactivationDone.next(null);
  65601. this.resultOfPreactivationDone.complete();
  65602. };
  65603. RouterInitializer.prototype.isLegacyEnabled = function (opts) {
  65604. return opts.initialNavigation === 'legacy_enabled' || opts.initialNavigation === true ||
  65605. opts.initialNavigation === undefined;
  65606. };
  65607. RouterInitializer.prototype.isLegacyDisabled = function (opts) {
  65608. return opts.initialNavigation === 'legacy_disabled' || opts.initialNavigation === false;
  65609. };
  65610. RouterInitializer = Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__decorate"])([
  65611. Object(_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injectable"])(),
  65612. Object(tslib__WEBPACK_IMPORTED_MODULE_0__["__metadata"])("design:paramtypes", [_angular_core__WEBPACK_IMPORTED_MODULE_1__["Injector"]])
  65613. ], RouterInitializer);
  65614. return RouterInitializer;
  65615. }());
  65616. function getAppInitializer(r) {
  65617. return r.appInitializer.bind(r);
  65618. }
  65619. function getBootstrapListener(r) {
  65620. return r.bootstrapListener.bind(r);
  65621. }
  65622. /**
  65623. * A token for the router initializer that will be called after the app is bootstrapped.
  65624. *
  65625. * @experimental
  65626. */
  65627. var ROUTER_INITIALIZER = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["InjectionToken"]('Router Initializer');
  65628. function provideRouterInitializer() {
  65629. return [
  65630. RouterInitializer,
  65631. {
  65632. provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_INITIALIZER"],
  65633. multi: true,
  65634. useFactory: getAppInitializer,
  65635. deps: [RouterInitializer]
  65636. },
  65637. { provide: ROUTER_INITIALIZER, useFactory: getBootstrapListener, deps: [RouterInitializer] },
  65638. { provide: _angular_core__WEBPACK_IMPORTED_MODULE_1__["APP_BOOTSTRAP_LISTENER"], multi: true, useExisting: ROUTER_INITIALIZER },
  65639. ];
  65640. }
  65641. /**
  65642. * @license
  65643. * Copyright Google Inc. All Rights Reserved.
  65644. *
  65645. * Use of this source code is governed by an MIT-style license that can be
  65646. * found in the LICENSE file at https://angular.io/license
  65647. */
  65648. var VERSION = new _angular_core__WEBPACK_IMPORTED_MODULE_1__["Version"]('6.1.10');
  65649. /**
  65650. * @license
  65651. * Copyright Google Inc. All Rights Reserved.
  65652. *
  65653. * Use of this source code is governed by an MIT-style license that can be
  65654. * found in the LICENSE file at https://angular.io/license
  65655. */
  65656. /**
  65657. * @license
  65658. * Copyright Google Inc. All Rights Reserved.
  65659. *
  65660. * Use of this source code is governed by an MIT-style license that can be
  65661. * found in the LICENSE file at https://angular.io/license
  65662. */
  65663. /**
  65664. * @license
  65665. * Copyright Google Inc. All Rights Reserved.
  65666. *
  65667. * Use of this source code is governed by an MIT-style license that can be
  65668. * found in the LICENSE file at https://angular.io/license
  65669. */
  65670. // This file only reexports content of the `src` folder. Keep it that way.
  65671. /**
  65672. * @license
  65673. * Copyright Google Inc. All Rights Reserved.
  65674. *
  65675. * Use of this source code is governed by an MIT-style license that can be
  65676. * found in the LICENSE file at https://angular.io/license
  65677. */
  65678. /**
  65679. * Generated bundle index. Do not edit.
  65680. */
  65681. //# sourceMappingURL=router.js.map
  65682. /***/ }),
  65683. /***/ "./node_modules/angularx-qrcode/dist/angularx-qrcode.module.js":
  65684. /*!*********************************************************************!*\
  65685. !*** ./node_modules/angularx-qrcode/dist/angularx-qrcode.module.js ***!
  65686. \*********************************************************************/
  65687. /*! exports provided: QRCodeModule */
  65688. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  65689. "use strict";
  65690. __webpack_require__.r(__webpack_exports__);
  65691. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QRCodeModule", function() { return QRCodeModule; });
  65692. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  65693. /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./components */ "./node_modules/angularx-qrcode/dist/components/index.js");
  65694. var QRCodeModule = /** @class */ (function () {
  65695. function QRCodeModule() {
  65696. }
  65697. QRCodeModule.decorators = [
  65698. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{
  65699. providers: [],
  65700. declarations: [
  65701. _components__WEBPACK_IMPORTED_MODULE_1__["QRCodeComponent"],
  65702. ],
  65703. exports: [
  65704. _components__WEBPACK_IMPORTED_MODULE_1__["QRCodeComponent"],
  65705. ]
  65706. },] },
  65707. ];
  65708. return QRCodeModule;
  65709. }());
  65710. //# sourceMappingURL=angularx-qrcode.module.js.map
  65711. /***/ }),
  65712. /***/ "./node_modules/angularx-qrcode/dist/components/angularx-qrcode/angularx-qrcode.component.js":
  65713. /*!***************************************************************************************************!*\
  65714. !*** ./node_modules/angularx-qrcode/dist/components/angularx-qrcode/angularx-qrcode.component.js ***!
  65715. \***************************************************************************************************/
  65716. /*! exports provided: QRCodeComponent */
  65717. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  65718. "use strict";
  65719. __webpack_require__.r(__webpack_exports__);
  65720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QRCodeComponent", function() { return QRCodeComponent; });
  65721. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  65722. /* harmony import */ var qrcodejs2__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! qrcodejs2 */ "./node_modules/qrcodejs2/qrcode.js");
  65723. /* harmony import */ var qrcodejs2__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(qrcodejs2__WEBPACK_IMPORTED_MODULE_1__);
  65724. var QRCodeComponent = /** @class */ (function () {
  65725. function QRCodeComponent(el) {
  65726. var _this = this;
  65727. this.el = el;
  65728. /** @internal */
  65729. this.allowEmptyString = false;
  65730. this.colordark = '#000000';
  65731. this.colorlight = '#ffffff';
  65732. this.level = 'M';
  65733. this.hidetitle = false;
  65734. this.qrdata = '';
  65735. this.size = 256;
  65736. this.usesvg = false;
  65737. this.isValidQrCodeText = function (data) {
  65738. if (_this.allowEmptyString === false) {
  65739. return !(typeof data === 'undefined' || data === '');
  65740. }
  65741. return !(typeof data === 'undefined');
  65742. };
  65743. }
  65744. QRCodeComponent.prototype.ngOnInit = function () {
  65745. try {
  65746. if (!this.isValidQrCodeText(this.qrdata)) {
  65747. throw new Error('Empty QR Code data');
  65748. }
  65749. this.qrcode = new qrcodejs2__WEBPACK_IMPORTED_MODULE_1__(this.el.nativeElement, {
  65750. colorDark: this.colordark,
  65751. colorLight: this.colorlight,
  65752. correctLevel: qrcodejs2__WEBPACK_IMPORTED_MODULE_1__["CorrectLevel"][this.level.toString()],
  65753. height: this.size,
  65754. text: this.qrdata || ' ',
  65755. useSVG: this.usesvg,
  65756. width: this.size,
  65757. });
  65758. }
  65759. catch (e) {
  65760. console.error('Error generating QR Code: ' + e.message);
  65761. }
  65762. };
  65763. QRCodeComponent.prototype.ngOnChanges = function (changes) {
  65764. if (!this.qrcode) {
  65765. return;
  65766. }
  65767. var qrData = changes['qrdata'];
  65768. if (qrData && this.isValidQrCodeText(qrData.currentValue)) {
  65769. this.qrcode.clear();
  65770. this.qrcode.makeCode(qrData.currentValue);
  65771. }
  65772. };
  65773. QRCodeComponent.decorators = [
  65774. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{
  65775. selector: 'qrcode',
  65776. changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush,
  65777. template: ''
  65778. },] },
  65779. ];
  65780. /** @nocollapse */
  65781. QRCodeComponent.ctorParameters = function () { return [
  65782. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ElementRef"], },
  65783. ]; };
  65784. QRCodeComponent.propDecorators = {
  65785. "allowEmptyString": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65786. "colordark": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65787. "colorlight": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65788. "level": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65789. "hidetitle": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65790. "qrdata": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65791. "size": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65792. "usesvg": [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  65793. };
  65794. return QRCodeComponent;
  65795. }());
  65796. //# sourceMappingURL=angularx-qrcode.component.js.map
  65797. /***/ }),
  65798. /***/ "./node_modules/angularx-qrcode/dist/components/angularx-qrcode/index.js":
  65799. /*!*******************************************************************************!*\
  65800. !*** ./node_modules/angularx-qrcode/dist/components/angularx-qrcode/index.js ***!
  65801. \*******************************************************************************/
  65802. /*! exports provided: QRCodeComponent */
  65803. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  65804. "use strict";
  65805. __webpack_require__.r(__webpack_exports__);
  65806. /* harmony import */ var _angularx_qrcode_component__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angularx-qrcode.component */ "./node_modules/angularx-qrcode/dist/components/angularx-qrcode/angularx-qrcode.component.js");
  65807. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QRCodeComponent", function() { return _angularx_qrcode_component__WEBPACK_IMPORTED_MODULE_0__["QRCodeComponent"]; });
  65808. //# sourceMappingURL=index.js.map
  65809. /***/ }),
  65810. /***/ "./node_modules/angularx-qrcode/dist/components/index.js":
  65811. /*!***************************************************************!*\
  65812. !*** ./node_modules/angularx-qrcode/dist/components/index.js ***!
  65813. \***************************************************************/
  65814. /*! exports provided: QRCodeComponent */
  65815. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  65816. "use strict";
  65817. __webpack_require__.r(__webpack_exports__);
  65818. /* harmony import */ var _angularx_qrcode__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./angularx-qrcode */ "./node_modules/angularx-qrcode/dist/components/angularx-qrcode/index.js");
  65819. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QRCodeComponent", function() { return _angularx_qrcode__WEBPACK_IMPORTED_MODULE_0__["QRCodeComponent"]; });
  65820. //# sourceMappingURL=index.js.map
  65821. /***/ }),
  65822. /***/ "./node_modules/angularx-qrcode/dist/index.js":
  65823. /*!****************************************************!*\
  65824. !*** ./node_modules/angularx-qrcode/dist/index.js ***!
  65825. \****************************************************/
  65826. /*! exports provided: QRCodeComponent, QRCodeModule */
  65827. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  65828. "use strict";
  65829. __webpack_require__.r(__webpack_exports__);
  65830. /* harmony import */ var _components__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./components */ "./node_modules/angularx-qrcode/dist/components/index.js");
  65831. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QRCodeComponent", function() { return _components__WEBPACK_IMPORTED_MODULE_0__["QRCodeComponent"]; });
  65832. /* harmony import */ var _angularx_qrcode_module__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./angularx-qrcode.module */ "./node_modules/angularx-qrcode/dist/angularx-qrcode.module.js");
  65833. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "QRCodeModule", function() { return _angularx_qrcode_module__WEBPACK_IMPORTED_MODULE_1__["QRCodeModule"]; });
  65834. //# sourceMappingURL=index.js.map
  65835. /***/ }),
  65836. /***/ "./node_modules/babylonjs-gui/babylon.gui.min.js":
  65837. /*!*******************************************************!*\
  65838. !*** ./node_modules/babylonjs-gui/babylon.gui.min.js ***!
  65839. \*******************************************************/
  65840. /*! no static exports found */
  65841. /***/ (function(module, exports, __webpack_require__) {
  65842. !function(t,e){ true?module.exports=e(__webpack_require__(/*! babylonjs */ "./node_modules/babylonjs/babylon.js")):undefined}(window,function(t){return function(t){var e={};function i(r){if(e[r])return e[r].exports;var o=e[r]={i:r,l:!1,exports:{}};return t[r].call(o.exports,o,o.exports,i),o.l=!0,o.exports}return i.m=t,i.c=e,i.d=function(t,e,r){i.o(t,e)||Object.defineProperty(t,e,{enumerable:!0,get:r})},i.r=function(t){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(t,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(t,"__esModule",{value:!0})},i.t=function(t,e){if(1&e&&(t=i(t)),8&e)return t;if(4&e&&"object"==typeof t&&t&&t.__esModule)return t;var r=Object.create(null);if(i.r(r),Object.defineProperty(r,"default",{enumerable:!0,value:t}),2&e&&"string"!=typeof t)for(var o in t)i.d(r,o,function(e){return t[e]}.bind(null,o));return r},i.n=function(t){var e=t&&t.__esModule?function(){return t.default}:function(){return t};return i.d(e,"a",e),e},i.o=function(t,e){return Object.prototype.hasOwnProperty.call(t,e)},i.p="",i(i.s=27)}([function(e,i){e.exports=t},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(2),o=i(0),n=i(7),s=i(17),a=function(){function t(e){this.name=e,this._alpha=1,this._alphaSet=!1,this._zIndex=0,this._currentMeasure=n.Measure.Empty(),this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new r.ValueAndUnit(18,r.ValueAndUnit.UNITMODE_PIXEL,!1),this._width=new r.ValueAndUnit(1,r.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._height=new r.ValueAndUnit(1,r.ValueAndUnit.UNITMODE_PERCENTAGE,!1),this._color="",this._style=null,this._horizontalAlignment=t.HORIZONTAL_ALIGNMENT_CENTER,this._verticalAlignment=t.VERTICAL_ALIGNMENT_CENTER,this._isDirty=!0,this._tempParentMeasure=n.Measure.Empty(),this._cachedParentMeasure=n.Measure.Empty(),this._paddingLeft=new r.ValueAndUnit(0),this._paddingRight=new r.ValueAndUnit(0),this._paddingTop=new r.ValueAndUnit(0),this._paddingBottom=new r.ValueAndUnit(0),this._left=new r.ValueAndUnit(0),this._top=new r.ValueAndUnit(0),this._scaleX=1,this._scaleY=1,this._rotation=0,this._transformCenterX=.5,this._transformCenterY=.5,this._transformMatrix=s.Matrix2D.Identity(),this._invertTransformMatrix=s.Matrix2D.Identity(),this._transformedPosition=o.Vector2.Zero(),this._onlyMeasureMode=!1,this._isMatrixDirty=!0,this._isVisible=!0,this._fontSet=!1,this._dummyVector2=o.Vector2.Zero(),this._downCount=0,this._enterCount=-1,this._doNotRender=!1,this._downPointerIds={},this._isEnabled=!0,this._disabledColor="#9a9a9a",this.isHitTestVisible=!0,this.isPointerBlocker=!1,this.isFocusInvisible=!1,this.shadowOffsetX=0,this.shadowOffsetY=0,this.shadowBlur=0,this.shadowColor="#000",this.hoverCursor="",this._linkOffsetX=new r.ValueAndUnit(0),this._linkOffsetY=new r.ValueAndUnit(0),this.onPointerMoveObservable=new o.Observable,this.onPointerOutObservable=new o.Observable,this.onPointerDownObservable=new o.Observable,this.onPointerUpObservable=new o.Observable,this.onPointerClickObservable=new o.Observable,this.onPointerEnterObservable=new o.Observable,this.onDirtyObservable=new o.Observable,this.onAfterDrawObservable=new o.Observable}return Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontOffset",{get:function(){return this._fontOffset},set:function(t){this._fontOffset=t},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"alpha",{get:function(){return this._alpha},set:function(t){this._alpha!==t&&(this._alphaSet=!0,this._alpha=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleX",{get:function(){return this._scaleX},set:function(t){this._scaleX!==t&&(this._scaleX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaleY",{get:function(){return this._scaleY},set:function(t){this._scaleY!==t&&(this._scaleY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rotation",{get:function(){return this._rotation},set:function(t){this._rotation!==t&&(this._rotation=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterY",{get:function(){return this._transformCenterY},set:function(t){this._transformCenterY!==t&&(this._transformCenterY=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"transformCenterX",{get:function(){return this._transformCenterX},set:function(t){this._transformCenterX!==t&&(this._transformCenterX=t,this._markAsDirty(),this._markMatrixAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"horizontalAlignment",{get:function(){return this._horizontalAlignment},set:function(t){this._horizontalAlignment!==t&&(this._horizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"verticalAlignment",{get:function(){return this._verticalAlignment},set:function(t){this._verticalAlignment!==t&&(this._verticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"widthInPixels",{get:function(){return this._width.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"heightInPixels",{get:function(){return this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"style",{get:function(){return this._style},set:function(t){var e=this;this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._style=t,this._style&&(this._styleObserver=this._style.onChangedObservable.add(function(){e._markAsDirty(),e._resetFontCache()})),this._markAsDirty(),this._resetFontCache()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_isFontSizeInPercentage",{get:function(){return this._fontSize.isPercentage},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontSizeInPixels",{get:function(){var t=this._style?this._style._fontSize:this._fontSize;return t.isPixel?t.getValue(this._host):t.getValueInPixel(this._host,this._tempParentMeasure.height||this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&(this._markAsDirty(),this._resetFontCache())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"color",{get:function(){return this._color},set:function(t){this._color!==t&&(this._color=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"zIndex",{get:function(){return this._zIndex},set:function(t){this.zIndex!==t&&(this._zIndex=t,this._root&&this._root._reOrderControl(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"notRenderable",{get:function(){return this._doNotRender},set:function(t){this._doNotRender!==t&&(this._doNotRender=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){this._isVisible!==t&&(this._isVisible=t,this._markAsDirty(!0))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkedMesh",{get:function(){return this._linkedMesh},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeft",{get:function(){return this._paddingLeft.toString(this._host)},set:function(t){this._paddingLeft.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingLeftInPixels",{get:function(){return this._paddingLeft.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingRight",{get:function(){return this._paddingRight.toString(this._host)},set:function(t){this._paddingRight.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingRightInPixels",{get:function(){return this._paddingRight.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingTop",{get:function(){return this._paddingTop.toString(this._host)},set:function(t){this._paddingTop.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingTopInPixels",{get:function(){return this._paddingTop.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottom",{get:function(){return this._paddingBottom.toString(this._host)},set:function(t){this._paddingBottom.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"paddingBottomInPixels",{get:function(){return this._paddingBottom.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"left",{get:function(){return this._left.toString(this._host)},set:function(t){this._left.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"leftInPixels",{get:function(){return this._left.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"top",{get:function(){return this._top.toString(this._host)},set:function(t){this._top.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"topInPixels",{get:function(){return this._top.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetX",{get:function(){return this._linkOffsetX.toString(this._host)},set:function(t){this._linkOffsetX.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetXInPixels",{get:function(){return this._linkOffsetX.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetY",{get:function(){return this._linkOffsetY.toString(this._host)},set:function(t){this._linkOffsetY.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"linkOffsetYInPixels",{get:function(){return this._linkOffsetY.getValueInPixel(this._host,this._cachedParentMeasure.height)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"centerX",{get:function(){return this._currentMeasure.left+this._currentMeasure.width/2},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"centerY",{get:function(){return this._currentMeasure.top+this._currentMeasure.height/2},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(t){this._isEnabled!==t&&(this._isEnabled=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"disabledColor",{get:function(){return this._disabledColor},set:function(t){this._disabledColor!==t&&(this._disabledColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),t.prototype._getTypeName=function(){return"Control"},t.prototype._resetFontCache=function(){this._fontSet=!0,this._markAsDirty()},t.prototype.isAscendant=function(t){return!!this.parent&&(this.parent===t||this.parent.isAscendant(t))},t.prototype.getLocalCoordinates=function(t){var e=o.Vector2.Zero();return this.getLocalCoordinatesToRef(t,e),e},t.prototype.getLocalCoordinatesToRef=function(t,e){return e.x=t.x-this._currentMeasure.left,e.y=t.y-this._currentMeasure.top,this},t.prototype.getParentLocalCoordinates=function(t){var e=o.Vector2.Zero();return e.x=t.x-this._cachedParentMeasure.left,e.y=t.y-this._cachedParentMeasure.top,e},t.prototype.moveToVector3=function(e,i){if(this._host&&this._root===this._host._rootContainer){this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP;var r=this._host._getGlobalViewport(i),n=o.Vector3.Project(e,o.Matrix.Identity(),i.getTransformMatrix(),r);this._moveToProjectedPosition(n),n.z<0||n.z>1?this.notRenderable=!0:this.notRenderable=!1}else o.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},t.prototype.linkWithMesh=function(e){if(!this._host||this._root&&this._root!==this._host._rootContainer)e&&o.Tools.Error("Cannot link a control to a mesh if the control is not at root level");else{var i=this._host._linkedControls.indexOf(this);if(-1!==i)return this._linkedMesh=e,void(e||this._host._linkedControls.splice(i,1));e&&(this.horizontalAlignment=t.HORIZONTAL_ALIGNMENT_LEFT,this.verticalAlignment=t.VERTICAL_ALIGNMENT_TOP,this._linkedMesh=e,this._onlyMeasureMode=0===this._currentMeasure.width||0===this._currentMeasure.height,this._host._linkedControls.push(this))}},t.prototype._moveToProjectedPosition=function(t){var e=this._left.getValue(this._host),i=this._top.getValue(this._host),r=t.x+this._linkOffsetX.getValue(this._host)-this._currentMeasure.width/2,o=t.y+this._linkOffsetY.getValue(this._host)-this._currentMeasure.height/2;this._left.ignoreAdaptiveScaling&&this._top.ignoreAdaptiveScaling&&(Math.abs(r-e)<.5&&(r=e),Math.abs(o-i)<.5&&(o=i)),this.left=r+"px",this.top=o+"px",this._left.ignoreAdaptiveScaling=!0,this._top.ignoreAdaptiveScaling=!0},t.prototype._markMatrixAsDirty=function(){this._isMatrixDirty=!0,this._flagDescendantsAsMatrixDirty()},t.prototype._flagDescendantsAsMatrixDirty=function(){},t.prototype._markAsDirty=function(t){void 0===t&&(t=!1),(this._isVisible||t)&&(this._isDirty=!0,this._host&&this._host.markAsDirty())},t.prototype._markAllAsDirty=function(){this._markAsDirty(),this._font&&this._prepareFont()},t.prototype._link=function(t,e){this._root=t,this._host=e},t.prototype._transform=function(t){if(this._isMatrixDirty||1!==this._scaleX||1!==this._scaleY||0!==this._rotation){var e=this._currentMeasure.width*this._transformCenterX+this._currentMeasure.left,i=this._currentMeasure.height*this._transformCenterY+this._currentMeasure.top;t.translate(e,i),t.rotate(this._rotation),t.scale(this._scaleX,this._scaleY),t.translate(-e,-i),(this._isMatrixDirty||this._cachedOffsetX!==e||this._cachedOffsetY!==i)&&(this._cachedOffsetX=e,this._cachedOffsetY=i,this._isMatrixDirty=!1,this._flagDescendantsAsMatrixDirty(),s.Matrix2D.ComposeToRef(-e,-i,this._rotation,this._scaleX,this._scaleY,this._root?this._root._transformMatrix:null,this._transformMatrix),this._transformMatrix.invertToRef(this._invertTransformMatrix))}},t.prototype._applyStates=function(t){this._isFontSizeInPercentage&&(this._fontSet=!0),this._fontSet&&(this._prepareFont(),this._fontSet=!1),this._font&&(t.font=this._font),this._color&&(t.fillStyle=this._color),this._alphaSet&&(t.globalAlpha=this.parent?this.parent.alpha*this._alpha:this._alpha)},t.prototype._processMeasures=function(t,e){return!this._isDirty&&this._cachedParentMeasure.isEqualsTo(t)||(this._isDirty=!1,this._currentMeasure.copyFrom(t),this._preMeasure(t,e),this._measure(),this._computeAlignment(t,e),this._currentMeasure.left=0|this._currentMeasure.left,this._currentMeasure.top=0|this._currentMeasure.top,this._currentMeasure.width=0|this._currentMeasure.width,this._currentMeasure.height=0|this._currentMeasure.height,this._additionalProcessing(t,e),this._cachedParentMeasure.copyFrom(t),this.onDirtyObservable.hasObservers()&&this.onDirtyObservable.notifyObservers(this)),!(this._currentMeasure.left>t.left+t.width)&&(!(this._currentMeasure.left+this._currentMeasure.width<t.left)&&(!(this._currentMeasure.top>t.top+t.height)&&(!(this._currentMeasure.top+this._currentMeasure.height<t.top)&&(this._transform(e),this._onlyMeasureMode?(this._onlyMeasureMode=!1,!1):(this._clip(e),e.clip(),!0)))))},t.prototype._clip=function(t){if(t.beginPath(),this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY){var e=this.shadowOffsetX,i=this.shadowOffsetY,r=this.shadowBlur,o=Math.min(Math.min(e,0)-2*r,0),n=Math.max(Math.max(e,0)+2*r,0),s=Math.min(Math.min(i,0)-2*r,0),a=Math.max(Math.max(i,0)+2*r,0);t.rect(this._currentMeasure.left+o,this._currentMeasure.top+s,this._currentMeasure.width+n-o,this._currentMeasure.height+a-s)}else t.rect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)},t.prototype._measure=function(){this._width.isPixel?this._currentMeasure.width=this._width.getValue(this._host):this._currentMeasure.width*=this._width.getValue(this._host),this._height.isPixel?this._currentMeasure.height=this._height.getValue(this._host):this._currentMeasure.height*=this._height.getValue(this._host)},t.prototype._computeAlignment=function(e,i){var r=this._currentMeasure.width,o=this._currentMeasure.height,n=e.width,s=e.height,a=0,h=0;switch(this.horizontalAlignment){case t.HORIZONTAL_ALIGNMENT_LEFT:a=0;break;case t.HORIZONTAL_ALIGNMENT_RIGHT:a=n-r;break;case t.HORIZONTAL_ALIGNMENT_CENTER:a=(n-r)/2}switch(this.verticalAlignment){case t.VERTICAL_ALIGNMENT_TOP:h=0;break;case t.VERTICAL_ALIGNMENT_BOTTOM:h=s-o;break;case t.VERTICAL_ALIGNMENT_CENTER:h=(s-o)/2}this._paddingLeft.isPixel?(this._currentMeasure.left+=this._paddingLeft.getValue(this._host),this._currentMeasure.width-=this._paddingLeft.getValue(this._host)):(this._currentMeasure.left+=n*this._paddingLeft.getValue(this._host),this._currentMeasure.width-=n*this._paddingLeft.getValue(this._host)),this._paddingRight.isPixel?this._currentMeasure.width-=this._paddingRight.getValue(this._host):this._currentMeasure.width-=n*this._paddingRight.getValue(this._host),this._paddingTop.isPixel?(this._currentMeasure.top+=this._paddingTop.getValue(this._host),this._currentMeasure.height-=this._paddingTop.getValue(this._host)):(this._currentMeasure.top+=s*this._paddingTop.getValue(this._host),this._currentMeasure.height-=s*this._paddingTop.getValue(this._host)),this._paddingBottom.isPixel?this._currentMeasure.height-=this._paddingBottom.getValue(this._host):this._currentMeasure.height-=s*this._paddingBottom.getValue(this._host),this._left.isPixel?this._currentMeasure.left+=this._left.getValue(this._host):this._currentMeasure.left+=n*this._left.getValue(this._host),this._top.isPixel?this._currentMeasure.top+=this._top.getValue(this._host):this._currentMeasure.top+=s*this._top.getValue(this._host),this._currentMeasure.left+=a,this._currentMeasure.top+=h},t.prototype._preMeasure=function(t,e){},t.prototype._additionalProcessing=function(t,e){},t.prototype._draw=function(t,e){},t.prototype.contains=function(t,e){return this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y,!(t<this._currentMeasure.left)&&(!(t>this._currentMeasure.left+this._currentMeasure.width)&&(!(e<this._currentMeasure.top)&&(!(e>this._currentMeasure.top+this._currentMeasure.height)&&(this.isPointerBlocker&&(this._host._shouldBlockPointer=!0),!0))))},t.prototype._processPicking=function(t,e,i,r,o){return!!this._isEnabled&&(!(!this.isHitTestVisible||!this.isVisible||this._doNotRender)&&(!!this.contains(t,e)&&(this._processObservables(i,t,e,r,o),!0)))},t.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)&&null!=this.parent&&this.parent._onPointerMove(t,e)},t.prototype._onPointerEnter=function(t){return!!this._isEnabled&&(!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this)&&null!=this.parent&&this.parent._onPointerEnter(t),!0))},t.prototype._onPointerOut=function(t){this._isEnabled&&(this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this)&&null!=this.parent&&this.parent._onPointerOut(t))},t.prototype._onPointerDown=function(t,e,i,r){return this._onPointerEnter(this),0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new s.Vector2WithInfo(e,r),-1,t,this)&&null!=this.parent&&this.parent._onPointerDown(t,e,i,r),!0)},t.prototype._onPointerUp=function(t,e,i,r,o){if(this._isEnabled){this._downCount=0,delete this._downPointerIds[i];var n=o;o&&(this._enterCount>0||-1===this._enterCount)&&(n=this.onPointerClickObservable.notifyObservers(new s.Vector2WithInfo(e,r),-1,t,this)),this.onPointerUpObservable.notifyObservers(new s.Vector2WithInfo(e,r),-1,t,this)&&null!=this.parent&&this.parent._onPointerUp(t,e,i,r,n)}},t.prototype._forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,o.Vector2.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,o.Vector2.Zero(),+e,0,!0)},t.prototype._processObservables=function(t,e,i,r,n){if(!this._isEnabled)return!1;if(this._dummyVector2.copyFromFloats(e,i),t===o.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,this._dummyVector2);var s=this._host._lastControlOver[r];return s&&s!==this&&s._onPointerOut(this),s!==this&&this._onPointerEnter(this),this._host._lastControlOver[r]=this,!0}return t===o.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,this._dummyVector2,r,n),this._host._lastControlDown[r]=this,this._host._lastPickedControl=this,!0):t===o.PointerEventTypes.POINTERUP&&(this._host._lastControlDown[r]&&this._host._lastControlDown[r]._onPointerUp(this,this._dummyVector2,r,n,!0),delete this._host._lastControlDown[r],!0)},t.prototype._prepareFont=function(){(this._font||this._fontSet)&&(this._style?this._font=this._style.fontStyle+" "+this._style.fontWeight+" "+this.fontSizeInPixels+"px "+this._style.fontFamily:this._font=this._fontStyle+" "+this._fontWeight+" "+this.fontSizeInPixels+"px "+this._fontFamily,this._fontOffset=t._GetFontOffset(this._font))},t.prototype.dispose=function(){(this.onDirtyObservable.clear(),this.onAfterDrawObservable.clear(),this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._styleObserver&&this._style&&(this._style.onChangedObservable.remove(this._styleObserver),this._styleObserver=null),this._root&&(this._root.removeControl(this),this._root=null),this._host)&&(this._host._linkedControls.indexOf(this)>-1&&this.linkWithMesh(null))},Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_LEFT",{get:function(){return t._HORIZONTAL_ALIGNMENT_LEFT},enumerable:!0,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_RIGHT",{get:function(){return t._HORIZONTAL_ALIGNMENT_RIGHT},enumerable:!0,configurable:!0}),Object.defineProperty(t,"HORIZONTAL_ALIGNMENT_CENTER",{get:function(){return t._HORIZONTAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_TOP",{get:function(){return t._VERTICAL_ALIGNMENT_TOP},enumerable:!0,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_BOTTOM",{get:function(){return t._VERTICAL_ALIGNMENT_BOTTOM},enumerable:!0,configurable:!0}),Object.defineProperty(t,"VERTICAL_ALIGNMENT_CENTER",{get:function(){return t._VERTICAL_ALIGNMENT_CENTER},enumerable:!0,configurable:!0}),t._GetFontOffset=function(e){if(t._FontHeightSizes[e])return t._FontHeightSizes[e];var i=document.createElement("span");i.innerHTML="Hg",i.style.font=e;var r=document.createElement("div");r.style.display="inline-block",r.style.width="1px",r.style.height="0px",r.style.verticalAlign="bottom";var o=document.createElement("div");o.appendChild(i),o.appendChild(r),document.body.appendChild(o);var n=0,s=0;try{s=r.getBoundingClientRect().top-i.getBoundingClientRect().top,r.style.verticalAlign="baseline",n=r.getBoundingClientRect().top-i.getBoundingClientRect().top}finally{document.body.removeChild(o)}var a={ascent:n,height:s,descent:s-n};return t._FontHeightSizes[e]=a,a},t.drawEllipse=function(t,e,i,r,o){o.translate(t,e),o.scale(i,r),o.beginPath(),o.arc(0,0,1,0,2*Math.PI),o.closePath(),o.scale(1/i,1/r),o.translate(-t,-e)},t._HORIZONTAL_ALIGNMENT_LEFT=0,t._HORIZONTAL_ALIGNMENT_RIGHT=1,t._HORIZONTAL_ALIGNMENT_CENTER=2,t._VERTICAL_ALIGNMENT_TOP=0,t._VERTICAL_ALIGNMENT_BOTTOM=1,t._VERTICAL_ALIGNMENT_CENTER=2,t._FontHeightSizes={},t.AddHeader=function(){},t}();e.Control=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(e,i,r){void 0===i&&(i=t.UNITMODE_PIXEL),void 0===r&&(r=!0),this.unit=i,this.negativeValueAllowed=r,this._value=1,this.ignoreAdaptiveScaling=!1,this._value=e}return Object.defineProperty(t.prototype,"isPercentage",{get:function(){return this.unit===t.UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isPixel",{get:function(){return this.unit===t.UNITMODE_PIXEL},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"internalValue",{get:function(){return this._value},enumerable:!0,configurable:!0}),t.prototype.getValueInPixel=function(t,e){return this.isPixel?this.getValue(t):this.getValue(t)*e},t.prototype.getValue=function(e){if(e&&!this.ignoreAdaptiveScaling&&this.unit!==t.UNITMODE_PERCENTAGE){var i=0,r=0;if(e.idealWidth&&(i=this._value*e.getSize().width/e.idealWidth),e.idealHeight&&(r=this._value*e.getSize().height/e.idealHeight),e.useSmallestIdeal&&e.idealWidth&&e.idealHeight)return window.innerWidth<window.innerHeight?i:r;if(e.idealWidth)return i;if(e.idealHeight)return r}return this._value},t.prototype.toString=function(e){switch(this.unit){case t.UNITMODE_PERCENTAGE:return 100*this.getValue(e)+"%";case t.UNITMODE_PIXEL:return this.getValue(e)+"px"}return this.unit.toString()},t.prototype.fromString=function(e){var i=t._Regex.exec(e.toString());if(!i||0===i.length)return!1;var r=parseFloat(i[1]),o=this.unit;if(this.negativeValueAllowed||r<0&&(r=0),4===i.length)switch(i[3]){case"px":o=t.UNITMODE_PIXEL;break;case"%":o=t.UNITMODE_PERCENTAGE,r/=100}return(r!==this._value||o!==this.unit)&&(this._value=r,this.unit=o,!0)},Object.defineProperty(t,"UNITMODE_PERCENTAGE",{get:function(){return t._UNITMODE_PERCENTAGE},enumerable:!0,configurable:!0}),Object.defineProperty(t,"UNITMODE_PIXEL",{get:function(){return t._UNITMODE_PIXEL},enumerable:!0,configurable:!0}),t._Regex=/(^-?\d*(\.\d+)?)(%|px)?/,t._UNITMODE_PERCENTAGE=0,t._UNITMODE_PIXEL=1,t}();e.ValueAndUnit=r},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(13),n=i(0),s=function(t){function e(e){var i=t.call(this,e)||this;return i._blockLayout=!1,i._children=new Array,i}return r(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"blockLayout",{get:function(){return this._blockLayout},set:function(t){this._blockLayout!==t&&(this._blockLayout=t,this._blockLayout||this._arrangeChildren())},enumerable:!0,configurable:!0}),e.prototype.updateLayout=function(){return this._arrangeChildren(),this},e.prototype.containsControl=function(t){return-1!==this._children.indexOf(t)},e.prototype.addControl=function(t){return-1!==this._children.indexOf(t)?this:(t.parent=this,t._host=this._host,this._children.push(t),this._host.utilityLayer&&(t._prepareNode(this._host.utilityLayer.utilityLayerScene),t.node&&(t.node.parent=this.node),this.blockLayout||this._arrangeChildren()),this)},e.prototype._arrangeChildren=function(){},e.prototype._createNode=function(t){return new n.TransformNode("ContainerNode",t)},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null,t._disposeNode()),this},e.prototype._getTypeName=function(){return"Container3D"},e.prototype.dispose=function(){for(var e=0,i=this._children;e<i.length;e++){i[e].dispose()}this._children=[],t.prototype.dispose.call(this)},e.UNSET_ORIENTATION=0,e.FACEORIGIN_ORIENTATION=1,e.FACEORIGINREVERSED_ORIENTATION=2,e.FACEFORWARD_ORIENTATION=3,e.FACEFORWARDREVERSED_ORIENTATION=4,e}(o.Control3D);e.Container3D=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(7),s=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._children=new Array,i._measureForChildren=n.Measure.Empty(),i._adaptWidthToChildren=!1,i._adaptHeightToChildren=!1,i}return r(e,t),Object.defineProperty(e.prototype,"adaptHeightToChildren",{get:function(){return this._adaptHeightToChildren},set:function(t){this._adaptHeightToChildren!==t&&(this._adaptHeightToChildren=t,t&&(this.height="100%"),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"adaptWidthToChildren",{get:function(){return this._adaptWidthToChildren},set:function(t){this._adaptWidthToChildren!==t&&(this._adaptWidthToChildren=t,t&&(this.width="100%"),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"children",{get:function(){return this._children},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Container"},e.prototype._flagDescendantsAsMatrixDirty=function(){for(var t=0,e=this.children;t<e.length;t++){e[t]._markMatrixAsDirty()}},e.prototype.getChildByName=function(t){for(var e=0,i=this.children;e<i.length;e++){var r=i[e];if(r.name===t)return r}return null},e.prototype.getChildByType=function(t,e){for(var i=0,r=this.children;i<r.length;i++){var o=r[i];if(o.typeName===e)return o}return null},e.prototype.containsControl=function(t){return-1!==this.children.indexOf(t)},e.prototype.addControl=function(t){return t?-1!==this._children.indexOf(t)?this:(t._link(this,this._host),t._markAllAsDirty(),this._reOrderControl(t),this._markAsDirty(),this):this},e.prototype.clearControls=function(){for(var t=0,e=this._children.slice();t<e.length;t++){var i=e[t];this.removeControl(i)}return this},e.prototype.removeControl=function(t){var e=this._children.indexOf(t);return-1!==e&&(this._children.splice(e,1),t.parent=null),t.linkWithMesh(null),this._host&&this._host._cleanControlAfterRemoval(t),this._markAsDirty(),this},e.prototype._reOrderControl=function(t){this.removeControl(t);for(var e=0;e<this._children.length;e++)if(this._children[e].zIndex>t.zIndex)return void this._children.splice(e,0,t);this._children.push(t),t.parent=this,this._markAsDirty()},e.prototype._markAllAsDirty=function(){t.prototype._markAllAsDirty.call(this);for(var e=0;e<this._children.length;e++)this._children[e]._markAllAsDirty()},e.prototype._localDraw=function(t){this._background&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),t.fillStyle=this._background,t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0))},e.prototype._link=function(e,i){t.prototype._link.call(this,e,i);for(var r=0,o=this._children;r<o.length;r++){o[r]._link(this,i)}},e.prototype._draw=function(t,e){if(this.isVisible&&!this.notRenderable){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){this._localDraw(e),this._clipForChildren(e);for(var i=-1,r=-1,o=0,n=this._children;o<n.length;o++){var s=n[o];s.isVisible&&!s.notRenderable&&(s._tempParentMeasure.copyFrom(this._measureForChildren),s._draw(this._measureForChildren,e),s.onAfterDrawObservable.hasObservers()&&s.onAfterDrawObservable.notifyObservers(s),this.adaptWidthToChildren&&s._width.isPixel&&(i=Math.max(i,s._currentMeasure.width)),this.adaptHeightToChildren&&s._height.isPixel&&(r=Math.max(r,s._currentMeasure.height)))}this.adaptWidthToChildren&&i>=0&&(this.width=i+"px"),this.adaptHeightToChildren&&r>=0&&(this.height=r+"px")}e.restore(),this.onAfterDrawObservable.hasObservers()&&this.onAfterDrawObservable.notifyObservers(this)}},e.prototype._processPicking=function(e,i,r,o,n){if(!this.isVisible||this.notRenderable)return!1;if(!t.prototype.contains.call(this,e,i))return!1;for(var s=this._children.length-1;s>=0;s--){var a=this._children[s];if(a._processPicking(e,i,r,o,n))return a.hoverCursor&&this._host._changeCursor(a.hoverCursor),!0}return!!this.isHitTestVisible&&this._processObservables(r,e,i,o,n)},e.prototype._clipForChildren=function(t){},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.copyFrom(this._currentMeasure)},e.prototype.dispose=function(){t.prototype.dispose.call(this);for(var e=0,i=this._children;e<i.length;e++){i[e].dispose()}},e}(o.Control);e.Container=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o,n=i(0),s=i(2),a=i(1);!function(t){t[t.Clip=0]="Clip",t[t.WordWrap=1]="WordWrap",t[t.Ellipsis=2]="Ellipsis"}(o=e.TextWrapping||(e.TextWrapping={}));var h=function(t){function e(e,i){void 0===i&&(i="");var r=t.call(this,e)||this;return r.name=e,r._text="",r._textWrapping=o.Clip,r._textHorizontalAlignment=a.Control.HORIZONTAL_ALIGNMENT_CENTER,r._textVerticalAlignment=a.Control.VERTICAL_ALIGNMENT_CENTER,r._resizeToFit=!1,r._lineSpacing=new s.ValueAndUnit(0),r._outlineWidth=0,r._outlineColor="white",r.onTextChangedObservable=new n.Observable,r.onLinesReadyObservable=new n.Observable,r.text=i,r}return r(e,t),Object.defineProperty(e.prototype,"lines",{get:function(){return this._lines},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"resizeToFit",{get:function(){return this._resizeToFit},set:function(t){this._resizeToFit=t,this._resizeToFit&&(this._width.ignoreAdaptiveScaling=!0,this._height.ignoreAdaptiveScaling=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textWrapping",{get:function(){return this._textWrapping},set:function(t){this._textWrapping!==t&&(this._textWrapping=+t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textHorizontalAlignment",{get:function(){return this._textHorizontalAlignment},set:function(t){this._textHorizontalAlignment!==t&&(this._textHorizontalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textVerticalAlignment",{get:function(){return this._textVerticalAlignment},set:function(t){this._textVerticalAlignment!==t&&(this._textVerticalAlignment=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineSpacing",{get:function(){return this._lineSpacing.toString(this._host)},set:function(t){this._lineSpacing.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineWidth",{get:function(){return this._outlineWidth},set:function(t){this._outlineWidth!==t&&(this._outlineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"outlineColor",{get:function(){return this._outlineColor},set:function(t){this._outlineColor!==t&&(this._outlineColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"TextBlock"},e.prototype._drawText=function(t,e,i,r){var o=this._currentMeasure.width,n=0;switch(this._textHorizontalAlignment){case a.Control.HORIZONTAL_ALIGNMENT_LEFT:n=0;break;case a.Control.HORIZONTAL_ALIGNMENT_RIGHT:n=o-e;break;case a.Control.HORIZONTAL_ALIGNMENT_CENTER:n=(o-e)/2}(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(r.shadowColor=this.shadowColor,r.shadowBlur=this.shadowBlur,r.shadowOffsetX=this.shadowOffsetX,r.shadowOffsetY=this.shadowOffsetY),this.outlineWidth&&r.strokeText(t,this._currentMeasure.left+n,i),r.fillText(t,this._currentMeasure.left+n,i)},e.prototype._draw=function(t,e){e.save(),this._applyStates(e),this._processMeasures(t,e)&&this._renderLines(e),e.restore()},e.prototype._applyStates=function(e){t.prototype._applyStates.call(this,e),this.outlineWidth&&(e.lineWidth=this.outlineWidth,e.strokeStyle=this.outlineColor)},e.prototype._additionalProcessing=function(t,e){this._lines=this._breakLines(this._currentMeasure.width,e),this.onLinesReadyObservable.notifyObservers(this)},e.prototype._breakLines=function(t,e){var i=[],r=this.text.split("\n");if(this._textWrapping!==o.Ellipsis||this._resizeToFit)if(this._textWrapping!==o.WordWrap||this._resizeToFit)for(var n=0,s=r;n<s.length;n++){l=s[n];i.push(this._parseLine(l,e))}else for(var a=0,h=r;a<h.length;a++){var l=h[a];i.push.apply(i,this._parseLineWordWrap(l,t,e))}else for(var u=0,c=r;u<c.length;u++){var l=c[u];i.push(this._parseLineEllipsis(l,t,e))}return i},e.prototype._parseLine=function(t,e){return void 0===t&&(t=""),{text:t,width:e.measureText(t).width}},e.prototype._parseLineEllipsis=function(t,e,i){void 0===t&&(t="");var r=i.measureText(t).width;for(r>e&&(t+="…");t.length>2&&r>e;)t=t.slice(0,-2)+"…",r=i.measureText(t).width;return{text:t,width:r}},e.prototype._parseLineWordWrap=function(t,e,i){void 0===t&&(t="");for(var r=[],o=t.split(" "),n=0,s=0;s<o.length;s++){var a=s>0?t+" "+o[s]:o[0],h=i.measureText(a).width;h>e&&s>0?(r.push({text:t,width:n}),t=o[s],n=i.measureText(t).width):(n=h,t=a)}return r.push({text:t,width:n}),r},e.prototype._renderLines=function(t){var e=this._currentMeasure.height;this._fontOffset||(this._fontOffset=a.Control._GetFontOffset(t.font));var i=0;switch(this._textVerticalAlignment){case a.Control.VERTICAL_ALIGNMENT_TOP:i=this._fontOffset.ascent;break;case a.Control.VERTICAL_ALIGNMENT_BOTTOM:i=e-this._fontOffset.height*(this._lines.length-1)-this._fontOffset.descent;break;case a.Control.VERTICAL_ALIGNMENT_CENTER:i=this._fontOffset.ascent+(e-this._fontOffset.height*this._lines.length)/2}i+=this._currentMeasure.top;for(var r=0,o=0;o<this._lines.length;o++){var n=this._lines[o];0!==o&&0!==this._lineSpacing.internalValue&&(this._lineSpacing.isPixel?i+=this._lineSpacing.getValue(this._host):i+=this._lineSpacing.getValue(this._host)*this._height.getValueInPixel(this._host,this._cachedParentMeasure.height)),this._drawText(n.text,n.width,i,t),i+=this._fontOffset.height,n.width>r&&(r=n.width)}this._resizeToFit&&(this.width=this.paddingLeftInPixels+this.paddingRightInPixels+r+"px",this.height=this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*this._lines.length+"px")},e.prototype.computeExpectedHeight=function(){if(this.text&&this.widthInPixels){var t=document.createElement("canvas").getContext("2d");if(t){this._applyStates(t),this._fontOffset||(this._fontOffset=a.Control._GetFontOffset(t.font));var e=this._lines?this._lines:this._breakLines(this.widthInPixels-this.paddingLeftInPixels-this.paddingRightInPixels,t);return this.paddingTopInPixels+this.paddingBottomInPixels+this._fontOffset.height*e.length}}return 0},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onTextChangedObservable.clear()},e}(a.Control);e.TextBlock=h},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(4),n=i(7),s=i(1),a=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isVertical=!0,i._manualWidth=!1,i._manualHeight=!1,i._doNotTrackManualChanges=!1,i._tempMeasureStore=n.Measure.Empty(),i}return r(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualWidth=!0),this._width.toString(this._host)!==t&&this._width.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{get:function(){return this._height.toString(this._host)},set:function(t){this._doNotTrackManualChanges||(this._manualHeight=!0),this._height.toString(this._host)!==t&&this._height.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"StackPanel"},e.prototype._preMeasure=function(e,i){for(var r=0,o=0,n=0,a=this._children;n<a.length;n++){var h=a[n];this._tempMeasureStore.copyFrom(h._currentMeasure),h._currentMeasure.copyFrom(e),h._measure(),this._isVertical?(h.top=o+"px",h._top.ignoreAdaptiveScaling||h._markAsDirty(),h._top.ignoreAdaptiveScaling=!0,o+=h._currentMeasure.height,h._currentMeasure.width>r&&(r=h._currentMeasure.width),h.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_TOP):(h.left=r+"px",h._left.ignoreAdaptiveScaling||h._markAsDirty(),h._left.ignoreAdaptiveScaling=!0,r+=h._currentMeasure.width,h._currentMeasure.height>o&&(o=h._currentMeasure.height),h.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT),h._currentMeasure.copyFrom(this._tempMeasureStore)}this._doNotTrackManualChanges=!0;var l,u,c=this.height,_=this.width;this._manualHeight||(this.height=o+"px"),this._manualWidth||(this.width=r+"px"),l=_!==this.width||!this._width.ignoreAdaptiveScaling,(u=c!==this.height||!this._height.ignoreAdaptiveScaling)&&(this._height.ignoreAdaptiveScaling=!0),l&&(this._width.ignoreAdaptiveScaling=!0),this._doNotTrackManualChanges=!1,(l||u)&&this._markAllAsDirty(),t.prototype._preMeasure.call(this,e,i)},e}(o.Container);e.StackPanel=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=function(){function t(t,e,i,r){this.left=t,this.top=e,this.width=i,this.height=r}return t.prototype.copyFrom=function(t){this.left=t.left,this.top=t.top,this.width=t.width,this.height=t.height},t.prototype.isEqualsTo=function(t){return this.left===t.left&&(this.top===t.top&&(this.width===t.width&&this.height===t.height))},t.Empty=function(){return new t(0,0,0,0)},t}();e.Measure=r},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(3),n=i(0),s=function(t){function e(){var e=t.call(this)||this;return e._columns=10,e._rows=0,e._rowThenColum=!0,e._orientation=o.Container3D.FACEORIGIN_ORIENTATION,e.margin=0,e}return r(e,t),Object.defineProperty(e.prototype,"orientation",{get:function(){return this._orientation},set:function(t){var e=this;this._orientation!==t&&(this._orientation=t,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"columns",{get:function(){return this._columns},set:function(t){var e=this;this._columns!==t&&(this._columns=t,this._rowThenColum=!0,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rows",{get:function(){return this._rows},set:function(t){var e=this;this._rows!==t&&(this._rows=t,this._rowThenColum=!1,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),e.prototype._arrangeChildren=function(){this._cellWidth=0,this._cellHeight=0;for(var t=0,e=0,i=0,r=n.Matrix.Invert(this.node.computeWorldMatrix(!0)),o=0,s=this._children;o<s.length;o++){if((b=s[o]).mesh){i++,b.mesh.computeWorldMatrix(!0);var a=b.mesh.getHierarchyBoundingVectors(),h=n.Tmp.Vector3[0],l=n.Tmp.Vector3[1];a.max.subtractToRef(a.min,l),l.scaleInPlace(.5),n.Vector3.TransformNormalToRef(l,r,h),this._cellWidth=Math.max(this._cellWidth,2*h.x),this._cellHeight=Math.max(this._cellHeight,2*h.y)}}this._cellWidth+=2*this.margin,this._cellHeight+=2*this.margin,this._rowThenColum?(e=this._columns,t=Math.ceil(i/this._columns)):(t=this._rows,e=Math.ceil(i/this._rows));var u=.5*e*this._cellWidth,c=.5*t*this._cellHeight,_=[],f=0;if(this._rowThenColum)for(var p=0;p<t;p++)for(var d=0;d<e&&(_.push(new n.Vector3(d*this._cellWidth-u+this._cellWidth/2,p*this._cellHeight-c+this._cellHeight/2,0)),!(++f>i));d++);else for(d=0;d<e;d++)for(p=0;p<t&&(_.push(new n.Vector3(d*this._cellWidth-u+this._cellWidth/2,p*this._cellHeight-c+this._cellHeight/2,0)),!(++f>i));p++);f=0;for(var y=0,g=this._children;y<g.length;y++){var b;(b=g[y]).mesh&&(this._mapGridNode(b,_[f]),f++)}this._finalProcessing()},e.prototype._finalProcessing=function(){},e}(o.Container3D);e.VolumeBasedPanel=s},function(t,e,i){"use strict";function r(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),r(i(16)),r(i(18)),r(i(30)),r(i(4)),r(i(1)),r(i(31)),r(i(32)),r(i(11)),r(i(19)),r(i(33)),r(i(34)),r(i(35)),r(i(21)),r(i(6)),r(i(36)),r(i(5)),r(i(37)),r(i(22)),r(i(10)),r(i(38)),r(i(39))},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i._cornerRadius=0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cornerRadius",{get:function(){return this._cornerRadius},set:function(t){t<0&&(t=0),this._cornerRadius!==t&&(this._cornerRadius=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Rectangle"},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),this._background&&(t.fillStyle=this._background,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.fill()):t.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),this._thickness&&((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,this._cornerRadius?(this._drawRoundedRect(t,this._thickness/2),t.stroke()):t.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness)),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._drawRoundedRect=function(t,e){void 0===e&&(e=0);var i=this._currentMeasure.left+e,r=this._currentMeasure.top+e,o=this._currentMeasure.width-2*e,n=this._currentMeasure.height-2*e,s=Math.min(n/2-2,Math.min(o/2-2,this._cornerRadius));t.beginPath(),t.moveTo(i+s,r),t.lineTo(i+o-s,r),t.quadraticCurveTo(i+o,r,i+o,r+s),t.lineTo(i+o,r+n-s),t.quadraticCurveTo(i+o,r+n,i+o-s,r+n),t.lineTo(i+s,r+n),t.quadraticCurveTo(i,r+n,i,r+n-s),t.lineTo(i,r+s),t.quadraticCurveTo(i,r,i+s,r),t.closePath()},e.prototype._clipForChildren=function(t){this._cornerRadius&&(this._drawRoundedRect(t,this._thickness),t.clip())},e}(i(4).Container);e.Rectangle=o},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(0),s=function(t){function e(i,r){void 0===r&&(r=null);var o=t.call(this,i)||this;return o.name=i,o._loaded=!1,o._stretch=e.STRETCH_FILL,o._autoScale=!1,o._sourceLeft=0,o._sourceTop=0,o._sourceWidth=0,o._sourceHeight=0,o._cellWidth=0,o._cellHeight=0,o._cellId=-1,o.source=r,o}return r(e,t),Object.defineProperty(e.prototype,"sourceLeft",{get:function(){return this._sourceLeft},set:function(t){this._sourceLeft!==t&&(this._sourceLeft=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sourceTop",{get:function(){return this._sourceTop},set:function(t){this._sourceTop!==t&&(this._sourceTop=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sourceWidth",{get:function(){return this._sourceWidth},set:function(t){this._sourceWidth!==t&&(this._sourceWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"sourceHeight",{get:function(){return this._sourceHeight},set:function(t){this._sourceHeight!==t&&(this._sourceHeight=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoScale",{get:function(){return this._autoScale},set:function(t){this._autoScale!==t&&(this._autoScale=t,t&&this._loaded&&this.synchronizeSizeWithContent())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stretch",{get:function(){return this._stretch},set:function(t){this._stretch!==t&&(this._stretch=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"domImage",{get:function(){return this._domImage},set:function(t){var e=this;this._domImage=t,this._loaded=!1,this._domImage.width?this._onImageLoaded():this._domImage.onload=function(){e._onImageLoaded()}},enumerable:!0,configurable:!0}),e.prototype._onImageLoaded=function(){this._imageWidth=this._domImage.width,this._imageHeight=this._domImage.height,this._loaded=!0,this._autoScale&&this.synchronizeSizeWithContent(),this._markAsDirty()},Object.defineProperty(e.prototype,"source",{set:function(t){var e=this;this._source!==t&&(this._loaded=!1,this._source=t,this._domImage=document.createElement("img"),this._domImage.onload=function(){e._onImageLoaded()},t&&(n.Tools.SetCorsBehavior(t,this._domImage),this._domImage.src=t))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth!==t&&(this._cellWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight!==t&&(this._cellHeight=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellId",{get:function(){return this._cellId},set:function(t){this._cellId!==t&&(this._cellId=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Image"},e.prototype.synchronizeSizeWithContent=function(){this._loaded&&(this.width=this._domImage.width+"px",this.height=this._domImage.height+"px")},e.prototype._draw=function(t,i){var r,o,n,s;if(i.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(i.shadowColor=this.shadowColor,i.shadowBlur=this.shadowBlur,i.shadowOffsetX=this.shadowOffsetX,i.shadowOffsetY=this.shadowOffsetY),-1==this.cellId)r=this._sourceLeft,o=this._sourceTop,n=this._sourceWidth?this._sourceWidth:this._imageWidth,s=this._sourceHeight?this._sourceHeight:this._imageHeight;else{var a=this._domImage.naturalWidth/this.cellWidth,h=this.cellId/a>>0,l=this.cellId%a;r=this.cellWidth*l,o=this.cellHeight*h,n=this.cellWidth,s=this.cellHeight}if(this._applyStates(i),this._processMeasures(t,i)&&this._loaded)switch(this._stretch){case e.STRETCH_NONE:case e.STRETCH_FILL:i.drawImage(this._domImage,r,o,n,s,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height);break;case e.STRETCH_UNIFORM:var u=this._currentMeasure.width/n,c=this._currentMeasure.height/s,_=Math.min(u,c),f=(this._currentMeasure.width-n*_)/2,p=(this._currentMeasure.height-s*_)/2;i.drawImage(this._domImage,r,o,n,s,this._currentMeasure.left+f,this._currentMeasure.top+p,n*_,s*_);break;case e.STRETCH_EXTEND:i.drawImage(this._domImage,r,o,n,s,this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height),this._autoScale&&this.synchronizeSizeWithContent(),this._root&&this._root.parent&&(this._root.width=this.width,this._root.height=this.height)}i.restore()},e.STRETCH_NONE=0,e.STRETCH_FILL=1,e.STRETCH_UNIFORM=2,e.STRETCH_EXTEND=3,e}(o.Control);e.Image=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(0),n=i(4),s=i(23),a=i(7),h=function(t){function e(e,i,r,s,a,h){void 0===i&&(i=0),void 0===r&&(r=0),void 0===a&&(a=!1),void 0===h&&(h=o.Texture.NEAREST_SAMPLINGMODE);var l=t.call(this,e,{width:i,height:r},s,a,h,o.Engine.TEXTUREFORMAT_RGBA)||this;return l._isDirty=!1,l._rootContainer=new n.Container("root"),l._lastControlOver={},l._lastControlDown={},l._capturingControl={},l._linkedControls=new Array,l._isFullscreen=!1,l._fullscreenViewport=new o.Viewport(0,0,1,1),l._idealWidth=0,l._idealHeight=0,l._useSmallestIdeal=!1,l._renderAtIdealSize=!1,l._blockNextFocusCheck=!1,l._renderScale=1,l.premulAlpha=!1,(s=l.getScene())&&l._texture?(l._rootCanvas=s.getEngine().getRenderingCanvas(),l._renderObserver=s.onBeforeCameraRenderObservable.add(function(t){return l._checkUpdate(t)}),l._preKeyboardObserver=s.onPreKeyboardObservable.add(function(t){l._focusedControl&&(t.type===o.KeyboardEventTypes.KEYDOWN&&l._focusedControl.processKeyboard(t.event),t.skipOnPointerObservable=!0)}),l._rootContainer._link(null,l),l.hasAlpha=!0,i&&r||(l._resizeObserver=s.getEngine().onResizeObservable.add(function(){return l._onResize()}),l._onResize()),l._texture.isReady=!0,l):l}return r(e,t),Object.defineProperty(e.prototype,"renderScale",{get:function(){return this._renderScale},set:function(t){t!==this._renderScale&&(this._renderScale=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this.markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"idealWidth",{get:function(){return this._idealWidth},set:function(t){this._idealWidth!==t&&(this._idealWidth=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"idealHeight",{get:function(){return this._idealHeight},set:function(t){this._idealHeight!==t&&(this._idealHeight=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"useSmallestIdeal",{get:function(){return this._useSmallestIdeal},set:function(t){this._useSmallestIdeal!==t&&(this._useSmallestIdeal=t,this.markAsDirty(),this._rootContainer._markAllAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderAtIdealSize",{get:function(){return this._renderAtIdealSize},set:function(t){this._renderAtIdealSize!==t&&(this._renderAtIdealSize=t,this._onResize())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"layer",{get:function(){return this._layerToDispose},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focusedControl",{get:function(){return this._focusedControl},set:function(t){this._focusedControl!=t&&(this._focusedControl&&this._focusedControl.onBlur(),t&&t.onFocus(),this._focusedControl=t)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isForeground",{get:function(){return!this.layer||!this.layer.isBackground},set:function(t){this.layer&&this.layer.isBackground!==!t&&(this.layer.isBackground=!t)},enumerable:!0,configurable:!0}),e.prototype.executeOnAllControls=function(t,e){e||(e=this._rootContainer),t(e);for(var i=0,r=e.children;i<r.length;i++){var o=r[i];o.children?this.executeOnAllControls(t,o):t(o)}},e.prototype.markAsDirty=function(){this._isDirty=!0},e.prototype.createStyle=function(){return new s.Style(this)},e.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},e.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},e.prototype.dispose=function(){var e=this.getScene();e&&(this._rootCanvas=null,e.onBeforeCameraRenderObservable.remove(this._renderObserver),this._resizeObserver&&e.getEngine().onResizeObservable.remove(this._resizeObserver),this._pointerMoveObserver&&e.onPrePointerObservable.remove(this._pointerMoveObserver),this._pointerObserver&&e.onPointerObservable.remove(this._pointerObserver),this._preKeyboardObserver&&e.onPreKeyboardObservable.remove(this._preKeyboardObserver),this._canvasPointerOutObserver&&e.getEngine().onCanvasPointerOutObservable.remove(this._canvasPointerOutObserver),this._layerToDispose&&(this._layerToDispose.texture=null,this._layerToDispose.dispose(),this._layerToDispose=null),this._rootContainer.dispose(),t.prototype.dispose.call(this))},e.prototype._onResize=function(){var t=this.getScene();if(t){var e=t.getEngine(),i=this.getSize(),r=e.getRenderWidth()*this._renderScale,o=e.getRenderHeight()*this._renderScale;this._renderAtIdealSize&&(this._idealWidth?(o=o*this._idealWidth/r,r=this._idealWidth):this._idealHeight&&(r=r*this._idealHeight/o,o=this._idealHeight)),i.width===r&&i.height===o||(this.scaleTo(r,o),this.markAsDirty(),(this._idealWidth||this._idealHeight)&&this._rootContainer._markAllAsDirty())}},e.prototype._getGlobalViewport=function(t){var e=t.getEngine();return this._fullscreenViewport.toGlobal(e.getRenderWidth(),e.getRenderHeight())},e.prototype.getProjectedPosition=function(t,e){var i=this.getScene();if(!i)return o.Vector2.Zero();var r=this._getGlobalViewport(i),n=o.Vector3.Project(t,e,i.getTransformMatrix(),r);return n.scaleInPlace(this.renderScale),new o.Vector2(n.x,n.y)},e.prototype._checkUpdate=function(t){if(!this._layerToDispose||0!=(t.layerMask&this._layerToDispose.layerMask)){if(this._isFullscreen&&this._linkedControls.length){var e=this.getScene();if(!e)return;for(var i=this._getGlobalViewport(e),r=0,n=this._linkedControls;r<n.length;r++){var s=n[r];if(s.isVisible){var a=s._linkedMesh;if(a&&!a.isDisposed()){var h=a.getBoundingInfo().boundingSphere.center,l=o.Vector3.Project(h,a.getWorldMatrix(),e.getTransformMatrix(),i);l.z<0||l.z>1?s.notRenderable=!0:(s.notRenderable=!1,l.scaleInPlace(this.renderScale),s._moveToProjectedPosition(l))}else o.Tools.SetImmediate(function(){s.linkWithMesh(null)})}}}(this._isDirty||this._rootContainer.isDirty)&&(this._isDirty=!1,this._render(),this.update(!0,this.premulAlpha))}},e.prototype._render=function(){var t=this.getSize(),e=t.width,i=t.height,r=this.getContext();r.clearRect(0,0,e,i),this._background&&(r.save(),r.fillStyle=this._background,r.fillRect(0,0,e,i),r.restore()),r.font="18px Arial",r.strokeStyle="white";var o=new a.Measure(0,0,e,i);this._rootContainer._draw(o,r)},e.prototype._changeCursor=function(t){this._rootCanvas&&(this._rootCanvas.style.cursor=t)},e.prototype._doPicking=function(t,e,i,r,n){var s=this.getScene();if(s){var a=s.getEngine(),h=this.getSize();this._isFullscreen&&(t*=h.width/a.getRenderWidth(),e*=h.height/a.getRenderHeight()),this._capturingControl[r]?this._capturingControl[r]._processObservables(i,t,e,r,n):(this._rootContainer._processPicking(t,e,i,r,n)||(this._changeCursor(""),i===o.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[r]&&this._lastControlOver[r]._onPointerOut(this._lastControlOver[r]),delete this._lastControlOver[r])),this._manageFocus())}},e.prototype._cleanControlAfterRemovalFromList=function(t,e){for(var i in t){if(t.hasOwnProperty(i))t[i]===e&&delete t[i]}},e.prototype._cleanControlAfterRemoval=function(t){this._cleanControlAfterRemovalFromList(this._lastControlDown,t),this._cleanControlAfterRemovalFromList(this._lastControlOver,t)},e.prototype.attach=function(){var t=this,e=this.getScene();e&&(this._pointerMoveObserver=e.onPrePointerObservable.add(function(i,r){if(!e.isPointerCaptured(i.event.pointerId)&&(i.type===o.PointerEventTypes.POINTERMOVE||i.type===o.PointerEventTypes.POINTERUP||i.type===o.PointerEventTypes.POINTERDOWN)&&e){var n=e.cameraToUseForPointers||e.activeCamera;if(n){var s=e.getEngine(),a=n.viewport,h=(e.pointerX/s.getHardwareScalingLevel()-a.x*s.getRenderWidth())/a.width,l=(e.pointerY/s.getHardwareScalingLevel()-a.y*s.getRenderHeight())/a.height;t._shouldBlockPointer=!1,t._doPicking(h,l,i.type,i.event.pointerId||0,i.event.button),t._shouldBlockPointer&&(i.skipOnPointerObservable=t._shouldBlockPointer)}}}),this._attachToOnPointerOut(e))},e.prototype.attachToMesh=function(t,e){var i=this;void 0===e&&(e=!0);var r=this.getScene();r&&(this._pointerObserver=r.onPointerObservable.add(function(e,r){if(e.type===o.PointerEventTypes.POINTERMOVE||e.type===o.PointerEventTypes.POINTERUP||e.type===o.PointerEventTypes.POINTERDOWN){var n=e.event.pointerId||0;if(e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh===t){var s=e.pickInfo.getTextureCoordinates();if(s){var a=i.getSize();i._doPicking(s.x*a.width,(1-s.y)*a.height,e.type,n,e.event.button)}}else if(e.type===o.PointerEventTypes.POINTERUP){if(i._lastControlDown[n]&&i._lastControlDown[n]._forcePointerUp(n),delete i._lastControlDown[n],i.focusedControl){var h=i.focusedControl.keepsFocusWith(),l=!0;if(h)for(var u=0,c=h;u<c.length;u++){var _=c[u];if(i!==_._host){var f=_._host;if(f._lastControlOver[n]&&f._lastControlOver[n].isAscendant(_)){l=!1;break}}}l&&(i.focusedControl=null)}}else e.type===o.PointerEventTypes.POINTERMOVE&&(i._lastControlOver[n]&&i._lastControlOver[n]._onPointerOut(i._lastControlOver[n]),delete i._lastControlOver[n])}}),t.enablePointerMoveEvents=e,this._attachToOnPointerOut(r))},e.prototype.moveFocusToControl=function(t){this.focusedControl=t,this._lastPickedControl=t,this._blockNextFocusCheck=!0},e.prototype._manageFocus=function(){if(this._blockNextFocusCheck)return this._blockNextFocusCheck=!1,void(this._lastPickedControl=this._focusedControl);if(this._focusedControl&&this._focusedControl!==this._lastPickedControl){if(this._lastPickedControl.isFocusInvisible)return;this.focusedControl=null}},e.prototype._attachToOnPointerOut=function(t){var e=this;this._canvasPointerOutObserver=t.getEngine().onCanvasPointerOutObservable.add(function(t){e._lastControlOver[t.pointerId]&&e._lastControlOver[t.pointerId]._onPointerOut(e._lastControlOver[t.pointerId]),delete e._lastControlOver[t.pointerId],e._lastControlDown[t.pointerId]&&e._lastControlDown[t.pointerId]._forcePointerUp(),delete e._lastControlDown[t.pointerId]})},e.CreateForMesh=function(t,i,r,n,s){void 0===i&&(i=1024),void 0===r&&(r=1024),void 0===n&&(n=!0),void 0===s&&(s=!1);var a=new e(t.name+" AdvancedDynamicTexture",i,r,t.getScene(),!0,o.Texture.TRILINEAR_SAMPLINGMODE),h=new o.StandardMaterial("AdvancedDynamicTextureMaterial",t.getScene());return h.backFaceCulling=!1,h.diffuseColor=o.Color3.Black(),h.specularColor=o.Color3.Black(),s?(h.diffuseTexture=a,h.emissiveTexture=a,a.hasAlpha=!0):(h.emissiveTexture=a,h.opacityTexture=a),t.material=h,a.attachToMesh(t,n),a},e.CreateFullscreenUI=function(t,i,r,n){void 0===i&&(i=!0),void 0===r&&(r=null),void 0===n&&(n=o.Texture.BILINEAR_SAMPLINGMODE);var s=new e(t,0,0,r,!1,n),a=new o.Layer(t+"_layer",null,r,!i);return a.texture=s,s._layerToDispose=a,s._isFullscreen=!0,s.attach(),s},e}(o.DynamicTexture);e.AdvancedDynamicTexture=h},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0),o=i(25),n=function(){function t(t){this.name=t,this._downCount=0,this._enterCount=-1,this._downPointerIds={},this._isVisible=!0,this.onPointerMoveObservable=new r.Observable,this.onPointerOutObservable=new r.Observable,this.onPointerDownObservable=new r.Observable,this.onPointerUpObservable=new r.Observable,this.onPointerClickObservable=new r.Observable,this.onPointerEnterObservable=new r.Observable,this._behaviors=new Array}return Object.defineProperty(t.prototype,"position",{get:function(){return this._node?this._node.position:r.Vector3.Zero()},set:function(t){this._node&&(this._node.position=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"scaling",{get:function(){return this._node?this._node.scaling:new r.Vector3(1,1,1)},set:function(t){this._node&&(this._node.scaling=t)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!0,configurable:!0}),t.prototype.addBehavior=function(t){var e=this;if(-1!==this._behaviors.indexOf(t))return this;t.init();var i=this._host.scene;return i.isLoading?i.onDataLoadedObservable.addOnce(function(){t.attach(e)}):t.attach(this),this._behaviors.push(t),this},t.prototype.removeBehavior=function(t){var e=this._behaviors.indexOf(t);return-1===e?this:(this._behaviors[e].detach(),this._behaviors.splice(e,1),this)},t.prototype.getBehaviorByName=function(t){for(var e=0,i=this._behaviors;e<i.length;e++){var r=i[e];if(r.name===t)return r}return null},Object.defineProperty(t.prototype,"isVisible",{get:function(){return this._isVisible},set:function(t){if(this._isVisible!==t){this._isVisible=t;var e=this.mesh;e&&e.setEnabled(t)}},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"typeName",{get:function(){return this._getTypeName()},enumerable:!0,configurable:!0}),t.prototype._getTypeName=function(){return"Control3D"},Object.defineProperty(t.prototype,"node",{get:function(){return this._node},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._node instanceof r.AbstractMesh?this._node:null},enumerable:!0,configurable:!0}),t.prototype.linkToTransformNode=function(t){return this._node&&(this._node.parent=t),this},t.prototype._prepareNode=function(t){if(!this._node){if(this._node=this._createNode(t),!this.node)return;this._node.metadata=this,this._node.position=this.position,this._node.scaling=this.scaling;var e=this.mesh;e&&(e.isPickable=!0,this._affectMaterial(e))}},t.prototype._createNode=function(t){return null},t.prototype._affectMaterial=function(t){t.material=null},t.prototype._onPointerMove=function(t,e){this.onPointerMoveObservable.notifyObservers(e,-1,t,this)},t.prototype._onPointerEnter=function(t){return!(this._enterCount>0)&&(-1===this._enterCount&&(this._enterCount=0),this._enterCount++,this.onPointerEnterObservable.notifyObservers(this,-1,t,this),this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},t.prototype._onPointerOut=function(t){this._enterCount=0,this.onPointerOutObservable.notifyObservers(this,-1,t,this),this.pointerOutAnimation&&this.pointerOutAnimation()},t.prototype._onPointerDown=function(t,e,i,r){return 0===this._downCount&&(this._downCount++,this._downPointerIds[i]=!0,this.onPointerDownObservable.notifyObservers(new o.Vector3WithInfo(e,r),-1,t,this),this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},t.prototype._onPointerUp=function(t,e,i,r,n){this._downCount=0,delete this._downPointerIds[i],n&&(this._enterCount>0||-1===this._enterCount)&&this.onPointerClickObservable.notifyObservers(new o.Vector3WithInfo(e,r),-1,t,this),this.onPointerUpObservable.notifyObservers(new o.Vector3WithInfo(e,r),-1,t,this),this.pointerUpAnimation&&this.pointerUpAnimation()},t.prototype.forcePointerUp=function(t){if(void 0===t&&(t=null),null!==t)this._onPointerUp(this,r.Vector3.Zero(),t,0,!0);else for(var e in this._downPointerIds)this._onPointerUp(this,r.Vector3.Zero(),+e,0,!0)},t.prototype._processObservables=function(t,e,i,o){if(t===r.PointerEventTypes.POINTERMOVE){this._onPointerMove(this,e);var n=this._host._lastControlOver[i];return n&&n!==this&&n._onPointerOut(this),n!==this&&this._onPointerEnter(this),this._host._lastControlOver[i]=this,!0}return t===r.PointerEventTypes.POINTERDOWN?(this._onPointerDown(this,e,i,o),this._host._lastControlDown[i]=this,this._host._lastPickedControl=this,!0):t===r.PointerEventTypes.POINTERUP&&(this._host._lastControlDown[i]&&this._host._lastControlDown[i]._onPointerUp(this,e,i,o,!0),delete this._host._lastControlDown[i],!0)},t.prototype._disposeNode=function(){this._node&&(this._node.dispose(),this._node=null)},t.prototype.dispose=function(){this.onPointerDownObservable.clear(),this.onPointerEnterObservable.clear(),this.onPointerMoveObservable.clear(),this.onPointerOutObservable.clear(),this.onPointerUpObservable.clear(),this.onPointerClickObservable.clear(),this._disposeNode();for(var t=0,e=this._behaviors;t<e.length;t++){e[t].detach()}},t}();e.Control3D=n},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(24),n=i(0),s=i(12),a=function(t){function e(e){var i=t.call(this,e)||this;return i._contentResolution=512,i._contentScaleRatio=2,i.pointerEnterAnimation=function(){i.mesh&&(i._currentMaterial.emissiveColor=n.Color3.Red())},i.pointerOutAnimation=function(){i._currentMaterial.emissiveColor=n.Color3.Black()},i.pointerDownAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(.95)},i.pointerUpAnimation=function(){i.mesh&&i.mesh.scaling.scaleInPlace(1/.95)},i}return r(e,t),Object.defineProperty(e.prototype,"contentResolution",{get:function(){return this._contentResolution},set:function(t){this._contentResolution!==t&&(this._contentResolution=t,this._resetContent())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contentScaleRatio",{get:function(){return this._contentScaleRatio},set:function(t){this._contentScaleRatio!==t&&(this._contentScaleRatio=t,this._resetContent())},enumerable:!0,configurable:!0}),e.prototype._disposeFacadeTexture=function(){this._facadeTexture&&(this._facadeTexture.dispose(),this._facadeTexture=null)},e.prototype._resetContent=function(){this._disposeFacadeTexture(),this.content=this._content},Object.defineProperty(e.prototype,"content",{get:function(){return this._content},set:function(t){this._content=t,this._host&&this._host.utilityLayer&&(this._facadeTexture||(this._facadeTexture=new s.AdvancedDynamicTexture("Facade",this._contentResolution,this._contentResolution,this._host.utilityLayer.utilityLayerScene,!0,n.Texture.TRILINEAR_SAMPLINGMODE),this._facadeTexture.rootContainer.scaleX=this._contentScaleRatio,this._facadeTexture.rootContainer.scaleY=this._contentScaleRatio,this._facadeTexture.premulAlpha=!0),this._facadeTexture.addControl(t),this._applyFacade(this._facadeTexture))},enumerable:!0,configurable:!0}),e.prototype._applyFacade=function(t){this._currentMaterial.emissiveTexture=t},e.prototype._getTypeName=function(){return"Button3D"},e.prototype._createNode=function(t){for(var e=new Array(6),i=0;i<6;i++)e[i]=new n.Vector4(0,0,0,0);return e[1]=new n.Vector4(0,0,1,1),n.MeshBuilder.CreateBox(this.name+"_rootMesh",{width:1,height:1,depth:.08,faceUV:e},t)},e.prototype._affectMaterial=function(t){var e=new n.StandardMaterial(this.name+"Material",t.getScene());e.specularColor=n.Color3.Black(),t.material=e,this._currentMaterial=e,this._resetContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeFacadeTexture(),this._currentMaterial&&this._currentMaterial.dispose()},e}(o.AbstractButton3D);e.Button3D=a},function(t,e,i){"use strict";function r(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),r(i(29)),r(i(40))},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(10),n=i(1),s=i(5),a=i(11),h=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i.thickness=1,i.isPointerBlocker=!0,i.pointerEnterAnimation=function(){i.alpha-=.1},i.pointerOutAnimation=function(){i.alpha+=.1},i.pointerDownAnimation=function(){i.scaleX-=.05,i.scaleY-=.05},i.pointerUpAnimation=function(){i.scaleX+=.05,i.scaleY+=.05},i}return r(e,t),e.prototype._getTypeName=function(){return"Button"},e.prototype._processPicking=function(e,i,r,o,n){return!(!this.isHitTestVisible||!this.isVisible||this.notRenderable)&&(!!t.prototype.contains.call(this,e,i)&&(this._processObservables(r,e,i,o,n),!0))},e.prototype._onPointerEnter=function(e){return!!t.prototype._onPointerEnter.call(this,e)&&(this.pointerEnterAnimation&&this.pointerEnterAnimation(),!0)},e.prototype._onPointerOut=function(e){this.pointerOutAnimation&&this.pointerOutAnimation(),t.prototype._onPointerOut.call(this,e)},e.prototype._onPointerDown=function(e,i,r,o){return!!t.prototype._onPointerDown.call(this,e,i,r,o)&&(this.pointerDownAnimation&&this.pointerDownAnimation(),!0)},e.prototype._onPointerUp=function(e,i,r,o,n){this.pointerUpAnimation&&this.pointerUpAnimation(),t.prototype._onPointerUp.call(this,e,i,r,o,n)},e.CreateImageButton=function(t,i,r){var o=new e(t),h=new s.TextBlock(t+"_button",i);h.textWrapping=!0,h.textHorizontalAlignment=n.Control.HORIZONTAL_ALIGNMENT_CENTER,h.paddingLeft="20%",o.addControl(h);var l=new a.Image(t+"_icon",r);return l.width="20%",l.stretch=a.Image.STRETCH_UNIFORM,l.horizontalAlignment=n.Control.HORIZONTAL_ALIGNMENT_LEFT,o.addControl(l),o},e.CreateImageOnlyButton=function(t,i){var r=new e(t),o=new a.Image(t+"_icon",i);return o.stretch=a.Image.STRETCH_FILL,o.horizontalAlignment=n.Control.HORIZONTAL_ALIGNMENT_LEFT,r.addControl(o),r},e.CreateSimpleButton=function(t,i){var r=new e(t),o=new s.TextBlock(t+"_button",i);return o.textWrapping=!0,o.textHorizontalAlignment=n.Control.HORIZONTAL_ALIGNMENT_CENTER,r.addControl(o),r},e.CreateImageWithCenterTextButton=function(t,i,r){var o=new e(t),h=new a.Image(t+"_icon",r);h.stretch=a.Image.STRETCH_FILL,o.addControl(h);var l=new s.TextBlock(t+"_button",i);return l.textWrapping=!0,l.textHorizontalAlignment=n.Control.HORIZONTAL_ALIGNMENT_CENTER,o.addControl(l),o},e}(o.Rectangle);e.Button=h},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(0),n=function(t){function e(e,i){void 0===i&&(i=0);var r=t.call(this,e.x,e.y)||this;return r.buttonIndex=i,r}return r(e,t),e}(o.Vector2);e.Vector2WithInfo=n;var s=function(){function t(t,e,i,r,o,n){this.m=new Float32Array(6),this.fromValues(t,e,i,r,o,n)}return t.prototype.fromValues=function(t,e,i,r,o,n){return this.m[0]=t,this.m[1]=e,this.m[2]=i,this.m[3]=r,this.m[4]=o,this.m[5]=n,this},t.prototype.determinant=function(){return this.m[0]*this.m[3]-this.m[1]*this.m[2]},t.prototype.invertToRef=function(t){var e=this.m[0],i=this.m[1],r=this.m[2],n=this.m[3],s=this.m[4],a=this.m[5],h=this.determinant();if(h<o.Epsilon*o.Epsilon)return t.m[0]=0,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[5]=0,this;var l=1/h,u=r*a-n*s,c=i*s-e*a;return t.m[0]=n*l,t.m[1]=-i*l,t.m[2]=-r*l,t.m[3]=e*l,t.m[4]=u*l,t.m[5]=c*l,this},t.prototype.multiplyToRef=function(t,e){var i=this.m[0],r=this.m[1],o=this.m[2],n=this.m[3],s=this.m[4],a=this.m[5],h=t.m[0],l=t.m[1],u=t.m[2],c=t.m[3],_=t.m[4],f=t.m[5];return e.m[0]=i*h+r*u,e.m[1]=i*l+r*c,e.m[2]=o*h+n*u,e.m[3]=o*l+n*c,e.m[4]=s*h+a*u+_,e.m[5]=s*l+a*c+f,this},t.prototype.transformCoordinates=function(t,e,i){return i.x=t*this.m[0]+e*this.m[2]+this.m[4],i.y=t*this.m[1]+e*this.m[3]+this.m[5],this},t.Identity=function(){return new t(1,0,0,1,0,0)},t.TranslationToRef=function(t,e,i){i.fromValues(1,0,0,1,t,e)},t.ScalingToRef=function(t,e,i){i.fromValues(t,0,0,e,0,0)},t.RotationToRef=function(t,e){var i=Math.sin(t),r=Math.cos(t);e.fromValues(r,i,-i,r,0,0)},t.ComposeToRef=function(e,i,r,o,n,s,a){t.TranslationToRef(e,i,t._TempPreTranslationMatrix),t.ScalingToRef(o,n,t._TempScalingMatrix),t.RotationToRef(r,t._TempRotationMatrix),t.TranslationToRef(-e,-i,t._TempPostTranslationMatrix),t._TempPreTranslationMatrix.multiplyToRef(t._TempScalingMatrix,t._TempCompose0),t._TempCompose0.multiplyToRef(t._TempRotationMatrix,t._TempCompose1),s?(t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,t._TempCompose2),t._TempCompose2.multiplyToRef(s,a)):t._TempCompose1.multiplyToRef(t._TempPostTranslationMatrix,a)},t._TempPreTranslationMatrix=t.Identity(),t._TempPostTranslationMatrix=t.Identity(),t._TempRotationMatrix=t.Identity(),t._TempScalingMatrix=t.Identity(),t._TempCompose0=t.Identity(),t._TempCompose1=t.Identity(),t._TempCompose2=t.Identity(),t}();e.Matrix2D=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(0),s=i(6),a=i(5),h=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.onIsCheckedChangedObservable=new n.Observable,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t))},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"CheckBox"},e.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=this._currentMeasure.width-this._thickness,r=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._isChecked){e.fillStyle=this._isEnabled?this.color:this._disabledColor;var o=i*this._checkSizeRatio,n=r*this._checkSizeRatio;e.fillRect(this._currentMeasure.left+this._thickness/2+(i-o)/2,this._currentMeasure.top+this._thickness/2+(r-n)/2,o,n)}e.strokeStyle=this.color,e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,i,r)}e.restore()},e.prototype._onPointerDown=function(e,i,r,o){return!!t.prototype._onPointerDown.call(this,e,i,r,o)&&(this.isChecked=!this.isChecked,!0)},e.AddCheckBoxWithHeader=function(t,i){var r=new s.StackPanel;r.isVertical=!1,r.height="30px";var n=new e;n.width="20px",n.height="20px",n.isChecked=!0,n.color="green",n.onIsCheckedChangedObservable.add(i),r.addControl(n);var h=new a.TextBlock;return h.text=t,h.width="180px",h.paddingLeft="5px",h.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,h.color="white",r.addControl(h),r},e}(o.Control);e.Checkbox=h},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(2),s=i(0),a=function(t){function e(e,i){void 0===i&&(i="");var r=t.call(this,e)||this;return r.name=e,r._text="",r._placeholderText="",r._background="#222222",r._focusedBackground="#000000",r._placeholderColor="gray",r._thickness=1,r._margin=new n.ValueAndUnit(10,n.ValueAndUnit.UNITMODE_PIXEL),r._autoStretchWidth=!0,r._maxWidth=new n.ValueAndUnit(1,n.ValueAndUnit.UNITMODE_PERCENTAGE,!1),r._isFocused=!1,r._blinkIsEven=!1,r._cursorOffset=0,r._deadKey=!1,r._addKey=!0,r._currentKey="",r.promptMessage="Please enter text:",r.onTextChangedObservable=new s.Observable,r.onBeforeKeyAddObservable=new s.Observable,r.onFocusObservable=new s.Observable,r.onBlurObservable=new s.Observable,r.text=i,r}return r(e,t),Object.defineProperty(e.prototype,"maxWidth",{get:function(){return this._maxWidth.toString(this._host)},set:function(t){this._maxWidth.toString(this._host)!==t&&this._maxWidth.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxWidthInPixels",{get:function(){return this._maxWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"margin",{get:function(){return this._margin.toString(this._host)},set:function(t){this._margin.toString(this._host)!==t&&this._margin.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"marginInPixels",{get:function(){return this._margin.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"autoStretchWidth",{get:function(){return this._autoStretchWidth},set:function(t){this._autoStretchWidth!==t&&(this._autoStretchWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focusedBackground",{get:function(){return this._focusedBackground},set:function(t){this._focusedBackground!==t&&(this._focusedBackground=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"placeholderColor",{get:function(){return this._placeholderColor},set:function(t){this._placeholderColor!==t&&(this._placeholderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"placeholderText",{get:function(){return this._placeholderText},set:function(t){this._placeholderText!==t&&(this._placeholderText=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"deadKey",{get:function(){return this._deadKey},set:function(t){this._deadKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"addKey",{get:function(){return this._addKey},set:function(t){this._addKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentKey",{get:function(){return this._currentKey},set:function(t){this._currentKey=t},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._markAsDirty(),this.onTextChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{get:function(){return this._width.toString(this._host)},set:function(t){this._width.toString(this._host)!==t&&(this._width.fromString(t)&&this._markAsDirty(),this.autoStretchWidth=!1)},enumerable:!0,configurable:!0}),e.prototype.onBlur=function(){this._isFocused=!1,this._scrollLeft=null,this._cursorOffset=0,clearTimeout(this._blinkTimeout),this._markAsDirty(),this.onBlurObservable.notifyObservers(this)},e.prototype.onFocus=function(){if(this._isEnabled&&(this._scrollLeft=null,this._isFocused=!0,this._blinkIsEven=!1,this._cursorOffset=0,this._markAsDirty(),this.onFocusObservable.notifyObservers(this),-1!==navigator.userAgent.indexOf("Mobile"))){var t=prompt(this.promptMessage);return null!==t&&(this.text=t),void(this._host.focusedControl=null)}},e.prototype._getTypeName=function(){return"InputText"},e.prototype.keepsFocusWith=function(){return this._connectedVirtualKeyboard?[this._connectedVirtualKeyboard]:null},e.prototype.processKey=function(t,e){switch(t){case 32:e=" ";break;case 8:if(this._text&&this._text.length>0)if(0===this._cursorOffset)this.text=this._text.substr(0,this._text.length-1);else(i=this._text.length-this._cursorOffset)>0&&(this.text=this._text.slice(0,i-1)+this._text.slice(i));return;case 46:if(this._text&&this._text.length>0){var i=this._text.length-this._cursorOffset;this.text=this._text.slice(0,i)+this._text.slice(i+1),this._cursorOffset--}return;case 13:return void(this._host.focusedControl=null);case 35:return this._cursorOffset=0,this._blinkIsEven=!1,void this._markAsDirty();case 36:return this._cursorOffset=this._text.length,this._blinkIsEven=!1,void this._markAsDirty();case 37:return this._cursorOffset++,this._cursorOffset>this._text.length&&(this._cursorOffset=this._text.length),this._blinkIsEven=!1,void this._markAsDirty();case 39:return this._cursorOffset--,this._cursorOffset<0&&(this._cursorOffset=0),this._blinkIsEven=!1,void this._markAsDirty();case 222:return void(this.deadKey=!0)}if(e&&(-1===t||32===t||t>47&&t<58||t>64&&t<91||t>185&&t<193||t>218&&t<223||t>95&&t<112)&&(this._currentKey=e,this.onBeforeKeyAddObservable.notifyObservers(this),e=this._currentKey,this._addKey))if(0===this._cursorOffset)this.text+=e;else{var r=this._text.length-this._cursorOffset;this.text=this._text.slice(0,r)+e+this._text.slice(r)}},e.prototype.processKeyboard=function(t){this.processKey(t.keyCode,t.key)},e.prototype._draw=function(t,e){var i=this;if(e.save(),this._applyStates(e),this._processMeasures(t,e)){(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isFocused?this._focusedBackground&&(e.fillStyle=this._isEnabled?this._focusedBackground:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)):this._background&&(e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height)),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._fontOffset||(this._fontOffset=o.Control._GetFontOffset(e.font));var r=this._currentMeasure.left+this._margin.getValueInPixel(this._host,t.width);this.color&&(e.fillStyle=this.color);var n=this._beforeRenderText(this._text);this._isFocused||this._text||!this._placeholderText||(n=this._placeholderText,this._placeholderColor&&(e.fillStyle=this._placeholderColor)),this._textWidth=e.measureText(n).width;var s=2*this._margin.getValueInPixel(this._host,t.width);this._autoStretchWidth&&(this.width=Math.min(this._maxWidth.getValueInPixel(this._host,t.width),this._textWidth+s)+"px");var a=this._fontOffset.ascent+(this._currentMeasure.height-this._fontOffset.height)/2,h=this._width.getValueInPixel(this._host,t.width)-s;if(e.save(),e.beginPath(),e.rect(r,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,h+2,this._currentMeasure.height),e.clip(),this._isFocused&&this._textWidth>h){var l=r-this._textWidth+h;this._scrollLeft||(this._scrollLeft=l)}else this._scrollLeft=r;if(e.fillText(n,this._scrollLeft,this._currentMeasure.top+a),this._isFocused){if(this._clickedCoordinate){var u=this._scrollLeft+this._textWidth-this._clickedCoordinate,c=0;this._cursorOffset=0;var _=0;do{this._cursorOffset&&(_=Math.abs(u-c)),this._cursorOffset++,c=e.measureText(n.substr(n.length-this._cursorOffset,this._cursorOffset)).width}while(c<u&&n.length>=this._cursorOffset);Math.abs(u-c)>_&&this._cursorOffset--,this._blinkIsEven=!1,this._clickedCoordinate=null}if(!this._blinkIsEven){var f=this.text.substr(this._text.length-this._cursorOffset),p=e.measureText(f).width,d=this._scrollLeft+this._textWidth-p;d<r?(this._scrollLeft+=r-d,d=r,this._markAsDirty()):d>r+h&&(this._scrollLeft+=r+h-d,d=r+h,this._markAsDirty()),e.fillRect(d,this._currentMeasure.top+(this._currentMeasure.height-this._fontOffset.height)/2,2,this._fontOffset.height)}clearTimeout(this._blinkTimeout),this._blinkTimeout=setTimeout(function(){i._blinkIsEven=!i._blinkIsEven,i._markAsDirty()},500)}e.restore(),this._thickness&&(this.color&&(e.strokeStyle=this.color),e.lineWidth=this._thickness,e.strokeRect(this._currentMeasure.left+this._thickness/2,this._currentMeasure.top+this._thickness/2,this._currentMeasure.width-this._thickness,this._currentMeasure.height-this._thickness))}e.restore()},e.prototype._onPointerDown=function(e,i,r,o){return!!t.prototype._onPointerDown.call(this,e,i,r,o)&&(this._clickedCoordinate=i.x,this._host.focusedControl===this?(clearTimeout(this._blinkTimeout),this._markAsDirty(),!0):!!this._isEnabled&&(this._host.focusedControl=this,!0))},e.prototype._onPointerUp=function(e,i,r,o,n){t.prototype._onPointerUp.call(this,e,i,r,o,n)},e.prototype._beforeRenderText=function(t){return t},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.onBlurObservable.clear(),this.onFocusObservable.clear(),this.onTextChangedObservable.clear()},e}(o.Control);e.InputText=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(2),o=i(0),n=function(){function t(t){this._multiLine=t,this._x=new r.ValueAndUnit(0),this._y=new r.ValueAndUnit(0),this._point=new o.Vector2(0,0)}return Object.defineProperty(t.prototype,"x",{get:function(){return this._x.toString(this._multiLine._host)},set:function(t){this._x.toString(this._multiLine._host)!==t&&this._x.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"y",{get:function(){return this._y.toString(this._multiLine._host)},set:function(t){this._y.toString(this._multiLine._host)!==t&&this._y.fromString(t)&&this._multiLine._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"control",{get:function(){return this._control},set:function(t){this._control!==t&&(this._control&&this._controlObserver&&(this._control.onDirtyObservable.remove(this._controlObserver),this._controlObserver=null),this._control=t,this._control&&(this._controlObserver=this._control.onDirtyObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"mesh",{get:function(){return this._mesh},set:function(t){this._mesh!==t&&(this._mesh&&this._meshObserver&&this._mesh.getScene().onAfterCameraRenderObservable.remove(this._meshObserver),this._mesh=t,this._mesh&&(this._meshObserver=this._mesh.getScene().onAfterCameraRenderObservable.add(this._multiLine.onPointUpdate)),this._multiLine._markAsDirty())},enumerable:!0,configurable:!0}),t.prototype.resetLinks=function(){this.control=null,this.mesh=null},t.prototype.translate=function(){return this._point=this._translatePoint(),this._point},t.prototype._translatePoint=function(){if(null!=this._mesh)return this._multiLine._host.getProjectedPosition(this._mesh.getBoundingInfo().boundingSphere.center,this._mesh.getWorldMatrix());if(null!=this._control)return new o.Vector2(this._control.centerX,this._control.centerY);var t=this._multiLine._host,e=this._x.getValueInPixel(t,Number(t._canvas.width)),i=this._y.getValueInPixel(t,Number(t._canvas.height));return new o.Vector2(e,i)},t.prototype.dispose=function(){this.resetLinks()},t}();e.MultiLinePoint=n},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(0),s=i(9),a=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._isChecked=!1,i._background="black",i._checkSizeRatio=.8,i._thickness=1,i.group="",i.onIsCheckedChangedObservable=new n.Observable,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"checkSizeRatio",{get:function(){return this._checkSizeRatio},set:function(t){t=Math.max(Math.min(1,t),0),this._checkSizeRatio!==t&&(this._checkSizeRatio=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isChecked",{get:function(){return this._isChecked},set:function(t){var e=this;this._isChecked!==t&&(this._isChecked=t,this._markAsDirty(),this.onIsCheckedChangedObservable.notifyObservers(t),this._isChecked&&this._host&&this._host.executeOnAllControls(function(t){if(t!==e&&void 0!==t.group){var i=t;i.group===e.group&&(i.isChecked=!1)}}))},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"RadioButton"},e.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=this._currentMeasure.width-this._thickness,r=this._currentMeasure.height-this._thickness;if((this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,e),e.fillStyle=this._isEnabled?this._background:this._disabledColor,e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this.color,e.lineWidth=this._thickness,e.stroke(),this._isChecked){e.fillStyle=this._isEnabled?this.color:this._disabledColor;var n=i*this._checkSizeRatio,s=r*this._checkSizeRatio;o.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,n/2-this._thickness/2,s/2-this._thickness/2,e),e.fill()}}e.restore()},e.prototype._onPointerDown=function(e,i,r,o){return!!t.prototype._onPointerDown.call(this,e,i,r,o)&&(this.isChecked||(this.isChecked=!0),!0)},e.AddRadioButtonWithHeader=function(t,i,r,n){var a=new s.StackPanel;a.isVertical=!1,a.height="30px";var h=new e;h.width="20px",h.height="20px",h.isChecked=r,h.color="green",h.group=i,h.onIsCheckedChangedObservable.add(function(t){return n(h,t)}),a.addControl(h);var l=new s.TextBlock;return l.text=t,l.width="180px",l.paddingLeft="5px",l.textHorizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,l.color="white",a.addControl(l),a},e}(o.Control);e.RadioButton=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(2),s=i(0),a=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thumbWidth=new n.ValueAndUnit(20,n.ValueAndUnit.UNITMODE_PIXEL,!1),i._minimum=0,i._maximum=100,i._value=50,i._isVertical=!1,i._background="black",i._borderColor="white",i._barOffset=new n.ValueAndUnit(5,n.ValueAndUnit.UNITMODE_PIXEL,!1),i._isThumbCircle=!1,i._isThumbClamped=!1,i.onValueChangedObservable=new s.Observable,i._pointerIsDown=!1,i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"borderColor",{get:function(){return this._borderColor},set:function(t){this._borderColor!==t&&(this._borderColor=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"barOffset",{get:function(){return this._barOffset.toString(this._host)},set:function(t){this._barOffset.toString(this._host)!==t&&this._barOffset.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"barOffsetInPixels",{get:function(){return this._barOffset.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidth",{get:function(){return this._thumbWidth.toString(this._host)},set:function(t){this._thumbWidth.toString(this._host)!==t&&this._thumbWidth.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"thumbWidthInPixels",{get:function(){return this._thumbWidth.getValueInPixel(this._host,this._cachedParentMeasure.width)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minimum",{get:function(){return this._minimum},set:function(t){this._minimum!==t&&(this._minimum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this._maximum},set:function(t){this._maximum!==t&&(this._maximum=t,this._markAsDirty(),this.value=Math.max(Math.min(this.value,this._maximum),this._minimum))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){t=Math.max(Math.min(t,this._maximum),this._minimum),this._value!==t&&(this._value=t,this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){this._isVertical!==t&&(this._isVertical=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isThumbCircle",{get:function(){return this._isThumbCircle},set:function(t){this._isThumbCircle!==t&&(this._isThumbCircle=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isThumbClamped",{get:function(){return this._isThumbClamped},set:function(t){this._isThumbClamped!==t&&(this._isThumbClamped=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Slider"},e.prototype._getThumbThickness=function(t,e){var i=0;switch(t){case"circle":i=this._thumbWidth.isPixel?Math.max(this._thumbWidth.getValue(this._host),e):e*this._thumbWidth.getValue(this._host);break;case"rectangle":i=this._thumbWidth.isPixel?Math.min(this._thumbWidth.getValue(this._host),e):e*this._thumbWidth.getValue(this._host)}return i},e.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=0,r=this.isThumbCircle?"circle":"rectangle",o=this._currentMeasure.left,n=this._currentMeasure.top,s=this._currentMeasure.width,a=this._currentMeasure.height,h=Math.max(this._currentMeasure.width,this._currentMeasure.height),l=Math.min(this._currentMeasure.width,this._currentMeasure.height),u=this._getThumbThickness(r,l);h-=u;var c=0;if(this._isVertical&&this._currentMeasure.height<this._currentMeasure.width)return void console.error("Height should be greater than width");l-=2*(i=this._barOffset.isPixel?Math.min(this._barOffset.getValue(this._host),l):l*this._barOffset.getValue(this._host)),this._isVertical?(o+=i,this.isThumbClamped||(n+=u/2),a=h,s=l):(n+=i,this.isThumbClamped||(o+=u/2),a=l,s=h),this.isThumbClamped&&this.isThumbCircle?(this._isVertical?n+=u/2:o+=u/2,c=l/2):c=(u-i)/2,(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY);var _=this._isVertical?(this._maximum-this._value)/(this._maximum-this._minimum)*h:(this._value-this._minimum)/(this._maximum-this._minimum)*h;e.fillStyle=this._background,this._isVertical?this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(o+l/2,n,c,Math.PI,2*Math.PI),e.fill(),e.fillRect(o,n,s,a)):e.fillRect(o,n,s,a+u):e.fillRect(o,n,s,a):this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(o+h,n+l/2,c,0,2*Math.PI),e.fill(),e.fillRect(o,n,s,a)):e.fillRect(o,n,s+u,a):e.fillRect(o,n,s,a),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.fillStyle=this.color,this._isVertical?this.isThumbClamped?this.isThumbCircle?(e.beginPath(),e.arc(o+l/2,n+h,c,0,2*Math.PI),e.fill(),e.fillRect(o,n+_,s,a-_)):e.fillRect(o,n+_,s,this._currentMeasure.height-_):e.fillRect(o,n+_,s,a-_):this.isThumbClamped&&this.isThumbCircle?(e.beginPath(),e.arc(o,n+l/2,c,0,2*Math.PI),e.fill(),e.fillRect(o,n,_,a)):e.fillRect(o,n,_,a),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._isThumbCircle?(e.beginPath(),this._isVertical?e.arc(o+l/2,n+_,c,0,2*Math.PI):e.arc(o+_,n+l/2,c,0,2*Math.PI),e.fill(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,e.stroke()):(this._isVertical?e.fillRect(o-i,this._currentMeasure.top+_,this._currentMeasure.width,u):e.fillRect(this._currentMeasure.left+_,this._currentMeasure.top,u,this._currentMeasure.height),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),e.strokeStyle=this._borderColor,this._isVertical?e.strokeRect(o-i,this._currentMeasure.top+_,this._currentMeasure.width,u):e.strokeRect(this._currentMeasure.left+_,this._currentMeasure.top,u,this._currentMeasure.height))}e.restore()},e.prototype._updateValueFromPointer=function(t,e){0!=this.rotation&&(this._invertTransformMatrix.transformCoordinates(t,e,this._transformedPosition),t=this._transformedPosition.x,e=this._transformedPosition.y),this._isVertical?this.value=this._minimum+(1-(e-this._currentMeasure.top)/this._currentMeasure.height)*(this._maximum-this._minimum):this.value=this._minimum+(t-this._currentMeasure.left)/this._currentMeasure.width*(this._maximum-this._minimum)},e.prototype._onPointerDown=function(e,i,r,o){return!!t.prototype._onPointerDown.call(this,e,i,r,o)&&(this._pointerIsDown=!0,this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[r]=this,!0)},e.prototype._onPointerMove=function(e,i){this._pointerIsDown&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i)},e.prototype._onPointerUp=function(e,i,r,o,n){this._pointerIsDown=!1,delete this._host._capturingControl[r],t.prototype._onPointerUp.call(this,e,i,r,o,n)},e}(o.Control);e.Slider=a},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0),o=i(2),n=function(){function t(t){this._fontFamily="Arial",this._fontStyle="",this._fontWeight="",this._fontSize=new o.ValueAndUnit(18,o.ValueAndUnit.UNITMODE_PIXEL,!1),this.onChangedObservable=new r.Observable,this._host=t}return Object.defineProperty(t.prototype,"fontSize",{get:function(){return this._fontSize.toString(this._host)},set:function(t){this._fontSize.toString(this._host)!==t&&this._fontSize.fromString(t)&&this.onChangedObservable.notifyObservers(this)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontFamily",{get:function(){return this._fontFamily},set:function(t){this._fontFamily!==t&&(this._fontFamily=t,this.onChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontStyle",{get:function(){return this._fontStyle},set:function(t){this._fontStyle!==t&&(this._fontStyle=t,this.onChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"fontWeight",{get:function(){return this._fontWeight},set:function(t){this._fontWeight!==t&&(this._fontWeight=t,this.onChangedObservable.notifyObservers(this))},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){this.onChangedObservable.clear()},t}();e.Style=n},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(13),n=i(0),s=function(t){function e(e){return t.call(this,e)||this}return r(e,t),e.prototype._getTypeName=function(){return"AbstractButton3D"},e.prototype._createNode=function(t){return new n.TransformNode("button"+this.name)},e}(o.Control3D);e.AbstractButton3D=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i){void 0===i&&(i=0);var r=t.call(this,e.x,e.y,e.z)||this;return r.buttonIndex=i,r}return r(e,t),e}(i(0).Vector3);e.Vector3WithInfo=o},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}(),o=this&&this.__decorate||function(t,e,i,r){var o,n=arguments.length,s=n<3?e:null===r?r=Object.getOwnPropertyDescriptor(e,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(t,e,i,r);else for(var a=t.length-1;a>=0;a--)(o=t[a])&&(s=(n<3?o(s):n>3?o(e,i,s):o(e,i))||s);return n>3&&s&&Object.defineProperty(e,i,s),s};Object.defineProperty(e,"__esModule",{value:!0});var n=i(0);i(44).registerShader();var s=function(t){function e(){var e=t.call(this)||this;return e.INNERGLOW=!1,e.BORDER=!1,e.HOVERLIGHT=!1,e.TEXTURE=!1,e.rebuild(),e}return r(e,t),e}(n.MaterialDefines);e.FluentMaterialDefines=s;var a=function(t){function e(e,i){var r=t.call(this,e,i)||this;return r.innerGlowColorIntensity=.5,r.innerGlowColor=new n.Color3(1,1,1),r.alpha=1,r.albedoColor=new n.Color3(.3,.35,.4),r.renderBorders=!1,r.borderWidth=.5,r.edgeSmoothingValue=.02,r.borderMinValue=.1,r.renderHoverLight=!1,r.hoverRadius=1,r.hoverColor=new n.Color4(.3,.3,.3,1),r.hoverPosition=n.Vector3.Zero(),r}return r(e,t),e.prototype.needAlphaBlending=function(){return 1!==this.alpha},e.prototype.needAlphaTesting=function(){return!1},e.prototype.getAlphaTestTexture=function(){return null},e.prototype.isReadyForSubMesh=function(t,e,i){if(this.isFrozen&&this._wasPreviouslyReady&&e.effect)return!0;e._materialDefines||(e._materialDefines=new s);var r=this.getScene(),o=e._materialDefines;if(!this.checkReadyOnEveryCall&&e.effect&&o._renderId===r.getRenderId())return!0;if(o._areTexturesDirty)if(o.INNERGLOW=this.innerGlowColorIntensity>0,o.BORDER=this.renderBorders,o.HOVERLIGHT=this.renderHoverLight,this._albedoTexture){if(!this._albedoTexture.isReadyOrNotBlocking())return!1;o.TEXTURE=!0}else o.TEXTURE=!1;var a=r.getEngine();if(o.isDirty){o.markAsProcessed(),r.resetCachedMaterial();var h=[n.VertexBuffer.PositionKind];h.push(n.VertexBuffer.NormalKind),h.push(n.VertexBuffer.UVKind);var l=["world","viewProjection","innerGlowColor","albedoColor","borderWidth","edgeSmoothingValue","scaleFactor","borderMinValue","hoverColor","hoverPosition","hoverRadius"],u=["albedoSampler"],c=new Array;n.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:l,uniformBuffersNames:c,samplers:u,defines:o,maxSimultaneousLights:4});var _=o.toString();e.setEffect(r.getEngine().createEffect("fluent",{attributes:h,uniformsNames:l,uniformBuffersNames:c,samplers:u,defines:_,fallbacks:null,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:4}},a))}return!(!e.effect||!e.effect.isReady())&&(o._renderId=r.getRenderId(),this._wasPreviouslyReady=!0,!0)},e.prototype.bindForSubMesh=function(t,e,i){var r=this.getScene(),o=i._materialDefines;if(o){var s=i.effect;s&&(this._activeEffect=s,this.bindOnlyWorldMatrix(t),this._activeEffect.setMatrix("viewProjection",r.getTransformMatrix()),this._mustRebind(r,s)&&(this._activeEffect.setColor4("albedoColor",this.albedoColor,this.alpha),o.INNERGLOW&&this._activeEffect.setColor4("innerGlowColor",this.innerGlowColor,this.innerGlowColorIntensity),o.BORDER&&(this._activeEffect.setFloat("borderWidth",this.borderWidth),this._activeEffect.setFloat("edgeSmoothingValue",this.edgeSmoothingValue),this._activeEffect.setFloat("borderMinValue",this.borderMinValue),e.getBoundingInfo().boundingBox.extendSize.multiplyToRef(e.scaling,n.Tmp.Vector3[0]),this._activeEffect.setVector3("scaleFactor",n.Tmp.Vector3[0])),o.HOVERLIGHT&&(this._activeEffect.setDirectColor4("hoverColor",this.hoverColor),this._activeEffect.setFloat("hoverRadius",this.hoverRadius),this._activeEffect.setVector3("hoverPosition",this.hoverPosition)),o.TEXTURE&&this._activeEffect.setTexture("albedoSampler",this._albedoTexture)),this._afterBind(e,this._activeEffect))}},e.prototype.getActiveTextures=function(){return t.prototype.getActiveTextures.call(this)},e.prototype.hasTexture=function(e){return!!t.prototype.hasTexture.call(this,e)},e.prototype.dispose=function(e){t.prototype.dispose.call(this,e)},e.prototype.clone=function(t){var i=this;return n.SerializationHelper.Clone(function(){return new e(t,i.getScene())},this)},e.prototype.serialize=function(){var t=n.SerializationHelper.Serialize(this);return t.customType="BABYLON.GUI.FluentMaterial",t},e.prototype.getClassName=function(){return"FluentMaterial"},e.Parse=function(t,i,r){return n.SerializationHelper.Parse(function(){return new e(t.name,i)},t,i,r)},o([n.serialize(),n.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"innerGlowColorIntensity",void 0),o([n.serializeAsColor3()],e.prototype,"innerGlowColor",void 0),o([n.serialize()],e.prototype,"alpha",void 0),o([n.serializeAsColor3()],e.prototype,"albedoColor",void 0),o([n.serialize(),n.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderBorders",void 0),o([n.serialize()],e.prototype,"borderWidth",void 0),o([n.serialize()],e.prototype,"edgeSmoothingValue",void 0),o([n.serialize()],e.prototype,"borderMinValue",void 0),o([n.serialize(),n.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"renderHoverLight",void 0),o([n.serialize()],e.prototype,"hoverRadius",void 0),o([n.serializeAsColor4()],e.prototype,"hoverColor",void 0),o([n.serializeAsVector3()],e.prototype,"hoverPosition",void 0),o([n.serializeAsTexture("albedoTexture")],e.prototype,"_albedoTexture",void 0),o([n.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],e.prototype,"albedoTexture",void 0),e}(n.PushMaterial);e.FluentMaterial=a},function(t,e,i){"use strict";(function(t){Object.defineProperty(e,"__esModule",{value:!0});var r=i(15),o=void 0!==t?t:"undefined"!=typeof window?window:void 0;void 0!==o&&(o.BABYLON=o.BABYLON||{},o.BABYLON.GUI=r),function(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}(i(15))}).call(this,i(28))},function(t,e){var i;i=function(){return this}();try{i=i||Function("return this")()||(0,eval)("this")}catch(t){"object"==typeof window&&(i=window)}t.exports=i},function(t,e,i){"use strict";function r(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),r(i(9)),r(i(12)),r(i(17)),r(i(7)),r(i(20)),r(i(23)),r(i(2))},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(0),s=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._value=n.Color3.Red(),i._tmpColor=new n.Color3,i._pointerStartedOnSquare=!1,i._pointerStartedOnWheel=!1,i._squareLeft=0,i._squareTop=0,i._squareSize=0,i._h=360,i._s=1,i._v=1,i.onValueChangedObservable=new n.Observable,i._pointerIsDown=!1,i.value=new n.Color3(.88,.1,.1),i.size="200px",i.isPointerBlocker=!0,i}return r(e,t),Object.defineProperty(e.prototype,"value",{get:function(){return this._value},set:function(t){this._value.equals(t)||(this._value.copyFrom(t),this._RGBtoHSV(this._value,this._tmpColor),this._h=this._tmpColor.r,this._s=Math.max(this._tmpColor.g,1e-5),this._v=Math.max(this._tmpColor.b,1e-5),this._markAsDirty(),this.onValueChangedObservable.notifyObservers(this._value))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"width",{set:function(t){this._width.toString(this._host)!==t&&this._width.fromString(t)&&(this._height.fromString(t),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"height",{set:function(t){this._height.toString(this._host)!==t&&this._height.fromString(t)&&(this._width.fromString(t),this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(t){this.width=t},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"ColorPicker"},e.prototype._updateSquareProps=function(){var t=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),e=2*(t-.2*t)/Math.sqrt(2),i=t-.5*e;this._squareLeft=this._currentMeasure.left+i,this._squareTop=this._currentMeasure.top+i,this._squareSize=e},e.prototype._drawGradientSquare=function(t,e,i,r,o,n){var s=n.createLinearGradient(e,i,r+e,i);s.addColorStop(0,"#fff"),s.addColorStop(1,"hsl("+t+", 100%, 50%)"),n.fillStyle=s,n.fillRect(e,i,r,o);var a=n.createLinearGradient(e,i,e,o+i);a.addColorStop(0,"rgba(0,0,0,0)"),a.addColorStop(1,"#000"),n.fillStyle=a,n.fillRect(e,i,r,o)},e.prototype._drawCircle=function(t,e,i,r){r.beginPath(),r.arc(t,e,i+1,0,2*Math.PI,!1),r.lineWidth=3,r.strokeStyle="#333333",r.stroke(),r.beginPath(),r.arc(t,e,i,0,2*Math.PI,!1),r.lineWidth=3,r.strokeStyle="#ffffff",r.stroke()},e.prototype._createColorWheelCanvas=function(t,e){var i=document.createElement("canvas");i.width=2*t,i.height=2*t;for(var r=i.getContext("2d"),o=r.getImageData(0,0,2*t,2*t),n=o.data,s=this._tmpColor,a=t*t,h=t-e,l=h*h,u=-t;u<t;u++)for(var c=-t;c<t;c++){var _=u*u+c*c;if(!(_>a||_<l)){var f=Math.sqrt(_),p=Math.atan2(c,u);this._HSVtoRGB(180*p/Math.PI+180,f/t,1,s);var d=4*(u+t+2*(c+t)*t);n[d]=255*s.r,n[d+1]=255*s.g,n[d+2]=255*s.b;var y=.2;y=t<50?.2:t>150?.04:-.16*(t-50)/100+.2;var g=(f-h)/(t-h);n[d+3]=g<y?g/y*255:g>1-y?255*(1-(g-(1-y))/y):255}}return r.putImageData(o,0,0),i},e.prototype._RGBtoHSV=function(t,e){var i=t.r,r=t.g,o=t.b,n=Math.max(i,r,o),s=Math.min(i,r,o),a=0,h=0,l=n,u=n-s;0!==n&&(h=u/n),n!=s&&(n==i?(a=(r-o)/u,r<o&&(a+=6)):n==r?a=(o-i)/u+2:n==o&&(a=(i-r)/u+4),a*=60),e.r=a,e.g=h,e.b=l},e.prototype._HSVtoRGB=function(t,e,i,r){var o=i*e,n=t/60,s=o*(1-Math.abs(n%2-1)),a=0,h=0,l=0;n>=0&&n<=1?(a=o,h=s):n>=1&&n<=2?(a=s,h=o):n>=2&&n<=3?(h=o,l=s):n>=3&&n<=4?(h=s,l=o):n>=4&&n<=5?(a=s,l=o):n>=5&&n<=6&&(a=o,l=s);var u=i-o;r.set(a+u,h+u,l+u)},e.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._processMeasures(t,e)){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=.2*i,o=this._currentMeasure.left,n=this._currentMeasure.top;this._colorWheelCanvas&&this._colorWheelCanvas.width==2*i||(this._colorWheelCanvas=this._createColorWheelCanvas(i,r)),this._updateSquareProps(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY,e.fillRect(this._squareLeft,this._squareTop,this._squareSize,this._squareSize)),e.drawImage(this._colorWheelCanvas,o,n),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowBlur=0,e.shadowOffsetX=0,e.shadowOffsetY=0),this._drawGradientSquare(this._h,this._squareLeft,this._squareTop,this._squareSize,this._squareSize,e);var s=this._squareLeft+this._squareSize*this._s,a=this._squareTop+this._squareSize*(1-this._v);this._drawCircle(s,a,.04*i,e);var h=i-.5*r;s=o+i+Math.cos((this._h-180)*Math.PI/180)*h,a=n+i+Math.sin((this._h-180)*Math.PI/180)*h,this._drawCircle(s,a,.35*r,e)}e.restore()},e.prototype._updateValueFromPointer=function(t,e){if(this._pointerStartedOnWheel){var i=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),r=i+this._currentMeasure.left,o=i+this._currentMeasure.top;this._h=180*Math.atan2(e-o,t-r)/Math.PI+180}else this._pointerStartedOnSquare&&(this._updateSquareProps(),this._s=(t-this._squareLeft)/this._squareSize,this._v=1-(e-this._squareTop)/this._squareSize,this._s=Math.min(this._s,1),this._s=Math.max(this._s,1e-5),this._v=Math.min(this._v,1),this._v=Math.max(this._v,1e-5));this._HSVtoRGB(this._h,this._s,this._v,this._tmpColor),this.value=this._tmpColor},e.prototype._isPointOnSquare=function(t){this._updateSquareProps();var e=this._squareLeft,i=this._squareTop,r=this._squareSize;return t.x>=e&&t.x<=e+r&&t.y>=i&&t.y<=i+r},e.prototype._isPointOnWheel=function(t){var e=.5*Math.min(this._currentMeasure.width,this._currentMeasure.height),i=e+this._currentMeasure.left,r=e+this._currentMeasure.top,o=e-.2*e,n=e*e,s=o*o,a=t.x-i,h=t.y-r,l=a*a+h*h;return l<=n&&l>=s},e.prototype._onPointerDown=function(e,i,r,o){return!!t.prototype._onPointerDown.call(this,e,i,r,o)&&(this._pointerIsDown=!0,this._pointerStartedOnSquare=!1,this._pointerStartedOnWheel=!1,this._isPointOnSquare(i)?this._pointerStartedOnSquare=!0:this._isPointOnWheel(i)&&(this._pointerStartedOnWheel=!0),this._updateValueFromPointer(i.x,i.y),this._host._capturingControl[r]=this,!0)},e.prototype._onPointerMove=function(e,i){this._pointerIsDown&&this._updateValueFromPointer(i.x,i.y),t.prototype._onPointerMove.call(this,e,i)},e.prototype._onPointerUp=function(e,i,r,o,n){this._pointerIsDown=!1,delete this._host._capturingControl[r],t.prototype._onPointerUp.call(this,e,i,r,o,n)},e}(o.Control);e.ColorPicker=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(4),n=i(1),s=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._thickness=1,i}return r(e,t),Object.defineProperty(e.prototype,"thickness",{get:function(){return this._thickness},set:function(t){this._thickness!==t&&(this._thickness=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Ellipse"},e.prototype._localDraw=function(t){t.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowColor=this.shadowColor,t.shadowBlur=this.shadowBlur,t.shadowOffsetX=this.shadowOffsetX,t.shadowOffsetY=this.shadowOffsetY),n.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2-this._thickness/2,this._currentMeasure.height/2-this._thickness/2,t),this._background&&(t.fillStyle=this._background,t.fill()),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(t.shadowBlur=0,t.shadowOffsetX=0,t.shadowOffsetY=0),this._thickness&&(this.color&&(t.strokeStyle=this.color),t.lineWidth=this._thickness,t.stroke()),t.restore()},e.prototype._additionalProcessing=function(e,i){t.prototype._additionalProcessing.call(this,e,i),this._measureForChildren.width-=2*this._thickness,this._measureForChildren.height-=2*this._thickness,this._measureForChildren.left+=this._thickness,this._measureForChildren.top+=this._thickness},e.prototype._clipForChildren=function(t){n.Control.drawEllipse(this._currentMeasure.left+this._currentMeasure.width/2,this._currentMeasure.top+this._currentMeasure.height/2,this._currentMeasure.width/2,this._currentMeasure.height/2,t),t.clip()},e}(o.Container);e.Ellipse=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(4),n=i(2),s=i(1),a=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._rowDefinitions=new Array,i._columnDefinitions=new Array,i._cells={},i._childControls=new Array,i}return r(e,t),Object.defineProperty(e.prototype,"children",{get:function(){return this._childControls},enumerable:!0,configurable:!0}),e.prototype.addRowDefinition=function(t,e){return void 0===e&&(e=!1),this._rowDefinitions.push(new n.ValueAndUnit(t,e?n.ValueAndUnit.UNITMODE_PIXEL:n.ValueAndUnit.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},e.prototype.addColumnDefinition=function(t,e){return void 0===e&&(e=!1),this._columnDefinitions.push(new n.ValueAndUnit(t,e?n.ValueAndUnit.UNITMODE_PIXEL:n.ValueAndUnit.UNITMODE_PERCENTAGE)),this._markAsDirty(),this},e.prototype.setRowDefinition=function(t,e,i){return void 0===i&&(i=!1),t<0||t>=this._rowDefinitions.length?this:(this._rowDefinitions[t]=new n.ValueAndUnit(e,i?n.ValueAndUnit.UNITMODE_PIXEL:n.ValueAndUnit.UNITMODE_PERCENTAGE),this._markAsDirty(),this)},e.prototype.setColumnDefinition=function(t,e,i){return void 0===i&&(i=!1),t<0||t>=this._columnDefinitions.length?this:(this._columnDefinitions[t]=new n.ValueAndUnit(e,i?n.ValueAndUnit.UNITMODE_PIXEL:n.ValueAndUnit.UNITMODE_PERCENTAGE),this._markAsDirty(),this)},e.prototype._removeCell=function(e,i){if(e){t.prototype.removeControl.call(this,e);for(var r=0,o=e.children;r<o.length;r++){var n=o[r],s=this._childControls.indexOf(n);-1!==s&&this._childControls.splice(s,1)}delete this._cells[i]}},e.prototype._offsetCell=function(t,e){if(this._cells[e]){this._cells[t]=this._cells[e];for(var i=0,r=this._cells[t].children;i<r.length;i++){r[i]._tag=t}delete this._cells[e]}},e.prototype.removeColumnDefinition=function(t){if(t<0||t>=this._columnDefinitions.length)return this;for(var e=0;e<this._rowDefinitions.length;e++){var i=e+":"+t,r=this._cells[i];this._removeCell(r,i)}for(e=0;e<this._rowDefinitions.length;e++)for(var o=t+1;o<this._columnDefinitions.length;o++){var n=e+":"+(o-1);i=e+":"+o;this._offsetCell(n,i)}return this._columnDefinitions.splice(t,1),this._markAsDirty(),this},e.prototype.removeRowDefinition=function(t){if(t<0||t>=this._rowDefinitions.length)return this;for(var e=0;e<this._columnDefinitions.length;e++){var i=t+":"+e,r=this._cells[i];this._removeCell(r,i)}for(e=0;e<this._columnDefinitions.length;e++)for(var o=t+1;o<this._rowDefinitions.length;o++){var n=o-1+":"+e;i=o+":"+e;this._offsetCell(n,i)}return this._rowDefinitions.splice(t,1),this._markAsDirty(),this},e.prototype.addControl=function(e,i,r){void 0===i&&(i=0),void 0===r&&(r=0),0===this._rowDefinitions.length&&this.addRowDefinition(1,!1),0===this._columnDefinitions.length&&this.addColumnDefinition(1,!1);var n=Math.min(i,this._rowDefinitions.length-1)+":"+Math.min(r,this._columnDefinitions.length-1),a=this._cells[n];return a||(a=new o.Container(n),this._cells[n]=a,a.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,a.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_TOP,t.prototype.addControl.call(this,a)),a.addControl(e),this._childControls.push(e),e._tag=n,this._markAsDirty(),this},e.prototype.removeControl=function(t){var e=this._childControls.indexOf(t);-1!==e&&this._childControls.splice(e,1);var i=this._cells[t._tag];return i&&i.removeControl(t),this._markAsDirty(),this},e.prototype._getTypeName=function(){return"Grid"},e.prototype._additionalProcessing=function(e,i){for(var r=[],o=[],n=[],s=[],a=this._currentMeasure.width,h=0,l=this._currentMeasure.height,u=0,c=0,_=0,f=this._rowDefinitions;_<f.length;_++){if((b=f[_]).isPixel)l-=g=b.getValue(this._host),o[c]=g;else u+=b.internalValue;c++}var p=0;c=0;for(var d=0,y=this._rowDefinitions;d<y.length;d++){var g,b=y[d];if(s.push(p),b.isPixel)p+=b.getValue(this._host);else p+=g=b.internalValue/u*l,o[c]=g;c++}c=0;for(var m=0,v=this._columnDefinitions;m<v.length;m++){if((b=v[m]).isPixel)a-=w=b.getValue(this._host),r[c]=w;else h+=b.internalValue;c++}var O=0;c=0;for(var P=0,C=this._columnDefinitions;P<C.length;P++){var w;b=C[P];if(n.push(O),b.isPixel)O+=b.getValue(this._host);else O+=w=b.internalValue/h*a,r[c]=w;c++}for(var T in this._cells)if(this._cells.hasOwnProperty(T)){var M=T.split(":"),x=parseInt(M[0]),A=parseInt(M[1]),k=this._cells[T];k.left=n[A]+"px",k.top=s[x]+"px",k.width=r[A]+"px",k.height=o[x]+"px"}t.prototype._additionalProcessing.call(this,e,i)},e.prototype.dispose=function(){t.prototype.dispose.call(this);for(var e=0,i=this._childControls;e<i.length;e++){i[e].dispose()}},e}(o.Container);e.Grid=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype._beforeRenderText=function(t){for(var e="",i=0;i<t.length;i++)e+="•";return e},e}(i(19).InputText);e.InputPassword=o},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(2),s=i(0),a=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i._x1=new n.ValueAndUnit(0),i._y1=new n.ValueAndUnit(0),i._x2=new n.ValueAndUnit(0),i._y2=new n.ValueAndUnit(0),i._dash=new Array,i.isHitTestVisible=!1,i._horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=o.Control.VERTICAL_ALIGNMENT_TOP,i}return r(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"connectedControl",{get:function(){return this._connectedControl},set:function(t){var e=this;this._connectedControl!==t&&(this._connectedControlDirtyObserver&&this._connectedControl&&(this._connectedControl.onDirtyObservable.remove(this._connectedControlDirtyObserver),this._connectedControlDirtyObserver=null),t&&(this._connectedControlDirtyObserver=t.onDirtyObservable.add(function(){return e._markAsDirty()})),this._connectedControl=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x1",{get:function(){return this._x1.toString(this._host)},set:function(t){this._x1.toString(this._host)!==t&&this._x1.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y1",{get:function(){return this._y1.toString(this._host)},set:function(t){this._y1.toString(this._host)!==t&&this._y1.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"x2",{get:function(){return this._x2.toString(this._host)},set:function(t){this._x2.toString(this._host)!==t&&this._x2.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"y2",{get:function(){return this._y2.toString(this._host)},set:function(t){this._y2.toString(this._host)!==t&&this._y2.fromString(t)&&this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveX2",{get:function(){return(this._connectedControl?this._connectedControl.centerX:0)+this._x2.getValue(this._host)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_effectiveY2",{get:function(){return(this._connectedControl?this._connectedControl.centerY:0)+this._y2.getValue(this._host)},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"Line"},e.prototype._draw=function(t,e){e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),this._processMeasures(t,e)&&(e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath(),e.moveTo(this._x1.getValue(this._host),this._y1.getValue(this._host)),e.lineTo(this._effectiveX2,this._effectiveY2),e.stroke()),e.restore()},e.prototype._measure=function(){this._currentMeasure.width=Math.abs(this._x1.getValue(this._host)-this._effectiveX2)+this._lineWidth,this._currentMeasure.height=Math.abs(this._y1.getValue(this._host)-this._effectiveY2)+this._lineWidth},e.prototype._computeAlignment=function(t,e){this._currentMeasure.left=Math.min(this._x1.getValue(this._host),this._effectiveX2)-this._lineWidth/2,this._currentMeasure.top=Math.min(this._y1.getValue(this._host),this._effectiveY2)-this._lineWidth/2},e.prototype.moveToVector3=function(t,e,i){if(void 0===i&&(i=!1),this._host&&this._root===this._host._rootContainer){var r=this._host._getGlobalViewport(e),o=s.Vector3.Project(t,s.Matrix.Identity(),e.getTransformMatrix(),r);this._moveToProjectedPosition(o,i),o.z<0||o.z>1?this.notRenderable=!0:this.notRenderable=!1}else s.Tools.Error("Cannot move a control to a vector3 if the control is not at root level")},e.prototype._moveToProjectedPosition=function(t,e){void 0===e&&(e=!1);var i=t.x+this._linkOffsetX.getValue(this._host)+"px",r=t.y+this._linkOffsetY.getValue(this._host)+"px";e?(this.x2=i,this.y2=r,this._x2.ignoreAdaptiveScaling=!0,this._y2.ignoreAdaptiveScaling=!0):(this.x1=i,this.y1=r,this._x1.ignoreAdaptiveScaling=!0,this._y1.ignoreAdaptiveScaling=!0)},e}(o.Control);e.Line=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(1),n=i(20),s=i(0),a=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._lineWidth=1,i.onPointUpdate=function(){i._markAsDirty()},i.isHitTestVisible=!1,i._horizontalAlignment=o.Control.HORIZONTAL_ALIGNMENT_LEFT,i._verticalAlignment=o.Control.VERTICAL_ALIGNMENT_TOP,i._dash=[],i._points=[],i}return r(e,t),Object.defineProperty(e.prototype,"dash",{get:function(){return this._dash},set:function(t){this._dash!==t&&(this._dash=t,this._markAsDirty())},enumerable:!0,configurable:!0}),e.prototype.getAt=function(t){return this._points[t]||(this._points[t]=new n.MultiLinePoint(this)),this._points[t]},e.prototype.add=function(){for(var t=this,e=[],i=0;i<arguments.length;i++)e[i]=arguments[i];return e.map(function(e){return t.push(e)})},e.prototype.push=function(t){var e=this.getAt(this._points.length);return null==t?e:(t instanceof s.AbstractMesh?e.mesh=t:t instanceof o.Control?e.control=t:null!=t.x&&null!=t.y&&(e.x=t.x,e.y=t.y),e)},e.prototype.remove=function(t){var e;if(t instanceof n.MultiLinePoint){if(-1===(e=this._points.indexOf(t)))return}else e=t;var i=this._points[e];i&&(i.dispose(),this._points.splice(e,1))},e.prototype.reset=function(){for(;this._points.length>0;)this.remove(this._points.length-1)},e.prototype.resetLinks=function(){this._points.forEach(function(t){null!=t&&t.resetLinks()})},Object.defineProperty(e.prototype,"lineWidth",{get:function(){return this._lineWidth},set:function(t){this._lineWidth!==t&&(this._lineWidth=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"horizontalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"verticalAlignment",{set:function(t){},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"MultiLine"},e.prototype._draw=function(t,e){if(e.save(),(this.shadowBlur||this.shadowOffsetX||this.shadowOffsetY)&&(e.shadowColor=this.shadowColor,e.shadowBlur=this.shadowBlur,e.shadowOffsetX=this.shadowOffsetX,e.shadowOffsetY=this.shadowOffsetY),this._applyStates(e),this._processMeasures(t,e)){e.strokeStyle=this.color,e.lineWidth=this._lineWidth,e.setLineDash(this._dash),e.beginPath();var i=!0;this._points.forEach(function(t){t&&(i?(e.moveTo(t._point.x,t._point.y),i=!1):e.lineTo(t._point.x,t._point.y))}),e.stroke()}e.restore()},e.prototype._additionalProcessing=function(t,e){var i=this;this._minX=null,this._minY=null,this._maxX=null,this._maxY=null,this._points.forEach(function(t,e){t&&(t.translate(),(null==i._minX||t._point.x<i._minX)&&(i._minX=t._point.x),(null==i._minY||t._point.y<i._minY)&&(i._minY=t._point.y),(null==i._maxX||t._point.x>i._maxX)&&(i._maxX=t._point.x),(null==i._maxY||t._point.y>i._maxY)&&(i._maxY=t._point.y))}),null==this._minX&&(this._minX=0),null==this._minY&&(this._minY=0),null==this._maxX&&(this._maxX=0),null==this._maxY&&(this._maxY=0)},e.prototype._measure=function(){null!=this._minX&&null!=this._maxX&&null!=this._minY&&null!=this._maxY&&(this._currentMeasure.width=Math.abs(this._maxX-this._minX)+this._lineWidth,this._currentMeasure.height=Math.abs(this._maxY-this._minY)+this._lineWidth)},e.prototype._computeAlignment=function(t,e){null!=this._minX&&null!=this._minY&&(this._currentMeasure.left=this._minX-this._lineWidth/2,this._currentMeasure.top=this._minY-this._lineWidth/2)},e.prototype.dispose=function(){this.reset(),t.prototype.dispose.call(this)},e}(o.Control);e.MultiLine=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(10),n=i(6),s=i(1),a=i(5),h=i(18),l=i(21),u=i(22),c=i(4),_=function(){function t(t){this.name=t,this._groupPanel=new n.StackPanel,this._selectors=new Array,this._groupPanel.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_TOP,this._groupPanel.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,this._groupHeader=this._addGroupHeader(t)}return Object.defineProperty(t.prototype,"groupPanel",{get:function(){return this._groupPanel},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"selectors",{get:function(){return this._selectors},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"header",{get:function(){return this._groupHeader.text},set:function(t){"label"!==this._groupHeader.text&&(this._groupHeader.text=t)},enumerable:!0,configurable:!0}),t.prototype._addGroupHeader=function(t){var e=new a.TextBlock("groupHead",t);return e.width=.9,e.height="30px",e.textWrapping=!0,e.color="black",e.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,e.textHorizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,e.left="2px",this._groupPanel.addControl(e),e},t.prototype._getSelector=function(t){if(!(t<0||t>=this._selectors.length))return this._selectors[t]},t.prototype.removeSelector=function(t){t<0||t>=this._selectors.length||(this._groupPanel.removeControl(this._selectors[t]),this._selectors.splice(t,1))},t}();e.SelectorGroup=_;var f=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addCheckbox=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);i=i||!1;var r=new h.Checkbox;r.width="20px",r.height="20px",r.color="#364249",r.background="#CCCCCC",r.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,r.onIsCheckedChangedObservable.add(function(t){e(t)});var o=s.Control.AddHeader(r,t,"200px",{isHorizontal:!0,controlFirst:!0});o.height="30px",o.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,o.left="4px",this.groupPanel.addControl(o),this.selectors.push(o),r.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(r.color=this.groupPanel.parent.parent.buttonColor,r.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(_);e.CheckboxGroup=f;var p=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._selectNb=0,e}return r(e,t),e.prototype.addRadio=function(t,e,i){void 0===e&&(e=function(t){}),void 0===i&&(i=!1);var r=this._selectNb++,o=new l.RadioButton;o.name=t,o.width="20px",o.height="20px",o.color="#364249",o.background="#CCCCCC",o.group=this.name,o.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,o.onIsCheckedChangedObservable.add(function(t){t&&e(r)});var n=s.Control.AddHeader(o,t,"200px",{isHorizontal:!0,controlFirst:!0});n.height="30px",n.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,n.left="4px",this.groupPanel.addControl(n),this.selectors.push(n),o.isChecked=i,this.groupPanel.parent&&this.groupPanel.parent.parent&&(o.color=this.groupPanel.parent.parent.buttonColor,o.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[1].text=e},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[0].background=e},e}(_);e.RadioGroup=p;var d=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype.addSlider=function(t,e,i,r,o,n,a){void 0===e&&(e=function(t){}),void 0===i&&(i="Units"),void 0===r&&(r=0),void 0===o&&(o=0),void 0===n&&(n=0),void 0===a&&(a=function(t){return 0|t});var h=new u.Slider;h.name=i,h.value=n,h.minimum=r,h.maximum=o,h.width=.9,h.height="20px",h.color="#364249",h.background="#CCCCCC",h.borderColor="black",h.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,h.left="4px",h.paddingBottom="4px",h.onValueChangedObservable.add(function(t){h.parent.children[0].text=h.parent.children[0].name+": "+a(t)+" "+h.name,e(t)});var l=s.Control.AddHeader(h,t+": "+a(n)+" "+i,"30px",{isHorizontal:!1,controlFirst:!1});l.height="60px",l.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,l.left="4px",l.children[0].name=t,this.groupPanel.addControl(l),this.selectors.push(l),this.groupPanel.parent&&this.groupPanel.parent.parent&&(h.color=this.groupPanel.parent.parent.buttonColor,h.background=this.groupPanel.parent.parent.buttonBackground)},e.prototype._setSelectorLabel=function(t,e){this.selectors[t].children[0].name=e,this.selectors[t].children[0].text=e+": "+this.selectors[t].children[1].value+" "+this.selectors[t].children[1].name},e.prototype._setSelectorLabelColor=function(t,e){this.selectors[t].children[0].color=e},e.prototype._setSelectorButtonColor=function(t,e){this.selectors[t].children[1].color=e},e.prototype._setSelectorButtonBackground=function(t,e){this.selectors[t].children[1].background=e},e}(_);e.SliderGroup=d;var y=function(t){function e(e,i){void 0===i&&(i=[]);var r=t.call(this,e)||this;if(r.name=e,r.groups=i,r._buttonColor="#364249",r._buttonBackground="#CCCCCC",r._headerColor="black",r._barColor="white",r._barHeight="2px",r._spacerHeight="20px",r._bars=new Array,r._groups=i,r.thickness=2,r._panel=new n.StackPanel,r._panel.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_TOP,r._panel.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,r._panel.top=5,r._panel.left=5,r._panel.width=.95,i.length>0){for(var o=0;o<i.length-1;o++)r._panel.addControl(i[o].groupPanel),r._addSpacer();r._panel.addControl(i[i.length-1].groupPanel)}return r.addControl(r._panel),r}return r(e,t),e.prototype._getTypeName=function(){return"SelectionPanel"},Object.defineProperty(e.prototype,"headerColor",{get:function(){return this._headerColor},set:function(t){this._headerColor!==t&&(this._headerColor=t,this._setHeaderColor())},enumerable:!0,configurable:!0}),e.prototype._setHeaderColor=function(){for(var t=0;t<this._groups.length;t++)this._groups[t].groupPanel.children[0].color=this._headerColor},Object.defineProperty(e.prototype,"buttonColor",{get:function(){return this._buttonColor},set:function(t){this._buttonColor!==t&&(this._buttonColor=t,this._setbuttonColor())},enumerable:!0,configurable:!0}),e.prototype._setbuttonColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonColor(e,this._buttonColor)},Object.defineProperty(e.prototype,"labelColor",{get:function(){return this._labelColor},set:function(t){this._labelColor!==t&&(this._labelColor=t,this._setLabelColor())},enumerable:!0,configurable:!0}),e.prototype._setLabelColor=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorLabelColor(e,this._labelColor)},Object.defineProperty(e.prototype,"buttonBackground",{get:function(){return this._buttonBackground},set:function(t){this._buttonBackground!==t&&(this._buttonBackground=t,this._setButtonBackground())},enumerable:!0,configurable:!0}),e.prototype._setButtonBackground=function(){for(var t=0;t<this._groups.length;t++)for(var e=0;e<this._groups[t].selectors.length;e++)this._groups[t]._setSelectorButtonBackground(e,this._buttonBackground)},Object.defineProperty(e.prototype,"barColor",{get:function(){return this._barColor},set:function(t){this._barColor!==t&&(this._barColor=t,this._setBarColor())},enumerable:!0,configurable:!0}),e.prototype._setBarColor=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].background=this._barColor},Object.defineProperty(e.prototype,"barHeight",{get:function(){return this._barHeight},set:function(t){this._barHeight!==t&&(this._barHeight=t,this._setBarHeight())},enumerable:!0,configurable:!0}),e.prototype._setBarHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].children[0].height=this._barHeight},Object.defineProperty(e.prototype,"spacerHeight",{get:function(){return this._spacerHeight},set:function(t){this._spacerHeight!==t&&(this._spacerHeight=t,this._setSpacerHeight())},enumerable:!0,configurable:!0}),e.prototype._setSpacerHeight=function(){for(var t=0;t<this._bars.length;t++)this._bars[t].height=this._spacerHeight},e.prototype._addSpacer=function(){var t=new c.Container;t.width=1,t.height=this._spacerHeight,t.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT;var e=new o.Rectangle;e.width=1,e.height=this._barHeight,e.horizontalAlignment=s.Control.HORIZONTAL_ALIGNMENT_LEFT,e.verticalAlignment=s.Control.VERTICAL_ALIGNMENT_CENTER,e.background=this._barColor,e.color="transparent",t.addControl(e),this._panel.addControl(t),this._bars.push(t)},e.prototype.addGroup=function(t){this._groups.length>0&&this._addSpacer(),this._panel.addControl(t.groupPanel),this._groups.push(t),t.groupPanel.children[0].color=this._headerColor;for(var e=0;e<t.selectors.length;e++)t._setSelectorButtonColor(e,this._buttonColor),t._setSelectorButtonBackground(e,this._buttonBackground)},e.prototype.removeGroup=function(t){if(!(t<0||t>=this._groups.length)){var e=this._groups[t];this._panel.removeControl(e.groupPanel),this._groups.splice(t,1),t<this._bars.length&&(this._panel.removeControl(this._bars[t]),this._bars.splice(t,1))}},e.prototype.setHeaderName=function(t,e){e<0||e>=this._groups.length||(this._groups[e].groupPanel.children[0].text=t)},e.prototype.relabel=function(t,e,i){if(!(e<0||e>=this._groups.length)){var r=this._groups[e];i<0||i>=r.selectors.length||r._setSelectorLabel(i,t)}},e.prototype.removeFromGroupSelector=function(t,e){if(!(t<0||t>=this._groups.length)){var i=this._groups[t];e<0||e>=i.selectors.length||i.removeSelector(e)}},e.prototype.addToGroupCheckbox=function(t,e,i,r){(void 0===i&&(i=function(){}),void 0===r&&(r=!1),t<0||t>=this._groups.length)||this._groups[t].addCheckbox(e,i,r)},e.prototype.addToGroupRadio=function(t,e,i,r){(void 0===i&&(i=function(){}),void 0===r&&(r=!1),t<0||t>=this._groups.length)||this._groups[t].addRadio(e,i,r)},e.prototype.addToGroupSlider=function(t,e,i,r,o,n,s,a){(void 0===i&&(i=function(){}),void 0===r&&(r="Units"),void 0===o&&(o=0),void 0===n&&(n=0),void 0===s&&(s=0),void 0===a&&(a=function(t){return 0|t}),t<0||t>=this._groups.length)||this._groups[t].addSlider(e,i,r,o,n,s,a)},e}(o.Rectangle);e.SelectionPanel=y},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(6),n=i(0),s=i(16),a=function(){return function(){}}();e.KeyPropertySet=a;var h=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e.onKeyPressObservable=new n.Observable,e.defaultButtonWidth="40px",e.defaultButtonHeight="40px",e.defaultButtonPaddingLeft="2px",e.defaultButtonPaddingRight="2px",e.defaultButtonPaddingTop="2px",e.defaultButtonPaddingBottom="2px",e.defaultButtonColor="#DDD",e.defaultButtonBackground="#070707",e.shiftButtonColor="#7799FF",e.selectedShiftThickness=1,e.shiftState=0,e._currentlyConnectedInputText=null,e._connectedInputTexts=[],e._onKeyPressObserver=null,e}return r(e,t),e.prototype._getTypeName=function(){return"VirtualKeyboard"},e.prototype._createKey=function(t,e){var i=this,r=s.Button.CreateSimpleButton(t,t);return r.width=e&&e.width?e.width:this.defaultButtonWidth,r.height=e&&e.height?e.height:this.defaultButtonHeight,r.color=e&&e.color?e.color:this.defaultButtonColor,r.background=e&&e.background?e.background:this.defaultButtonBackground,r.paddingLeft=e&&e.paddingLeft?e.paddingLeft:this.defaultButtonPaddingLeft,r.paddingRight=e&&e.paddingRight?e.paddingRight:this.defaultButtonPaddingRight,r.paddingTop=e&&e.paddingTop?e.paddingTop:this.defaultButtonPaddingTop,r.paddingBottom=e&&e.paddingBottom?e.paddingBottom:this.defaultButtonPaddingBottom,r.thickness=0,r.isFocusInvisible=!0,r.shadowColor=this.shadowColor,r.shadowBlur=this.shadowBlur,r.shadowOffsetX=this.shadowOffsetX,r.shadowOffsetY=this.shadowOffsetY,r.onPointerUpObservable.add(function(){i.onKeyPressObservable.notifyObservers(t)}),r},e.prototype.addKeysRow=function(t,e){var i=new o.StackPanel;i.isVertical=!1,i.isFocusInvisible=!0;for(var r=0;r<t.length;r++){var n=null;e&&e.length===t.length&&(n=e[r]),i.addControl(this._createKey(t[r],n))}this.addControl(i)},e.prototype.applyShiftState=function(t){if(this.children)for(var e=0;e<this.children.length;e++){var i=this.children[e];if(i&&i.children)for(var r=i,o=0;o<r.children.length;o++){var n=r.children[o];if(n&&n.children[0]){var s=n.children[0];"⇧"===s.text&&(n.color=t?this.shiftButtonColor:this.defaultButtonColor,n.thickness=t>1?this.selectedShiftThickness:0),s.text=t>0?s.text.toUpperCase():s.text.toLowerCase()}}}},Object.defineProperty(e.prototype,"connectedInputText",{get:function(){return this._currentlyConnectedInputText},enumerable:!0,configurable:!0}),e.prototype.connect=function(t){var e=this;if(!this._connectedInputTexts.some(function(e){return e.input===t})){null===this._onKeyPressObserver&&(this._onKeyPressObserver=this.onKeyPressObservable.add(function(t){if(e._currentlyConnectedInputText){switch(e._currentlyConnectedInputText._host.focusedControl=e._currentlyConnectedInputText,t){case"⇧":return e.shiftState++,e.shiftState>2&&(e.shiftState=0),void e.applyShiftState(e.shiftState);case"←":return void e._currentlyConnectedInputText.processKey(8);case"↵":return void e._currentlyConnectedInputText.processKey(13)}e._currentlyConnectedInputText.processKey(-1,e.shiftState?t.toUpperCase():t),1===e.shiftState&&(e.shiftState=0,e.applyShiftState(e.shiftState))}})),this.isVisible=!1,this._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=this;var i=t.onFocusObservable.add(function(){e._currentlyConnectedInputText=t,t._connectedVirtualKeyboard=e,e.isVisible=!0}),r=t.onBlurObservable.add(function(){t._connectedVirtualKeyboard=null,e._currentlyConnectedInputText=null,e.isVisible=!1});this._connectedInputTexts.push({input:t,onBlurObserver:r,onFocusObserver:i})}},e.prototype.disconnect=function(t){var e=this;if(t){var i=this._connectedInputTexts.filter(function(e){return e.input===t});1===i.length&&(this._removeConnectedInputObservables(i[0]),this._connectedInputTexts=this._connectedInputTexts.filter(function(e){return e.input!==t}),this._currentlyConnectedInputText===t&&(this._currentlyConnectedInputText=null))}else this._connectedInputTexts.forEach(function(t){e._removeConnectedInputObservables(t)}),this._connectedInputTexts=[];0===this._connectedInputTexts.length&&(this._currentlyConnectedInputText=null,this.onKeyPressObservable.remove(this._onKeyPressObserver),this._onKeyPressObserver=null)},e.prototype._removeConnectedInputObservables=function(t){t.input._connectedVirtualKeyboard=null,t.input.onFocusObservable.remove(t.onFocusObserver),t.input.onBlurObservable.remove(t.onBlurObserver)},e.prototype.dispose=function(){t.prototype.dispose.call(this),this.disconnect()},e.CreateDefaultLayout=function(t){var i=new e(t);return i.addKeysRow(["1","2","3","4","5","6","7","8","9","0","←"]),i.addKeysRow(["q","w","e","r","t","y","u","i","o","p"]),i.addKeysRow(["a","s","d","f","g","h","j","k","l",";","'","↵"]),i.addKeysRow(["⇧","z","x","c","v","b","n","m",",",".","/"]),i.addKeysRow([" "],[{width:"200px"}]),i},e}(o.StackPanel);e.VirtualKeyboard=h},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e){var i=t.call(this,e)||this;return i.name=e,i._cellWidth=20,i._cellHeight=20,i._minorLineTickness=1,i._minorLineColor="DarkGray",i._majorLineTickness=2,i._majorLineColor="White",i._majorLineFrequency=5,i._background="Black",i._displayMajorLines=!0,i._displayMinorLines=!0,i}return r(e,t),Object.defineProperty(e.prototype,"displayMinorLines",{get:function(){return this._displayMinorLines},set:function(t){this._displayMinorLines!==t&&(this._displayMinorLines=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayMajorLines",{get:function(){return this._displayMajorLines},set:function(t){this._displayMajorLines!==t&&(this._displayMajorLines=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"background",{get:function(){return this._background},set:function(t){this._background!==t&&(this._background=t,this._markAsDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellWidth",{get:function(){return this._cellWidth},set:function(t){this._cellWidth=t,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cellHeight",{get:function(){return this._cellHeight},set:function(t){this._cellHeight=t,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minorLineTickness",{get:function(){return this._minorLineTickness},set:function(t){this._minorLineTickness=t,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minorLineColor",{get:function(){return this._minorLineColor},set:function(t){this._minorLineColor=t,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"majorLineTickness",{get:function(){return this._majorLineTickness},set:function(t){this._majorLineTickness=t,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"majorLineColor",{get:function(){return this._majorLineColor},set:function(t){this._majorLineColor=t,this._markAsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"majorLineFrequency",{get:function(){return this._majorLineFrequency},set:function(t){this._majorLineFrequency=t,this._markAsDirty()},enumerable:!0,configurable:!0}),e.prototype._draw=function(t,e){if(e.save(),this._applyStates(e),this._isEnabled&&this._processMeasures(t,e)){this._background&&(e.fillStyle=this._background,e.fillRect(this._currentMeasure.left,this._currentMeasure.top,this._currentMeasure.width,this._currentMeasure.height));var i=this._currentMeasure.width/this._cellWidth,r=this._currentMeasure.height/this._cellHeight,o=this._currentMeasure.left+this._currentMeasure.width/2,n=this._currentMeasure.top+this._currentMeasure.height/2;if(this._displayMinorLines){e.strokeStyle=this._minorLineColor,e.lineWidth=this._minorLineTickness;for(var s=-i/2;s<i/2;s++){var a=o+s*this.cellWidth;e.beginPath(),e.moveTo(a,this._currentMeasure.top),e.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),e.stroke()}for(var h=-r/2;h<r/2;h++){var l=n+h*this.cellHeight;e.beginPath(),e.moveTo(this._currentMeasure.left,l),e.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),e.stroke()}}if(this._displayMajorLines){e.strokeStyle=this._majorLineColor,e.lineWidth=this._majorLineTickness;for(s=-i/2+this._majorLineFrequency;s<i/2;s+=this._majorLineFrequency){a=o+s*this.cellWidth;e.beginPath(),e.moveTo(a,this._currentMeasure.top),e.lineTo(a,this._currentMeasure.top+this._currentMeasure.height),e.stroke()}for(h=-r/2+this._majorLineFrequency;h<r/2;h+=this._majorLineFrequency){l=n+h*this.cellHeight;e.moveTo(this._currentMeasure.left,l),e.lineTo(this._currentMeasure.left+this._currentMeasure.width,l),e.closePath(),e.stroke()}}}e.restore()},e.prototype._getTypeName=function(){return"DisplayGrid"},e}(i(9).Control);e.DisplayGrid=o},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(1),o=i(6),n=i(5);e.name="Statics",r.Control.AddHeader=function(t,e,i,s){var a=new o.StackPanel("panel"),h=!s||s.isHorizontal,l=!s||s.controlFirst;a.isVertical=!h;var u=new n.TextBlock("header");return u.text=e,u.textHorizontalAlignment=r.Control.HORIZONTAL_ALIGNMENT_LEFT,h?u.width=i:u.height=i,l?(a.addControl(t),a.addControl(u),u.paddingLeft="5px"):(a.addControl(u),a.addControl(t),u.paddingRight="5px"),u.shadowBlur=t.shadowBlur,u.shadowColor=t.shadowColor,u.shadowOffsetX=t.shadowOffsetX,u.shadowOffsetY=t.shadowOffsetY,a}},function(t,e,i){"use strict";function r(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),r(i(41)),r(i(52)),r(i(53)),r(i(25))},function(t,e,i){"use strict";function r(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}Object.defineProperty(e,"__esModule",{value:!0}),r(i(24)),r(i(14)),r(i(3)),r(i(13)),r(i(42)),r(i(43)),r(i(47)),r(i(48)),r(i(49)),r(i(50)),r(i(51)),r(i(8))},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(8),n=i(0),s=i(3),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return r(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var r=this._cylindricalMapping(e);switch(t.position=r,this.orientation){case s.Container3D.FACEORIGIN_ORIENTATION:i.lookAt(new BABYLON.Vector3(-r.x,r.y,-r.z));break;case s.Container3D.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new BABYLON.Vector3(2*r.x,r.y,2*r.z));break;case s.Container3D.FACEFORWARD_ORIENTATION:break;case s.Container3D.FACEFORWARDREVERSED_ORIENTATION:i.rotate(BABYLON.Axis.Y,Math.PI,BABYLON.Space.LOCAL)}}},e.prototype._cylindricalMapping=function(t){var e=new n.Vector3(0,t.y,this._radius),i=t.x/this._radius;return n.Matrix.RotationYawPitchRollToRef(i,0,0,n.Tmp.Matrix[0]),n.Vector3.TransformNormal(e,n.Tmp.Matrix[0])},e}(o.VolumeBasedPanel);e.CylinderPanel=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(14),n=i(0),s=i(26),a=i(6),h=i(11),l=i(5),u=i(12),c=function(t){function e(e,i){void 0===i&&(i=!0);var r=t.call(this,e)||this;return r._shareMaterials=!0,r._shareMaterials=i,r.pointerEnterAnimation=function(){r.mesh&&r._frontPlate.setEnabled(!0)},r.pointerOutAnimation=function(){r.mesh&&r._frontPlate.setEnabled(!1)},r}return r(e,t),e.prototype._disposeTooltip=function(){this._tooltipFade=null,this._tooltipTextBlock&&this._tooltipTextBlock.dispose(),this._tooltipTexture&&this._tooltipTexture.dispose(),this._tooltipMesh&&this._tooltipMesh.dispose(),this.onPointerEnterObservable.remove(this._tooltipHoverObserver),this.onPointerOutObservable.remove(this._tooltipOutObserver)},Object.defineProperty(e.prototype,"tooltipText",{get:function(){return this._tooltipTextBlock?this._tooltipTextBlock.text:null},set:function(t){var e=this;if(t){if(!this._tooltipFade){this._tooltipMesh=BABYLON.MeshBuilder.CreatePlane("",{size:1},this._backPlate._scene);var i=BABYLON.MeshBuilder.CreatePlane("",{size:1,sideOrientation:BABYLON.Mesh.DOUBLESIDE},this._backPlate._scene),r=new n.StandardMaterial("",this._backPlate._scene);r.diffuseColor=BABYLON.Color3.FromHexString("#212121"),i.material=r,i.isPickable=!1,this._tooltipMesh.addChild(i),i.position.z=.05,this._tooltipMesh.scaling.y=1/3,this._tooltipMesh.position.y=.7,this._tooltipMesh.position.z=-.15,this._tooltipMesh.isPickable=!1,this._tooltipMesh.parent=this._backPlate,this._tooltipTexture=u.AdvancedDynamicTexture.CreateForMesh(this._tooltipMesh),this._tooltipTextBlock=new l.TextBlock,this._tooltipTextBlock.scaleY=3,this._tooltipTextBlock.color="white",this._tooltipTextBlock.fontSize=130,this._tooltipTexture.addControl(this._tooltipTextBlock),this._tooltipFade=new BABYLON.FadeInOutBehavior,this._tooltipFade.delay=500,this._tooltipMesh.addBehavior(this._tooltipFade),this._tooltipHoverObserver=this.onPointerEnterObservable.add(function(){e._tooltipFade&&e._tooltipFade.fadeIn(!0)}),this._tooltipOutObserver=this.onPointerOutObservable.add(function(){e._tooltipFade&&e._tooltipFade.fadeIn(!1)})}this._tooltipTextBlock&&(this._tooltipTextBlock.text=t)}else this._disposeTooltip()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"text",{get:function(){return this._text},set:function(t){this._text!==t&&(this._text=t,this._rebuildContent())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageUrl",{get:function(){return this._imageUrl},set:function(t){this._imageUrl!==t&&(this._imageUrl=t,this._rebuildContent())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"backMaterial",{get:function(){return this._backMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frontMaterial",{get:function(){return this._frontMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"plateMaterial",{get:function(){return this._plateMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shareMaterials",{get:function(){return this._shareMaterials},enumerable:!0,configurable:!0}),e.prototype._getTypeName=function(){return"HolographicButton"},e.prototype._rebuildContent=function(){this._disposeFacadeTexture();var t=new a.StackPanel;if(t.isVertical=!0,this._imageUrl){var e=new h.Image;e.source=this._imageUrl,e.paddingTop="40px",e.height="180px",e.width="100px",e.paddingBottom="40px",t.addControl(e)}if(this._text){var i=new l.TextBlock;i.text=this._text,i.color="white",i.height="30px",i.fontSize=24,t.addControl(i)}this._frontPlate&&(this.content=t)},e.prototype._createNode=function(e){return this._backPlate=n.MeshBuilder.CreateBox(this.name+"BackMesh",{width:1,height:1,depth:.08},e),this._frontPlate=n.MeshBuilder.CreateBox(this.name+"FrontMesh",{width:1,height:1,depth:.08},e),this._frontPlate.parent=this._backPlate,this._frontPlate.position.z=-.08,this._frontPlate.isPickable=!1,this._frontPlate.setEnabled(!1),this._textPlate=t.prototype._createNode.call(this,e),this._textPlate.parent=this._backPlate,this._textPlate.position.z=-.08,this._textPlate.isPickable=!1,this._backPlate},e.prototype._applyFacade=function(t){this._plateMaterial.emissiveTexture=t,this._plateMaterial.opacityTexture=t},e.prototype._createBackMaterial=function(t){var e=this;this._backMaterial=new s.FluentMaterial(this.name+"Back Material",t.getScene()),this._backMaterial.renderHoverLight=!0,this._pickedPointObserver=this._host.onPickedPointChangedObservable.add(function(t){t?(e._backMaterial.hoverPosition=t,e._backMaterial.hoverColor.a=1):e._backMaterial.hoverColor.a=0})},e.prototype._createFrontMaterial=function(t){this._frontMaterial=new s.FluentMaterial(this.name+"Front Material",t.getScene()),this._frontMaterial.innerGlowColorIntensity=0,this._frontMaterial.alpha=.5,this._frontMaterial.renderBorders=!0},e.prototype._createPlateMaterial=function(t){this._plateMaterial=new n.StandardMaterial(this.name+"Plate Material",t.getScene()),this._plateMaterial.specularColor=n.Color3.Black()},e.prototype._affectMaterial=function(t){this._shareMaterials?(this._host._sharedMaterials.backFluentMaterial?this._backMaterial=this._host._sharedMaterials.backFluentMaterial:(this._createBackMaterial(t),this._host._sharedMaterials.backFluentMaterial=this._backMaterial),this._host._sharedMaterials.frontFluentMaterial?this._frontMaterial=this._host._sharedMaterials.frontFluentMaterial:(this._createFrontMaterial(t),this._host._sharedMaterials.frontFluentMaterial=this._frontMaterial)):(this._createBackMaterial(t),this._createFrontMaterial(t)),this._createPlateMaterial(t),this._backPlate.material=this._backMaterial,this._frontPlate.material=this._frontMaterial,this._textPlate.material=this._plateMaterial,this._rebuildContent()},e.prototype.dispose=function(){t.prototype.dispose.call(this),this._disposeTooltip(),this.shareMaterials||(this._backMaterial.dispose(),this._frontMaterial.dispose(),this._plateMaterial.dispose(),this._pickedPointObserver&&(this._host.onPickedPointChangedObservable.remove(this._pickedPointObserver),this._pickedPointObserver=null))},e}(o.Button3D);e.HolographicButton=c},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0),o=i(45);e.fShader=o;var n=i(46);e.vShader=n,e.registerShader=function(){r.Effect.ShadersStore.fluentVertexShader=n,r.Effect.ShadersStore.fluentPixelShader=o}},function(t,e){t.exports="precision highp float;\nvarying vec2 vUV;\nuniform vec4 albedoColor;\n#ifdef INNERGLOW\nuniform vec4 innerGlowColor;\n#endif\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float edgeSmoothingValue;\nuniform float borderMinValue;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\nuniform vec3 hoverPosition;\nuniform vec4 hoverColor;\nuniform float hoverRadius;\n#endif\n#ifdef TEXTURE\nuniform sampler2D albedoSampler;\n#endif\nvoid main(void) {\nvec3 albedo=albedoColor.rgb;\nfloat alpha=albedoColor.a;\n#ifdef TEXTURE\nalbedo=texture2D(albedoSampler,vUV).rgb;\n#endif\n#ifdef HOVERLIGHT\nfloat pointToHover=(1.0-clamp(length(hoverPosition-worldPosition)/hoverRadius,0.,1.))*hoverColor.a;\nalbedo=clamp(albedo+hoverColor.rgb*pointToHover,0.,1.);\n#else\nfloat pointToHover=1.0;\n#endif\n#ifdef BORDER \nfloat borderPower=10.0;\nfloat inverseBorderPower=1.0/borderPower;\nvec3 borderColor=albedo*borderPower;\nvec2 distanceToEdge;\ndistanceToEdge.x=abs(vUV.x-0.5)*2.0;\ndistanceToEdge.y=abs(vUV.y-0.5)*2.0;\nfloat borderValue=max(smoothstep(scaleInfo.x-edgeSmoothingValue,scaleInfo.x+edgeSmoothingValue,distanceToEdge.x),\nsmoothstep(scaleInfo.y-edgeSmoothingValue,scaleInfo.y+edgeSmoothingValue,distanceToEdge.y));\nborderColor=borderColor*borderValue*max(borderMinValue*inverseBorderPower,pointToHover); \nalbedo+=borderColor;\nalpha=max(alpha,borderValue);\n#endif\n#ifdef INNERGLOW\n\nvec2 uvGlow=(vUV-vec2(0.5,0.5))*(innerGlowColor.a*2.0);\nuvGlow=uvGlow*uvGlow;\nuvGlow=uvGlow*uvGlow;\nalbedo+=mix(vec3(0.0,0.0,0.0),innerGlowColor.rgb,uvGlow.x+uvGlow.y); \n#endif\ngl_FragColor=vec4(albedo,alpha);\n}"},function(t,e){t.exports="precision highp float;\n\nattribute vec3 position;\nattribute vec3 normal;\nattribute vec2 uv;\n\nuniform mat4 world;\nuniform mat4 viewProjection;\nvarying vec2 vUV;\n#ifdef BORDER\nvarying vec2 scaleInfo;\nuniform float borderWidth;\nuniform vec3 scaleFactor;\n#endif\n#ifdef HOVERLIGHT\nvarying vec3 worldPosition;\n#endif\nvoid main(void) {\nvUV=uv;\n#ifdef BORDER\nvec3 scale=scaleFactor;\nfloat minScale=min(min(scale.x,scale.y),scale.z);\nfloat maxScale=max(max(scale.x,scale.y),scale.z);\nfloat minOverMiddleScale=minScale/(scale.x+scale.y+scale.z-minScale-maxScale);\nfloat areaYZ=scale.y*scale.z;\nfloat areaXZ=scale.x*scale.z;\nfloat areaXY=scale.x*scale.y;\nfloat scaledBorderWidth=borderWidth; \nif (abs(normal.x) == 1.0) \n{\nscale.x=scale.y;\nscale.y=scale.z;\nif (areaYZ>areaXZ && areaYZ>areaXY)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse if (abs(normal.y) == 1.0) \n{\nscale.x=scale.z;\nif (areaXZ>areaXY && areaXZ>areaYZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nelse \n{\nif (areaXY>areaYZ && areaXY>areaXZ)\n{\nscaledBorderWidth*=minOverMiddleScale;\n}\n}\nfloat scaleRatio=min(scale.x,scale.y)/max(scale.x,scale.y);\nif (scale.x>scale.y)\n{\nscaleInfo.x=1.0-(scaledBorderWidth*scaleRatio);\nscaleInfo.y=1.0-scaledBorderWidth;\n}\nelse\n{\nscaleInfo.x=1.0-scaledBorderWidth;\nscaleInfo.y=1.0-(scaledBorderWidth*scaleRatio);\n} \n#endif \nvec4 worldPos=world*vec4(position,1.0);\n#ifdef HOVERLIGHT\nworldPosition=worldPos.xyz;\n#endif\ngl_Position=viewProjection*worldPos;\n}\n"},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=function(t){function e(e,i){var r=t.call(this,i)||this;return r._currentMesh=e,r.pointerEnterAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1.1)},r.pointerOutAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1/1.1)},r.pointerDownAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(.95)},r.pointerUpAnimation=function(){r.mesh&&r.mesh.scaling.scaleInPlace(1/.95)},r}return r(e,t),e.prototype._getTypeName=function(){return"MeshButton3D"},e.prototype._createNode=function(t){var e=this;return this._currentMesh.getChildMeshes().forEach(function(t){t.metadata=e}),this._currentMesh},e.prototype._affectMaterial=function(t){},e}(i(14).Button3D);e.MeshButton3D=o},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(0),n=i(3),s=function(t){function e(){return null!==t&&t.apply(this,arguments)||this}return r(e,t),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){t.position=e.clone();var r=o.Tmp.Vector3[0];switch(r.copyFrom(e),this.orientation){case n.Container3D.FACEORIGIN_ORIENTATION:case n.Container3D.FACEFORWARD_ORIENTATION:r.addInPlace(new BABYLON.Vector3(0,0,-1)),i.lookAt(r);break;case n.Container3D.FACEFORWARDREVERSED_ORIENTATION:case n.Container3D.FACEORIGINREVERSED_ORIENTATION:r.addInPlace(new BABYLON.Vector3(0,0,1)),i.lookAt(r)}}},e}(i(8).VolumeBasedPanel);e.PlanePanel=s},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(8),n=i(0),s=i(3),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._iteration=100,e}return r(e,t),Object.defineProperty(e.prototype,"iteration",{get:function(){return this._iteration},set:function(t){var e=this;this._iteration!==t&&(this._iteration=t,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh,r=this._scatterMapping(e);if(i){switch(this.orientation){case s.Container3D.FACEORIGIN_ORIENTATION:case s.Container3D.FACEFORWARD_ORIENTATION:i.lookAt(new n.Vector3(0,0,-1));break;case s.Container3D.FACEFORWARDREVERSED_ORIENTATION:case s.Container3D.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new n.Vector3(0,0,1))}t.position=r}},e.prototype._scatterMapping=function(t){return t.x=(1-2*Math.random())*this._cellWidth,t.y=(1-2*Math.random())*this._cellHeight,t},e.prototype._finalProcessing=function(){for(var t=[],e=0,i=this._children;e<i.length;e++){var r=i[e];r.mesh&&t.push(r.mesh)}for(var o=0;o<this._iteration;o++){t.sort(function(t,e){var i=t.position.lengthSquared(),r=e.position.lengthSquared();return i<r?1:i>r?-1:0});for(var s=Math.pow(this.margin,2),a=Math.max(this._cellWidth,this._cellHeight),h=n.Tmp.Vector2[0],l=n.Tmp.Vector3[0],u=0;u<t.length-1;u++)for(var c=u+1;c<t.length;c++)if(u!=c){t[c].position.subtractToRef(t[u].position,l),h.x=l.x,h.y=l.y;var _=a,f=h.lengthSquared()-s;(f-=Math.min(f,s))<Math.pow(_,2)&&(h.normalize(),l.scaleInPlace(.5*(_-Math.sqrt(f))),t[c].position.addInPlace(l),t[u].position.subtractInPlace(l))}}},e}(o.VolumeBasedPanel);e.ScatterPanel=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(8),n=i(0),s=i(3),a=function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._radius=5,e}return r(e,t),Object.defineProperty(e.prototype,"radius",{get:function(){return this._radius},set:function(t){var e=this;this._radius!==t&&(this._radius=t,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),e.prototype._mapGridNode=function(t,e){var i=t.mesh;if(i){var r=this._sphericalMapping(e);switch(t.position=r,this.orientation){case s.Container3D.FACEORIGIN_ORIENTATION:i.lookAt(new BABYLON.Vector3(-r.x,-r.y,-r.z));break;case s.Container3D.FACEORIGINREVERSED_ORIENTATION:i.lookAt(new BABYLON.Vector3(2*r.x,2*r.y,2*r.z));break;case s.Container3D.FACEFORWARD_ORIENTATION:break;case s.Container3D.FACEFORWARDREVERSED_ORIENTATION:i.rotate(BABYLON.Axis.Y,Math.PI,BABYLON.Space.LOCAL)}}},e.prototype._sphericalMapping=function(t){var e=new n.Vector3(0,0,this._radius),i=t.y/this._radius,r=-t.x/this._radius;return n.Matrix.RotationYawPitchRollToRef(r,i,0,n.Tmp.Matrix[0]),n.Vector3.TransformNormal(e,n.Tmp.Matrix[0])},e}(o.VolumeBasedPanel);e.SpherePanel=a},function(t,e,i){"use strict";var r=this&&this.__extends||function(){var t=function(e,i){return(t=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var i in e)e.hasOwnProperty(i)&&(t[i]=e[i])})(e,i)};return function(e,i){function r(){this.constructor=e}t(e,i),e.prototype=null===i?Object.create(i):(r.prototype=i.prototype,new r)}}();Object.defineProperty(e,"__esModule",{value:!0});var o=i(3),n=i(0),s=function(t){function e(e){void 0===e&&(e=!1);var i=t.call(this)||this;return i._isVertical=!1,i.margin=.1,i._isVertical=e,i}return r(e,t),Object.defineProperty(e.prototype,"isVertical",{get:function(){return this._isVertical},set:function(t){var e=this;this._isVertical!==t&&(this._isVertical=t,n.Tools.SetImmediate(function(){e._arrangeChildren()}))},enumerable:!0,configurable:!0}),e.prototype._arrangeChildren=function(){for(var t,e=0,i=0,r=0,o=[],s=n.Matrix.Invert(this.node.computeWorldMatrix(!0)),a=0,h=this._children;a<h.length;a++){if((p=h[a]).mesh){r++,p.mesh.computeWorldMatrix(!0),p.mesh.getWorldMatrix().multiplyToRef(s,n.Tmp.Matrix[0]);var l=p.mesh.getBoundingInfo().boundingBox,u=n.Vector3.TransformNormal(l.extendSize,n.Tmp.Matrix[0]);o.push(u),this._isVertical?i+=u.y:e+=u.x}}this._isVertical?i+=(r-1)*this.margin/2:e+=(r-1)*this.margin/2,t=this._isVertical?-i:-e;for(var c=0,_=0,f=this._children;_<f.length;_++){var p;if((p=f[_]).mesh){r--;u=o[c++];this._isVertical?(p.position.y=t+u.y,p.position.x=0,t+=2*u.y):(p.position.x=t+u.x,p.position.y=0,t+=2*u.x),t+=r>0?this.margin:0}}},e}(o.Container3D);e.StackPanel3D=s},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0}),function(t){for(var i in t)e.hasOwnProperty(i)||(e[i]=t[i])}(i(26))},function(t,e,i){"use strict";Object.defineProperty(e,"__esModule",{value:!0});var r=i(0),o=i(3),n=function(){function t(t){var e=this;this._lastControlOver={},this._lastControlDown={},this.onPickedPointChangedObservable=new r.Observable,this._sharedMaterials={},this._scene=t||r.Engine.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add(function(){e._sceneDisposeObserver=null,e._utilityLayer=null,e.dispose()}),this._utilityLayer=new r.UtilityLayerRenderer(this._scene),this._utilityLayer.onlyCheckPointerDownEvents=!1,this._utilityLayer.mainSceneTrackerPredicate=function(t){return t&&t.metadata&&t.metadata._node},this._rootContainer=new o.Container3D("RootContainer"),this._rootContainer._host=this;var i=this._utilityLayer.utilityLayerScene;this._pointerOutObserver=this._utilityLayer.onPointerOutObservable.add(function(t){e._handlePointerOut(t,!0)}),this._pointerObserver=i.onPointerObservable.add(function(t,i){e._doPicking(t)}),this._utilityLayer.utilityLayerScene.autoClear=!1,this._utilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,new r.HemisphericLight("hemi",r.Vector3.Up(),this._utilityLayer.utilityLayerScene)}return Object.defineProperty(t.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"utilityLayer",{get:function(){return this._utilityLayer},enumerable:!0,configurable:!0}),t.prototype._handlePointerOut=function(t,e){var i=this._lastControlOver[t];i&&(i._onPointerOut(i),delete this._lastControlOver[t]),e&&this._lastControlDown[t]&&(this._lastControlDown[t].forcePointerUp(),delete this._lastControlDown[t]),this.onPickedPointChangedObservable.notifyObservers(null)},t.prototype._doPicking=function(t){if(!this._utilityLayer||!this._utilityLayer.utilityLayerScene.activeCamera)return!1;var e=t.event,i=e.pointerId||0,o=e.button,n=t.pickInfo;if(!n||!n.hit)return this._handlePointerOut(i,t.type===r.PointerEventTypes.POINTERUP),!1;var s=n.pickedMesh.metadata;return n.pickedPoint&&this.onPickedPointChangedObservable.notifyObservers(n.pickedPoint),s._processObservables(t.type,n.pickedPoint,i,o)||t.type===r.PointerEventTypes.POINTERMOVE&&(this._lastControlOver[i]&&this._lastControlOver[i]._onPointerOut(this._lastControlOver[i]),delete this._lastControlOver[i]),t.type===r.PointerEventTypes.POINTERUP&&(this._lastControlDown[e.pointerId]&&(this._lastControlDown[e.pointerId].forcePointerUp(),delete this._lastControlDown[e.pointerId]),"touch"===e.pointerType&&this._handlePointerOut(i,!1)),!0},Object.defineProperty(t.prototype,"rootContainer",{get:function(){return this._rootContainer},enumerable:!0,configurable:!0}),t.prototype.containsControl=function(t){return this._rootContainer.containsControl(t)},t.prototype.addControl=function(t){return this._rootContainer.addControl(t),this},t.prototype.removeControl=function(t){return this._rootContainer.removeControl(t),this},t.prototype.dispose=function(){for(var t in this._rootContainer.dispose(),this._sharedMaterials)this._sharedMaterials.hasOwnProperty(t)&&this._sharedMaterials[t].dispose();this._sharedMaterials={},this._pointerOutObserver&&this._utilityLayer&&(this._utilityLayer.onPointerOutObservable.remove(this._pointerOutObserver),this._pointerOutObserver=null),this.onPickedPointChangedObservable.clear();var e=this._utilityLayer?this._utilityLayer.utilityLayerScene:null;e&&this._pointerObserver&&(e.onPointerObservable.remove(this._pointerObserver),this._pointerObserver=null),this._scene&&this._sceneDisposeObserver&&(this._scene.onDisposeObservable.remove(this._sceneDisposeObserver),this._sceneDisposeObserver=null),this._utilityLayer&&this._utilityLayer.dispose()},t}();e.GUI3DManager=n}])});
  65843. //# sourceMappingURL=babylon.gui.min.js.map
  65844. /***/ }),
  65845. /***/ "./node_modules/babylonjs/babylon.js":
  65846. /*!*******************************************!*\
  65847. !*** ./node_modules/babylonjs/babylon.js ***!
  65848. \*******************************************/
  65849. /*! no static exports found */
  65850. /***/ (function(module, exports, __webpack_require__) {
  65851. !(function(e,t){var i=[],r=e.CANNON||this.CANNON,n=e.OIMO||this.OIMO,o=e.earcut||this.earcut;if(true){try{r=r||__webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module 'cannon'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()))}catch(e){}try{n=n||__webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module 'oimo'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()))}catch(e){}try{o=o||__webpack_require__(!(function webpackMissingModule() { var e = new Error("Cannot find module 'earcut'"); e.code = 'MODULE_NOT_FOUND'; throw e; }()))}catch(e){}module.exports=t(r,n,o)}else {}})(this,(function(i,t,m){i=i||this.CANNON,t=t||this.OIMO,m=m||this.earcut;var r,e,n,o,s,a,l,c,h,u,d,f,p,_,g,v,b=this&&this.__decorate||function(e,t,i,r){var n,o=arguments.length,s=o<3?t:null===r?r=Object.getOwnPropertyDescriptor(t,i):r;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)s=Reflect.decorate(e,t,i,r);else for(var a=e.length-1;0<=a;a--)(n=e[a])&&(s=(o<3?n(s):3<o?n(t,i,s):n(t,i))||s);return 3<o&&s&&Object.defineProperty(t,i,s),s},T=this&&this.__extends||(r=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var i in t)t.hasOwnProperty(i)&&(e[i]=t[i])},function(e,t){function i(){this.constructor=e}r(e,t),e.prototype=null===t?Object.create(t):(i.prototype=t.prototype,new i)});!(function(b){var e=(function(){function e(){this._defines={},this._currentRank=32,this._maxRank=-1}return e.prototype.unBindMesh=function(){this._mesh=null},e.prototype.addFallback=function(e,t){this._defines[e]||(e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e),this._defines[e]=new Array),this._defines[e].push(t)},e.prototype.addCPUSkinningFallback=function(e,t){this._mesh=t,e<this._currentRank&&(this._currentRank=e),e>this._maxRank&&(this._maxRank=e)},Object.defineProperty(e.prototype,"isMoreFallbacks",{get:function(){return this._currentRank<=this._maxRank},enumerable:!0,configurable:!0}),e.prototype.reduce=function(e,t){if(this._mesh&&this._mesh.computeBonesUsingShaders&&0<this._mesh.numBoneInfluencers&&this._mesh.material){this._mesh.computeBonesUsingShaders=!1,e=e.replace("#define NUM_BONE_INFLUENCERS "+this._mesh.numBoneInfluencers,"#define NUM_BONE_INFLUENCERS 0"),t._bonesComputationForcedToCPU=!0;for(var i=this._mesh.getScene(),r=0;r<i.meshes.length;r++){var n=i.meshes[r];if(n.material&&(n.computeBonesUsingShaders&&0!==n.numBoneInfluencers))if(n.material.getEffect()===t)n.computeBonesUsingShaders=!1;else if(n.subMeshes)for(var o=0,s=n.subMeshes;o<s.length;o++){if(s[o].effect===t){n.computeBonesUsingShaders=!1;break}}}}else{var a=this._defines[this._currentRank];if(a)for(r=0;r<a.length;r++)e=e.replace("#define "+a[r],"");this._currentRank++}return e},e})();b.EffectFallbacks=e;var t=function(){};b.EffectCreationOptions=t;var i=(function(){function y(n,e,t,i,r,o,s,a,l,c){void 0===i&&(i=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null),void 0===l&&(l=null);var h,u,d=this;if(this.uniqueId=0,this.onCompileObservable=new b.Observable,this.onErrorObservable=new b.Observable,this._bonesComputationForcedToCPU=!1,this._uniformBuffersNames={},this._isReady=!1,this._compilationError="",this.name=n,e.attributes){var f=e;if(this._engine=t,this._attributesNames=f.attributes,this._uniformsNames=f.uniformsNames.concat(f.samplers),this._samplers=f.samplers.slice(),this.defines=f.defines,this.onError=f.onError,this.onCompiled=f.onCompiled,this._fallbacks=f.fallbacks,this._indexParameters=f.indexParameters,this._transformFeedbackVaryings=f.transformFeedbackVaryings,f.uniformBuffersNames)for(var p=0;p<f.uniformBuffersNames.length;p++)this._uniformBuffersNames[f.uniformBuffersNames[p]]=p}else this._engine=r,this.defines=o,this._uniformsNames=t.concat(i),this._samplers=i?i.slice():[],this._attributesNames=e,this.onError=l,this.onCompiled=a,this._indexParameters=c,this._fallbacks=s;this.uniqueId=y._uniqueIdSeed++,n.vertexElement?(h=document.getElementById(n.vertexElement))||(h=n.vertexElement):h=n.vertex||n,n.fragmentElement?(u=document.getElementById(n.fragmentElement))||(u=n.fragmentElement):u=n.fragment||n,this._loadVertexShader(h,(function(e){d._processIncludes(e,(function(e){d._processShaderConversion(e,!1,(function(r){d._loadFragmentShader(u,(function(e){d._processIncludes(e,(function(e){d._processShaderConversion(e,!0,(function(e){if(n){var t=n.vertexElement||n.vertex||n,i=n.fragmentElement||n.fragment||n;d._vertexSourceCode="#define SHADER_NAME vertex:"+t+"\n"+r,d._fragmentSourceCode="#define SHADER_NAME fragment:"+i+"\n"+e}else d._vertexSourceCode=r,d._fragmentSourceCode=e;d._prepareEffect()}))}))}))}))}))}))}return Object.defineProperty(y.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new b.Observable),this._onBindObservable},enumerable:!0,configurable:!0}),Object.defineProperty(y.prototype,"key",{get:function(){return this._key},enumerable:!0,configurable:!0}),y.prototype.isReady=function(){return this._isReady},y.prototype.getEngine=function(){return this._engine},y.prototype.getProgram=function(){return this._program},y.prototype.getAttributesNames=function(){return this._attributesNames},y.prototype.getAttributeLocation=function(e){return this._attributes[e]},y.prototype.getAttributeLocationByName=function(e){var t=this._attributesNames.indexOf(e);return this._attributes[t]},y.prototype.getAttributesCount=function(){return this._attributes.length},y.prototype.getUniformIndex=function(e){return this._uniformsNames.indexOf(e)},y.prototype.getUniform=function(e){return this._uniforms[this._uniformsNames.indexOf(e)]},y.prototype.getSamplers=function(){return this._samplers},y.prototype.getCompilationError=function(){return this._compilationError},y.prototype.executeWhenCompiled=function(t){this.isReady()?t(this):this.onCompileObservable.add((function(e){t(e)}))},y.prototype._loadVertexShader=function(e,t){var i;if(b.Tools.IsWindowObjectExist()&&e instanceof HTMLElement)return void t(b.Tools.GetDOMTextContent(e));"base64:"!==e.substr(0,7)?y.ShadersStore[e+"VertexShader"]?t(y.ShadersStore[e+"VertexShader"]):(i="."===e[0]||"/"===e[0]||-1<e.indexOf("http")?e:b.Engine.ShadersRepository+e,this._engine._loadFile(i+".vertex.fx",t)):t(window.atob(e.substr(7)))},y.prototype._loadFragmentShader=function(e,t){var i;if(b.Tools.IsWindowObjectExist()&&e instanceof HTMLElement)return void t(b.Tools.GetDOMTextContent(e));"base64:"!==e.substr(0,7)?y.ShadersStore[e+"PixelShader"]?t(y.ShadersStore[e+"PixelShader"]):y.ShadersStore[e+"FragmentShader"]?t(y.ShadersStore[e+"FragmentShader"]):(i="."===e[0]||"/"===e[0]||-1<e.indexOf("http")?e:b.Engine.ShadersRepository+e,this._engine._loadFile(i+".fragment.fx",t)):t(window.atob(e.substr(7)))},y.prototype._dumpShadersSource=function(e,t,i){var r=(1<this._engine.webGLVersion?"#version 300 es\n#define WEBGL2 \n":"")+(i?i+"\n":"");t=r+t;var n=2,o=/\n/gm,s="\n1\t"+(e=r+e).replace(o,(function(){return"\n"+n+++"\t"}));n=2;var a="\n1\t"+t.replace(o,(function(){return"\n"+n+++"\t"}));this.name.vertexElement?(b.Tools.Error("Vertex shader: "+this.name.vertexElement+s),b.Tools.Error("Fragment shader: "+this.name.fragmentElement+a)):this.name.vertex?(b.Tools.Error("Vertex shader: "+this.name.vertex+s),b.Tools.Error("Fragment shader: "+this.name.fragment+a)):(b.Tools.Error("Vertex shader: "+this.name+s),b.Tools.Error("Fragment shader: "+this.name+a))},y.prototype._processShaderConversion=function(e,t,i){var r=this._processPrecision(e);if(1!=this._engine.webGLVersion)if(-1===r.indexOf("#version 3")){var n=-1!==r.search(/#extension.+GL_EXT_draw_buffers.+require/),o=r.replace(/#extension.+(GL_OES_standard_derivatives|GL_EXT_shader_texture_lod|GL_EXT_frag_depth|GL_EXT_draw_buffers).+(enable|require)/g,"");o=(o=(o=o.replace(/varying(?![\n\r])\s/g,t?"in ":"out ")).replace(/attribute[ \t]/g,"in ")).replace(/[ \t]attribute/g," in"),t&&(o=(o=(o=(o=(o=(o=(o=(o=o.replace(/texture2DLodEXT\s*\(/g,"textureLod(")).replace(/textureCubeLodEXT\s*\(/g,"textureLod(")).replace(/texture2D\s*\(/g,"texture(")).replace(/textureCube\s*\(/g,"texture(")).replace(/gl_FragDepthEXT/g,"gl_FragDepth")).replace(/gl_FragColor/g,"glFragColor")).replace(/gl_FragData/g,"glFragData")).replace(/void\s+?main\s*\(/g,(n?"":"out vec4 glFragColor;\n")+"void main(")),i(o)}else i(r.replace("#version 300 es",""));else i(r)},y.prototype._processIncludes=function(e,t){for(var i=this,r=/#include<(.+)>(\((.*)\))*(\[(.*)\])*/g,n=r.exec(e),o=new String(e);null!=n;){var s=n[1];if(-1!==s.indexOf("__decl__")&&(s=s.replace(/__decl__/,""),this._engine.supportsUniformBuffers&&(s=(s=s.replace(/Vertex/,"Ubo")).replace(/Fragment/,"Ubo")),s+="Declaration"),!y.IncludesShadersStore[s]){var a=b.Engine.ShadersRepository+"ShadersInclude/"+s+".fx";return void this._engine._loadFile(a,(function(e){y.IncludesShadersStore[s]=e,i._processIncludes(o,t)}))}var l=y.IncludesShadersStore[s];if(n[2])for(var c=n[3].split(","),h=0;h<c.length;h+=2){var u=new RegExp(c[h],"g"),d=c[h+1];l=l.replace(u,d)}if(n[4]){var f=n[5];if(-1!==f.indexOf("..")){var p=f.split(".."),_=parseInt(p[0]),m=parseInt(p[1]),g=l.slice(0);l="",isNaN(m)&&(m=this._indexParameters[p[1]]);for(var v=_;v<m;v++)this._engine.supportsUniformBuffers||(g=g.replace(/light\{X\}.(\w*)/g,(function(e,t){return t+"{X}"}))),l+=g.replace(/\{X\}/g,v.toString())+"\n"}else this._engine.supportsUniformBuffers||(l=l.replace(/light\{X\}.(\w*)/g,(function(e,t){return t+"{X}"}))),l=l.replace(/\{X\}/g,f)}o=o.replace(n[0],l),n=r.exec(e)}t(o)},y.prototype._processPrecision=function(e){return-1===e.indexOf("precision highp float")?e=this._engine.getCaps().highPrecisionShaderSupported?"precision highp float;\n"+e:"precision mediump float;\n"+e:this._engine.getCaps().highPrecisionShaderSupported||(e=e.replace("precision highp float","precision mediump float")),e},y.prototype._rebuildProgram=function(e,t,i,r){var n=this;this._isReady=!1,this._vertexSourceCodeOverride=e,this._fragmentSourceCodeOverride=t,this.onError=function(e,t){r&&r(t)},this.onCompiled=function(){for(var e=n.getEngine().scenes,t=0;t<e.length;t++)e[t].markAllMaterialsAsDirty(b.Material.TextureDirtyFlag);i&&i(n._program)},this._fallbacks=null,this._prepareEffect()},y.prototype.getSpecificUniformLocations=function(e){return this._engine.getUniforms(this._program,e)},y.prototype._prepareEffect=function(){var t=this._attributesNames,e=this.defines,i=this._fallbacks;this._valueCache={};var r=this._program;try{var n,o=this._engine;if(this._vertexSourceCodeOverride&&this._fragmentSourceCodeOverride?this._program=o.createRawShaderProgram(this._vertexSourceCodeOverride,this._fragmentSourceCodeOverride,void 0,this._transformFeedbackVaryings):this._program=o.createShaderProgram(this._vertexSourceCode,this._fragmentSourceCode,e,void 0,this._transformFeedbackVaryings),this._program.__SPECTOR_rebuildProgram=this._rebuildProgram.bind(this),o.supportsUniformBuffers)for(var s in this._uniformBuffersNames)this.bindUniformBlock(s,this._uniformBuffersNames[s]);for(this._uniforms=o.getUniforms(this._program,this._uniformsNames),this._attributes=o.getAttributes(this._program,t),n=0;n<this._samplers.length;n++){null==this.getUniform(this._samplers[n])&&(this._samplers.splice(n,1),n--)}o.bindSamplers(this),this._compilationError="",this._isReady=!0,this.onCompiled&&this.onCompiled(this),this.onCompileObservable.notifyObservers(this),this.onCompileObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh(),r&&this.getEngine()._deleteProgram(r)}catch(e){this._compilationError=e.message,b.Tools.Error("Unable to compile effect:"),b.Tools.Error("Uniforms: "+this._uniformsNames.map((function(e){return" "+e}))),b.Tools.Error("Attributes: "+t.map((function(e){return" "+e}))),b.Tools.Error("Error: "+this._compilationError),r&&(this._program=r,this._isReady=!0,this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this)),i&&i.isMoreFallbacks?(b.Tools.Error("Trying next fallback."),this.defines=i.reduce(this.defines,this),this._prepareEffect()):(this.onError&&this.onError(this,this._compilationError),this.onErrorObservable.notifyObservers(this),this.onErrorObservable.clear(),this._fallbacks&&this._fallbacks.unBindMesh())}},Object.defineProperty(y.prototype,"isSupported",{get:function(){return""===this._compilationError},enumerable:!0,configurable:!0}),y.prototype._bindTexture=function(e,t){this._engine._bindTexture(this._samplers.indexOf(e),t)},y.prototype.setTexture=function(e,t){this._engine.setTexture(this._samplers.indexOf(e),this.getUniform(e),t)},y.prototype.setDepthStencilTexture=function(e,t){this._engine.setDepthStencilTexture(this._samplers.indexOf(e),this.getUniform(e),t)},y.prototype.setTextureArray=function(e,t){if(-1===this._samplers.indexOf(e+"Ex"))for(var i=this._samplers.indexOf(e),r=1;r<t.length;r++)this._samplers.splice(i+r,0,e+"Ex");this._engine.setTextureArray(this._samplers.indexOf(e),this.getUniform(e),t)},y.prototype.setTextureFromPostProcess=function(e,t){this._engine.setTextureFromPostProcess(this._samplers.indexOf(e),t)},y.prototype.setTextureFromPostProcessOutput=function(e,t){this._engine.setTextureFromPostProcessOutput(this._samplers.indexOf(e),t)},y.prototype._cacheMatrix=function(e,t){var i=this._valueCache[e],r=t.updateFlag;return(void 0===i||i!==r)&&(this._valueCache[e]=r,!0)},y.prototype._cacheFloat2=function(e,t,i){var r=this._valueCache[e];if(!r)return r=[t,i],this._valueCache[e]=r,!0;var n=!1;return r[0]!==t&&(r[0]=t,n=!0),r[1]!==i&&(r[1]=i,n=!0),n},y.prototype._cacheFloat3=function(e,t,i,r){var n=this._valueCache[e];if(!n)return n=[t,i,r],this._valueCache[e]=n,!0;var o=!1;return n[0]!==t&&(n[0]=t,o=!0),n[1]!==i&&(n[1]=i,o=!0),n[2]!==r&&(n[2]=r,o=!0),o},y.prototype._cacheFloat4=function(e,t,i,r,n){var o=this._valueCache[e];if(!o)return o=[t,i,r,n],this._valueCache[e]=o,!0;var s=!1;return o[0]!==t&&(o[0]=t,s=!0),o[1]!==i&&(o[1]=i,s=!0),o[2]!==r&&(o[2]=r,s=!0),o[3]!==n&&(o[3]=n,s=!0),s},y.prototype.bindUniformBuffer=function(e,t){var i=this._uniformBuffersNames[t];void 0!==i&&y._baseCache[i]!==e&&(y._baseCache[i]=e,this._engine.bindUniformBufferBase(e,i))},y.prototype.bindUniformBlock=function(e,t){this._engine.bindUniformBlock(this._program,e,t)},y.prototype.setInt=function(e,t){var i=this._valueCache[e];return void 0!==i&&i===t||(this._valueCache[e]=t,this._engine.setInt(this.getUniform(e),t)),this},y.prototype.setIntArray=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray(this.getUniform(e),t),this},y.prototype.setIntArray2=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray2(this.getUniform(e),t),this},y.prototype.setIntArray3=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray3(this.getUniform(e),t),this},y.prototype.setIntArray4=function(e,t){return this._valueCache[e]=null,this._engine.setIntArray4(this.getUniform(e),t),this},y.prototype.setFloatArray=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray(this.getUniform(e),t),this},y.prototype.setFloatArray2=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray2(this.getUniform(e),t),this},y.prototype.setFloatArray3=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray3(this.getUniform(e),t),this},y.prototype.setFloatArray4=function(e,t){return this._valueCache[e]=null,this._engine.setFloatArray4(this.getUniform(e),t),this},y.prototype.setArray=function(e,t){return this._valueCache[e]=null,this._engine.setArray(this.getUniform(e),t),this},y.prototype.setArray2=function(e,t){return this._valueCache[e]=null,this._engine.setArray2(this.getUniform(e),t),this},y.prototype.setArray3=function(e,t){return this._valueCache[e]=null,this._engine.setArray3(this.getUniform(e),t),this},y.prototype.setArray4=function(e,t){return this._valueCache[e]=null,this._engine.setArray4(this.getUniform(e),t),this},y.prototype.setMatrices=function(e,t){return t&&(this._valueCache[e]=null,this._engine.setMatrices(this.getUniform(e),t)),this},y.prototype.setMatrix=function(e,t){return this._cacheMatrix(e,t)&&this._engine.setMatrix(this.getUniform(e),t),this},y.prototype.setMatrix3x3=function(e,t){return this._valueCache[e]=null,this._engine.setMatrix3x3(this.getUniform(e),t),this},y.prototype.setMatrix2x2=function(e,t){return this._valueCache[e]=null,this._engine.setMatrix2x2(this.getUniform(e),t),this},y.prototype.setFloat=function(e,t){var i=this._valueCache[e];return void 0!==i&&i===t||(this._valueCache[e]=t,this._engine.setFloat(this.getUniform(e),t)),this},y.prototype.setBool=function(e,t){var i=this._valueCache[e];return void 0!==i&&i===t||(this._valueCache[e]=t,this._engine.setBool(this.getUniform(e),t?1:0)),this},y.prototype.setVector2=function(e,t){return this._cacheFloat2(e,t.x,t.y)&&this._engine.setFloat2(this.getUniform(e),t.x,t.y),this},y.prototype.setFloat2=function(e,t,i){return this._cacheFloat2(e,t,i)&&this._engine.setFloat2(this.getUniform(e),t,i),this},y.prototype.setVector3=function(e,t){return this._cacheFloat3(e,t.x,t.y,t.z)&&this._engine.setFloat3(this.getUniform(e),t.x,t.y,t.z),this},y.prototype.setFloat3=function(e,t,i,r){return this._cacheFloat3(e,t,i,r)&&this._engine.setFloat3(this.getUniform(e),t,i,r),this},y.prototype.setVector4=function(e,t){return this._cacheFloat4(e,t.x,t.y,t.z,t.w)&&this._engine.setFloat4(this.getUniform(e),t.x,t.y,t.z,t.w),this},y.prototype.setFloat4=function(e,t,i,r,n){return this._cacheFloat4(e,t,i,r,n)&&this._engine.setFloat4(this.getUniform(e),t,i,r,n),this},y.prototype.setColor3=function(e,t){return this._cacheFloat3(e,t.r,t.g,t.b)&&this._engine.setColor3(this.getUniform(e),t),this},y.prototype.setColor4=function(e,t,i){return this._cacheFloat4(e,t.r,t.g,t.b,i)&&this._engine.setColor4(this.getUniform(e),t,i),this},y.prototype.setDirectColor4=function(e,t){return this._cacheFloat4(e,t.r,t.g,t.b,t.a)&&this._engine.setDirectColor4(this.getUniform(e),t),this},y.RegisterShader=function(e,t,i){t&&(y.ShadersStore[e+"PixelShader"]=t),i&&(y.ShadersStore[e+"VertexShader"]=i)},y.ResetCache=function(){y._baseCache={}},y._uniqueIdSeed=0,y._baseCache={},y.ShadersStore={},y.IncludesShadersStore={},y})();b.Effect=i})($a||($a={})),(function(e){var t=(function(){function e(){}return e.KEYDOWN=1,e.KEYUP=2,e})();e.KeyboardEventTypes=t;var i=function(e,t){this.type=e,this.event=t},r=(function(r){function e(e,t){var i=r.call(this,e,t)||this;return i.type=e,i.event=t,i.skipOnPointerObservable=!1,i}return T(e,r),e})(e.KeyboardInfo=i);e.KeyboardInfoPre=r})($a||($a={})),(function(s){var e=(function(){function e(){}return e.POINTERDOWN=1,e.POINTERUP=2,e.POINTERMOVE=4,e.POINTERWHEEL=8,e.POINTERPICK=16,e.POINTERTAP=32,e.POINTERDOUBLETAP=64,e})();s.PointerEventTypes=e;var t=function(e,t){this.type=e,this.event=t},i=(function(o){function e(e,t,i,r){var n=o.call(this,e,t)||this;return n.ray=null,n.skipOnPointerObservable=!1,n.localPosition=new s.Vector2(i,r),n}return T(e,o),e})(s.PointerInfoBase=t);s.PointerInfoPre=i;var r=(function(n){function e(e,t,i){var r=n.call(this,e,t)||this;return r.pickInfo=i,r}return T(e,n),e})(t);s.PointerInfo=r})($a||($a={})),(function(f){f.ToGammaSpace=1/2.2,f.ToLinearSpace=2.2,f.Epsilon=.001;var t=(function(){function n(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.r=e,this.g=t,this.b=i}return n.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+"}"},n.prototype.getClassName=function(){return"Color3"},n.prototype.getHashCode=function(){var e=this.r||0;return e=397*(e=397*e^(this.g||0))^(this.b||0)},n.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,this},n.prototype.toColor4=function(e){return void 0===e&&(e=1),new i(this.r,this.g,this.b,e)},n.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},n.prototype.toLuminance=function(){return.3*this.r+.59*this.g+.11*this.b},n.prototype.multiply=function(e){return new n(this.r*e.r,this.g*e.g,this.b*e.b)},n.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,this},n.prototype.equals=function(e){return e&&this.r===e.r&&this.g===e.g&&this.b===e.b},n.prototype.equalsFloats=function(e,t,i){return this.r===e&&this.g===t&&this.b===i},n.prototype.scale=function(e){return new n(this.r*e,this.g*e,this.b*e)},n.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,this},n.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,this},n.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=f.Scalar.Clamp(this.r,e,t),i.g=f.Scalar.Clamp(this.g,e,t),i.b=f.Scalar.Clamp(this.b,e,t),this},n.prototype.add=function(e){return new n(this.r+e.r,this.g+e.g,this.b+e.b)},n.prototype.addToRef=function(e,t){return t.r=this.r+e.r,t.g=this.g+e.g,t.b=this.b+e.b,this},n.prototype.subtract=function(e){return new n(this.r-e.r,this.g-e.g,this.b-e.b)},n.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,this},n.prototype.clone=function(){return new n(this.r,this.g,this.b)},n.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this},n.prototype.copyFromFloats=function(e,t,i){return this.r=e,this.g=t,this.b=i,this},n.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},n.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0;return"#"+f.Scalar.ToHex(e)+f.Scalar.ToHex(t)+f.Scalar.ToHex(i)},n.prototype.toLinearSpace=function(){var e=new n;return this.toLinearSpaceToRef(e),e},n.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,f.ToLinearSpace),e.g=Math.pow(this.g,f.ToLinearSpace),e.b=Math.pow(this.b,f.ToLinearSpace),this},n.prototype.toGammaSpace=function(){var e=new n;return this.toGammaSpaceToRef(e),e},n.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,f.ToGammaSpace),e.g=Math.pow(this.g,f.ToGammaSpace),e.b=Math.pow(this.b,f.ToGammaSpace),this},n.FromHexString=function(e){if("#"!==e.substring(0,1)||7!==e.length)return new n(0,0,0);var t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16);return n.FromInts(t,i,r)},n.FromArray=function(e,t){return void 0===t&&(t=0),new n(e[t],e[t+1],e[t+2])},n.FromInts=function(e,t,i){return new n(e/255,t/255,i/255)},n.Lerp=function(e,t,i){var r=new n(0,0,0);return n.LerpToRef(e,t,i,r),r},n.LerpToRef=function(e,t,i,r){r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i},n.Red=function(){return new n(1,0,0)},n.Green=function(){return new n(0,1,0)},n.Blue=function(){return new n(0,0,1)},n.Black=function(){return new n(0,0,0)},n.White=function(){return new n(1,1,1)},n.Purple=function(){return new n(.5,0,.5)},n.Magenta=function(){return new n(1,0,1)},n.Yellow=function(){return new n(1,1,0)},n.Gray=function(){return new n(.5,.5,.5)},n.Teal=function(){return new n(0,1,1)},n.Random=function(){return new n(Math.random(),Math.random(),Math.random())},n})();f.Color3=t;var i=(function(){function o(e,t,i,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=1),this.r=e,this.g=t,this.b=i,this.a=r}return o.prototype.addInPlace=function(e){return this.r+=e.r,this.g+=e.g,this.b+=e.b,this.a+=e.a,this},o.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},o.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.r,e[t+1]=this.g,e[t+2]=this.b,e[t+3]=this.a,this},o.prototype.add=function(e){return new o(this.r+e.r,this.g+e.g,this.b+e.b,this.a+e.a)},o.prototype.subtract=function(e){return new o(this.r-e.r,this.g-e.g,this.b-e.b,this.a-e.a)},o.prototype.subtractToRef=function(e,t){return t.r=this.r-e.r,t.g=this.g-e.g,t.b=this.b-e.b,t.a=this.a-e.a,this},o.prototype.scale=function(e){return new o(this.r*e,this.g*e,this.b*e,this.a*e)},o.prototype.scaleToRef=function(e,t){return t.r=this.r*e,t.g=this.g*e,t.b=this.b*e,t.a=this.a*e,this},o.prototype.scaleAndAddToRef=function(e,t){return t.r+=this.r*e,t.g+=this.g*e,t.b+=this.b*e,t.a+=this.a*e,this},o.prototype.clampToRef=function(e,t,i){return void 0===e&&(e=0),void 0===t&&(t=1),i.r=f.Scalar.Clamp(this.r,e,t),i.g=f.Scalar.Clamp(this.g,e,t),i.b=f.Scalar.Clamp(this.b,e,t),i.a=f.Scalar.Clamp(this.a,e,t),this},o.prototype.multiply=function(e){return new o(this.r*e.r,this.g*e.g,this.b*e.b,this.a*e.a)},o.prototype.multiplyToRef=function(e,t){return t.r=this.r*e.r,t.g=this.g*e.g,t.b=this.b*e.b,t.a=this.a*e.a,t},o.prototype.toString=function(){return"{R: "+this.r+" G:"+this.g+" B:"+this.b+" A:"+this.a+"}"},o.prototype.getClassName=function(){return"Color4"},o.prototype.getHashCode=function(){var e=this.r||0;return e=397*(e=397*(e=397*e^(this.g||0))^(this.b||0))^(this.a||0)},o.prototype.clone=function(){return new o(this.r,this.g,this.b,this.a)},o.prototype.copyFrom=function(e){return this.r=e.r,this.g=e.g,this.b=e.b,this.a=e.a,this},o.prototype.copyFromFloats=function(e,t,i,r){return this.r=e,this.g=t,this.b=i,this.a=r,this},o.prototype.set=function(e,t,i,r){return this.copyFromFloats(e,t,i,r)},o.prototype.toHexString=function(){var e=255*this.r|0,t=255*this.g|0,i=255*this.b|0,r=255*this.a|0;return"#"+f.Scalar.ToHex(e)+f.Scalar.ToHex(t)+f.Scalar.ToHex(i)+f.Scalar.ToHex(r)},o.prototype.toLinearSpace=function(){var e=new o;return this.toLinearSpaceToRef(e),e},o.prototype.toLinearSpaceToRef=function(e){return e.r=Math.pow(this.r,f.ToLinearSpace),e.g=Math.pow(this.g,f.ToLinearSpace),e.b=Math.pow(this.b,f.ToLinearSpace),e.a=this.a,this},o.prototype.toGammaSpace=function(){var e=new o;return this.toGammaSpaceToRef(e),e},o.prototype.toGammaSpaceToRef=function(e){return e.r=Math.pow(this.r,f.ToGammaSpace),e.g=Math.pow(this.g,f.ToGammaSpace),e.b=Math.pow(this.b,f.ToGammaSpace),e.a=this.a,this},o.FromHexString=function(e){if("#"!==e.substring(0,1)||9!==e.length)return new o(0,0,0,0);var t=parseInt(e.substring(1,3),16),i=parseInt(e.substring(3,5),16),r=parseInt(e.substring(5,7),16),n=parseInt(e.substring(7,9),16);return o.FromInts(t,i,r,n)},o.Lerp=function(e,t,i){var r=new o(0,0,0,0);return o.LerpToRef(e,t,i,r),r},o.LerpToRef=function(e,t,i,r){r.r=e.r+(t.r-e.r)*i,r.g=e.g+(t.g-e.g)*i,r.b=e.b+(t.b-e.b)*i,r.a=e.a+(t.a-e.a)*i},o.FromColor3=function(e,t){return void 0===t&&(t=1),new o(e.r,e.g,e.b,t)},o.FromArray=function(e,t){return void 0===t&&(t=0),new o(e[t],e[t+1],e[t+2],e[t+3])},o.FromInts=function(e,t,i,r){return new o(e/255,t/255,i/255,r/255)},o.CheckColors4=function(e,t){if(e.length===3*t){for(var i=[],r=0;r<e.length;r+=3){var n=r/3*4;i[n]=e[r],i[n+1]=e[r+1],i[n+2]=e[r+2],i[n+3]=1}return i}return e},o})();f.Color4=i;var p=(function(){function u(e,t){void 0===e&&(e=0),void 0===t&&(t=0),this.x=e,this.y=t}return u.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+"}"},u.prototype.getClassName=function(){return"Vector2"},u.prototype.getHashCode=function(){var e=this.x||0;return e=397*e^(this.y||0)},u.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,this},u.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},u.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this},u.prototype.copyFromFloats=function(e,t){return this.x=e,this.y=t,this},u.prototype.set=function(e,t){return this.copyFromFloats(e,t)},u.prototype.add=function(e){return new u(this.x+e.x,this.y+e.y)},u.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,this},u.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this},u.prototype.addVector3=function(e){return new u(this.x+e.x,this.y+e.y)},u.prototype.subtract=function(e){return new u(this.x-e.x,this.y-e.y)},u.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,this},u.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this},u.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this},u.prototype.multiply=function(e){return new u(this.x*e.x,this.y*e.y)},u.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,this},u.prototype.multiplyByFloats=function(e,t){return new u(this.x*e,this.y*t)},u.prototype.divide=function(e){return new u(this.x/e.x,this.y/e.y)},u.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,this},u.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},u.prototype.negate=function(){return new u(-this.x,-this.y)},u.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this},u.prototype.scale=function(e){var t=new u(0,0);return this.scaleToRef(e,t),t},u.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,this},u.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,this},u.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y},u.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=f.Epsilon),e&&f.Scalar.WithinEpsilon(this.x,e.x,t)&&f.Scalar.WithinEpsilon(this.y,e.y,t)},u.prototype.floor=function(){return new u(Math.floor(this.x),Math.floor(this.y))},u.prototype.fract=function(){return new u(this.x-Math.floor(this.x),this.y-Math.floor(this.y))},u.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y)},u.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y},u.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this},u.prototype.clone=function(){return new u(this.x,this.y)},u.Zero=function(){return new u(0,0)},u.One=function(){return new u(1,1)},u.FromArray=function(e,t){return void 0===t&&(t=0),new u(e[t],e[t+1])},u.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1]},u.CatmullRom=function(e,t,i,r,n){var o=n*n,s=n*o;return new u(.5*(2*t.x+(-e.x+i.x)*n+(2*e.x-5*t.x+4*i.x-r.x)*o+(-e.x+3*t.x-3*i.x+r.x)*s),.5*(2*t.y+(-e.y+i.y)*n+(2*e.y-5*t.y+4*i.y-r.y)*o+(-e.y+3*t.y-3*i.y+r.y)*s))},u.Clamp=function(e,t,i){var r=e.x;r=(r=r>i.x?i.x:r)<t.x?t.x:r;var n=e.y;return new u(r,n=(n=n>i.y?i.y:n)<t.y?t.y:n)},u.Hermite=function(e,t,i,r,n){var o=n*n,s=n*o,a=2*s-3*o+1,l=-2*s+3*o,c=s-2*o+n,h=s-o;return new u(e.x*a+i.x*l+t.x*c+r.x*h,e.y*a+i.y*l+t.y*c+r.y*h)},u.Lerp=function(e,t,i){return new u(e.x+(t.x-e.x)*i,e.y+(t.y-e.y)*i)},u.Dot=function(e,t){return e.x*t.x+e.y*t.y},u.Normalize=function(e){var t=e.clone();return t.normalize(),t},u.Minimize=function(e,t){return new u(e.x<t.x?e.x:t.x,e.y<t.y?e.y:t.y)},u.Maximize=function(e,t){return new u(e.x>t.x?e.x:t.x,e.y>t.y?e.y:t.y)},u.Transform=function(e,t){var i=u.Zero();return u.TransformToRef(e,t,i),i},u.TransformToRef=function(e,t,i){var r=e.x*t.m[0]+e.y*t.m[4]+t.m[12],n=e.x*t.m[1]+e.y*t.m[5]+t.m[13];i.x=r,i.y=n},u.PointInTriangle=function(e,t,i,r){var n=.5*(-i.y*r.x+t.y*(-i.x+r.x)+t.x*(i.y-r.y)+i.x*r.y),o=n<0?-1:1,s=(t.y*r.x-t.x*r.y+(r.y-t.y)*e.x+(t.x-r.x)*e.y)*o,a=(t.x*i.y-t.y*i.x+(t.y-i.y)*e.x+(i.x-t.x)*e.y)*o;return 0<s&&0<a&&s+a<2*n*o},u.Distance=function(e,t){return Math.sqrt(u.DistanceSquared(e,t))},u.DistanceSquared=function(e,t){var i=e.x-t.x,r=e.y-t.y;return i*i+r*r},u.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},u.DistanceOfPointFromSegment=function(e,t,i){var r=u.DistanceSquared(t,i);if(0===r)return u.Distance(e,t);var n=i.subtract(t),o=Math.max(0,Math.min(1,u.Dot(e.subtract(t),n)/r)),s=t.add(n.multiplyByFloats(o,o));return u.Distance(e,s)},u})();f.Vector2=p;var _=(function(){function d(e,t,i){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),this.x=e,this.y=t,this.z=i}return d.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+"}"},d.prototype.getClassName=function(){return"Vector3"},d.prototype.getHashCode=function(){var e=this.x||0;return e=397*(e=397*e^(this.y||0))^(this.z||0)},d.prototype.asArray=function(){var e=[];return this.toArray(e,0),e},d.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,this},d.prototype.toQuaternion=function(){return f.Quaternion.RotationYawPitchRoll(this.x,this.y,this.z)},d.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this},d.prototype.add=function(e){return new d(this.x+e.x,this.y+e.y,this.z+e.z)},d.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,this},d.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this},d.prototype.subtract=function(e){return new d(this.x-e.x,this.y-e.y,this.z-e.z)},d.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,this},d.prototype.subtractFromFloats=function(e,t,i){return new d(this.x-e,this.y-t,this.z-i)},d.prototype.subtractFromFloatsToRef=function(e,t,i,r){return r.x=this.x-e,r.y=this.y-t,r.z=this.z-i,this},d.prototype.negate=function(){return new d(-this.x,-this.y,-this.z)},d.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this},d.prototype.scale=function(e){return new d(this.x*e,this.y*e,this.z*e)},d.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,this},d.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,this},d.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z},d.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=f.Epsilon),e&&f.Scalar.WithinEpsilon(this.x,e.x,t)&&f.Scalar.WithinEpsilon(this.y,e.y,t)&&f.Scalar.WithinEpsilon(this.z,e.z,t)},d.prototype.equalsToFloats=function(e,t,i){return this.x===e&&this.y===t&&this.z===i},d.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this},d.prototype.multiply=function(e){return new d(this.x*e.x,this.y*e.y,this.z*e.z)},d.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,this},d.prototype.multiplyByFloats=function(e,t,i){return new d(this.x*e,this.y*t,this.z*i)},d.prototype.divide=function(e){return new d(this.x/e.x,this.y/e.y,this.z/e.z)},d.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,this},d.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},d.prototype.minimizeInPlace=function(e){return this.minimizeInPlaceFromFloats(e.x,e.y,e.z)},d.prototype.maximizeInPlace=function(e){return this.maximizeInPlaceFromFloats(e.x,e.y,e.z)},d.prototype.minimizeInPlaceFromFloats=function(e,t,i){return e<this.x&&(this.x=e),t<this.y&&(this.y=t),i<this.z&&(this.z=i),this},d.prototype.maximizeInPlaceFromFloats=function(e,t,i){return e>this.x&&(this.x=e),t>this.y&&(this.y=t),i>this.z&&(this.z=i),this},Object.defineProperty(d.prototype,"isNonUniform",{get:function(){var e=Math.abs(this.x),t=Math.abs(this.y);if(e!==t)return!0;var i=Math.abs(this.z);return e!==i||t!==i},enumerable:!0,configurable:!0}),d.prototype.floor=function(){return new d(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z))},d.prototype.fract=function(){return new d(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z))},d.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z)},d.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z},d.prototype.normalize=function(){var e=this.length();if(0===e||1===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this},d.prototype.normalizeToNew=function(){var e=new d(0,0,0);return this.normalizeToRef(e),e},d.prototype.normalizeToRef=function(e){var t=this.length();if(0===t||1===t)return e.set(this.x,this.y,this.z),e;var i=1/t;return this.scaleToRef(i,e),e},d.prototype.clone=function(){return new d(this.x,this.y,this.z)},d.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this},d.prototype.copyFromFloats=function(e,t,i){return this.x=e,this.y=t,this.z=i,this},d.prototype.set=function(e,t,i){return this.copyFromFloats(e,t,i)},d.GetClipFactor=function(e,t,i,r){var n=d.Dot(e,i)-r;return n/(n-(d.Dot(t,i)-r))},d.GetAngleBetweenVectors=function(e,t,i){var r=A.Vector3[1].copyFrom(e).normalize(),n=A.Vector3[2].copyFrom(t).normalize(),o=d.Dot(r,n),s=A.Vector3[3];return d.CrossToRef(r,n,s),0<d.Dot(s,i)?Math.acos(o):-Math.acos(o)},d.FromArray=function(e,t){return t||(t=0),new d(e[t],e[t+1],e[t+2])},d.FromFloatArray=function(e,t){return d.FromArray(e,t)},d.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2]},d.FromFloatArrayToRef=function(e,t,i){return d.FromArrayToRef(e,t,i)},d.FromFloatsToRef=function(e,t,i,r){r.x=e,r.y=t,r.z=i},d.Zero=function(){return new d(0,0,0)},d.One=function(){return new d(1,1,1)},d.Up=function(){return new d(0,1,0)},d.Down=function(){return new d(0,-1,0)},d.Forward=function(){return new d(0,0,1)},d.Backward=function(){return new d(0,0,-1)},d.Right=function(){return new d(1,0,0)},d.Left=function(){return new d(-1,0,0)},d.TransformCoordinates=function(e,t){var i=d.Zero();return d.TransformCoordinatesToRef(e,t,i),i},d.TransformCoordinatesToRef=function(e,t,i){var r=e.x*t.m[0]+e.y*t.m[4]+e.z*t.m[8]+t.m[12],n=e.x*t.m[1]+e.y*t.m[5]+e.z*t.m[9]+t.m[13],o=e.x*t.m[2]+e.y*t.m[6]+e.z*t.m[10]+t.m[14],s=e.x*t.m[3]+e.y*t.m[7]+e.z*t.m[11]+t.m[15];i.x=r/s,i.y=n/s,i.z=o/s},d.TransformCoordinatesFromFloatsToRef=function(e,t,i,r,n){var o=e*r.m[0]+t*r.m[4]+i*r.m[8]+r.m[12],s=e*r.m[1]+t*r.m[5]+i*r.m[9]+r.m[13],a=e*r.m[2]+t*r.m[6]+i*r.m[10]+r.m[14],l=e*r.m[3]+t*r.m[7]+i*r.m[11]+r.m[15];n.x=o/l,n.y=s/l,n.z=a/l},d.TransformNormal=function(e,t){var i=d.Zero();return d.TransformNormalToRef(e,t,i),i},d.TransformNormalToRef=function(e,t,i){var r=e.x*t.m[0]+e.y*t.m[4]+e.z*t.m[8],n=e.x*t.m[1]+e.y*t.m[5]+e.z*t.m[9],o=e.x*t.m[2]+e.y*t.m[6]+e.z*t.m[10];i.x=r,i.y=n,i.z=o},d.TransformNormalFromFloatsToRef=function(e,t,i,r,n){n.x=e*r.m[0]+t*r.m[4]+i*r.m[8],n.y=e*r.m[1]+t*r.m[5]+i*r.m[9],n.z=e*r.m[2]+t*r.m[6]+i*r.m[10]},d.CatmullRom=function(e,t,i,r,n){var o=n*n,s=n*o;return new d(.5*(2*t.x+(-e.x+i.x)*n+(2*e.x-5*t.x+4*i.x-r.x)*o+(-e.x+3*t.x-3*i.x+r.x)*s),.5*(2*t.y+(-e.y+i.y)*n+(2*e.y-5*t.y+4*i.y-r.y)*o+(-e.y+3*t.y-3*i.y+r.y)*s),.5*(2*t.z+(-e.z+i.z)*n+(2*e.z-5*t.z+4*i.z-r.z)*o+(-e.z+3*t.z-3*i.z+r.z)*s))},d.Clamp=function(e,t,i){var r=e.x;r=(r=r>i.x?i.x:r)<t.x?t.x:r;var n=e.y;n=(n=n>i.y?i.y:n)<t.y?t.y:n;var o=e.z;return new d(r,n,o=(o=o>i.z?i.z:o)<t.z?t.z:o)},d.Hermite=function(e,t,i,r,n){var o=n*n,s=n*o,a=2*s-3*o+1,l=-2*s+3*o,c=s-2*o+n,h=s-o;return new d(e.x*a+i.x*l+t.x*c+r.x*h,e.y*a+i.y*l+t.y*c+r.y*h,e.z*a+i.z*l+t.z*c+r.z*h)},d.Lerp=function(e,t,i){var r=new d(0,0,0);return d.LerpToRef(e,t,i,r),r},d.LerpToRef=function(e,t,i,r){r.x=e.x+(t.x-e.x)*i,r.y=e.y+(t.y-e.y)*i,r.z=e.z+(t.z-e.z)*i},d.Dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z},d.Cross=function(e,t){var i=d.Zero();return d.CrossToRef(e,t,i),i},d.CrossToRef=function(e,t,i){A.Vector3[0].x=e.y*t.z-e.z*t.y,A.Vector3[0].y=e.z*t.x-e.x*t.z,A.Vector3[0].z=e.x*t.y-e.y*t.x,i.copyFrom(A.Vector3[0])},d.Normalize=function(e){var t=d.Zero();return d.NormalizeToRef(e,t),t},d.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},d.Project=function(e,t,i,r){var n=r.width,o=r.height,s=r.x,a=r.y,l=d._viewportMatrixCache?d._viewportMatrixCache:d._viewportMatrixCache=new h;h.FromValuesToRef(n/2,0,0,0,0,-o/2,0,0,0,0,.5,0,s+n/2,o/2+a,.5,1,l);var c=A.Matrix[0];return t.multiplyToRef(i,c),c.multiplyToRef(l,c),d.TransformCoordinates(e,c)},d.UnprojectFromTransform=function(e,t,i,r,n){var o=A.Matrix[0];r.multiplyToRef(n,o),o.invert(),e.x=e.x/t*2-1,e.y=-(e.y/i*2-1);var s=d.TransformCoordinates(e,o),a=e.x*o.m[3]+e.y*o.m[7]+e.z*o.m[11]+o.m[15];return f.Scalar.WithinEpsilon(a,1)&&(s=s.scale(1/a)),s},d.Unproject=function(e,t,i,r,n,o){var s=d.Zero();return d.UnprojectToRef(e,t,i,r,n,o,s),s},d.UnprojectToRef=function(e,t,i,r,n,o,s){d.UnprojectFloatsToRef(e.x,e.y,e.z,t,i,r,n,o,s)},d.UnprojectFloatsToRef=function(e,t,i,r,n,o,s,a,l){var c=A.Matrix[0];o.multiplyToRef(s,c),c.multiplyToRef(a,c),c.invert();var h=A.Vector3[0];h.x=e/r*2-1,h.y=-(t/n*2-1),h.z=2*i-1,d.TransformCoordinatesToRef(h,c,l);var u=h.x*c.m[3]+h.y*c.m[7]+h.z*c.m[11]+c.m[15];f.Scalar.WithinEpsilon(u,1)&&l.scaleInPlace(1/u)},d.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},d.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},d.Distance=function(e,t){return Math.sqrt(d.DistanceSquared(e,t))},d.DistanceSquared=function(e,t){var i=e.x-t.x,r=e.y-t.y,n=e.z-t.z;return i*i+r*r+n*n},d.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},d.RotationFromAxis=function(e,t,i){var r=d.Zero();return d.RotationFromAxisToRef(e,t,i,r),r},d.RotationFromAxisToRef=function(e,t,i,r){var n=A.Quaternion[0];m.RotationQuaternionFromAxisToRef(e,t,i,n),n.toEulerAnglesToRef(r)},d})();f.Vector3=_;var r=(function(){function n(e,t,i,r){this.x=e,this.y=t,this.z=i,this.w=r}return n.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},n.prototype.getClassName=function(){return"Vector4"},n.prototype.getHashCode=function(){var e=this.x||0;return e=397*(e=397*(e=397*e^(this.y||0))^(this.z||0))^(this.w||0)},n.prototype.asArray=function(){var e=new Array;return this.toArray(e,0),e},n.prototype.toArray=function(e,t){return void 0===t&&(t=0),e[t]=this.x,e[t+1]=this.y,e[t+2]=this.z,e[t+3]=this.w,this},n.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},n.prototype.add=function(e){return new n(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},n.prototype.addToRef=function(e,t){return t.x=this.x+e.x,t.y=this.y+e.y,t.z=this.z+e.z,t.w=this.w+e.w,this},n.prototype.subtractInPlace=function(e){return this.x-=e.x,this.y-=e.y,this.z-=e.z,this.w-=e.w,this},n.prototype.subtract=function(e){return new n(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},n.prototype.subtractToRef=function(e,t){return t.x=this.x-e.x,t.y=this.y-e.y,t.z=this.z-e.z,t.w=this.w-e.w,this},n.prototype.subtractFromFloats=function(e,t,i,r){return new n(this.x-e,this.y-t,this.z-i,this.w-r)},n.prototype.subtractFromFloatsToRef=function(e,t,i,r,n){return n.x=this.x-e,n.y=this.y-t,n.z=this.z-i,n.w=this.w-r,this},n.prototype.negate=function(){return new n(-this.x,-this.y,-this.z,-this.w)},n.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},n.prototype.scale=function(e){return new n(this.x*e,this.y*e,this.z*e,this.w*e)},n.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,this},n.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,this},n.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},n.prototype.equalsWithEpsilon=function(e,t){return void 0===t&&(t=f.Epsilon),e&&f.Scalar.WithinEpsilon(this.x,e.x,t)&&f.Scalar.WithinEpsilon(this.y,e.y,t)&&f.Scalar.WithinEpsilon(this.z,e.z,t)&&f.Scalar.WithinEpsilon(this.w,e.w,t)},n.prototype.equalsToFloats=function(e,t,i,r){return this.x===e&&this.y===t&&this.z===i&&this.w===r},n.prototype.multiplyInPlace=function(e){return this.x*=e.x,this.y*=e.y,this.z*=e.z,this.w*=e.w,this},n.prototype.multiply=function(e){return new n(this.x*e.x,this.y*e.y,this.z*e.z,this.w*e.w)},n.prototype.multiplyToRef=function(e,t){return t.x=this.x*e.x,t.y=this.y*e.y,t.z=this.z*e.z,t.w=this.w*e.w,this},n.prototype.multiplyByFloats=function(e,t,i,r){return new n(this.x*e,this.y*t,this.z*i,this.w*r)},n.prototype.divide=function(e){return new n(this.x/e.x,this.y/e.y,this.z/e.z,this.w/e.w)},n.prototype.divideToRef=function(e,t){return t.x=this.x/e.x,t.y=this.y/e.y,t.z=this.z/e.z,t.w=this.w/e.w,this},n.prototype.divideInPlace=function(e){return this.divideToRef(e,this)},n.prototype.minimizeInPlace=function(e){return e.x<this.x&&(this.x=e.x),e.y<this.y&&(this.y=e.y),e.z<this.z&&(this.z=e.z),e.w<this.w&&(this.w=e.w),this},n.prototype.maximizeInPlace=function(e){return e.x>this.x&&(this.x=e.x),e.y>this.y&&(this.y=e.y),e.z>this.z&&(this.z=e.z),e.w>this.w&&(this.w=e.w),this},n.prototype.floor=function(){return new n(Math.floor(this.x),Math.floor(this.y),Math.floor(this.z),Math.floor(this.w))},n.prototype.fract=function(){return new n(this.x-Math.floor(this.x),this.y-Math.floor(this.y),this.z-Math.floor(this.z),this.w-Math.floor(this.w))},n.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},n.prototype.lengthSquared=function(){return this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w},n.prototype.normalize=function(){var e=this.length();if(0===e)return this;var t=1/e;return this.x*=t,this.y*=t,this.z*=t,this.w*=t,this},n.prototype.toVector3=function(){return new _(this.x,this.y,this.z)},n.prototype.clone=function(){return new n(this.x,this.y,this.z,this.w)},n.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},n.prototype.copyFromFloats=function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},n.prototype.set=function(e,t,i,r){return this.copyFromFloats(e,t,i,r)},n.FromArray=function(e,t){return t||(t=0),new n(e[t],e[t+1],e[t+2],e[t+3])},n.FromArrayToRef=function(e,t,i){i.x=e[t],i.y=e[t+1],i.z=e[t+2],i.w=e[t+3]},n.FromFloatArrayToRef=function(e,t,i){n.FromArrayToRef(e,t,i)},n.FromFloatsToRef=function(e,t,i,r,n){n.x=e,n.y=t,n.z=i,n.w=r},n.Zero=function(){return new n(0,0,0,0)},n.One=function(){return new n(1,1,1,1)},n.Normalize=function(e){var t=n.Zero();return n.NormalizeToRef(e,t),t},n.NormalizeToRef=function(e,t){t.copyFrom(e),t.normalize()},n.Minimize=function(e,t){var i=e.clone();return i.minimizeInPlace(t),i},n.Maximize=function(e,t){var i=e.clone();return i.maximizeInPlace(t),i},n.Distance=function(e,t){return Math.sqrt(n.DistanceSquared(e,t))},n.DistanceSquared=function(e,t){var i=e.x-t.x,r=e.y-t.y,n=e.z-t.z,o=e.w-t.w;return i*i+r*r+n*n+o*o},n.Center=function(e,t){var i=e.add(t);return i.scaleInPlace(.5),i},n.TransformNormal=function(e,t){var i=n.Zero();return n.TransformNormalToRef(e,t,i),i},n.TransformNormalToRef=function(e,t,i){var r=e.x*t.m[0]+e.y*t.m[4]+e.z*t.m[8],n=e.x*t.m[1]+e.y*t.m[5]+e.z*t.m[9],o=e.x*t.m[2]+e.y*t.m[6]+e.z*t.m[10];i.x=r,i.y=n,i.z=o,i.w=e.w},n.TransformNormalFromFloatsToRef=function(e,t,i,r,n,o){o.x=e*n.m[0]+t*n.m[4]+i*n.m[8],o.y=e*n.m[1]+t*n.m[5]+i*n.m[9],o.z=e*n.m[2]+t*n.m[6]+i*n.m[10],o.w=r},n})();f.Vector4=r;var e=(function(){function r(e,t){this.width=e,this.height=t}return r.prototype.toString=function(){return"{W: "+this.width+", H: "+this.height+"}"},r.prototype.getClassName=function(){return"Size"},r.prototype.getHashCode=function(){var e=this.width||0;return e=397*e^(this.height||0)},r.prototype.copyFrom=function(e){this.width=e.width,this.height=e.height},r.prototype.copyFromFloats=function(e,t){return this.width=e,this.height=t,this},r.prototype.set=function(e,t){return this.copyFromFloats(e,t)},r.prototype.multiplyByFloats=function(e,t){return new r(this.width*e,this.height*t)},r.prototype.clone=function(){return new r(this.width,this.height)},r.prototype.equals=function(e){return!!e&&(this.width===e.width&&this.height===e.height)},Object.defineProperty(r.prototype,"surface",{get:function(){return this.width*this.height},enumerable:!0,configurable:!0}),r.Zero=function(){return new r(0,0)},r.prototype.add=function(e){return new r(this.width+e.width,this.height+e.height)},r.prototype.subtract=function(e){return new r(this.width-e.width,this.height-e.height)},r.Lerp=function(e,t,i){return new r(e.width+(t.width-e.width)*i,e.height+(t.height-e.height)*i)},r})();f.Size=e;var m=(function(){function u(e,t,i,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=1),this.x=e,this.y=t,this.z=i,this.w=r}return u.prototype.toString=function(){return"{X: "+this.x+" Y:"+this.y+" Z:"+this.z+" W:"+this.w+"}"},u.prototype.getClassName=function(){return"Quaternion"},u.prototype.getHashCode=function(){var e=this.x||0;return e=397*(e=397*(e=397*e^(this.y||0))^(this.z||0))^(this.w||0)},u.prototype.asArray=function(){return[this.x,this.y,this.z,this.w]},u.prototype.equals=function(e){return e&&this.x===e.x&&this.y===e.y&&this.z===e.z&&this.w===e.w},u.prototype.clone=function(){return new u(this.x,this.y,this.z,this.w)},u.prototype.copyFrom=function(e){return this.x=e.x,this.y=e.y,this.z=e.z,this.w=e.w,this},u.prototype.copyFromFloats=function(e,t,i,r){return this.x=e,this.y=t,this.z=i,this.w=r,this},u.prototype.set=function(e,t,i,r){return this.copyFromFloats(e,t,i,r)},u.prototype.add=function(e){return new u(this.x+e.x,this.y+e.y,this.z+e.z,this.w+e.w)},u.prototype.addInPlace=function(e){return this.x+=e.x,this.y+=e.y,this.z+=e.z,this.w+=e.w,this},u.prototype.subtract=function(e){return new u(this.x-e.x,this.y-e.y,this.z-e.z,this.w-e.w)},u.prototype.scale=function(e){return new u(this.x*e,this.y*e,this.z*e,this.w*e)},u.prototype.scaleToRef=function(e,t){return t.x=this.x*e,t.y=this.y*e,t.z=this.z*e,t.w=this.w*e,this},u.prototype.scaleInPlace=function(e){return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},u.prototype.scaleAndAddToRef=function(e,t){return t.x+=this.x*e,t.y+=this.y*e,t.z+=this.z*e,t.w+=this.w*e,this},u.prototype.multiply=function(e){var t=new u(0,0,0,1);return this.multiplyToRef(e,t),t},u.prototype.multiplyToRef=function(e,t){var i=this.x*e.w+this.y*e.z-this.z*e.y+this.w*e.x,r=-this.x*e.z+this.y*e.w+this.z*e.x+this.w*e.y,n=this.x*e.y-this.y*e.x+this.z*e.w+this.w*e.z,o=-this.x*e.x-this.y*e.y-this.z*e.z+this.w*e.w;return t.copyFromFloats(i,r,n,o),this},u.prototype.multiplyInPlace=function(e){return this.multiplyToRef(e,this),this},u.prototype.conjugateToRef=function(e){return e.copyFromFloats(-this.x,-this.y,-this.z,this.w),this},u.prototype.conjugateInPlace=function(){return this.x*=-1,this.y*=-1,this.z*=-1,this},u.prototype.conjugate=function(){return new u(-this.x,-this.y,-this.z,this.w)},u.prototype.length=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.z*this.z+this.w*this.w)},u.prototype.normalize=function(){var e=1/this.length();return this.x*=e,this.y*=e,this.z*=e,this.w*=e,this},u.prototype.toEulerAngles=function(e){void 0===e&&(e="YZX");var t=_.Zero();return this.toEulerAnglesToRef(t,e),t},u.prototype.toEulerAnglesToRef=function(e,t){void 0===t&&(t="YZX");var i=this.z,r=this.x,n=this.y,o=this.w,s=o*o,a=i*i,l=r*r,c=n*n,h=n*i-r*o;return h<-.4999999?(e.y=2*Math.atan2(n,o),e.x=Math.PI/2,e.z=0):.4999999<h?(e.y=2*Math.atan2(n,o),e.x=-Math.PI/2,e.z=0):(e.z=Math.atan2(2*(r*n+i*o),-a-l+c+s),e.x=Math.asin(-2*(i*n-r*o)),e.y=Math.atan2(2*(i*r+n*o),a-l-c+s)),this},u.prototype.toRotationMatrix=function(e){var t=this.x*this.x,i=this.y*this.y,r=this.z*this.z,n=this.x*this.y,o=this.z*this.w,s=this.z*this.x,a=this.y*this.w,l=this.y*this.z,c=this.x*this.w;return e.m[0]=1-2*(i+r),e.m[1]=2*(n+o),e.m[2]=2*(s-a),e.m[3]=0,e.m[4]=2*(n-o),e.m[5]=1-2*(r+t),e.m[6]=2*(l+c),e.m[7]=0,e.m[8]=2*(s+a),e.m[9]=2*(l-c),e.m[10]=1-2*(i+t),e.m[11]=0,e.m[12]=0,e.m[13]=0,e.m[14]=0,e.m[15]=1,e._markAsUpdated(),this},u.prototype.fromRotationMatrix=function(e){return u.FromRotationMatrixToRef(e,this),this},u.FromRotationMatrix=function(e){var t=new u;return u.FromRotationMatrixToRef(e,t),t},u.FromRotationMatrixToRef=function(e,t){var i,r=e.m,n=r[0],o=r[4],s=r[8],a=r[1],l=r[5],c=r[9],h=r[2],u=r[6],d=r[10],f=n+l+d;0<f?(i=.5/Math.sqrt(f+1),t.w=.25/i,t.x=(u-c)*i,t.y=(s-h)*i,t.z=(a-o)*i):l<n&&d<n?(i=2*Math.sqrt(1+n-l-d),t.w=(u-c)/i,t.x=.25*i,t.y=(o+a)/i,t.z=(s+h)/i):d<l?(i=2*Math.sqrt(1+l-n-d),t.w=(s-h)/i,t.x=(o+a)/i,t.y=.25*i,t.z=(c+u)/i):(i=2*Math.sqrt(1+d-n-l),t.w=(a-o)/i,t.x=(s+h)/i,t.y=(c+u)/i,t.z=.25*i)},u.Dot=function(e,t){return e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w},u.AreClose=function(e,t){return 0<=u.Dot(e,t)},u.Zero=function(){return new u(0,0,0,0)},u.Inverse=function(e){return new u(-e.x,-e.y,-e.z,e.w)},u.Identity=function(){return new u(0,0,0,1)},u.IsIdentity=function(e){return e&&0===e.x&&0===e.y&&0===e.z&&1===e.w},u.RotationAxis=function(e,t){return u.RotationAxisToRef(e,t,new u)},u.RotationAxisToRef=function(e,t,i){var r=Math.sin(t/2);return e.normalize(),i.w=Math.cos(t/2),i.x=e.x*r,i.y=e.y*r,i.z=e.z*r,i},u.FromArray=function(e,t){return t||(t=0),new u(e[t],e[t+1],e[t+2],e[t+3])},u.RotationYawPitchRoll=function(e,t,i){var r=new u;return u.RotationYawPitchRollToRef(e,t,i,r),r},u.RotationYawPitchRollToRef=function(e,t,i,r){var n=.5*i,o=.5*t,s=.5*e,a=Math.sin(n),l=Math.cos(n),c=Math.sin(o),h=Math.cos(o),u=Math.sin(s),d=Math.cos(s);r.x=d*c*l+u*h*a,r.y=u*h*l-d*c*a,r.z=d*h*a-u*c*l,r.w=d*h*l+u*c*a},u.RotationAlphaBetaGamma=function(e,t,i){var r=new u;return u.RotationAlphaBetaGammaToRef(e,t,i,r),r},u.RotationAlphaBetaGammaToRef=function(e,t,i,r){var n=.5*(i+e),o=.5*(i-e),s=.5*t;r.x=Math.cos(o)*Math.sin(s),r.y=Math.sin(o)*Math.sin(s),r.z=Math.sin(n)*Math.cos(s),r.w=Math.cos(n)*Math.cos(s)},u.RotationQuaternionFromAxis=function(e,t,i){var r=new u(0,0,0,0);return u.RotationQuaternionFromAxisToRef(e,t,i,r),r},u.RotationQuaternionFromAxisToRef=function(e,t,i,r){var n=A.Matrix[0];h.FromXYZAxesToRef(e.normalize(),t.normalize(),i.normalize(),n),u.FromRotationMatrixToRef(n,r)},u.Slerp=function(e,t,i){var r=u.Identity();return u.SlerpToRef(e,t,i,r),r},u.SlerpToRef=function(e,t,i,r){var n,o,s=e.x*t.x+e.y*t.y+e.z*t.z+e.w*t.w,a=!1;if(s<0&&(a=!0,s=-s),.999999<s)o=1-i,n=a?-i:i;else{var l=Math.acos(s),c=1/Math.sin(l);o=Math.sin((1-i)*l)*c,n=a?-Math.sin(i*l)*c:Math.sin(i*l)*c}r.x=o*e.x+n*t.x,r.y=o*e.y+n*t.y,r.z=o*e.z+n*t.z,r.w=o*e.w+n*t.w},u.Hermite=function(e,t,i,r,n){var o=n*n,s=n*o,a=2*s-3*o+1,l=-2*s+3*o,c=s-2*o+n,h=s-o;return new u(e.x*a+i.x*l+t.x*c+r.x*h,e.y*a+i.y*l+t.y*c+r.y*h,e.z*a+i.z*l+t.z*c+r.z*h,e.w*a+i.w*l+t.w*c+r.w*h)},u})();f.Quaternion=m;var h=(function(){function g(){this._isIdentity=!1,this._isIdentityDirty=!0,this.m=new Float32Array(16),this._markAsUpdated()}return g.prototype._markAsUpdated=function(){this.updateFlag=g._updateFlagSeed++,this._isIdentityDirty=!0},g.prototype.isIdentity=function(e){return void 0===e&&(e=!1),this._isIdentityDirty&&(this._isIdentityDirty=!1,1!==this.m[0]||1!==this.m[5]||1!==this.m[15]?this._isIdentity=!1:0!==this.m[1]||0!==this.m[2]||0!==this.m[3]||0!==this.m[4]||0!==this.m[6]||0!==this.m[7]||0!==this.m[8]||0!==this.m[9]||0!==this.m[11]||0!==this.m[12]||0!==this.m[13]||0!==this.m[14]?this._isIdentity=!1:this._isIdentity=!0,e||1===this.m[10]||(this._isIdentity=!1)),this._isIdentity},g.prototype.determinant=function(){var e=this.m[10]*this.m[15]-this.m[11]*this.m[14],t=this.m[9]*this.m[15]-this.m[11]*this.m[13],i=this.m[9]*this.m[14]-this.m[10]*this.m[13],r=this.m[8]*this.m[15]-this.m[11]*this.m[12],n=this.m[8]*this.m[14]-this.m[10]*this.m[12],o=this.m[8]*this.m[13]-this.m[9]*this.m[12];return this.m[0]*(this.m[5]*e-this.m[6]*t+this.m[7]*i)-this.m[1]*(this.m[4]*e-this.m[6]*r+this.m[7]*n)+this.m[2]*(this.m[4]*t-this.m[5]*r+this.m[7]*o)-this.m[3]*(this.m[4]*i-this.m[5]*n+this.m[6]*o)},g.prototype.toArray=function(){return this.m},g.prototype.asArray=function(){return this.toArray()},g.prototype.invert=function(){return this.invertToRef(this),this},g.prototype.reset=function(){for(var e=0;e<16;e++)this.m[e]=0;return this._markAsUpdated(),this},g.prototype.add=function(e){var t=new g;return this.addToRef(e,t),t},g.prototype.addToRef=function(e,t){for(var i=0;i<16;i++)t.m[i]=this.m[i]+e.m[i];return t._markAsUpdated(),this},g.prototype.addToSelf=function(e){for(var t=0;t<16;t++)this.m[t]+=e.m[t];return this._markAsUpdated(),this},g.prototype.invertToRef=function(e){var t=this.m[0],i=this.m[1],r=this.m[2],n=this.m[3],o=this.m[4],s=this.m[5],a=this.m[6],l=this.m[7],c=this.m[8],h=this.m[9],u=this.m[10],d=this.m[11],f=this.m[12],p=this.m[13],_=this.m[14],m=this.m[15],g=u*m-d*_,v=h*m-d*p,y=h*_-u*p,b=c*m-d*f,T=c*_-u*f,E=c*p-h*f,x=s*g-a*v+l*y,P=-(o*g-a*b+l*T),A=o*v-s*b+l*E,S=-(o*y-s*T+a*E),M=1/(t*x+i*P+r*A+n*S),R=a*m-l*_,C=s*m-l*p,O=s*_-a*p,D=o*m-l*f,I=o*_-a*f,w=o*p-s*f,L=a*d-l*u,F=s*d-l*h,B=s*u-a*h,N=o*d-l*c,V=o*u-a*c,U=o*h-s*c;return e.m[0]=x*M,e.m[4]=P*M,e.m[8]=A*M,e.m[12]=S*M,e.m[1]=-(i*g-r*v+n*y)*M,e.m[5]=(t*g-r*b+n*T)*M,e.m[9]=-(t*v-i*b+n*E)*M,e.m[13]=(t*y-i*T+r*E)*M,e.m[2]=(i*R-r*C+n*O)*M,e.m[6]=-(t*R-r*D+n*I)*M,e.m[10]=(t*C-i*D+n*w)*M,e.m[14]=-(t*O-i*I+r*w)*M,e.m[3]=-(i*L-r*F+n*B)*M,e.m[7]=(t*L-r*N+n*V)*M,e.m[11]=-(t*F-i*N+n*U)*M,e.m[15]=(t*B-i*V+r*U)*M,e._markAsUpdated(),this},g.prototype.setTranslationFromFloats=function(e,t,i){return this.m[12]=e,this.m[13]=t,this.m[14]=i,this._markAsUpdated(),this},g.prototype.setTranslation=function(e){return this.m[12]=e.x,this.m[13]=e.y,this.m[14]=e.z,this._markAsUpdated(),this},g.prototype.getTranslation=function(){return new _(this.m[12],this.m[13],this.m[14])},g.prototype.getTranslationToRef=function(e){return e.x=this.m[12],e.y=this.m[13],e.z=this.m[14],this},g.prototype.removeRotationAndScaling=function(){return this.setRowFromFloats(0,1,0,0,0),this.setRowFromFloats(1,0,1,0,0),this.setRowFromFloats(2,0,0,1,0),this},g.prototype.multiply=function(e){var t=new g;return this.multiplyToRef(e,t),t},g.prototype.copyFrom=function(e){for(var t=0;t<16;t++)this.m[t]=e.m[t];return this._markAsUpdated(),this},g.prototype.copyToArray=function(e,t){void 0===t&&(t=0);for(var i=0;i<16;i++)e[t+i]=this.m[i];return this},g.prototype.multiplyToRef=function(e,t){return this.multiplyToArray(e,t.m,0),t._markAsUpdated(),this},g.prototype.multiplyToArray=function(e,t,i){var r=this.m[0],n=this.m[1],o=this.m[2],s=this.m[3],a=this.m[4],l=this.m[5],c=this.m[6],h=this.m[7],u=this.m[8],d=this.m[9],f=this.m[10],p=this.m[11],_=this.m[12],m=this.m[13],g=this.m[14],v=this.m[15],y=e.m[0],b=e.m[1],T=e.m[2],E=e.m[3],x=e.m[4],P=e.m[5],A=e.m[6],S=e.m[7],M=e.m[8],R=e.m[9],C=e.m[10],O=e.m[11],D=e.m[12],I=e.m[13],w=e.m[14],L=e.m[15];return t[i]=r*y+n*x+o*M+s*D,t[i+1]=r*b+n*P+o*R+s*I,t[i+2]=r*T+n*A+o*C+s*w,t[i+3]=r*E+n*S+o*O+s*L,t[i+4]=a*y+l*x+c*M+h*D,t[i+5]=a*b+l*P+c*R+h*I,t[i+6]=a*T+l*A+c*C+h*w,t[i+7]=a*E+l*S+c*O+h*L,t[i+8]=u*y+d*x+f*M+p*D,t[i+9]=u*b+d*P+f*R+p*I,t[i+10]=u*T+d*A+f*C+p*w,t[i+11]=u*E+d*S+f*O+p*L,t[i+12]=_*y+m*x+g*M+v*D,t[i+13]=_*b+m*P+g*R+v*I,t[i+14]=_*T+m*A+g*C+v*w,t[i+15]=_*E+m*S+g*O+v*L,this},g.prototype.equals=function(e){return e&&this.m[0]===e.m[0]&&this.m[1]===e.m[1]&&this.m[2]===e.m[2]&&this.m[3]===e.m[3]&&this.m[4]===e.m[4]&&this.m[5]===e.m[5]&&this.m[6]===e.m[6]&&this.m[7]===e.m[7]&&this.m[8]===e.m[8]&&this.m[9]===e.m[9]&&this.m[10]===e.m[10]&&this.m[11]===e.m[11]&&this.m[12]===e.m[12]&&this.m[13]===e.m[13]&&this.m[14]===e.m[14]&&this.m[15]===e.m[15]},g.prototype.clone=function(){return g.FromValues(this.m[0],this.m[1],this.m[2],this.m[3],this.m[4],this.m[5],this.m[6],this.m[7],this.m[8],this.m[9],this.m[10],this.m[11],this.m[12],this.m[13],this.m[14],this.m[15])},g.prototype.getClassName=function(){return"Matrix"},g.prototype.getHashCode=function(){for(var e=this.m[0]||0,t=1;t<16;t++)e=397*e^(this.m[t]||0);return e},g.prototype.decompose=function(e,t,i){return i&&(i.x=this.m[12],i.y=this.m[13],i.z=this.m[14]),(e=e||A.Vector3[0]).x=Math.sqrt(this.m[0]*this.m[0]+this.m[1]*this.m[1]+this.m[2]*this.m[2]),e.y=Math.sqrt(this.m[4]*this.m[4]+this.m[5]*this.m[5]+this.m[6]*this.m[6]),e.z=Math.sqrt(this.m[8]*this.m[8]+this.m[9]*this.m[9]+this.m[10]*this.m[10]),this.determinant()<=0&&(e.y*=-1),0===e.x||0===e.y||0===e.z?(t&&(t.x=0,t.y=0,t.z=0,t.w=1),!1):(t&&(g.FromValuesToRef(this.m[0]/e.x,this.m[1]/e.x,this.m[2]/e.x,0,this.m[4]/e.y,this.m[5]/e.y,this.m[6]/e.y,0,this.m[8]/e.z,this.m[9]/e.z,this.m[10]/e.z,0,0,0,0,1,A.Matrix[0]),m.FromRotationMatrixToRef(A.Matrix[0],t)),!0)},g.prototype.getRow=function(e){if(e<0||3<e)return null;var t=4*e;return new r(this.m[t+0],this.m[t+1],this.m[t+2],this.m[t+3])},g.prototype.setRow=function(e,t){if(e<0||3<e)return this;var i=4*e;return this.m[i+0]=t.x,this.m[i+1]=t.y,this.m[i+2]=t.z,this.m[i+3]=t.w,this._markAsUpdated(),this},g.prototype.transpose=function(){return g.Transpose(this)},g.prototype.transposeToRef=function(e){return g.TransposeToRef(this,e),this},g.prototype.setRowFromFloats=function(e,t,i,r,n){if(e<0||3<e)return this;var o=4*e;return this.m[o+0]=t,this.m[o+1]=i,this.m[o+2]=r,this.m[o+3]=n,this._markAsUpdated(),this},g.prototype.scale=function(e){var t=new g;return this.scaleToRef(e,t),t},g.prototype.scaleToRef=function(e,t){for(var i=0;i<16;i++)t.m[i]=this.m[i]*e;return t._markAsUpdated(),this},g.prototype.scaleAndAddToRef=function(e,t){for(var i=0;i<16;i++)t.m[i]+=this.m[i]*e;return t._markAsUpdated(),this},g.prototype.toNormalMatrix=function(e){this.invertToRef(e),e.transpose();var t=e.m;g.FromValuesToRef(t[0],t[1],t[2],0,t[4],t[5],t[6],0,t[8],t[9],t[10],0,0,0,0,1,e)},g.prototype.getRotationMatrix=function(){var e=g.Identity();return this.getRotationMatrixToRef(e),e},g.prototype.getRotationMatrixToRef=function(e){var t=this.m,i=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]),r=Math.sqrt(t[4]*t[4]+t[5]*t[5]+t[6]*t[6]),n=Math.sqrt(t[8]*t[8]+t[9]*t[9]+t[10]*t[10]);return this.determinant()<=0&&(r*=-1),0===i||0===r||0===n?g.IdentityToRef(e):g.FromValuesToRef(t[0]/i,t[1]/i,t[2]/i,0,t[4]/r,t[5]/r,t[6]/r,0,t[8]/n,t[9]/n,t[10]/n,0,0,0,0,1,e),this},g.FromArray=function(e,t){var i=new g;return t||(t=0),g.FromArrayToRef(e,t,i),i},g.FromArrayToRef=function(e,t,i){for(var r=0;r<16;r++)i.m[r]=e[r+t];i._markAsUpdated()},g.FromFloat32ArrayToRefScaled=function(e,t,i,r){for(var n=0;n<16;n++)r.m[n]=e[n+t]*i;r._markAsUpdated()},g.FromValuesToRef=function(e,t,i,r,n,o,s,a,l,c,h,u,d,f,p,_,m){m.m[0]=e,m.m[1]=t,m.m[2]=i,m.m[3]=r,m.m[4]=n,m.m[5]=o,m.m[6]=s,m.m[7]=a,m.m[8]=l,m.m[9]=c,m.m[10]=h,m.m[11]=u,m.m[12]=d,m.m[13]=f,m.m[14]=p,m.m[15]=_,m._markAsUpdated()},Object.defineProperty(g,"IdentityReadOnly",{get:function(){return g._identityReadOnly},enumerable:!0,configurable:!0}),g.FromValues=function(e,t,i,r,n,o,s,a,l,c,h,u,d,f,p,_){var m=new g;return m.m[0]=e,m.m[1]=t,m.m[2]=i,m.m[3]=r,m.m[4]=n,m.m[5]=o,m.m[6]=s,m.m[7]=a,m.m[8]=l,m.m[9]=c,m.m[10]=h,m.m[11]=u,m.m[12]=d,m.m[13]=f,m.m[14]=p,m.m[15]=_,m},g.Compose=function(e,t,i){var r=g.Identity();return g.ComposeToRef(e,t,i,r),r},g.ComposeToRef=function(e,t,i,r){g.FromValuesToRef(e.x,0,0,0,0,e.y,0,0,0,0,e.z,0,0,0,0,1,A.Matrix[1]),t.toRotationMatrix(A.Matrix[0]),A.Matrix[1].multiplyToRef(A.Matrix[0],r),r.setTranslation(i)},g.Identity=function(){return g.FromValues(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1)},g.IdentityToRef=function(e){g.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,0,0,0,1,e)},g.Zero=function(){return g.FromValues(0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0)},g.RotationX=function(e){var t=new g;return g.RotationXToRef(e,t),t},g.Invert=function(e){var t=new g;return e.invertToRef(t),t},g.RotationXToRef=function(e,t){var i=Math.sin(e),r=Math.cos(e);t.m[0]=1,t.m[15]=1,t.m[5]=r,t.m[10]=r,t.m[9]=-i,t.m[6]=i,t.m[1]=0,t.m[2]=0,t.m[3]=0,t.m[4]=0,t.m[7]=0,t.m[8]=0,t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t._markAsUpdated()},g.RotationY=function(e){var t=new g;return g.RotationYToRef(e,t),t},g.RotationYToRef=function(e,t){var i=Math.sin(e),r=Math.cos(e);t.m[5]=1,t.m[15]=1,t.m[0]=r,t.m[2]=-i,t.m[8]=i,t.m[10]=r,t.m[1]=0,t.m[3]=0,t.m[4]=0,t.m[6]=0,t.m[7]=0,t.m[9]=0,t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t._markAsUpdated()},g.RotationZ=function(e){var t=new g;return g.RotationZToRef(e,t),t},g.RotationZToRef=function(e,t){var i=Math.sin(e),r=Math.cos(e);t.m[10]=1,t.m[15]=1,t.m[0]=r,t.m[1]=i,t.m[4]=-i,t.m[5]=r,t.m[2]=0,t.m[3]=0,t.m[6]=0,t.m[7]=0,t.m[8]=0,t.m[9]=0,t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t._markAsUpdated()},g.RotationAxis=function(e,t){var i=g.Zero();return g.RotationAxisToRef(e,t,i),i},g.RotationAxisToRef=function(e,t,i){var r=Math.sin(-t),n=Math.cos(-t),o=1-n;e.normalize(),i.m[0]=e.x*e.x*o+n,i.m[1]=e.x*e.y*o-e.z*r,i.m[2]=e.x*e.z*o+e.y*r,i.m[3]=0,i.m[4]=e.y*e.x*o+e.z*r,i.m[5]=e.y*e.y*o+n,i.m[6]=e.y*e.z*o-e.x*r,i.m[7]=0,i.m[8]=e.z*e.x*o-e.y*r,i.m[9]=e.z*e.y*o+e.x*r,i.m[10]=e.z*e.z*o+n,i.m[11]=0,i.m[15]=1,i._markAsUpdated()},g.RotationYawPitchRoll=function(e,t,i){var r=new g;return g.RotationYawPitchRollToRef(e,t,i,r),r},g.RotationYawPitchRollToRef=function(e,t,i,r){m.RotationYawPitchRollToRef(e,t,i,this._tempQuaternion),this._tempQuaternion.toRotationMatrix(r)},g.Scaling=function(e,t,i){var r=g.Zero();return g.ScalingToRef(e,t,i,r),r},g.ScalingToRef=function(e,t,i,r){r.m[0]=e,r.m[1]=0,r.m[2]=0,r.m[3]=0,r.m[4]=0,r.m[5]=t,r.m[6]=0,r.m[7]=0,r.m[8]=0,r.m[9]=0,r.m[10]=i,r.m[11]=0,r.m[12]=0,r.m[13]=0,r.m[14]=0,r.m[15]=1,r._markAsUpdated()},g.Translation=function(e,t,i){var r=g.Identity();return g.TranslationToRef(e,t,i,r),r},g.TranslationToRef=function(e,t,i,r){g.FromValuesToRef(1,0,0,0,0,1,0,0,0,0,1,0,e,t,i,1,r)},g.Lerp=function(e,t,i){var r=g.Zero();return g.LerpToRef(e,t,i,r),r},g.LerpToRef=function(e,t,i,r){for(var n=0;n<16;n++)r.m[n]=e.m[n]*(1-i)+t.m[n]*i;r._markAsUpdated()},g.DecomposeLerp=function(e,t,i){var r=g.Zero();return g.DecomposeLerpToRef(e,t,i,r),r},g.DecomposeLerpToRef=function(e,t,i,r){var n=A.Vector3[0],o=A.Quaternion[0],s=A.Vector3[1];e.decompose(n,o,s);var a=A.Vector3[2],l=A.Quaternion[1],c=A.Vector3[3];t.decompose(a,l,c);var h=A.Vector3[4];_.LerpToRef(n,a,i,h);var u=A.Quaternion[2];m.SlerpToRef(o,l,i,u);var d=A.Vector3[5];_.LerpToRef(s,c,i,d),g.ComposeToRef(h,u,d,r)},g.LookAtLH=function(e,t,i){var r=g.Zero();return g.LookAtLHToRef(e,t,i,r),r},g.LookAtLHToRef=function(e,t,i,r){t.subtractToRef(e,this._zAxis),this._zAxis.normalize(),_.CrossToRef(i,this._zAxis,this._xAxis),0===this._xAxis.lengthSquared()?this._xAxis.x=1:this._xAxis.normalize(),_.CrossToRef(this._zAxis,this._xAxis,this._yAxis),this._yAxis.normalize();var n=-_.Dot(this._xAxis,e),o=-_.Dot(this._yAxis,e),s=-_.Dot(this._zAxis,e);return g.FromValuesToRef(this._xAxis.x,this._yAxis.x,this._zAxis.x,0,this._xAxis.y,this._yAxis.y,this._zAxis.y,0,this._xAxis.z,this._yAxis.z,this._zAxis.z,0,n,o,s,1,r)},g.LookAtRH=function(e,t,i){var r=g.Zero();return g.LookAtRHToRef(e,t,i,r),r},g.LookAtRHToRef=function(e,t,i,r){e.subtractToRef(t,this._zAxis),this._zAxis.normalize(),_.CrossToRef(i,this._zAxis,this._xAxis),0===this._xAxis.lengthSquared()?this._xAxis.x=1:this._xAxis.normalize(),_.CrossToRef(this._zAxis,this._xAxis,this._yAxis),this._yAxis.normalize();var n=-_.Dot(this._xAxis,e),o=-_.Dot(this._yAxis,e),s=-_.Dot(this._zAxis,e);return g.FromValuesToRef(this._xAxis.x,this._yAxis.x,this._zAxis.x,0,this._xAxis.y,this._yAxis.y,this._zAxis.y,0,this._xAxis.z,this._yAxis.z,this._zAxis.z,0,n,o,s,1,r)},g.OrthoLH=function(e,t,i,r){var n=g.Zero();return g.OrthoLHToRef(e,t,i,r,n),n},g.OrthoLHToRef=function(e,t,i,r,n){g.FromValuesToRef(2/e,0,0,0,0,2/t,0,0,0,0,2/(r-i),0,0,0,-(r+i)/(r-i),1,n)},g.OrthoOffCenterLH=function(e,t,i,r,n,o){var s=g.Zero();return g.OrthoOffCenterLHToRef(e,t,i,r,n,o,s),s},g.OrthoOffCenterLHToRef=function(e,t,i,r,n,o,s){g.FromValuesToRef(2/(t-e),0,0,0,0,2/(r-i),0,0,0,0,2/(o-n),0,(e+t)/(e-t),(r+i)/(i-r),-(o+n)/(o-n),1,s)},g.OrthoOffCenterRH=function(e,t,i,r,n,o){var s=g.Zero();return g.OrthoOffCenterRHToRef(e,t,i,r,n,o,s),s},g.OrthoOffCenterRHToRef=function(e,t,i,r,n,o,s){g.OrthoOffCenterLHToRef(e,t,i,r,n,o,s),s.m[10]*=-1},g.PerspectiveLH=function(e,t,i,r){var n=g.Zero();return g.FromValuesToRef(2*i/e,0,0,0,0,2*i/t,0,0,0,0,(r+i)/(r-i),1,0,0,-2*r*i/(r-i),0,n),n},g.PerspectiveFovLH=function(e,t,i,r){var n=g.Zero();return g.PerspectiveFovLHToRef(e,t,i,r,n),n},g.PerspectiveFovLHToRef=function(e,t,i,r,n,o){void 0===o&&(o=!0);var s=i,a=r,l=1/Math.tan(.5*e);g.FromValuesToRef(o?l/t:l,0,0,0,0,o?l:l*t,0,0,0,0,(a+s)/(a-s),1,0,0,-2*a*s/(a-s),0,n)},g.PerspectiveFovRH=function(e,t,i,r){var n=g.Zero();return g.PerspectiveFovRHToRef(e,t,i,r,n),n},g.PerspectiveFovRHToRef=function(e,t,i,r,n,o){void 0===o&&(o=!0);var s=i,a=r,l=1/Math.tan(.5*e);g.FromValuesToRef(o?l/t:l,0,0,0,0,o?l:l*t,0,0,0,0,-(a+s)/(a-s),-1,0,0,-2*a*s/(a-s),0,n)},g.PerspectiveFovWebVRToRef=function(e,t,i,r,n){void 0===n&&(n=!1);var o=n?-1:1,s=Math.tan(e.upDegrees*Math.PI/180),a=Math.tan(e.downDegrees*Math.PI/180),l=Math.tan(e.leftDegrees*Math.PI/180),c=Math.tan(e.rightDegrees*Math.PI/180),h=2/(l+c),u=2/(s+a);r.m[0]=h,r.m[1]=r.m[2]=r.m[3]=r.m[4]=0,r.m[5]=u,r.m[6]=r.m[7]=0,r.m[8]=(l-c)*h*.5,r.m[9]=-(s-a)*u*.5,r.m[10]=-i/(t-i),r.m[11]=1*o,r.m[12]=r.m[13]=r.m[15]=0,r.m[14]=-2*i*t/(i-t),r._markAsUpdated()},g.GetFinalMatrix=function(e,t,i,r,n,o){var s=e.width,a=e.height,l=e.x,c=e.y,h=g.FromValues(s/2,0,0,0,0,-a/2,0,0,0,0,o-n,0,l+s/2,a/2+c,n,1);return t.multiply(i).multiply(r).multiply(h)},g.GetAsMatrix2x2=function(e){return new Float32Array([e.m[0],e.m[1],e.m[4],e.m[5]])},g.GetAsMatrix3x3=function(e){return new Float32Array([e.m[0],e.m[1],e.m[2],e.m[4],e.m[5],e.m[6],e.m[8],e.m[9],e.m[10]])},g.Transpose=function(e){var t=new g;return g.TransposeToRef(e,t),t},g.TransposeToRef=function(e,t){t.m[0]=e.m[0],t.m[1]=e.m[4],t.m[2]=e.m[8],t.m[3]=e.m[12],t.m[4]=e.m[1],t.m[5]=e.m[5],t.m[6]=e.m[9],t.m[7]=e.m[13],t.m[8]=e.m[2],t.m[9]=e.m[6],t.m[10]=e.m[10],t.m[11]=e.m[14],t.m[12]=e.m[3],t.m[13]=e.m[7],t.m[14]=e.m[11],t.m[15]=e.m[15]},g.Reflection=function(e){var t=new g;return g.ReflectionToRef(e,t),t},g.ReflectionToRef=function(e,t){e.normalize();var i=e.normal.x,r=e.normal.y,n=e.normal.z,o=-2*i,s=-2*r,a=-2*n;t.m[0]=o*i+1,t.m[1]=s*i,t.m[2]=a*i,t.m[3]=0,t.m[4]=o*r,t.m[5]=s*r+1,t.m[6]=a*r,t.m[7]=0,t.m[8]=o*n,t.m[9]=s*n,t.m[10]=a*n+1,t.m[11]=0,t.m[12]=o*e.d,t.m[13]=s*e.d,t.m[14]=a*e.d,t.m[15]=1,t._markAsUpdated()},g.FromXYZAxesToRef=function(e,t,i,r){r.m[0]=e.x,r.m[1]=e.y,r.m[2]=e.z,r.m[3]=0,r.m[4]=t.x,r.m[5]=t.y,r.m[6]=t.z,r.m[7]=0,r.m[8]=i.x,r.m[9]=i.y,r.m[10]=i.z,r.m[11]=0,r.m[12]=0,r.m[13]=0,r.m[14]=0,r.m[15]=1,r._markAsUpdated()},g.FromQuaternionToRef=function(e,t){var i=e.x*e.x,r=e.y*e.y,n=e.z*e.z,o=e.x*e.y,s=e.z*e.w,a=e.z*e.x,l=e.y*e.w,c=e.y*e.z,h=e.x*e.w;t.m[0]=1-2*(r+n),t.m[1]=2*(o+s),t.m[2]=2*(a-l),t.m[3]=0,t.m[4]=2*(o-s),t.m[5]=1-2*(n+i),t.m[6]=2*(c+h),t.m[7]=0,t.m[8]=2*(a+l),t.m[9]=2*(c-h),t.m[10]=1-2*(r+i),t.m[11]=0,t.m[12]=0,t.m[13]=0,t.m[14]=0,t.m[15]=1,t._markAsUpdated()},g._tempQuaternion=new m,g._xAxis=_.Zero(),g._yAxis=_.Zero(),g._zAxis=_.Zero(),g._updateFlagSeed=0,g._identityReadOnly=g.Identity(),g})();f.Matrix=h;var n=(function(){function s(e,t,i,r){this.normal=new _(e,t,i),this.d=r}return s.prototype.asArray=function(){return[this.normal.x,this.normal.y,this.normal.z,this.d]},s.prototype.clone=function(){return new s(this.normal.x,this.normal.y,this.normal.z,this.d)},s.prototype.getClassName=function(){return"Plane"},s.prototype.getHashCode=function(){var e=this.normal.getHashCode();return e=397*e^(this.d||0)},s.prototype.normalize=function(){var e=Math.sqrt(this.normal.x*this.normal.x+this.normal.y*this.normal.y+this.normal.z*this.normal.z),t=0;return 0!==e&&(t=1/e),this.normal.x*=t,this.normal.y*=t,this.normal.z*=t,this.d*=t,this},s.prototype.transform=function(e){var t=h.Transpose(e),i=this.normal.x,r=this.normal.y,n=this.normal.z,o=this.d;return new s(i*t.m[0]+r*t.m[1]+n*t.m[2]+o*t.m[3],i*t.m[4]+r*t.m[5]+n*t.m[6]+o*t.m[7],i*t.m[8]+r*t.m[9]+n*t.m[10]+o*t.m[11],i*t.m[12]+r*t.m[13]+n*t.m[14]+o*t.m[15])},s.prototype.dotCoordinate=function(e){return this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z+this.d},s.prototype.copyFromPoints=function(e,t,i){var r,n=t.x-e.x,o=t.y-e.y,s=t.z-e.z,a=i.x-e.x,l=i.y-e.y,c=i.z-e.z,h=o*c-s*l,u=s*a-n*c,d=n*l-o*a,f=Math.sqrt(h*h+u*u+d*d);return r=0!==f?1/f:0,this.normal.x=h*r,this.normal.y=u*r,this.normal.z=d*r,this.d=-(this.normal.x*e.x+this.normal.y*e.y+this.normal.z*e.z),this},s.prototype.isFrontFacingTo=function(e,t){return _.Dot(this.normal,e)<=t},s.prototype.signedDistanceTo=function(e){return _.Dot(e,this.normal)+this.d},s.FromArray=function(e){return new s(e[0],e[1],e[2],e[3])},s.FromPoints=function(e,t,i){var r=new s(0,0,0,0);return r.copyFromPoints(e,t,i),r},s.FromPositionAndNormal=function(e,t){var i=new s(0,0,0,0);return t.normalize(),i.normal=t,i.d=-(t.x*e.x+t.y*e.y+t.z*e.z),i},s.SignedDistanceToPlaneFromPositionAndNormal=function(e,t,i){var r=-(t.x*e.x+t.y*e.y+t.z*e.z);return _.Dot(i,t)+r},s})();f.Plane=n;var o=(function(){function n(e,t,i,r){this.x=e,this.y=t,this.width=i,this.height=r}return n.prototype.toGlobal=function(e,t){if(e.getRenderWidth){var i=e;return this.toGlobal(i.getRenderWidth(),i.getRenderHeight())}var r=e;return new n(this.x*r,this.y*t,this.width*r,this.height*t)},n.prototype.clone=function(){return new n(this.x,this.y,this.width,this.height)},n})();f.Viewport=o;var s,a=(function(){function r(){}return r.GetPlanes=function(e){for(var t=[],i=0;i<6;i++)t.push(new n(0,0,0,0));return r.GetPlanesToRef(e,t),t},r.GetNearPlaneToRef=function(e,t){t.normal.x=e.m[3]+e.m[2],t.normal.y=e.m[7]+e.m[6],t.normal.z=e.m[11]+e.m[10],t.d=e.m[15]+e.m[14],t.normalize()},r.GetFarPlaneToRef=function(e,t){t.normal.x=e.m[3]-e.m[2],t.normal.y=e.m[7]-e.m[6],t.normal.z=e.m[11]-e.m[10],t.d=e.m[15]-e.m[14],t.normalize()},r.GetLeftPlaneToRef=function(e,t){t.normal.x=e.m[3]+e.m[0],t.normal.y=e.m[7]+e.m[4],t.normal.z=e.m[11]+e.m[8],t.d=e.m[15]+e.m[12],t.normalize()},r.GetRightPlaneToRef=function(e,t){t.normal.x=e.m[3]-e.m[0],t.normal.y=e.m[7]-e.m[4],t.normal.z=e.m[11]-e.m[8],t.d=e.m[15]-e.m[12],t.normalize()},r.GetTopPlaneToRef=function(e,t){t.normal.x=e.m[3]-e.m[1],t.normal.y=e.m[7]-e.m[5],t.normal.z=e.m[11]-e.m[9],t.d=e.m[15]-e.m[13],t.normalize()},r.GetBottomPlaneToRef=function(e,t){t.normal.x=e.m[3]+e.m[1],t.normal.y=e.m[7]+e.m[5],t.normal.z=e.m[11]+e.m[9],t.d=e.m[15]+e.m[13],t.normalize()},r.GetPlanesToRef=function(e,t){r.GetNearPlaneToRef(e,t[0]),r.GetFarPlaneToRef(e,t[1]),r.GetLeftPlaneToRef(e,t[2]),r.GetRightPlaneToRef(e,t[3]),r.GetTopPlaneToRef(e,t[4]),r.GetBottomPlaneToRef(e,t[5])},r})();f.Frustum=a,(s=f.Space||(f.Space={}))[s.LOCAL=0]="LOCAL",s[s.WORLD=1]="WORLD",s[s.BONE=2]="BONE";var l=(function(){function e(){}return e.X=new _(1,0,0),e.Y=new _(0,1,0),e.Z=new _(0,0,1),e})();f.Axis=l;var g,c,u=(function(){function e(){}return e.Interpolate=function(e,t,i,r,n){for(var o=1-3*r+3*t,s=3*r-6*t,a=3*t,l=e,c=0;c<5;c++){var h=l*l;l-=(o*(h*l)+s*h+a*l-e)*(1/(3*o*h+2*s*l+a)),l=Math.min(1,Math.max(0,l))}return 3*Math.pow(1-l,2)*l*i+3*(1-l)*Math.pow(l,2)*n+Math.pow(l,3)},e})();f.BezierCurve=u,(c=g=f.Orientation||(f.Orientation={}))[c.CW=0]="CW",c[c.CCW=1]="CCW";var d=(function(){function r(e){this._radians=e,this._radians<0&&(this._radians+=2*Math.PI)}return r.prototype.degrees=function(){return 180*this._radians/Math.PI},r.prototype.radians=function(){return this._radians},r.BetweenTwoPoints=function(e,t){var i=t.subtract(e);return new r(Math.atan2(i.y,i.x))},r.FromRadians=function(e){return new r(e)},r.FromDegrees=function(e){return new r(e*Math.PI/180)},r})();f.Angle=d;var v=function(e,t,i){this.startPoint=e,this.midPoint=t,this.endPoint=i;var r=Math.pow(t.x,2)+Math.pow(t.y,2),n=(Math.pow(e.x,2)+Math.pow(e.y,2)-r)/2,o=(r-Math.pow(i.x,2)-Math.pow(i.y,2))/2,s=(e.x-t.x)*(t.y-i.y)-(t.x-i.x)*(e.y-t.y);this.centerPoint=new p((n*(t.y-i.y)-o*(e.y-t.y))/s,((e.x-t.x)*o-(t.x-i.x)*n)/s),this.radius=this.centerPoint.subtract(this.startPoint).length(),this.startAngle=d.BetweenTwoPoints(this.centerPoint,this.startPoint);var a=this.startAngle.degrees(),l=d.BetweenTwoPoints(this.centerPoint,this.midPoint).degrees(),c=d.BetweenTwoPoints(this.centerPoint,this.endPoint).degrees();180<l-a&&(l-=360),l-a<-180&&(l+=360),180<c-l&&(c-=360),c-l<-180&&(c+=360),this.orientation=l-a<0?g.CW:g.CCW,this.angle=d.FromDegrees(this.orientation===g.CW?a-c:c-a)};f.Arc2=v;var y=(function(){function i(e,t){this._points=new Array,this._length=0,this.closed=!1,this._points.push(new p(e,t))}return i.prototype.addLineTo=function(e,t){if(this.closed)return this;var i=new p(e,t),r=this._points[this._points.length-1];return this._points.push(i),this._length+=i.subtract(r).length(),this},i.prototype.addArcTo=function(e,t,i,r,n){if(void 0===n&&(n=36),this.closed)return this;var o=this._points[this._points.length-1],s=new p(e,t),a=new p(i,r),l=new v(o,s,a),c=l.angle.radians()/n;l.orientation===g.CW&&(c*=-1);for(var h=l.startAngle.radians()+c,u=0;u<n;u++){var d=Math.cos(h)*l.radius+l.centerPoint.x,f=Math.sin(h)*l.radius+l.centerPoint.y;this.addLineTo(d,f),h+=c}return this},i.prototype.close=function(){return this.closed=!0,this},i.prototype.length=function(){var e=this._length;if(!this.closed){var t=this._points[this._points.length-1];e+=this._points[0].subtract(t).length()}return e},i.prototype.getPoints=function(){return this._points},i.prototype.getPointAtLengthPosition=function(e){if(e<0||1<e)return p.Zero();for(var t=e*this.length(),i=0,r=0;r<this._points.length;r++){var n=(r+1)%this._points.length,o=this._points[r],s=this._points[n].subtract(o),a=s.length()+i;if(i<=t&&t<=a){var l=s.normalize(),c=t-i;return new p(o.x+l.x*c,o.y+l.y*c)}i=a}return p.Zero()},i.StartingAt=function(e,t){return new i(e,t)},i})();f.Path2=y;var b=(function(){function e(e,t,i){void 0===t&&(t=null),this.path=e,this._curve=new Array,this._distances=new Array,this._tangents=new Array,this._normals=new Array,this._binormals=new Array;for(var r=0;r<e.length;r++)this._curve[r]=e[r].clone();this._raw=i||!1,this._compute(t)}return e.prototype.getCurve=function(){return this._curve},e.prototype.getTangents=function(){return this._tangents},e.prototype.getNormals=function(){return this._normals},e.prototype.getBinormals=function(){return this._binormals},e.prototype.getDistances=function(){return this._distances},e.prototype.update=function(e,t){void 0===t&&(t=null);for(var i=0;i<e.length;i++)this._curve[i].x=e[i].x,this._curve[i].y=e[i].y,this._curve[i].z=e[i].z;return this._compute(t),this},e.prototype._compute=function(e){var t=this._curve.length;this._tangents[0]=this._getFirstNonNullVector(0),this._raw||this._tangents[0].normalize(),this._tangents[t-1]=this._curve[t-1].subtract(this._curve[t-2]),this._raw||this._tangents[t-1].normalize();var i,r,n,o,s=this._tangents[0],a=this._normalVector(this._curve[0],s,e);this._normals[0]=a,this._raw||this._normals[0].normalize(),this._binormals[0]=_.Cross(s,this._normals[0]),this._raw||this._binormals[0].normalize(),this._distances[0]=0;for(var l=1;l<t;l++)i=this._getLastNonNullVector(l),l<t-1&&(r=this._getFirstNonNullVector(l),this._tangents[l]=i.add(r),this._tangents[l].normalize()),this._distances[l]=this._distances[l-1]+i.length(),n=this._tangents[l],o=this._binormals[l-1],this._normals[l]=_.Cross(o,n),this._raw||this._normals[l].normalize(),this._binormals[l]=_.Cross(n,this._normals[l]),this._raw||this._binormals[l].normalize()},e.prototype._getFirstNonNullVector=function(e){for(var t=1,i=this._curve[e+t].subtract(this._curve[e]);0===i.length()&&e+t+1<this._curve.length;)t++,i=this._curve[e+t].subtract(this._curve[e]);return i},e.prototype._getLastNonNullVector=function(e){for(var t=1,i=this._curve[e].subtract(this._curve[e-t]);0===i.length()&&t+1<e;)t++,i=this._curve[e].subtract(this._curve[e-t]);return i},e.prototype._normalVector=function(e,t,i){var r,n,o=t.length();(0===o&&(o=1),null==i)?(n=f.Scalar.WithinEpsilon(Math.abs(t.y)/o,1,f.Epsilon)?f.Scalar.WithinEpsilon(Math.abs(t.x)/o,1,f.Epsilon)?f.Scalar.WithinEpsilon(Math.abs(t.z)/o,1,f.Epsilon)?_.Zero():new _(0,0,1):new _(1,0,0):new _(0,-1,0),r=_.Cross(t,n)):(r=_.Cross(t,i),_.CrossToRef(r,t,r));return r.normalize(),r},e})();f.Path3D=b;var T=(function(){function h(e){this._length=0,this._points=e,this._length=this._computeLength(e)}return h.CreateQuadraticBezier=function(e,t,i,r){r=2<r?r:3;for(var n=new Array,o=function(e,t,i,r){return(1-e)*(1-e)*t+2*e*(1-e)*i+e*e*r},s=0;s<=r;s++)n.push(new _(o(s/r,e.x,t.x,i.x),o(s/r,e.y,t.y,i.y),o(s/r,e.z,t.z,i.z)));return new h(n)},h.CreateCubicBezier=function(e,t,i,r,n){n=3<n?n:4;for(var o=new Array,s=function(e,t,i,r,n){return(1-e)*(1-e)*(1-e)*t+3*e*(1-e)*(1-e)*i+3*e*e*(1-e)*r+e*e*e*n},a=0;a<=n;a++)o.push(new _(s(a/n,e.x,t.x,i.x,r.x),s(a/n,e.y,t.y,i.y,r.y),s(a/n,e.z,t.z,i.z,r.z)));return new h(o)},h.CreateHermiteSpline=function(e,t,i,r,n){for(var o=new Array,s=1/n,a=0;a<=n;a++)o.push(_.Hermite(e,t,i,r,a*s));return new h(o)},h.CreateCatmullRomSpline=function(e,t,i){var r=new Array,n=1/t,o=0;if(i){for(var s=e.length,a=0;a<s;a++)for(var l=o=0;l<t;l++)r.push(_.CatmullRom(e[a%s],e[(a+1)%s],e[(a+2)%s],e[(a+3)%s],o)),o+=n;r.push(r[0])}else{var c=new Array;c.push(e[0].clone()),Array.prototype.push.apply(c,e),c.push(e[e.length-1].clone());for(a=0;a<c.length-3;a++)for(l=o=0;l<t;l++)r.push(_.CatmullRom(c[a],c[a+1],c[a+2],c[a+3],o)),o+=n;a--,r.push(_.CatmullRom(c[a],c[a+1],c[a+2],c[a+3],o))}return new h(r)},h.prototype.getPoints=function(){return this._points},h.prototype.length=function(){return this._length},h.prototype.continue=function(e){for(var t=this._points[this._points.length-1],i=this._points.slice(),r=e.getPoints(),n=1;n<r.length;n++)i.push(r[n].subtract(r[0]).add(t));return new h(i)},h.prototype._computeLength=function(e){for(var t=0,i=1;i<e.length;i++)t+=e[i].subtract(e[i-1]).length();return t},h})();f.Curve3=T;var E=(function(){function e(e,t){void 0===e&&(e=_.Zero()),void 0===t&&(t=_.Up()),this.position=e,this.normal=t}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone())},e})();f.PositionNormalVertex=E;var x=(function(){function e(e,t,i){void 0===e&&(e=_.Zero()),void 0===t&&(t=_.Up()),void 0===i&&(i=p.Zero()),this.position=e,this.normal=t,this.uv=i}return e.prototype.clone=function(){return new e(this.position.clone(),this.normal.clone(),this.uv.clone())},e})();f.PositionNormalTextureVertex=x;var P=(function(){function e(){}return e.Color3=[t.Black(),t.Black(),t.Black()],e.Color4=[new i(0,0,0,0),new i(0,0,0,0)],e.Vector2=[p.Zero(),p.Zero(),p.Zero()],e.Vector3=[_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero()],e.Vector4=[r.Zero(),r.Zero(),r.Zero()],e.Quaternion=[m.Zero(),m.Zero()],e.Matrix=[h.Zero(),h.Zero(),h.Zero(),h.Zero(),h.Zero(),h.Zero(),h.Zero(),h.Zero()],e})();f.Tmp=P;var A=(function(){function e(){}return e.Vector3=[_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero(),_.Zero()],e.Matrix=[h.Zero(),h.Zero()],e.Quaternion=[m.Zero(),m.Zero(),m.Zero()],e})()})($a||($a={})),e=$a||($a={}),n=(function(){function n(){}return n.WithinEpsilon=function(e,t,i){void 0===i&&(i=1401298e-51);var r=e-t;return-i<=r&&r<=i},n.ToHex=function(e){var t=e.toString(16);return e<=15?("0"+t).toUpperCase():t.toUpperCase()},n.Sign=function(e){return 0===(e=+e)||isNaN(e)?e:0<e?1:-1},n.Clamp=function(e,t,i){return void 0===t&&(t=0),void 0===i&&(i=1),Math.min(i,Math.max(t,e))},n.Log2=function(e){return Math.log(e)*Math.LOG2E},n.Repeat=function(e,t){return e-Math.floor(e/t)*t},n.Normalize=function(e,t,i){return(e-t)/(i-t)},n.Denormalize=function(e,t,i){return e*(i-t)+t},n.DeltaAngle=function(e,t){var i=n.Repeat(t-e,360);return 180<i&&(i-=360),i},n.PingPong=function(e,t){var i=n.Repeat(e,2*t);return t-Math.abs(i-t)},n.SmoothStep=function(e,t,i){var r=n.Clamp(i);return t*(r=-2*r*r*r+3*r*r)+e*(1-r)},n.MoveTowards=function(e,t,i){return Math.abs(t-e)<=i?t:e+n.Sign(t-e)*i},n.MoveTowardsAngle=function(e,t,i){var r=n.DeltaAngle(e,t);return-i<r&&r<i?t:n.MoveTowards(e,t=e+r,i)},n.Lerp=function(e,t,i){return e+(t-e)*i},n.LerpAngle=function(e,t,i){var r=n.Repeat(t-e,360);return 180<r&&(r-=360),e+r*n.Clamp(i)},n.InverseLerp=function(e,t,i){return e!=t?n.Clamp((i-e)/(t-e)):0},n.Hermite=function(e,t,i,r,n){var o=n*n,s=n*o;return e*(2*s-3*o+1)+i*(-2*s+3*o)+t*(s-2*o+n)+r*(s-o)},n.RandomRange=function(e,t){return e===t?e:Math.random()*(t-e)+e},n.RangeToPercent=function(e,t,i){return(e-t)/(i-t)},n.PercentToRange=function(e,t,i){return(i-t)*e+t},n.NormalizeRadians=function(e){return e-=n.TwoPi*Math.floor((e+Math.PI)/n.TwoPi)},n.TwoPi=2*Math.PI,n})(),e.Scalar=n,(function(u){var c={},h={},i=function(e,t,i){var r=e();u.Tags&&u.Tags.AddTagsTo(r,t.tags);var n=d(r);for(var o in n){var s=n[o],a=t[o],l=s.type;if(null!=a)switch(l){case 0:case 6:case 11:r[o]=a;break;case 1:r[o]=i||a.isRenderTarget?a:a.clone();break;case 2:case 3:case 4:case 5:case 7:case 10:r[o]=i?a:a.clone()}}return r};function d(e){var t=e.getClassName();if(h[t])return h[t];h[t]={};for(var i=h[t],r=e,n=t;n;){var o=c[n];for(var s in o)i[s]=o[s];var a=void 0,l=!1;do{if(!(a=Object.getPrototypeOf(r)).getClassName){l=!0;break}if(a.getClassName()!==n)break;r=a}while(a);if(l)break;n=a.getClassName(),r=a}return i}function t(n,o){return function(e,t){var i,r=(i=e.getClassName(),c[i]||(c[i]={}),c[i]);r[t]||(r[t]={type:n,sourceName:o})}}u.expandToProperty=function(e,t){return void 0===t&&(t=null),r=e,void 0===(n=t)&&(n=null),function(t,e){var i=n||"_"+e;Object.defineProperty(t,e,{get:function(){return this[i]},set:function(e){this[i]!==e&&(this[i]=e,t[r].apply(this))},enumerable:!0,configurable:!0})};var r,n},u.serialize=function(e){return t(0,e)},u.serializeAsTexture=function(e){return t(1,e)},u.serializeAsColor3=function(e){return t(2,e)},u.serializeAsFresnelParameters=function(e){return t(3,e)},u.serializeAsVector2=function(e){return t(4,e)},u.serializeAsVector3=function(e){return t(5,e)},u.serializeAsMeshReference=function(e){return t(6,e)},u.serializeAsColorCurves=function(e){return t(7,e)},u.serializeAsColor4=function(e){return t(8,e)},u.serializeAsImageProcessingConfiguration=function(e){return t(9,e)},u.serializeAsQuaternion=function(e){return t(10,e)},u.serializeAsCameraReference=function(e){return t(11,e)};var e=(function(){function e(){}return e.Serialize=function(e,t){t||(t={}),u.Tags&&(t.tags=u.Tags.GetTags(e));var i=d(e);for(var r in i){var n=i[r],o=n.sourceName||r,s=n.type,a=e[r];if(null!=a)switch(s){case 0:t[o]=a;break;case 1:t[o]=a.serialize();break;case 2:t[o]=a.asArray();break;case 3:t[o]=a.serialize();break;case 4:case 5:t[o]=a.asArray();break;case 6:t[o]=a.id;break;case 7:t[o]=a.serialize();break;case 8:t[o]=a.asArray();break;case 9:t[o]=a.serialize();break;case 10:t[o]=a.asArray();break;case 11:t[o]=a.id}}return t},e.Parse=function(e,t,i,r){void 0===r&&(r=null);var n=e();r||(r=""),u.Tags&&u.Tags.AddTagsTo(n,t.tags);var o=d(n);for(var s in o){var a=o[s],l=t[a.sourceName||s],c=a.type;if(null!=l){var h=n;switch(c){case 0:h[s]=l;break;case 1:i&&(h[s]=u.Texture.Parse(l,i,r));break;case 2:h[s]=u.Color3.FromArray(l);break;case 3:h[s]=u.FresnelParameters.Parse(l);break;case 4:h[s]=u.Vector2.FromArray(l);break;case 5:h[s]=u.Vector3.FromArray(l);break;case 6:i&&(h[s]=i.getLastMeshByID(l));break;case 7:h[s]=u.ColorCurves.Parse(l);break;case 8:h[s]=u.Color4.FromArray(l);break;case 9:h[s]=u.ImageProcessingConfiguration.Parse(l);break;case 10:h[s]=u.Quaternion.FromArray(l);break;case 11:i&&(h[s]=i.getCameraByID(l))}}}return n},e.Clone=function(e,t){return i(e,t,!1)},e.Instanciate=function(e,t){return i(e,t,!0)},e})();u.SerializationHelper=e})($a||($a={})),o=$a||($a={}),s=(function(){function e(){var i=this;this.promise=new Promise(function(e,t){i._resolve=e,i._reject=t})}return Object.defineProperty(e.prototype,"resolve",{get:function(){return this._resolve},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"reject",{get:function(){return this._reject},enumerable:!0,configurable:!0}),e})(),o.Deferred=s,(function(i){var r=(function(){function e(e,t,i,r){void 0===t&&(t=!1),this.initalize(e,t,i,r)}return e.prototype.initalize=function(e,t,i,r){return void 0===t&&(t=!1),this.mask=e,this.skipNextObservers=t,this.target=i,this.currentTarget=r,this},e})();i.EventState=r;var s=function(e,t,i){void 0===i&&(i=null),this.callback=e,this.mask=t,this.scope=i,this._willBeUnregistered=!1,this.unregisterOnNextCall=!1};i.Observer=s;var e=(function(){function l(){}return l.prototype.dispose=function(){if(this._observers&&this._observables)for(var e=0;e<this._observers.length;e++)this._observables[e].remove(this._observers[e]);this._observers=null,this._observables=null},l.Watch=function(e,t,i,r){void 0===i&&(i=-1),void 0===r&&(r=null);var n=new l;n._observers=new Array;for(var o=0,s=n._observables=e;o<s.length;o++){var a=s[o].add(t,i,!1,r);a&&n._observers.push(a)}return n},l})();i.MultiObserver=e;var t=(function(){function t(e){this._observers=new Array,this._eventState=new r(0),e&&(this._onObserverAdded=e)}return t.prototype.add=function(e,t,i,r,n){if(void 0===t&&(t=-1),void 0===i&&(i=!1),void 0===r&&(r=null),void 0===n&&(n=!1),!e)return null;var o=new s(e,t,r);return o.unregisterOnNextCall=n,i?this._observers.unshift(o):this._observers.push(o),this._onObserverAdded&&this._onObserverAdded(o),o},t.prototype.addOnce=function(e){return this.add(e,void 0,void 0,void 0,!0)},t.prototype.remove=function(e){return!!e&&(-1!==this._observers.indexOf(e)&&(this._deferUnregister(e),!0))},t.prototype.removeCallback=function(e,t){for(var i=0;i<this._observers.length;i++)if(this._observers[i].callback===e&&(!t||t===this._observers[i].scope))return this._deferUnregister(this._observers[i]),!0;return!1},t.prototype._deferUnregister=function(e){var t=this;e.unregisterOnNextCall=!1,e._willBeUnregistered=!0,i.Tools.SetImmediate((function(){t._remove(e)}))},t.prototype._remove=function(e){if(!e)return!1;var t=this._observers.indexOf(e);return-1!==t&&(this._observers.splice(t,1),!0)},t.prototype.notifyObservers=function(e,t,i,r){if(void 0===t&&(t=-1),!this._observers.length)return!0;var n=this._eventState;n.mask=t,n.target=i,n.currentTarget=r,n.skipNextObservers=!1,n.lastReturnValue=e;for(var o=0,s=this._observers;o<s.length;o++){var a=s[o];if(!a._willBeUnregistered&&(a.mask&t&&(a.scope?n.lastReturnValue=a.callback.apply(a.scope,[e,n]):n.lastReturnValue=a.callback(e,n),a.unregisterOnNextCall&&this._deferUnregister(a)),n.skipNextObservers))return!1}return!0},t.prototype.notifyObserversWithPromise=function(i,e,t,r){var n=this;void 0===e&&(e=-1);var o=Promise.resolve(i);if(!this._observers.length)return o;var s=this._eventState;return s.mask=e,s.target=t,s.currentTarget=r,s.skipNextObservers=!1,this._observers.forEach((function(t){s.skipNextObservers||t._willBeUnregistered||t.mask&e&&(o=t.scope?o.then((function(e){return s.lastReturnValue=e,t.callback.apply(t.scope,[i,s])})):o.then((function(e){return s.lastReturnValue=e,t.callback(i,s)})),t.unregisterOnNextCall&&n._deferUnregister(t))})),o.then((function(){return i}))},t.prototype.notifyObserver=function(e,t,i){void 0===i&&(i=-1);var r=this._eventState;r.mask=i,r.skipNextObservers=!1,e.callback(t,r)},t.prototype.hasObservers=function(){return 0<this._observers.length},t.prototype.clear=function(){this._observers=new Array,this._onObserverAdded=null},t.prototype.clone=function(){var e=new t;return e._observers=this._observers.slice(0),e},t.prototype.hasSpecificMask=function(e){void 0===e&&(e=-1);for(var t=0,i=this._observers;t<i.length;t++){var r=i[t];if(r.mask&e||r.mask===e)return!0}return!1},t})();i.Observable=t})($a||($a={})),a=$a||($a={}),l=(function(){function t(e){this.length=0,this.data=new Array(e),this._id=t._GlobalId++}return t.prototype.push=function(e){this.data[this.length++]=e,this.length>this.data.length&&(this.data.length*=2)},t.prototype.forEach=function(e){for(var t=0;t<this.length;t++)e(this.data[t])},t.prototype.sort=function(e){this.data.sort(e)},t.prototype.reset=function(){this.length=0},t.prototype.dispose=function(){this.reset(),this.data&&(this.data.length=0,this.data=[])},t.prototype.concat=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++)this.data[this.length++]=(e.data||e)[t]}},t.prototype.indexOf=function(e){var t=this.data.indexOf(e);return t>=this.length?-1:t},t.prototype.contains=function(e){return-1!==this.indexOf(e)},t._GlobalId=0,t})(),c=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._duplicateId=0,e}return T(e,t),e.prototype.push=function(e){t.prototype.push.call(this,e),e.__smartArrayFlags||(e.__smartArrayFlags={}),e.__smartArrayFlags[this._id]=this._duplicateId},e.prototype.pushNoDuplicate=function(e){return(!e.__smartArrayFlags||e.__smartArrayFlags[this._id]!==this._duplicateId)&&(this.push(e),!0)},e.prototype.reset=function(){t.prototype.reset.call(this),this._duplicateId++},e.prototype.concatWithNoDuplicate=function(e){if(0!==e.length){this.length+e.length>this.data.length&&(this.data.length=2*(this.length+e.length));for(var t=0;t<e.length;t++){var i=(e.data||e)[t];this.pushNoDuplicate(i)}}},e})(a.SmartArray=l),a.SmartArrayNoDuplicate=c,(function(_){var e=(function(){function e(){}return e.prototype.getColorToRef=function(e){this.color2?_.Color4.LerpToRef(this.color1,this.color2,Math.random(),e):e.copyFrom(this.color1)},e})();_.ColorGradient=e;var t=function(){};_.Color3Gradient=t;var i=(function(){function e(){}return e.prototype.getFactor=function(){return void 0===this.factor2?this.factor1:_.Scalar.Lerp(this.factor1,this.factor2,Math.random())},e})();_.FactorGradient=i;var g=(function(r){function n(e,t){var i=r.call(this,e)||this;return i.request=t,i.name="LoadFileError",n._setPrototypeOf(i,n.prototype),i}return T(n,r),n._setPrototypeOf=Object.setPrototypeOf||function(e,t){return e.__proto__=t,e},n})(Error);_.LoadFileError=g;var v,r=(function(){function e(){}return e.ExponentialBackoff=function(r,n){return void 0===r&&(r=3),void 0===n&&(n=500),function(e,t,i){return 0!==t.status||r<=i||-1!==e.indexOf("file:")?-1:Math.pow(2,i)*n}},e})();_.RetryStrategy=r;var c=function(e,t){return e?e instanceof _.Mesh?null:e instanceof _.SubMesh?e.clone(t):e.clone?e.clone():null:null},n=(function(){function m(){}return m.FetchToRef=function(e,t,i,r,n,o){var s=4*((Math.abs(e)*i%i|0)+(Math.abs(t)*r%r|0)*i);o.r=n[s]/255,o.g=n[s+1]/255,o.b=n[s+2]/255,o.a=n[s+3]/255},m.Mix=function(e,t,i){return e*(1-i)+t*i},m.Instantiate=function(e){if(m.RegisteredExternalClasses&&m.RegisteredExternalClasses[e])return m.RegisteredExternalClasses[e];for(var t=e.split("."),i=window||this,r=0,n=t.length;r<n;r++)i=i[t[r]];return"function"!=typeof i?null:i},m.Slice=function(e,t,i){return e.slice?e.slice(t,i):Array.prototype.slice.call(e,t,i)},m.SetImmediate=function(e){m.IsWindowObjectExist()&&window.setImmediate?window.setImmediate(e):setTimeout(e,1)},m.IsExponentOfTwo=function(e){for(var t=1;(t*=2)<e;);return t===e},m.FloatRound=function(e){return Math.fround?Math.fround(e):m._tmpFloatArray[0]=e},m.CeilingPOT=function(e){return e--,e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,e|=e>>16,++e},m.FloorPOT=function(e){return e|=e>>1,e|=e>>2,e|=e>>4,e|=e>>8,(e|=e>>16)-(e>>1)},m.NearestPOT=function(e){var t=m.CeilingPOT(e),i=m.FloorPOT(e);return e-i<t-e?i:t},m.GetExponentOfTwo=function(e,t,i){var r;switch(void 0===i&&(i=_.Engine.SCALEMODE_NEAREST),i){case _.Engine.SCALEMODE_FLOOR:r=m.FloorPOT(e);break;case _.Engine.SCALEMODE_NEAREST:r=m.NearestPOT(e);break;case _.Engine.SCALEMODE_CEILING:default:r=m.CeilingPOT(e)}return Math.min(r,t)},m.GetFilename=function(e){var t=e.lastIndexOf("/");return t<0?e:e.substring(t+1)},m.GetFolderPath=function(e,t){void 0===t&&(t=!1);var i=e.lastIndexOf("/");return i<0?t?e:"":e.substring(0,i+1)},m.GetDOMTextContent=function(e){for(var t="",i=e.firstChild;i;)3===i.nodeType&&(t+=i.textContent),i=i.nextSibling;return t},m.ToDegrees=function(e){return 180*e/Math.PI},m.ToRadians=function(e){return e*Math.PI/180},m.EncodeArrayBufferTobase64=function(e){for(var t,i,r,n,o,s,a,l="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=",c="",h=0,u=new Uint8Array(e);h<u.length;)n=(t=u[h++])>>2,o=(3&t)<<4|(i=h<u.length?u[h++]:Number.NaN)>>4,s=(15&i)<<2|(r=h<u.length?u[h++]:Number.NaN)>>6,a=63&r,isNaN(i)?s=a=64:isNaN(r)&&(a=64),c+=l.charAt(n)+l.charAt(o)+l.charAt(s)+l.charAt(a);return"data:image/png;base64,"+c},m.ExtractMinAndMaxIndexed=function(e,t,i,r,n){void 0===n&&(n=null);for(var o=new _.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new _.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),a=i;a<i+r;a++){var l=3*t[a],c=e[l],h=e[l+1],u=e[l+2];o.minimizeInPlaceFromFloats(c,h,u),s.maximizeInPlaceFromFloats(c,h,u)}return n&&(o.x-=o.x*n.x+n.y,o.y-=o.y*n.x+n.y,o.z-=o.z*n.x+n.y,s.x+=s.x*n.x+n.y,s.y+=s.y*n.x+n.y,s.z+=s.z*n.x+n.y),{minimum:o,maximum:s}},m.ExtractMinAndMax=function(e,t,i,r,n){void 0===r&&(r=null);var o=new _.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),s=new _.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);n||(n=3);for(var a=t,l=t*n;a<t+i;a++,l+=n){var c=e[l],h=e[l+1],u=e[l+2];o.minimizeInPlaceFromFloats(c,h,u),s.maximizeInPlaceFromFloats(c,h,u)}return r&&(o.x-=o.x*r.x+r.y,o.y-=o.y*r.x+r.y,o.z-=o.z*r.x+r.y,s.x+=s.x*r.x+r.y,s.y+=s.y*r.x+r.y,s.z+=s.z*r.x+r.y),{minimum:o,maximum:s}},m.MakeArray=function(e,t){return!0===t||void 0!==e&&null!=e?Array.isArray(e)?e:[e]:null},m.GetPointerPrefix=function(){var e="pointer";return!m.IsWindowObjectExist()||window.PointerEvent||navigator.pointerEnabled||(e="mouse"),e},m.QueueNewFrame=function(e,t){return m.IsWindowObjectExist()?(t||(t=window),t.requestAnimationFrame?t.requestAnimationFrame(e):t.msRequestAnimationFrame?t.msRequestAnimationFrame(e):t.webkitRequestAnimationFrame?t.webkitRequestAnimationFrame(e):t.mozRequestAnimationFrame?t.mozRequestAnimationFrame(e):t.oRequestAnimationFrame?t.oRequestAnimationFrame(e):window.setTimeout(e,16)):setTimeout(e,16)},m.RequestFullscreen=function(e){var t=e.requestFullscreen||e.msRequestFullscreen||e.webkitRequestFullscreen||e.mozRequestFullScreen;t&&t.call(e)},m.ExitFullscreen=function(){document.exitFullscreen?document.exitFullscreen():document.mozCancelFullScreen?document.mozCancelFullScreen():document.webkitCancelFullScreen?document.webkitCancelFullScreen():document.msCancelFullScreen&&document.msCancelFullScreen()},m.SetCorsBehavior=function(e,t){if((!e||0!==e.indexOf("data:"))&&m.CorsBehavior)if("string"==typeof m.CorsBehavior||m.CorsBehavior instanceof String)t.crossOrigin=m.CorsBehavior;else{var i=m.CorsBehavior(e);i&&(t.crossOrigin=i)}},m.CleanUrl=function(e){return e=e.replace(/#/gm,"%23")},m.LoadImage=function(t,e,i,r){var n,o=!1;t instanceof ArrayBuffer?(n=URL.createObjectURL(new Blob([t])),o=!0):t instanceof Blob?(n=URL.createObjectURL(t),o=!0):(n=m.CleanUrl(t),n=m.PreprocessUrl(t));var s=new Image;m.SetCorsBehavior(n,s);var a=function(){o&&s.src&&URL.revokeObjectURL(s.src),s.removeEventListener("load",a),s.removeEventListener("error",l),e(s)},l=function(e){o&&s.src&&URL.revokeObjectURL(s.src),s.removeEventListener("load",a),s.removeEventListener("error",l),m.Error("Error while trying to load image: "+t),i&&i("Error while trying to load image: "+t,e)};s.addEventListener("load",a),s.addEventListener("error",l);var c=function(){s.src=n};if("data:"!==n.substr(0,5)&&r&&r.enableTexturesOffline&&_.Database.IsUASupportingBlobStorage)r.openAsync((function(){r&&r.loadImageFromDB(n,s)}),c);else{if(-1!==n.indexOf("file:")){var h=decodeURIComponent(n.substring(5).toLowerCase());if(_.FilesInput.FilesToLoad[h]){try{var u;try{u=URL.createObjectURL(_.FilesInput.FilesToLoad[h])}catch(e){u=URL.createObjectURL(_.FilesInput.FilesToLoad[h])}s.src=u,o=!0}catch(e){s.src=""}return s}}c()}return s},m.LoadFile=function(e,c,t,i,h,u){if(e=m.CleanUrl(e),-1!==(e=m.PreprocessUrl(e)).indexOf("file:")){var r=decodeURIComponent(e.substring(5).toLowerCase());if(_.FilesInput.FilesToLoad[r])return m.ReadFile(_.FilesInput.FilesToLoad[r],c,t,h)}var d=m.BaseUrl+e,f=!1,p={onCompleteObservable:new _.Observable,abort:function(){return f=!0}},n=function(){var s=new XMLHttpRequest,a=null;p.abort=function(){f=!0,s.readyState!==(XMLHttpRequest.DONE||4)&&s.abort(),null!==a&&(clearTimeout(a),a=null)};var l=function(r){s.open("GET",d,!0),h&&(s.responseType="arraybuffer"),t&&s.addEventListener("progress",t);var n=function(){s.removeEventListener("loadend",n),p.onCompleteObservable.notifyObservers(p),p.onCompleteObservable.clear()};s.addEventListener("loadend",n);var o=function(){if(!f&&s.readyState===(XMLHttpRequest.DONE||4)){if(s.removeEventListener("readystatechange",o),200<=s.status&&s.status<300||0===s.status&&(!m.IsWindowObjectExist()||m.IsFileURL()))return void c(h?s.response:s.responseText,s.responseURL);var e=m.DefaultRetryStrategy;if(e){var t=e(d,s,r);if(-1!==t)return s.removeEventListener("loadend",n),s=new XMLHttpRequest,void(a=setTimeout((function(){return l(r+1)}),t))}var i=new g("Error status: "+s.status+" "+s.statusText+" - Unable to load "+d,s);if(!u)throw i;u(s,i)}};s.addEventListener("readystatechange",o),s.send()};l(0)};if(i&&i.enableSceneOffline){var o=function(e){e&&400<e.status?u&&u(e):f||n()};i.openAsync((function(){f||i&&i.loadFileFromDB(e,(function(e){f||c(e),p.onCompleteObservable.notifyObservers(p)}),t?function(e){f||t(e)}:void 0,o,h)}),o)}else n();return p},m.LoadScript=function(t,e,i){if(m.IsWindowObjectExist()){var r=document.getElementsByTagName("head")[0],n=document.createElement("script");n.type="text/javascript",n.src=t,n.onload=function(){e&&e()},n.onerror=function(e){i&&i("Unable to load script '"+t+"'",e)},r.appendChild(n)}},m.ReadFileAsDataURL=function(e,t,i){var r=new FileReader,n={onCompleteObservable:new _.Observable,abort:function(){return r.abort()}};return r.onloadend=function(e){n.onCompleteObservable.notifyObservers(n)},r.onload=function(e){t(e.target.result)},r.onprogress=i,r.readAsDataURL(e),n},m.ReadFile=function(t,i,e,r){var n=new FileReader,o={onCompleteObservable:new _.Observable,abort:function(){return n.abort()}};return n.onloadend=function(e){return o.onCompleteObservable.notifyObservers(o)},n.onerror=function(e){m.Log("Error while reading file: "+t.name),i(JSON.stringify({autoClear:!0,clearColor:[1,0,0],ambientColor:[0,0,0],gravity:[0,-9.807,0],meshes:[],cameras:[],lights:[]}))},n.onload=function(e){i(e.target.result)},e&&(n.onprogress=e),r?n.readAsArrayBuffer(t):n.readAsText(t),o},m.FileAsURL=function(e){var t=new Blob([e]);return(window.URL||window.webkitURL).createObjectURL(t)},m.Format=function(e,t){return void 0===t&&(t=2),e.toFixed(t)},m.CheckExtends=function(e,t,i){e.x<t.x&&(t.x=e.x),e.y<t.y&&(t.y=e.y),e.z<t.z&&(t.z=e.z),e.x>i.x&&(i.x=e.x),e.y>i.y&&(i.y=e.y),e.z>i.z&&(i.z=e.z)},m.DeepCopy=function(e,t,i,r){for(var n in e)if(("_"!==n[0]||r&&-1!==r.indexOf(n))&&(!i||-1===i.indexOf(n))){var o=e[n],s=typeof o;if("function"!==s)try{if("object"===s)if(o instanceof Array){if(t[n]=[],0<o.length)if("object"==typeof o[0])for(var a=0;a<o.length;a++){var l=c(o[a],t);-1===t[n].indexOf(l)&&t[n].push(l)}else t[n]=o.slice(0)}else t[n]=c(o,t);else t[n]=o}catch(e){}}},m.IsEmpty=function(e){for(var t in e)if(e.hasOwnProperty(t))return!1;return!0},m.RegisterTopRootEvents=function(e){for(var t=0;t<e.length;t++){var i=e[t];window.addEventListener(i.name,i.handler,!1);try{window.parent&&window.parent.addEventListener(i.name,i.handler,!1)}catch(e){}}},m.UnregisterTopRootEvents=function(e){for(var t=0;t<e.length;t++){var i=e[t];window.removeEventListener(i.name,i.handler);try{window.parent&&window.parent.removeEventListener(i.name,i.handler)}catch(e){}}},m.DumpFramebuffer=function(e,t,i,r,n,o){void 0===n&&(n="image/png");for(var s=4*e,a=t/2,l=i.readPixels(0,0,e,t),c=0;c<a;c++)for(var h=0;h<s;h++){var u=h+c*s,d=h+(t-c-1)*s,f=l[u];l[u]=l[d],l[d]=f}v||(v=document.createElement("canvas")),v.width=e,v.height=t;var p=v.getContext("2d");if(p){var _=p.createImageData(e,t);_.data.set(l),p.putImageData(_,0,0),m.EncodeScreenshotCanvasData(r,n,o)}},m.ToBlob=function(e,t,i){void 0===i&&(i="image/png"),e.toBlob||(e.toBlob=function(n,o,s){var a=this;setTimeout((function(){for(var e=atob(a.toDataURL(o,s).split(",")[1]),t=e.length,i=new Uint8Array(t),r=0;r<t;r++)i[r]=e.charCodeAt(r);n(new Blob([i]))}))}),e.toBlob((function(e){t(e)}),i)},m.EncodeScreenshotCanvasData=function(e,t,s){(void 0===t&&(t="image/png"),e)?e(v.toDataURL(t)):this.ToBlob(v,(function(e){if("download"in document.createElement("a")){if(!s){var t=new Date,i=(t.getFullYear()+"-"+(t.getMonth()+1)).slice(2)+"-"+t.getDate()+"_"+t.getHours()+"-"+("0"+t.getMinutes()).slice(-2);s="screenshot_"+i+".png"}m.Download(e,s)}else{var r=URL.createObjectURL(e),n=window.open("");if(!n)return;var o=n.document.createElement("img");o.onload=function(){URL.revokeObjectURL(r)},o.src=r,n.document.body.appendChild(o)}}),t)},m.Download=function(e,t){if(navigator&&navigator.msSaveBlob)navigator.msSaveBlob(e,t);else{var i=window.URL.createObjectURL(e),r=document.createElement("a");document.body.appendChild(r),r.style.display="none",r.href=i,r.download=t,r.addEventListener("click",(function(){r.parentElement&&r.parentElement.removeChild(r)})),r.click(),window.URL.revokeObjectURL(i)}},m.CreateScreenshot=function(e,t,i,r,n){var o,s;if(void 0===n&&(n="image/png"),i.precision)o=Math.round(e.getRenderWidth()*i.precision),s=Math.round(o/e.getAspectRatio(t));else if(i.width&&i.height)o=i.width,s=i.height;else if(i.width&&!i.height)o=i.width,s=Math.round(o/e.getAspectRatio(t));else if(i.height&&!i.width)s=i.height,o=Math.round(s*e.getAspectRatio(t));else{if(isNaN(i))return void m.Error("Invalid 'size' parameter !");o=s=i}v||(v=document.createElement("canvas")),v.width=o,v.height=s;var a=v.getContext("2d"),l=e.getRenderWidth()/e.getRenderHeight(),c=o,h=c/l;s<h&&(c=(h=s)*l);var u=Math.max(0,o-c)/2,d=Math.max(0,s-h)/2,f=e.getRenderingCanvas();a&&f&&a.drawImage(f,u,d,c,h),m.EncodeScreenshotCanvasData(r,n)},m.CreateScreenshotUsingRenderTarget=function(e,t,i,r,n,o,s,a){var l,c;if(void 0===n&&(n="image/png"),void 0===o&&(o=1),void 0===s&&(s=!1),i.precision)l=Math.round(e.getRenderWidth()*i.precision),c=Math.round(l/e.getAspectRatio(t)),i={width:l,height:c};else if(i.width&&i.height)l=i.width,c=i.height;else if(i.width&&!i.height)l=i.width,c=Math.round(l/e.getAspectRatio(t)),i={width:l,height:c};else if(i.height&&!i.width)c=i.height,i={width:l=Math.round(c*e.getAspectRatio(t)),height:c};else{if(isNaN(i))return void m.Error("Invalid 'size' parameter !");l=c=i}var h=t.getScene(),u=null;h.activeCamera!==t&&(u=h.activeCamera,h.activeCamera=t);var d=new _.RenderTargetTexture("screenShot",i,h,!1,!1,_.Engine.TEXTURETYPE_UNSIGNED_INT,!1,_.Texture.NEAREST_SAMPLINGMODE);d.renderList=null,d.samples=o,s&&d.addPostProcess(new _.FxaaPostProcess("antialiasing",1,h.activeCamera)),d.onAfterRenderObservable.add((function(){m.DumpFramebuffer(l,c,e,r,n,a)})),h.incrementRenderId(),h.resetCachedMaterial(),d.render(!0),d.dispose(),u&&(h.activeCamera=u),t.getProjectionMatrix(!0)},m.ValidateXHRData=function(e,t){void 0===t&&(t=7);try{if(1&t){if(e.responseText&&0<e.responseText.length)return!0;if(1===t)return!1}if(2&t){var i=_.TGATools.GetTGAHeader(e.response);if(i.width&&i.height&&0<i.width&&0<i.height)return!0;if(2===t)return!1}if(4&t){var r=new Uint8Array(e.response,0,3);return 68===r[0]&&68===r[1]&&83===r[2]}}catch(e){}return!1},m.RandomId=function(){return"xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx".replace(/[xy]/g,(function(e){var t=16*Math.random()|0;return("x"===e?t:3&t|8).toString(16)}))},m.IsBase64=function(e){return!(e.length<5)&&"data:"===e.substr(0,5)},m.DecodeBase64=function(e){for(var t=atob(e.split(",")[1]),i=t.length,r=new Uint8Array(new ArrayBuffer(i)),n=0;n<i;n++)r[n]=t.charCodeAt(n);return r.buffer},m._AddLogEntry=function(e){m._LogCache=e+m._LogCache,m.OnNewCacheEntry&&m.OnNewCacheEntry(e)},m._FormatMessage=function(e){var t=function(e){return e<10?"0"+e:""+e},i=new Date;return"["+t(i.getHours())+":"+t(i.getMinutes())+":"+t(i.getSeconds())+"]: "+e},m._LogDisabled=function(e){},m._LogEnabled=function(e){var t=m._FormatMessage(e);console.log("BJS - "+t),m._AddLogEntry("<div style='color:white'>"+t+"</div><br>")},m._WarnDisabled=function(e){},m._WarnEnabled=function(e){var t=m._FormatMessage(e);console.warn("BJS - "+t),m._AddLogEntry("<div style='color:orange'>"+t+"</div><br>")},m._ErrorDisabled=function(e){},m._ErrorEnabled=function(e){m.errorsCount++;var t=m._FormatMessage(e);console.error("BJS - "+t),m._AddLogEntry("<div style='color:red'>"+t+"</div><br>")},Object.defineProperty(m,"LogCache",{get:function(){return m._LogCache},enumerable:!0,configurable:!0}),m.ClearLogCache=function(){m._LogCache="",m.errorsCount=0},Object.defineProperty(m,"LogLevels",{set:function(e){m.Log=(e&m.MessageLogLevel)===m.MessageLogLevel?m._LogEnabled:m._LogDisabled,m.Warn=(e&m.WarningLogLevel)===m.WarningLogLevel?m._WarnEnabled:m._WarnDisabled,m.Error=(e&m.ErrorLogLevel)===m.ErrorLogLevel?m._ErrorEnabled:m._ErrorDisabled},enumerable:!0,configurable:!0}),m.IsFileURL=function(){return"file:"===location.protocol},m.IsWindowObjectExist=function(){return"undefined"!=typeof window},Object.defineProperty(m,"PerformanceLogLevel",{set:function(e){return(e&m.PerformanceUserMarkLogLevel)===m.PerformanceUserMarkLogLevel?(m.StartPerformanceCounter=m._StartUserMark,void(m.EndPerformanceCounter=m._EndUserMark)):(e&m.PerformanceConsoleLogLevel)===m.PerformanceConsoleLogLevel?(m.StartPerformanceCounter=m._StartPerformanceConsole,void(m.EndPerformanceCounter=m._EndPerformanceConsole)):(m.StartPerformanceCounter=m._StartPerformanceCounterDisabled,void(m.EndPerformanceCounter=m._EndPerformanceCounterDisabled))},enumerable:!0,configurable:!0}),m._StartPerformanceCounterDisabled=function(e,t){},m._EndPerformanceCounterDisabled=function(e,t){},m._StartUserMark=function(e,t){if(void 0===t&&(t=!0),!m._performance){if(!m.IsWindowObjectExist())return;m._performance=window.performance}t&&m._performance.mark&&m._performance.mark(e+"-Begin")},m._EndUserMark=function(e,t){void 0===t&&(t=!0),t&&m._performance.mark&&(m._performance.mark(e+"-End"),m._performance.measure(e,e+"-Begin",e+"-End"))},m._StartPerformanceConsole=function(e,t){void 0===t&&(t=!0),t&&(m._StartUserMark(e,t),console.time&&console.time(e))},m._EndPerformanceConsole=function(e,t){void 0===t&&(t=!0),t&&(m._EndUserMark(e,t),console.time&&console.timeEnd(e))},Object.defineProperty(m,"Now",{get:function(){return m.IsWindowObjectExist()&&window.performance&&window.performance.now?window.performance.now():Date.now()},enumerable:!0,configurable:!0}),m.GetClassName=function(e,t){void 0===t&&(t=!1);var i=null;if(!t&&e.getClassName)i=e.getClassName();else{if(e instanceof Object)i=(t?e:Object.getPrototypeOf(e)).constructor.__bjsclassName__;i||(i=typeof e)}return i},m.First=function(e,t){for(var i=0,r=e;i<r.length;i++){var n=r[i];if(t(n))return n}return null},m.getFullClassName=function(e,t){void 0===t&&(t=!1);var i=null,r=null;if(!t&&e.getClassName)i=e.getClassName();else{if(e instanceof Object){var n=t?e:Object.getPrototypeOf(e);i=n.constructor.__bjsclassName__,r=n.constructor.__bjsmoduleName__}i||(i=typeof e)}return i?(null!=r?r+".":"")+i:null},m.DelayAsync=function(t){return new Promise(function(e){setTimeout((function(){e()}),t)})},m.GetCurrentGradient=function(e,t,i){for(var r=0;r<t.length-1;r++){var n=t[r],o=t[r+1];if(e>=n.gradient&&e<=o.gradient)return void i(n,o,(e-n.gradient)/(o.gradient-n.gradient))}var s=t.length-1;i(t[s],t[s],1)},m.BaseUrl="",m.DefaultRetryStrategy=r.ExponentialBackoff(),m.CorsBehavior="anonymous",m.UseFallbackTexture=!0,m.RegisteredExternalClasses={},m.fallbackTexture="data:image/jpg;base64,/9j/4AAQSkZJRgABAQEAYABgAAD/4QBmRXhpZgAATU0AKgAAAAgABAEaAAUAAAABAAAAPgEbAAUAAAABAAAARgEoAAMAAAABAAIAAAExAAIAAAAQAAAATgAAAAAAAABgAAAAAQAAAGAAAAABcGFpbnQubmV0IDQuMC41AP/bAEMABAIDAwMCBAMDAwQEBAQFCQYFBQUFCwgIBgkNCw0NDQsMDA4QFBEODxMPDAwSGBITFRYXFxcOERkbGRYaFBYXFv/bAEMBBAQEBQUFCgYGChYPDA8WFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFhYWFv/AABEIAQABAAMBIgACEQEDEQH/xAAfAAABBQEBAQEBAQAAAAAAAAAAAQIDBAUGBwgJCgv/xAC1EAACAQMDAgQDBQUEBAAAAX0BAgMABBEFEiExQQYTUWEHInEUMoGRoQgjQrHBFVLR8CQzYnKCCQoWFxgZGiUmJygpKjQ1Njc4OTpDREVGR0hJSlNUVVZXWFlaY2RlZmdoaWpzdHV2d3h5eoOEhYaHiImKkpOUlZaXmJmaoqOkpaanqKmqsrO0tba3uLm6wsPExcbHyMnK0tPU1dbX2Nna4eLj5OXm5+jp6vHy8/T19vf4+fr/xAAfAQADAQEBAQEBAQEBAAAAAAAAAQIDBAUGBwgJCgv/xAC1EQACAQIEBAMEBwUEBAABAncAAQIDEQQFITEGEkFRB2FxEyIygQgUQpGhscEJIzNS8BVictEKFiQ04SXxFxgZGiYnKCkqNTY3ODk6Q0RFRkdISUpTVFVWV1hZWmNkZWZnaGlqc3R1dnd4eXqCg4SFhoeIiYqSk5SVlpeYmZqio6Slpqeoqaqys7S1tre4ubrCw8TFxsfIycrS09TV1tfY2dri4+Tl5ufo6ery8/T19vf4+fr/2gAMAwEAAhEDEQA/APH6KKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76CiiigD5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BQooooA+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/voKKKKAPl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FCiiigD6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++gooooA+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gUKKKKAPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76Pl+iiivuj+BT6gooor4U/vo+X6KKK+6P4FPqCiiivhT++j5fooor7o/gU+oKKKK+FP76P//Z",m._tmpFloatArray=new Float32Array(1),m.PreprocessUrl=function(e){return e},m.NoneLogLevel=0,m.MessageLogLevel=1,m.WarningLogLevel=2,m.ErrorLogLevel=4,m.AllLogLevel=7,m._LogCache="",m.errorsCount=0,m.Log=m._LogEnabled,m.Warn=m._WarnEnabled,m.Error=m._ErrorEnabled,m.PerformanceNoneLogLevel=0,m.PerformanceUserMarkLogLevel=1,m.PerformanceConsoleLogLevel=2,m.StartPerformanceCounter=m._StartPerformanceCounterDisabled,m.EndPerformanceCounter=m._EndPerformanceCounterDisabled,m})();_.Tools=n;var o=(function(){function i(){this._startMonitoringTime=0,this._min=0,this._max=0,this._average=0,this._lastSecAverage=0,this._current=0,this._totalValueCount=0,this._totalAccumulated=0,this._lastSecAccumulated=0,this._lastSecTime=0,this._lastSecValueCount=0}return Object.defineProperty(i.prototype,"min",{get:function(){return this._min},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"max",{get:function(){return this._max},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"average",{get:function(){return this._average},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"lastSecAverage",{get:function(){return this._lastSecAverage},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"current",{get:function(){return this._current},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"total",{get:function(){return this._totalAccumulated},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"count",{get:function(){return this._totalValueCount},enumerable:!0,configurable:!0}),i.prototype.fetchNewFrame=function(){this._totalValueCount++,this._current=0,this._lastSecValueCount++},i.prototype.addCount=function(e,t){i.Enabled&&(this._current+=e,t&&this._fetchResult())},i.prototype.beginMonitoring=function(){i.Enabled&&(this._startMonitoringTime=n.Now)},i.prototype.endMonitoring=function(e){if(void 0===e&&(e=!0),i.Enabled){e&&this.fetchNewFrame();var t=n.Now;this._current=t-this._startMonitoringTime,e&&this._fetchResult()}},i.prototype._fetchResult=function(){this._totalAccumulated+=this._current,this._lastSecAccumulated+=this._current,this._min=Math.min(this._min,this._current),this._max=Math.max(this._max,this._current),this._average=this._totalAccumulated/this._totalValueCount;var e=n.Now;1e3<e-this._lastSecTime&&(this._lastSecAverage=this._lastSecAccumulated/this._lastSecValueCount,this._lastSecTime=e,this._lastSecAccumulated=0,this._lastSecValueCount=0)},i.Enabled=!0,i})();_.PerfCounter=o,_.className=function(t,i){return function(e){e.__bjsclassName__=t,e.__bjsmoduleName__=null!=i?i:null}};var s=(function(){function a(e,t,i,r){void 0===r&&(r=0),this.iterations=e,this.index=r-1,this._done=!1,this._fn=t,this._successCallback=i}return a.prototype.executeNext=function(){this._done||(this.index+1<this.iterations?(++this.index,this._fn(this)):this.breakLoop())},a.prototype.breakLoop=function(){this._done=!0,this._successCallback()},a.Run=function(e,t,i,r){void 0===r&&(r=0);var n=new a(e,t,i,r);return n.executeNext(),n},a.SyncAsyncForLoop=function(r,n,o,e,s,t){return void 0===t&&(t=0),a.Run(Math.ceil(r/n),(function(i){s&&s()?i.breakLoop():setTimeout((function(){for(var e=0;e<n;++e){var t=i.index*n+e;if(r<=t)break;if(o(t),s&&s()){i.breakLoop();break}}i.executeNext()}),t)}),e)},a})();_.AsyncLoop=s})($a||($a={})),(function(o){var a,e;(e=a||(a={}))[e.Pending=0]="Pending",e[e.Fulfilled=1]="Fulfilled",e[e.Rejected=2]="Rejected";var s=function(){this.count=0,this.target=0,this.results=[]},t=(function(){function n(e){var t=this;if(this._state=a.Pending,this._children=new Array,this._rejectWasConsumed=!1,e)try{e((function(e){t._resolve(e)}),(function(e){t._reject(e)}))}catch(e){this._reject(e)}}return Object.defineProperty(n.prototype,"_result",{get:function(){return this._resultValue},set:function(e){this._resultValue=e,this._parent&&void 0===this._parent._result&&(this._parent._result=e)},enumerable:!0,configurable:!0}),n.prototype.catch=function(e){return this.then(void 0,e)},n.prototype.then=function(e,t){var i=this,r=new n;return r._onFulfilled=e,r._onRejected=t,this._children.push(r),(r._parent=this)._state!==a.Pending&&o.Tools.SetImmediate((function(){if(i._state===a.Fulfilled||i._rejectWasConsumed){var e=r._resolve(i._result);if(null!=e)if(void 0!==e._state){var t=e;r._children.push(t),t._parent=r,r=t}else r._result=e}else r._reject(i._reason)})),r},n.prototype._moveChildren=function(e){var t,i=this;if((t=this._children).push.apply(t,e.splice(0,e.length)),this._children.forEach((function(e){e._parent=i})),this._state===a.Fulfilled)for(var r=0,n=this._children;r<n.length;r++){n[r]._resolve(this._result)}else if(this._state===a.Rejected)for(var o=0,s=this._children;o<s.length;o++){s[o]._reject(this._reason)}},n.prototype._resolve=function(e){try{this._state=a.Fulfilled;var t=null;if(this._onFulfilled&&(t=this._onFulfilled(e)),null!=t)if(void 0!==t._state){var i=t;i._parent=this,i._moveChildren(this._children),e=i._result}else e=t;this._result=e;for(var r=0,n=this._children;r<n.length;r++){n[r]._resolve(e)}this._children.length=0,delete this._onFulfilled,delete this._onRejected}catch(e){this._reject(e,!0)}},n.prototype._reject=function(t,e){if(void 0===e&&(e=!1),this._state=a.Rejected,this._reason=t,this._onRejected&&!e)try{this._onRejected(t),this._rejectWasConsumed=!0}catch(e){t=e}for(var i=0,r=this._children;i<r.length;i++){var n=r[i];this._rejectWasConsumed?n._resolve(null):n._reject(t)}this._children.length=0,delete this._onFulfilled,delete this._onRejected},n.resolve=function(e){var t=new n;return t._resolve(e),t},n._RegisterForFulfillment=function(e,t,i){e.then((function(e){return t.results[i]=e,t.count++,t.count===t.target&&t.rootPromise._resolve(t.results),null}),(function(e){t.rootPromise._state!==a.Rejected&&t.rootPromise._reject(e)}))},n.all=function(e){var t=new n,i=new s;if(i.target=e.length,i.rootPromise=t,e.length)for(var r=0;r<e.length;r++)n._RegisterForFulfillment(e[r],i,r);else t._resolve([]);return t},n.race=function(e){var t=new n;if(e.length)for(var i=0,r=e;i<r.length;i++){r[i].then((function(e){return t&&(t._resolve(e),t=null),null}),(function(e){t&&(t._reject(e),t=null)}))}return t},n})(),i=(function(){function e(){}return e.Apply=function(e){(void 0===e&&(e=!1),e||"undefined"==typeof Promise)&&(window.Promise=t)},e})();o.PromisePolyfill=i})($a||($a={})),h=$a||($a={}),u=(function(){function e(e){this._pendingActions=new Array,this._workerInfos=e.map((function(e){return{worker:e,active:!1}}))}return e.prototype.dispose=function(){for(var e=0,t=this._workerInfos;e<t.length;e++){t[e].worker.terminate()}delete this._workerInfos,delete this._pendingActions},e.prototype.push=function(e){for(var t=0,i=this._workerInfos;t<i.length;t++){var r=i[t];if(!r.active)return void this._execute(r,e)}this._pendingActions.push(e)},e.prototype._execute=function(t,e){var i=this;t.active=!0,e(t.worker,(function(){t.active=!1;var e=i._pendingActions.shift();e&&i._execute(t,e)}))},e})(),h.WorkerPool=u,d=$a||($a={}),f=(function(){function e(){this._isAlphaBlendDirty=!1,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1,this._alphaBlend=!1,this._blendFunctionParameters=new Array(4),this._blendEquationParameters=new Array(2),this._blendConstants=new Array(4),this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isAlphaBlendDirty||this._isBlendFunctionParametersDirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"alphaBlend",{get:function(){return this._alphaBlend},set:function(e){this._alphaBlend!==e&&(this._alphaBlend=e,this._isAlphaBlendDirty=!0)},enumerable:!0,configurable:!0}),e.prototype.setAlphaBlendConstants=function(e,t,i,r){this._blendConstants[0]===e&&this._blendConstants[1]===t&&this._blendConstants[2]===i&&this._blendConstants[3]===r||(this._blendConstants[0]=e,this._blendConstants[1]=t,this._blendConstants[2]=i,this._blendConstants[3]=r,this._isBlendConstantsDirty=!0)},e.prototype.setAlphaBlendFunctionParameters=function(e,t,i,r){this._blendFunctionParameters[0]===e&&this._blendFunctionParameters[1]===t&&this._blendFunctionParameters[2]===i&&this._blendFunctionParameters[3]===r||(this._blendFunctionParameters[0]=e,this._blendFunctionParameters[1]=t,this._blendFunctionParameters[2]=i,this._blendFunctionParameters[3]=r,this._isBlendFunctionParametersDirty=!0)},e.prototype.setAlphaEquationParameters=function(e,t){this._blendEquationParameters[0]===e&&this._blendEquationParameters[1]===t||(this._blendEquationParameters[0]=e,this._blendEquationParameters[1]=t,this._isBlendEquationParametersDirty=!0)},e.prototype.reset=function(){this._alphaBlend=!1,this._blendFunctionParameters[0]=null,this._blendFunctionParameters[1]=null,this._blendFunctionParameters[2]=null,this._blendFunctionParameters[3]=null,this._blendEquationParameters[0]=null,this._blendEquationParameters[1]=null,this._blendConstants[0]=null,this._blendConstants[1]=null,this._blendConstants[2]=null,this._blendConstants[3]=null,this._isAlphaBlendDirty=!0,this._isBlendFunctionParametersDirty=!1,this._isBlendEquationParametersDirty=!1,this._isBlendConstantsDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isAlphaBlendDirty&&(this._alphaBlend?e.enable(e.BLEND):e.disable(e.BLEND),this._isAlphaBlendDirty=!1),this._isBlendFunctionParametersDirty&&(e.blendFuncSeparate(this._blendFunctionParameters[0],this._blendFunctionParameters[1],this._blendFunctionParameters[2],this._blendFunctionParameters[3]),this._isBlendFunctionParametersDirty=!1),this._isBlendEquationParametersDirty&&(e.blendEquationSeparate(this._blendEquationParameters[0],this._blendEquationParameters[1]),this._isBlendEquationParametersDirty=!1),this._isBlendConstantsDirty&&(e.blendColor(this._blendConstants[0],this._blendConstants[1],this._blendConstants[2],this._blendConstants[3]),this._isBlendConstantsDirty=!1))},e})(),d._AlphaState=f,p=$a||($a={}),_=(function(){function e(){this._isDepthTestDirty=!1,this._isDepthMaskDirty=!1,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDepthFuncDirty||this._isDepthTestDirty||this._isDepthMaskDirty||this._isCullFaceDirty||this._isCullDirty||this._isZOffsetDirty||this._isFrontFaceDirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zOffset",{get:function(){return this._zOffset},set:function(e){this._zOffset!==e&&(this._zOffset=e,this._isZOffsetDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cullFace",{get:function(){return this._cullFace},set:function(e){this._cullFace!==e&&(this._cullFace=e,this._isCullFaceDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cull",{get:function(){return this._cull},set:function(e){this._cull!==e&&(this._cull=e,this._isCullDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthFunc",{get:function(){return this._depthFunc},set:function(e){this._depthFunc!==e&&(this._depthFunc=e,this._isDepthFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthMask",{get:function(){return this._depthMask},set:function(e){this._depthMask!==e&&(this._depthMask=e,this._isDepthMaskDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthTest",{get:function(){return this._depthTest},set:function(e){this._depthTest!==e&&(this._depthTest=e,this._isDepthTestDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frontFace",{get:function(){return this._frontFace},set:function(e){this._frontFace!==e&&(this._frontFace=e,this._isFrontFaceDirty=!0)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this._depthMask=!0,this._depthTest=!0,this._depthFunc=null,this._cullFace=null,this._cull=null,this._zOffset=0,this._frontFace=null,this._isDepthTestDirty=!0,this._isDepthMaskDirty=!0,this._isDepthFuncDirty=!1,this._isCullFaceDirty=!1,this._isCullDirty=!1,this._isZOffsetDirty=!1,this._isFrontFaceDirty=!1},e.prototype.apply=function(e){this.isDirty&&(this._isCullDirty&&(this.cull?e.enable(e.CULL_FACE):e.disable(e.CULL_FACE),this._isCullDirty=!1),this._isCullFaceDirty&&(e.cullFace(this.cullFace),this._isCullFaceDirty=!1),this._isDepthMaskDirty&&(e.depthMask(this.depthMask),this._isDepthMaskDirty=!1),this._isDepthTestDirty&&(this.depthTest?e.enable(e.DEPTH_TEST):e.disable(e.DEPTH_TEST),this._isDepthTestDirty=!1),this._isDepthFuncDirty&&(e.depthFunc(this.depthFunc),this._isDepthFuncDirty=!1),this._isZOffsetDirty&&(this.zOffset?(e.enable(e.POLYGON_OFFSET_FILL),e.polygonOffset(this.zOffset,0)):e.disable(e.POLYGON_OFFSET_FILL),this._isZOffsetDirty=!1),this._isFrontFaceDirty&&(e.frontFace(this.frontFace),this._isFrontFaceDirty=!1))},e})(),p._DepthCullingState=_,g=$a||($a={}),v=(function(){function e(){this._isStencilTestDirty=!1,this._isStencilMaskDirty=!1,this._isStencilFuncDirty=!1,this._isStencilOpDirty=!1,this.reset()}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isStencilTestDirty||this._isStencilMaskDirty||this._isStencilFuncDirty||this._isStencilOpDirty},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilFunc",{get:function(){return this._stencilFunc},set:function(e){this._stencilFunc!==e&&(this._stencilFunc=e,this._isStencilFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncRef",{get:function(){return this._stencilFuncRef},set:function(e){this._stencilFuncRef!==e&&(this._stencilFuncRef=e,this._isStencilFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilFuncMask",{get:function(){return this._stencilFuncMask},set:function(e){this._stencilFuncMask!==e&&(this._stencilFuncMask=e,this._isStencilFuncDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilFail",{get:function(){return this._stencilOpStencilFail},set:function(e){this._stencilOpStencilFail!==e&&(this._stencilOpStencilFail=e,this._isStencilOpDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpDepthFail",{get:function(){return this._stencilOpDepthFail},set:function(e){this._stencilOpDepthFail!==e&&(this._stencilOpDepthFail=e,this._isStencilOpDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilOpStencilDepthPass",{get:function(){return this._stencilOpStencilDepthPass},set:function(e){this._stencilOpStencilDepthPass!==e&&(this._stencilOpStencilDepthPass=e,this._isStencilOpDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilMask",{get:function(){return this._stencilMask},set:function(e){this._stencilMask!==e&&(this._stencilMask=e,this._isStencilMaskDirty=!0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"stencilTest",{get:function(){return this._stencilTest},set:function(e){this._stencilTest!==e&&(this._stencilTest=e,this._isStencilTestDirty=!0)},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this._stencilTest=!1,this._stencilMask=255,this._stencilFunc=g.Engine.ALWAYS,this._stencilFuncRef=1,this._stencilFuncMask=255,this._stencilOpStencilFail=g.Engine.KEEP,this._stencilOpDepthFail=g.Engine.KEEP,this._stencilOpStencilDepthPass=g.Engine.REPLACE,this._isStencilTestDirty=!0,this._isStencilMaskDirty=!0,this._isStencilFuncDirty=!0,this._isStencilOpDirty=!0},e.prototype.apply=function(e){this.isDirty&&(this._isStencilTestDirty&&(this.stencilTest?e.enable(e.STENCIL_TEST):e.disable(e.STENCIL_TEST),this._isStencilTestDirty=!1),this._isStencilMaskDirty&&(e.stencilMask(this.stencilMask),this._isStencilMaskDirty=!1),this._isStencilFuncDirty&&(e.stencilFunc(this.stencilFunc,this.stencilFuncRef,this.stencilFuncMask),this._isStencilFuncDirty=!1),this._isStencilOpDirty&&(e.stencilOp(this.stencilOpStencilFail,this.stencilOpDepthFail,this.stencilOpStencilDepthPass),this._isStencilOpDirty=!1))},e})(),g._StencilState=v;var y,E,x,P,A,S,M,R,C,O,D,I,w,L,F,B,N,V,U,z,G,k,W,H,X,j,Y,K,Q,Z,q,J,$,ee,te,ie,re,ne,oe,se,ae=this&&this.__assign||function(){return(ae=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};!(function(R){var b=function(){},e=function(){};R.InstancingAttributeInfo=e;var h=function(){};R.RenderTargetCreationOptions=h;var t=function(){};R.DepthTextureCreationOptions=t;var l=function(){};R.EngineCapabilities=l;var i=(function(){function M(e,t,i,r){void 0===r&&(r=!1);var n=this;this.forcePOTTextures=!1,this.isFullscreen=!1,this.isPointerLock=!1,this.cullBackFaces=!0,this.renderEvenInBackground=!0,this.preventCacheWipeBetweenFrames=!1,this.enableOfflineSupport=!1,this.disableManifestCheck=!1,this.scenes=new Array,this.postProcesses=new Array,this.validateShaderPrograms=!1,this.onResizeObservable=new R.Observable,this.onCanvasBlurObservable=new R.Observable,this.onCanvasFocusObservable=new R.Observable,this.onCanvasPointerOutObservable=new R.Observable,this.onBeforeTextureInitObservable=new R.Observable,this._vrDisplay=void 0,this._vrSupported=!1,this._vrExclusivePointerMode=!1,this.disableUniformBuffers=!1,this._uniformBuffers=new Array,this.onBeginFrameObservable=new R.Observable,this.onEndFrameObservable=new R.Observable,this.onBeforeShaderCompilationObservable=new R.Observable,this.onAfterShaderCompilationObservable=new R.Observable,this._windowIsBackground=!1,this._webGLVersion=1,this._badOS=!1,this._badDesktopOS=!1,this.disableTextureBindingOptimization=!1,this.onVRDisplayChangedObservable=new R.Observable,this.onVRRequestPresentComplete=new R.Observable,this.onVRRequestPresentStart=new R.Observable,this._colorWrite=!0,this._drawCalls=new R.PerfCounter,this._textureCollisions=new R.PerfCounter,this._renderingQueueLaunched=!1,this._activeRenderLoops=new Array,this._deterministicLockstep=!1,this._lockstepMaxSteps=4,this.onContextLostObservable=new R.Observable,this.onContextRestoredObservable=new R.Observable,this._contextWasLost=!1,this._doNotHandleContextLost=!1,this._performanceMonitor=new R.PerformanceMonitor,this._fps=60,this._deltaTime=0,this.disablePerformanceMonitorInBackground=!1,this._depthCullingState=new R._DepthCullingState,this._stencilState=new R._StencilState,this._alphaState=new R._AlphaState,this._alphaMode=M.ALPHA_DISABLE,this._internalTexturesCache=new Array,this._activeChannel=0,this._currentTextureChannel=-1,this._boundTexturesCache={},this._compiledEffects={},this._vertexAttribArraysEnabled=[],this._uintIndicesCurrentlySet=!1,this._currentBoundBuffer=new Array,this._currentFramebuffer=null,this._currentBufferPointers=new Array,this._currentInstanceLocations=new Array,this._currentInstanceBuffers=new Array,this._firstBoundInternalTextureTracker=new R.DummyInternalTextureTracker,this._lastBoundInternalTextureTracker=new R.DummyInternalTextureTracker,this._vaoRecordInProgress=!1,this._mustWipeVertexAttributes=!1,this._nextFreeTextureSlots=new Array,this._maxSimultaneousTextures=0,this._activeRequests=new Array,this._texturesSupported=new Array,this.premultipliedAlpha=!0,this._viewportCached=new R.Vector4(0,0,0,0),this._onVRFullScreenTriggered=function(){if(n._vrDisplay&&n._vrDisplay.isPresenting){n._oldSize=new R.Size(n.getRenderWidth(),n.getRenderHeight()),n._oldHardwareScaleFactor=n.getHardwareScalingLevel();var e=n._vrDisplay.getEyeParameters("left");n.setHardwareScalingLevel(1),n.setSize(2*e.renderWidth,e.renderHeight)}else n.setHardwareScalingLevel(n._oldHardwareScaleFactor),n.setSize(n._oldSize.width,n._oldSize.height)},this._unpackFlipYCached=null,this.enableUnpackFlipYCached=!0,this._boundUniforms={},R.PromisePolyfill.Apply();var o=null;if(M.Instances.push(this),e){if(i=i||{},e.getContext){if(o=e,this._renderingCanvas=o,null!=t&&(i.antialias=t),void 0===i.deterministicLockstep&&(i.deterministicLockstep=!1),void 0===i.lockstepMaxSteps&&(i.lockstepMaxSteps=4),void 0===i.preserveDrawingBuffer&&(i.preserveDrawingBuffer=!1),void 0===i.audioEngine&&(i.audioEngine=!0),void 0===i.stencil&&(i.stencil=!0),!1===i.premultipliedAlpha&&(this.premultipliedAlpha=!1),this._deterministicLockstep=i.deterministicLockstep,this._lockstepMaxSteps=i.lockstepMaxSteps,this._doNotHandleContextLost=!!i.doNotHandleContextLost,navigator&&navigator.userAgent)for(var s=navigator.userAgent,a=0,l=M.ExceptionList;a<l.length;a++){var c=l[a],h=c.key,u=c.targets;if(-1<s.indexOf(h)){if(c.capture&&c.captureConstraint){var d=c.capture,f=c.captureConstraint,p=new RegExp(d).exec(s);if(p&&0<p.length)if(f<=parseInt(p[p.length-1]))continue}for(var _=0,m=u;_<m.length;_++){switch(m[_]){case"uniformBuffer":this.disableUniformBuffers=!0;break;case"textureBindingOptimization":this.disableTextureBindingOptimization=!0}}}}if(!i.disableWebGL2Support)try{this._gl=o.getContext("webgl2",i)||o.getContext("experimental-webgl2",i),this._gl&&(this._webGLVersion=2,this._gl.deleteQuery||(this._webGLVersion=1))}catch(e){}if(!this._gl){if(!o)throw new Error("The provided canvas is null or undefined.");try{this._gl=o.getContext("webgl",i)||o.getContext("experimental-webgl",i)}catch(e){throw new Error("WebGL not supported")}}if(!this._gl)throw new Error("WebGL not supported");this._onCanvasFocus=function(){n.onCanvasFocusObservable.notifyObservers(n)},this._onCanvasBlur=function(){n.onCanvasBlurObservable.notifyObservers(n)},o.addEventListener("focus",this._onCanvasFocus),o.addEventListener("blur",this._onCanvasBlur),this._onBlur=function(){n.disablePerformanceMonitorInBackground&&n._performanceMonitor.disable(),n._windowIsBackground=!0},this._onFocus=function(){n.disablePerformanceMonitorInBackground&&n._performanceMonitor.enable(),n._windowIsBackground=!1},this._onCanvasPointerOut=function(e){n.onCanvasPointerOutObservable.notifyObservers(e)},window.addEventListener("blur",this._onBlur),window.addEventListener("focus",this._onFocus),o.addEventListener("pointerout",this._onCanvasPointerOut),this._doNotHandleContextLost||(this._onContextLost=function(e){e.preventDefault(),n._contextWasLost=!0,R.Tools.Warn("WebGL context lost."),n.onContextLostObservable.notifyObservers(n)},this._onContextRestored=function(e){setTimeout((function(){n._initGLContext(),n._rebuildEffects(),n._rebuildInternalTextures(),n._rebuildBuffers(),n.wipeCaches(!0),R.Tools.Warn("WebGL context successfully restored."),n.onContextRestoredObservable.notifyObservers(n),n._contextWasLost=!1}),0)},o.addEventListener("webglcontextlost",this._onContextLost,!1),o.addEventListener("webglcontextrestored",this._onContextRestored,!1))}else{this._gl=e,this._renderingCanvas=this._gl.canvas,this._gl.renderbufferStorageMultisample&&(this._webGLVersion=2);var g=this._gl.getContextAttributes();g&&(i.stencil=g.stencil)}var v=i.limitDeviceRatio||window.devicePixelRatio||1;this._hardwareScalingLevel=r?1/Math.min(v,window.devicePixelRatio||1):1,this.resize(),this._isStencilEnable=!!i.stencil,this._initGLContext(),o&&(this._onFullscreenChange=function(){void 0!==document.fullscreen?n.isFullscreen=document.fullscreen:void 0!==document.mozFullScreen?n.isFullscreen=document.mozFullScreen:void 0!==document.webkitIsFullScreen?n.isFullscreen=document.webkitIsFullScreen:void 0!==document.msIsFullScreen&&(n.isFullscreen=document.msIsFullScreen),n.isFullscreen&&n._pointerLockRequested&&o&&(o.requestPointerLock=o.requestPointerLock||o.msRequestPointerLock||o.mozRequestPointerLock||o.webkitRequestPointerLock,o.requestPointerLock&&o.requestPointerLock())},document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",this._onFullscreenChange,!1),this._onPointerLockChange=function(){n.isPointerLock=document.mozPointerLockElement===o||document.webkitPointerLockElement===o||document.msPointerLockElement===o||document.pointerLockElement===o},document.addEventListener("pointerlockchange",this._onPointerLockChange,!1),document.addEventListener("mspointerlockchange",this._onPointerLockChange,!1),document.addEventListener("mozpointerlockchange",this._onPointerLockChange,!1),document.addEventListener("webkitpointerlockchange",this._onPointerLockChange,!1),this._onVRDisplayPointerRestricted=function(){o&&o.requestPointerLock()},this._onVRDisplayPointerUnrestricted=function(){document.exitPointerLock()},window.addEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted,!1),window.addEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted,!1)),!M.audioEngine&&i.audioEngine&&M.AudioEngineFactory&&(M.audioEngine=M.AudioEngineFactory(this.getRenderingCanvas()));for(var y=0;y<this._caps.maxVertexAttribs;y++)this._currentBufferPointers[y]=new b;this._linkTrackers(this._firstBoundInternalTextureTracker,this._lastBoundInternalTextureTracker),i.autoEnableWebVR&&this.initWebVR(),this._badOS=/iPad/i.test(navigator.userAgent)||/iPhone/i.test(navigator.userAgent),this._badDesktopOS=/^((?!chrome|android).)*safari/i.test(navigator.userAgent),console.log("Babylon.js engine (v"+M.Version+") launched"),this.enableOfflineSupport=void 0!==R.Database}}return Object.defineProperty(M,"LastCreatedEngine",{get:function(){return 0===M.Instances.length?null:M.Instances[M.Instances.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(M,"LastCreatedScene",{get:function(){var e=M.LastCreatedEngine;return e?0===e.scenes.length?null:e.scenes[e.scenes.length-1]:null},enumerable:!0,configurable:!0}),M.MarkAllMaterialsAsDirty=function(e,t){for(var i=0;i<M.Instances.length;i++)for(var r=M.Instances[i],n=0;n<r.scenes.length;n++)r.scenes[n].markAllMaterialsAsDirty(e,t)},Object.defineProperty(M,"Version",{get:function(){return"3.3.0"},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"isInVRExclusivePointerMode",{get:function(){return this._vrExclusivePointerMode},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"supportsUniformBuffers",{get:function(){return 1<this.webGLVersion&&!this.disableUniformBuffers},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"needPOTTextures",{get:function(){return this._webGLVersion<2||this.forcePOTTextures},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"doNotHandleContextLost",{get:function(){return this._doNotHandleContextLost},set:function(e){this._doNotHandleContextLost=e},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"performanceMonitor",{get:function(){return this._performanceMonitor},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"texturesSupported",{get:function(){return this._texturesSupported},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"textureFormatInUse",{get:function(){return this._textureFormatInUse},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"currentViewport",{get:function(){return this._cachedViewport},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"emptyTexture",{get:function(){return this._emptyTexture||(this._emptyTexture=this.createRawTexture(new Uint8Array(4),1,1,M.TEXTUREFORMAT_RGBA,!1,!1,M.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"emptyTexture3D",{get:function(){return this._emptyTexture3D||(this._emptyTexture3D=this.createRawTexture3D(new Uint8Array(4),1,1,1,M.TEXTUREFORMAT_RGBA,!1,!1,M.TEXTURE_NEAREST_SAMPLINGMODE)),this._emptyTexture3D},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"emptyCubeTexture",{get:function(){if(!this._emptyCubeTexture){var e=new Uint8Array(4),t=[e,e,e,e,e,e];this._emptyCubeTexture=this.createRawCubeTexture(t,1,M.TEXTUREFORMAT_RGBA,M.TEXTURETYPE_UNSIGNED_INT,!1,!1,M.TEXTURE_NEAREST_SAMPLINGMODE)}return this._emptyCubeTexture},enumerable:!0,configurable:!0}),M.prototype._rebuildInternalTextures=function(){for(var e=0,t=this._internalTexturesCache.slice();e<t.length;e++){t[e]._rebuild()}},M.prototype._rebuildEffects=function(){for(var e in this._compiledEffects){this._compiledEffects[e]._prepareEffect()}R.Effect.ResetCache()},M.prototype._rebuildBuffers=function(){for(var e=0,t=this.scenes;e<t.length;e++){var i=t[e];i.resetCachedMaterial(),i._rebuildGeometries(),i._rebuildTextures()}for(var r=0,n=this._uniformBuffers;r<n.length;r++){n[r]._rebuild()}},M.prototype._initGLContext=function(){this._caps=new l,this._caps.maxTexturesImageUnits=this._gl.getParameter(this._gl.MAX_TEXTURE_IMAGE_UNITS),this._caps.maxCombinedTexturesImageUnits=this._gl.getParameter(this._gl.MAX_COMBINED_TEXTURE_IMAGE_UNITS),this._caps.maxVertexTextureImageUnits=this._gl.getParameter(this._gl.MAX_VERTEX_TEXTURE_IMAGE_UNITS),this._caps.maxTextureSize=this._gl.getParameter(this._gl.MAX_TEXTURE_SIZE),this._caps.maxCubemapTextureSize=this._gl.getParameter(this._gl.MAX_CUBE_MAP_TEXTURE_SIZE),this._caps.maxRenderTextureSize=this._gl.getParameter(this._gl.MAX_RENDERBUFFER_SIZE),this._caps.maxVertexAttribs=this._gl.getParameter(this._gl.MAX_VERTEX_ATTRIBS),this._caps.maxVaryingVectors=this._gl.getParameter(this._gl.MAX_VARYING_VECTORS),this._caps.maxFragmentUniformVectors=this._gl.getParameter(this._gl.MAX_FRAGMENT_UNIFORM_VECTORS),this._caps.maxVertexUniformVectors=this._gl.getParameter(this._gl.MAX_VERTEX_UNIFORM_VECTORS),this._glVersion=this._gl.getParameter(this._gl.VERSION);var e=this._gl.getExtension("WEBGL_debug_renderer_info");if(null!=e&&(this._glRenderer=this._gl.getParameter(e.UNMASKED_RENDERER_WEBGL),this._glVendor=this._gl.getParameter(e.UNMASKED_VENDOR_WEBGL)),this._glVendor||(this._glVendor="Unknown vendor"),this._glRenderer||(this._glRenderer="Unknown renderer"),this._gl.HALF_FLOAT_OES=36193,34842!==this._gl.RGBA16F&&(this._gl.RGBA16F=34842),34836!==this._gl.RGBA32F&&(this._gl.RGBA32F=34836),35056!==this._gl.DEPTH24_STENCIL8&&(this._gl.DEPTH24_STENCIL8=35056),this._caps.standardDerivatives=1<this._webGLVersion||null!==this._gl.getExtension("OES_standard_derivatives"),this._caps.astc=this._gl.getExtension("WEBGL_compressed_texture_astc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_astc"),this._caps.s3tc=this._gl.getExtension("WEBGL_compressed_texture_s3tc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_s3tc"),this._caps.pvrtc=this._gl.getExtension("WEBGL_compressed_texture_pvrtc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_pvrtc"),this._caps.etc1=this._gl.getExtension("WEBGL_compressed_texture_etc1")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc1"),this._caps.etc2=this._gl.getExtension("WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBKIT_WEBGL_compressed_texture_etc")||this._gl.getExtension("WEBGL_compressed_texture_es3_0"),this._caps.textureAnisotropicFilterExtension=this._gl.getExtension("EXT_texture_filter_anisotropic")||this._gl.getExtension("WEBKIT_EXT_texture_filter_anisotropic")||this._gl.getExtension("MOZ_EXT_texture_filter_anisotropic"),this._caps.maxAnisotropy=this._caps.textureAnisotropicFilterExtension?this._gl.getParameter(this._caps.textureAnisotropicFilterExtension.MAX_TEXTURE_MAX_ANISOTROPY_EXT):0,this._caps.uintIndices=1<this._webGLVersion||null!==this._gl.getExtension("OES_element_index_uint"),this._caps.fragmentDepthSupported=1<this._webGLVersion||null!==this._gl.getExtension("EXT_frag_depth"),this._caps.highPrecisionShaderSupported=!0,this._caps.timerQuery=this._gl.getExtension("EXT_disjoint_timer_query_webgl2")||this._gl.getExtension("EXT_disjoint_timer_query"),this._caps.timerQuery&&(1===this._webGLVersion&&(this._gl.getQuery=this._caps.timerQuery.getQueryEXT.bind(this._caps.timerQuery)),this._caps.canUseTimestampForTimerQuery=0<this._gl.getQuery(this._caps.timerQuery.TIMESTAMP_EXT,this._caps.timerQuery.QUERY_COUNTER_BITS_EXT)),this._caps.colorBufferFloat=1<this._webGLVersion&&this._gl.getExtension("EXT_color_buffer_float"),this._caps.textureFloat=!!(1<this._webGLVersion||this._gl.getExtension("OES_texture_float")),this._caps.textureFloatLinearFiltering=!(!this._caps.textureFloat||!this._gl.getExtension("OES_texture_float_linear")),this._caps.textureFloatRender=!(!this._caps.textureFloat||!this._canRenderToFloatFramebuffer()),this._caps.textureHalfFloat=!!(1<this._webGLVersion||this._gl.getExtension("OES_texture_half_float")),this._caps.textureHalfFloatLinearFiltering=!!(1<this._webGLVersion||this._caps.textureHalfFloat&&this._gl.getExtension("OES_texture_half_float_linear")),1<this._webGLVersion&&(this._gl.HALF_FLOAT_OES=5131),this._caps.textureHalfFloatRender=this._caps.textureHalfFloat&&this._canRenderToHalfFloatFramebuffer(),this._caps.textureLOD=!!(1<this._webGLVersion||this._gl.getExtension("EXT_shader_texture_lod")),1<this._webGLVersion)this._caps.drawBuffersExtension=!0;else{var t=this._gl.getExtension("WEBGL_draw_buffers");if(null!==t){this._caps.drawBuffersExtension=!0,this._gl.drawBuffers=t.drawBuffersWEBGL.bind(t),this._gl.DRAW_FRAMEBUFFER=this._gl.FRAMEBUFFER;for(var i=0;i<16;i++)this._gl["COLOR_ATTACHMENT"+i+"_WEBGL"]=t["COLOR_ATTACHMENT"+i+"_WEBGL"]}else this._caps.drawBuffersExtension=!1}if(1<this._webGLVersion)this._caps.depthTextureExtension=!0;else{var r=this._gl.getExtension("WEBGL_depth_texture");null!=r&&(this._caps.depthTextureExtension=!0,this._gl.UNSIGNED_INT_24_8=r.UNSIGNED_INT_24_8_WEBGL)}if(1<this._webGLVersion)this._caps.vertexArrayObject=!0;else{var n=this._gl.getExtension("OES_vertex_array_object");null!=n?(this._caps.vertexArrayObject=!0,this._gl.createVertexArray=n.createVertexArrayOES.bind(n),this._gl.bindVertexArray=n.bindVertexArrayOES.bind(n),this._gl.deleteVertexArray=n.deleteVertexArrayOES.bind(n)):this._caps.vertexArrayObject=!1}if(1<this._webGLVersion)this._caps.instancedArrays=!0;else{var o=this._gl.getExtension("ANGLE_instanced_arrays");null!=o?(this._caps.instancedArrays=!0,this._gl.drawArraysInstanced=o.drawArraysInstancedANGLE.bind(o),this._gl.drawElementsInstanced=o.drawElementsInstancedANGLE.bind(o),this._gl.vertexAttribDivisor=o.vertexAttribDivisorANGLE.bind(o)):this._caps.instancedArrays=!1}if(this._caps.astc&&this.texturesSupported.push("-astc.ktx"),this._caps.s3tc&&this.texturesSupported.push("-dxt.ktx"),this._caps.pvrtc&&this.texturesSupported.push("-pvrtc.ktx"),this._caps.etc2&&this.texturesSupported.push("-etc2.ktx"),this._caps.etc1&&this.texturesSupported.push("-etc1.ktx"),this._gl.getShaderPrecisionFormat){var s=this._gl.getShaderPrecisionFormat(this._gl.FRAGMENT_SHADER,this._gl.HIGH_FLOAT);s&&(this._caps.highPrecisionShaderSupported=0!==s.precision)}this.setDepthBuffer(!0),this.setDepthFunctionToLessOrEqual(),this.setDepthWrite(!0),this._maxSimultaneousTextures=this._caps.maxCombinedTexturesImageUnits;for(var a=0;a<this._maxSimultaneousTextures;a++)this._nextFreeTextureSlots.push(a)},Object.defineProperty(M.prototype,"webGLVersion",{get:function(){return this._webGLVersion},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"isStencilEnable",{get:function(){return this._isStencilEnable},enumerable:!0,configurable:!0}),M.prototype._prepareWorkingCanvas=function(){if(!this._workingCanvas){this._workingCanvas=document.createElement("canvas");var e=this._workingCanvas.getContext("2d");e&&(this._workingContext=e)}},M.prototype.resetTextureCache=function(){for(var e in this._boundTexturesCache)if(this._boundTexturesCache.hasOwnProperty(e)){var t=this._boundTexturesCache[e];t&&this._removeDesignatedSlot(t),this._boundTexturesCache[e]=null}if(!this.disableTextureBindingOptimization){this._nextFreeTextureSlots=[];for(var i=0;i<this._maxSimultaneousTextures;i++)this._nextFreeTextureSlots.push(i)}this._currentTextureChannel=-1},M.prototype.isDeterministicLockStep=function(){return this._deterministicLockstep},M.prototype.getLockstepMaxSteps=function(){return this._lockstepMaxSteps},M.prototype.getGlInfo=function(){return{vendor:this._glVendor,renderer:this._glRenderer,version:this._glVersion}},M.prototype.getAspectRatio=function(e,t){void 0===t&&(t=!1);var i=e.viewport;return this.getRenderWidth(t)*i.width/(this.getRenderHeight(t)*i.height)},M.prototype.getScreenAspectRatio=function(){return this.getRenderWidth(!0)/this.getRenderHeight(!0)},M.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._gl.drawingBufferWidth},M.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._gl.drawingBufferHeight},M.prototype.getRenderingCanvas=function(){return this._renderingCanvas},M.prototype.getRenderingCanvasClientRect=function(){return this._renderingCanvas?this._renderingCanvas.getBoundingClientRect():null},M.prototype.setHardwareScalingLevel=function(e){this._hardwareScalingLevel=e,this.resize()},M.prototype.getHardwareScalingLevel=function(){return this._hardwareScalingLevel},M.prototype.getLoadedTexturesCache=function(){return this._internalTexturesCache},M.prototype.getCaps=function(){return this._caps},Object.defineProperty(M.prototype,"drawCalls",{get:function(){return R.Tools.Warn("drawCalls is deprecated. Please use SceneInstrumentation class"),0},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"drawCallsPerfCounter",{get:function(){return R.Tools.Warn("drawCallsPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),M.prototype.getDepthFunction=function(){return this._depthCullingState.depthFunc},M.prototype.setDepthFunction=function(e){this._depthCullingState.depthFunc=e},M.prototype.setDepthFunctionToGreater=function(){this._depthCullingState.depthFunc=this._gl.GREATER},M.prototype.setDepthFunctionToGreaterOrEqual=function(){this._depthCullingState.depthFunc=this._gl.GEQUAL},M.prototype.setDepthFunctionToLess=function(){this._depthCullingState.depthFunc=this._gl.LESS},M.prototype.setDepthFunctionToLessOrEqual=function(){this._depthCullingState.depthFunc=this._gl.LEQUAL},M.prototype.getStencilBuffer=function(){return this._stencilState.stencilTest},M.prototype.setStencilBuffer=function(e){this._stencilState.stencilTest=e},M.prototype.getStencilMask=function(){return this._stencilState.stencilMask},M.prototype.setStencilMask=function(e){this._stencilState.stencilMask=e},M.prototype.getStencilFunction=function(){return this._stencilState.stencilFunc},M.prototype.getStencilFunctionReference=function(){return this._stencilState.stencilFuncRef},M.prototype.getStencilFunctionMask=function(){return this._stencilState.stencilFuncMask},M.prototype.setStencilFunction=function(e){this._stencilState.stencilFunc=e},M.prototype.setStencilFunctionReference=function(e){this._stencilState.stencilFuncRef=e},M.prototype.setStencilFunctionMask=function(e){this._stencilState.stencilFuncMask=e},M.prototype.getStencilOperationFail=function(){return this._stencilState.stencilOpStencilFail},M.prototype.getStencilOperationDepthFail=function(){return this._stencilState.stencilOpDepthFail},M.prototype.getStencilOperationPass=function(){return this._stencilState.stencilOpStencilDepthPass},M.prototype.setStencilOperationFail=function(e){this._stencilState.stencilOpStencilFail=e},M.prototype.setStencilOperationDepthFail=function(e){this._stencilState.stencilOpDepthFail=e},M.prototype.setStencilOperationPass=function(e){this._stencilState.stencilOpStencilDepthPass=e},M.prototype.setDitheringState=function(e){e?this._gl.enable(this._gl.DITHER):this._gl.disable(this._gl.DITHER)},M.prototype.setRasterizerState=function(e){e?this._gl.disable(this._gl.RASTERIZER_DISCARD):this._gl.enable(this._gl.RASTERIZER_DISCARD)},M.prototype.stopRenderLoop=function(e){if(e){var t=this._activeRenderLoops.indexOf(e);0<=t&&this._activeRenderLoops.splice(t,1)}else this._activeRenderLoops=[]},M.prototype._renderLoop=function(){if(!this._contextWasLost){var e=!0;if(!this.renderEvenInBackground&&this._windowIsBackground&&(e=!1),e){this.beginFrame();for(var t=0;t<this._activeRenderLoops.length;t++){(0,this._activeRenderLoops[t])()}this.endFrame()}}if(0<this._activeRenderLoops.length){var i=null;this._vrDisplay&&this._vrDisplay.isPresenting&&(i=this._vrDisplay),this._frameHandler=R.Tools.QueueNewFrame(this._bindedRenderFunction,i)}else this._renderingQueueLaunched=!1},M.prototype.runRenderLoop=function(e){-1===this._activeRenderLoops.indexOf(e)&&(this._activeRenderLoops.push(e),this._renderingQueueLaunched||(this._renderingQueueLaunched=!0,this._bindedRenderFunction=this._renderLoop.bind(this),this._frameHandler=R.Tools.QueueNewFrame(this._bindedRenderFunction)))},M.prototype.switchFullscreen=function(e){this.isFullscreen?R.Tools.ExitFullscreen():(this._pointerLockRequested=e,this._renderingCanvas&&R.Tools.RequestFullscreen(this._renderingCanvas))},M.prototype.clear=function(e,t,i,r){void 0===r&&(r=!1),this.applyStates();var n=0;t&&e&&(this._gl.clearColor(e.r,e.g,e.b,void 0!==e.a?e.a:1),n|=this._gl.COLOR_BUFFER_BIT),i&&(this._gl.clearDepth(1),n|=this._gl.DEPTH_BUFFER_BIT),r&&(this._gl.clearStencil(0),n|=this._gl.STENCIL_BUFFER_BIT),this._gl.clear(n)},M.prototype.scissorClear=function(e,t,i,r,n){var o=this._gl,s=o.getParameter(o.SCISSOR_TEST),a=o.getParameter(o.SCISSOR_BOX);o.enable(o.SCISSOR_TEST),o.scissor(e,t,i,r),this.clear(n,!0,!0,!0),o.scissor(a[0],a[1],a[2],a[3]),!0===s?o.enable(o.SCISSOR_TEST):o.disable(o.SCISSOR_TEST)},M.prototype._viewport=function(e,t,i,r){e===this._viewportCached.x&&t===this._viewportCached.y&&i===this._viewportCached.z&&r===this._viewportCached.w||(this._viewportCached.x=e,this._viewportCached.y=t,this._viewportCached.z=i,this._viewportCached.w=r,this._gl.viewport(e,t,i,r))},M.prototype.setViewport=function(e,t,i){var r=t||this.getRenderWidth(),n=i||this.getRenderHeight(),o=e.x||0,s=e.y||0;this._cachedViewport=e,this._viewport(o*r,s*n,r*e.width,n*e.height)},M.prototype.setDirectViewport=function(e,t,i,r){var n=this._cachedViewport;return this._cachedViewport=null,this._viewport(e,t,i,r),n},M.prototype.beginFrame=function(){this.onBeginFrameObservable.notifyObservers(this),this._measureFps()},M.prototype.endFrame=function(){this._badOS&&this.flushFramebuffer(),this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.submitFrame(),this.onEndFrameObservable.notifyObservers(this)},M.prototype.resize=function(){if(!this._vrDisplay||!this._vrDisplay.isPresenting){var e=this._renderingCanvas?this._renderingCanvas.clientWidth:window.innerWidth,t=this._renderingCanvas?this._renderingCanvas.clientHeight:window.innerHeight;this.setSize(e/this._hardwareScalingLevel,t/this._hardwareScalingLevel)}},M.prototype.setSize=function(e,t){if(this._renderingCanvas&&(this._renderingCanvas.width!==e||this._renderingCanvas.height!==t)){this._renderingCanvas.width=e,this._renderingCanvas.height=t;for(var i=0;i<this.scenes.length;i++)for(var r=this.scenes[i],n=0;n<r.cameras.length;n++){r.cameras[n]._currentRenderId=0}this.onResizeObservable.hasObservers&&this.onResizeObservable.notifyObservers(this)}},M.prototype.isVRDevicePresent=function(){return!!this._vrDisplay},M.prototype.getVRDevice=function(){return this._vrDisplay},M.prototype.initWebVR=function(){return this.initWebVRAsync(),this.onVRDisplayChangedObservable},M.prototype.initWebVRAsync=function(){var i=this,t=function(){var t={vrDisplay:i._vrDisplay,vrSupported:i._vrSupported};i.onVRDisplayChangedObservable.notifyObservers(t),i._webVRInitPromise=new Promise(function(e){e(t)})};return this._onVrDisplayConnect||(this._onVrDisplayConnect=function(e){i._vrDisplay=e.display,t()},this._onVrDisplayDisconnect=function(){i._vrDisplay.cancelAnimationFrame(i._frameHandler),i._vrDisplay=void 0,i._frameHandler=R.Tools.QueueNewFrame(i._bindedRenderFunction),t()},this._onVrDisplayPresentChange=function(){i._vrExclusivePointerMode=i._vrDisplay&&i._vrDisplay.isPresenting},window.addEventListener("vrdisplayconnect",this._onVrDisplayConnect),window.addEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),window.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange)),this._webVRInitPromise=this._webVRInitPromise||this._getVRDisplaysAsync(),this._webVRInitPromise.then(t),this._webVRInitPromise},M.prototype.enableVR=function(){var e=this;if(this._vrDisplay&&!this._vrDisplay.isPresenting){this.onVRRequestPresentStart.notifyObservers(this),this._vrDisplay.requestPresent([{source:this.getRenderingCanvas()}]).then((function(){e.onVRRequestPresentComplete.notifyObservers(!0),e._onVRFullScreenTriggered()})).catch((function(){e.onVRRequestPresentComplete.notifyObservers(!1)}))}},M.prototype.disableVR=function(){this._vrDisplay&&this._vrDisplay.isPresenting&&this._vrDisplay.exitPresent().then(this._onVRFullScreenTriggered).catch(this._onVRFullScreenTriggered)},M.prototype._getVRDisplaysAsync=function(){var i=this;return new Promise(function(t,e){navigator.getVRDisplays?navigator.getVRDisplays().then((function(e){i._vrSupported=!0,i._vrDisplay=e[0],t({vrDisplay:i._vrDisplay,vrSupported:i._vrSupported})})):(i._vrDisplay=void 0,i._vrSupported=!1,t({vrDisplay:i._vrDisplay,vrSupported:i._vrSupported}))})},M.prototype.bindFramebuffer=function(e,t,i,r,n,o,s){void 0===s&&(s=0),this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this.bindUnboundFramebuffer(e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer);var a=this._gl;e.isCube&&(void 0===t&&(t=0),a.framebufferTexture2D(a.FRAMEBUFFER,a.COLOR_ATTACHMENT0,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,e._webGLTexture,s),o&&(o._generateStencilBuffer?a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_STENCIL_ATTACHMENT,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,o._webGLTexture,s):a.framebufferTexture2D(a.FRAMEBUFFER,a.DEPTH_ATTACHMENT,a.TEXTURE_CUBE_MAP_POSITIVE_X+t,o._webGLTexture,s))),this._cachedViewport&&!n?this.setViewport(this._cachedViewport,i,r):(i||(i=e.width,s&&(i/=Math.pow(2,s))),r||(r=e.height,s&&(r/=Math.pow(2,s))),this._viewport(0,0,i,r)),this.wipeCaches()},M.prototype.bindUnboundFramebuffer=function(e){this._currentFramebuffer!==e&&(this._gl.bindFramebuffer(this._gl.FRAMEBUFFER,e),this._currentFramebuffer=e)},M.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var r=this._gl;e._MSAAFramebuffer&&(r.bindFramebuffer(r.READ_FRAMEBUFFER,e._MSAAFramebuffer),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,e._framebuffer),r.blitFramebuffer(0,0,e.width,e.height,0,0,e.width,e.height,r.COLOR_BUFFER_BIT,r.NEAREST)),!e.generateMipMaps||t||e.isCube||(this._bindTextureDirectly(r.TEXTURE_2D,e,!0),r.generateMipmap(r.TEXTURE_2D),this._bindTextureDirectly(r.TEXTURE_2D,null)),i&&(e._MSAAFramebuffer&&this.bindUnboundFramebuffer(e._framebuffer),i()),this.bindUnboundFramebuffer(null)},M.prototype.unBindMultiColorAttachmentFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null;var r=this._gl;if(e[0]._MSAAFramebuffer){r.bindFramebuffer(r.READ_FRAMEBUFFER,e[0]._MSAAFramebuffer),r.bindFramebuffer(r.DRAW_FRAMEBUFFER,e[0]._framebuffer);var n=e[0]._attachments;n||(n=new Array(e.length),e[0]._attachments=n);for(var o=0;o<e.length;o++){for(var s=e[o],a=0;a<n.length;a++)n[a]=r.NONE;n[o]=r[1<this.webGLVersion?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"],r.readBuffer(n[o]),r.drawBuffers(n),r.blitFramebuffer(0,0,s.width,s.height,0,0,s.width,s.height,r.COLOR_BUFFER_BIT,r.NEAREST)}for(o=0;o<n.length;o++)n[o]=r[1<this.webGLVersion?"COLOR_ATTACHMENT"+o:"COLOR_ATTACHMENT"+o+"_WEBGL"];r.drawBuffers(n)}for(o=0;o<e.length;o++){!(s=e[o]).generateMipMaps||t||s.isCube||(this._bindTextureDirectly(r.TEXTURE_2D,s),r.generateMipmap(r.TEXTURE_2D),this._bindTextureDirectly(r.TEXTURE_2D,null))}i&&(e[0]._MSAAFramebuffer&&this.bindUnboundFramebuffer(e[0]._framebuffer),i()),this.bindUnboundFramebuffer(null)},M.prototype.generateMipMapsForCubemap=function(e){if(e.generateMipMaps){var t=this._gl;this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,e,!0),t.generateMipmap(t.TEXTURE_CUBE_MAP),this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,null)}},M.prototype.flushFramebuffer=function(){this._gl.flush()},M.prototype.restoreDefaultFramebuffer=function(){this._currentRenderTarget?this.unBindFramebuffer(this._currentRenderTarget):this.bindUnboundFramebuffer(null),this._cachedViewport&&this.setViewport(this._cachedViewport),this.wipeCaches()},M.prototype.createUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create uniform buffer");return this.bindUniformBuffer(t),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW),this.bindUniformBuffer(null),t.references=1,t},M.prototype.createDynamicUniformBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic uniform buffer");return this.bindUniformBuffer(t),e instanceof Float32Array?this._gl.bufferData(this._gl.UNIFORM_BUFFER,e,this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.UNIFORM_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW),this.bindUniformBuffer(null),t.references=1,t},M.prototype.updateUniformBuffer=function(e,t,i,r){this.bindUniformBuffer(e),void 0===i&&(i=0),void 0===r?t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,t):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,i,new Float32Array(t)):t instanceof Float32Array?this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,t.subarray(i,i+r)):this._gl.bufferSubData(this._gl.UNIFORM_BUFFER,0,new Float32Array(t).subarray(i,i+r)),this.bindUniformBuffer(null)},M.prototype._resetVertexBufferBinding=function(){this.bindArrayBuffer(null),this._cachedVertexBuffers=null},M.prototype.createVertexBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create vertex buffer");return this.bindArrayBuffer(t),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.STATIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.STATIC_DRAW),this._resetVertexBufferBinding(),t.references=1,t},M.prototype.createDynamicVertexBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create dynamic vertex buffer");return this.bindArrayBuffer(t),e instanceof Array?this._gl.bufferData(this._gl.ARRAY_BUFFER,new Float32Array(e),this._gl.DYNAMIC_DRAW):this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),this._resetVertexBufferBinding(),t.references=1,t},M.prototype.updateDynamicIndexBuffer=function(e,t,i){var r;void 0===i&&(i=0),this._currentBoundBuffer[this._gl.ELEMENT_ARRAY_BUFFER]=null,this.bindIndexBuffer(e),r=t instanceof Uint16Array||t instanceof Uint32Array?t:e.is32Bits?new Uint32Array(t):new Uint16Array(t),this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,r,this._gl.DYNAMIC_DRAW),this._resetIndexBufferBinding()},M.prototype.updateDynamicVertexBuffer=function(e,t,i,r){this.bindArrayBuffer(e),void 0===i&&(i=0),void 0===r?t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,new Float32Array(t)):this._gl.bufferSubData(this._gl.ARRAY_BUFFER,i,t):t instanceof Array?this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,new Float32Array(t).subarray(i,i+r)):(t=t instanceof ArrayBuffer?new Uint8Array(t,i,r):new Uint8Array(t.buffer,t.byteOffset+i,r),this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t)),this._resetVertexBufferBinding()},M.prototype._resetIndexBufferBinding=function(){this.bindIndexBuffer(null),this._cachedIndexBuffer=null},M.prototype.createIndexBuffer=function(e,t){var i,r=this._gl.createBuffer();if(!r)throw new Error("Unable to create index buffer");this.bindIndexBuffer(r);var n=!1;if(e instanceof Uint16Array)i=e;else if(this._caps.uintIndices)if(e instanceof Uint32Array)i=e,n=!0;else{for(var o=0;o<e.length;o++)if(65535<e[o]){n=!0;break}i=n?new Uint32Array(e):new Uint16Array(e)}else i=new Uint16Array(e);return this._gl.bufferData(this._gl.ELEMENT_ARRAY_BUFFER,i,t?this._gl.DYNAMIC_DRAW:this._gl.STATIC_DRAW),this._resetIndexBufferBinding(),r.references=1,r.is32Bits=n,r},M.prototype.bindArrayBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ARRAY_BUFFER)},M.prototype.bindUniformBuffer=function(e){this._gl.bindBuffer(this._gl.UNIFORM_BUFFER,e)},M.prototype.bindUniformBufferBase=function(e,t){this._gl.bindBufferBase(this._gl.UNIFORM_BUFFER,t,e)},M.prototype.bindUniformBlock=function(e,t,i){var r=this._gl.getUniformBlockIndex(e,t);this._gl.uniformBlockBinding(e,r,i)},M.prototype.bindIndexBuffer=function(e){this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.bindBuffer(e,this._gl.ELEMENT_ARRAY_BUFFER)},M.prototype.bindBuffer=function(e,t){(this._vaoRecordInProgress||this._currentBoundBuffer[t]!==e)&&(this._gl.bindBuffer(t,e),this._currentBoundBuffer[t]=e)},M.prototype.updateArrayBuffer=function(e){this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,e)},M.prototype._vertexAttribPointer=function(e,t,i,r,n,o,s){var a=this._currentBufferPointers[t],l=!1;a.active?(a.buffer!==e&&(a.buffer=e,l=!0),a.size!==i&&(a.size=i,l=!0),a.type!==r&&(a.type=r,l=!0),a.normalized!==n&&(a.normalized=n,l=!0),a.stride!==o&&(a.stride=o,l=!0),a.offset!==s&&(a.offset=s,l=!0)):(l=!0,a.active=!0,a.index=t,a.size=i,a.type=r,a.normalized=n,a.stride=o,a.offset=s,a.buffer=e),(l||this._vaoRecordInProgress)&&(this.bindArrayBuffer(e),this._gl.vertexAttribPointer(t,i,r,n,o,s))},M.prototype._bindIndexBufferWithCache=function(e){null!=e&&this._cachedIndexBuffer!==e&&(this._cachedIndexBuffer=e,this.bindIndexBuffer(e),this._uintIndicesCurrentlySet=e.is32Bits)},M.prototype._bindVertexBuffersAttributes=function(e,t){var i=t.getAttributesNames();this._vaoRecordInProgress||this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var r=0;r<i.length;r++){var n=t.getAttributeLocation(r);if(0<=n){var o=e[i[r]];if(!o)continue;this._gl.enableVertexAttribArray(n),this._vaoRecordInProgress||(this._vertexAttribArraysEnabled[n]=!0);var s=o.getBuffer();s&&(this._vertexAttribPointer(s,n,o.getSize(),o.type,o.normalized,o.byteStride,o.byteOffset),o.getIsInstanced()&&(this._gl.vertexAttribDivisor(n,o.getInstanceDivisor()),this._vaoRecordInProgress||(this._currentInstanceLocations.push(n),this._currentInstanceBuffers.push(s))))}}},M.prototype.recordVertexArrayObject=function(e,t,i){var r=this._gl.createVertexArray();return this._vaoRecordInProgress=!0,this._gl.bindVertexArray(r),this._mustWipeVertexAttributes=!0,this._bindVertexBuffersAttributes(e,i),this.bindIndexBuffer(t),this._vaoRecordInProgress=!1,this._gl.bindVertexArray(null),r},M.prototype.bindVertexArrayObject=function(e,t){this._cachedVertexArrayObject!==e&&(this._cachedVertexArrayObject=e,this._gl.bindVertexArray(e),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._uintIndicesCurrentlySet=null!=t&&t.is32Bits,this._mustWipeVertexAttributes=!0)},M.prototype.bindBuffersDirectly=function(e,t,i,r,n){if(this._cachedVertexBuffers!==e||this._cachedEffectForVertexBuffers!==n){this._cachedVertexBuffers=e;var o=(this._cachedEffectForVertexBuffers=n).getAttributesCount();this._unbindVertexArrayObject(),this.unbindAllAttributes();for(var s=0,a=0;a<o;a++)if(a<i.length){var l=n.getAttributeLocation(a);0<=l&&(this._gl.enableVertexAttribArray(l),this._vertexAttribArraysEnabled[l]=!0,this._vertexAttribPointer(e,l,i[a],this._gl.FLOAT,!1,r,s)),s+=4*i[a]}}this._bindIndexBufferWithCache(t)},M.prototype._unbindVertexArrayObject=function(){this._cachedVertexArrayObject&&(this._cachedVertexArrayObject=null,this._gl.bindVertexArray(null))},M.prototype.bindBuffers=function(e,t,i){this._cachedVertexBuffers===e&&this._cachedEffectForVertexBuffers===i||(this._cachedVertexBuffers=e,this._cachedEffectForVertexBuffers=i,this._bindVertexBuffersAttributes(e,i)),this._bindIndexBufferWithCache(t)},M.prototype.unbindInstanceAttributes=function(){for(var e,t=0,i=this._currentInstanceLocations.length;t<i;t++){var r=this._currentInstanceBuffers[t];e!=r&&r.references&&(e=r,this.bindArrayBuffer(r));var n=this._currentInstanceLocations[t];this._gl.vertexAttribDivisor(n,0)}this._currentInstanceBuffers.length=0,this._currentInstanceLocations.length=0},M.prototype.releaseVertexArrayObject=function(e){this._gl.deleteVertexArray(e)},M.prototype._releaseBuffer=function(e){return e.references--,0===e.references&&(this._gl.deleteBuffer(e),!0)},M.prototype.createInstancesBuffer=function(e){var t=this._gl.createBuffer();if(!t)throw new Error("Unable to create instance buffer");return t.capacity=e,this.bindArrayBuffer(t),this._gl.bufferData(this._gl.ARRAY_BUFFER,e,this._gl.DYNAMIC_DRAW),t},M.prototype.deleteInstancesBuffer=function(e){this._gl.deleteBuffer(e)},M.prototype.updateAndBindInstancesBuffer=function(e,t,i){if(this.bindArrayBuffer(e),t&&this._gl.bufferSubData(this._gl.ARRAY_BUFFER,0,t),void 0!==i[0].index){for(var r=0,n=0;n<i.length;n++){r+=4*(o=i[n]).attributeSize}for(n=0;n<i.length;n++){var o=i[n];this._vertexAttribArraysEnabled[o.index]||(this._gl.enableVertexAttribArray(o.index),this._vertexAttribArraysEnabled[o.index]=!0),this._vertexAttribPointer(e,o.index,o.attributeSize,o.attribyteType||this._gl.FLOAT,o.normalized||!1,r,o.offset),this._gl.vertexAttribDivisor(o.index,1),this._currentInstanceLocations.push(o.index),this._currentInstanceBuffers.push(e)}}else for(var s=0;s<4;s++){var a=i[s];this._vertexAttribArraysEnabled[a]||(this._gl.enableVertexAttribArray(a),this._vertexAttribArraysEnabled[a]=!0),this._vertexAttribPointer(e,a,4,this._gl.FLOAT,!1,64,16*s),this._gl.vertexAttribDivisor(a,1),this._currentInstanceLocations.push(a),this._currentInstanceBuffers.push(e)}},M.prototype.applyStates=function(){this._depthCullingState.apply(this._gl),this._stencilState.apply(this._gl),this._alphaState.apply(this._gl)},M.prototype.draw=function(e,t,i,r){this.drawElementsType(e?R.Material.TriangleFillMode:R.Material.WireFrameFillMode,t,i,r)},M.prototype.drawPointClouds=function(e,t,i){this.drawArraysType(R.Material.PointFillMode,e,t,i)},M.prototype.drawUnIndexed=function(e,t,i,r){this.drawArraysType(e?R.Material.TriangleFillMode:R.Material.WireFrameFillMode,t,i,r)},M.prototype.drawElementsType=function(e,t,i,r){this.applyStates(),this._drawCalls.addCount(1,!1);var n=this._drawMode(e),o=this._uintIndicesCurrentlySet?this._gl.UNSIGNED_INT:this._gl.UNSIGNED_SHORT,s=this._uintIndicesCurrentlySet?4:2;r?this._gl.drawElementsInstanced(n,i,o,t*s,r):this._gl.drawElements(n,i,o,t*s)},M.prototype.drawArraysType=function(e,t,i,r){this.applyStates(),this._drawCalls.addCount(1,!1);var n=this._drawMode(e);r?this._gl.drawArraysInstanced(n,t,i,r):this._gl.drawArrays(n,t,i)},M.prototype._drawMode=function(e){switch(e){case R.Material.TriangleFillMode:return this._gl.TRIANGLES;case R.Material.PointFillMode:return this._gl.POINTS;case R.Material.WireFrameFillMode:return this._gl.LINES;case R.Material.PointListDrawMode:return this._gl.POINTS;case R.Material.LineListDrawMode:return this._gl.LINES;case R.Material.LineLoopDrawMode:return this._gl.LINE_LOOP;case R.Material.LineStripDrawMode:return this._gl.LINE_STRIP;case R.Material.TriangleStripDrawMode:return this._gl.TRIANGLE_STRIP;case R.Material.TriangleFanDrawMode:return this._gl.TRIANGLE_FAN;default:return this._gl.TRIANGLES}},M.prototype._releaseEffect=function(e){this._compiledEffects[e._key]&&(delete this._compiledEffects[e._key],this._deleteProgram(e.getProgram()))},M.prototype._deleteProgram=function(e){e&&(e.__SPECTOR_rebuildProgram=null,e.transformFeedback&&(this.deleteTransformFeedback(e.transformFeedback),e.transformFeedback=null),this._gl.deleteProgram(e))},M.prototype.createEffect=function(e,t,i,r,n,o,s,a,l){var c=(e.vertexElement||e.vertex||e)+"+"+(e.fragmentElement||e.fragment||e)+"@"+(n||t.defines);if(this._compiledEffects[c]){var h=this._compiledEffects[c];return s&&h.isReady()&&s(h),h}var u=new R.Effect(e,t,i,r,this,n,o,s,a,l);return u._key=c,this._compiledEffects[c]=u},M.prototype._compileShader=function(e,t,i,r){return this._compileRawShader(r+(i?i+"\n":"")+e,t)},M.prototype._compileRawShader=function(e,t){var i=this._gl,r=i.createShader("vertex"===t?i.VERTEX_SHADER:i.FRAGMENT_SHADER);if(!r)throw new Error("Something went wrong while compile the shader.");if(i.shaderSource(r,e),i.compileShader(r),!i.getShaderParameter(r,i.COMPILE_STATUS)){var n=i.getShaderInfoLog(r);if(n)throw new Error(n)}return r},M.prototype.createRawShaderProgram=function(e,t,i,r){void 0===r&&(r=null),i=i||this._gl;var n=this._compileRawShader(e,"vertex"),o=this._compileRawShader(t,"fragment");return this._createShaderProgram(n,o,i,r)},M.prototype.createShaderProgram=function(e,t,i,r,n){void 0===n&&(n=null),r=r||this._gl,this.onBeforeShaderCompilationObservable.notifyObservers(this);var o=1<this._webGLVersion?"#version 300 es\n#define WEBGL2 \n":"",s=this._compileShader(e,"vertex",i,o),a=this._compileShader(t,"fragment",i,o),l=this._createShaderProgram(s,a,r,n);return this.onAfterShaderCompilationObservable.notifyObservers(this),l},M.prototype._createShaderProgram=function(e,t,i,r){void 0===r&&(r=null);var n,o=i.createProgram();if(!o)throw new Error("Unable to create program");if(i.attachShader(o,e),i.attachShader(o,t),1<this.webGLVersion&&r){var s=this.createTransformFeedback();this.bindTransformFeedback(s),this.setTranformFeedbackVaryings(o,r),o.transformFeedback=s}if((i.linkProgram(o),1<this.webGLVersion&&r&&this.bindTransformFeedback(null),!i.getProgramParameter(o,i.LINK_STATUS))&&(n=i.getProgramInfoLog(o)))throw new Error(n);if(this.validateShaderPrograms&&(i.validateProgram(o),!i.getProgramParameter(o,i.VALIDATE_STATUS)&&(n=i.getProgramInfoLog(o))))throw new Error(n);return i.deleteShader(e),i.deleteShader(t),o},M.prototype.getUniforms=function(e,t){for(var i=new Array,r=0;r<t.length;r++)i.push(this._gl.getUniformLocation(e,t[r]));return i},M.prototype.getAttributes=function(e,t){for(var i=[],r=0;r<t.length;r++)try{i.push(this._gl.getAttribLocation(e,t[r]))}catch(e){i.push(-1)}return i},M.prototype.enableEffect=function(e){e&&e!==this._currentEffect&&(this.bindSamplers(e),(this._currentEffect=e).onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e))},M.prototype.setIntArray=function(e,t){e&&this._gl.uniform1iv(e,t)},M.prototype.setIntArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2iv(e,t)},M.prototype.setIntArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3iv(e,t)},M.prototype.setIntArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4iv(e,t)},M.prototype.setFloatArray=function(e,t){e&&this._gl.uniform1fv(e,t)},M.prototype.setFloatArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2fv(e,t)},M.prototype.setFloatArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3fv(e,t)},M.prototype.setFloatArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4fv(e,t)},M.prototype.setArray=function(e,t){e&&this._gl.uniform1fv(e,t)},M.prototype.setArray2=function(e,t){e&&t.length%2==0&&this._gl.uniform2fv(e,t)},M.prototype.setArray3=function(e,t){e&&t.length%3==0&&this._gl.uniform3fv(e,t)},M.prototype.setArray4=function(e,t){e&&t.length%4==0&&this._gl.uniform4fv(e,t)},M.prototype.setMatrices=function(e,t){e&&this._gl.uniformMatrix4fv(e,!1,t)},M.prototype.setMatrix=function(e,t){e&&this._gl.uniformMatrix4fv(e,!1,t.toArray())},M.prototype.setMatrix3x3=function(e,t){e&&this._gl.uniformMatrix3fv(e,!1,t)},M.prototype.setMatrix2x2=function(e,t){e&&this._gl.uniformMatrix2fv(e,!1,t)},M.prototype.setInt=function(e,t){e&&this._gl.uniform1i(e,t)},M.prototype.setFloat=function(e,t){e&&this._gl.uniform1f(e,t)},M.prototype.setFloat2=function(e,t,i){e&&this._gl.uniform2f(e,t,i)},M.prototype.setFloat3=function(e,t,i,r){e&&this._gl.uniform3f(e,t,i,r)},M.prototype.setBool=function(e,t){e&&this._gl.uniform1i(e,t)},M.prototype.setFloat4=function(e,t,i,r,n){e&&this._gl.uniform4f(e,t,i,r,n)},M.prototype.setColor3=function(e,t){e&&this._gl.uniform3f(e,t.r,t.g,t.b)},M.prototype.setColor4=function(e,t,i){e&&this._gl.uniform4f(e,t.r,t.g,t.b,i)},M.prototype.setDirectColor4=function(e,t){e&&this._gl.uniform4f(e,t.r,t.g,t.b,t.a)},M.prototype.setState=function(e,t,i,r){void 0===t&&(t=0),void 0===r&&(r=!1),(this._depthCullingState.cull!==e||i)&&(this._depthCullingState.cull=e);var n=this.cullBackFaces?this._gl.BACK:this._gl.FRONT;(this._depthCullingState.cullFace!==n||i)&&(this._depthCullingState.cullFace=n),this.setZOffset(t);var o=r?this._gl.CW:this._gl.CCW;(this._depthCullingState.frontFace!==o||i)&&(this._depthCullingState.frontFace=o)},M.prototype.setZOffset=function(e){this._depthCullingState.zOffset=e},M.prototype.getZOffset=function(){return this._depthCullingState.zOffset},M.prototype.setDepthBuffer=function(e){this._depthCullingState.depthTest=e},M.prototype.getDepthWrite=function(){return this._depthCullingState.depthMask},M.prototype.setDepthWrite=function(e){this._depthCullingState.depthMask=e},M.prototype.setColorWrite=function(e){this._gl.colorMask(e,e,e,e),this._colorWrite=e},M.prototype.getColorWrite=function(){return this._colorWrite},M.prototype.setAlphaConstants=function(e,t,i,r){this._alphaState.setAlphaBlendConstants(e,t,i,r)},M.prototype.setAlphaMode=function(e,t){if(void 0===t&&(t=!1),this._alphaMode!==e){switch(e){case M.ALPHA_DISABLE:this._alphaState.alphaBlend=!1;break;case M.ALPHA_PREMULTIPLIED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_PREMULTIPLIED_PORTERDUFF:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0;break;case M.ALPHA_COMBINE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_ALPHA,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_ONEONE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_ADD:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE,this._gl.ZERO,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_SUBTRACT:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ZERO,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_MULTIPLY:this._alphaState.setAlphaBlendFunctionParameters(this._gl.DST_COLOR,this._gl.ZERO,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_MAXIMIZED:this._alphaState.setAlphaBlendFunctionParameters(this._gl.SRC_ALPHA,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE),this._alphaState.alphaBlend=!0;break;case M.ALPHA_INTERPOLATE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.CONSTANT_COLOR,this._gl.ONE_MINUS_CONSTANT_COLOR,this._gl.CONSTANT_ALPHA,this._gl.ONE_MINUS_CONSTANT_ALPHA),this._alphaState.alphaBlend=!0;break;case M.ALPHA_SCREENMODE:this._alphaState.setAlphaBlendFunctionParameters(this._gl.ONE,this._gl.ONE_MINUS_SRC_COLOR,this._gl.ONE,this._gl.ONE_MINUS_SRC_ALPHA),this._alphaState.alphaBlend=!0}t||this.setDepthWrite(e===M.ALPHA_DISABLE),this._alphaMode=e}},M.prototype.getAlphaMode=function(){return this._alphaMode},M.prototype.clearInternalTexturesCache=function(){this._internalTexturesCache=[]},M.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames&&!e||(this._currentEffect=null,this._viewportCached.x=0,this._viewportCached.y=0,this._viewportCached.z=0,this._viewportCached.w=0,e&&(this.resetTextureCache(),this._currentProgram=null,this._stencilState.reset(),this._depthCullingState.reset(),this.setDepthFunctionToLessOrEqual(),this._alphaState.reset(),this._unpackFlipYCached=null),this._resetVertexBufferBinding(),this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null,this._unbindVertexArrayObject(),this.bindIndexBuffer(null))},M.prototype.setTextureFormatToUse=function(e){for(var t=0,i=this.texturesSupported.length;t<i;t++)for(var r=0,n=e.length;r<n;r++)if(this._texturesSupported[t]===e[r].toLowerCase())return this._textureFormatInUse=this._texturesSupported[t];return this._textureFormatInUse=null},M.prototype._getSamplingParameters=function(e,t){var i=this._gl,r=i.NEAREST,n=i.NEAREST;switch(e){case M.TEXTURE_BILINEAR_SAMPLINGMODE:r=i.LINEAR,n=t?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case M.TEXTURE_TRILINEAR_SAMPLINGMODE:r=i.LINEAR,n=t?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case M.TEXTURE_NEAREST_SAMPLINGMODE:r=i.NEAREST,n=t?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case M.TEXTURE_NEAREST_NEAREST_MIPNEAREST:r=i.NEAREST,n=t?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case M.TEXTURE_NEAREST_LINEAR_MIPNEAREST:r=i.NEAREST,n=t?i.LINEAR_MIPMAP_NEAREST:i.LINEAR;break;case M.TEXTURE_NEAREST_LINEAR_MIPLINEAR:r=i.NEAREST,n=t?i.LINEAR_MIPMAP_LINEAR:i.LINEAR;break;case M.TEXTURE_NEAREST_LINEAR:r=i.NEAREST,n=i.LINEAR;break;case M.TEXTURE_NEAREST_NEAREST:r=i.NEAREST,n=i.NEAREST;break;case M.TEXTURE_LINEAR_NEAREST_MIPNEAREST:r=i.LINEAR,n=t?i.NEAREST_MIPMAP_NEAREST:i.NEAREST;break;case M.TEXTURE_LINEAR_NEAREST_MIPLINEAR:r=i.LINEAR,n=t?i.NEAREST_MIPMAP_LINEAR:i.NEAREST;break;case M.TEXTURE_LINEAR_LINEAR:r=i.LINEAR,n=i.LINEAR;break;case M.TEXTURE_LINEAR_NEAREST:r=i.LINEAR,n=i.NEAREST}return{min:n,mag:r}},M.prototype._partialLoadImg=function(e,t,i,r,n,o){var s;void 0===o&&(o=null);s=R.Tools.LoadImage(e,(function(){i[t]=s,i._internalCount++,r&&r._removePendingData(s),6===i._internalCount&&n(i)}),(function(e,t){r&&r._removePendingData(s),o&&o(e,t)}),r?r.database:null),r&&r._addPendingData(s)},M.prototype._cascadeLoadImgs=function(e,t,i,r,n){void 0===n&&(n=null);for(var o=[],s=o._internalCount=0;s<6;s++)this._partialLoadImg(r[s],s,o,t,i,n)},M.prototype._createTexture=function(){var e=this._gl.createTexture();if(!e)throw new Error("Unable to create texture");return e},M.prototype.createTexture=function(r,n,o,c,s,e,a,l,t,h,i){var u=this;void 0===s&&(s=M.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===e&&(e=null),void 0===a&&(a=null),void 0===l&&(l=null),void 0===t&&(t=null),void 0===h&&(h=null),void 0===i&&(i=null);for(var d=String(r),f="data:"===d.substr(0,5),p="blob:"===d.substr(0,5),_=f&&-1!==d.indexOf(";base64,"),m=t||new R.InternalTexture(this,R.InternalTexture.DATASOURCE_URL),g=d.lastIndexOf("."),v=i||(-1<g?d.substring(g).toLowerCase():""),y=null,b=0,T=M._TextureLoaders;b<T.length;b++){var E=T[b];if(E.canLoad(v,this._textureFormatInUse,t,_,!!l)){y=E;break}}y&&(d=y.transformUrl(d,this._textureFormatInUse)),c&&c._addPendingData(m),m.url=d,m.generateMipMaps=!n,m.samplingMode=s,m.invertY=o,this._doNotHandleContextLost||(m._buffer=l);var x=null;e&&!t&&(x=m.onLoadedObservable.add(e)),t||this._internalTexturesCache.push(m);var P=function(e,t){c&&c._removePendingData(m);var i=!1;y&&(y.getFallbackTextureUrl(d,u._textureFormatInUse)&&(i=!0,u.createTexture(r,n,o,c,s,null,a,l,m)));i||(x&&m.onLoadedObservable.remove(x),R.Tools.UseFallbackTexture&&u.createTexture(R.Tools.fallbackTexture,n,o,c,s,null,a,l,m)),a&&a(e||"Unknown error",t)};if(y){var A=function(e){y.loadData(e,m,(function(e,t,i,r,n){u._prepareWebGLTexture(m,c,e,t,o,!i,r,(function(){return n(),!1}),s)}))};l?A(l):this._loadFile(d,A,void 0,c?c.database:void 0,!0,(function(e,t){P("Unable to load "+(e&&e.responseURL,t))}))}else{var S=function(l){p&&!u._doNotHandleContextLost&&(m._buffer=l),u._prepareWebGLTexture(m,c,l.width,l.height,o,n,!1,(function(e,t,i){var r=u._gl,n=l.width===e&&l.height===t,o=h?u._getInternalFormat(h):".jpg"===v?r.RGB:r.RGBA;if(n)return r.texImage2D(r.TEXTURE_2D,0,o,o,r.UNSIGNED_BYTE,l),!1;var s=u._caps.maxTextureSize;if(l.width>s||l.height>s)return u._prepareWorkingCanvas(),u._workingCanvas&&u._workingContext&&(u._workingCanvas.width=e,u._workingCanvas.height=t,u._workingContext.drawImage(l,0,0,l.width,l.height,0,0,e,t),r.texImage2D(r.TEXTURE_2D,0,o,o,r.UNSIGNED_BYTE,u._workingCanvas),m.width=e,m.height=t),!1;var a=new R.InternalTexture(u,R.InternalTexture.DATASOURCE_TEMP);return u._bindTextureDirectly(r.TEXTURE_2D,a,!0),r.texImage2D(r.TEXTURE_2D,0,o,o,r.UNSIGNED_BYTE,l),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,r.LINEAR),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),u._rescaleTexture(a,m,c,o,(function(){u._releaseTexture(a),u._bindTextureDirectly(r.TEXTURE_2D,m,!0),i()})),!0}),s)};!f||_?l instanceof HTMLImageElement?S(l):R.Tools.LoadImage(d,S,P,c?c.database:null):"string"==typeof l||l instanceof ArrayBuffer||l instanceof Blob?R.Tools.LoadImage(l,S,P,c?c.database:null):S(l)}return m},M.prototype._rescaleTexture=function(t,i,r,n,o){var s=this,a=this.createRenderTargetTexture({width:i.width,height:i.height},{generateMipMaps:!1,type:M.TEXTURETYPE_UNSIGNED_INT,samplingMode:M.TEXTURE_BILINEAR_SAMPLINGMODE,generateDepthBuffer:!1,generateStencilBuffer:!1});this._rescalePostProcess||(this._rescalePostProcess=new R.PassPostProcess("rescale",1,null,M.TEXTURE_BILINEAR_SAMPLINGMODE,this,!1,M.TEXTURETYPE_UNSIGNED_INT)),this._rescalePostProcess.getEffect().executeWhenCompiled((function(){s._rescalePostProcess.onApply=function(e){e._bindTexture("textureSampler",t)};var e=r;e||(e=s.scenes[s.scenes.length-1]),e.postProcessManager.directRender([s._rescalePostProcess],a,!0),s._bindTextureDirectly(s._gl.TEXTURE_2D,i,!0),s._gl.copyTexImage2D(s._gl.TEXTURE_2D,0,n,0,0,i.width,i.height,0),s.unBindFramebuffer(a),s._releaseTexture(a),o&&o()}))},M.prototype.updateRawTexture=function(e,t,i,r,n,o){if(void 0===n&&(n=null),void 0===o&&(o=M.TEXTURETYPE_UNSIGNED_INT),e){var s=this._getRGBABufferInternalSizedFormat(o,i),a=this._getInternalFormat(i),l=this._getWebGLTextureType(o);this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===r||!!r),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.type=o,e.invertY=r,e._compression=n),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),n&&t?this._gl.compressedTexImage2D(this._gl.TEXTURE_2D,0,this.getCaps().s3tc[n],e.width,e.height,0,t):this._gl.texImage2D(this._gl.TEXTURE_2D,0,s,e.width,e.height,0,a,l,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),e.isReady=!0}},M.prototype.createRawTexture=function(e,t,i,r,n,o,s,a,l){void 0===a&&(a=null),void 0===l&&(l=M.TEXTURETYPE_UNSIGNED_INT);var c=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_RAW);c.baseWidth=t,c.baseHeight=i,c.width=t,c.height=i,c.format=r,c.generateMipMaps=n,c.samplingMode=s,c.invertY=o,c._compression=a,c.type=l,this._doNotHandleContextLost||(c._bufferView=e),this.updateRawTexture(c,e,r,o,a,l),this._bindTextureDirectly(this._gl.TEXTURE_2D,c,!0);var h=this._getSamplingParameters(s,n);return this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,h.mag),this._gl.texParameteri(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,h.min),n&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._internalTexturesCache.push(c),c},M.prototype._unpackFlipY=function(e){this._unpackFlipYCached!==e&&(this._gl.pixelStorei(this._gl.UNPACK_FLIP_Y_WEBGL,e?1:0),this.enableUnpackFlipYCached&&(this._unpackFlipYCached=e))},M.prototype._getUnpackAlignement=function(){return this._gl.getParameter(this._gl.UNPACK_ALIGNMENT)},M.prototype.createDynamicTexture=function(e,t,i,r){var n=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_DYNAMIC);return n.baseWidth=e,n.baseHeight=t,i&&(e=this.needPOTTextures?R.Tools.GetExponentOfTwo(e,this._caps.maxTextureSize):e,t=this.needPOTTextures?R.Tools.GetExponentOfTwo(t,this._caps.maxTextureSize):t),n.width=e,n.height=t,n.isReady=!1,n.generateMipMaps=i,n.samplingMode=r,this.updateTextureSamplingMode(r,n),this._internalTexturesCache.push(n),n},M.prototype.updateTextureSamplingMode=function(e,t){var i=this._getSamplingParameters(e,t.generateMipMaps);t.isCube?(this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):t.is3D?(this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_3D,null)):(this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MAG_FILTER,i.mag,t),this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_MIN_FILTER,i.min),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),t.samplingMode=e},M.prototype.updateDynamicTexture=function(e,t,i,r,n){if(void 0===r&&(r=!1),e){this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),this._unpackFlipY(i),r&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,1);var o=n?this._getInternalFormat(n):this._gl.RGBA;this._gl.texImage2D(this._gl.TEXTURE_2D,0,o,o,this._gl.UNSIGNED_BYTE,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(this._gl.TEXTURE_2D,null),r&&this._gl.pixelStorei(this._gl.UNPACK_PREMULTIPLY_ALPHA_WEBGL,0),e.isReady=!0}},M.prototype.updateVideoTexture=function(t,e,i){if(t&&!t._isDisabled){var r=this._bindTextureDirectly(this._gl.TEXTURE_2D,t,!0);this._unpackFlipY(!i);try{if(void 0===this._videoTextureSupported&&(this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,e),0!==this._gl.getError()?this._videoTextureSupported=!1:this._videoTextureSupported=!0),this._videoTextureSupported)this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,e);else{if(!t._workingCanvas){t._workingCanvas=document.createElement("canvas");var n=t._workingCanvas.getContext("2d");if(!n)throw new Error("Unable to get 2d context");t._workingContext=n,t._workingCanvas.width=t.width,t._workingCanvas.height=t.height}t._workingContext.drawImage(e,0,0,e.videoWidth,e.videoHeight,0,0,t.width,t.height),this._gl.texImage2D(this._gl.TEXTURE_2D,0,this._gl.RGBA,this._gl.RGBA,this._gl.UNSIGNED_BYTE,t._workingCanvas)}t.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),r||this._bindTextureDirectly(this._gl.TEXTURE_2D,null),t.isReady=!0}catch(e){t._isDisabled=!0}}},M.prototype.updateTextureComparisonFunction=function(e,t){if(1!==this.webGLVersion){var i=this._gl;e.isCube?(this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,e,!0),0===t?(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,M.LEQUAL),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null)):(this._bindTextureDirectly(this._gl.TEXTURE_2D,e,!0),0===t?(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,M.LEQUAL),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.NONE)):(i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_FUNC,t),i.texParameteri(i.TEXTURE_2D,i.TEXTURE_COMPARE_MODE,i.COMPARE_REF_TO_TEXTURE)),this._bindTextureDirectly(this._gl.TEXTURE_2D,null)),e._comparisonFunction=t}else R.Tools.Error("WebGL 1 does not support texture comparison.")},M.prototype._setupDepthStencilTexture=function(e,t,i,r,n){var o=t.width||t,s=t.height||t;e.baseWidth=o,e.baseHeight=s,e.width=o,e.height=s,e.isReady=!0,e.samples=1,e.generateMipMaps=!1,e._generateDepthBuffer=!0,e._generateStencilBuffer=i,e.samplingMode=r?M.TEXTURE_BILINEAR_SAMPLINGMODE:M.TEXTURE_NEAREST_SAMPLINGMODE,e.type=M.TEXTURETYPE_UNSIGNED_INT,e._comparisonFunction=n;var a=this._gl,l=e.isCube?a.TEXTURE_CUBE_MAP:a.TEXTURE_2D,c=this._getSamplingParameters(e.samplingMode,!1);a.texParameteri(l,a.TEXTURE_MAG_FILTER,c.mag),a.texParameteri(l,a.TEXTURE_MIN_FILTER,c.min),a.texParameteri(l,a.TEXTURE_WRAP_S,a.CLAMP_TO_EDGE),a.texParameteri(l,a.TEXTURE_WRAP_T,a.CLAMP_TO_EDGE),0===n?(a.texParameteri(l,a.TEXTURE_COMPARE_FUNC,M.LEQUAL),a.texParameteri(l,a.TEXTURE_COMPARE_MODE,a.NONE)):(a.texParameteri(l,a.TEXTURE_COMPARE_FUNC,n),a.texParameteri(l,a.TEXTURE_COMPARE_MODE,a.COMPARE_REF_TO_TEXTURE))},M.prototype.createDepthStencilTexture=function(e,t){if(t.isCube){var i=e.width||e;return this._createDepthStencilCubeTexture(i,t)}return this._createDepthStencilTexture(e,t)},M.prototype._createDepthStencilTexture=function(e,t){var i=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_DEPTHTEXTURE);if(!this._caps.depthTextureExtension)return R.Tools.Error("Depth texture is not supported by your browser or hardware."),i;var r=ae({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),n=this._gl;return this._bindTextureDirectly(n.TEXTURE_2D,i,!0),this._setupDepthStencilTexture(i,e,r.generateStencil,r.bilinearFiltering,r.comparisonFunction),1<this.webGLVersion?r.generateStencil?n.texImage2D(n.TEXTURE_2D,0,n.DEPTH24_STENCIL8,i.width,i.height,0,n.DEPTH_STENCIL,n.UNSIGNED_INT_24_8,null):n.texImage2D(n.TEXTURE_2D,0,n.DEPTH_COMPONENT24,i.width,i.height,0,n.DEPTH_COMPONENT,n.UNSIGNED_INT,null):r.generateStencil?n.texImage2D(n.TEXTURE_2D,0,n.DEPTH_STENCIL,i.width,i.height,0,n.DEPTH_STENCIL,n.UNSIGNED_INT_24_8,null):n.texImage2D(n.TEXTURE_2D,0,n.DEPTH_COMPONENT,i.width,i.height,0,n.DEPTH_COMPONENT,n.UNSIGNED_INT,null),this._bindTextureDirectly(n.TEXTURE_2D,null),i},M.prototype._createDepthStencilCubeTexture=function(e,t){var i=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_UNKNOWN);if(i.isCube=!0,1===this.webGLVersion)return R.Tools.Error("Depth cube texture is not supported by WebGL 1."),i;var r=ae({bilinearFiltering:!1,comparisonFunction:0,generateStencil:!1},t),n=this._gl;this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,i,!0),this._setupDepthStencilTexture(i,e,r.generateStencil,r.bilinearFiltering,r.comparisonFunction);for(var o=0;o<6;o++)r.generateStencil?n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,n.DEPTH24_STENCIL8,e,e,0,n.DEPTH_STENCIL,n.UNSIGNED_INT_24_8,null):n.texImage2D(n.TEXTURE_CUBE_MAP_POSITIVE_X+o,0,n.DEPTH_COMPONENT24,e,e,0,n.DEPTH_COMPONENT,n.UNSIGNED_INT,null);return this._bindTextureDirectly(n.TEXTURE_CUBE_MAP,null),i},M.prototype.setFrameBufferDepthStencilTexture=function(e){var t=e.getInternalTexture();if(t&&t._framebuffer&&e.depthStencilTexture){var i=this._gl,r=e.depthStencilTexture;this.bindUnboundFramebuffer(t._framebuffer),r.isCube?r._generateStencilBuffer?i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_CUBE_MAP_POSITIVE_X,r._webGLTexture,0):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_CUBE_MAP_POSITIVE_X,r._webGLTexture,0):r._generateStencilBuffer?i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_STENCIL_ATTACHMENT,i.TEXTURE_2D,r._webGLTexture,0):i.framebufferTexture2D(i.FRAMEBUFFER,i.DEPTH_ATTACHMENT,i.TEXTURE_2D,r._webGLTexture,0),this.bindUnboundFramebuffer(null)}},M.prototype.createRenderTargetTexture=function(e,t){var i=new h;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,i.generateStencilBuffer=i.generateDepthBuffer&&t.generateStencilBuffer,i.type=void 0===t.type?M.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?M.TEXTURE_TRILINEAR_SAMPLINGMODE:t.samplingMode,i.format=void 0===t.format?M.TEXTUREFORMAT_RGBA:t.format):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=M.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=M.TEXTURE_TRILINEAR_SAMPLINGMODE,i.format=M.TEXTUREFORMAT_RGBA),(i.type!==M.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==M.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=M.TEXTURE_NEAREST_SAMPLINGMODE);var r=this._gl,n=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(r.TEXTURE_2D,n,!0);var o=e.width||e,s=e.height||e,a=this._getSamplingParameters(i.samplingMode,!!i.generateMipMaps);i.type!==M.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=M.TEXTURETYPE_UNSIGNED_INT,R.Tools.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type")),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MAG_FILTER,a.mag),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_MIN_FILTER,a.min),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_2D,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE),r.texImage2D(r.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),o,s,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var l=this._currentFramebuffer,c=r.createFramebuffer();return this.bindUnboundFramebuffer(c),r.framebufferTexture2D(r.FRAMEBUFFER,r.COLOR_ATTACHMENT0,r.TEXTURE_2D,n._webGLTexture,0),n._depthStencilBuffer=this._setupFramebufferDepthAttachments(!!i.generateStencilBuffer,i.generateDepthBuffer,o,s),i.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(r.TEXTURE_2D,null),r.bindRenderbuffer(r.RENDERBUFFER,null),this.bindUnboundFramebuffer(l),n._framebuffer=c,n.baseWidth=o,n.baseHeight=s,n.width=o,n.height=s,n.isReady=!0,n.samples=1,n.generateMipMaps=!!i.generateMipMaps,n.samplingMode=i.samplingMode,n.type=i.type,n.format=i.format,n._generateDepthBuffer=i.generateDepthBuffer,n._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(n),n},M.prototype.createMultipleRenderTarget=function(e,t){var i=!1,r=!0,n=!1,o=!1,s=1,a=M.TEXTURETYPE_UNSIGNED_INT,l=M.TEXTURE_TRILINEAR_SAMPLINGMODE,c=new Array,h=new Array;void 0!==t&&(i=void 0!==t.generateMipMaps&&t.generateMipMaps,r=void 0===t.generateDepthBuffer||t.generateDepthBuffer,n=void 0!==t.generateStencilBuffer&&t.generateStencilBuffer,o=void 0!==t.generateDepthTexture&&t.generateDepthTexture,s=t.textureCount||1,t.types&&(c=t.types),t.samplingModes&&(h=t.samplingModes));var u=this._gl,d=u.createFramebuffer();this.bindUnboundFramebuffer(d);for(var f=e.width||e,p=e.height||e,_=[],m=[],g=this._setupFramebufferDepthAttachments(n,r,f,p),v=0;v<s;v++){var y=h[v]||l,b=c[v]||a;(b!==M.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(b!==M.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(y=M.TEXTURE_NEAREST_SAMPLINGMODE);var T=this._getSamplingParameters(y,i);b!==M.TEXTURETYPE_FLOAT||this._caps.textureFloat||(b=M.TEXTURETYPE_UNSIGNED_INT,R.Tools.Warn("Float textures are not supported. Render target forced to TEXTURETYPE_UNSIGNED_BYTE type"));var E=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_MULTIRENDERTARGET),x=u[1<this.webGLVersion?"COLOR_ATTACHMENT"+v:"COLOR_ATTACHMENT"+v+"_WEBGL"];_.push(E),m.push(x),u.activeTexture(u["TEXTURE"+v]),u.bindTexture(u.TEXTURE_2D,E._webGLTexture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,T.mag),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,T.min),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(b),f,p,0,u.RGBA,this._getWebGLTextureType(b),null),u.framebufferTexture2D(u.DRAW_FRAMEBUFFER,x,u.TEXTURE_2D,E._webGLTexture,0),i&&this._gl.generateMipmap(this._gl.TEXTURE_2D),this._bindTextureDirectly(u.TEXTURE_2D,null),E._framebuffer=d,E._depthStencilBuffer=g,E.baseWidth=f,E.baseHeight=p,E.width=f,E.height=p,E.isReady=!0,E.samples=1,E.generateMipMaps=i,E.samplingMode=y,E.type=b,E._generateDepthBuffer=r,E._generateStencilBuffer=n,E._attachments=m,this._internalTexturesCache.push(E)}if(o&&this._caps.depthTextureExtension){var P=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_MULTIRENDERTARGET);u.activeTexture(u.TEXTURE0),u.bindTexture(u.TEXTURE_2D,P._webGLTexture),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MAG_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_MIN_FILTER,u.NEAREST),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_S,u.CLAMP_TO_EDGE),u.texParameteri(u.TEXTURE_2D,u.TEXTURE_WRAP_T,u.CLAMP_TO_EDGE),u.texImage2D(u.TEXTURE_2D,0,this.webGLVersion<2?u.DEPTH_COMPONENT:u.DEPTH_COMPONENT16,f,p,0,u.DEPTH_COMPONENT,u.UNSIGNED_SHORT,null),u.framebufferTexture2D(u.FRAMEBUFFER,u.DEPTH_ATTACHMENT,u.TEXTURE_2D,P._webGLTexture,0),P._framebuffer=d,P.baseWidth=f,P.baseHeight=p,P.width=f,P.height=p,P.isReady=!0,P.samples=1,P.generateMipMaps=i,P.samplingMode=u.NEAREST,P._generateDepthBuffer=r,P._generateStencilBuffer=n,_.push(P),this._internalTexturesCache.push(P)}return u.drawBuffers(m),u.bindRenderbuffer(u.RENDERBUFFER,null),this.bindUnboundFramebuffer(null),this.resetTextureCache(),_},M.prototype._setupFramebufferDepthAttachments=function(e,t,i,r,n){void 0===n&&(n=1);var o=null,s=this._gl;return e?(o=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,o),1<n?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH24_STENCIL8,i,r):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_STENCIL,i,r),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_STENCIL_ATTACHMENT,s.RENDERBUFFER,o)):t&&(o=s.createRenderbuffer(),s.bindRenderbuffer(s.RENDERBUFFER,o),1<n?s.renderbufferStorageMultisample(s.RENDERBUFFER,n,s.DEPTH_COMPONENT16,i,r):s.renderbufferStorage(s.RENDERBUFFER,s.DEPTH_COMPONENT16,i,r),s.framebufferRenderbuffer(s.FRAMEBUFFER,s.DEPTH_ATTACHMENT,s.RENDERBUFFER,o)),o},M.prototype.updateRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e)return 1;if(e.samples===t)return t;var i=this._gl;if(t=Math.min(t,i.getParameter(i.MAX_SAMPLES)),e._depthStencilBuffer&&(i.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(i.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(i.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null),1<t){var r=i.createFramebuffer();if(!r)throw new Error("Unable to create multi sampled framebuffer");e._MSAAFramebuffer=r,this.bindUnboundFramebuffer(e._MSAAFramebuffer);var n=i.createRenderbuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,n),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(e.type),e.width,e.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,i.COLOR_ATTACHMENT0,i.RENDERBUFFER,n),e._MSAARenderBuffer=n}else this.bindUnboundFramebuffer(e._framebuffer);return e.samples=t,e._depthStencilBuffer=this._setupFramebufferDepthAttachments(e._generateStencilBuffer,e._generateDepthBuffer,e.width,e.height,t),i.bindRenderbuffer(i.RENDERBUFFER,null),this.bindUnboundFramebuffer(null),t},M.prototype.updateMultipleRenderTargetTextureSampleCount=function(e,t){if(this.webGLVersion<2||!e||0==e.length)return 1;if(e[0].samples===t)return t;var i=this._gl;t=Math.min(t,i.getParameter(i.MAX_SAMPLES)),e[0]._depthStencilBuffer&&(i.deleteRenderbuffer(e[0]._depthStencilBuffer),e[0]._depthStencilBuffer=null),e[0]._MSAAFramebuffer&&(i.deleteFramebuffer(e[0]._MSAAFramebuffer),e[0]._MSAAFramebuffer=null);for(var r=0;r<e.length;r++)e[r]._MSAARenderBuffer&&(i.deleteRenderbuffer(e[r]._MSAARenderBuffer),e[r]._MSAARenderBuffer=null);if(1<t){var n=i.createFramebuffer();if(!n)throw new Error("Unable to create multi sampled framebuffer");this.bindUnboundFramebuffer(n);var o=this._setupFramebufferDepthAttachments(e[0]._generateStencilBuffer,e[0]._generateDepthBuffer,e[0].width,e[0].height,t),s=[];for(r=0;r<e.length;r++){var a=e[r],l=i[1<this.webGLVersion?"COLOR_ATTACHMENT"+r:"COLOR_ATTACHMENT"+r+"_WEBGL"],c=i.createRenderbuffer();if(!c)throw new Error("Unable to create multi sampled framebuffer");i.bindRenderbuffer(i.RENDERBUFFER,c),i.renderbufferStorageMultisample(i.RENDERBUFFER,t,this._getRGBAMultiSampleBufferFormat(a.type),a.width,a.height),i.framebufferRenderbuffer(i.FRAMEBUFFER,l,i.RENDERBUFFER,c),a._MSAAFramebuffer=n,a._MSAARenderBuffer=c,a.samples=t,a._depthStencilBuffer=o,i.bindRenderbuffer(i.RENDERBUFFER,null),s.push(l)}i.drawBuffers(s)}else this.bindUnboundFramebuffer(e[0]._framebuffer);return this.bindUnboundFramebuffer(null),t},M.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,r,n,o,s){void 0===o&&(o=0),void 0===s&&(s=0);var a=this._gl,l=a.TEXTURE_2D;e.isCube&&(l=a.TEXTURE_CUBE_MAP_POSITIVE_X+o),this._gl.compressedTexImage2D(l,s,t,i,r,0,n)},M.prototype._uploadDataToTextureDirectly=function(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=this._gl,o=this._getWebGLTextureType(e.type),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s);this._unpackFlipY(e.invertY);var l=n.TEXTURE_2D;e.isCube&&(l=n.TEXTURE_CUBE_MAP_POSITIVE_X+i);var c=Math.round(R.Scalar.Log2(e.width)),h=Math.round(R.Scalar.Log2(e.height)),u=Math.pow(2,Math.max(c-r,0)),d=Math.pow(2,Math.max(h-r,0));n.texImage2D(l,r,a,u,d,0,s,o,t)},M.prototype._uploadArrayBufferViewToTexture=function(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=this._gl,o=e.isCube?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D;this._bindTextureDirectly(o,e,!0),this._uploadDataToTextureDirectly(e,t,i,r),this._bindTextureDirectly(o,null,!0)},M.prototype._uploadImageToTexture=function(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0);var n=this._gl,o=this._getWebGLTextureType(e.type),s=this._getInternalFormat(e.format),a=this._getRGBABufferInternalSizedFormat(e.type,s),l=e.isCube?n.TEXTURE_CUBE_MAP:n.TEXTURE_2D;this._bindTextureDirectly(l,e,!0),this._unpackFlipY(e.invertY);var c=n.TEXTURE_2D;e.isCube&&(c=n.TEXTURE_CUBE_MAP_POSITIVE_X+i),n.texImage2D(c,r,a,s,o,t),this._bindTextureDirectly(l,null,!0)},M.prototype.createRenderTargetCubeTexture=function(e,t){var i=ae({generateMipMaps:!0,generateDepthBuffer:!0,generateStencilBuffer:!1,type:M.TEXTURETYPE_UNSIGNED_INT,samplingMode:M.TEXTURE_TRILINEAR_SAMPLINGMODE,format:M.TEXTUREFORMAT_RGBA},t);i.generateStencilBuffer=i.generateDepthBuffer&&i.generateStencilBuffer,(i.type!==M.TEXTURETYPE_FLOAT||this._caps.textureFloatLinearFiltering)&&(i.type!==M.TEXTURETYPE_HALF_FLOAT||this._caps.textureHalfFloatLinearFiltering)||(i.samplingMode=M.TEXTURE_NEAREST_SAMPLINGMODE);var r=this._gl,n=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_RENDERTARGET);this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,n,!0);var o=this._getSamplingParameters(i.samplingMode,i.generateMipMaps);i.type!==M.TEXTURETYPE_FLOAT||this._caps.textureFloat||(i.type=M.TEXTURETYPE_UNSIGNED_INT,R.Tools.Warn("Float textures are not supported. Cube render target forced to TEXTURETYPE_UNESIGNED_BYTE type")),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MAG_FILTER,o.mag),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_MIN_FILTER,o.min),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_S,r.CLAMP_TO_EDGE),r.texParameteri(r.TEXTURE_CUBE_MAP,r.TEXTURE_WRAP_T,r.CLAMP_TO_EDGE);for(var s=0;s<6;s++)r.texImage2D(r.TEXTURE_CUBE_MAP_POSITIVE_X+s,0,this._getRGBABufferInternalSizedFormat(i.type,i.format),e,e,0,this._getInternalFormat(i.format),this._getWebGLTextureType(i.type),null);var a=r.createFramebuffer();return this.bindUnboundFramebuffer(a),n._depthStencilBuffer=this._setupFramebufferDepthAttachments(i.generateStencilBuffer,i.generateDepthBuffer,e,e),i.generateMipMaps&&r.generateMipmap(r.TEXTURE_CUBE_MAP),this._bindTextureDirectly(r.TEXTURE_CUBE_MAP,null),r.bindRenderbuffer(r.RENDERBUFFER,null),this.bindUnboundFramebuffer(null),n._framebuffer=a,n.width=e,n.height=e,n.isReady=!0,n.isCube=!0,n.samples=1,n.generateMipMaps=i.generateMipMaps,n.samplingMode=i.samplingMode,n.type=i.type,n.format=i.format,n._generateDepthBuffer=i.generateDepthBuffer,n._generateStencilBuffer=i.generateStencilBuffer,this._internalTexturesCache.push(n),n},M.prototype.createPrefilteredCubeTexture=function(e,_,m,g,v,t,i,r,y){var b=this;void 0===v&&(v=null),void 0===t&&(t=null),void 0===r&&(r=null),void 0===y&&(y=!0);return this.createCubeTexture(e,_,null,!1,(function(e){if(e){var t=e.texture;if(y?e.info.sphericalPolynomial&&(t._sphericalPolynomial=e.info.sphericalPolynomial):t._sphericalPolynomial=new R.SphericalPolynomial,t._dataSource=R.InternalTexture.DATASOURCE_CUBEPREFILTERED,b._caps.textureLOD)v&&v(t);else{var i=b._gl,r=e.width;if(r){for(var n=[],o=0;o<3;o++){var s=1-o/2,a=g,l=R.Scalar.Log2(r)*m+g,c=a+(l-a)*s,h=Math.round(Math.min(Math.max(c,0),l)),u=new R.InternalTexture(b,R.InternalTexture.DATASOURCE_TEMP);if(u.type=t.type,u.format=t.format,u.width=Math.pow(2,Math.max(R.Scalar.Log2(r)-h,0)),u.height=u.width,u.isCube=!0,b._bindTextureDirectly(i.TEXTURE_CUBE_MAP,u,!0),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MAG_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_MIN_FILTER,i.LINEAR),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_WRAP_S,i.CLAMP_TO_EDGE),i.texParameteri(i.TEXTURE_CUBE_MAP,i.TEXTURE_WRAP_T,i.CLAMP_TO_EDGE),e.isDDS){var d=e.info,f=e.data;b._unpackFlipY(d.isCompressed),R.DDSTools.UploadDDSLevels(b,u,f,d,!0,6,h)}else R.Tools.Warn("DDS is the only prefiltered cube map supported so far.");b._bindTextureDirectly(i.TEXTURE_CUBE_MAP,null);var p=new R.BaseTexture(_);p.isCube=!0,(p._texture=u).isReady=!0,n.push(p)}t._lodTextureHigh=n[2],t._lodTextureMid=n[1],t._lodTextureLow=n[0],v&&v(t)}}}else v&&v(null)}),t,i,r,y,m,g)},M.prototype.createCubeTexture=function(r,n,o,s,a,l,c,e,h,u,d,t){var f=this;void 0===a&&(a=null),void 0===l&&(l=null),void 0===e&&(e=null),void 0===h&&(h=!1),void 0===u&&(u=0),void 0===d&&(d=0),void 0===t&&(t=null);var p=this._gl,_=t||new R.InternalTexture(this,R.InternalTexture.DATASOURCE_CUBE);_.isCube=!0,_.url=r,_.generateMipMaps=!s,_._lodGenerationScale=u,_._lodGenerationOffset=d,this._doNotHandleContextLost||(_._extension=e,_._files=o);for(var i=r.lastIndexOf("."),m=e||(-1<i?r.substring(i).toLowerCase():""),g=null,v=0,y=M._TextureLoaders;v<y.length;v++){var b=y[v];if(b.canLoad(m,this._textureFormatInUse,t,!1,!1)){g=b;break}}if(g){r=g.transformUrl(r,this._textureFormatInUse);var T=function(e){f._bindTextureDirectly(p.TEXTURE_CUBE_MAP,_,!0),g.loadCubeData(e,_,h,a,l)};o&&6===o.length?g.supportCascades?this._cascadeLoadFiles(n,T,o,l):l&&l("Textures type does not support cascades."):this._loadFile(r,T,void 0,void 0,!0,(function(e,t){if(g){var i=g.getFallbackTextureUrl(r,f._textureFormatInUse);i&&f.createCubeTexture(i,n,o,s,a,l,c,m,h,u,d,_)}l&&e&&l(e.status+" "+e.statusText,t)}))}else{if(!o)throw new Error("Cannot load cubemap because files were not defined");this._cascadeLoadImgs(r,n,(function(e){var t=f.needPOTTextures?R.Tools.GetExponentOfTwo(e[0].width,f._caps.maxCubemapTextureSize):e[0].width,i=t;if(f._prepareWorkingCanvas(),f._workingCanvas&&f._workingContext){f._workingCanvas.width=t,f._workingCanvas.height=i;var r=[p.TEXTURE_CUBE_MAP_POSITIVE_X,p.TEXTURE_CUBE_MAP_POSITIVE_Y,p.TEXTURE_CUBE_MAP_POSITIVE_Z,p.TEXTURE_CUBE_MAP_NEGATIVE_X,p.TEXTURE_CUBE_MAP_NEGATIVE_Y,p.TEXTURE_CUBE_MAP_NEGATIVE_Z];f._bindTextureDirectly(p.TEXTURE_CUBE_MAP,_,!0),f._unpackFlipY(!1);for(var n=c?f._getInternalFormat(c):f._gl.RGBA,o=0;o<r.length;o++)f._workingContext.drawImage(e[o],0,0,e[o].width,e[o].height,0,0,t,i),p.texImage2D(r[o],0,n,n,p.UNSIGNED_BYTE,f._workingCanvas);s||p.generateMipmap(p.TEXTURE_CUBE_MAP),f._setCubeMapTextureParams(!s),_.width=t,_.height=i,_.isReady=!0,c&&(_.format=c),_.onLoadedObservable.notifyObservers(_),_.onLoadedObservable.clear(),a&&a()}}),o,l)}return this._internalTexturesCache.push(_),_},M.prototype._setCubeMapTextureParams=function(e){var t=this._gl;t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MAG_FILTER,t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_MIN_FILTER,e?t.LINEAR_MIPMAP_LINEAR:t.LINEAR),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_S,t.CLAMP_TO_EDGE),t.texParameteri(t.TEXTURE_CUBE_MAP,t.TEXTURE_WRAP_T,t.CLAMP_TO_EDGE),this._bindTextureDirectly(t.TEXTURE_CUBE_MAP,null)},M.prototype.updateRawCubeTexture=function(e,t,i,r,n,o,s){void 0===o&&(o=null),void 0===s&&(s=0),e._bufferViewArray=t,e.format=i,e.type=r,e.invertY=n,e._compression=o;var a=this._gl,l=this._getWebGLTextureType(r),c=this._getInternalFormat(i),h=this._getRGBABufferInternalSizedFormat(r),u=!1;c===a.RGB&&(c=a.RGBA,u=!0),this._bindTextureDirectly(a.TEXTURE_CUBE_MAP,e,!0),this._unpackFlipY(void 0===n||!!n),e.width%4!=0&&a.pixelStorei(a.UNPACK_ALIGNMENT,1);for(var d=0;d<6;d++){var f=t[d];o?a.compressedTexImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,s,this.getCaps().s3tc[o],e.width,e.height,0,f):(u&&(f=this._convertRGBtoRGBATextureData(f,e.width,e.height,r)),a.texImage2D(a.TEXTURE_CUBE_MAP_POSITIVE_X+d,s,h,e.width,e.height,0,c,l,f))}(!this.needPOTTextures||R.Tools.IsExponentOfTwo(e.width)&&R.Tools.IsExponentOfTwo(e.height))&&e.generateMipMaps&&0===s&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),e.isReady=!0},M.prototype.createRawCubeTexture=function(e,t,i,r,n,o,s,a){void 0===a&&(a=null);var l=this._gl,c=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_CUBERAW);c.isCube=!0,c.format=i,c.type=r,this._doNotHandleContextLost||(c._bufferViewArray=e);var h=this._getWebGLTextureType(r),u=this._getInternalFormat(i);u===l.RGB&&(u=l.RGBA),h!==l.FLOAT||this._caps.textureFloatLinearFiltering?h!==this._gl.HALF_FLOAT_OES||this._caps.textureHalfFloatLinearFiltering?h!==l.FLOAT||this._caps.textureFloatRender?h!==l.HALF_FLOAT||this._caps.colorBufferFloat||(n=!1,R.Tools.Warn("Render to half float textures is not supported. Mipmap generation forced to false.")):(n=!1,R.Tools.Warn("Render to float textures is not supported. Mipmap generation forced to false.")):(n=!1,s=M.TEXTURE_NEAREST_SAMPLINGMODE,R.Tools.Warn("Half float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively.")):(n=!1,s=M.TEXTURE_NEAREST_SAMPLINGMODE,R.Tools.Warn("Float texture filtering is not supported. Mipmap generation and sampling mode are forced to false and TEXTURE_NEAREST_SAMPLINGMODE, respectively."));var d=t,f=d;c.width=d,c.height=f,!this.needPOTTextures||R.Tools.IsExponentOfTwo(c.width)&&R.Tools.IsExponentOfTwo(c.height)||(n=!1),e&&this.updateRawCubeTexture(c,e,i,r,o,a),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,c,!0),e&&n&&this._gl.generateMipmap(this._gl.TEXTURE_CUBE_MAP);var p=this._getSamplingParameters(s,n);return l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MAG_FILTER,p.mag),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_MIN_FILTER,p.min),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_S,l.CLAMP_TO_EDGE),l.texParameteri(l.TEXTURE_CUBE_MAP,l.TEXTURE_WRAP_T,l.CLAMP_TO_EDGE),this._bindTextureDirectly(l.TEXTURE_CUBE_MAP,null),c.generateMipMaps=n,c},M.prototype.createRawCubeTextureFromUrl=function(e,d,t,f,p,i,_,m,g,r,n,v){var y=this;void 0===g&&(g=null),void 0===r&&(r=null),void 0===n&&(n=M.TEXTURE_TRILINEAR_SAMPLINGMODE),void 0===v&&(v=!1);var b=this._gl,T=this.createRawCubeTexture(null,t,f,p,!i,v,n);d._addPendingData(T),T.url=e,this._internalTexturesCache.push(T);return this._loadFile(e,(function(e){!(function(e){var t=T.width,i=_(e);if(i){if(m){var r=y._getWebGLTextureType(p),n=y._getInternalFormat(f),o=y._getRGBABufferInternalSizedFormat(p),s=!1;n===b.RGB&&(n=b.RGBA,s=!0),y._bindTextureDirectly(b.TEXTURE_CUBE_MAP,T,!0),y._unpackFlipY(!1);for(var a=m(i),l=0;l<a.length;l++)for(var c=t>>l,h=0;h<6;h++){var u=a[l][h];s&&(u=y._convertRGBtoRGBATextureData(u,c,c,p)),b.texImage2D(h,l,o,c,c,0,n,r,u)}y._bindTextureDirectly(b.TEXTURE_CUBE_MAP,null)}else y.updateRawCubeTexture(T,i,f,p,v);T.isReady=!0,d._removePendingData(T),g&&g()}})(e)}),void 0,d.database,!0,(function(e,t){d._removePendingData(T),r&&e&&r(e.status+" "+e.statusText,t)})),T},M.prototype.updateRawTexture3D=function(e,t,i,r,n,o){void 0===n&&(n=null),void 0===o&&(o=M.TEXTURETYPE_UNSIGNED_INT);var s=this._getWebGLTextureType(o),a=this._getInternalFormat(i),l=this._getRGBABufferInternalSizedFormat(o,i);this._bindTextureDirectly(this._gl.TEXTURE_3D,e,!0),this._unpackFlipY(void 0===r||!!r),this._doNotHandleContextLost||(e._bufferView=t,e.format=i,e.invertY=r,e._compression=n),e.width%4!=0&&this._gl.pixelStorei(this._gl.UNPACK_ALIGNMENT,1),n&&t?this._gl.compressedTexImage3D(this._gl.TEXTURE_3D,0,this.getCaps().s3tc[n],e.width,e.height,e.depth,0,t):this._gl.texImage3D(this._gl.TEXTURE_3D,0,l,e.width,e.height,e.depth,0,a,s,t),e.generateMipMaps&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),e.isReady=!0},M.prototype.createRawTexture3D=function(e,t,i,r,n,o,s,a,l,c){void 0===l&&(l=null),void 0===c&&(c=M.TEXTURETYPE_UNSIGNED_INT);var h=new R.InternalTexture(this,R.InternalTexture.DATASOURCE_RAW3D);h.baseWidth=t,h.baseHeight=i,h.baseDepth=r,h.width=t,h.height=i,h.depth=r,h.format=n,h.type=c,h.generateMipMaps=o,h.samplingMode=a,h.is3D=!0,this._doNotHandleContextLost||(h._bufferView=e),this.updateRawTexture3D(h,e,n,s,l,c),this._bindTextureDirectly(this._gl.TEXTURE_3D,h,!0);var u=this._getSamplingParameters(a,o);return this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MAG_FILTER,u.mag),this._gl.texParameteri(this._gl.TEXTURE_3D,this._gl.TEXTURE_MIN_FILTER,u.min),o&&this._gl.generateMipmap(this._gl.TEXTURE_3D),this._bindTextureDirectly(this._gl.TEXTURE_3D,null),this._internalTexturesCache.push(h),h},M.prototype._prepareWebGLTextureContinuation=function(e,t,i,r,n){var o=this._gl;if(o){var s=this._getSamplingParameters(n,!i);o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MAG_FILTER,s.mag),o.texParameteri(o.TEXTURE_2D,o.TEXTURE_MIN_FILTER,s.min),i||r||o.generateMipmap(o.TEXTURE_2D),this._bindTextureDirectly(o.TEXTURE_2D,null),t&&t._removePendingData(e),e.onLoadedObservable.notifyObservers(e),e.onLoadedObservable.clear()}},M.prototype._prepareWebGLTexture=function(e,t,i,r,n,o,s,a,l){var c=this;void 0===l&&(l=M.TEXTURE_TRILINEAR_SAMPLINGMODE);var h=this.getCaps().maxTextureSize,u=Math.min(h,this.needPOTTextures?R.Tools.GetExponentOfTwo(i,h):i),d=Math.min(h,this.needPOTTextures?R.Tools.GetExponentOfTwo(r,h):r),f=this._gl;f&&(e._webGLTexture?(this._bindTextureDirectly(f.TEXTURE_2D,e,!0),this._unpackFlipY(void 0===n||!!n),e.baseWidth=i,e.baseHeight=r,e.width=u,e.height=d,e.isReady=!0,a(u,d,(function(){c._prepareWebGLTextureContinuation(e,t,o,s,l)}))||this._prepareWebGLTextureContinuation(e,t,o,s,l)):t&&t._removePendingData(e))},M.prototype._convertRGBtoRGBATextureData=function(e,t,i,r){var n;n=r===M.TEXTURETYPE_FLOAT?new Float32Array(t*i*4):new Uint32Array(t*i*4);for(var o=0;o<t;o++)for(var s=0;s<i;s++){var a=3*(s*t+o),l=4*(s*t+o);n[l+0]=e[a+0],n[l+1]=e[a+1],n[l+2]=e[a+2],n[l+3]=1}return n},M.prototype._releaseFramebufferObjects=function(e){var t=this._gl;e._framebuffer&&(t.deleteFramebuffer(e._framebuffer),e._framebuffer=null),e._depthStencilBuffer&&(t.deleteRenderbuffer(e._depthStencilBuffer),e._depthStencilBuffer=null),e._MSAAFramebuffer&&(t.deleteFramebuffer(e._MSAAFramebuffer),e._MSAAFramebuffer=null),e._MSAARenderBuffer&&(t.deleteRenderbuffer(e._MSAARenderBuffer),e._MSAARenderBuffer=null)},M.prototype._releaseTexture=function(t){var e=this._gl;this._releaseFramebufferObjects(t),e.deleteTexture(t._webGLTexture),this.unbindAllTextures();var i=this._internalTexturesCache.indexOf(t);-1!==i&&this._internalTexturesCache.splice(i,1),t._lodTextureHigh&&t._lodTextureHigh.dispose(),t._lodTextureMid&&t._lodTextureMid.dispose(),t._lodTextureLow&&t._lodTextureLow.dispose(),this.scenes.forEach((function(e){e.postProcesses.forEach((function(e){e._outputTexture==t&&(e._outputTexture=null)})),e.cameras.forEach((function(e){e._postProcesses.forEach((function(e){e&&e._outputTexture==t&&(e._outputTexture=null)}))}))}))},M.prototype.setProgram=function(e){this._currentProgram!==e&&(this._gl.useProgram(e),this._currentProgram=e)},M.prototype.bindSamplers=function(e){this.setProgram(e.getProgram());for(var t=e.getSamplers(),i=0;i<t.length;i++){var r=e.getUniform(t[i]);r&&(this._boundUniforms[i]=r)}this._currentEffect=null},M.prototype._moveBoundTextureOnTop=function(e){this.disableTextureBindingOptimization||this._lastBoundInternalTextureTracker.previous===e||(this._linkTrackers(e.previous,e.next),this._linkTrackers(this._lastBoundInternalTextureTracker.previous,e),this._linkTrackers(e,this._lastBoundInternalTextureTracker))},M.prototype._getCorrectTextureChannel=function(e,t){if(!t)return-1;if(t._initialSlot=e,this.disableTextureBindingOptimization)e!==t._designatedSlot&&this._textureCollisions.addCount(1,!1);else if(e!==t._designatedSlot)return-1<t._designatedSlot?t._designatedSlot:this._nextFreeTextureSlots.length?this._nextFreeTextureSlots[0]:(this._textureCollisions.addCount(1,!1),this._removeDesignatedSlot(this._firstBoundInternalTextureTracker.next));return e},M.prototype._linkTrackers=function(e,t){(e.next=t).previous=e},M.prototype._removeDesignatedSlot=function(e){var t=e._designatedSlot;return-1===t?-1:(e._designatedSlot=-1,this.disableTextureBindingOptimization?-1:(this._linkTrackers(e.previous,e.next),this._boundTexturesCache[t]=null,this._nextFreeTextureSlots.push(t),t))},M.prototype._activateCurrentTexture=function(){this._currentTextureChannel!==this._activeChannel&&(this._gl.activeTexture(this._gl.TEXTURE0+this._activeChannel),this._currentTextureChannel=this._activeChannel)},M.prototype._bindTextureDirectly=function(e,t,i,r){void 0===i&&(i=!1),void 0===r&&(r=!1);var n=!1;i&&t&&-1<t._designatedSlot&&(this._activeChannel=t._designatedSlot);var o=this._boundTexturesCache[this._activeChannel],s=t&&-1<t._initialSlot;if(o!==t||r){if(o&&this._removeDesignatedSlot(o),this._activateCurrentTexture(),this._gl.bindTexture(e,t?t._webGLTexture:null),this._boundTexturesCache[this._activeChannel]=t){if(!this.disableTextureBindingOptimization){var a=this._nextFreeTextureSlots.indexOf(this._activeChannel);-1<a&&this._nextFreeTextureSlots.splice(a,1),this._linkTrackers(this._lastBoundInternalTextureTracker.previous,t),this._linkTrackers(t,this._lastBoundInternalTextureTracker)}t._designatedSlot=this._activeChannel}}else i&&(n=!0,this._activateCurrentTexture());return s&&!i&&this._bindSamplerUniformToChannel(t._initialSlot,this._activeChannel),n},M.prototype._bindTexture=function(e,t){e<0||(t&&(e=this._getCorrectTextureChannel(e,t)),this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,t))},M.prototype.setTextureFromPostProcess=function(e,t){this._bindTexture(e,t?t._textures.data[t._currentRenderTextureInd]:null)},M.prototype.setTextureFromPostProcessOutput=function(e,t){this._bindTexture(e,t?t._outputTexture:null)},M.prototype.unbindAllTextures=function(){for(var e=0;e<this._maxSimultaneousTextures;e++)this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),1<this.webGLVersion&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)},M.prototype.setTexture=function(e,t,i){e<0||(t&&(this._boundUniforms[e]=t),this._setTexture(e,i))},M.prototype.setDepthStencilTexture=function(e,t,i){e<0||(t&&(this._boundUniforms[e]=t),i&&i.depthStencilTexture?this._setTexture(e,i,!1,!0):this._setTexture(e,null))},M.prototype._bindSamplerUniformToChannel=function(e,t){var i=this._boundUniforms[e];i._currentState!==t&&(this._gl.uniform1i(i,t),i._currentState=t)},M.prototype._getTextureWrapMode=function(e){switch(e){case M.TEXTURE_WRAP_ADDRESSMODE:return this._gl.REPEAT;case M.TEXTURE_CLAMP_ADDRESSMODE:return this._gl.CLAMP_TO_EDGE;case M.TEXTURE_MIRROR_ADDRESSMODE:return this._gl.MIRRORED_REPEAT}return this._gl.REPEAT},M.prototype._setTexture=function(e,t,i,r){if(void 0===i&&(i=!1),void 0===r&&(r=!1),!t)return null!=this._boundTexturesCache[e]&&(this._activeChannel=e,this._bindTextureDirectly(this._gl.TEXTURE_2D,null),this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,null),1<this.webGLVersion&&this._bindTextureDirectly(this._gl.TEXTURE_3D,null)),!1;if(t.video)this._activeChannel=e,t.update();else if(t.delayLoadState===M.DELAYLOADSTATE_NOTLOADED)return t.delayLoad(),!1;var n;n=r?t.depthStencilTexture:t.isReady()?t.getInternalTexture():t.isCube?this.emptyCubeTexture:t.is3D?this.emptyTexture3D:this.emptyTexture,i||(e=this._getCorrectTextureChannel(e,n));var o=!0;if(this._boundTexturesCache[e]===n&&(this._moveBoundTextureOnTop(n),i||this._bindSamplerUniformToChannel(n._initialSlot,e),o=!1),this._activeChannel=e,n&&n.is3D)o&&this._bindTextureDirectly(this._gl.TEXTURE_3D,n,i),n&&n._cachedWrapU!==t.wrapU&&(n._cachedWrapU=t.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),n)),n&&n._cachedWrapV!==t.wrapV&&(n._cachedWrapV=t.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),n)),n&&n._cachedWrapR!==t.wrapR&&(n._cachedWrapR=t.wrapR,this._setTextureParameterInteger(this._gl.TEXTURE_3D,this._gl.TEXTURE_WRAP_R,this._getTextureWrapMode(t.wrapR),n)),this._setAnisotropicLevel(this._gl.TEXTURE_3D,t);else if(n&&n.isCube){if(o&&this._bindTextureDirectly(this._gl.TEXTURE_CUBE_MAP,n,i),n._cachedCoordinatesMode!==t.coordinatesMode){n._cachedCoordinatesMode=t.coordinatesMode;var s=t.coordinatesMode!==M.TEXTURE_CUBIC_MODE&&t.coordinatesMode!==M.TEXTURE_SKYBOX_MODE?this._gl.REPEAT:this._gl.CLAMP_TO_EDGE;this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_S,s,n),this._setTextureParameterInteger(this._gl.TEXTURE_CUBE_MAP,this._gl.TEXTURE_WRAP_T,s)}this._setAnisotropicLevel(this._gl.TEXTURE_CUBE_MAP,t)}else o&&this._bindTextureDirectly(this._gl.TEXTURE_2D,n,i),n&&n._cachedWrapU!==t.wrapU&&(n._cachedWrapU=t.wrapU,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_S,this._getTextureWrapMode(t.wrapU),n)),n&&n._cachedWrapV!==t.wrapV&&(n._cachedWrapV=t.wrapV,this._setTextureParameterInteger(this._gl.TEXTURE_2D,this._gl.TEXTURE_WRAP_T,this._getTextureWrapMode(t.wrapV),n)),this._setAnisotropicLevel(this._gl.TEXTURE_2D,t);return!0},M.prototype.setTextureArray=function(e,t,i){if(!(e<0)&&t){this._textureUnits&&this._textureUnits.length===i.length||(this._textureUnits=new Int32Array(i.length));for(var r=0;r<i.length;r++)this._textureUnits[r]=this._getCorrectTextureChannel(e+r,i[r].getInternalTexture());this._gl.uniform1iv(t,this._textureUnits);for(var n=0;n<i.length;n++)this._setTexture(this._textureUnits[n],i[n],!0)}},M.prototype._setAnisotropicLevel=function(e,t){var i=t.getInternalTexture();if(i){var r=this._caps.textureAnisotropicFilterExtension,n=t.anisotropicFilteringLevel;i.samplingMode!==M.TEXTURE_LINEAR_LINEAR_MIPNEAREST&&i.samplingMode!==M.TEXTURE_LINEAR_LINEAR_MIPLINEAR&&i.samplingMode!==M.TEXTURE_LINEAR_LINEAR&&(n=1),r&&i._cachedAnisotropicFilteringLevel!==n&&(this._setTextureParameterFloat(e,r.TEXTURE_MAX_ANISOTROPY_EXT,Math.min(n,this._caps.maxAnisotropy),i),i._cachedAnisotropicFilteringLevel=n)}},M.prototype._setTextureParameterFloat=function(e,t,i,r){this._bindTextureDirectly(e,r,!0,!0),this._gl.texParameterf(e,t,i)},M.prototype._setTextureParameterInteger=function(e,t,i,r){r&&this._bindTextureDirectly(e,r,!0,!0),this._gl.texParameteri(e,t,i)},M.prototype.readPixels=function(e,t,i,r){var n=new Uint8Array(r*i*4);return this._gl.readPixels(e,t,i,r,this._gl.RGBA,this._gl.UNSIGNED_BYTE,n),n},M.prototype.addExternalData=function(e,t){return this._externalData||(this._externalData=new R.StringDictionary),this._externalData.add(e,t)},M.prototype.getExternalData=function(e){return this._externalData||(this._externalData=new R.StringDictionary),this._externalData.get(e)},M.prototype.getOrAddExternalDataWithFactory=function(e,t){return this._externalData||(this._externalData=new R.StringDictionary),this._externalData.getOrAddWithFactory(e,t)},M.prototype.removeExternalData=function(e){return this._externalData||(this._externalData=new R.StringDictionary),this._externalData.remove(e)},M.prototype.unbindAllAttributes=function(){if(this._mustWipeVertexAttributes){this._mustWipeVertexAttributes=!1;for(var e=0;e<this._caps.maxVertexAttribs;e++)this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1}else{e=0;for(var t=this._vertexAttribArraysEnabled.length;e<t;e++)e>=this._caps.maxVertexAttribs||!this._vertexAttribArraysEnabled[e]||(this._gl.disableVertexAttribArray(e),this._vertexAttribArraysEnabled[e]=!1,this._currentBufferPointers[e].active=!1)}},M.prototype.releaseEffects=function(){for(var e in this._compiledEffects)this._deleteProgram(this._compiledEffects[e]._program);this._compiledEffects={}},M.prototype.dispose=function(){for(this.hideLoadingUI(),this.stopRenderLoop();this.postProcesses.length;)this.postProcesses[0].dispose();for(this._emptyTexture&&(this._releaseTexture(this._emptyTexture),this._emptyTexture=null),this._emptyCubeTexture&&(this._releaseTexture(this._emptyCubeTexture),this._emptyCubeTexture=null),this._rescalePostProcess&&this._rescalePostProcess.dispose();this.scenes.length;)this.scenes[0].dispose();1===M.Instances.length&&M.audioEngine&&M.audioEngine.dispose(),this.releaseEffects(),this.unbindAllAttributes(),this._boundUniforms=[],this._dummyFramebuffer&&this._gl.deleteFramebuffer(this._dummyFramebuffer),this.disableVR(),R.Tools.IsWindowObjectExist()&&(window.removeEventListener("blur",this._onBlur),window.removeEventListener("focus",this._onFocus),window.removeEventListener("vrdisplaypointerrestricted",this._onVRDisplayPointerRestricted),window.removeEventListener("vrdisplaypointerunrestricted",this._onVRDisplayPointerUnrestricted),this._renderingCanvas&&(this._renderingCanvas.removeEventListener("focus",this._onCanvasFocus),this._renderingCanvas.removeEventListener("blur",this._onCanvasBlur),this._renderingCanvas.removeEventListener("pointerout",this._onCanvasPointerOut),this._doNotHandleContextLost||(this._renderingCanvas.removeEventListener("webglcontextlost",this._onContextLost),this._renderingCanvas.removeEventListener("webglcontextrestored",this._onContextRestored))),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.removeEventListener("pointerlockchange",this._onPointerLockChange),document.removeEventListener("mspointerlockchange",this._onPointerLockChange),document.removeEventListener("mozpointerlockchange",this._onPointerLockChange),document.removeEventListener("webkitpointerlockchange",this._onPointerLockChange),this._onVrDisplayConnect&&(window.removeEventListener("vrdisplayconnect",this._onVrDisplayConnect),this._onVrDisplayDisconnect&&window.removeEventListener("vrdisplaydisconnect",this._onVrDisplayDisconnect),this._onVrDisplayPresentChange&&window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._onVrDisplayConnect=null,this._onVrDisplayDisconnect=null));var e=M.Instances.indexOf(this);0<=e&&M.Instances.splice(e,1),this._workingCanvas=null,this._workingContext=null,this._currentBufferPointers=[],this._renderingCanvas=null,this._currentProgram=null,this._bindedRenderFunction=null,this.onResizeObservable.clear(),this.onCanvasBlurObservable.clear(),this.onCanvasFocusObservable.clear(),this.onCanvasPointerOutObservable.clear(),this.onBeginFrameObservable.clear(),this.onEndFrameObservable.clear(),R.Effect.ResetCache();for(var t=0,i=this._activeRequests;t<i.length;t++){i[t].abort()}},M.prototype.displayLoadingUI=function(){if(R.Tools.IsWindowObjectExist()){var e=this.loadingScreen;e&&e.displayLoadingUI()}},M.prototype.hideLoadingUI=function(){if(R.Tools.IsWindowObjectExist()){var e=this.loadingScreen;e&&e.hideLoadingUI()}},Object.defineProperty(M.prototype,"loadingScreen",{get:function(){return!this._loadingScreen&&R.DefaultLoadingScreen&&this._renderingCanvas&&(this._loadingScreen=new R.DefaultLoadingScreen(this._renderingCanvas)),this._loadingScreen},set:function(e){this._loadingScreen=e},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"loadingUIText",{set:function(e){this.loadingScreen.loadingUIText=e},enumerable:!0,configurable:!0}),Object.defineProperty(M.prototype,"loadingUIBackgroundColor",{set:function(e){this.loadingScreen.loadingUIBackgroundColor=e},enumerable:!0,configurable:!0}),M.prototype.attachContextLostEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextlost",e,!1)},M.prototype.attachContextRestoredEvent=function(e){this._renderingCanvas&&this._renderingCanvas.addEventListener("webglcontextrestored",e,!1)},M.prototype.getVertexShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[0]):null},M.prototype.getFragmentShaderSource=function(e){var t=this._gl.getAttachedShaders(e);return t?this._gl.getShaderSource(t[1]):null},M.prototype.getError=function(){return this._gl.getError()},M.prototype.getFps=function(){return this._fps},M.prototype.getDeltaTime=function(){return this._deltaTime},M.prototype._measureFps=function(){this._performanceMonitor.sampleFrame(),this._fps=this._performanceMonitor.averageFPS,this._deltaTime=this._performanceMonitor.instantaneousFrameTime||0},M.prototype._readTexturePixels=function(e,t,i,r,n,o){void 0===r&&(r=-1),void 0===n&&(n=0),void 0===o&&(o=null);var s=this._gl;if(!this._dummyFramebuffer){var a=s.createFramebuffer();if(!a)throw new Error("Unable to create dummy framebuffer");this._dummyFramebuffer=a}s.bindFramebuffer(s.FRAMEBUFFER,this._dummyFramebuffer),-1<r?s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_CUBE_MAP_POSITIVE_X+r,e._webGLTexture,n):s.framebufferTexture2D(s.FRAMEBUFFER,s.COLOR_ATTACHMENT0,s.TEXTURE_2D,e._webGLTexture,n);var l=void 0!==e.type?this._getWebGLTextureType(e.type):s.UNSIGNED_BYTE;switch(l){case s.UNSIGNED_BYTE:o||(o=new Uint8Array(4*t*i)),l=s.UNSIGNED_BYTE;break;default:o||(o=new Float32Array(4*t*i)),l=s.FLOAT}return s.readPixels(0,0,t,i,s.RGBA,l,o),s.bindFramebuffer(s.FRAMEBUFFER,this._currentFramebuffer),o},M.prototype._canRenderToFloatFramebuffer=function(){return 1<this._webGLVersion?this._caps.colorBufferFloat:this._canRenderToFramebuffer(M.TEXTURETYPE_FLOAT)},M.prototype._canRenderToHalfFloatFramebuffer=function(){return 1<this._webGLVersion?this._caps.colorBufferFloat:this._canRenderToFramebuffer(M.TEXTURETYPE_HALF_FLOAT)},M.prototype._canRenderToFramebuffer=function(e){for(var t=this._gl;t.getError()!==t.NO_ERROR;);var i=!0,r=t.createTexture();t.bindTexture(t.TEXTURE_2D,r),t.texImage2D(t.TEXTURE_2D,0,this._getRGBABufferInternalSizedFormat(e),1,1,0,t.RGBA,this._getWebGLTextureType(e),null),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MIN_FILTER,t.NEAREST),t.texParameteri(t.TEXTURE_2D,t.TEXTURE_MAG_FILTER,t.NEAREST);var n=t.createFramebuffer();t.bindFramebuffer(t.FRAMEBUFFER,n),t.framebufferTexture2D(t.FRAMEBUFFER,t.COLOR_ATTACHMENT0,t.TEXTURE_2D,r,0);var o=t.checkFramebufferStatus(t.FRAMEBUFFER);if((i=(i=i&&o===t.FRAMEBUFFER_COMPLETE)&&t.getError()===t.NO_ERROR)&&(t.clear(t.COLOR_BUFFER_BIT),i=i&&t.getError()===t.NO_ERROR),i){t.bindFramebuffer(t.FRAMEBUFFER,null);var s=t.RGBA,a=t.UNSIGNED_BYTE,l=new Uint8Array(4);t.readPixels(0,0,1,1,s,a,l),i=i&&t.getError()===t.NO_ERROR}for(t.deleteTexture(r),t.deleteFramebuffer(n),t.bindFramebuffer(t.FRAMEBUFFER,null);!i&&t.getError()!==t.NO_ERROR;);return i},M.prototype._getWebGLTextureType=function(e){if(1===this._webGLVersion){switch(e){case M.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case M.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT_OES;case M.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE}return this._gl.UNSIGNED_BYTE}switch(e){case M.TEXTURETYPE_BYTE:return this._gl.BYTE;case M.TEXTURETYPE_UNSIGNED_BYTE:return this._gl.UNSIGNED_BYTE;case M.TEXTURETYPE_SHORT:return this._gl.SHORT;case M.TEXTURETYPE_UNSIGNED_SHORT:return this._gl.UNSIGNED_SHORT;case M.TEXTURETYPE_INT:return this._gl.INT;case M.TEXTURETYPE_UNSIGNED_INTEGER:return this._gl.UNSIGNED_INT;case M.TEXTURETYPE_FLOAT:return this._gl.FLOAT;case M.TEXTURETYPE_HALF_FLOAT:return this._gl.HALF_FLOAT;case M.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.UNSIGNED_SHORT_4_4_4_4;case M.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.UNSIGNED_SHORT_5_5_5_1;case M.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.UNSIGNED_SHORT_5_6_5;case M.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:return this._gl.UNSIGNED_INT_2_10_10_10_REV;case M.TEXTURETYPE_UNSIGNED_INT_24_8:return this._gl.UNSIGNED_INT_24_8;case M.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.UNSIGNED_INT_10F_11F_11F_REV;case M.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.UNSIGNED_INT_5_9_9_9_REV;case M.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV:return this._gl.FLOAT_32_UNSIGNED_INT_24_8_REV}return this._gl.UNSIGNED_BYTE},M.prototype._getInternalFormat=function(e){var t=this._gl.RGBA;switch(e){case M.TEXTUREFORMAT_ALPHA:t=this._gl.ALPHA;break;case M.TEXTUREFORMAT_LUMINANCE:t=this._gl.LUMINANCE;break;case M.TEXTUREFORMAT_LUMINANCE_ALPHA:t=this._gl.LUMINANCE_ALPHA;break;case M.TEXTUREFORMAT_RED:t=this._gl.RED;break;case M.TEXTUREFORMAT_RG:t=this._gl.RG;break;case M.TEXTUREFORMAT_RGB:t=this._gl.RGB;break;case M.TEXTUREFORMAT_RGBA:t=this._gl.RGBA}if(1<this._webGLVersion)switch(e){case M.TEXTUREFORMAT_RED_INTEGER:t=this._gl.RED_INTEGER;break;case M.TEXTUREFORMAT_RG_INTEGER:t=this._gl.RG_INTEGER;break;case M.TEXTUREFORMAT_RGB_INTEGER:t=this._gl.RGB_INTEGER;break;case M.TEXTUREFORMAT_RGBA_INTEGER:t=this._gl.RGBA_INTEGER}return t},M.prototype._getRGBABufferInternalSizedFormat=function(e,t){if(1===this._webGLVersion){if(void 0!==t)switch(t){case M.TEXTUREFORMAT_ALPHA:return this._gl.ALPHA;case M.TEXTUREFORMAT_LUMINANCE:return this._gl.LUMINANCE;case M.TEXTUREFORMAT_LUMINANCE_ALPHA:return this._gl.LUMINANCE_ALPHA}return this._gl.RGBA}switch(e){case M.TEXTURETYPE_BYTE:switch(t){case M.TEXTUREFORMAT_RED:return this._gl.R8_SNORM;case M.TEXTUREFORMAT_RG:return this._gl.RG8_SNORM;case M.TEXTUREFORMAT_RGB:return this._gl.RGB8_SNORM;case M.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8I;case M.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8I;case M.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8I;case M.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8I;default:return this._gl.RGBA8_SNORM}case M.TEXTURETYPE_UNSIGNED_BYTE:switch(t){case M.TEXTUREFORMAT_RED:return this._gl.R8;case M.TEXTUREFORMAT_RG:return this._gl.RG8;case M.TEXTUREFORMAT_RGB:return this._gl.RGB8;case M.TEXTUREFORMAT_RGBA:return this._gl.RGBA8;case M.TEXTUREFORMAT_RED_INTEGER:return this._gl.R8UI;case M.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG8UI;case M.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB8UI;case M.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGBA8UI;default:return this._gl.RGBA8}case M.TEXTURETYPE_SHORT:switch(t){case M.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16I;case M.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16I;case M.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16I;case M.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16I}case M.TEXTURETYPE_UNSIGNED_SHORT:switch(t){case M.TEXTUREFORMAT_RED_INTEGER:return this._gl.R16UI;case M.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG16UI;case M.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB16UI;case M.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA16UI}case M.TEXTURETYPE_INT:switch(t){case M.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32I;case M.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32I;case M.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32I;case M.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32I}case M.TEXTURETYPE_UNSIGNED_INTEGER:switch(t){case M.TEXTUREFORMAT_RED_INTEGER:return this._gl.R32UI;case M.TEXTUREFORMAT_RG_INTEGER:return this._gl.RG32UI;case M.TEXTUREFORMAT_RGB_INTEGER:return this._gl.RGB32UI;case M.TEXTUREFORMAT_RGBA_INTEGER:default:return this._gl.RGBA32UI}case M.TEXTURETYPE_FLOAT:switch(t){case M.TEXTUREFORMAT_RED:return this._gl.R32F;case M.TEXTUREFORMAT_RG:return this._gl.RG32F;case M.TEXTUREFORMAT_RGB:return this._gl.RGB32F;case M.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA32F}case M.TEXTURETYPE_HALF_FLOAT:switch(t){case M.TEXTUREFORMAT_RED:return this._gl.R16F;case M.TEXTUREFORMAT_RG:return this._gl.RG16F;case M.TEXTUREFORMAT_RGB:return this._gl.RGB16F;case M.TEXTUREFORMAT_RGBA:default:return this._gl.RGBA16F}case M.TEXTURETYPE_UNSIGNED_SHORT_5_6_5:return this._gl.RGB565;case M.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV:return this._gl.R11F_G11F_B10F;case M.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV:return this._gl.RGB9_E5;case M.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4:return this._gl.RGBA4;case M.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1:return this._gl.RGB5_A1;case M.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV:switch(t){case M.TEXTUREFORMAT_RGBA:return this._gl.RGB10_A2;case M.TEXTUREFORMAT_RGBA_INTEGER:return this._gl.RGB10_A2UI;default:return this._gl.RGB10_A2}}return this._gl.RGBA8},M.prototype._getRGBAMultiSampleBufferFormat=function(e){return e===M.TEXTURETYPE_FLOAT?this._gl.RGBA32F:e===M.TEXTURETYPE_HALF_FLOAT?this._gl.RGBA16F:this._gl.RGBA8},M.prototype._loadFile=function(e,t,i,r,n,o){var s=this,a=R.Tools.LoadFile(e,t,i,r,n,o);return this._activeRequests.push(a),a.onCompleteObservable.add((function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)})),a},M.prototype._loadFileAsync=function(e,r,n){var o=this;return new Promise(function(t,i){o._loadFile(e,(function(e){t(e)}),void 0,r,n,(function(e,t){i(t)}))})},M.prototype._partialLoadFile=function(e,t,i,r,n,o){void 0===o&&(o=null);this._loadFile(e,(function(e){i[t]=e,i._internalCount++,6===i._internalCount&&n(i)}),void 0,void 0,!0,(function(e,t){o&&e&&o(e.status+" "+e.statusText,t)}))},M.prototype._cascadeLoadFiles=function(e,t,i,r){void 0===r&&(r=null);for(var n=[],o=n._internalCount=0;o<6;o++)this._partialLoadFile(i[o],o,n,e,t,r)},M.isSupported=function(){try{var e=document.createElement("canvas");return null!=(e.getContext("webgl")||e.getContext("experimental-webgl"))&&!!window.WebGLRenderingContext}catch(e){return!1}},M.ExceptionList=[{key:"Chrome/63.0",capture:"63\\.0\\.3239\\.(\\d+)",captureConstraint:108,targets:["uniformBuffer"]},{key:"Firefox/58",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Firefox/59",capture:null,captureConstraint:null,targets:["uniformBuffer"]},{key:"Macintosh",capture:null,captureConstraint:null,targets:["textureBindingOptimization"]},{key:"iPhone",capture:null,captureConstraint:null,targets:["textureBindingOptimization"]},{key:"iPad",capture:null,captureConstraint:null,targets:["textureBindingOptimization"]}],M.Instances=new Array,M._TextureLoaders=[],M.ALPHA_DISABLE=0,M.ALPHA_ADD=1,M.ALPHA_COMBINE=2,M.ALPHA_SUBTRACT=3,M.ALPHA_MULTIPLY=4,M.ALPHA_MAXIMIZED=5,M.ALPHA_ONEONE=6,M.ALPHA_PREMULTIPLIED=7,M.ALPHA_PREMULTIPLIED_PORTERDUFF=8,M.ALPHA_INTERPOLATE=9,M.ALPHA_SCREENMODE=10,M.DELAYLOADSTATE_NONE=0,M.DELAYLOADSTATE_LOADED=1,M.DELAYLOADSTATE_LOADING=2,M.DELAYLOADSTATE_NOTLOADED=4,M.NEVER=512,M.ALWAYS=519,M.LESS=513,M.EQUAL=514,M.LEQUAL=515,M.GREATER=516,M.GEQUAL=518,M.NOTEQUAL=517,M.KEEP=7680,M.REPLACE=7681,M.INCR=7682,M.DECR=7683,M.INVERT=5386,M.INCR_WRAP=34055,M.DECR_WRAP=34056,M.TEXTURE_CLAMP_ADDRESSMODE=0,M.TEXTURE_WRAP_ADDRESSMODE=1,M.TEXTURE_MIRROR_ADDRESSMODE=2,M.TEXTUREFORMAT_ALPHA=0,M.TEXTUREFORMAT_LUMINANCE=1,M.TEXTUREFORMAT_LUMINANCE_ALPHA=2,M.TEXTUREFORMAT_RGB=4,M.TEXTUREFORMAT_RGBA=5,M.TEXTUREFORMAT_RED=6,M.TEXTUREFORMAT_R=6,M.TEXTUREFORMAT_RG=7,M.TEXTUREFORMAT_RED_INTEGER=8,M.TEXTUREFORMAT_R_INTEGER=8,M.TEXTUREFORMAT_RG_INTEGER=9,M.TEXTUREFORMAT_RGB_INTEGER=10,M.TEXTUREFORMAT_RGBA_INTEGER=11,M.TEXTURETYPE_UNSIGNED_BYTE=0,M.TEXTURETYPE_UNSIGNED_INT=0,M.TEXTURETYPE_FLOAT=1,M.TEXTURETYPE_HALF_FLOAT=2,M.TEXTURETYPE_BYTE=3,M.TEXTURETYPE_SHORT=4,M.TEXTURETYPE_UNSIGNED_SHORT=5,M.TEXTURETYPE_INT=6,M.TEXTURETYPE_UNSIGNED_INTEGER=7,M.TEXTURETYPE_UNSIGNED_SHORT_4_4_4_4=8,M.TEXTURETYPE_UNSIGNED_SHORT_5_5_5_1=9,M.TEXTURETYPE_UNSIGNED_SHORT_5_6_5=10,M.TEXTURETYPE_UNSIGNED_INT_2_10_10_10_REV=11,M.TEXTURETYPE_UNSIGNED_INT_24_8=12,M.TEXTURETYPE_UNSIGNED_INT_10F_11F_11F_REV=13,M.TEXTURETYPE_UNSIGNED_INT_5_9_9_9_REV=14,M.TEXTURETYPE_FLOAT_32_UNSIGNED_INT_24_8_REV=15,M.TEXTURE_NEAREST_SAMPLINGMODE=1,M.TEXTURE_BILINEAR_SAMPLINGMODE=2,M.TEXTURE_TRILINEAR_SAMPLINGMODE=3,M.TEXTURE_NEAREST_NEAREST_MIPLINEAR=1,M.TEXTURE_LINEAR_LINEAR_MIPNEAREST=2,M.TEXTURE_LINEAR_LINEAR_MIPLINEAR=3,M.TEXTURE_NEAREST_NEAREST_MIPNEAREST=4,M.TEXTURE_NEAREST_LINEAR_MIPNEAREST=5,M.TEXTURE_NEAREST_LINEAR_MIPLINEAR=6,M.TEXTURE_NEAREST_LINEAR=7,M.TEXTURE_NEAREST_NEAREST=8,M.TEXTURE_LINEAR_NEAREST_MIPNEAREST=9,M.TEXTURE_LINEAR_NEAREST_MIPLINEAR=10,M.TEXTURE_LINEAR_LINEAR=11,M.TEXTURE_LINEAR_NEAREST=12,M.TEXTURE_EXPLICIT_MODE=0,M.TEXTURE_SPHERICAL_MODE=1,M.TEXTURE_PLANAR_MODE=2,M.TEXTURE_CUBIC_MODE=3,M.TEXTURE_PROJECTION_MODE=4,M.TEXTURE_SKYBOX_MODE=5,M.TEXTURE_INVCUBIC_MODE=6,M.TEXTURE_EQUIRECTANGULAR_MODE=7,M.TEXTURE_FIXED_EQUIRECTANGULAR_MODE=8,M.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE=9,M.SCALEMODE_FLOOR=1,M.SCALEMODE_NEAREST=2,M.SCALEMODE_CEILING=3,M.CollisionsEpsilon=.001,M.CodeRepository="src/",M.ShadersRepository="src/Shaders/",M})();R.Engine=i})($a||($a={})),y=$a||($a={}),E=(function(){function e(e,t){void 0===t&&(t=null),this.state="",this.metadata=null,this.doNotSerialize=!1,this._isDisposed=!1,this.animations=new Array,this._ranges={},this._isEnabled=!0,this._isParentEnabled=!0,this._isReady=!0,this._currentRenderId=-1,this._parentRenderId=-1,this._childRenderId=-1,this._worldMatrix=y.Matrix.Identity(),this._worldMatrixDeterminant=0,this._sceneRootNodesIndex=-1,this._animationPropertiesOverride=null,this.onDisposeObservable=new y.Observable,this._behaviors=new Array,this.name=e,this.id=e,this._scene=t||y.Engine.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._initCache(),this.addToSceneRootNodes()}return e.AddNodeConstructor=function(e,t){this._NodeConstructors[e]=t},e.Construct=function(e,t,i,r){var n=this._NodeConstructors[e];return n?n(t,i,r):null},e.prototype.isDisposed=function(){return this._isDisposed},Object.defineProperty(e.prototype,"parent",{get:function(){return this._parentNode},set:function(e){if(this._parentNode!==e){var t=this._parentNode;if(this._parentNode&&void 0!==this._parentNode._children&&null!==this._parentNode._children){var i=this._parentNode._children.indexOf(this);-1!==i&&this._parentNode._children.splice(i,1),e||this.addToSceneRootNodes()}this._parentNode=e,this._parentNode&&(void 0!==this._parentNode._children&&null!==this._parentNode._children||(this._parentNode._children=new Array),this._parentNode._children.push(this),t||this.removeFromSceneRootNodes()),this._syncParentEnabledState()}},enumerable:!0,configurable:!0}),e.prototype.addToSceneRootNodes=function(){-1===this._sceneRootNodesIndex&&(this._sceneRootNodesIndex=this._scene.rootNodes.length,this._scene.rootNodes.push(this))},e.prototype.removeFromSceneRootNodes=function(){if(-1!==this._sceneRootNodesIndex){var e=this._scene.rootNodes,t=e.length-1;e[this._sceneRootNodesIndex]=e[t],e[this._sceneRootNodesIndex]._sceneRootNodesIndex=this._sceneRootNodesIndex,this._scene.rootNodes.pop(),this._sceneRootNodesIndex=-1}},Object.defineProperty(e.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"Node"},Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype.getEngine=function(){return this._scene.getEngine()},e.prototype.addBehavior=function(e,t){var i=this;return void 0===t&&(t=!1),-1!==this._behaviors.indexOf(e)||(e.init(),this._scene.isLoading&&!t?this._scene.onDataLoadedObservable.addOnce((function(){e.attach(i)})):e.attach(this),this._behaviors.push(e)),this},e.prototype.removeBehavior=function(e){var t=this._behaviors.indexOf(e);return-1===t||(this._behaviors[t].detach(),this._behaviors.splice(t,1)),this},Object.defineProperty(e.prototype,"behaviors",{get:function(){return this._behaviors},enumerable:!0,configurable:!0}),e.prototype.getBehaviorByName=function(e){for(var t=0,i=this._behaviors;t<i.length;t++){var r=i[t];if(r.name===e)return r}return null},e.prototype.getWorldMatrix=function(){return this._currentRenderId!==this._scene.getRenderId()&&this.computeWorldMatrix(),this._worldMatrix},e.prototype._getWorldMatrixDeterminant=function(){return this._worldMatrixDeterminant},Object.defineProperty(e.prototype,"worldMatrixFromCache",{get:function(){return this._worldMatrix},enumerable:!0,configurable:!0}),e.prototype._initCache=function(){this._cache={},this._cache.parent=void 0},e.prototype.updateCache=function(e){!e&&this.isSynchronized()||(this._cache.parent=this.parent,this._updateCache())},e.prototype._updateCache=function(e){},e.prototype._isSynchronized=function(){return!0},e.prototype._markSyncedWithParent=function(){this._parentNode&&(this._parentRenderId=this._parentNode._childRenderId)},e.prototype.isSynchronizedWithParent=function(){return!this._parentNode||this._parentRenderId===this._parentNode._childRenderId&&this._parentNode.isSynchronized()},e.prototype.isSynchronized=function(){return this._cache.parent!=this._parentNode?(this._cache.parent=this._parentNode,!1):!(this._parentNode&&!this.isSynchronizedWithParent())&&this._isSynchronized()},e.prototype.isReady=function(e){return void 0===e&&(e=!1),this._isReady},e.prototype.isEnabled=function(e){return void 0===e&&(e=!0),!1===e?this._isEnabled:!!this._isEnabled&&this._isParentEnabled},e.prototype._syncParentEnabledState=function(){this._isParentEnabled=!this._parentNode||this._parentNode.isEnabled(),this._children&&this._children.forEach((function(e){e._syncParentEnabledState()}))},e.prototype.setEnabled=function(e){this._isEnabled=e,this._syncParentEnabledState()},e.prototype.isDescendantOf=function(e){return!!this.parent&&(this.parent===e||this.parent.isDescendantOf(e))},e.prototype._getDescendants=function(e,t,i){if(void 0===t&&(t=!1),this._children)for(var r=0;r<this._children.length;r++){var n=this._children[r];i&&!i(n)||e.push(n),t||n._getDescendants(e,!1,i)}},e.prototype.getDescendants=function(e,t){var i=new Array;return this._getDescendants(i,e,t),i},e.prototype.getChildMeshes=function(e,t){var i=[];return this._getDescendants(i,e,(function(e){return(!t||t(e))&&e instanceof y.AbstractMesh})),i},e.prototype.getChildTransformNodes=function(e,t){var i=[];return this._getDescendants(i,e,(function(e){return(!t||t(e))&&e instanceof y.TransformNode})),i},e.prototype.getChildren=function(e){return this.getDescendants(!0,e)},e.prototype._setReady=function(e){e!==this._isReady&&(e?(this.onReady&&this.onReady(this),this._isReady=!0):this._isReady=!1)},e.prototype.getAnimationByName=function(e){for(var t=0;t<this.animations.length;t++){var i=this.animations[t];if(i.name===e)return i}return null},e.prototype.createAnimationRange=function(e,t,i){if(!this._ranges[e]){this._ranges[e]=new y.AnimationRange(e,t,i);for(var r=0,n=this.animations.length;r<n;r++)this.animations[r]&&this.animations[r].createRange(e,t,i)}},e.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var i=0,r=this.animations.length;i<r;i++)this.animations[i]&&this.animations[i].deleteRange(e,t);this._ranges[e]=null},e.prototype.getAnimationRange=function(e){return this._ranges[e]},e.prototype.beginAnimation=function(e,t,i,r){var n=this.getAnimationRange(e);return n?this._scene.beginAnimation(this,n.from,n.to,t,i,r):null},e.prototype.serializeAnimationRanges=function(){var e=[];for(var t in this._ranges){var i=this._ranges[t];if(i){var r={};r.name=t,r.from=i.from,r.to=i.to,e.push(r)}}return e},e.prototype.computeWorldMatrix=function(e){return this._worldMatrix||(this._worldMatrix=y.Matrix.Identity()),this._worldMatrix},e.prototype.dispose=function(e,t){if(void 0===t&&(t=!1),e)for(var i=0,r=this.getChildTransformNodes(!0);i<r.length;i++){var n=r[i];n.parent=null,n.computeWorldMatrix(!0)}else for(var o=0,s=this.getDescendants(!0);o<s.length;o++){s[o].dispose(e,t)}this.parent?this.parent=null:this.removeFromSceneRootNodes(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear();for(var a=0,l=this._behaviors;a<l.length;a++){l[a].detach()}this._behaviors=[],this._isDisposed=!0},e.ParseAnimationRanges=function(e,t,i){if(t.ranges)for(var r=0;r<t.ranges.length;r++){var n=t.ranges[r];e.createAnimationRange(n.name,n.from,n.to)}},e._NodeConstructors={},b([y.serialize()],e.prototype,"name",void 0),b([y.serialize()],e.prototype,"id",void 0),b([y.serialize()],e.prototype,"uniqueId",void 0),b([y.serialize()],e.prototype,"state",void 0),b([y.serialize()],e.prototype,"metadata",void 0),e})(),y.Node=E,x=$a||($a={}),P=x.Matrix.Identity(),A=(function(){function e(e,t){this.center=x.Vector3.Zero(),this.centerWorld=x.Vector3.Zero(),this.minimum=x.Vector3.Zero(),this.maximum=x.Vector3.Zero(),this.reConstruct(e,t)}return e.prototype.reConstruct=function(e,t){this.minimum.copyFrom(e),this.maximum.copyFrom(t);var i=x.Vector3.Distance(e,t);x.Vector3.LerpToRef(e,t,.5,this.center),this.radius=.5*i,this.centerWorld.set(0,0,0),this._update(P)},e.prototype.scale=function(e){var t=this.radius*e,i=x.Tmp.Vector3[0].set(t,t,t),r=x.Tmp.Vector3[1].copyFrom(this.center).subtractInPlace(i),n=x.Tmp.Vector3[2].copyFrom(this.center).addInPlace(i);return this.reConstruct(r,n),this},e.prototype._update=function(e){x.Vector3.TransformCoordinatesToRef(this.center,e,this.centerWorld);var t=x.Tmp.Vector3[0];x.Vector3.TransformNormalFromFloatsToRef(1,1,1,e,t),this.radiusWorld=Math.max(Math.abs(t.x),Math.abs(t.y),Math.abs(t.z))*this.radius},e.prototype.isInFrustum=function(e){for(var t=0;t<6;t++)if(e[t].dotCoordinate(this.centerWorld)<=-this.radiusWorld)return!1;return!0},e.prototype.intersectsPoint=function(e){var t=this.centerWorld.x-e.x,i=this.centerWorld.y-e.y,r=this.centerWorld.z-e.z,n=Math.sqrt(t*t+i*i+r*r);return!(this.radiusWorld<n)},e.Intersects=function(e,t){var i=e.centerWorld.x-t.centerWorld.x,r=e.centerWorld.y-t.centerWorld.y,n=e.centerWorld.z-t.centerWorld.z,o=Math.sqrt(i*i+r*r+n*n);return!(e.radiusWorld+t.radiusWorld<o)},e})(),x.BoundingSphere=A,S=$a||($a={}),M=(function(){function t(e,t){this.vectors=[S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero()],this.center=S.Vector3.Zero(),this.centerWorld=S.Vector3.Zero(),this.extendSize=S.Vector3.Zero(),this.extendSizeWorld=S.Vector3.Zero(),this.directions=[S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero()],this.vectorsWorld=[S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero(),S.Vector3.Zero()],this.minimumWorld=S.Vector3.Zero(),this.maximumWorld=S.Vector3.Zero(),this.minimum=S.Vector3.Zero(),this.maximum=S.Vector3.Zero(),this.reConstruct(e,t)}return t.prototype.reConstruct=function(e,t){this.minimum.copyFrom(e),this.maximum.copyFrom(t),this.vectors[0].copyFrom(this.minimum),this.vectors[1].copyFrom(this.maximum),this.vectors[2].copyFrom(this.minimum),this.vectors[3].copyFrom(this.minimum),this.vectors[4].copyFrom(this.minimum),this.vectors[5].copyFrom(this.maximum),this.vectors[6].copyFrom(this.maximum),this.vectors[7].copyFrom(this.maximum),this.vectors[2].x=this.maximum.x,this.vectors[3].y=this.maximum.y,this.vectors[4].z=this.maximum.z,this.vectors[5].z=this.minimum.z,this.vectors[6].x=this.minimum.x,this.vectors[7].y=this.minimum.y,this.center.copyFrom(this.maximum).addInPlace(this.minimum).scaleInPlace(.5),this.extendSize.copyFrom(this.maximum).subtractInPlace(this.minimum).scaleInPlace(.5);for(var i=0;i<3;i++)this.directions[i].copyFromFloats(0,0,0);for(i=0;i<8;i++)this.vectorsWorld[i].copyFromFloats(0,0,0);this.minimumWorld.copyFromFloats(0,0,0),this.maximumWorld.copyFromFloats(0,0,0),this.centerWorld.copyFromFloats(0,0,0),this.extendSizeWorld.copyFromFloats(0,0,0),this._update(this._worldMatrix||S.Matrix.Identity())},t.prototype.scale=function(e){var t=S.Tmp.Vector3[0].copyFrom(this.maximum).subtractInPlace(this.minimum),i=t.length()*e;t.normalize();var r=t.scaleInPlace(.5*i),n=S.Tmp.Vector3[1].copyFrom(this.center).subtractInPlace(r),o=S.Tmp.Vector3[2].copyFrom(this.center).addInPlace(r);return this.reConstruct(n,o),this},t.prototype.getWorldMatrix=function(){return this._worldMatrix},t.prototype.setWorldMatrix=function(e){return this._worldMatrix.copyFrom(e),this},t.prototype._update=function(e){S.Vector3.FromFloatsToRef(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,this.minimumWorld),S.Vector3.FromFloatsToRef(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,this.maximumWorld);for(var t=0;t<8;t++){var i=this.vectorsWorld[t];S.Vector3.TransformCoordinatesToRef(this.vectors[t],e,i),this.minimumWorld.minimizeInPlace(i),this.maximumWorld.maximizeInPlace(i)}this.maximumWorld.subtractToRef(this.minimumWorld,this.extendSizeWorld),this.extendSizeWorld.scaleInPlace(.5),this.maximumWorld.addToRef(this.minimumWorld,this.centerWorld),this.centerWorld.scaleInPlace(.5),S.Vector3.FromFloatArrayToRef(e.m,0,this.directions[0]),S.Vector3.FromFloatArrayToRef(e.m,4,this.directions[1]),S.Vector3.FromFloatArrayToRef(e.m,8,this.directions[2]),this._worldMatrix=e},t.prototype.isInFrustum=function(e){return t.IsInFrustum(this.vectorsWorld,e)},t.prototype.isCompletelyInFrustum=function(e){return t.IsCompletelyInFrustum(this.vectorsWorld,e)},t.prototype.intersectsPoint=function(e){var t=-S.Epsilon;return!(this.maximumWorld.x-e.x<t||t>e.x-this.minimumWorld.x)&&(!(this.maximumWorld.y-e.y<t||t>e.y-this.minimumWorld.y)&&!(this.maximumWorld.z-e.z<t||t>e.z-this.minimumWorld.z))},t.prototype.intersectsSphere=function(e){return t.IntersectsSphere(this.minimumWorld,this.maximumWorld,e.centerWorld,e.radiusWorld)},t.prototype.intersectsMinMax=function(e,t){return!(this.maximumWorld.x<e.x||this.minimumWorld.x>t.x)&&(!(this.maximumWorld.y<e.y||this.minimumWorld.y>t.y)&&!(this.maximumWorld.z<e.z||this.minimumWorld.z>t.z))},t.Intersects=function(e,t){return!(e.maximumWorld.x<t.minimumWorld.x||e.minimumWorld.x>t.maximumWorld.x)&&(!(e.maximumWorld.y<t.minimumWorld.y||e.minimumWorld.y>t.maximumWorld.y)&&!(e.maximumWorld.z<t.minimumWorld.z||e.minimumWorld.z>t.maximumWorld.z))},t.IntersectsSphere=function(e,t,i,r){var n=S.Vector3.Clamp(i,e,t);return S.Vector3.DistanceSquared(i,n)<=r*r},t.IsCompletelyInFrustum=function(e,t){for(var i=0;i<6;i++)for(var r=0;r<8;r++)if(t[i].dotCoordinate(e[r])<0)return!1;return!0},t.IsInFrustum=function(e,t){for(var i=0;i<6;i++){for(var r=8,n=0;n<8&&t[i].dotCoordinate(e[n])<0;n++)--r;if(0===r)return!1}return!0},t})(),S.BoundingBox=M,R=$a||($a={}),C=function(e,t){var i=R.Vector3.Dot(t.centerWorld,e),r=Math.abs(R.Vector3.Dot(t.directions[0],e))*t.extendSize.x+Math.abs(R.Vector3.Dot(t.directions[1],e))*t.extendSize.y+Math.abs(R.Vector3.Dot(t.directions[2],e))*t.extendSize.z;return{min:i-r,max:i+r}},O=function(e,t,i){var r,n,o,s=C(e,t),a=C(e,i);return r=s.min,n=s.max,o=a.min,!(a.max<r||n<o)},D=(function(){function e(e,t){this._isLocked=!1,this.boundingBox=new R.BoundingBox(e,t),this.boundingSphere=new R.BoundingSphere(e,t)}return Object.defineProperty(e.prototype,"minimum",{get:function(){return this.boundingBox.minimum},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maximum",{get:function(){return this.boundingBox.maximum},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isLocked",{get:function(){return this._isLocked},set:function(e){this._isLocked=e},enumerable:!0,configurable:!0}),e.prototype.update=function(e){this._isLocked||(this.boundingBox._update(e),this.boundingSphere._update(e))},e.prototype.centerOn=function(e,t){var i=R.Tmp.Vector3[0].copyFrom(e).subtractInPlace(t),r=R.Tmp.Vector3[1].copyFrom(e).addInPlace(t);return this.boundingBox.reConstruct(i,r),this.boundingSphere.reConstruct(i,r),this},e.prototype.scale=function(e){return this.boundingBox.scale(e),this.boundingSphere.scale(e),this},e.prototype.isInFrustum=function(e,t){return void 0===t&&(t=R.AbstractMesh.CULLINGSTRATEGY_STANDARD),!!this.boundingSphere.isInFrustum(e)&&(t===R.AbstractMesh.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY||this.boundingBox.isInFrustum(e))},Object.defineProperty(e.prototype,"diagonalLength",{get:function(){var e=this.boundingBox;return e.maximumWorld.subtract(e.minimumWorld).length()},enumerable:!0,configurable:!0}),e.prototype.isCompletelyInFrustum=function(e){return this.boundingBox.isCompletelyInFrustum(e)},e.prototype._checkCollision=function(e){return e._canDoCollision(this.boundingSphere.centerWorld,this.boundingSphere.radiusWorld,this.boundingBox.minimumWorld,this.boundingBox.maximumWorld)},e.prototype.intersectsPoint=function(e){return!!this.boundingSphere.centerWorld&&(!!this.boundingSphere.intersectsPoint(e)&&!!this.boundingBox.intersectsPoint(e))},e.prototype.intersects=function(e,t){if(!this.boundingSphere.centerWorld||!e.boundingSphere.centerWorld)return!1;if(!R.BoundingSphere.Intersects(this.boundingSphere,e.boundingSphere))return!1;if(!R.BoundingBox.Intersects(this.boundingBox,e.boundingBox))return!1;if(!t)return!0;var i=this.boundingBox,r=e.boundingBox;return!!O(i.directions[0],i,r)&&(!!O(i.directions[1],i,r)&&(!!O(i.directions[2],i,r)&&(!!O(r.directions[0],i,r)&&(!!O(r.directions[1],i,r)&&(!!O(r.directions[2],i,r)&&(!!O(R.Vector3.Cross(i.directions[0],r.directions[0]),i,r)&&(!!O(R.Vector3.Cross(i.directions[0],r.directions[1]),i,r)&&(!!O(R.Vector3.Cross(i.directions[0],r.directions[2]),i,r)&&(!!O(R.Vector3.Cross(i.directions[1],r.directions[0]),i,r)&&(!!O(R.Vector3.Cross(i.directions[1],r.directions[1]),i,r)&&(!!O(R.Vector3.Cross(i.directions[1],r.directions[2]),i,r)&&(!!O(R.Vector3.Cross(i.directions[2],r.directions[0]),i,r)&&(!!O(R.Vector3.Cross(i.directions[2],r.directions[1]),i,r)&&!!O(R.Vector3.Cross(i.directions[2],r.directions[2]),i,r))))))))))))))},e})(),R.BoundingInfo=D,I=$a||($a={}),w=(function(n){function h(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!0);var r=n.call(this,e,t)||this;return r._forward=new I.Vector3(0,0,1),r._forwardInverted=new I.Vector3(0,0,-1),r._up=new I.Vector3(0,1,0),r._right=new I.Vector3(1,0,0),r._rightInverted=new I.Vector3(-1,0,0),r._position=I.Vector3.Zero(),r._rotation=I.Vector3.Zero(),r._scaling=I.Vector3.One(),r._isDirty=!1,r.billboardMode=h.BILLBOARDMODE_NONE,r.scalingDeterminant=1,r.infiniteDistance=!1,r.ignoreNonUniformScaling=!1,r._localWorld=I.Matrix.Zero(),r._absolutePosition=I.Vector3.Zero(),r._pivotMatrix=I.Matrix.Identity(),r._postMultiplyPivotMatrix=!1,r._isWorldMatrixFrozen=!1,r.onAfterWorldMatrixUpdateObservable=new I.Observable,r._nonUniformScaling=!1,i&&r.getScene().addTransformNode(r),r}return T(h,n),h.prototype.getClassName=function(){return"TransformNode"},Object.defineProperty(h.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"rotation",{get:function(){return this._rotation},set:function(e){this._rotation=e,this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this._isDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"rotationQuaternion",{get:function(){return this._rotationQuaternion},set:function(e){(this._rotationQuaternion=e)&&this.rotation.length()&&this.rotation.copyFromFloats(0,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"forward",{get:function(){return I.Vector3.Normalize(I.Vector3.TransformNormal(this.getScene().useRightHandedSystem?this._forwardInverted:this._forward,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"up",{get:function(){return I.Vector3.Normalize(I.Vector3.TransformNormal(this._up,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"right",{get:function(){return I.Vector3.Normalize(I.Vector3.TransformNormal(this.getScene().useRightHandedSystem?this._rightInverted:this._right,this.getWorldMatrix()))},enumerable:!0,configurable:!0}),h.prototype.updatePoseMatrix=function(e){return this._poseMatrix.copyFrom(e),this},h.prototype.getPoseMatrix=function(){return this._poseMatrix},h.prototype._isSynchronized=function(){return!this._isDirty&&(this.billboardMode===this._cache.billboardMode&&this.billboardMode===h.BILLBOARDMODE_NONE&&(!this._cache.pivotMatrixUpdated&&(!this.infiniteDistance&&(!!this._cache.position.equals(this._position)&&(!(this._rotationQuaternion&&!this._cache.rotationQuaternion.equals(this._rotationQuaternion))&&(!!this._cache.rotation.equals(this._rotation)&&!!this._cache.scaling.equals(this._scaling)))))))},h.prototype._initCache=function(){n.prototype._initCache.call(this),this._cache.localMatrixUpdated=!1,this._cache.position=I.Vector3.Zero(),this._cache.scaling=I.Vector3.Zero(),this._cache.rotation=I.Vector3.Zero(),this._cache.rotationQuaternion=new I.Quaternion(0,0,0,0),this._cache.billboardMode=-1},h.prototype.markAsDirty=function(e){return"rotation"===e&&(this.rotationQuaternion=null),this._currentRenderId=Number.MAX_VALUE,this._isDirty=!0,this},Object.defineProperty(h.prototype,"absolutePosition",{get:function(){return this._absolutePosition},enumerable:!0,configurable:!0}),h.prototype.setPreTransformMatrix=function(e){return this.setPivotMatrix(e,!1)},h.prototype.setPivotMatrix=function(e,t){return void 0===t&&(t=!0),this._pivotMatrix=e.clone(),this._cache.pivotMatrixUpdated=!0,this._postMultiplyPivotMatrix=t,this._postMultiplyPivotMatrix&&(this._pivotMatrixInverse?this._pivotMatrix.invertToRef(this._pivotMatrixInverse):this._pivotMatrixInverse=I.Matrix.Invert(this._pivotMatrix)),this},h.prototype.getPivotMatrix=function(){return this._pivotMatrix},h.prototype.freezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this._isWorldMatrixFrozen=!0,this},h.prototype.unfreezeWorldMatrix=function(){return this._isWorldMatrixFrozen=!1,this.computeWorldMatrix(!0),this},Object.defineProperty(h.prototype,"isWorldMatrixFrozen",{get:function(){return this._isWorldMatrixFrozen},enumerable:!0,configurable:!0}),h.prototype.getAbsolutePosition=function(){return this.computeWorldMatrix(),this._absolutePosition},h.prototype.setAbsolutePosition=function(e){if(!e)return this;var t,i,r;if(void 0===e.x){if(arguments.length<3)return this;t=e,i=arguments[1],r=arguments[2]}else t=e.x,i=e.y,r=e.z;if(this.parent){var n=this.parent.getWorldMatrix().clone();n.invert();var o=new I.Vector3(t,i,r);this.position=I.Vector3.TransformCoordinates(o,n)}else this.position.x=t,this.position.y=i,this.position.z=r;return this},h.prototype.setPositionWithLocalVector=function(e){return this.computeWorldMatrix(),this.position=I.Vector3.TransformNormal(e,this._localWorld),this},h.prototype.getPositionExpressedInLocalSpace=function(){this.computeWorldMatrix();var e=this._localWorld.clone();return e.invert(),I.Vector3.TransformNormal(this.position,e)},h.prototype.locallyTranslate=function(e){return this.computeWorldMatrix(!0),this.position=I.Vector3.TransformCoordinates(e,this._localWorld),this},h.prototype.lookAt=function(e,t,i,r,n){void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=0),void 0===n&&(n=I.Space.LOCAL);var o=h._lookAtVectorCache,s=n===I.Space.LOCAL?this.position:this.getAbsolutePosition();e.subtractToRef(s,o);var a=-Math.atan2(o.z,o.x)-Math.PI/2,l=Math.sqrt(o.x*o.x+o.z*o.z),c=Math.atan2(o.y,l);return this.rotationQuaternion?I.Quaternion.RotationYawPitchRollToRef(a+t,c+i,r,this.rotationQuaternion):(this.rotation.x=c+i,this.rotation.y=a+t,this.rotation.z=r),this},h.prototype.getDirection=function(e){var t=I.Vector3.Zero();return this.getDirectionToRef(e,t),t},h.prototype.getDirectionToRef=function(e,t){return I.Vector3.TransformNormalToRef(e,this.getWorldMatrix(),t),this},h.prototype.setPivotPoint=function(e,t){void 0===t&&(t=I.Space.LOCAL),0==this.getScene().getRenderId()&&this.computeWorldMatrix(!0);var i=this.getWorldMatrix();if(t==I.Space.WORLD){var r=I.Tmp.Matrix[0];i.invertToRef(r),e=I.Vector3.TransformCoordinates(e,r)}return this.setPivotMatrix(I.Matrix.Translation(-e.x,-e.y,-e.z),!0)},h.prototype.getPivotPoint=function(){var e=I.Vector3.Zero();return this.getPivotPointToRef(e),e},h.prototype.getPivotPointToRef=function(e){return e.x=-this._pivotMatrix.m[12],e.y=-this._pivotMatrix.m[13],e.z=-this._pivotMatrix.m[14],this},h.prototype.getAbsolutePivotPoint=function(){var e=I.Vector3.Zero();return this.getAbsolutePivotPointToRef(e),e},h.prototype.getAbsolutePivotPointToRef=function(e){return e.x=this._pivotMatrix.m[12],e.y=this._pivotMatrix.m[13],e.z=this._pivotMatrix.m[14],this.getPivotPointToRef(e),I.Vector3.TransformCoordinatesToRef(e,this.getWorldMatrix(),e),this},h.prototype.setParent=function(e){if(!e&&!this.parent)return this;if(e){r=I.Tmp.Quaternion[0],n=I.Tmp.Vector3[0],o=I.Tmp.Vector3[1];var t=I.Tmp.Matrix[0],i=I.Tmp.Matrix[1];this.computeWorldMatrix(!0),e.computeWorldMatrix(!0),e.getWorldMatrix().invertToRef(i),this.getWorldMatrix().multiplyToRef(i,t),t.decompose(o,r,n),this.rotationQuaternion?this.rotationQuaternion.copyFrom(r):r.toEulerAnglesToRef(this.rotation),this.position.x=n.x,this.position.y=n.y,this.position.z=n.z,this.scaling.x=o.x,this.scaling.y=o.y,this.scaling.z=o.z}else{var r=I.Tmp.Quaternion[0],n=I.Tmp.Vector3[0],o=I.Tmp.Vector3[1];this.parent&&this.parent.computeWorldMatrix&&this.parent.computeWorldMatrix(!0),this.computeWorldMatrix(!0),this.getWorldMatrix().decompose(o,r,n),this.rotationQuaternion?this.rotationQuaternion.copyFrom(r):r.toEulerAnglesToRef(this.rotation),this.scaling.x=o.x,this.scaling.y=o.y,this.scaling.z=o.z,this.position.x=n.x,this.position.y=n.y,this.position.z=n.z}return this.parent=e,this},Object.defineProperty(h.prototype,"nonUniformScaling",{get:function(){return this._nonUniformScaling},enumerable:!0,configurable:!0}),h.prototype._updateNonUniformScalingState=function(e){return this._nonUniformScaling!==e&&(this._nonUniformScaling=e,!0)},h.prototype.attachToBone=function(e,t){return this._transformToBoneReferal=t,(this.parent=e).getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this},h.prototype.detachFromBone=function(){return this.parent&&(this.parent.getWorldMatrix().determinant()<0&&(this.scalingDeterminant*=-1),this._transformToBoneReferal=null,this.parent=null),this},h.prototype.rotate=function(e,t,i){var r;if(e.normalize(),this.rotationQuaternion||(this.rotationQuaternion=I.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation=I.Vector3.Zero()),i&&i!==I.Space.LOCAL){if(this.parent){var n=this.parent.getWorldMatrix().clone();n.invert(),e=I.Vector3.TransformNormal(e,n)}(r=I.Quaternion.RotationAxisToRef(e,t,h._rotationAxisCache)).multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)}else r=I.Quaternion.RotationAxisToRef(e,t,h._rotationAxisCache),this.rotationQuaternion.multiplyToRef(r,this.rotationQuaternion);return this},h.prototype.rotateAround=function(e,t,i){return t.normalize(),this.rotationQuaternion||(this.rotationQuaternion=I.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z),this.rotation.copyFromFloats(0,0,0)),e.subtractToRef(this.position,I.Tmp.Vector3[0]),I.Matrix.TranslationToRef(I.Tmp.Vector3[0].x,I.Tmp.Vector3[0].y,I.Tmp.Vector3[0].z,I.Tmp.Matrix[0]),I.Tmp.Matrix[0].invertToRef(I.Tmp.Matrix[2]),I.Matrix.RotationAxisToRef(t,i,I.Tmp.Matrix[1]),I.Tmp.Matrix[2].multiplyToRef(I.Tmp.Matrix[1],I.Tmp.Matrix[2]),I.Tmp.Matrix[2].multiplyToRef(I.Tmp.Matrix[0],I.Tmp.Matrix[2]),I.Tmp.Matrix[2].decompose(I.Tmp.Vector3[0],I.Tmp.Quaternion[0],I.Tmp.Vector3[1]),this.position.addInPlace(I.Tmp.Vector3[1]),I.Tmp.Quaternion[0].multiplyToRef(this.rotationQuaternion,this.rotationQuaternion),this},h.prototype.translate=function(e,t,i){var r=e.scale(t);if(i&&i!==I.Space.LOCAL)this.setAbsolutePosition(this.getAbsolutePosition().add(r));else{var n=this.getPositionExpressedInLocalSpace().add(r);this.setPositionWithLocalVector(n)}return this},h.prototype.addRotation=function(e,t,i){var r;this.rotationQuaternion?r=this.rotationQuaternion:(r=I.Tmp.Quaternion[1],I.Quaternion.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,r));var n=I.Tmp.Quaternion[0];return I.Quaternion.RotationYawPitchRollToRef(t,e,i,n),r.multiplyInPlace(n),this.rotationQuaternion||r.toEulerAnglesToRef(this.rotation),this},h.prototype.computeWorldMatrix=function(e){if(this._isWorldMatrixFrozen)return this._worldMatrix;if(!e&&this.isSynchronized())return this._currentRenderId=this.getScene().getRenderId(),this._worldMatrix;(this._updateCache(),this._cache.position.copyFrom(this.position),this._cache.scaling.copyFrom(this.scaling),this._cache.pivotMatrixUpdated=!1,this._cache.billboardMode=this.billboardMode,this._currentRenderId=this.getScene().getRenderId(),this._childRenderId=this.getScene().getRenderId(),this._isDirty=!1,I.Matrix.ScalingToRef(this.scaling.x*this.scalingDeterminant,this.scaling.y*this.scalingDeterminant,this.scaling.z*this.scalingDeterminant,I.Tmp.Matrix[1]),this.rotationQuaternion)&&(this.rotation.length()&&(this.rotationQuaternion.multiplyInPlace(I.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)),this.rotation.copyFromFloats(0,0,0)));this.rotationQuaternion?(this.rotationQuaternion.toRotationMatrix(I.Tmp.Matrix[0]),this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)):(I.Matrix.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,I.Tmp.Matrix[0]),this._cache.rotation.copyFrom(this.rotation));var t=this.getScene().activeCamera;if(this.infiniteDistance&&!this.parent&&t){var i=t.getWorldMatrix(),r=new I.Vector3(i.m[12],i.m[13],i.m[14]);I.Matrix.TranslationToRef(this.position.x+r.x,this.position.y+r.y,this.position.z+r.z,I.Tmp.Matrix[2])}else I.Matrix.TranslationToRef(this.position.x,this.position.y,this.position.z,I.Tmp.Matrix[2]);if(this._pivotMatrix.multiplyToRef(I.Tmp.Matrix[1],I.Tmp.Matrix[4]),I.Tmp.Matrix[4].multiplyToRef(I.Tmp.Matrix[0],I.Tmp.Matrix[5]),this.billboardMode!==h.BILLBOARDMODE_NONE&&t){if((this.billboardMode&h.BILLBOARDMODE_ALL)!==h.BILLBOARDMODE_ALL){var n=I.Tmp.Vector3[3];this.parent&&this.parent.getWorldMatrix?this._transformToBoneReferal?(this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),I.Tmp.Matrix[6]),I.Vector3.TransformCoordinatesToRef(this.position,I.Tmp.Matrix[6],n)):I.Vector3.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),n):n.copyFrom(this.position),n.subtractInPlace(t.globalPosition);var o=I.Tmp.Vector3[4].copyFromFloats(0,0,0);(this.billboardMode&h.BILLBOARDMODE_X)===h.BILLBOARDMODE_X&&(o.x=Math.atan2(-n.y,n.z)),(this.billboardMode&h.BILLBOARDMODE_Y)===h.BILLBOARDMODE_Y&&(o.y=Math.atan2(n.x,n.z)),(this.billboardMode&h.BILLBOARDMODE_Z)===h.BILLBOARDMODE_Z&&(o.z=Math.atan2(n.y,n.x)),I.Matrix.RotationYawPitchRollToRef(o.y,o.x,o.z,I.Tmp.Matrix[0])}else I.Tmp.Matrix[1].copyFrom(t.getViewMatrix()),I.Tmp.Matrix[1].setTranslationFromFloats(0,0,0),I.Tmp.Matrix[1].invertToRef(I.Tmp.Matrix[0]);I.Tmp.Matrix[1].copyFrom(I.Tmp.Matrix[5]),I.Tmp.Matrix[1].multiplyToRef(I.Tmp.Matrix[0],I.Tmp.Matrix[5])}return this._postMultiplyPivotMatrix&&I.Tmp.Matrix[5].multiplyToRef(this._pivotMatrixInverse,I.Tmp.Matrix[5]),I.Tmp.Matrix[5].multiplyToRef(I.Tmp.Matrix[2],this._localWorld),this.parent&&this.parent.getWorldMatrix?(this.billboardMode!==h.BILLBOARDMODE_NONE?(this._transformToBoneReferal?(this.parent.getWorldMatrix().multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),I.Tmp.Matrix[6]),I.Tmp.Matrix[5].copyFrom(I.Tmp.Matrix[6])):I.Tmp.Matrix[5].copyFrom(this.parent.getWorldMatrix()),this._localWorld.getTranslationToRef(I.Tmp.Vector3[5]),I.Vector3.TransformCoordinatesToRef(I.Tmp.Vector3[5],I.Tmp.Matrix[5],I.Tmp.Vector3[5]),this._worldMatrix.copyFrom(this._localWorld),this._worldMatrix.setTranslation(I.Tmp.Vector3[5])):this._transformToBoneReferal?(this._localWorld.multiplyToRef(this.parent.getWorldMatrix(),I.Tmp.Matrix[6]),I.Tmp.Matrix[6].multiplyToRef(this._transformToBoneReferal.getWorldMatrix(),this._worldMatrix)):this._localWorld.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()):this._worldMatrix.copyFrom(this._localWorld),this.ignoreNonUniformScaling?this._updateNonUniformScalingState(!1):this.scaling.isNonUniform?this._updateNonUniformScalingState(!0):this.parent&&this.parent._nonUniformScaling?this._updateNonUniformScalingState(this.parent._nonUniformScaling):this._updateNonUniformScalingState(!1),this._afterComputeWorldMatrix(),this._absolutePosition.copyFromFloats(this._worldMatrix.m[12],this._worldMatrix.m[13],this._worldMatrix.m[14]),this.onAfterWorldMatrixUpdateObservable.notifyObservers(this),this._poseMatrix||(this._poseMatrix=I.Matrix.Invert(this._worldMatrix)),this._worldMatrixDeterminant=this._worldMatrix.determinant(),this._worldMatrix},h.prototype._afterComputeWorldMatrix=function(){},h.prototype.registerAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.add(e),this},h.prototype.unregisterAfterWorldMatrixUpdate=function(e){return this.onAfterWorldMatrixUpdateObservable.removeCallback(e),this},h.prototype.clone=function(e,t,i){var r=this,n=I.SerializationHelper.Clone((function(){return new h(e,r.getScene())}),this);if(n.name=e,n.id=e,t&&(n.parent=t),!i)for(var o=this.getDescendants(!0),s=0;s<o.length;s++){var a=o[s];a.clone&&a.clone(e+"."+a.name,n)}return n},h.prototype.serialize=function(e){var t=I.SerializationHelper.Serialize(this,e);return t.type=this.getClassName(),this.parent&&(t.parentId=this.parent.id),I.Tags&&I.Tags.HasTags(this)&&(t.tags=I.Tags.GetTags(this)),t.localMatrix=this.getPivotMatrix().asArray(),t.isEnabled=this.isEnabled(),this.parent&&(t.parentId=this.parent.id),t},h.Parse=function(e,t,i){var r=I.SerializationHelper.Parse((function(){return new h(e.name,t)}),e,t,i);return I.Tags&&I.Tags.AddTagsTo(r,e.tags),e.localMatrix?r.setPreTransformMatrix(I.Matrix.FromArray(e.localMatrix)):e.pivotMatrix&&r.setPivotMatrix(I.Matrix.FromArray(e.pivotMatrix)),r.setEnabled(e.isEnabled),e.parentId&&(r._waitingParentId=e.parentId),r},h.prototype.dispose=function(e,t){void 0===t&&(t=!1),this.getScene().stopAnimation(this),this.getScene().removeTransformNode(this),this.onAfterWorldMatrixUpdateObservable.clear(),n.prototype.dispose.call(this,e,t)},h.BILLBOARDMODE_NONE=0,h.BILLBOARDMODE_X=1,h.BILLBOARDMODE_Y=2,h.BILLBOARDMODE_Z=4,h.BILLBOARDMODE_ALL=7,h._lookAtVectorCache=new I.Vector3(0,0,0),h._rotationAxisCache=new I.Quaternion,b([I.serializeAsVector3("position")],h.prototype,"_position",void 0),b([I.serializeAsVector3("rotation")],h.prototype,"_rotation",void 0),b([I.serializeAsQuaternion("rotationQuaternion")],h.prototype,"_rotationQuaternion",void 0),b([I.serializeAsVector3("scaling")],h.prototype,"_scaling",void 0),b([I.serialize()],h.prototype,"billboardMode",void 0),b([I.serialize()],h.prototype,"scalingDeterminant",void 0),b([I.serialize()],h.prototype,"infiniteDistance",void 0),b([I.serialize()],h.prototype,"ignoreNonUniformScaling",void 0),h})(I.Node),I.TransformNode=w,L=$a||($a={}),F=function(){this.facetNb=0,this.partitioningSubdivisions=10,this.partitioningBBoxRatio=1.01,this.facetDataEnabled=!1,this.facetParameters={},this.bbSize=L.Vector3.Zero(),this.subDiv={max:1,X:1,Y:1,Z:1},this.facetDepthSort=!1,this.facetDepthSortEnabled=!1},B=(function(a){function i(e,t){void 0===t&&(t=null);var r=a.call(this,e,t,!1)||this;return r._facetData=new F,r.cullingStrategy=i.CULLINGSTRATEGY_STANDARD,r.onCollideObservable=new L.Observable,r.onCollisionPositionChangeObservable=new L.Observable,r.onMaterialChangedObservable=new L.Observable,r.definedFacingForward=!0,r._visibility=1,r.alphaIndex=Number.MAX_VALUE,r.isVisible=!0,r.isPickable=!0,r.showSubMeshesBoundingBox=!1,r.isBlocker=!1,r.enablePointerMoveEvents=!1,r.renderingGroupId=0,r._receiveShadows=!1,r.outlineColor=L.Color3.Red(),r.outlineWidth=.02,r.overlayColor=L.Color3.Red(),r.overlayAlpha=.5,r._hasVertexAlpha=!1,r._useVertexColors=!0,r._computeBonesUsingShaders=!0,r._numBoneInfluencers=4,r._applyFog=!0,r.useOctreeForRenderingSelection=!0,r.useOctreeForPicking=!0,r.useOctreeForCollisions=!0,r._layerMask=268435455,r.alwaysSelectAsActiveMesh=!1,r.actionManager=null,r._checkCollisions=!1,r._collisionMask=-1,r._collisionGroup=-1,r.ellipsoid=new L.Vector3(.5,1,.5),r.ellipsoidOffset=new L.Vector3(0,0,0),r._oldPositionForCollisions=new L.Vector3(0,0,0),r._diffPositionForCollisions=new L.Vector3(0,0,0),r.edgesWidth=1,r.edgesColor=new L.Color4(1,0,0,1),r._renderId=0,r._intersectionsInProgress=new Array,r._unIndexed=!1,r._lightSources=new Array,r.onRebuildObservable=new L.Observable,r._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),r.getScene().workerCollisions&&t.multiplyInPlace(r._collider._radius),t.subtractToRef(r._oldPositionForCollisions,r._diffPositionForCollisions),r._diffPositionForCollisions.length()>L.Engine.CollisionsEpsilon&&r.position.addInPlace(r._diffPositionForCollisions),i&&r.onCollideObservable.notifyObservers(i),r.onCollisionPositionChangeObservable.notifyObservers(r.position)},r.getScene().addMesh(r),r._resyncLightSources(),r}return T(i,a),Object.defineProperty(i,"BILLBOARDMODE_NONE",{get:function(){return L.TransformNode.BILLBOARDMODE_NONE},enumerable:!0,configurable:!0}),Object.defineProperty(i,"BILLBOARDMODE_X",{get:function(){return L.TransformNode.BILLBOARDMODE_X},enumerable:!0,configurable:!0}),Object.defineProperty(i,"BILLBOARDMODE_Y",{get:function(){return L.TransformNode.BILLBOARDMODE_Y},enumerable:!0,configurable:!0}),Object.defineProperty(i,"BILLBOARDMODE_Z",{get:function(){return L.TransformNode.BILLBOARDMODE_Z},enumerable:!0,configurable:!0}),Object.defineProperty(i,"BILLBOARDMODE_ALL",{get:function(){return L.TransformNode.BILLBOARDMODE_ALL},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"facetNb",{get:function(){return this._facetData.facetNb},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"partitioningSubdivisions",{get:function(){return this._facetData.partitioningSubdivisions},set:function(e){this._facetData.partitioningSubdivisions=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"partitioningBBoxRatio",{get:function(){return this._facetData.partitioningBBoxRatio},set:function(e){this._facetData.partitioningBBoxRatio=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"mustDepthSortFacets",{get:function(){return this._facetData.facetDepthSort},set:function(e){this._facetData.facetDepthSort=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"facetDepthSortFrom",{get:function(){return this._facetData.facetDepthSortFrom},set:function(e){this._facetData.facetDepthSortFrom=e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isFacetDataEnabled",{get:function(){return this._facetData.facetDataEnabled},enumerable:!0,configurable:!0}),i.prototype._updateNonUniformScalingState=function(e){return!!a.prototype._updateNonUniformScalingState.call(this,e)&&(this._markSubMeshesAsMiscDirty(),!0)},Object.defineProperty(i.prototype,"onCollide",{set:function(e){this._onCollideObserver&&this.onCollideObservable.remove(this._onCollideObserver),this._onCollideObserver=this.onCollideObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onCollisionPositionChange",{set:function(e){this._onCollisionPositionChangeObserver&&this.onCollisionPositionChangeObservable.remove(this._onCollisionPositionChangeObserver),this._onCollisionPositionChangeObserver=this.onCollisionPositionChangeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"visibility",{get:function(){return this._visibility},set:function(e){this._visibility!==e&&(this._visibility=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"material",{get:function(){return this._material},set:function(e){this._material!==e&&(this._material=e,this.onMaterialChangedObservable.hasObservers&&this.onMaterialChangedObservable.notifyObservers(this),this.subMeshes&&this._unBindEffect())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"receiveShadows",{get:function(){return this._receiveShadows},set:function(e){this._receiveShadows!==e&&(this._receiveShadows=e,this._markSubMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"hasVertexAlpha",{get:function(){return this._hasVertexAlpha},set:function(e){this._hasVertexAlpha!==e&&(this._hasVertexAlpha=e,this._markSubMeshesAsAttributesDirty(),this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"useVertexColors",{get:function(){return this._useVertexColors},set:function(e){this._useVertexColors!==e&&(this._useVertexColors=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"computeBonesUsingShaders",{get:function(){return this._computeBonesUsingShaders},set:function(e){this._computeBonesUsingShaders!==e&&(this._computeBonesUsingShaders=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"numBoneInfluencers",{get:function(){return this._numBoneInfluencers},set:function(e){this._numBoneInfluencers!==e&&(this._numBoneInfluencers=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"applyFog",{get:function(){return this._applyFog},set:function(e){this._applyFog!==e&&(this._applyFog=e,this._markSubMeshesAsMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"layerMask",{get:function(){return this._layerMask},set:function(e){e!==this._layerMask&&(this._layerMask=e,this._resyncLightSources())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"collisionGroup",{get:function(){return this._collisionGroup},set:function(e){this._collisionGroup=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"_positions",{get:function(){return null},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"skeleton",{get:function(){return this._skeleton},set:function(e){this._skeleton&&this._skeleton.needInitialSkinMatrix&&this._skeleton._unregisterMeshWithPoseMatrix(this),e&&e.needInitialSkinMatrix&&e._registerMeshWithPoseMatrix(this),this._skeleton=e,this._skeleton||(this._bonesTransformMatrices=null),this._markSubMeshesAsAttributesDirty()},enumerable:!0,configurable:!0}),i.prototype.getClassName=function(){return"AbstractMesh"},i.prototype.toString=function(e){var t="Name: "+this.name+", isInstance: "+(this instanceof L.InstancedMesh?"YES":"NO");return t+=", # of submeshes: "+(this.subMeshes?this.subMeshes.length:0),this._skeleton&&(t+=", skeleton: "+this._skeleton.name),e&&(t+=", billboard mode: "+["NONE","X","Y",null,"Z",null,null,"ALL"][this.billboardMode],t+=", freeze wrld mat: "+(this._isWorldMatrixFrozen||this._waitingFreezeWorldMatrix?"YES":"NO")),t},i.prototype._rebuild=function(){if(this.onRebuildObservable.notifyObservers(this),this._occlusionQuery&&(this._occlusionQuery=null),this.subMeshes)for(var e=0,t=this.subMeshes;e<t.length;e++){t[e]._rebuild()}},i.prototype._resyncLightSources=function(){for(var e=this._lightSources.length=0,t=this.getScene().lights;e<t.length;e++){var i=t[e];i.isEnabled()&&(i.canAffectMesh(this)&&this._lightSources.push(i))}this._markSubMeshesAsLightDirty()},i.prototype._resyncLighSource=function(e){var t=e.isEnabled()&&e.canAffectMesh(this),i=this._lightSources.indexOf(e);if(-1===i){if(!t)return;this._lightSources.push(e)}else{if(t)return;this._lightSources.splice(i,1)}this._markSubMeshesAsLightDirty()},i.prototype._unBindEffect=function(){for(var e=0,t=this.subMeshes;e<t.length;e++){t[e].setEffect(null)}},i.prototype._removeLightSource=function(e){var t=this._lightSources.indexOf(e);-1!==t&&(this._lightSources.splice(t,1),this._markSubMeshesAsLightDirty())},i.prototype._markSubMeshesAsDirty=function(e){if(this.subMeshes)for(var t=0,i=this.subMeshes;t<i.length;t++){var r=i[t];r._materialDefines&&e(r._materialDefines)}},i.prototype._markSubMeshesAsLightDirty=function(){this._markSubMeshesAsDirty((function(e){return e.markAsLightDirty()}))},i.prototype._markSubMeshesAsAttributesDirty=function(){this._markSubMeshesAsDirty((function(e){return e.markAsAttributesDirty()}))},i.prototype._markSubMeshesAsMiscDirty=function(){if(this.subMeshes)for(var e=0,t=this.subMeshes;e<t.length;e++){var i=t[e].getMaterial();i&&i.markAsDirty(L.Material.MiscDirtyFlag)}},Object.defineProperty(i.prototype,"scaling",{get:function(){return this._scaling},set:function(e){this._scaling=e,this.physicsImpostor&&this.physicsImpostor.forceUpdate()},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isBlocked",{get:function(){return!1},enumerable:!0,configurable:!0}),i.prototype.getLOD=function(e){return this},i.prototype.getTotalVertices=function(){return 0},i.prototype.getIndices=function(){return null},i.prototype.getVerticesData=function(e){return null},i.prototype.setVerticesData=function(e,t,i,r){return this},i.prototype.updateVerticesData=function(e,t,i,r){return this},i.prototype.setIndices=function(e,t){return this},i.prototype.isVerticesDataPresent=function(e){return!1},i.prototype.getBoundingInfo=function(){return this._masterMesh?this._masterMesh.getBoundingInfo():(this._boundingInfo||this._updateBoundingInfo(),this._boundingInfo)},i.prototype.normalizeToUnitCube=function(e){void 0===e&&(e=!0);var t=this.getHierarchyBoundingVectors(e),i=t.max.subtract(t.min),r=Math.max(i.x,i.y,i.z);if(0===r)return this;var n=1/r;return this.scaling.scaleInPlace(n),this},i.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},Object.defineProperty(i.prototype,"useBones",{get:function(){return this.skeleton&&this.getScene().skeletonsEnabled&&this.isVerticesDataPresent(L.VertexBuffer.MatricesIndicesKind)&&this.isVerticesDataPresent(L.VertexBuffer.MatricesWeightsKind)},enumerable:!0,configurable:!0}),i.prototype._preActivate=function(){},i.prototype._preActivateForIntermediateRendering=function(e){},i.prototype._activate=function(e){this._renderId=e},i.prototype.getWorldMatrix=function(){return this._masterMesh?this._masterMesh.getWorldMatrix():a.prototype.getWorldMatrix.call(this)},i.prototype._getWorldMatrixDeterminant=function(){return this._masterMesh?this._masterMesh._getWorldMatrixDeterminant():a.prototype._getWorldMatrixDeterminant.call(this)},i.prototype.movePOV=function(e,t,i){return this.position.addInPlace(this.calcMovePOV(e,t,i)),this},i.prototype.calcMovePOV=function(e,t,i){var r=new L.Matrix;(this.rotationQuaternion?this.rotationQuaternion:L.Quaternion.RotationYawPitchRoll(this.rotation.y,this.rotation.x,this.rotation.z)).toRotationMatrix(r);var n=L.Vector3.Zero(),o=this.definedFacingForward?-1:1;return L.Vector3.TransformCoordinatesFromFloatsToRef(e*o,t,i*o,r,n),n},i.prototype.rotatePOV=function(e,t,i){return this.rotation.addInPlace(this.calcRotatePOV(e,t,i)),this},i.prototype.calcRotatePOV=function(e,t,i){var r=this.definedFacingForward?1:-1;return new L.Vector3(e*r,t,i*r)},i.prototype.getHierarchyBoundingVectors=function(e,t){var i,r;void 0===e&&(e=!0),void 0===t&&(t=null),this.getScene().incrementRenderId(),this.computeWorldMatrix(!0);var n=this.getBoundingInfo();if(this.subMeshes?(i=n.boundingBox.minimumWorld,r=n.boundingBox.maximumWorld):(i=new L.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),r=new L.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE)),e)for(var o=0,s=this.getDescendants(!1);o<s.length;o++){var a=s[o];if(a.computeWorldMatrix(!0),(!t||t(a))&&a.getBoundingInfo&&0!==a.getTotalVertices()){var l=a.getBoundingInfo().boundingBox,c=l.minimumWorld,h=l.maximumWorld;L.Tools.CheckExtends(c,i,r),L.Tools.CheckExtends(h,i,r)}}return{min:i,max:r}},i.prototype._updateBoundingInfo=function(){return this._boundingInfo=this._boundingInfo||new L.BoundingInfo(this.absolutePosition,this.absolutePosition),this._boundingInfo.update(this.worldMatrixFromCache),this._updateSubMeshesBoundingInfo(this.worldMatrixFromCache),this},i.prototype._updateSubMeshesBoundingInfo=function(e){if(!this.subMeshes)return this;for(var t=this.subMeshes.length,i=0;i<t;i++){var r=this.subMeshes[i];(1<t||!r.IsGlobal)&&r.updateBoundingInfo(e)}return this},i.prototype._afterComputeWorldMatrix=function(){this._updateBoundingInfo()},i.prototype.isInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isInFrustum(e,this.cullingStrategy)},i.prototype.isCompletelyInFrustum=function(e){return null!==this._boundingInfo&&this._boundingInfo.isCompletelyInFrustum(e)},i.prototype.intersectsMesh=function(e,t,i){if(void 0===t&&(t=!1),!this._boundingInfo||!e._boundingInfo)return!1;if(this._boundingInfo.intersects(e._boundingInfo,t))return!0;if(i)for(var r=0,n=this.getChildMeshes();r<n.length;r++){if(n[r].intersectsMesh(e,t,!0))return!0}return!1},i.prototype.intersectsPoint=function(e){return!!this._boundingInfo&&this._boundingInfo.intersectsPoint(e)},i.prototype.getPositionInCameraSpace=function(e){return void 0===e&&(e=null),e||(e=this.getScene().activeCamera),L.Vector3.TransformCoordinates(this.absolutePosition,e.getViewMatrix())},i.prototype.getDistanceToCamera=function(e){return void 0===e&&(e=null),e||(e=this.getScene().activeCamera),this.absolutePosition.subtract(e.position).length()},Object.defineProperty(i.prototype,"checkCollisions",{get:function(){return this._checkCollisions},set:function(e){this._checkCollisions=e,this.getScene().workerCollisions&&this.getScene().collisionCoordinator.onMeshUpdated(this)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"collider",{get:function(){return this._collider},enumerable:!0,configurable:!0}),i.prototype.moveWithCollisions=function(e){return this.getAbsolutePosition().addToRef(this.ellipsoidOffset,this._oldPositionForCollisions),this._collider||(this._collider=new L.Collider),this._collider._radius=this.ellipsoid,this.getScene().collisionCoordinator.getNewPosition(this._oldPositionForCollisions,e,this._collider,3,this,this._onCollisionPositionChange,this.uniqueId),this},i.prototype._collideForSubMesh=function(e,t,i){if(this._generatePointsArray(),!this._positions)return this;if(!e._lastColliderWorldVertices||!e._lastColliderTransformMatrix.equals(t)){e._lastColliderTransformMatrix=t.clone(),e._lastColliderWorldVertices=[],e._trianglePlanes=[];for(var r=e.verticesStart,n=e.verticesStart+e.verticesCount,o=r;o<n;o++)e._lastColliderWorldVertices.push(L.Vector3.TransformCoordinates(this._positions[o],t))}return i._collide(e._trianglePlanes,e._lastColliderWorldVertices,this.getIndices(),e.indexStart,e.indexStart+e.indexCount,e.verticesStart,!!e.getMaterial()),i.collisionFound&&(i.collidedMesh=this),this},i.prototype._processCollisionsForSubMeshes=function(e,t){for(var i=this._scene.getCollidingSubMeshCandidates(this,e),r=i.length,n=0;n<r;n++){var o=i.data[n];1<r&&!o._checkCollision(e)||this._collideForSubMesh(o,t,e)}return this},i.prototype._checkCollision=function(e){if(!this._boundingInfo||!this._boundingInfo._checkCollision(e))return this;var t=L.Tmp.Matrix[0],i=L.Tmp.Matrix[1];return L.Matrix.ScalingToRef(1/e._radius.x,1/e._radius.y,1/e._radius.z,t),this.worldMatrixFromCache.multiplyToRef(t,i),this._processCollisionsForSubMeshes(e,i),this},i.prototype._generatePointsArray=function(){return!1},i.prototype.intersects=function(e,t){var i=new L.PickingInfo;if(!(this.subMeshes&&this._boundingInfo&&e.intersectsSphere(this._boundingInfo.boundingSphere)&&e.intersectsBox(this._boundingInfo.boundingBox)))return i;if(!this._generatePointsArray())return i;for(var r=null,n=this._scene.getIntersectingSubMeshCandidates(this,e),o=n.length,s=0;s<o;s++){var a=n.data[s];if(!(1<o)||a.canIntersects(e)){var l=a.intersects(e,this._positions,this.getIndices(),t);if(l&&(t||!r||l.distance<r.distance)&&((r=l).subMeshId=s,t))break}}if(r){var c=this.getWorldMatrix(),h=L.Vector3.TransformCoordinates(e.origin,c),u=e.direction.clone();u=u.scale(r.distance);var d=L.Vector3.TransformNormal(u,c),f=h.add(d);return i.hit=!0,i.distance=L.Vector3.Distance(h,f),i.pickedPoint=f,i.pickedMesh=this,i.bu=r.bu||0,i.bv=r.bv||0,i.faceId=r.faceId,i.subMeshId=r.subMeshId,i}return i},i.prototype.clone=function(e,t,i){return null},i.prototype.releaseSubMeshes=function(){if(this.subMeshes)for(;this.subMeshes.length;)this.subMeshes[0].dispose();else this.subMeshes=new Array;return this},i.prototype.dispose=function(e,t){var i,n=this;for(void 0===t&&(t=!1),this.getScene().freeActiveMeshes(),this.getScene().freeRenderingGroups(),void 0!==this.actionManager&&null!==this.actionManager&&(this.actionManager.dispose(),this.actionManager=null),this._skeleton=null,i=0;i<this._intersectionsInProgress.length;i++){var r=this._intersectionsInProgress[i],o=r._intersectionsInProgress.indexOf(this);r._intersectionsInProgress.splice(o,1)}this._intersectionsInProgress=[],this.getScene().lights.forEach((function(e){var t=e.includedOnlyMeshes.indexOf(n);-1!==t&&e.includedOnlyMeshes.splice(t,1),-1!==(t=e.excludedMeshes.indexOf(n))&&e.excludedMeshes.splice(t,1);var i=e.getShadowGenerator();if(i){var r=i.getShadowMap();r&&r.renderList&&-1!==(t=r.renderList.indexOf(n))&&r.renderList.splice(t,1)}})),"InstancedMesh"!==this.getClassName()&&this.releaseSubMeshes();var s=this.getScene().getEngine();if(this._occlusionQuery&&(this.isOcclusionQueryInProgress=!1,s.deleteQuery(this._occlusionQuery),this._occlusionQuery=null),s.wipeCaches(),this.getScene().removeMesh(this),t&&this.material&&this.material.dispose(!1,!0),!e)for(i=0;i<this.getScene().particleSystems.length;i++)this.getScene().particleSystems[i].emitter===this&&(this.getScene().particleSystems[i].dispose(),i--);this._facetData.facetDataEnabled&&this.disableFacetData(),this.onAfterWorldMatrixUpdateObservable.clear(),this.onCollideObservable.clear(),this.onCollisionPositionChangeObservable.clear(),this.onRebuildObservable.clear(),a.prototype.dispose.call(this,e,t)},i.prototype.addChild=function(e){return e.setParent(this),this},i.prototype.removeChild=function(e){return e.setParent(null),this},i.prototype._initFacetData=function(){var e=this._facetData;e.facetNormals||(e.facetNormals=new Array),e.facetPositions||(e.facetPositions=new Array),e.facetPartitioning||(e.facetPartitioning=new Array),e.facetNb=this.getIndices().length/3|0,e.partitioningSubdivisions=e.partitioningSubdivisions?e.partitioningSubdivisions:10,e.partitioningBBoxRatio=e.partitioningBBoxRatio?e.partitioningBBoxRatio:1.01;for(var t=0;t<e.facetNb;t++)e.facetNormals[t]=L.Vector3.Zero(),e.facetPositions[t]=L.Vector3.Zero();return e.facetDataEnabled=!0,this},i.prototype.updateFacetData=function(){var e=this._facetData;e.facetDataEnabled||this._initFacetData();var t=this.getVerticesData(L.VertexBuffer.PositionKind),i=this.getIndices(),r=this.getVerticesData(L.VertexBuffer.NormalKind),n=this.getBoundingInfo();if(e.facetDepthSort&&!e.facetDepthSortEnabled){if(e.facetDepthSortEnabled=!0,i instanceof Uint16Array)e.depthSortedIndices=new Uint16Array(i);else if(i instanceof Uint32Array)e.depthSortedIndices=new Uint32Array(i);else{for(var o=!1,s=0;s<i.length;s++)if(65535<i[s]){o=!0;break}e.depthSortedIndices=o?new Uint32Array(i):new Uint16Array(i)}if(e.facetDepthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},!e.facetDepthSortFrom){var a=this.getScene().activeCamera;e.facetDepthSortFrom=a?a.position:L.Vector3.Zero()}e.depthSortedFacets=[];for(var l=0;l<e.facetNb;l++){var c={ind:3*l,sqDistance:0};e.depthSortedFacets.push(c)}e.invertedMatrix=L.Matrix.Identity(),e.facetDepthSortOrigin=L.Vector3.Zero()}e.bbSize.x=n.maximum.x-n.minimum.x>L.Epsilon?n.maximum.x-n.minimum.x:L.Epsilon,e.bbSize.y=n.maximum.y-n.minimum.y>L.Epsilon?n.maximum.y-n.minimum.y:L.Epsilon,e.bbSize.z=n.maximum.z-n.minimum.z>L.Epsilon?n.maximum.z-n.minimum.z:L.Epsilon;var h=e.bbSize.x>e.bbSize.y?e.bbSize.x:e.bbSize.y;if(h=h>e.bbSize.z?h:e.bbSize.z,e.subDiv.max=e.partitioningSubdivisions,e.subDiv.X=Math.floor(e.subDiv.max*e.bbSize.x/h),e.subDiv.Y=Math.floor(e.subDiv.max*e.bbSize.y/h),e.subDiv.Z=Math.floor(e.subDiv.max*e.bbSize.z/h),e.subDiv.X=e.subDiv.X<1?1:e.subDiv.X,e.subDiv.Y=e.subDiv.Y<1?1:e.subDiv.Y,e.subDiv.Z=e.subDiv.Z<1?1:e.subDiv.Z,e.facetParameters.facetNormals=this.getFacetLocalNormals(),e.facetParameters.facetPositions=this.getFacetLocalPositions(),e.facetParameters.facetPartitioning=this.getFacetLocalPartitioning(),e.facetParameters.bInfo=n,e.facetParameters.bbSize=e.bbSize,e.facetParameters.subDiv=e.subDiv,e.facetParameters.ratio=this.partitioningBBoxRatio,e.facetParameters.depthSort=e.facetDepthSort,e.facetDepthSort&&e.facetDepthSortEnabled&&(this.computeWorldMatrix(!0),this._worldMatrix.invertToRef(e.invertedMatrix),L.Vector3.TransformCoordinatesToRef(e.facetDepthSortFrom,e.invertedMatrix,e.facetDepthSortOrigin),e.facetParameters.distanceTo=e.facetDepthSortOrigin),e.facetParameters.depthSortedFacets=e.depthSortedFacets,L.VertexData.ComputeNormals(t,i,r,e.facetParameters),e.facetDepthSort&&e.facetDepthSortEnabled){e.depthSortedFacets.sort(e.facetDepthSortFunction);var u=e.depthSortedIndices.length/3|0;for(l=0;l<u;l++){var d=e.depthSortedFacets[l].ind;e.depthSortedIndices[3*l]=i[d],e.depthSortedIndices[3*l+1]=i[d+1],e.depthSortedIndices[3*l+2]=i[d+2]}this.updateIndices(e.depthSortedIndices)}return this},i.prototype.getFacetLocalNormals=function(){return this._facetData.facetNormals||this.updateFacetData(),this._facetData.facetNormals},i.prototype.getFacetLocalPositions=function(){return this._facetData.facetPositions||this.updateFacetData(),this._facetData.facetPositions},i.prototype.getFacetLocalPartitioning=function(){return this._facetData.facetPartitioning||this.updateFacetData(),this._facetData.facetPartitioning},i.prototype.getFacetPosition=function(e){var t=L.Vector3.Zero();return this.getFacetPositionToRef(e,t),t},i.prototype.getFacetPositionToRef=function(e,t){var i=this.getFacetLocalPositions()[e],r=this.getWorldMatrix();return L.Vector3.TransformCoordinatesToRef(i,r,t),this},i.prototype.getFacetNormal=function(e){var t=L.Vector3.Zero();return this.getFacetNormalToRef(e,t),t},i.prototype.getFacetNormalToRef=function(e,t){var i=this.getFacetLocalNormals()[e];return L.Vector3.TransformNormalToRef(i,this.getWorldMatrix(),t),this},i.prototype.getFacetsAtLocalCoordinates=function(e,t,i){var r=this.getBoundingInfo(),n=this._facetData,o=Math.floor((e-r.minimum.x*n.partitioningBBoxRatio)*n.subDiv.X*n.partitioningBBoxRatio/n.bbSize.x),s=Math.floor((t-r.minimum.y*n.partitioningBBoxRatio)*n.subDiv.Y*n.partitioningBBoxRatio/n.bbSize.y),a=Math.floor((i-r.minimum.z*n.partitioningBBoxRatio)*n.subDiv.Z*n.partitioningBBoxRatio/n.bbSize.z);return o<0||o>n.subDiv.max||s<0||s>n.subDiv.max||a<0||a>n.subDiv.max?null:n.facetPartitioning[o+n.subDiv.max*s+n.subDiv.max*n.subDiv.max*a]},i.prototype.getClosestFacetAtCoordinates=function(e,t,i,r,n,o){void 0===n&&(n=!1),void 0===o&&(o=!0);var s=this.getWorldMatrix(),a=L.Tmp.Matrix[5];s.invertToRef(a);var l=L.Tmp.Vector3[8];L.Vector3.TransformCoordinatesFromFloatsToRef(e,t,i,a,l);var c=this.getClosestFacetAtLocalCoordinates(l.x,l.y,l.z,r,n,o);return r&&L.Vector3.TransformCoordinatesFromFloatsToRef(r.x,r.y,r.z,s,r),c},i.prototype.getClosestFacetAtLocalCoordinates=function(e,t,i,r,n,o){void 0===n&&(n=!1),void 0===o&&(o=!0);var s=null,a=0,l=0,c=0,h=0,u=0,d=0,f=0,p=0,_=this.getFacetLocalPositions(),m=this.getFacetLocalNormals(),g=this.getFacetsAtLocalCoordinates(e,t,i);if(!g)return null;for(var v,y,b,T=Number.MAX_VALUE,E=T,x=0;x<g.length;x++)y=m[v=g[x]],h=(e-(b=_[v]).x)*y.x+(t-b.y)*y.y+(i-b.z)*y.z,(!n||n&&o&&0<=h||n&&!o&&h<=0)&&(h=y.x*b.x+y.y*b.y+y.z*b.z,u=-(y.x*e+y.y*t+y.z*i-h)/(y.x*y.x+y.y*y.y+y.z*y.z),(E=(a=(d=e+y.x*u)-e)*a+(l=(f=t+y.y*u)-t)*l+(c=(p=i+y.z*u)-i)*c)<T&&(T=E,s=v,r&&(r.x=d,r.y=f,r.z=p)));return s},i.prototype.getFacetDataParameters=function(){return this._facetData.facetParameters},i.prototype.disableFacetData=function(){return this._facetData.facetDataEnabled&&(this._facetData.facetDataEnabled=!1,this._facetData.facetPositions=new Array,this._facetData.facetNormals=new Array,this._facetData.facetPartitioning=new Array,this._facetData.facetParameters=null,this._facetData.depthSortedIndices=new Uint32Array(0)),this},i.prototype.updateIndices=function(e){return this},i.prototype.createNormals=function(e){var t,i=this.getVerticesData(L.VertexBuffer.PositionKind),r=this.getIndices();return t=this.isVerticesDataPresent(L.VertexBuffer.NormalKind)?this.getVerticesData(L.VertexBuffer.NormalKind):[],L.VertexData.ComputeNormals(i,r,t,{useRightHandedSystem:this.getScene().useRightHandedSystem}),this.setVerticesData(L.VertexBuffer.NormalKind,t,e),this},i.prototype.alignWithNormal=function(e,t){t||(t=L.Axis.Y);var i=L.Tmp.Vector3[0],r=L.Tmp.Vector3[1];return L.Vector3.CrossToRef(t,e,r),L.Vector3.CrossToRef(e,r,i),this.rotationQuaternion?L.Quaternion.RotationQuaternionFromAxisToRef(i,e,r,this.rotationQuaternion):L.Vector3.RotationFromAxisToRef(i,e,r,this.rotation),this},i.prototype._checkOcclusionQuery=function(){return!1},i.OCCLUSION_TYPE_NONE=0,i.OCCLUSION_TYPE_OPTIMISTIC=1,i.OCCLUSION_TYPE_STRICT=2,i.OCCLUSION_ALGORITHM_TYPE_ACCURATE=0,i.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE=1,i.CULLINGSTRATEGY_STANDARD=0,i.CULLINGSTRATEGY_BOUNDINGSPHERE_ONLY=1,i})(L.TransformNode),L.AbstractMesh=B,N=$a||($a={}),V=(function(n){function s(e,t){var i=n.call(this,e,t)||this;return i.diffuse=new N.Color3(1,1,1),i.specular=new N.Color3(1,1,1),i.falloffType=s.FALLOFF_DEFAULT,i.intensity=1,i._range=Number.MAX_VALUE,i._inverseSquaredRange=0,i._photometricScale=1,i._intensityMode=s.INTENSITYMODE_AUTOMATIC,i._radius=1e-5,i.renderPriority=0,i._shadowEnabled=!0,i._excludeWithLayerMask=0,i._includeOnlyWithLayerMask=0,i._lightmapMode=0,i._excludedMeshesIds=new Array,i._includedOnlyMeshesIds=new Array,i.getScene().addLight(i),i._uniformBuffer=new N.UniformBuffer(i.getScene().getEngine()),i._buildUniformLayout(),i.includedOnlyMeshes=new Array,i.excludedMeshes=new Array,i._resyncMeshes(),i}return T(s,n),Object.defineProperty(s.prototype,"range",{get:function(){return this._range},set:function(e){this._range=e,this._inverseSquaredRange=1/(this.range*this.range)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"intensityMode",{get:function(){return this._intensityMode},set:function(e){this._intensityMode=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._computePhotometricScale()},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"shadowEnabled",{get:function(){return this._shadowEnabled},set:function(e){this._shadowEnabled!==e&&(this._shadowEnabled=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"includedOnlyMeshes",{get:function(){return this._includedOnlyMeshes},set:function(e){this._includedOnlyMeshes=e,this._hookArrayForIncludedOnly(e)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"excludedMeshes",{get:function(){return this._excludedMeshes},set:function(e){this._excludedMeshes=e,this._hookArrayForExcluded(e)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"excludeWithLayerMask",{get:function(){return this._excludeWithLayerMask},set:function(e){this._excludeWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"includeOnlyWithLayerMask",{get:function(){return this._includeOnlyWithLayerMask},set:function(e){this._includeOnlyWithLayerMask=e,this._resyncMeshes()},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"lightmapMode",{get:function(){return this._lightmapMode},set:function(e){this._lightmapMode!==e&&(this._lightmapMode=e,this._markMeshesAsLightDirty())},enumerable:!0,configurable:!0}),s.prototype.getClassName=function(){return"Light"},s.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+["Point","Directional","Spot","Hemispheric"][this.getTypeID()],this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t},s.prototype._syncParentEnabledState=function(){n.prototype._syncParentEnabledState.call(this),this._resyncMeshes()},s.prototype.setEnabled=function(e){n.prototype.setEnabled.call(this,e),this._resyncMeshes()},s.prototype.getShadowGenerator=function(){return this._shadowGenerator},s.prototype.getAbsolutePosition=function(){return N.Vector3.Zero()},s.prototype.canAffectMesh=function(e){return!e||!(this.includedOnlyMeshes&&0<this.includedOnlyMeshes.length&&-1===this.includedOnlyMeshes.indexOf(e))&&(!(this.excludedMeshes&&0<this.excludedMeshes.length&&-1!==this.excludedMeshes.indexOf(e))&&((0===this.includeOnlyWithLayerMask||0!=(this.includeOnlyWithLayerMask&e.layerMask))&&!(0!==this.excludeWithLayerMask&&this.excludeWithLayerMask&e.layerMask)))},s.CompareLightsPriority=function(e,t){return e.shadowEnabled!==t.shadowEnabled?(t.shadowEnabled?1:0)-(e.shadowEnabled?1:0):t.renderPriority-e.renderPriority},s.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._shadowGenerator&&(this._shadowGenerator.dispose(),this._shadowGenerator=null),this.getScene().stopAnimation(this);for(var i=0,r=this.getScene().meshes;i<r.length;i++){r[i]._removeLightSource(this)}this._uniformBuffer.dispose(),this.getScene().removeLight(this),n.prototype.dispose.call(this,e,t)},s.prototype.getTypeID=function(){return 0},s.prototype.getScaledIntensity=function(){return this._photometricScale*this.intensity},s.prototype.clone=function(e){var t=s.GetConstructorFromName(this.getTypeID(),e,this.getScene());return t?N.SerializationHelper.Clone(t,this):null},s.prototype.serialize=function(){var t=N.SerializationHelper.Serialize(this);return t.type=this.getTypeID(),this.parent&&(t.parentId=this.parent.id),0<this.excludedMeshes.length&&(t.excludedMeshesIds=[],this.excludedMeshes.forEach((function(e){t.excludedMeshesIds.push(e.id)}))),0<this.includedOnlyMeshes.length&&(t.includedOnlyMeshesIds=[],this.includedOnlyMeshes.forEach((function(e){t.includedOnlyMeshesIds.push(e.id)}))),N.Animation.AppendSerializedAnimations(this,t),t.ranges=this.serializeAnimationRanges(),t},s.GetConstructorFromName=function(e,t,i){var r=N.Node.Construct("Light_Type_"+e,t,i);return r||null},s.Parse=function(e,t){var i=s.GetConstructorFromName(e.type,e.name,t);if(!i)return null;var r=N.SerializationHelper.Parse(i,e,t);if(e.excludedMeshesIds&&(r._excludedMeshesIds=e.excludedMeshesIds),e.includedOnlyMeshesIds&&(r._includedOnlyMeshesIds=e.includedOnlyMeshesIds),e.parentId&&(r._waitingParentId=e.parentId),e.animations){for(var n=0;n<e.animations.length;n++){var o=e.animations[n];r.animations.push(N.Animation.Parse(o))}N.Node.ParseAnimationRanges(r,e,t)}return e.autoAnimate&&t.beginAnimation(r,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),r},s.prototype._hookArrayForExcluded=function(o){var s=this,a=o.push;o.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];for(var i=a.apply(o,e),r=0,n=e;r<n.length;r++){n[r]._resyncLighSource(s)}return i};var l=o.splice;o.splice=function(e,t){for(var i=l.apply(o,[e,t]),r=0,n=i;r<n.length;r++){n[r]._resyncLighSource(s)}return i};for(var e=0,t=o;e<t.length;e++){t[e]._resyncLighSource(this)}},s.prototype._hookArrayForIncludedOnly=function(r){var n=this,o=r.push;r.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=o.apply(r,e);return n._resyncMeshes(),i};var s=r.splice;r.splice=function(e,t){var i=s.apply(r,[e,t]);return n._resyncMeshes(),i},this._resyncMeshes()},s.prototype._resyncMeshes=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){t[e]._resyncLighSource(this)}},s.prototype._markMeshesAsLightDirty=function(){for(var e=0,t=this.getScene().meshes;e<t.length;e++){var i=t[e];-1!==i._lightSources.indexOf(this)&&i._markSubMeshesAsLightDirty()}},s.prototype._computePhotometricScale=function(){this._photometricScale=this._getPhotometricScale(),this.getScene().resetCachedMaterial()},s.prototype._getPhotometricScale=function(){var e=0,t=this.getTypeID(),i=this.intensityMode;switch(i===s.INTENSITYMODE_AUTOMATIC&&(i=t===s.LIGHTTYPEID_DIRECTIONALLIGHT?s.INTENSITYMODE_ILLUMINANCE:s.INTENSITYMODE_LUMINOUSINTENSITY),t){case s.LIGHTTYPEID_POINTLIGHT:case s.LIGHTTYPEID_SPOTLIGHT:switch(i){case s.INTENSITYMODE_LUMINOUSPOWER:e=1/(4*Math.PI);break;case s.INTENSITYMODE_LUMINOUSINTENSITY:e=1;break;case s.INTENSITYMODE_LUMINANCE:e=this.radius*this.radius}break;case s.LIGHTTYPEID_DIRECTIONALLIGHT:switch(i){case s.INTENSITYMODE_ILLUMINANCE:e=1;break;case s.INTENSITYMODE_LUMINANCE:var r=this.radius;r=Math.max(r,.001),e=2*Math.PI*(1-Math.cos(r))}break;case s.LIGHTTYPEID_HEMISPHERICLIGHT:e=1}return e},s.prototype._reorderLightsInScene=function(){var e=this.getScene();0!=this._renderPriority&&(e.requireLightSorting=!0),this.getScene().sortLightsByPriority()},s.FALLOFF_DEFAULT=0,s.FALLOFF_PHYSICAL=1,s.FALLOFF_GLTF=2,s.FALLOFF_STANDARD=3,s.LIGHTMAP_DEFAULT=0,s.LIGHTMAP_SPECULAR=1,s.LIGHTMAP_SHADOWSONLY=2,s.INTENSITYMODE_AUTOMATIC=0,s.INTENSITYMODE_LUMINOUSPOWER=1,s.INTENSITYMODE_LUMINOUSINTENSITY=2,s.INTENSITYMODE_ILLUMINANCE=3,s.INTENSITYMODE_LUMINANCE=4,s.LIGHTTYPEID_POINTLIGHT=0,s.LIGHTTYPEID_DIRECTIONALLIGHT=1,s.LIGHTTYPEID_SPOTLIGHT=2,s.LIGHTTYPEID_HEMISPHERICLIGHT=3,b([N.serializeAsColor3()],s.prototype,"diffuse",void 0),b([N.serializeAsColor3()],s.prototype,"specular",void 0),b([N.serialize()],s.prototype,"falloffType",void 0),b([N.serialize()],s.prototype,"intensity",void 0),b([N.serialize()],s.prototype,"range",null),b([N.serialize()],s.prototype,"intensityMode",null),b([N.serialize()],s.prototype,"radius",null),b([N.serialize()],s.prototype,"_renderPriority",void 0),b([N.expandToProperty("_reorderLightsInScene")],s.prototype,"renderPriority",void 0),b([N.serialize("shadowEnabled")],s.prototype,"_shadowEnabled",void 0),b([N.serialize("excludeWithLayerMask")],s.prototype,"_excludeWithLayerMask",void 0),b([N.serialize("includeOnlyWithLayerMask")],s.prototype,"_includeOnlyWithLayerMask",void 0),b([N.serialize("lightmapMode")],s.prototype,"_lightmapMode",void 0),s})(N.Node),N.Light=V,U=$a||($a={}),z=(function(o){function c(e,t,i,r){void 0===r&&(r=!0);var n=o.call(this,e,i)||this;return n.upVector=U.Vector3.Up(),n.orthoLeft=null,n.orthoRight=null,n.orthoBottom=null,n.orthoTop=null,n.fov=.8,n.minZ=1,n.maxZ=1e4,n.inertia=.9,n.mode=c.PERSPECTIVE_CAMERA,n.isIntermediate=!1,n.viewport=new U.Viewport(0,0,1,1),n.layerMask=268435455,n.fovMode=c.FOVMODE_VERTICAL_FIXED,n.cameraRigMode=c.RIG_MODE_NONE,n.customRenderTargets=new Array,n.onViewMatrixChangedObservable=new U.Observable,n.onProjectionMatrixChangedObservable=new U.Observable,n.onAfterCheckInputsObservable=new U.Observable,n.onRestoreStateObservable=new U.Observable,n._rigCameras=new Array,n._webvrViewMatrix=U.Matrix.Identity(),n._skipRendering=!1,n._projectionMatrix=new U.Matrix,n._postProcesses=new Array,n._activeMeshes=new U.SmartArray(256),n._globalPosition=U.Vector3.Zero(),n._computedViewMatrix=U.Matrix.Identity(),n._doNotComputeProjectionMatrix=!1,n._transformMatrix=U.Matrix.Zero(),n._refreshFrustumPlanes=!0,n.getScene().addCamera(n),r&&!n.getScene().activeCamera&&(n.getScene().activeCamera=n),n.position=t,n}return T(c,o),c.prototype.storeState=function(){return this._stateStored=!0,this._storedFov=this.fov,this},c.prototype._restoreStateValues=function(){return!!this._stateStored&&(this.fov=this._storedFov,!0)},c.prototype.restoreState=function(){return!!this._restoreStateValues()&&(this.onRestoreStateObservable.notifyObservers(this),!0)},c.prototype.getClassName=function(){return"Camera"},c.prototype.toString=function(e){var t="Name: "+this.name;if(t+=", type: "+this.getClassName(),this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);return t},Object.defineProperty(c.prototype,"globalPosition",{get:function(){return this._globalPosition},enumerable:!0,configurable:!0}),c.prototype.getActiveMeshes=function(){return this._activeMeshes},c.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},c.prototype.isReady=function(e){if(void 0===e&&(e=!1),e)for(var t=0,i=this._postProcesses;t<i.length;t++){var r=i[t];if(r&&!r.isReady())return!1}return o.prototype.isReady.call(this,e)},c.prototype._initCache=function(){o.prototype._initCache.call(this),this._cache.position=new U.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.upVector=new U.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.mode=void 0,this._cache.minZ=void 0,this._cache.maxZ=void 0,this._cache.fov=void 0,this._cache.fovMode=void 0,this._cache.aspectRatio=void 0,this._cache.orthoLeft=void 0,this._cache.orthoRight=void 0,this._cache.orthoBottom=void 0,this._cache.orthoTop=void 0,this._cache.renderWidth=void 0,this._cache.renderHeight=void 0},c.prototype._updateCache=function(e){e||o.prototype._updateCache.call(this),this._cache.position.copyFrom(this.position),this._cache.upVector.copyFrom(this.upVector)},c.prototype._isSynchronized=function(){return this._isSynchronizedViewMatrix()&&this._isSynchronizedProjectionMatrix()},c.prototype._isSynchronizedViewMatrix=function(){return!!o.prototype._isSynchronized.call(this)&&(this._cache.position.equals(this.position)&&this._cache.upVector.equals(this.upVector)&&this.isSynchronizedWithParent())},c.prototype._isSynchronizedProjectionMatrix=function(){var e=this._cache.mode===this.mode&&this._cache.minZ===this.minZ&&this._cache.maxZ===this.maxZ;if(!e)return!1;var t=this.getEngine();return e=this.mode===c.PERSPECTIVE_CAMERA?this._cache.fov===this.fov&&this._cache.fovMode===this.fovMode&&this._cache.aspectRatio===t.getAspectRatio(this):this._cache.orthoLeft===this.orthoLeft&&this._cache.orthoRight===this.orthoRight&&this._cache.orthoBottom===this.orthoBottom&&this._cache.orthoTop===this.orthoTop&&this._cache.renderWidth===t.getRenderWidth()&&this._cache.renderHeight===t.getRenderHeight()},c.prototype.attachControl=function(e,t){},c.prototype.detachControl=function(e){},c.prototype.update=function(){this._checkInputs(),this.cameraRigMode!==c.RIG_MODE_NONE&&this._updateRigCameras()},c.prototype._checkInputs=function(){this.onAfterCheckInputsObservable.notifyObservers(this)},Object.defineProperty(c.prototype,"rigCameras",{get:function(){return this._rigCameras},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"rigPostProcess",{get:function(){return this._rigPostProcess},enumerable:!0,configurable:!0}),c.prototype._getFirstPostProcess=function(){for(var e=0;e<this._postProcesses.length;e++)if(null!==this._postProcesses[e])return this._postProcesses[e];return null},c.prototype._cascadePostProcessesToRigCams=function(){var e=this._getFirstPostProcess();e&&e.markTextureDirty();for(var t=0,i=this._rigCameras.length;t<i;t++){var r=this._rigCameras[t],n=r._rigPostProcess;if(n)n instanceof U.PassPostProcess&&(r.isIntermediate=0===this._postProcesses.length),r._postProcesses=this._postProcesses.slice(0).concat(n),n.markTextureDirty();else r._postProcesses=this._postProcesses.slice(0)}},c.prototype.attachPostProcess=function(e,t){return void 0===t&&(t=null),!e.isReusable()&&-1<this._postProcesses.indexOf(e)?(U.Tools.Error("You're trying to reuse a post process not defined as reusable."),0):(null==t||t<0?this._postProcesses.push(e):null===this._postProcesses[t]?this._postProcesses[t]=e:this._postProcesses.splice(t,0,e),this._cascadePostProcessesToRigCams(),this._postProcesses.indexOf(e))},c.prototype.detachPostProcess=function(e){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses[t]=null),this._cascadePostProcessesToRigCams()},c.prototype.getWorldMatrix=function(){return this._isSynchronizedViewMatrix()||this.getViewMatrix(),this._worldMatrix},c.prototype._getViewMatrix=function(){return U.Matrix.Identity()},c.prototype.getViewMatrix=function(e){return!e&&this._isSynchronizedViewMatrix()||(this.updateCache(),this._computedViewMatrix=this._getViewMatrix(),this._currentRenderId=this.getScene().getRenderId(),this._childRenderId=this._currentRenderId,this._refreshFrustumPlanes=!0,this._cameraRigParams&&this._cameraRigParams.vrPreViewMatrix&&this._computedViewMatrix.multiplyToRef(this._cameraRigParams.vrPreViewMatrix,this._computedViewMatrix),this.onViewMatrixChangedObservable.notifyObservers(this),this._computedViewMatrix.invertToRef(this._worldMatrix)),this._computedViewMatrix},c.prototype.freezeProjectionMatrix=function(e){this._doNotComputeProjectionMatrix=!0,void 0!==e&&(this._projectionMatrix=e)},c.prototype.unfreezeProjectionMatrix=function(){this._doNotComputeProjectionMatrix=!1},c.prototype.getProjectionMatrix=function(e){if(this._doNotComputeProjectionMatrix||!e&&this._isSynchronizedProjectionMatrix())return this._projectionMatrix;this._cache.mode=this.mode,this._cache.minZ=this.minZ,this._cache.maxZ=this.maxZ,this._refreshFrustumPlanes=!0;var t=this.getEngine(),i=this.getScene();if(this.mode===c.PERSPECTIVE_CAMERA)this._cache.fov=this.fov,this._cache.fovMode=this.fovMode,this._cache.aspectRatio=t.getAspectRatio(this),this.minZ<=0&&(this.minZ=.1),i.useRightHandedSystem?U.Matrix.PerspectiveFovRHToRef(this.fov,t.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===c.FOVMODE_VERTICAL_FIXED):U.Matrix.PerspectiveFovLHToRef(this.fov,t.getAspectRatio(this),this.minZ,this.maxZ,this._projectionMatrix,this.fovMode===c.FOVMODE_VERTICAL_FIXED);else{var r=t.getRenderWidth()/2,n=t.getRenderHeight()/2;i.useRightHandedSystem?U.Matrix.OrthoOffCenterRHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-n,this.orthoTop||n,this.minZ,this.maxZ,this._projectionMatrix):U.Matrix.OrthoOffCenterLHToRef(this.orthoLeft||-r,this.orthoRight||r,this.orthoBottom||-n,this.orthoTop||n,this.minZ,this.maxZ,this._projectionMatrix),this._cache.orthoLeft=this.orthoLeft,this._cache.orthoRight=this.orthoRight,this._cache.orthoBottom=this.orthoBottom,this._cache.orthoTop=this.orthoTop,this._cache.renderWidth=t.getRenderWidth(),this._cache.renderHeight=t.getRenderHeight()}return this.onProjectionMatrixChangedObservable.notifyObservers(this),this._projectionMatrix},c.prototype.getTransformationMatrix=function(){return this._computedViewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._transformMatrix},c.prototype._updateFrustumPlanes=function(){this._refreshFrustumPlanes&&(this.getTransformationMatrix(),this._frustumPlanes?U.Frustum.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=U.Frustum.GetPlanes(this._transformMatrix),this._refreshFrustumPlanes=!1)},c.prototype.isInFrustum=function(e){return this._updateFrustumPlanes(),e.isInFrustum(this._frustumPlanes)},c.prototype.isCompletelyInFrustum=function(e){return this._updateFrustumPlanes(),e.isCompletelyInFrustum(this._frustumPlanes)},c.prototype.getForwardRay=function(e,t,i){void 0===e&&(e=100),t||(t=this.getWorldMatrix()),i||(i=this.position);var r=this._scene.useRightHandedSystem?new U.Vector3(0,0,-1):new U.Vector3(0,0,1),n=U.Vector3.TransformNormal(r,t),o=U.Vector3.Normalize(n);return new U.Ray(i,o,e)},c.prototype.dispose=function(e,t){for(void 0===t&&(t=!1),this.onViewMatrixChangedObservable.clear(),this.onProjectionMatrixChangedObservable.clear(),this.onAfterCheckInputsObservable.clear(),this.onRestoreStateObservable.clear(),this.inputs&&this.inputs.clear(),this.getScene().stopAnimation(this),this.getScene().removeCamera(this);0<this._rigCameras.length;){var i=this._rigCameras.pop();i&&i.dispose()}if(this._rigPostProcess)this._rigPostProcess.dispose(this),this._rigPostProcess=null,this._postProcesses=[];else if(this.cameraRigMode!==c.RIG_MODE_NONE)this._rigPostProcess=null,this._postProcesses=[];else for(var r=this._postProcesses.length;0<=--r;){var n=this._postProcesses[r];n&&n.dispose(this)}for(r=this.customRenderTargets.length;0<=--r;)this.customRenderTargets[r].dispose();this.customRenderTargets=[],this._activeMeshes.dispose(),o.prototype.dispose.call(this,e,t)},Object.defineProperty(c.prototype,"leftCamera",{get:function(){return this._rigCameras.length<1?null:this._rigCameras[0]},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"rightCamera",{get:function(){return this._rigCameras.length<2?null:this._rigCameras[1]},enumerable:!0,configurable:!0}),c.prototype.getLeftTarget=function(){return this._rigCameras.length<1?null:this._rigCameras[0].getTarget()},c.prototype.getRightTarget=function(){return this._rigCameras.length<2?null:this._rigCameras[1].getTarget()},c.prototype.setCameraRigMode=function(e,t){if(this.cameraRigMode!==e){for(;0<this._rigCameras.length;){var i=this._rigCameras.pop();i&&i.dispose()}if(this.cameraRigMode=e,this._cameraRigParams={},this._cameraRigParams.interaxialDistance=t.interaxialDistance||.0637,this._cameraRigParams.stereoHalfAngle=U.Tools.ToRadians(this._cameraRigParams.interaxialDistance/.0637),this.cameraRigMode!==c.RIG_MODE_NONE){var r=this.createRigCamera(this.name+"_L",0),n=this.createRigCamera(this.name+"_R",1);r&&n&&(this._rigCameras.push(r),this._rigCameras.push(n))}switch(this.cameraRigMode){case c.RIG_MODE_STEREOSCOPIC_ANAGLYPH:this._rigCameras[0]._rigPostProcess=new U.PassPostProcess(this.name+"_passthru",1,this._rigCameras[0]),this._rigCameras[1]._rigPostProcess=new U.AnaglyphPostProcess(this.name+"_anaglyph",1,this._rigCameras);break;case c.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case c.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case c.RIG_MODE_STEREOSCOPIC_OVERUNDER:var o=this.cameraRigMode===c.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL||this.cameraRigMode===c.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED;this._rigCameras[0]._rigPostProcess=new U.PassPostProcess(this.name+"_passthru",1,this._rigCameras[0]),this._rigCameras[1]._rigPostProcess=new U.StereoscopicInterlacePostProcess(this.name+"_stereoInterlace",this._rigCameras,o);break;case c.RIG_MODE_VR:var s=t.vrCameraMetrics||U.VRCameraMetrics.GetDefault();this._rigCameras[0]._cameraRigParams.vrMetrics=s,this._rigCameras[0].viewport=new U.Viewport(0,0,.5,1),this._rigCameras[0]._cameraRigParams.vrWorkMatrix=new U.Matrix,this._rigCameras[0]._cameraRigParams.vrHMatrix=s.leftHMatrix,this._rigCameras[0]._cameraRigParams.vrPreViewMatrix=s.leftPreViewMatrix,this._rigCameras[0].getProjectionMatrix=this._rigCameras[0]._getVRProjectionMatrix,this._rigCameras[1]._cameraRigParams.vrMetrics=s,this._rigCameras[1].viewport=new U.Viewport(.5,0,.5,1),this._rigCameras[1]._cameraRigParams.vrWorkMatrix=new U.Matrix,this._rigCameras[1]._cameraRigParams.vrHMatrix=s.rightHMatrix,this._rigCameras[1]._cameraRigParams.vrPreViewMatrix=s.rightPreViewMatrix,this._rigCameras[1].getProjectionMatrix=this._rigCameras[1]._getVRProjectionMatrix,s.compensateDistortion&&(this._rigCameras[0]._rigPostProcess=new U.VRDistortionCorrectionPostProcess("VR_Distort_Compensation_Left",this._rigCameras[0],!1,s),this._rigCameras[1]._rigPostProcess=new U.VRDistortionCorrectionPostProcess("VR_Distort_Compensation_Right",this._rigCameras[1],!0,s));break;case c.RIG_MODE_WEBVR:if(t.vrDisplay){var a=t.vrDisplay.getEyeParameters("left"),l=t.vrDisplay.getEyeParameters("right");this._rigCameras[0].viewport=new U.Viewport(0,0,.5,1),this._rigCameras[0].setCameraRigParameter("left",!0),this._rigCameras[0].setCameraRigParameter("specs",t.specs),this._rigCameras[0].setCameraRigParameter("eyeParameters",a),this._rigCameras[0].setCameraRigParameter("frameData",t.frameData),this._rigCameras[0].setCameraRigParameter("parentCamera",t.parentCamera),this._rigCameras[0]._cameraRigParams.vrWorkMatrix=new U.Matrix,this._rigCameras[0].getProjectionMatrix=this._getWebVRProjectionMatrix,(this._rigCameras[0].parent=this)._rigCameras[0]._getViewMatrix=this._getWebVRViewMatrix,this._rigCameras[1].viewport=new U.Viewport(.5,0,.5,1),this._rigCameras[1].setCameraRigParameter("eyeParameters",l),this._rigCameras[1].setCameraRigParameter("specs",t.specs),this._rigCameras[1].setCameraRigParameter("frameData",t.frameData),this._rigCameras[1].setCameraRigParameter("parentCamera",t.parentCamera),this._rigCameras[1]._cameraRigParams.vrWorkMatrix=new U.Matrix,this._rigCameras[1].getProjectionMatrix=this._getWebVRProjectionMatrix,(this._rigCameras[1].parent=this)._rigCameras[1]._getViewMatrix=this._getWebVRViewMatrix,c.UseAlternateWebVRRendering&&(this._rigCameras[1]._skipRendering=!0,this._rigCameras[0]._alternateCamera=this._rigCameras[1])}}this._cascadePostProcessesToRigCams(),this.update()}},c.prototype._getVRProjectionMatrix=function(){return U.Matrix.PerspectiveFovLHToRef(this._cameraRigParams.vrMetrics.aspectRatioFov,this._cameraRigParams.vrMetrics.aspectRatio,this.minZ,this.maxZ,this._cameraRigParams.vrWorkMatrix),this._cameraRigParams.vrWorkMatrix.multiplyToRef(this._cameraRigParams.vrHMatrix,this._projectionMatrix),this._projectionMatrix},c.prototype._updateCameraRotationMatrix=function(){},c.prototype._updateWebVRCameraRotationMatrix=function(){},c.prototype._getWebVRProjectionMatrix=function(){return U.Matrix.Identity()},c.prototype._getWebVRViewMatrix=function(){return U.Matrix.Identity()},c.prototype.setCameraRigParameter=function(e,t){this._cameraRigParams||(this._cameraRigParams={}),this._cameraRigParams[e]=t,"interaxialDistance"===e&&(this._cameraRigParams.stereoHalfAngle=U.Tools.ToRadians(t/.0637))},c.prototype.createRigCamera=function(e,t){return null},c.prototype._updateRigCameras=function(){for(var e=0;e<this._rigCameras.length;e++)this._rigCameras[e].minZ=this.minZ,this._rigCameras[e].maxZ=this.maxZ,this._rigCameras[e].fov=this.fov;this.cameraRigMode===c.RIG_MODE_STEREOSCOPIC_ANAGLYPH&&(this._rigCameras[0].viewport=this._rigCameras[1].viewport=this.viewport)},c.prototype._setupInputs=function(){},c.prototype.serialize=function(){var e=U.SerializationHelper.Serialize(this);return e.type=this.getClassName(),this.parent&&(e.parentId=this.parent.id),this.inputs&&this.inputs.serialize(e),U.Animation.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e},c.prototype.clone=function(e){return U.SerializationHelper.Clone(c.GetConstructorFromName(this.getClassName(),e,this.getScene(),this.interaxialDistance,this.isStereoscopicSideBySide),this)},c.prototype.getDirection=function(e){var t=U.Vector3.Zero();return this.getDirectionToRef(e,t),t},c.prototype.getDirectionToRef=function(e,t){U.Vector3.TransformNormalToRef(e,this.getWorldMatrix(),t)},c.GetConstructorFromName=function(e,t,i,r,n){void 0===r&&(r=0),void 0===n&&(n=!0);var o=U.Node.Construct(e,t,i,{interaxial_distance:r,isStereoscopicSideBySide:n});return o||function(){return new U.UniversalCamera(t,U.Vector3.Zero(),i)}},c.prototype.computeWorldMatrix=function(){return this.getWorldMatrix()},c.Parse=function(e,t){var i=e.type,r=c.GetConstructorFromName(i,e.name,t,e.interaxial_distance,e.isStereoscopicSideBySide),n=U.SerializationHelper.Parse(r,e,t);if(e.parentId&&(n._waitingParentId=e.parentId),n.inputs&&(n.inputs.parse(e),n._setupInputs()),n.setPosition&&(n.position.copyFromFloats(0,0,0),n.setPosition(U.Vector3.FromArray(e.position))),e.target&&n.setTarget&&n.setTarget(U.Vector3.FromArray(e.target)),e.cameraRigMode){var o=e.interaxial_distance?{interaxialDistance:e.interaxial_distance}:{};n.setCameraRigMode(e.cameraRigMode,o)}if(e.animations){for(var s=0;s<e.animations.length;s++){var a=e.animations[s];n.animations.push(U.Animation.Parse(a))}U.Node.ParseAnimationRanges(n,e,t)}return e.autoAnimate&&t.beginAnimation(n,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),n},c.PERSPECTIVE_CAMERA=0,c.ORTHOGRAPHIC_CAMERA=1,c.FOVMODE_VERTICAL_FIXED=0,c.FOVMODE_HORIZONTAL_FIXED=1,c.RIG_MODE_NONE=0,c.RIG_MODE_STEREOSCOPIC_ANAGLYPH=10,c.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL=11,c.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED=12,c.RIG_MODE_STEREOSCOPIC_OVERUNDER=13,c.RIG_MODE_VR=20,c.RIG_MODE_WEBVR=21,c.ForceAttachControlToAlwaysPreventDefault=!1,c.UseAlternateWebVRRendering=!1,b([U.serializeAsVector3()],c.prototype,"position",void 0),b([U.serializeAsVector3()],c.prototype,"upVector",void 0),b([U.serialize()],c.prototype,"orthoLeft",void 0),b([U.serialize()],c.prototype,"orthoRight",void 0),b([U.serialize()],c.prototype,"orthoBottom",void 0),b([U.serialize()],c.prototype,"orthoTop",void 0),b([U.serialize()],c.prototype,"fov",void 0),b([U.serialize()],c.prototype,"minZ",void 0),b([U.serialize()],c.prototype,"maxZ",void 0),b([U.serialize()],c.prototype,"inertia",void 0),b([U.serialize()],c.prototype,"mode",void 0),b([U.serialize()],c.prototype,"layerMask",void 0),b([U.serialize()],c.prototype,"fovMode",void 0),b([U.serialize()],c.prototype,"cameraRigMode",void 0),b([U.serialize()],c.prototype,"interaxialDistance",void 0),b([U.serialize()],c.prototype,"isStereoscopicSideBySide",void 0),c})(U.Node),U.Camera=z,G=$a||($a={}),k=(function(){function p(e){this._useSceneAutoClearSetup=!1,this._renderingGroups=new Array,this._autoClearDepthStencil={},this._customOpaqueSortCompareFn={},this._customAlphaTestSortCompareFn={},this._customTransparentSortCompareFn={},this._renderingGroupInfo=new G.RenderingGroupInfo,this._scene=e;for(var t=p.MIN_RENDERINGGROUPS;t<p.MAX_RENDERINGGROUPS;t++)this._autoClearDepthStencil[t]={autoClear:!0,depth:!0,stencil:!0}}return p.prototype._clearDepthStencilBuffer=function(e,t){void 0===e&&(e=!0),void 0===t&&(t=!0),this._depthStencilBufferAlreadyCleaned||(this._scene.getEngine().clear(null,!1,e,t),this._depthStencilBufferAlreadyCleaned=!0)},p.prototype.render=function(e,t,i,r){var n=this._renderingGroupInfo;if(n.scene=this._scene,n.camera=this._scene.activeCamera,this._scene.spriteManagers&&r)for(var o=0;o<this._scene.spriteManagers.length;o++){var s=this._scene.spriteManagers[o];this.dispatchSprites(s)}for(o=p.MIN_RENDERINGGROUPS;o<p.MAX_RENDERINGGROUPS;o++){this._depthStencilBufferAlreadyCleaned=o===p.MIN_RENDERINGGROUPS;var a=this._renderingGroups[o];if(a){var l=Math.pow(2,o);if(n.renderingGroupId=o,this._scene.onBeforeRenderingGroupObservable.notifyObservers(n,l),p.AUTOCLEAR){var c=this._useSceneAutoClearSetup?this._scene.getAutoClearDepthStencilSetup(o):this._autoClearDepthStencil[o];c&&c.autoClear&&this._clearDepthStencilBuffer(c.depth,c.stencil)}for(var h=0,u=this._scene._beforeRenderingGroupDrawStage;h<u.length;h++){u[h].action(o)}a.render(e,r,i,t);for(var d=0,f=this._scene._afterRenderingGroupDrawStage;d<f.length;d++){f[d].action(o)}this._scene.onAfterRenderingGroupObservable.notifyObservers(n,l)}}},p.prototype.reset=function(){for(var e=p.MIN_RENDERINGGROUPS;e<p.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.prepare()}},p.prototype.dispose=function(){this.freeRenderingGroups(),this._renderingGroups.length=0,this._renderingGroupInfo=null},p.prototype.freeRenderingGroups=function(){for(var e=p.MIN_RENDERINGGROUPS;e<p.MAX_RENDERINGGROUPS;e++){var t=this._renderingGroups[e];t&&t.dispose()}},p.prototype._prepareRenderingGroup=function(e){void 0===this._renderingGroups[e]&&(this._renderingGroups[e]=new G.RenderingGroup(e,this._scene,this._customOpaqueSortCompareFn[e],this._customAlphaTestSortCompareFn[e],this._customTransparentSortCompareFn[e]))},p.prototype.dispatchSprites=function(e){var t=e.renderingGroupId||0;this._prepareRenderingGroup(t),this._renderingGroups[t].dispatchSprites(e)},p.prototype.dispatchParticles=function(e){var t=e.renderingGroupId||0;this._prepareRenderingGroup(t),this._renderingGroups[t].dispatchParticles(e)},p.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh());var r=t.renderingGroupId||0;this._prepareRenderingGroup(r),this._renderingGroups[r].dispatch(e,t,i)},p.prototype.setRenderingOrder=function(e,t,i,r){if(void 0===t&&(t=null),void 0===i&&(i=null),void 0===r&&(r=null),this._customOpaqueSortCompareFn[e]=t,this._customAlphaTestSortCompareFn[e]=i,this._customTransparentSortCompareFn[e]=r,this._renderingGroups[e]){var n=this._renderingGroups[e];n.opaqueSortCompareFn=this._customOpaqueSortCompareFn[e],n.alphaTestSortCompareFn=this._customAlphaTestSortCompareFn[e],n.transparentSortCompareFn=this._customTransparentSortCompareFn[e]}},p.prototype.setRenderingAutoClearDepthStencil=function(e,t,i,r){void 0===i&&(i=!0),void 0===r&&(r=!0),this._autoClearDepthStencil[e]={autoClear:t,depth:i,stencil:r}},p.prototype.getAutoClearDepthStencilSetup=function(e){return this._autoClearDepthStencil[e]},p.MAX_RENDERINGGROUPS=4,p.MIN_RENDERINGGROUPS=0,p.AUTOCLEAR=!0,p})(),G.RenderingManager=k,W=$a||($a={}),H=(function(){function i(e,t,i,r,n){void 0===i&&(i=null),void 0===r&&(r=null),void 0===n&&(n=null),this.index=e,this._opaqueSubMeshes=new W.SmartArray(256),this._transparentSubMeshes=new W.SmartArray(256),this._alphaTestSubMeshes=new W.SmartArray(256),this._depthOnlySubMeshes=new W.SmartArray(256),this._particleSystems=new W.SmartArray(256),this._spriteManagers=new W.SmartArray(256),this._edgesRenderers=new W.SmartArray(16),this._scene=t,this.opaqueSortCompareFn=i,this.alphaTestSortCompareFn=r,this.transparentSortCompareFn=n}return Object.defineProperty(i.prototype,"opaqueSortCompareFn",{set:function(e){this._opaqueSortCompareFn=e,this._renderOpaque=e?this.renderOpaqueSorted:i.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"alphaTestSortCompareFn",{set:function(e){this._alphaTestSortCompareFn=e,this._renderAlphaTest=e?this.renderAlphaTestSorted:i.renderUnsorted},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"transparentSortCompareFn",{set:function(e){this._transparentSortCompareFn=e||i.defaultTransparentSortCompare,this._renderTransparent=this.renderTransparentSorted},enumerable:!0,configurable:!0}),i.prototype.render=function(e,t,i,r){if(e)e(this._opaqueSubMeshes,this._alphaTestSubMeshes,this._transparentSubMeshes,this._depthOnlySubMeshes);else{var n=this._scene.getEngine();0!==this._depthOnlySubMeshes.length&&(n.setColorWrite(!1),this._renderAlphaTest(this._depthOnlySubMeshes),n.setColorWrite(!0)),0!==this._opaqueSubMeshes.length&&this._renderOpaque(this._opaqueSubMeshes),0!==this._alphaTestSubMeshes.length&&this._renderAlphaTest(this._alphaTestSubMeshes);var o=n.getStencilBuffer();if(n.setStencilBuffer(!1),t&&this._renderSprites(),i&&this._renderParticles(r),this.onBeforeTransparentRendering&&this.onBeforeTransparentRendering(),0!==this._transparentSubMeshes.length&&(this._renderTransparent(this._transparentSubMeshes),n.setAlphaMode(W.Engine.ALPHA_DISABLE)),n.setStencilBuffer(!1),this._edgesRenderers.length){for(var s=0;s<this._edgesRenderers.length;s++)this._edgesRenderers.data[s].render();n.setAlphaMode(W.Engine.ALPHA_DISABLE)}n.setStencilBuffer(o)}},i.prototype.renderOpaqueSorted=function(e){return i.renderSorted(e,this._opaqueSortCompareFn,this._scene.activeCamera,!1)},i.prototype.renderAlphaTestSorted=function(e){return i.renderSorted(e,this._alphaTestSortCompareFn,this._scene.activeCamera,!1)},i.prototype.renderTransparentSorted=function(e){return i.renderSorted(e,this._transparentSortCompareFn,this._scene.activeCamera,!0)},i.renderSorted=function(e,t,i,r){for(var n,o=0,s=i?i.globalPosition:W.Vector3.Zero();o<e.length;o++)(n=e.data[o])._alphaIndex=n.getMesh().alphaIndex,n._distanceToCamera=n.getBoundingInfo().boundingSphere.centerWorld.subtract(s).length();var a=e.data.slice(0,e.length);for(t&&a.sort(t),o=0;o<a.length;o++){if(n=a[o],r){var l=n.getMaterial();if(l&&l.needDepthPrePass){var c=l.getScene().getEngine();c.setColorWrite(!1),c.setAlphaMode(W.Engine.ALPHA_DISABLE),n.render(!1),c.setColorWrite(!0)}}n.render(r)}},i.renderUnsorted=function(e){for(var t=0;t<e.length;t++){e.data[t].render(!1)}},i.defaultTransparentSortCompare=function(e,t){return e._alphaIndex>t._alphaIndex?1:e._alphaIndex<t._alphaIndex?-1:i.backToFrontSortCompare(e,t)},i.backToFrontSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0},i.frontToBackSortCompare=function(e,t){return e._distanceToCamera<t._distanceToCamera?-1:e._distanceToCamera>t._distanceToCamera?1:0},i.prototype.prepare=function(){this._opaqueSubMeshes.reset(),this._transparentSubMeshes.reset(),this._alphaTestSubMeshes.reset(),this._depthOnlySubMeshes.reset(),this._particleSystems.reset(),this._spriteManagers.reset(),this._edgesRenderers.reset()},i.prototype.dispose=function(){this._opaqueSubMeshes.dispose(),this._transparentSubMeshes.dispose(),this._alphaTestSubMeshes.dispose(),this._depthOnlySubMeshes.dispose(),this._particleSystems.dispose(),this._spriteManagers.dispose(),this._edgesRenderers.dispose()},i.prototype.dispatch=function(e,t,i){void 0===t&&(t=e.getMesh()),void 0===i&&(i=e.getMaterial()),null!=i&&(i.needAlphaBlendingForMesh(t)?this._transparentSubMeshes.push(e):i.needAlphaTesting()?(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._alphaTestSubMeshes.push(e)):(i.needDepthPrePass&&this._depthOnlySubMeshes.push(e),this._opaqueSubMeshes.push(e)),t._edgesRenderer&&t._edgesRenderer.isEnabled&&this._edgesRenderers.push(t._edgesRenderer))},i.prototype.dispatchSprites=function(e){this._spriteManagers.push(e)},i.prototype.dispatchParticles=function(e){this._particleSystems.push(e)},i.prototype._renderParticles=function(e){if(0!==this._particleSystems.length){var t=this._scene.activeCamera;this._scene.onBeforeParticlesRenderingObservable.notifyObservers(this._scene);for(var i=0;i<this._particleSystems.length;i++){var r=this._particleSystems.data[i];if(0!==(t&&t.layerMask&r.layerMask)){var n=r.emitter;n.position&&e&&-1===e.indexOf(n)||this._scene._activeParticles.addCount(r.render(),!1)}}this._scene.onAfterParticlesRenderingObservable.notifyObservers(this._scene)}},i.prototype._renderSprites=function(){if(this._scene.spritesEnabled&&0!==this._spriteManagers.length){var e=this._scene.activeCamera;this._scene.onBeforeSpritesRenderingObservable.notifyObservers(this._scene);for(var t=0;t<this._spriteManagers.length;t++){var i=this._spriteManagers.data[t];0!==(e&&e.layerMask&i.layerMask)&&i.render()}this._scene.onAfterSpritesRenderingObservable.notifyObservers(this._scene)}},i})(),W.RenderingGroup=H,(function(e){var t=(function(){function e(){}return e.NAME_EFFECTLAYER="EffectLayer",e.NAME_LAYER="Layer",e.NAME_LENSFLARESYSTEM="LensFlareSystem",e.NAME_BOUNDINGBOXRENDERER="BoundingBoxRenderer",e.NAME_PARTICLESYSTEM="ParticleSystem",e.NAME_GAMEPAD="Gamepad",e.NAME_SIMPLIFICATIONQUEUE="SimplificationQueue",e.NAME_GEOMETRYBUFFERRENDERER="GeometryBufferRenderer",e.NAME_DEPTHRENDERER="DepthRenderer",e.NAME_POSTPROCESSRENDERPIPELINEMANAGER="PostProcessRenderPipelineManager",e.NAME_SPRITE="Sprite",e.NAME_OUTLINERENDERER="Outline",e.NAME_PROCEDURALTEXTURE="ProceduralTexture",e.NAME_SHADOWGENERATOR="ShadowGenerator",e.NAME_OCTREE="Octree",e.NAME_PHYSICSENGINE="PhysicsEngine",e.NAME_AUDIO="Audio",e.STEP_ISREADYFORMESH_EFFECTLAYER=0,e.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER=0,e.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER=0,e.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER=1,e.STEP_BEFORECAMERADRAW_EFFECTLAYER=0,e.STEP_BEFORECAMERADRAW_LAYER=1,e.STEP_BEFORERENDERINGMESH_OUTLINE=0,e.STEP_AFTERRENDERINGMESH_OUTLINE=0,e.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW=0,e.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER=1,e.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE=0,e.STEP_BEFORECAMERAUPDATE_GAMEPAD=1,e.STEP_BEFORECLEAR_PROCEDURALTEXTURE=0,e.STEP_AFTERCAMERADRAW_EFFECTLAYER=0,e.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM=1,e.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW=2,e.STEP_AFTERCAMERADRAW_LAYER=3,e.STEP_AFTERRENDER_AUDIO=0,e.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR=0,e.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER=1,e.STEP_GATHERRENDERTARGETS_DEPTHRENDERER=2,e.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER=3,e.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER=0,e.STEP_POINTERMOVE_SPRITE=0,e.STEP_POINTERDOWN_SPRITE=0,e.STEP_POINTERUP_SPRITE=0,e})();e.SceneComponentConstants=t;var i=(function(t){function e(e){return t.apply(this,e)||this}return T(e,t),e.Create=function(){return Object.create(e.prototype)},e.prototype.registerStep=function(e,t,i){var r=0;for(Number.MAX_VALUE;r<this.length;r++){if(e<this[r].index)break}this.splice(r,0,{index:e,component:t,action:i.bind(t)})},e.prototype.clear=function(){this.length=0},e})(Array);e.Stage=i})($a||($a={})),X=$a||($a={}),j=(function(){function e(){this.rootNodes=new Array,this.cameras=new Array,this.lights=new Array,this.meshes=new Array,this.skeletons=new Array,this.particleSystems=new Array,this.animations=[],this.animationGroups=new Array,this.multiMaterials=new Array,this.materials=new Array,this.morphTargetManagers=new Array,this.geometries=new Array,this.transformNodes=new Array,this.actionManagers=new Array,this.textures=new Array}return e.AddParser=function(e,t){this._BabylonFileParsers[e]=t},e.GetParser=function(e){return this._BabylonFileParsers[e]?this._BabylonFileParsers[e]:null},e.AddIndividualParser=function(e,t){this._IndividualBabylonFileParsers[e]=t},e.GetIndividualParser=function(e){return this._IndividualBabylonFileParsers[e]?this._IndividualBabylonFileParsers[e]:null},e.Parse=function(e,t,i,r){for(var n in this._BabylonFileParsers)this._BabylonFileParsers.hasOwnProperty(n)&&this._BabylonFileParsers[n](e,t,i,r)},e._BabylonFileParsers={},e._IndividualBabylonFileParsers={},e})(),X.AbstractScene=j,(function(x){var u=(function(){function e(){this._singleClick=!1,this._doubleClick=!1,this._hasSwiped=!1,this._ignore=!1}return Object.defineProperty(e.prototype,"singleClick",{get:function(){return this._singleClick},set:function(e){this._singleClick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"doubleClick",{get:function(){return this._doubleClick},set:function(e){this._doubleClick=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"hasSwiped",{get:function(){return this._hasSwiped},set:function(e){this._hasSwiped=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ignore",{get:function(){return this._ignore},set:function(e){this._ignore=e},enumerable:!0,configurable:!0}),e})(),e=function(){};x.RenderingGroupInfo=e;var t=(function(i){function E(e){var t=i.call(this)||this;return t.autoClear=!0,t.autoClearDepthAndStencil=!0,t.clearColor=new x.Color4(.2,.2,.3,1),t.ambientColor=new x.Color3(0,0,0),t._forceWireframe=!1,t._forcePointsCloud=!1,t.animationsEnabled=!0,t._animationPropertiesOverride=null,t.useConstantAnimationDeltaTime=!1,t.constantlyUpdateMeshUnderPointer=!1,t.hoverCursor="pointer",t.defaultCursor="",t.preventDefaultOnPointerDown=!0,t.metadata=null,t.disableOfflineSupportExceptionRules=new Array,t.onDisposeObservable=new x.Observable,t._onDisposeObserver=null,t.onBeforeRenderObservable=new x.Observable,t._onBeforeRenderObserver=null,t.onAfterRenderObservable=new x.Observable,t._onAfterRenderObserver=null,t.onBeforeAnimationsObservable=new x.Observable,t.onAfterAnimationsObservable=new x.Observable,t.onBeforeDrawPhaseObservable=new x.Observable,t.onAfterDrawPhaseObservable=new x.Observable,t.onReadyObservable=new x.Observable,t.onBeforeCameraRenderObservable=new x.Observable,t._onBeforeCameraRenderObserver=null,t.onAfterCameraRenderObservable=new x.Observable,t._onAfterCameraRenderObserver=null,t.onBeforeActiveMeshesEvaluationObservable=new x.Observable,t.onAfterActiveMeshesEvaluationObservable=new x.Observable,t.onBeforeParticlesRenderingObservable=new x.Observable,t.onAfterParticlesRenderingObservable=new x.Observable,t.onDataLoadedObservable=new x.Observable,t.onNewCameraAddedObservable=new x.Observable,t.onCameraRemovedObservable=new x.Observable,t.onNewLightAddedObservable=new x.Observable,t.onLightRemovedObservable=new x.Observable,t.onNewGeometryAddedObservable=new x.Observable,t.onGeometryRemovedObservable=new x.Observable,t.onNewTransformNodeAddedObservable=new x.Observable,t.onTransformNodeRemovedObservable=new x.Observable,t.onNewMeshAddedObservable=new x.Observable,t.onMeshRemovedObservable=new x.Observable,t.onNewMaterialAddedObservable=new x.Observable,t.onMaterialRemovedObservable=new x.Observable,t.onNewTextureAddedObservable=new x.Observable,t.onTextureRemovedObservable=new x.Observable,t.onBeforeRenderTargetsRenderObservable=new x.Observable,t.onAfterRenderTargetsRenderObservable=new x.Observable,t.onBeforeStepObservable=new x.Observable,t.onAfterStepObservable=new x.Observable,t.onBeforeRenderingGroupObservable=new x.Observable,t.onAfterRenderingGroupObservable=new x.Observable,t.onMeshImportedObservable=new x.Observable,t._registeredForLateAnimationBindings=new x.SmartArrayNoDuplicate(256),t.onPrePointerObservable=new x.Observable,t.onPointerObservable=new x.Observable,t._meshPickProceed=!1,t._currentPickResult=null,t._previousPickResult=null,t._totalPointersPressed=0,t._doubleClickOccured=!1,t.cameraToUseForPointers=null,t._pointerX=0,t._pointerY=0,t._startingPointerPosition=new x.Vector2(0,0),t._previousStartingPointerPosition=new x.Vector2(0,0),t._startingPointerTime=0,t._previousStartingPointerTime=0,t._pointerCaptures={},t._timeAccumulator=0,t._currentStepId=0,t._currentInternalStep=0,t.onPreKeyboardObservable=new x.Observable,t.onKeyboardObservable=new x.Observable,t._useRightHandedSystem=!1,t._fogEnabled=!0,t._fogMode=E.FOGMODE_NONE,t.fogColor=new x.Color3(.2,.2,.3),t.fogDensity=.1,t.fogStart=0,t.fogEnd=1e3,t._shadowsEnabled=!0,t._lightsEnabled=!0,t.activeCameras=new Array,t._texturesEnabled=!0,t.particlesEnabled=!0,t.spritesEnabled=!0,t._skeletonsEnabled=!0,t.lensFlaresEnabled=!0,t.collisionsEnabled=!0,t.gravity=new x.Vector3(0,-9.807,0),t.postProcessesEnabled=!0,t.postProcesses=new Array,t.renderTargetsEnabled=!0,t.dumpNextRenderTargets=!1,t.customRenderTargets=new Array,t.importedMeshesFiles=new Array,t.probesEnabled=!0,t._meshesForIntersections=new x.SmartArrayNoDuplicate(256),t.proceduralTexturesEnabled=!0,t._totalVertices=new x.PerfCounter,t._activeIndices=new x.PerfCounter,t._activeParticles=new x.PerfCounter,t._activeBones=new x.PerfCounter,t._animationTime=0,t.animationTimeScale=1,t._renderId=0,t._frameId=0,t._executeWhenReadyTimeoutId=-1,t._intermediateRendering=!1,t._viewUpdateFlag=-1,t._projectionUpdateFlag=-1,t._alternateViewUpdateFlag=-1,t._alternateProjectionUpdateFlag=-1,t._toBeDisposed=new Array(256),t._activeRequests=new Array,t._pendingData=new Array,t._isDisposed=!1,t.dispatchAllSubMeshesOfActiveMeshes=!1,t._activeMeshes=new x.SmartArray(256),t._processedMaterials=new x.SmartArray(256),t._renderTargets=new x.SmartArrayNoDuplicate(256),t._activeParticleSystems=new x.SmartArray(256),t._activeSkeletons=new x.SmartArrayNoDuplicate(32),t._softwareSkinnedMeshes=new x.SmartArrayNoDuplicate(32),t._activeAnimatables=new Array,t._transformMatrix=x.Matrix.Zero(),t._useAlternateCameraConfiguration=!1,t._alternateRendering=!1,t.requireLightSorting=!1,t._components=[],t._serializableComponents=[],t._transientComponents=[],t._beforeCameraUpdateStage=x.Stage.Create(),t._beforeClearStage=x.Stage.Create(),t._gatherRenderTargetsStage=x.Stage.Create(),t._gatherActiveCameraRenderTargetsStage=x.Stage.Create(),t._isReadyForMeshStage=x.Stage.Create(),t._beforeEvaluateActiveMeshStage=x.Stage.Create(),t._evaluateSubMeshStage=x.Stage.Create(),t._activeMeshStage=x.Stage.Create(),t._cameraDrawRenderTargetStage=x.Stage.Create(),t._beforeCameraDrawStage=x.Stage.Create(),t._beforeRenderingGroupDrawStage=x.Stage.Create(),t._beforeRenderingMeshStage=x.Stage.Create(),t._afterRenderingMeshStage=x.Stage.Create(),t._afterRenderingGroupDrawStage=x.Stage.Create(),t._afterCameraDrawStage=x.Stage.Create(),t._afterRenderStage=x.Stage.Create(),t._pointerMoveStage=x.Stage.Create(),t._pointerDownStage=x.Stage.Create(),t._pointerUpStage=x.Stage.Create(),t._defaultMeshCandidates={data:[],length:0},t._defaultSubMeshCandidates={data:[],length:0},t._activeMeshesFrozen=!1,t._allowPostProcessClearColor=!0,t.getDeterministicFrameTime=function(){return 1e3/60},t._tempPickingRay=x.Ray?x.Ray.Zero():null,t._blockMaterialDirtyMechanism=!1,t._engine=e||x.Engine.LastCreatedEngine,t._engine.scenes.push(t),t._uid=null,t._renderingManager=new x.RenderingManager(t),x.PostProcessManager&&(t.postProcessManager=new x.PostProcessManager(t)),x.Tools.IsWindowObjectExist()&&t.attachControl(),t.workerCollisions=!1,t._createUbo(),x.ImageProcessingConfiguration&&(t._imageProcessingConfiguration=new x.ImageProcessingConfiguration),t.setDefaultCandidateProviders(),t}return T(E,i),Object.defineProperty(E.prototype,"environmentTexture",{get:function(){return this._environmentTexture},set:function(e){this._environmentTexture!==e&&(this._environmentTexture=e,this.markAllMaterialsAsDirty(x.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"forceWireframe",{get:function(){return this._forceWireframe},set:function(e){this._forceWireframe!==e&&(this._forceWireframe=e,this.markAllMaterialsAsDirty(x.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"forcePointsCloud",{get:function(){return this._forcePointsCloud},set:function(e){this._forcePointsCloud!==e&&(this._forcePointsCloud=e,this.markAllMaterialsAsDirty(x.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"beforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),e&&(this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"afterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),e&&(this._onAfterRenderObserver=this.onAfterRenderObservable.add(e))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"beforeCameraRender",{set:function(e){this._onBeforeCameraRenderObserver&&this.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=this.onBeforeCameraRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"afterCameraRender",{set:function(e){this._onAfterCameraRenderObserver&&this.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=this.onAfterCameraRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"unTranslatedPointer",{get:function(){return new x.Vector2(this._unTranslatedPointerX,this._unTranslatedPointerY)},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"useRightHandedSystem",{get:function(){return this._useRightHandedSystem},set:function(e){this._useRightHandedSystem!==e&&(this._useRightHandedSystem=e,this.markAllMaterialsAsDirty(x.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),E.prototype.setStepId=function(e){this._currentStepId=e},E.prototype.getStepId=function(){return this._currentStepId},E.prototype.getInternalStep=function(){return this._currentInternalStep},Object.defineProperty(E.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAllMaterialsAsDirty(x.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"fogMode",{get:function(){return this._fogMode},set:function(e){this._fogMode!==e&&(this._fogMode=e,this.markAllMaterialsAsDirty(x.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"shadowsEnabled",{get:function(){return this._shadowsEnabled},set:function(e){this._shadowsEnabled!==e&&(this._shadowsEnabled=e,this.markAllMaterialsAsDirty(x.Material.LightDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"lightsEnabled",{get:function(){return this._lightsEnabled},set:function(e){this._lightsEnabled!==e&&(this._lightsEnabled=e,this.markAllMaterialsAsDirty(x.Material.LightDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"defaultMaterial",{get:function(){return this._defaultMaterial||(this._defaultMaterial=new x.StandardMaterial("default material",this)),this._defaultMaterial},set:function(e){this._defaultMaterial=e},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"texturesEnabled",{get:function(){return this._texturesEnabled},set:function(e){this._texturesEnabled!==e&&(this._texturesEnabled=e,this.markAllMaterialsAsDirty(x.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"skeletonsEnabled",{get:function(){return this._skeletonsEnabled},set:function(e){this._skeletonsEnabled!==e&&(this._skeletonsEnabled=e,this.markAllMaterialsAsDirty(x.Material.AttributesDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"_isAlternateRenderingEnabled",{get:function(){return this._alternateRendering},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"frustumPlanes",{get:function(){return this._frustumPlanes},enumerable:!0,configurable:!0}),E.prototype._registerTransientComponents=function(){if(0<this._transientComponents.length){for(var e=0,t=this._transientComponents;e<t.length;e++){t[e].register()}this._transientComponents=[]}},E.prototype._addComponent=function(e){this._components.push(e),this._transientComponents.push(e);var t=e;t.addFromContainer&&this._serializableComponents.push(t)},E.prototype._getComponent=function(e){for(var t=0,i=this._components;t<i.length;t++){var r=i[t];if(r.name===e)return r}return null},E.prototype._getDefaultMeshCandidates=function(){return this._defaultMeshCandidates.data=this.meshes,this._defaultMeshCandidates.length=this.meshes.length,this._defaultMeshCandidates},E.prototype._getDefaultSubMeshCandidates=function(e){return this._defaultSubMeshCandidates.data=e.subMeshes,this._defaultSubMeshCandidates.length=e.subMeshes.length,this._defaultSubMeshCandidates},E.prototype.setDefaultCandidateProviders=function(){this.getActiveMeshCandidates=this._getDefaultMeshCandidates.bind(this),this.getActiveSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getIntersectingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this),this.getCollidingSubMeshCandidates=this._getDefaultSubMeshCandidates.bind(this)},Object.defineProperty(E.prototype,"workerCollisions",{get:function(){return this._workerCollisions},set:function(e){x.CollisionCoordinatorLegacy&&(e=e&&!!Worker&&!!x.CollisionWorker,this._workerCollisions=e,this.collisionCoordinator&&this.collisionCoordinator.destroy(),this.collisionCoordinator=e?new x.CollisionCoordinatorWorker:new x.CollisionCoordinatorLegacy,this.collisionCoordinator.init(this))},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"meshUnderPointer",{get:function(){return this._pointerOverMesh},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"pointerX",{get:function(){return this._pointerX},enumerable:!0,configurable:!0}),Object.defineProperty(E.prototype,"pointerY",{get:function(){return this._pointerY},enumerable:!0,configurable:!0}),E.prototype.getCachedMaterial=function(){return this._cachedMaterial},E.prototype.getCachedEffect=function(){return this._cachedEffect},E.prototype.getCachedVisibility=function(){return this._cachedVisibility},E.prototype.isCachedMaterialInvalid=function(e,t,i){return void 0===i&&(i=1),this._cachedEffect!==t||this._cachedMaterial!==e||this._cachedVisibility!==i},E.prototype.getEngine=function(){return this._engine},E.prototype.getTotalVertices=function(){return this._totalVertices.current},Object.defineProperty(E.prototype,"totalVerticesPerfCounter",{get:function(){return this._totalVertices},enumerable:!0,configurable:!0}),E.prototype.getActiveIndices=function(){return this._activeIndices.current},Object.defineProperty(E.prototype,"totalActiveIndicesPerfCounter",{get:function(){return this._activeIndices},enumerable:!0,configurable:!0}),E.prototype.getActiveParticles=function(){return this._activeParticles.current},Object.defineProperty(E.prototype,"activeParticlesPerfCounter",{get:function(){return this._activeParticles},enumerable:!0,configurable:!0}),E.prototype.getActiveBones=function(){return this._activeBones.current},Object.defineProperty(E.prototype,"activeBonesPerfCounter",{get:function(){return this._activeBones},enumerable:!0,configurable:!0}),E.prototype.getInterFramePerfCounter=function(){return x.Tools.Warn("getInterFramePerfCounter is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(E.prototype,"interFramePerfCounter",{get:function(){return x.Tools.Warn("interFramePerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),E.prototype.getLastFrameDuration=function(){return x.Tools.Warn("getLastFrameDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(E.prototype,"lastFramePerfCounter",{get:function(){return x.Tools.Warn("lastFramePerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),E.prototype.getEvaluateActiveMeshesDuration=function(){return x.Tools.Warn("getEvaluateActiveMeshesDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(E.prototype,"evaluateActiveMeshesDurationPerfCounter",{get:function(){return x.Tools.Warn("evaluateActiveMeshesDurationPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),E.prototype.getActiveMeshes=function(){return this._activeMeshes},E.prototype.getRenderTargetsDuration=function(){return x.Tools.Warn("getRenderTargetsDuration is deprecated. Please use SceneInstrumentation class"),0},E.prototype.getRenderDuration=function(){return x.Tools.Warn("getRenderDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(E.prototype,"renderDurationPerfCounter",{get:function(){return x.Tools.Warn("renderDurationPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),E.prototype.getParticlesDuration=function(){return x.Tools.Warn("getParticlesDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(E.prototype,"particlesDurationPerfCounter",{get:function(){return x.Tools.Warn("particlesDurationPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),E.prototype.getSpritesDuration=function(){return x.Tools.Warn("getSpritesDuration is deprecated. Please use SceneInstrumentation class"),0},Object.defineProperty(E.prototype,"spriteDuractionPerfCounter",{get:function(){return x.Tools.Warn("spriteDuractionPerfCounter is deprecated. Please use SceneInstrumentation class"),null},enumerable:!0,configurable:!0}),E.prototype.getAnimationRatio=function(){return void 0!==this._animationRatio?this._animationRatio:1},E.prototype.getRenderId=function(){return this._renderId},E.prototype.getFrameId=function(){return this._frameId},E.prototype.incrementRenderId=function(){this._renderId++},E.prototype._updatePointerPosition=function(e){var t=this._engine.getRenderingCanvasClientRect();t&&(this._pointerX=e.clientX-t.left,this._pointerY=e.clientY-t.top,this._unTranslatedPointerX=this._pointerX,this._unTranslatedPointerY=this._pointerY)},E.prototype._createUbo=function(){this._sceneUbo=new x.UniformBuffer(this._engine,void 0,!0),this._sceneUbo.addUniform("viewProjection",16),this._sceneUbo.addUniform("view",16)},E.prototype._createAlternateUbo=function(){this._alternateSceneUbo=new x.UniformBuffer(this._engine,void 0,!0),this._alternateSceneUbo.addUniform("viewProjection",16),this._alternateSceneUbo.addUniform("view",16)},E.prototype._setRayOnPointerInfo=function(e){e.pickInfo&&(e.pickInfo.ray||(e.pickInfo.ray=this.createPickingRay(e.event.offsetX,e.event.offsetY,x.Matrix.Identity(),this.activeCamera)))},E.prototype.simulatePointerMove=function(e,t){var i=new PointerEvent("pointermove",t);return this._checkPrePointerObservable(e,i,x.PointerEventTypes.POINTERMOVE)?this:this._processPointerMove(e,i)},E.prototype._processPointerMove=function(e,t){var i=this._engine.getRenderingCanvas();if(!i)return this;i.style.cursor=this.defaultCursor;var r=!!(e&&e.hit&&e.pickedMesh);r?(this.setPointerOverMesh(e.pickedMesh),this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.hasPointerTriggers&&(this._pointerOverMesh.actionManager.hoverCursor?i.style.cursor=this._pointerOverMesh.actionManager.hoverCursor:i.style.cursor=this.hoverCursor)):this.setPointerOverMesh(null);for(var n=0,o=this._pointerMoveStage;n<o.length;n++){e=o[n].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,r,i)}if(e){var s="mousewheel"===t.type||"DOMMouseScroll"===t.type?x.PointerEventTypes.POINTERWHEEL:x.PointerEventTypes.POINTERMOVE;if(this.onPointerMove&&this.onPointerMove(t,e,s),this.onPointerObservable.hasObservers()){var a=new x.PointerInfo(s,t,e);this._setRayOnPointerInfo(a),this.onPointerObservable.notifyObservers(a,s)}}return this},E.prototype._checkPrePointerObservable=function(e,t,i){var r=new x.PointerInfoPre(i,t,this._unTranslatedPointerX,this._unTranslatedPointerY);return e&&(r.ray=e.ray),this.onPrePointerObservable.notifyObservers(r,i),!!r.skipOnPointerObservable},E.prototype.simulatePointerDown=function(e,t){var i=new PointerEvent("pointerdown",t);return this._checkPrePointerObservable(e,i,x.PointerEventTypes.POINTERDOWN)?this:this._processPointerDown(e,i)},E.prototype._processPointerDown=function(e,t){var i=this;if(e&&e.hit&&e.pickedMesh){this._pickedDownMesh=e.pickedMesh;var r=e.pickedMesh.actionManager;if(r){if(r.hasPickTriggers)switch(r.processTrigger(x.ActionManager.OnPickDownTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t)),t.button){case 0:r.processTrigger(x.ActionManager.OnLeftPickTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t));break;case 1:r.processTrigger(x.ActionManager.OnCenterPickTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t));break;case 2:r.processTrigger(x.ActionManager.OnRightPickTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t))}r.hasSpecificTrigger(x.ActionManager.OnLongPressTrigger)&&window.setTimeout((function(){var e=i.pick(i._unTranslatedPointerX,i._unTranslatedPointerY,(function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.actionManager&&e.actionManager.hasSpecificTrigger(x.ActionManager.OnLongPressTrigger)&&e==i._pickedDownMesh}),!1,i.cameraToUseForPointers);e&&e.hit&&e.pickedMesh&&r&&0!==i._totalPointersPressed&&Date.now()-i._startingPointerTime>E.LongPressDelay&&!i._isPointerSwiping()&&(i._startingPointerTime=0,r.processTrigger(x.ActionManager.OnLongPressTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t)))}),E.LongPressDelay)}}else for(var n=0,o=this._pointerDownStage;n<o.length;n++){e=o[n].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t)}if(e){var s=x.PointerEventTypes.POINTERDOWN;if(this.onPointerDown&&this.onPointerDown(t,e,s),this.onPointerObservable.hasObservers()){var a=new x.PointerInfo(s,t,e);this._setRayOnPointerInfo(a),this.onPointerObservable.notifyObservers(a,s)}}return this},E.prototype.simulatePointerUp=function(e,t){var i=new PointerEvent("pointerup",t),r=new u;return r.singleClick=!0,r.ignore=!0,this._checkPrePointerObservable(e,i,x.PointerEventTypes.POINTERUP)?this:this._processPointerUp(e,i,r)},E.prototype._processPointerUp=function(e,t,i){if(e&&e&&e.pickedMesh){if(this._pickedUpMesh=e.pickedMesh,this._pickedDownMesh===this._pickedUpMesh&&(this.onPointerPick&&this.onPointerPick(t,e),i.singleClick&&!i.ignore&&this.onPointerObservable.hasObservers())){var r=x.PointerEventTypes.POINTERPICK,n=new x.PointerInfo(r,t,e);this._setRayOnPointerInfo(n),this.onPointerObservable.notifyObservers(n,r)}e.pickedMesh.actionManager&&(i.ignore&&e.pickedMesh.actionManager.processTrigger(x.ActionManager.OnPickUpTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t)),i.hasSwiped||i.ignore||!i.singleClick||e.pickedMesh.actionManager.processTrigger(x.ActionManager.OnPickTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t)),i.doubleClick&&!i.ignore&&e.pickedMesh.actionManager.hasSpecificTrigger(x.ActionManager.OnDoublePickTrigger)&&e.pickedMesh.actionManager.processTrigger(x.ActionManager.OnDoublePickTrigger,x.ActionEvent.CreateNew(e.pickedMesh,t)))}else if(!i.ignore)for(var o=0,s=this._pointerUpStage;o<s.length;o++){e=s[o].action(this._unTranslatedPointerX,this._unTranslatedPointerY,e,t)}this._pickedDownMesh&&this._pickedDownMesh.actionManager&&this._pickedDownMesh.actionManager.hasSpecificTrigger(x.ActionManager.OnPickOutTrigger)&&this._pickedDownMesh!==this._pickedUpMesh&&this._pickedDownMesh.actionManager.processTrigger(x.ActionManager.OnPickOutTrigger,x.ActionEvent.CreateNew(this._pickedDownMesh,t));var a=x.PointerEventTypes.POINTERUP;if(this.onPointerObservable.hasObservers())if(i.ignore){n=new x.PointerInfo(a,t,e);this._setRayOnPointerInfo(n),this.onPointerObservable.notifyObservers(n,a)}else if(!i.hasSwiped){if(i.singleClick&&this.onPointerObservable.hasSpecificMask(x.PointerEventTypes.POINTERTAP)){var l=x.PointerEventTypes.POINTERTAP,n=new x.PointerInfo(l,t,e);this._setRayOnPointerInfo(n),this.onPointerObservable.notifyObservers(n,l)}if(i.doubleClick&&this.onPointerObservable.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP)){var c=x.PointerEventTypes.POINTERDOUBLETAP;n=new x.PointerInfo(c,t,e);this._setRayOnPointerInfo(n),this.onPointerObservable.notifyObservers(n,c)}}return this.onPointerUp&&this.onPointerUp(t,e,a),this},E.prototype.isPointerCaptured=function(e){return void 0===e&&(e=0),this._pointerCaptures[e]},E.prototype._isPointerSwiping=function(){return Math.abs(this._startingPointerPosition.x-this._pointerX)>E.DragMovementThreshold||Math.abs(this._startingPointerPosition.y-this._pointerY)>E.DragMovementThreshold},E.prototype.attachControl=function(e,t,i){var h=this;void 0===e&&(e=!0),void 0===t&&(t=!0),void 0===i&&(i=!0),this._initActionManager=function(e,t){if(!h._meshPickProceed){var i=h.pick(h._unTranslatedPointerX,h._unTranslatedPointerY,h.pointerDownPredicate,!1,h.cameraToUseForPointers);(h._currentPickResult=i)&&(e=i.hit&&i.pickedMesh?i.pickedMesh.actionManager:null),h._meshPickProceed=!0}return e},this._delayedSimpleClick=function(e,t,i){(Date.now()-h._previousStartingPointerTime>E.DoubleClickDelay&&!h._doubleClickOccured||e!==h._previousButtonPressed)&&(h._doubleClickOccured=!1,t.singleClick=!0,t.ignore=!1,i(t,h._currentPickResult))},this._initClickEvent=function(e,t,i,r){var n=new u,o=h._currentPickResult=null,s=e.hasSpecificMask(x.PointerEventTypes.POINTERPICK)||t.hasSpecificMask(x.PointerEventTypes.POINTERPICK)||e.hasSpecificMask(x.PointerEventTypes.POINTERTAP)||t.hasSpecificMask(x.PointerEventTypes.POINTERTAP)||e.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP)||t.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP);if(!s&&x.ActionManager&&x.ActionManager.HasPickTriggers&&(o=h._initActionManager(o,n))&&(s=o.hasPickTriggers),s){var a=i.button;if(n.hasSwiped=h._isPointerSwiping(),!n.hasSwiped){var l=!E.ExclusiveDoubleClickMode;l||(l=!e.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP)&&!t.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP))&&!x.ActionManager.HasSpecificTrigger(x.ActionManager.OnDoublePickTrigger)&&(o=h._initActionManager(o,n))&&(l=!o.hasSpecificTrigger(x.ActionManager.OnDoublePickTrigger)),l?(Date.now()-h._previousStartingPointerTime>E.DoubleClickDelay||a!==h._previousButtonPressed)&&(n.singleClick=!0,r(n,h._currentPickResult)):(h._previousDelayedSimpleClickTimeout=h._delayedSimpleClickTimeout,h._delayedSimpleClickTimeout=window.setTimeout(h._delayedSimpleClick.bind(h,a,n,r),E.DoubleClickDelay));var c=e.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP)||t.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP);!c&&x.ActionManager.HasSpecificTrigger(x.ActionManager.OnDoublePickTrigger)&&(o=h._initActionManager(o,n))&&(c=o.hasSpecificTrigger(x.ActionManager.OnDoublePickTrigger)),c&&(a===h._previousButtonPressed&&Date.now()-h._previousStartingPointerTime<E.DoubleClickDelay&&!h._doubleClickOccured?n.hasSwiped||h._isPointerSwiping()?(h._doubleClickOccured=!1,h._previousStartingPointerTime=h._startingPointerTime,h._previousStartingPointerPosition.x=h._startingPointerPosition.x,h._previousStartingPointerPosition.y=h._startingPointerPosition.y,h._previousButtonPressed=a,E.ExclusiveDoubleClickMode?(h._previousDelayedSimpleClickTimeout&&clearTimeout(h._previousDelayedSimpleClickTimeout),h._previousDelayedSimpleClickTimeout=h._delayedSimpleClickTimeout,r(n,h._previousPickResult)):r(n,h._currentPickResult)):(h._previousStartingPointerTime=0,h._doubleClickOccured=!0,n.doubleClick=!0,n.ignore=!1,E.ExclusiveDoubleClickMode&&h._previousDelayedSimpleClickTimeout&&clearTimeout(h._previousDelayedSimpleClickTimeout),h._previousDelayedSimpleClickTimeout=h._delayedSimpleClickTimeout,r(n,h._currentPickResult)):(h._doubleClickOccured=!1,h._previousStartingPointerTime=h._startingPointerTime,h._previousStartingPointerPosition.x=h._startingPointerPosition.x,h._previousStartingPointerPosition.y=h._startingPointerPosition.y,h._previousButtonPressed=a))}}n.ignore=!0,r(n,h._currentPickResult)},this._onPointerMove=function(e){if(h._updatePointerPosition(e),!h._checkPrePointerObservable(null,e,"mousewheel"===e.type||"DOMMouseScroll"===e.type?x.PointerEventTypes.POINTERWHEEL:x.PointerEventTypes.POINTERMOVE)&&(h.cameraToUseForPointers||h.activeCamera)){h.pointerMovePredicate||(h.pointerMovePredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()&&(e.enablePointerMoveEvents||h.constantlyUpdateMeshUnderPointer||null!==e.actionManager&&void 0!==e.actionManager)});var t=h.pick(h._unTranslatedPointerX,h._unTranslatedPointerY,h.pointerMovePredicate,!1,h.cameraToUseForPointers);h._processPointerMove(t,e)}},this._onPointerDown=function(e){if(h._totalPointersPressed++,h._pickedDownMesh=null,h._meshPickProceed=!1,h._updatePointerPosition(e),h.preventDefaultOnPointerDown&&o&&(e.preventDefault(),o.focus()),!h._checkPrePointerObservable(null,e,x.PointerEventTypes.POINTERDOWN)&&(h.cameraToUseForPointers||h.activeCamera)){h._pointerCaptures[e.pointerId]=!0,h._startingPointerPosition.x=h._pointerX,h._startingPointerPosition.y=h._pointerY,h._startingPointerTime=Date.now(),h.pointerDownPredicate||(h.pointerDownPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()}),h._pickedDownMesh=null;var t=h.pick(h._unTranslatedPointerX,h._unTranslatedPointerY,h.pointerDownPredicate,!1,h.cameraToUseForPointers);h._processPointerDown(t,e)}},this._onPointerUp=function(i){0!==h._totalPointersPressed&&(h._totalPointersPressed--,h._pickedUpMesh=null,h._meshPickProceed=!1,h._updatePointerPosition(i),h._initClickEvent(h.onPrePointerObservable,h.onPointerObservable,i,(function(e,t){if(h.onPrePointerObservable.hasObservers())if(e.ignore){if(h._checkPrePointerObservable(null,i,x.PointerEventTypes.POINTERUP))return}else if(!e.hasSwiped){if(e.singleClick&&h.onPrePointerObservable.hasSpecificMask(x.PointerEventTypes.POINTERTAP)&&h._checkPrePointerObservable(null,i,x.PointerEventTypes.POINTERTAP))return;if(e.doubleClick&&h.onPrePointerObservable.hasSpecificMask(x.PointerEventTypes.POINTERDOUBLETAP)&&h._checkPrePointerObservable(null,i,x.PointerEventTypes.POINTERDOUBLETAP))return}(h.cameraToUseForPointers||h.activeCamera)&&(h._pointerCaptures[i.pointerId]=!1,h.pointerUpPredicate||(h.pointerUpPredicate=function(e){return e.isPickable&&e.isVisible&&e.isReady()&&e.isEnabled()}),!h._meshPickProceed&&(x.ActionManager&&x.ActionManager.HasTriggers||h.onPointerObservable.hasObservers())&&h._initActionManager(null,e),t||(t=h._currentPickResult),h._processPointerUp(t,i,e),h._previousPickResult=h._currentPickResult)})))},this._onKeyDown=function(e){var t=x.KeyboardEventTypes.KEYDOWN;if(h.onPreKeyboardObservable.hasObservers()){var i=new x.KeyboardInfoPre(t,e);if(h.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnPointerObservable)return}if(h.onKeyboardObservable.hasObservers()){i=new x.KeyboardInfo(t,e);h.onKeyboardObservable.notifyObservers(i,t)}h.actionManager&&h.actionManager.processTrigger(x.ActionManager.OnKeyDownTrigger,x.ActionEvent.CreateNewFromScene(h,e))},this._onKeyUp=function(e){var t=x.KeyboardEventTypes.KEYUP;if(h.onPreKeyboardObservable.hasObservers()){var i=new x.KeyboardInfoPre(t,e);if(h.onPreKeyboardObservable.notifyObservers(i,t),i.skipOnPointerObservable)return}if(h.onKeyboardObservable.hasObservers()){i=new x.KeyboardInfo(t,e);h.onKeyboardObservable.notifyObservers(i,t)}h.actionManager&&h.actionManager.processTrigger(x.ActionManager.OnKeyUpTrigger,x.ActionEvent.CreateNewFromScene(h,e))};var r=this.getEngine();this._onCanvasFocusObserver=r.onCanvasFocusObservable.add((function(){o&&(o.addEventListener("keydown",h._onKeyDown,!1),o.addEventListener("keyup",h._onKeyUp,!1))})),this._onCanvasBlurObserver=r.onCanvasBlurObservable.add((function(){o&&(o.removeEventListener("keydown",h._onKeyDown),o.removeEventListener("keyup",h._onKeyUp))}));var n=x.Tools.GetPointerPrefix(),o=this._engine.getRenderingCanvas();o&&(i&&(o.addEventListener(n+"move",this._onPointerMove,!1),o.addEventListener("mousewheel",this._onPointerMove,!1),o.addEventListener("DOMMouseScroll",this._onPointerMove,!1)),t&&o.addEventListener(n+"down",this._onPointerDown,!1),e&&window.addEventListener(n+"up",this._onPointerUp,!1),o.tabIndex=1)},E.prototype.detachControl=function(){var e=this.getEngine(),t=x.Tools.GetPointerPrefix(),i=e.getRenderingCanvas();i&&(i.removeEventListener(t+"move",this._onPointerMove),i.removeEventListener(t+"down",this._onPointerDown),window.removeEventListener(t+"up",this._onPointerUp),this._onCanvasBlurObserver&&e.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onCanvasFocusObserver&&e.onCanvasFocusObservable.remove(this._onCanvasFocusObserver),i.removeEventListener("mousewheel",this._onPointerMove),i.removeEventListener("DOMMouseScroll",this._onPointerMove),i.removeEventListener("keydown",this._onKeyDown),i.removeEventListener("keyup",this._onKeyUp),this.onKeyboardObservable.clear(),this.onPreKeyboardObservable.clear(),this.onPointerObservable.clear(),this.onPrePointerObservable.clear())},E.prototype.isReady=function(){if(this._isDisposed)return!1;if(0<this._pendingData.length)return!1;var e,t=this.getEngine();for(e=0;e<this.geometries.length;e++){if(this.geometries[e].delayLoadState===x.Engine.DELAYLOADSTATE_LOADING)return!1}for(e=0;e<this.meshes.length;e++){var i=this.meshes[e];if(i.isEnabled()&&(i.subMeshes&&0!==i.subMeshes.length)){if(!i.isReady(!0))return!1;for(var r="InstancedMesh"===i.getClassName()||t.getCaps().instancedArrays&&0<i.instances.length,n=0,o=this._isReadyForMeshStage;n<o.length;n++){if(!o[n].action(i,r))return!1}}}if(this.activeCameras&&0<this.activeCameras.length)for(var s=0,a=this.activeCameras;s<a.length;s++){if(!a[s].isReady(!0))return!1}else if(this.activeCamera&&!this.activeCamera.isReady(!0))return!1;for(var l=0,c=this.particleSystems;l<c.length;l++){if(!c[l].isReady())return!1}return!0},E.prototype.resetCachedMaterial=function(){this._cachedMaterial=null,this._cachedEffect=null,this._cachedVisibility=null},E.prototype.registerBeforeRender=function(e){this.onBeforeRenderObservable.add(e)},E.prototype.unregisterBeforeRender=function(e){this.onBeforeRenderObservable.removeCallback(e)},E.prototype.registerAfterRender=function(e){this.onAfterRenderObservable.add(e)},E.prototype.unregisterAfterRender=function(e){this.onAfterRenderObservable.removeCallback(e)},E.prototype._executeOnceBeforeRender=function(e){var t=this,i=function(){e(),setTimeout((function(){t.unregisterBeforeRender(i)}))};this.registerBeforeRender(i)},E.prototype.executeOnceBeforeRender=function(e,t){var i=this;void 0!==t?setTimeout((function(){i._executeOnceBeforeRender(e)}),t):this._executeOnceBeforeRender(e)},E.prototype._addPendingData=function(e){this._pendingData.push(e)},E.prototype._removePendingData=function(e){var t=this.isLoading,i=this._pendingData.indexOf(e);-1!==i&&this._pendingData.splice(i,1),t&&!this.isLoading&&this.onDataLoadedObservable.notifyObservers(this)},E.prototype.getWaitingItemsCount=function(){return this._pendingData.length},Object.defineProperty(E.prototype,"isLoading",{get:function(){return 0<this._pendingData.length},enumerable:!0,configurable:!0}),E.prototype.executeWhenReady=function(e){var t=this;this.onReadyObservable.add(e),-1===this._executeWhenReadyTimeoutId&&(this._executeWhenReadyTimeoutId=setTimeout((function(){t._checkIsReady()}),150))},E.prototype.whenReadyAsync=function(){var t=this;return new Promise(function(e){t.executeWhenReady((function(){e()}))})},E.prototype._checkIsReady=function(){var e=this;if(this._registerTransientComponents(),this.isReady())return this.onReadyObservable.notifyObservers(this),this.onReadyObservable.clear(),void(this._executeWhenReadyTimeoutId=-1);this._executeWhenReadyTimeoutId=setTimeout((function(){e._checkIsReady()}),150)},E.prototype.beginWeightedAnimation=function(e,t,i,r,n,o,s,a,l){void 0===r&&(r=1),void 0===o&&(o=1);var c=this.beginAnimation(e,t,i,n,o,s,a,!1,l);return c.weight=r,c},E.prototype.beginAnimation=function(e,t,i,r,n,o,s,a,l){void 0===n&&(n=1),void 0===a&&(a=!0),i<t&&0<n&&(n*=-1),a&&this.stopAnimation(e,void 0,l),s||(s=new x.Animatable(this,e,t,i,r,n,o));var c=!l||l(e);if(e.animations&&c&&s.appendAnimations(e,e.animations),e.getAnimatables)for(var h=e.getAnimatables(),u=0;u<h.length;u++)this.beginAnimation(h[u],t,i,r,n,o,s,a,l);return s.reset(),s},E.prototype.beginDirectAnimation=function(e,t,i,r,n,o,s){return void 0===o&&(o=1),new x.Animatable(this,e,i,r,n,o,s,t)},E.prototype.beginDirectHierarchyAnimation=function(e,t,i,r,n,o,s,a){var l=e.getDescendants(t),c=[];c.push(this.beginDirectAnimation(e,i,r,n,o,s,a));for(var h=0,u=l;h<u.length;h++){var d=u[h];c.push(this.beginDirectAnimation(d,i,r,n,o,s,a))}return c},E.prototype.getAnimatableByTarget=function(e){for(var t=0;t<this._activeAnimatables.length;t++)if(this._activeAnimatables[t].target===e)return this._activeAnimatables[t];return null},E.prototype.getAllAnimatablesByTarget=function(e){for(var t=[],i=0;i<this._activeAnimatables.length;i++)this._activeAnimatables[i].target===e&&t.push(this._activeAnimatables[i]);return t},Object.defineProperty(E.prototype,"animatables",{get:function(){return this._activeAnimatables},enumerable:!0,configurable:!0}),E.prototype.stopAnimation=function(e,t,i){for(var r=0,n=this.getAllAnimatablesByTarget(e);r<n.length;r++){n[r].stop(t,i)}},E.prototype.stopAllAnimations=function(){if(this._activeAnimatables){for(var e=0;e<this._activeAnimatables.length;e++)this._activeAnimatables[e].stop();this._activeAnimatables=[]}for(var t=0,i=this.animationGroups;t<i.length;t++){i[t].stop()}},E.prototype._animate=function(){if(this.animationsEnabled&&0!==this._activeAnimatables.length){var e=x.Tools.Now;if(!this._animationTimeLast){if(0<this._pendingData.length)return;this._animationTimeLast=e}var t=this.useConstantAnimationDeltaTime?16:(e-this._animationTimeLast)*this.animationTimeScale;this._animationTime+=t,this._animationTimeLast=e;for(var i=0;i<this._activeAnimatables.length;i++)this._activeAnimatables[i]._animate(this._animationTime);this._processLateAnimationBindings()}},E.prototype._registerTargetForLateAnimationBinding=function(e,t){var i=e.target;this._registeredForLateAnimationBindings.pushNoDuplicate(i),i._lateAnimationHolders||(i._lateAnimationHolders={}),i._lateAnimationHolders[e.targetPath]||(i._lateAnimationHolders[e.targetPath]={totalWeight:0,animations:[],originalValue:t}),i._lateAnimationHolders[e.targetPath].animations.push(e),i._lateAnimationHolders[e.targetPath].totalWeight+=e.weight},E.prototype._processLateAnimationBindingsForMatrices=function(e){var t=1,i=x.Tmp.Vector3[0],r=x.Tmp.Vector3[1],n=x.Tmp.Quaternion[0],o=0,s=e.animations[0],a=e.originalValue,l=1;if(e.totalWeight<1)a.decompose(r,n,i),l=1-e.totalWeight;else if(o=1,t=e.totalWeight,s.currentValue.decompose(r,n,i),1==(l=s.weight/t))return s.currentValue;r.scaleInPlace(l),i.scaleInPlace(l),n.scaleInPlace(l);for(var c=o;c<e.animations.length;c++){var h=e.animations[c],u=(l=h.weight/t,x.Tmp.Vector3[2]),d=x.Tmp.Vector3[3],f=x.Tmp.Quaternion[1];h.currentValue.decompose(d,f,u),d.scaleAndAddToRef(l,r),f.scaleAndAddToRef(l,n),u.scaleAndAddToRef(l,i)}return x.Matrix.ComposeToRef(r,n,i,s._workValue),s._workValue},E.prototype._processLateAnimationBindingsForQuaternions=function(e,t){var i=e.animations[0],r=e.originalValue;if(1===e.animations.length)return x.Quaternion.SlerpToRef(r,i.currentValue,Math.min(1,e.totalWeight),t),t;var n,o,s=1;if(e.totalWeight<1){var a=1-e.totalWeight;o=[],(n=[]).push(r),o.push(a)}else{if(2===e.animations.length)return x.Quaternion.SlerpToRef(e.animations[0].currentValue,e.animations[1].currentValue,e.animations[1].weight/e.totalWeight,t),t;n=[],o=[],s=e.totalWeight}for(var l=0;l<e.animations.length;l++){var c=e.animations[l];n.push(c.currentValue),o.push(c.weight/s)}for(var h=0,u=null,d=0;d<n.length;)u?(h+=o[d],x.Quaternion.SlerpToRef(u,n[d],o[d]/h,u),d++):(x.Quaternion.SlerpToRef(n[d],n[d+1],o[d+1]/(o[d]+o[d+1]),t),u=t,h=o[d]+o[d+1],d+=2);return u},E.prototype._processLateAnimationBindings=function(){if(this._registeredForLateAnimationBindings.length){for(var e=0;e<this._registeredForLateAnimationBindings.length;e++){var t=this._registeredForLateAnimationBindings.data[e];for(var i in t._lateAnimationHolders){var r=t._lateAnimationHolders[i],n=r.animations[0],o=r.originalValue,s=x.Animation.AllowMatrixDecomposeForInterpolation&&o.m,a=t[i];if(s)a=this._processLateAnimationBindingsForMatrices(r);else if(void 0!==o.w)a=this._processLateAnimationBindingsForQuaternions(r,a||x.Quaternion.Identity());else{var l=0,c=1;if(r.totalWeight<1)a=o.scale?o.scale(1-r.totalWeight):o*(1-r.totalWeight);else{c=r.totalWeight;var h=n.weight/c;a=1!==h?n.currentValue.scale?n.currentValue.scale(h):n.currentValue*h:n.currentValue,l=1}for(var u=l;u<r.animations.length;u++){var d=r.animations[u],f=d.weight/c;d.currentValue.scaleAndAddToRef?d.currentValue.scaleAndAddToRef(f,a):a+=d.currentValue*f}}t[i]=a}t._lateAnimationHolders={}}this._registeredForLateAnimationBindings.reset()}},E.prototype._switchToAlternateCameraConfiguration=function(e){this._useAlternateCameraConfiguration=e},E.prototype.getViewMatrix=function(){return this._useAlternateCameraConfiguration?this._alternateViewMatrix:this._viewMatrix},E.prototype.getProjectionMatrix=function(){return this._useAlternateCameraConfiguration?this._alternateProjectionMatrix:this._projectionMatrix},E.prototype.getTransformMatrix=function(){return this._useAlternateCameraConfiguration?this._alternateTransformMatrix:this._transformMatrix},E.prototype.setTransformMatrix=function(e,t){if(this._viewUpdateFlag!==e.updateFlag||this._projectionUpdateFlag!==t.updateFlag){if(this._viewUpdateFlag=e.updateFlag,this._projectionUpdateFlag=t.updateFlag,this._viewMatrix=e,this._projectionMatrix=t,this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix),this._frustumPlanes?x.Frustum.GetPlanesToRef(this._transformMatrix,this._frustumPlanes):this._frustumPlanes=x.Frustum.GetPlanes(this._transformMatrix),this.activeCamera&&this.activeCamera._alternateCamera){var i=this.activeCamera._alternateCamera;i.getViewMatrix().multiplyToRef(i.getProjectionMatrix(),x.Tmp.Matrix[0]),x.Frustum.GetRightPlaneToRef(x.Tmp.Matrix[0],this._frustumPlanes[3])}this._sceneUbo.useUbo&&(this._sceneUbo.updateMatrix("viewProjection",this._transformMatrix),this._sceneUbo.updateMatrix("view",this._viewMatrix),this._sceneUbo.update())}},E.prototype._setAlternateTransformMatrix=function(e,t){this._alternateViewUpdateFlag===e.updateFlag&&this._alternateProjectionUpdateFlag===t.updateFlag||(this._alternateViewUpdateFlag=e.updateFlag,this._alternateProjectionUpdateFlag=t.updateFlag,this._alternateViewMatrix=e,this._alternateProjectionMatrix=t,this._alternateTransformMatrix||(this._alternateTransformMatrix=x.Matrix.Zero()),this._alternateViewMatrix.multiplyToRef(this._alternateProjectionMatrix,this._alternateTransformMatrix),this._alternateSceneUbo||this._createAlternateUbo(),this._alternateSceneUbo.useUbo&&(this._alternateSceneUbo.updateMatrix("viewProjection",this._alternateTransformMatrix),this._alternateSceneUbo.updateMatrix("view",this._alternateViewMatrix),this._alternateSceneUbo.update()))},E.prototype.getSceneUniformBuffer=function(){return this._useAlternateCameraConfiguration?this._alternateSceneUbo:this._sceneUbo},E.prototype.getUniqueId=function(){var e=E._uniqueIdCounter;return E._uniqueIdCounter++,e},E.prototype.addMesh=function(e,t){var i=this;void 0===t&&(t=!1),this.meshes.push(e),this.collisionCoordinator&&this.collisionCoordinator.onMeshAdded(e),e._resyncLightSources(),this.onNewMeshAddedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.addMesh(e)}))},E.prototype.removeMesh=function(e,t){var i=this;void 0===t&&(t=!1);var r=this.meshes.indexOf(e);return-1!==r&&this.meshes.splice(r,1),this.onMeshRemovedObservable.notifyObservers(e),t&&e.getChildMeshes().forEach((function(e){i.removeMesh(e)})),r},E.prototype.addTransformNode=function(e){this.transformNodes.push(e),this.onNewTransformNodeAddedObservable.notifyObservers(e)},E.prototype.removeTransformNode=function(e){var t=this.transformNodes.indexOf(e);return-1!==t&&this.transformNodes.splice(t,1),this.onTransformNodeRemovedObservable.notifyObservers(e),t},E.prototype.removeSkeleton=function(e){var t=this.skeletons.indexOf(e);return-1!==t&&this.skeletons.splice(t,1),t},E.prototype.removeMorphTargetManager=function(e){var t=this.morphTargetManagers.indexOf(e);return-1!==t&&this.morphTargetManagers.splice(t,1),t},E.prototype.removeLight=function(e){var t=this.lights.indexOf(e);if(-1!==t){for(var i=0,r=this.meshes;i<r.length;i++){r[i]._removeLightSource(e)}this.lights.splice(t,1),this.sortLightsByPriority()}return this.onLightRemovedObservable.notifyObservers(e),t},E.prototype.removeCamera=function(e){var t=this.cameras.indexOf(e);-1!==t&&this.cameras.splice(t,1);var i=this.activeCameras.indexOf(e);return-1!==i&&this.activeCameras.splice(i,1),this.activeCamera===e&&(0<this.cameras.length?this.activeCamera=this.cameras[0]:this.activeCamera=null),this.onCameraRemovedObservable.notifyObservers(e),t},E.prototype.removeParticleSystem=function(e){var t=this.particleSystems.indexOf(e);return-1!==t&&this.particleSystems.splice(t,1),t},E.prototype.removeAnimation=function(e){var t=this.animations.indexOf(e);return-1!==t&&this.animations.splice(t,1),t},E.prototype.removeAnimationGroup=function(e){var t=this.animationGroups.indexOf(e);return-1!==t&&this.animationGroups.splice(t,1),t},E.prototype.removeMultiMaterial=function(e){var t=this.multiMaterials.indexOf(e);return-1!==t&&this.multiMaterials.splice(t,1),t},E.prototype.removeMaterial=function(e){var t=this.materials.indexOf(e);return-1!==t&&this.materials.splice(t,1),this.onMaterialRemovedObservable.notifyObservers(e),t},E.prototype.removeActionManager=function(e){var t=this.actionManagers.indexOf(e);return-1!==t&&this.actionManagers.splice(t,1),t},E.prototype.removeTexture=function(e){var t=this.textures.indexOf(e);return-1!==t&&this.textures.splice(t,1),this.onTextureRemovedObservable.notifyObservers(e),t},E.prototype.addLight=function(e){this.lights.push(e),this.sortLightsByPriority();for(var t=0,i=this.meshes;t<i.length;t++){var r=i[t];-1===r._lightSources.indexOf(e)&&(r._lightSources.push(e),r._resyncLightSources())}this.onNewLightAddedObservable.notifyObservers(e)},E.prototype.sortLightsByPriority=function(){this.requireLightSorting&&this.lights.sort(x.Light.CompareLightsPriority)},E.prototype.addCamera=function(e){this.cameras.push(e),this.onNewCameraAddedObservable.notifyObservers(e)},E.prototype.addSkeleton=function(e){this.skeletons.push(e)},E.prototype.addParticleSystem=function(e){this.particleSystems.push(e)},E.prototype.addAnimation=function(e){this.animations.push(e)},E.prototype.addAnimationGroup=function(e){this.animationGroups.push(e)},E.prototype.addMultiMaterial=function(e){this.multiMaterials.push(e)},E.prototype.addMaterial=function(e){this.materials.push(e),this.onNewMaterialAddedObservable.notifyObservers(e)},E.prototype.addMorphTargetManager=function(e){this.morphTargetManagers.push(e)},E.prototype.addGeometry=function(e){this.geometries.push(e)},E.prototype.addActionManager=function(e){this.actionManagers.push(e)},E.prototype.addTexture=function(e){this.textures.push(e),this.onNewTextureAddedObservable.notifyObservers(e)},E.prototype.switchActiveCamera=function(e,t){void 0===t&&(t=!0);var i=this._engine.getRenderingCanvas();i&&(this.activeCamera&&this.activeCamera.detachControl(i),this.activeCamera=e,t&&e.attachControl(i))},E.prototype.setActiveCameraByID=function(e){var t=this.getCameraByID(e);return t?this.activeCamera=t:null},E.prototype.setActiveCameraByName=function(e){var t=this.getCameraByName(e);return t?this.activeCamera=t:null},E.prototype.getAnimationGroupByName=function(e){for(var t=0;t<this.animationGroups.length;t++)if(this.animationGroups[t].name===e)return this.animationGroups[t];return null},E.prototype.getMaterialByID=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].id===e)return this.materials[t];return null},E.prototype.getMaterialByName=function(e){for(var t=0;t<this.materials.length;t++)if(this.materials[t].name===e)return this.materials[t];return null},E.prototype.getCameraByID=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].id===e)return this.cameras[t];return null},E.prototype.getCameraByUniqueID=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].uniqueId===e)return this.cameras[t];return null},E.prototype.getCameraByName=function(e){for(var t=0;t<this.cameras.length;t++)if(this.cameras[t].name===e)return this.cameras[t];return null},E.prototype.getBoneByID=function(e){for(var t=0;t<this.skeletons.length;t++)for(var i=this.skeletons[t],r=0;r<i.bones.length;r++)if(i.bones[r].id===e)return i.bones[r];return null},E.prototype.getBoneByName=function(e){for(var t=0;t<this.skeletons.length;t++)for(var i=this.skeletons[t],r=0;r<i.bones.length;r++)if(i.bones[r].name===e)return i.bones[r];return null},E.prototype.getLightByName=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].name===e)return this.lights[t];return null},E.prototype.getLightByID=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].id===e)return this.lights[t];return null},E.prototype.getLightByUniqueID=function(e){for(var t=0;t<this.lights.length;t++)if(this.lights[t].uniqueId===e)return this.lights[t];return null},E.prototype.getParticleSystemByID=function(e){for(var t=0;t<this.particleSystems.length;t++)if(this.particleSystems[t].id===e)return this.particleSystems[t];return null},E.prototype.getGeometryByID=function(e){for(var t=0;t<this.geometries.length;t++)if(this.geometries[t].id===e)return this.geometries[t];return null},E.prototype.pushGeometry=function(e,t){return!(!t&&this.getGeometryByID(e.id))&&(this.geometries.push(e),this.collisionCoordinator&&this.collisionCoordinator.onGeometryAdded(e),this.onNewGeometryAddedObservable.notifyObservers(e),!0)},E.prototype.removeGeometry=function(e){var t=this.geometries.indexOf(e);return-1<t&&(this.geometries.splice(t,1),this.collisionCoordinator&&this.collisionCoordinator.onGeometryDeleted(e),this.onGeometryRemovedObservable.notifyObservers(e),!0)},E.prototype.getGeometries=function(){return this.geometries},E.prototype.getMeshByID=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].id===e)return this.meshes[t];return null},E.prototype.getMeshesByID=function(t){return this.meshes.filter((function(e){return e.id===t}))},E.prototype.getTransformNodeByID=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].id===e)return this.transformNodes[t];return null},E.prototype.getTransformNodesByID=function(t){return this.transformNodes.filter((function(e){return e.id===t}))},E.prototype.getMeshByUniqueID=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].uniqueId===e)return this.meshes[t];return null},E.prototype.getLastMeshByID=function(e){for(var t=this.meshes.length-1;0<=t;t--)if(this.meshes[t].id===e)return this.meshes[t];return null},E.prototype.getLastEntryByID=function(e){var t;for(t=this.meshes.length-1;0<=t;t--)if(this.meshes[t].id===e)return this.meshes[t];for(t=this.transformNodes.length-1;0<=t;t--)if(this.transformNodes[t].id===e)return this.transformNodes[t];for(t=this.cameras.length-1;0<=t;t--)if(this.cameras[t].id===e)return this.cameras[t];for(t=this.lights.length-1;0<=t;t--)if(this.lights[t].id===e)return this.lights[t];return null},E.prototype.getNodeByID=function(e){var t=this.getMeshByID(e);if(t)return t;var i=this.getLightByID(e);if(i)return i;var r=this.getCameraByID(e);return r||this.getBoneByID(e)},E.prototype.getNodeByName=function(e){var t=this.getMeshByName(e);if(t)return t;var i=this.getLightByName(e);if(i)return i;var r=this.getCameraByName(e);return r||this.getBoneByName(e)},E.prototype.getMeshByName=function(e){for(var t=0;t<this.meshes.length;t++)if(this.meshes[t].name===e)return this.meshes[t];return null},E.prototype.getTransformNodeByName=function(e){for(var t=0;t<this.transformNodes.length;t++)if(this.transformNodes[t].name===e)return this.transformNodes[t];return null},E.prototype.getLastSkeletonByID=function(e){for(var t=this.skeletons.length-1;0<=t;t--)if(this.skeletons[t].id===e)return this.skeletons[t];return null},E.prototype.getSkeletonById=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].id===e)return this.skeletons[t];return null},E.prototype.getSkeletonByName=function(e){for(var t=0;t<this.skeletons.length;t++)if(this.skeletons[t].name===e)return this.skeletons[t];return null},E.prototype.getMorphTargetManagerById=function(e){for(var t=0;t<this.morphTargetManagers.length;t++)if(this.morphTargetManagers[t].uniqueId===e)return this.morphTargetManagers[t];return null},E.prototype.isActiveMesh=function(e){return-1!==this._activeMeshes.indexOf(e)},Object.defineProperty(E.prototype,"uid",{get:function(){return this._uid||(this._uid=x.Tools.RandomId()),this._uid},enumerable:!0,configurable:!0}),E.prototype.addExternalData=function(e,t){return this._externalData||(this._externalData=new x.StringDictionary),this._externalData.add(e,t)},E.prototype.getExternalData=function(e){return this._externalData?this._externalData.get(e):null},E.prototype.getOrAddExternalDataWithFactory=function(e,t){return this._externalData||(this._externalData=new x.StringDictionary),this._externalData.getOrAddWithFactory(e,t)},E.prototype.removeExternalData=function(e){return this._externalData.remove(e)},E.prototype._evaluateSubMesh=function(e,t){if(this.dispatchAllSubMeshesOfActiveMeshes||t.alwaysSelectAsActiveMesh||1===t.subMeshes.length||e.isInFrustum(this._frustumPlanes)){for(var i=0,r=this._evaluateSubMeshStage;i<r.length;i++){r[i].action(t,e)}var n=e.getMaterial();null!=n&&(n.hasRenderTargetTextures&&void 0!==n.getRenderTargetTextures&&-1===this._processedMaterials.indexOf(n)&&(this._processedMaterials.push(n),this._renderTargets.concatWithNoDuplicate(n.getRenderTargetTextures())),this._activeIndices.addCount(e.indexCount,!1),this._renderingManager.dispatch(e,t,n))}},E.prototype.freeProcessedMaterials=function(){this._processedMaterials.dispose()},E.prototype.freeActiveMeshes=function(){if(this._activeMeshes.dispose(),this.activeCamera&&this.activeCamera._activeMeshes&&this.activeCamera._activeMeshes.dispose(),this.activeCameras)for(var e=0;e<this.activeCameras.length;e++){var t=this.activeCameras[e];t&&t._activeMeshes&&t._activeMeshes.dispose()}},E.prototype.freeRenderingGroups=function(){if(this._renderingManager&&this._renderingManager.freeRenderingGroups(),this.textures)for(var e=0;e<this.textures.length;e++){var t=this.textures[e];t&&t.renderList&&t.freeRenderingGroups()}},E.prototype._isInIntermediateRendering=function(){return this._intermediateRendering},E.prototype.freezeActiveMeshes=function(){return this.activeCamera&&(this._frustumPlanes||this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix()),this._evaluateActiveMeshes(),this._activeMeshesFrozen=!0),this},E.prototype.unfreezeActiveMeshes=function(){return this._activeMeshesFrozen=!1,this},E.prototype._evaluateActiveMeshes=function(){if((!this._activeMeshesFrozen||!this._activeMeshes.length)&&this.activeCamera){this.onBeforeActiveMeshesEvaluationObservable.notifyObservers(this),this.activeCamera._activeMeshes.reset(),this._activeMeshes.reset(),this._renderingManager.reset(),this._processedMaterials.reset(),this._activeParticleSystems.reset(),this._activeSkeletons.reset(),this._softwareSkinnedMeshes.reset();for(var e=0,t=this._beforeEvaluateActiveMeshStage;e<t.length;e++){t[e].action()}for(var i=this.getActiveMeshCandidates(),r=i.length,n=0;n<r;n++){var o=i.data[n];if(!o.isBlocked&&(this._totalVertices.addCount(o.getTotalVertices(),!1),o.isReady()&&o.isEnabled())){o.computeWorldMatrix(),o.actionManager&&o.actionManager.hasSpecificTriggers2(x.ActionManager.OnIntersectionEnterTrigger,x.ActionManager.OnIntersectionExitTrigger)&&this._meshesForIntersections.pushNoDuplicate(o);var s=o.getLOD(this.activeCamera);null!=s&&(o._preActivate(),o.isVisible&&0<o.visibility&&(o.alwaysSelectAsActiveMesh||0!=(o.layerMask&this.activeCamera.layerMask)&&o.isInFrustum(this._frustumPlanes))&&(this._activeMeshes.push(o),this.activeCamera._activeMeshes.push(o),o._activate(this._renderId),s!==o&&s._activate(this._renderId),this._activeMesh(o,s)))}}if(this.onAfterActiveMeshesEvaluationObservable.notifyObservers(this),this.particlesEnabled){this.onBeforeParticlesRenderingObservable.notifyObservers(this);for(var a=0;a<this.particleSystems.length;a++){var l=this.particleSystems[a];if(l.isStarted()&&l.emitter){var c=l.emitter;c.position&&!c.isEnabled()||(this._activeParticleSystems.push(l),l.animate(),this._renderingManager.dispatchParticles(l))}}this.onAfterParticlesRenderingObservable.notifyObservers(this)}}},E.prototype._activeMesh=function(e,t){this._skeletonsEnabled&&null!==t.skeleton&&void 0!==t.skeleton&&(this._activeSkeletons.pushNoDuplicate(t.skeleton)&&t.skeleton.prepare(),t.computeBonesUsingShaders||this._softwareSkinnedMeshes.pushNoDuplicate(t));for(var i=0,r=this._activeMeshStage;i<r.length;i++){r[i].action(e,t)}if(null!=t&&void 0!==t.subMeshes&&null!==t.subMeshes&&0<t.subMeshes.length)for(var n=this.getActiveSubMeshCandidates(t),o=n.length,s=0;s<o;s++){var a=n.data[s];this._evaluateSubMesh(a,t)}},E.prototype.updateTransformMatrix=function(e){this.activeCamera&&this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix(e))},E.prototype.updateAlternateTransformMatrix=function(e){this._setAlternateTransformMatrix(e.getViewMatrix(),e.getProjectionMatrix())},E.prototype._renderForCamera=function(e,t){if(!e||!e._skipRendering){var i=this._engine;if(this.activeCamera=e,!this.activeCamera)throw new Error("Active camera not set");i.setViewport(this.activeCamera.viewport),this.resetCachedMaterial(),this._renderId++,this.updateTransformMatrix(),e._alternateCamera&&(this.updateAlternateTransformMatrix(e._alternateCamera),this._alternateRendering=!0),this.onBeforeCameraRenderObservable.notifyObservers(this.activeCamera),this._evaluateActiveMeshes();for(var r=0;r<this._softwareSkinnedMeshes.length;r++){var n=this._softwareSkinnedMeshes.data[r];n.applySkeleton(n.skeleton)}this.onBeforeRenderTargetsRenderObservable.notifyObservers(this),e.customRenderTargets&&0<e.customRenderTargets.length&&this._renderTargets.concatWithNoDuplicate(e.customRenderTargets),t&&t.customRenderTargets&&0<t.customRenderTargets.length&&this._renderTargets.concatWithNoDuplicate(t.customRenderTargets);for(var o=0,s=this._gatherActiveCameraRenderTargetsStage;o<s.length;o++){s[o].action(this._renderTargets)}if(this.renderTargetsEnabled){if(this._intermediateRendering=!0,0<this._renderTargets.length){x.Tools.StartPerformanceCounter("Render targets",0<this._renderTargets.length);for(var a=0;a<this._renderTargets.length;a++){var l=this._renderTargets.data[a];if(l._shouldRender()){this._renderId++;var c=l.activeCamera&&l.activeCamera!==this.activeCamera;l.render(c,this.dumpNextRenderTargets)}}x.Tools.EndPerformanceCounter("Render targets",0<this._renderTargets.length),this._renderId++}for(var h=0,u=this._cameraDrawRenderTargetStage;h<u.length;h++){u[h].action(this.activeCamera)}this._intermediateRendering=!1,i.restoreDefaultFramebuffer()}this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this.postProcessManager&&this.postProcessManager._prepareFrame();for(var d=0,f=this._beforeCameraDrawStage;d<f.length;d++){f[d].action(this.activeCamera)}this.onBeforeDrawPhaseObservable.notifyObservers(this),this._renderingManager.render(null,null,!0,!0),this.onAfterDrawPhaseObservable.notifyObservers(this);for(var p=0,_=this._afterCameraDrawStage;p<_.length;p++){_[p].action(this.activeCamera)}this.postProcessManager&&this.postProcessManager._finalizeFrame(e.isIntermediate),this._renderTargets.reset(),this._alternateRendering=!1,this.onAfterCameraRenderObservable.notifyObservers(this.activeCamera)}},E.prototype._processSubCameras=function(e){if(e.cameraRigMode!==x.Camera.RIG_MODE_NONE){for(var t=0;t<e._rigCameras.length;t++)this._renderForCamera(e._rigCameras[t],e);this.activeCamera=e,this.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix())}else this._renderForCamera(e)},E.prototype._checkIntersections=function(){for(var e=0;e<this._meshesForIntersections.length;e++){var t=this._meshesForIntersections.data[e];if(t.actionManager)for(var i=0;i<t.actionManager.actions.length;i++){var r=t.actionManager.actions[i];if(r.trigger===x.ActionManager.OnIntersectionEnterTrigger||r.trigger===x.ActionManager.OnIntersectionExitTrigger){var n=r.getTriggerParameter(),o=n instanceof x.AbstractMesh?n:n.mesh,s=o.intersectsMesh(t,n.usePreciseIntersection),a=t._intersectionsInProgress.indexOf(o);s&&-1===a?r.trigger===x.ActionManager.OnIntersectionEnterTrigger?(r._executeCurrent(x.ActionEvent.CreateNew(t,void 0,o)),t._intersectionsInProgress.push(o)):r.trigger===x.ActionManager.OnIntersectionExitTrigger&&t._intersectionsInProgress.push(o):!s&&-1<a&&(r.trigger===x.ActionManager.OnIntersectionExitTrigger&&r._executeCurrent(x.ActionEvent.CreateNew(t,void 0,o)),t.actionManager.hasSpecificTrigger(x.ActionManager.OnIntersectionExitTrigger,(function(e){var t=e instanceof x.AbstractMesh?e:e.mesh;return o===t}))&&r.trigger!==x.ActionManager.OnIntersectionExitTrigger||t._intersectionsInProgress.splice(a,1))}}}},E.prototype._advancePhysicsEngineStep=function(e){},E.prototype.render=function(e){if(void 0===e&&(e=!0),!this.isDisposed){if(this._frameId++,this._registerTransientComponents(),this._activeParticles.fetchNewFrame(),this._totalVertices.fetchNewFrame(),this._activeIndices.fetchNewFrame(),this._activeBones.fetchNewFrame(),this._meshesForIntersections.reset(),this.resetCachedMaterial(),this.onBeforeAnimationsObservable.notifyObservers(this),this.actionManager&&this.actionManager.processTrigger(x.ActionManager.OnEveryFrameTrigger),this._engine.isDeterministicLockStep()){var t=Math.max(E.MinDeltaTime,Math.min(this._engine.getDeltaTime(),E.MaxDeltaTime))+this._timeAccumulator,i=this.getDeterministicFrameTime(),r=0,n=this._engine.getLockstepMaxSteps(),o=Math.floor(t/60);for(o=Math.min(o,n);this.onBeforeStepObservable.notifyObservers(this),this._animationRatio=.06*i,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this._advancePhysicsEngineStep(i),this.onAfterStepObservable.notifyObservers(this),this._currentStepId++,0<(t-=i)&&++r<o;);this._timeAccumulator=t<0?0:t}else{t=this.useConstantAnimationDeltaTime?16:Math.max(E.MinDeltaTime,Math.min(this._engine.getDeltaTime(),E.MaxDeltaTime));this._animationRatio=.06*t,this._animate(),this.onAfterAnimationsObservable.notifyObservers(this),this._advancePhysicsEngineStep(t)}for(var s=0,a=this._beforeCameraUpdateStage;s<a.length;s++){a[s].action()}if(e)if(0<this.activeCameras.length)for(var l=0;l<this.activeCameras.length;l++){var c=this.activeCameras[l];if(c.update(),c.cameraRigMode!==x.Camera.RIG_MODE_NONE)for(var h=0;h<c._rigCameras.length;h++)c._rigCameras[h].update()}else if(this.activeCamera&&(this.activeCamera.update(),this.activeCamera.cameraRigMode!==x.Camera.RIG_MODE_NONE))for(h=0;h<this.activeCamera._rigCameras.length;h++)this.activeCamera._rigCameras[h].update();this.onBeforeRenderObservable.notifyObservers(this),this.onBeforeRenderTargetsRenderObservable.notifyObservers(this);var u=this.getEngine(),d=this.activeCamera;if(this.renderTargetsEnabled){x.Tools.StartPerformanceCounter("Custom render targets",0<this.customRenderTargets.length),this._intermediateRendering=!0;for(var f=0;f<this.customRenderTargets.length;f++){var p=this.customRenderTargets[f];if(p._shouldRender()){if(this._renderId++,this.activeCamera=p.activeCamera||this.activeCamera,!this.activeCamera)throw new Error("Active camera not set");u.setViewport(this.activeCamera.viewport),this.updateTransformMatrix(),p.render(d!==this.activeCamera,this.dumpNextRenderTargets)}}x.Tools.EndPerformanceCounter("Custom render targets",0<this.customRenderTargets.length),this._intermediateRendering=!1,this._renderId++}0<this.customRenderTargets.length&&u.restoreDefaultFramebuffer(),this.onAfterRenderTargetsRenderObservable.notifyObservers(this),this.activeCamera=d;for(var _=0,m=this._beforeClearStage;_<m.length;_++){m[_].action()}(this.autoClearDepthAndStencil||this.autoClear)&&this._engine.clear(this.clearColor,this.autoClear||this.forceWireframe||this.forcePointsCloud,this.autoClearDepthAndStencil,this.autoClearDepthAndStencil);for(var g=0,v=this._gatherRenderTargetsStage;g<v.length;g++){v[g].action(this._renderTargets)}if(0<this.activeCameras.length)for(l=0;l<this.activeCameras.length;l++)0<l&&this._engine.clear(null,!1,!0,!0),this._processSubCameras(this.activeCameras[l]);else{if(!this.activeCamera)throw new Error("No camera defined");this._processSubCameras(this.activeCamera)}this._checkIntersections();for(var y=0,b=this._afterRenderStage;y<b.length;y++){b[y].action()}if(this.afterRender&&this.afterRender(),this.onAfterRenderObservable.notifyObservers(this),this._toBeDisposed.length){for(h=0;h<this._toBeDisposed.length;h++){var T=this._toBeDisposed[h];T&&T.dispose()}this._toBeDisposed=[]}this.dumpNextRenderTargets&&(this.dumpNextRenderTargets=!1),this._activeBones.addCount(0,!0),this._activeIndices.addCount(0,!0),this._activeParticles.addCount(0,!0)}},E.prototype.freezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].freeze()},E.prototype.unfreezeMaterials=function(){for(var e=0;e<this.materials.length;e++)this.materials[e].unfreeze()},E.prototype.dispose=function(){this.beforeRender=null,this.afterRender=null,this.skeletons=[],this.morphTargetManagers=[],this._transientComponents=[],this._isReadyForMeshStage.clear(),this._beforeEvaluateActiveMeshStage.clear(),this._evaluateSubMeshStage.clear(),this._activeMeshStage.clear(),this._cameraDrawRenderTargetStage.clear(),this._beforeCameraDrawStage.clear(),this._beforeRenderingGroupDrawStage.clear(),this._beforeRenderingMeshStage.clear(),this._afterRenderingMeshStage.clear(),this._afterRenderingGroupDrawStage.clear(),this._afterCameraDrawStage.clear(),this._afterRenderStage.clear(),this._beforeCameraUpdateStage.clear(),this._beforeClearStage.clear(),this._gatherRenderTargetsStage.clear(),this._gatherActiveCameraRenderTargetsStage.clear(),this._pointerMoveStage.clear(),this._pointerDownStage.clear(),this._pointerUpStage.clear();for(var e=0,t=this._components;e<t.length;e++){t[e].dispose()}this.importedMeshesFiles=new Array,this.stopAllAnimations(),this.resetCachedMaterial(),this.activeCamera&&(this.activeCamera._activeMeshes.dispose(),this.activeCamera=null),this._activeMeshes.dispose(),this._renderingManager.dispose(),this._processedMaterials.dispose(),this._activeParticleSystems.dispose(),this._activeSkeletons.dispose(),this._softwareSkinnedMeshes.dispose(),this._renderTargets.dispose(),this._registeredForLateAnimationBindings.dispose(),this._meshesForIntersections.dispose(),this._toBeDisposed=[];for(var i=0,r=this._activeRequests;i<r.length;i++){r[i].abort()}this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderTargetsRenderObservable.clear(),this.onAfterRenderTargetsRenderObservable.clear(),this.onAfterStepObservable.clear(),this.onBeforeStepObservable.clear(),this.onBeforeActiveMeshesEvaluationObservable.clear(),this.onAfterActiveMeshesEvaluationObservable.clear(),this.onBeforeParticlesRenderingObservable.clear(),this.onAfterParticlesRenderingObservable.clear(),this.onBeforeDrawPhaseObservable.clear(),this.onAfterDrawPhaseObservable.clear(),this.onBeforeAnimationsObservable.clear(),this.onAfterAnimationsObservable.clear(),this.onDataLoadedObservable.clear(),this.onBeforeRenderingGroupObservable.clear(),this.onAfterRenderingGroupObservable.clear(),this.onMeshImportedObservable.clear(),this.onBeforeCameraRenderObservable.clear(),this.onAfterCameraRenderObservable.clear(),this.onReadyObservable.clear(),this.onNewCameraAddedObservable.clear(),this.onCameraRemovedObservable.clear(),this.onNewLightAddedObservable.clear(),this.onLightRemovedObservable.clear(),this.onNewGeometryAddedObservable.clear(),this.onGeometryRemovedObservable.clear(),this.onNewTransformNodeAddedObservable.clear(),this.onTransformNodeRemovedObservable.clear(),this.onNewMeshAddedObservable.clear(),this.onMeshRemovedObservable.clear(),this.onNewMaterialAddedObservable.clear(),this.onMaterialRemovedObservable.clear(),this.onNewTextureAddedObservable.clear(),this.onTextureRemovedObservable.clear(),this.onPrePointerObservable.clear(),this.onPointerObservable.clear(),this.onPreKeyboardObservable.clear(),this.onKeyboardObservable.clear(),this.detachControl();var n,o=this._engine.getRenderingCanvas();if(o)for(n=0;n<this.cameras.length;n++)this.cameras[n].detachControl(o);for(;this.animationGroups.length;)this.animationGroups[0].dispose();for(;this.lights.length;)this.lights[0].dispose();for(;this.meshes.length;)this.meshes[0].dispose(!0);for(;this.transformNodes.length;)this.removeTransformNode(this.transformNodes[0]);for(;this.cameras.length;)this.cameras[0].dispose();for(this.defaultMaterial&&this.defaultMaterial.dispose();this.multiMaterials.length;)this.multiMaterials[0].dispose();for(;this.materials.length;)this.materials[0].dispose();for(;this.particleSystems.length;)this.particleSystems[0].dispose();for(;this.postProcesses.length;)this.postProcesses[0].dispose();for(;this.textures.length;)this.textures[0].dispose();this._sceneUbo.dispose(),this._alternateSceneUbo&&this._alternateSceneUbo.dispose(),this.postProcessManager.dispose(),-1<(n=this._engine.scenes.indexOf(this))&&this._engine.scenes.splice(n,1),this._engine.wipeCaches(!0),this._isDisposed=!0},Object.defineProperty(E.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),E.prototype.clearCachedVertexData=function(){for(var e=0;e<this.meshes.length;e++){var t=this.meshes[e].geometry;if(t)for(var i in t._indices=[],t._vertexBuffers)t._vertexBuffers.hasOwnProperty(i)&&(t._vertexBuffers[i]._buffer._data=null)}},E.prototype.cleanCachedTextureBuffer=function(){for(var e=0,t=this.textures;e<t.length;e++){var i=t[e];i._buffer&&(i._buffer=null)}},E.prototype.getWorldExtends=function(e){var n=new x.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),o=new x.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE);return e=e||function(){return!0},this.meshes.filter(e).forEach((function(e){if(e.computeWorldMatrix(!0),e.subMeshes&&0!==e.subMeshes.length&&!e.infiniteDistance){var t=e.getBoundingInfo(),i=t.boundingBox.minimumWorld,r=t.boundingBox.maximumWorld;x.Tools.CheckExtends(i,n,o),x.Tools.CheckExtends(r,n,o)}})),{min:n,max:o}},E.prototype.createPickingRay=function(e,t,i,r,n){void 0===n&&(n=!1);var o=x.Ray.Zero();return this.createPickingRayToRef(e,t,i,o,r,n),o},E.prototype.createPickingRayToRef=function(e,t,i,r,n,o){void 0===o&&(o=!1);var s=this._engine;if(!n){if(!this.activeCamera)throw new Error("Active camera not set");n=this.activeCamera}var a=n.viewport.toGlobal(s.getRenderWidth(),s.getRenderHeight());return e=e/this._engine.getHardwareScalingLevel()-a.x,t=t/this._engine.getHardwareScalingLevel()-(this._engine.getRenderHeight()-a.y-a.height),r.update(e,t,a.width,a.height,i||x.Matrix.Identity(),o?x.Matrix.Identity():n.getViewMatrix(),n.getProjectionMatrix()),this},E.prototype.createPickingRayInCameraSpace=function(e,t,i){var r=x.Ray.Zero();return this.createPickingRayInCameraSpaceToRef(e,t,r,i),r},E.prototype.createPickingRayInCameraSpaceToRef=function(e,t,i,r){if(!x.PickingInfo)return this;var n=this._engine;if(!r){if(!this.activeCamera)throw new Error("Active camera not set");r=this.activeCamera}var o=r.viewport.toGlobal(n.getRenderWidth(),n.getRenderHeight()),s=x.Matrix.Identity();return e=e/this._engine.getHardwareScalingLevel()-o.x,t=t/this._engine.getHardwareScalingLevel()-(this._engine.getRenderHeight()-o.y-o.height),i.update(e,t,o.width,o.height,s,s,r.getProjectionMatrix()),this},E.prototype._internalPick=function(e,t,i){if(!x.PickingInfo)return null;for(var r=null,n=0;n<this.meshes.length;n++){var o=this.meshes[n];if(t){if(!t(o))continue}else if(!o.isEnabled()||!o.isVisible||!o.isPickable)continue;var s=e(o.getWorldMatrix()),a=o.intersects(s,i);if(a&&a.hit&&((i||null==r||!(a.distance>=r.distance))&&(r=a,i)))break}return r||new x.PickingInfo},E.prototype._internalMultiPick=function(e,t){if(!x.PickingInfo)return null;for(var i=new Array,r=0;r<this.meshes.length;r++){var n=this.meshes[r];if(t){if(!t(n))continue}else if(!n.isEnabled()||!n.isVisible||!n.isPickable)continue;var o=e(n.getWorldMatrix()),s=n.intersects(o,!1);s&&s.hit&&i.push(s)}return i},E.prototype.pick=function(t,i,e,r,n){var o=this;if(!x.PickingInfo)return null;var s=this._internalPick((function(e){return o.createPickingRayToRef(t,i,e,o._tempPickingRay,n||null),o._tempPickingRay}),e,r);return s&&(s.ray=this.createPickingRay(t,i,x.Matrix.Identity(),n||null)),s},E.prototype.pickWithRay=function(t,e,i){var r=this,n=this._internalPick((function(e){return r._pickWithRayInverseMatrix||(r._pickWithRayInverseMatrix=x.Matrix.Identity()),e.invertToRef(r._pickWithRayInverseMatrix),r._cachedRayForTransform||(r._cachedRayForTransform=x.Ray.Zero()),x.Ray.TransformToRef(t,r._pickWithRayInverseMatrix,r._cachedRayForTransform),r._cachedRayForTransform}),e,i);return n&&(n.ray=t),n},E.prototype.multiPick=function(t,i,e,r){var n=this;return this._internalMultiPick((function(e){return n.createPickingRay(t,i,e,r||null)}),e)},E.prototype.multiPickWithRay=function(t,e){var i=this;return this._internalMultiPick((function(e){return i._pickWithRayInverseMatrix||(i._pickWithRayInverseMatrix=x.Matrix.Identity()),e.invertToRef(i._pickWithRayInverseMatrix),i._cachedRayForTransform||(i._cachedRayForTransform=x.Ray.Zero()),x.Ray.TransformToRef(t,i._pickWithRayInverseMatrix,i._cachedRayForTransform),i._cachedRayForTransform}),e)},E.prototype.setPointerOverMesh=function(e){this._pointerOverMesh!==e&&(this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.processTrigger(x.ActionManager.OnPointerOutTrigger,x.ActionEvent.CreateNew(this._pointerOverMesh)),this._pointerOverMesh=e,this._pointerOverMesh&&this._pointerOverMesh.actionManager&&this._pointerOverMesh.actionManager.processTrigger(x.ActionManager.OnPointerOverTrigger,x.ActionEvent.CreateNew(this._pointerOverMesh)))},E.prototype.getPointerOverMesh=function(){return this._pointerOverMesh},E.prototype._rebuildGeometries=function(){for(var e=0,t=this.geometries;e<t.length;e++){t[e]._rebuild()}for(var i=0,r=this.meshes;i<r.length;i++){r[i]._rebuild()}this.postProcessManager&&this.postProcessManager._rebuild();for(var n=0,o=this._components;n<o.length;n++){o[n].rebuild()}for(var s=0,a=this.particleSystems;s<a.length;s++){a[s].rebuild()}},E.prototype._rebuildTextures=function(){for(var e=0,t=this.textures;e<t.length;e++){t[e]._rebuild()}this.markAllMaterialsAsDirty(x.Material.TextureDirtyFlag)},E.prototype._getByTags=function(e,t,i){if(void 0===t)return e;var r=[];for(var n in i=i||function(e){},e){var o=e[n];x.Tags&&x.Tags.MatchesQuery(o,t)&&(r.push(o),i(o))}return r},E.prototype.getMeshesByTags=function(e,t){return this._getByTags(this.meshes,e,t)},E.prototype.getCamerasByTags=function(e,t){return this._getByTags(this.cameras,e,t)},E.prototype.getLightsByTags=function(e,t){return this._getByTags(this.lights,e,t)},E.prototype.getMaterialByTags=function(e,t){return this._getByTags(this.materials,e,t).concat(this._getByTags(this.multiMaterials,e,t))},E.prototype.setRenderingOrder=function(e,t,i,r){void 0===t&&(t=null),void 0===i&&(i=null),void 0===r&&(r=null),this._renderingManager.setRenderingOrder(e,t,i,r)},E.prototype.setRenderingAutoClearDepthStencil=function(e,t,i,r){void 0===i&&(i=!0),void 0===r&&(r=!0),this._renderingManager.setRenderingAutoClearDepthStencil(e,t,i,r)},E.prototype.getAutoClearDepthStencilSetup=function(e){return this._renderingManager.getAutoClearDepthStencilSetup(e)},Object.defineProperty(E.prototype,"blockMaterialDirtyMechanism",{get:function(){return this._blockMaterialDirtyMechanism},set:function(e){this._blockMaterialDirtyMechanism!==e&&((this._blockMaterialDirtyMechanism=e)||this.markAllMaterialsAsDirty(x.Material.AllDirtyFlag))},enumerable:!0,configurable:!0}),E.prototype.markAllMaterialsAsDirty=function(e,t){if(!this._blockMaterialDirtyMechanism)for(var i=0,r=this.materials;i<r.length;i++){var n=r[i];t&&!t(n)||n.markAsDirty(e)}},E.prototype._loadFile=function(e,t,i,r,n,o){var s=this,a=x.Tools.LoadFile(e,t,i,r?this.database:void 0,n,o);return this._activeRequests.push(a),a.onCompleteObservable.add((function(e){s._activeRequests.splice(s._activeRequests.indexOf(e),1)})),a},E.prototype._loadFileAsync=function(e,r,n){var o=this;return new Promise(function(t,i){o._loadFile(e,(function(e){t(e)}),void 0,r,n,(function(e,t){i(t)}))})},E._uniqueIdCounter=0,E.FOGMODE_NONE=0,E.FOGMODE_EXP=1,E.FOGMODE_EXP2=2,E.FOGMODE_LINEAR=3,E.MinDeltaTime=1,E.MaxDeltaTime=1e3,E.DragMovementThreshold=10,E.LongPressDelay=500,E.DoubleClickDelay=300,E.ExclusiveDoubleClickMode=!1,E})(x.AbstractScene);x.Scene=t})($a||($a={})),(function(r){var n=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t})(r.AbstractScene);r.KeepAssets=n;var e=(function(i){function e(e){var t=i.call(this)||this;return t.scene=e,t}return T(e,i),e.prototype.addAllToScene=function(){var t=this;this.cameras.forEach((function(e){t.scene.addCamera(e)})),this.lights.forEach((function(e){t.scene.addLight(e)})),this.meshes.forEach((function(e){t.scene.addMesh(e)})),this.skeletons.forEach((function(e){t.scene.addSkeleton(e)})),this.animations.forEach((function(e){t.scene.addAnimation(e)})),this.animationGroups.forEach((function(e){t.scene.addAnimationGroup(e)})),this.multiMaterials.forEach((function(e){t.scene.addMultiMaterial(e)})),this.materials.forEach((function(e){t.scene.addMaterial(e)})),this.morphTargetManagers.forEach((function(e){t.scene.addMorphTargetManager(e)})),this.geometries.forEach((function(e){t.scene.addGeometry(e)})),this.transformNodes.forEach((function(e){t.scene.addTransformNode(e)})),this.actionManagers.forEach((function(e){t.scene.addActionManager(e)})),this.textures.forEach((function(e){t.scene.addTexture(e)}));for(var e=0,i=this.scene._serializableComponents;e<i.length;e++){i[e].addFromContainer(this.scene)}},e.prototype.removeAllFromScene=function(){var t=this;this.cameras.forEach((function(e){t.scene.removeCamera(e)})),this.lights.forEach((function(e){t.scene.removeLight(e)})),this.meshes.forEach((function(e){t.scene.removeMesh(e)})),this.skeletons.forEach((function(e){t.scene.removeSkeleton(e)})),this.animations.forEach((function(e){t.scene.removeAnimation(e)})),this.animationGroups.forEach((function(e){t.scene.removeAnimationGroup(e)})),this.multiMaterials.forEach((function(e){t.scene.removeMultiMaterial(e)})),this.materials.forEach((function(e){t.scene.removeMaterial(e)})),this.morphTargetManagers.forEach((function(e){t.scene.removeMorphTargetManager(e)})),this.geometries.forEach((function(e){t.scene.removeGeometry(e)})),this.transformNodes.forEach((function(e){t.scene.removeTransformNode(e)})),this.actionManagers.forEach((function(e){t.scene.removeActionManager(e)})),this.textures.forEach((function(e){t.scene.removeTexture(e)}));for(var e=0,i=this.scene._serializableComponents;e<i.length;e++){i[e].removeFromContainer(this.scene)}},e.prototype._moveAssets=function(e,t,i){if(e)for(var r=0,n=e;r<n.length;r++){var o=n[r],s=!0;if(i)for(var a=0,l=i;a<l.length;a++){if(o===l[a]){s=!1;break}}s&&t.push(o)}},e.prototype.moveAllFromScene=function(e){for(var t in void 0===e&&(e=new n),this)this.hasOwnProperty(t)&&(this[t]=this[t]||[],this._moveAssets(this.scene[t],this[t],e[t]));this.removeAllFromScene()},e.prototype.createRootMesh=function(){var t=new r.Mesh("assetContainerRootMesh",this.scene);return this.meshes.forEach((function(e){e.parent||t.addChild(e)})),this.meshes.unshift(t),t},e})(r.AbstractScene);r.AssetContainer=e})($a||($a={})),Y=$a||($a={}),K=(function(){function e(e,t,i,r,n,o,s){void 0===r&&(r=0),void 0===n&&(n=!1),void 0===o&&(o=!1),void 0===s&&(s=!1),e instanceof Y.Mesh?this._engine=e.getScene().getEngine():this._engine=e,this._updatable=i,this._instanced=o,this._data=t,this.byteStride=s?r:r*Float32Array.BYTES_PER_ELEMENT,n||this.create()}return e.prototype.createVertexBuffer=function(e,t,i,r,n,o){void 0===o&&(o=!1);var s=o?t:t*Float32Array.BYTES_PER_ELEMENT,a=r?o?r:r*Float32Array.BYTES_PER_ELEMENT:this.byteStride;return new Y.VertexBuffer(this._engine,this,e,this._updatable,!0,a,void 0===n?this._instanced:n,s,i,void 0,void 0,!0)},e.prototype.isUpdatable=function(){return this._updatable},e.prototype.getData=function(){return this._data},e.prototype.getBuffer=function(){return this._buffer},e.prototype.getStrideSize=function(){return this.byteStride/Float32Array.BYTES_PER_ELEMENT},e.prototype.create=function(e){void 0===e&&(e=null),!e&&this._buffer||(e=e||this._data)&&(this._buffer?this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e),this._data=e):this._updatable?(this._buffer=this._engine.createDynamicVertexBuffer(e),this._data=e):this._buffer=this._engine.createVertexBuffer(e))},e.prototype._rebuild=function(){this._buffer=null,this.create(this._data)},e.prototype.update=function(e){this.create(e)},e.prototype.updateDirectly=function(e,t,i,r){void 0===r&&(r=!1),this._buffer&&this._updatable&&(this._engine.updateDynamicVertexBuffer(this._buffer,e,r?t:t*Float32Array.BYTES_PER_ELEMENT,i?i*this.byteStride:void 0),this._data=null)},e.prototype.dispose=function(){this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)},e})(),Y.Buffer=K,Q=$a||($a={}),Z=(function(){function _(e,t,i,r,n,o,s,a,l,c,h,u){if(void 0===h&&(h=!1),void 0===u&&(u=!1),t instanceof Q.Buffer?(this._buffer=t,this._ownsBuffer=!1):(this._buffer=new Q.Buffer(e,t,r,o,n,s,u),this._ownsBuffer=!0),this._kind=i,null==c){var d=this.getData();this.type=_.FLOAT,d instanceof Int8Array?this.type=_.BYTE:d instanceof Uint8Array?this.type=_.UNSIGNED_BYTE:d instanceof Int16Array?this.type=_.SHORT:d instanceof Uint16Array?this.type=_.UNSIGNED_SHORT:d instanceof Int32Array?this.type=_.INT:d instanceof Uint32Array&&(this.type=_.UNSIGNED_INT)}else this.type=c;var f=_.GetTypeByteLength(this.type);u?(this._size=l||(o?o/f:_.DeduceStride(i)),this.byteStride=o||this._buffer.byteStride||this._size*f,this.byteOffset=a||0):(this._size=l||o||_.DeduceStride(i),this.byteStride=o?o*f:this._buffer.byteStride||this._size*f,this.byteOffset=(a||0)*f),this.normalized=h,this._instanced=void 0!==s&&s,this._instanceDivisor=s?1:0}return Object.defineProperty(_.prototype,"instanceDivisor",{get:function(){return this._instanceDivisor},set:function(e){this._instanceDivisor=e,this._instanced=0!=e},enumerable:!0,configurable:!0}),_.prototype._rebuild=function(){this._buffer&&this._buffer._rebuild()},_.prototype.getKind=function(){return this._kind},_.prototype.isUpdatable=function(){return this._buffer.isUpdatable()},_.prototype.getData=function(){return this._buffer.getData()},_.prototype.getBuffer=function(){return this._buffer.getBuffer()},_.prototype.getStrideSize=function(){return this.byteStride/_.GetTypeByteLength(this.type)},_.prototype.getOffset=function(){return this.byteOffset/_.GetTypeByteLength(this.type)},_.prototype.getSize=function(){return this._size},_.prototype.getIsInstanced=function(){return this._instanced},_.prototype.getInstanceDivisor=function(){return this._instanceDivisor},_.prototype.create=function(e){this._buffer.create(e)},_.prototype.update=function(e){this._buffer.update(e)},_.prototype.updateDirectly=function(e,t,i){void 0===i&&(i=!1),this._buffer.updateDirectly(e,t,void 0,i)},_.prototype.dispose=function(){this._ownsBuffer&&this._buffer.dispose()},_.prototype.forEach=function(e,t){_.ForEach(this._buffer.getData(),this.byteOffset,this.byteStride,this._size,this.type,e,this.normalized,t)},_.DeduceStride=function(e){switch(e){case _.UVKind:case _.UV2Kind:case _.UV3Kind:case _.UV4Kind:case _.UV5Kind:case _.UV6Kind:return 2;case _.NormalKind:case _.PositionKind:return 3;case _.ColorKind:case _.MatricesIndicesKind:case _.MatricesIndicesExtraKind:case _.MatricesWeightsKind:case _.MatricesWeightsExtraKind:case _.TangentKind:return 4;default:throw new Error("Invalid kind '"+e+"'")}},_.GetTypeByteLength=function(e){switch(e){case _.BYTE:case _.UNSIGNED_BYTE:return 1;case _.SHORT:case _.UNSIGNED_SHORT:return 2;case _.INT:case _.FLOAT:return 4;default:throw new Error("Invalid type '"+e+"'")}},_.ForEach=function(e,t,i,r,n,o,s,a){if(e instanceof Array)for(var l=t/4,c=i/4,h=0;h<o;h+=r){for(var u=0;u<r;u++)a(e[l+u],h+u);l+=c}else{var d=e instanceof ArrayBuffer?new DataView(e):new DataView(e.buffer,e.byteOffset,e.byteLength),f=_.GetTypeByteLength(n);for(h=0;h<o;h+=r){var p=t;for(u=0;u<r;u++){a(_._GetFloatValue(d,n,p,s),h+u),p+=f}t+=i}}},_._GetFloatValue=function(e,t,i,r){switch(t){case _.BYTE:var n=e.getInt8(i);return r&&(n=Math.max(n/127,-1)),n;case _.UNSIGNED_BYTE:n=e.getUint8(i);return r&&(n/=255),n;case _.SHORT:n=e.getInt16(i,!0);return r&&(n=Math.max(n/16383,-1)),n;case _.UNSIGNED_SHORT:n=e.getUint16(i,!0);return r&&(n/=65535),n;case _.FLOAT:return e.getFloat32(i,!0);default:throw new Error("Invalid component type "+t)}},_.BYTE=5120,_.UNSIGNED_BYTE=5121,_.SHORT=5122,_.UNSIGNED_SHORT=5123,_.INT=5124,_.UNSIGNED_INT=5125,_.FLOAT=5126,_.PositionKind="position",_.NormalKind="normal",_.TangentKind="tangent",_.UVKind="uv",_.UV2Kind="uv2",_.UV3Kind="uv3",_.UV4Kind="uv4",_.UV5Kind="uv5",_.UV6Kind="uv6",_.ColorKind="color",_.MatricesIndicesKind="matricesIndices",_.MatricesWeightsKind="matricesWeights",_.MatricesIndicesExtraKind="matricesIndicesExtra",_.MatricesWeightsExtraKind="matricesWeightsExtra",_})(),Q.VertexBuffer=Z,q=function(){this.previous=null,this.next=null},($a||($a={})).DummyInternalTextureTracker=q,J=$a||($a={}),$=(function(){function o(e,t){this.onLoadedObservable=new J.Observable,this.previous=null,this.next=null,this._initialSlot=-1,this._designatedSlot=-1,this._dataSource=o.DATASOURCE_UNKNOWN,this._comparisonFunction=0,this._sphericalPolynomial=null,this._lodGenerationScale=0,this._lodGenerationOffset=0,this._isRGBD=!1,this._references=1,this._engine=e,this._dataSource=t,this._webGLTexture=e._createTexture()}return o.prototype.getEngine=function(){return this._engine},Object.defineProperty(o.prototype,"dataSource",{get:function(){return this._dataSource},enumerable:!0,configurable:!0}),o.prototype.incrementReferences=function(){this._references++},o.prototype.updateSize=function(e,t,i){void 0===i&&(i=1),this.width=e,this.height=t,this.depth=i,this.baseWidth=e,this.baseHeight=t,this.baseDepth=i,this._size=e*t*i},o.prototype._rebuild=function(){var e,t=this;switch(this.isReady=!1,this._cachedCoordinatesMode=null,this._cachedWrapU=null,this._cachedWrapV=null,this._cachedAnisotropicFilteringLevel=null,this._dataSource){case o.DATASOURCE_TEMP:return;case o.DATASOURCE_URL:return void(e=this._engine.createTexture(this.url,!this.generateMipMaps,this.invertY,null,this.samplingMode,(function(){t.isReady=!0}),null,this._buffer,void 0,this.format))._swapAndDie(this);case o.DATASOURCE_RAW:return(e=this._engine.createRawTexture(this._bufferView,this.baseWidth,this.baseHeight,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case o.DATASOURCE_RAW3D:return(e=this._engine.createRawTexture3D(this._bufferView,this.baseWidth,this.baseHeight,this.baseDepth,this.format,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case o.DATASOURCE_DYNAMIC:return void(e=this._engine.createDynamicTexture(this.baseWidth,this.baseHeight,this.generateMipMaps,this.samplingMode))._swapAndDie(this);case o.DATASOURCE_RENDERTARGET:var i=new J.RenderTargetCreationOptions;if(i.generateDepthBuffer=this._generateDepthBuffer,i.generateMipMaps=this.generateMipMaps,i.generateStencilBuffer=this._generateStencilBuffer,i.samplingMode=this.samplingMode,i.type=this.type,this.isCube)e=this._engine.createRenderTargetCubeTexture(this.width,i);else{var r={width:this.width,height:this.height};e=this._engine.createRenderTargetTexture(r,i)}return e._swapAndDie(this),void(this.isReady=!0);case o.DATASOURCE_DEPTHTEXTURE:var n={bilinearFiltering:this.samplingMode!==J.Texture.BILINEAR_SAMPLINGMODE,comparisonFunction:this._comparisonFunction,generateStencil:this._generateStencilBuffer,isCube:this.isCube};return(e=this._engine.createDepthStencilTexture({width:this.width,height:this.height},n))._swapAndDie(this),void(this.isReady=!0);case o.DATASOURCE_CUBE:return void(e=this._engine.createCubeTexture(this.url,null,this._files,!this.generateMipMaps,(function(){t.isReady=!0}),null,this.format,this._extension))._swapAndDie(this);case o.DATASOURCE_CUBERAW:return(e=this._engine.createRawCubeTexture(this._bufferViewArray,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression))._swapAndDie(this),void(this.isReady=!0);case o.DATASOURCE_CUBERAW_RGBD:return e=this._engine.createRawCubeTexture(null,this.width,this.format,this.type,this.generateMipMaps,this.invertY,this.samplingMode,this._compression),J.RawCubeTexture._UpdateRGBDAsync(e,this._bufferViewArrayArray,this._sphericalPolynomial,this._lodGenerationScale,this._lodGenerationOffset).then((function(){t.isReady=!0})),void e._swapAndDie(this);case o.DATASOURCE_CUBEPREFILTERED:return void((e=this._engine.createPrefilteredCubeTexture(this.url,null,this._lodGenerationScale,this._lodGenerationOffset,(function(e){e&&e._swapAndDie(t),t.isReady=!0}),null,this.format,this._extension))._sphericalPolynomial=this._sphericalPolynomial)}},o.prototype._swapAndDie=function(e){e._webGLTexture=this._webGLTexture,this._framebuffer&&(e._framebuffer=this._framebuffer),this._depthStencilBuffer&&(e._depthStencilBuffer=this._depthStencilBuffer),this._lodTextureHigh&&(e._lodTextureHigh&&e._lodTextureHigh.dispose(),e._lodTextureHigh=this._lodTextureHigh),this._lodTextureMid&&(e._lodTextureMid&&e._lodTextureMid.dispose(),e._lodTextureMid=this._lodTextureMid),this._lodTextureLow&&(e._lodTextureLow&&e._lodTextureLow.dispose(),e._lodTextureLow=this._lodTextureLow);var t=this._engine.getLoadedTexturesCache(),i=t.indexOf(this);-1!==i&&t.splice(i,1)},o.prototype.dispose=function(){this._webGLTexture&&(this._references--,0===this._references&&(this._engine._releaseTexture(this),this._webGLTexture=null,this.previous=null,this.next=null))},o.DATASOURCE_UNKNOWN=0,o.DATASOURCE_URL=1,o.DATASOURCE_TEMP=2,o.DATASOURCE_RAW=3,o.DATASOURCE_DYNAMIC=4,o.DATASOURCE_RENDERTARGET=5,o.DATASOURCE_MULTIRENDERTARGET=6,o.DATASOURCE_CUBE=7,o.DATASOURCE_CUBERAW=8,o.DATASOURCE_CUBEPREFILTERED=9,o.DATASOURCE_RAW3D=10,o.DATASOURCE_DEPTHTEXTURE=11,o.DATASOURCE_CUBERAW_RGBD=12,o})(),J.InternalTexture=$,ee=$a||($a={}),te=(function(){function t(e){this._hasAlpha=!1,this.getAlphaFromRGB=!1,this.level=1,this.coordinatesIndex=0,this._coordinatesMode=ee.Texture.EXPLICIT_MODE,this.wrapU=ee.Texture.WRAP_ADDRESSMODE,this.wrapV=ee.Texture.WRAP_ADDRESSMODE,this.wrapR=ee.Texture.WRAP_ADDRESSMODE,this.anisotropicFilteringLevel=t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL,this.isCube=!1,this.is3D=!1,this.gammaSpace=!0,this.invertZ=!1,this.lodLevelInAlpha=!1,this.isRenderTarget=!1,this.animations=new Array,this.onDisposeObservable=new ee.Observable,this.delayLoadState=ee.Engine.DELAYLOADSTATE_NONE,this._cachedSize=ee.Size.Zero(),this._scene=e||ee.Engine.LastCreatedScene,this._scene&&(this._scene.textures.push(this),this._scene.onNewTextureAddedObservable.notifyObservers(this)),this._uid=null}return Object.defineProperty(t.prototype,"hasAlpha",{get:function(){return this._hasAlpha},set:function(e){this._hasAlpha!==e&&(this._hasAlpha=e,this._scene&&this._scene.markAllMaterialsAsDirty(ee.Material.TextureDirtyFlag|ee.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"coordinatesMode",{get:function(){return this._coordinatesMode},set:function(e){this._coordinatesMode!==e&&(this._coordinatesMode=e,this._scene&&this._scene.markAllMaterialsAsDirty(ee.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isRGBD",{get:function(){return null!=this._texture&&this._texture._isRGBD},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationOffset",{get:function(){return this._texture?this._texture._lodGenerationOffset:0},set:function(e){this._texture&&(this._texture._lodGenerationOffset=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"lodGenerationScale",{get:function(){return this._texture?this._texture._lodGenerationScale:0},set:function(e){this._texture&&(this._texture._lodGenerationScale=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"uid",{get:function(){return this._uid||(this._uid=ee.Tools.RandomId()),this._uid},enumerable:!0,configurable:!0}),t.prototype.toString=function(){return this.name},t.prototype.getClassName=function(){return"BaseTexture"},Object.defineProperty(t.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"isBlocking",{get:function(){return!0},enumerable:!0,configurable:!0}),t.prototype.getScene=function(){return this._scene},t.prototype.getTextureMatrix=function(){return ee.Matrix.IdentityReadOnly},t.prototype.getReflectionTextureMatrix=function(){return ee.Matrix.IdentityReadOnly},t.prototype.getInternalTexture=function(){return this._texture},t.prototype.isReadyOrNotBlocking=function(){return!this.isBlocking||this.isReady()},t.prototype.isReady=function(){return this.delayLoadState===ee.Engine.DELAYLOADSTATE_NOTLOADED?(this.delayLoad(),!1):!!this._texture&&this._texture.isReady},t.prototype.getSize=function(){if(this._texture){if(this._texture.width)return this._cachedSize.width=this._texture.width,this._cachedSize.height=this._texture.height,this._cachedSize;if(this._texture._size)return this._cachedSize.width=this._texture._size,this._cachedSize.height=this._texture._size,this._cachedSize}return this._cachedSize},t.prototype.getBaseSize=function(){return this.isReady()&&this._texture?this._texture._size?new ee.Size(this._texture._size,this._texture._size):new ee.Size(this._texture.baseWidth,this._texture.baseHeight):ee.Size.Zero()},t.prototype.scale=function(e){},Object.defineProperty(t.prototype,"canRescale",{get:function(){return!1},enumerable:!0,configurable:!0}),t.prototype._getFromCache=function(e,t,i){if(!this._scene)return null;for(var r=this._scene.getEngine().getLoadedTexturesCache(),n=0;n<r.length;n++){var o=r[n];if(o.url===e&&o.generateMipMaps===!t&&(!i||i===o.samplingMode))return o.incrementReferences(),o}return null},t.prototype._rebuild=function(){},t.prototype.delayLoad=function(){},t.prototype.clone=function(){return null},Object.defineProperty(t.prototype,"textureType",{get:function(){return this._texture&&void 0!==this._texture.type?this._texture.type:ee.Engine.TEXTURETYPE_UNSIGNED_INT},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"textureFormat",{get:function(){return this._texture&&void 0!==this._texture.format?this._texture.format:ee.Engine.TEXTUREFORMAT_RGBA},enumerable:!0,configurable:!0}),t.prototype.readPixels=function(e,t,i){if(void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=null),!this._texture)return null;var r=this.getSize(),n=r.width,o=r.height,s=this.getScene();if(!s)return null;var a=s.getEngine();return 0!=t&&(n/=Math.pow(2,t),o/=Math.pow(2,t),n=Math.round(n),o=Math.round(o)),this._texture.isCube?a._readTexturePixels(this._texture,n,o,e,t,i):a._readTexturePixels(this._texture,n,o,-1,t,i)},t.prototype.releaseInternalTexture=function(){this._texture&&(this._texture.dispose(),this._texture=null)},Object.defineProperty(t.prototype,"sphericalPolynomial",{get:function(){return this._texture&&ee.CubeMapToSphericalPolynomialTools&&this.isReady()?(this._texture._sphericalPolynomial||(this._texture._sphericalPolynomial=ee.CubeMapToSphericalPolynomialTools.ConvertCubeMapTextureToSphericalPolynomial(this)),this._texture._sphericalPolynomial):null},set:function(e){this._texture&&(this._texture._sphericalPolynomial=e)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lodTextureHigh",{get:function(){return this._texture?this._texture._lodTextureHigh:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lodTextureMid",{get:function(){return this._texture?this._texture._lodTextureMid:null},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"_lodTextureLow",{get:function(){return this._texture?this._texture._lodTextureLow:null},enumerable:!0,configurable:!0}),t.prototype.dispose=function(){if(this._scene){this._scene.stopAnimation(this),this._scene._removePendingData(this);var e=this._scene.textures.indexOf(this);0<=e&&this._scene.textures.splice(e,1),this._scene.onTextureRemovedObservable.notifyObservers(this),void 0!==this._texture&&(this.releaseInternalTexture(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear())}},t.prototype.serialize=function(){if(!this.name)return null;var e=ee.SerializationHelper.Serialize(this);return ee.Animation.AppendSerializedAnimations(this,e),e},t.WhenAllReady=function(t,i){var r=t.length;if(0!==r)for(var n,o,e=function(){if((n=t[s]).isReady())0==--r&&i();else{o=n.onLoadObservable;var e=function(){o.removeCallback(e),0==--r&&i()};o.add(e)}},s=0;s<t.length;s++)e();else i()},t.DEFAULT_ANISOTROPIC_FILTERING_LEVEL=4,b([ee.serialize()],t.prototype,"name",void 0),b([ee.serialize("hasAlpha")],t.prototype,"_hasAlpha",void 0),b([ee.serialize()],t.prototype,"getAlphaFromRGB",void 0),b([ee.serialize()],t.prototype,"level",void 0),b([ee.serialize()],t.prototype,"coordinatesIndex",void 0),b([ee.serialize("coordinatesMode")],t.prototype,"_coordinatesMode",void 0),b([ee.serialize()],t.prototype,"wrapU",void 0),b([ee.serialize()],t.prototype,"wrapV",void 0),b([ee.serialize()],t.prototype,"wrapR",void 0),b([ee.serialize()],t.prototype,"anisotropicFilteringLevel",void 0),b([ee.serialize()],t.prototype,"isCube",void 0),b([ee.serialize()],t.prototype,"is3D",void 0),b([ee.serialize()],t.prototype,"gammaSpace",void 0),b([ee.serialize()],t.prototype,"invertZ",void 0),b([ee.serialize()],t.prototype,"lodLevelInAlpha",void 0),b([ee.serialize()],t.prototype,"lodGenerationOffset",null),b([ee.serialize()],t.prototype,"lodGenerationScale",null),b([ee.serialize()],t.prototype,"isRenderTarget",void 0),t})(),ee.BaseTexture=te,ie=$a||($a={}),re=(function(d){function f(e,t,i,r,n,o,s,a,l,c){void 0===i&&(i=!1),void 0===r&&(r=!0),void 0===n&&(n=f.TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null),void 0===l&&(l=!1);var h=d.call(this,t)||this;if(h.uOffset=0,h.vOffset=0,h.uScale=1,h.vScale=1,h.uAng=0,h.vAng=0,h.wAng=0,h.uRotationCenter=.5,h.vRotationCenter=.5,h.wRotationCenter=.5,h.onLoadObservable=new ie.Observable,h._isBlocking=!0,h.name=e||"",h.url=e,h._noMipmap=i,h._invertY=r,h._samplingMode=n,h._buffer=a,h._deleteBuffer=l,c&&(h._format=c),!(t=h.getScene()))return h;t.getEngine().onBeforeTextureInitObservable.notifyObservers(h);var u=function(){h.onLoadObservable.hasObservers()&&h.onLoadObservable.notifyObservers(h),o&&o(),!h.isBlocking&&t&&t.resetCachedMaterial()};return h.url?(h._texture=h._getFromCache(h.url,i,n),h._texture?h._texture.isReady?ie.Tools.SetImmediate((function(){return u()})):h._texture.onLoadedObservable.add(u):t.useDelayedTextureLoading?(h.delayLoadState=ie.Engine.DELAYLOADSTATE_NOTLOADED,h._delayedOnLoad=u,h._delayedOnError=s):(h._texture=t.getEngine().createTexture(h.url,i,r,t,h._samplingMode,u,s,h._buffer,void 0,h._format),l&&delete h._buffer)):(h._delayedOnLoad=u,h._delayedOnError=s),h}return T(f,d),Object.defineProperty(f.prototype,"noMipmap",{get:function(){return this._noMipmap},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"samplingMode",{get:function(){return this._samplingMode},enumerable:!0,configurable:!0}),f.prototype.updateURL=function(e,t){if(void 0===t&&(t=null),this.url)throw new Error("URL is already set");this.url=e,this._buffer=t,this.delayLoadState=ie.Engine.DELAYLOADSTATE_NOTLOADED,this.delayLoad()},f.prototype.delayLoad=function(){if(this.delayLoadState===ie.Engine.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();e&&(this.delayLoadState=ie.Engine.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap,this._samplingMode),this._texture?this._delayedOnLoad&&(this._texture.isReady?ie.Tools.SetImmediate(this._delayedOnLoad):this._texture.onLoadedObservable.add(this._delayedOnLoad)):(this._texture=e.getEngine().createTexture(this.url,this._noMipmap,this._invertY,e,this._samplingMode,this._delayedOnLoad,this._delayedOnError,this._buffer,null,this._format),this._deleteBuffer&&delete this._buffer),this._delayedOnLoad=null,this._delayedOnError=null)}},f.prototype.updateSamplingMode=function(e){if(this._texture){var t=this.getScene();t&&(this._samplingMode=e,t.getEngine().updateTextureSamplingMode(e,this._texture))}},f.prototype._prepareRowForTextureGeneration=function(e,t,i,r){e*=this.uScale,t*=this.vScale,e-=this.uRotationCenter*this.uScale,t-=this.vRotationCenter*this.vScale,i-=this.wRotationCenter,ie.Vector3.TransformCoordinatesFromFloatsToRef(e,t,i,this._rowGenerationMatrix,r),r.x+=this.uRotationCenter*this.uScale+this.uOffset,r.y+=this.vRotationCenter*this.vScale+this.vOffset,r.z+=this.wRotationCenter},f.prototype.getTextureMatrix=function(){var t=this;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.uAng===this._cachedUAng&&this.vAng===this._cachedVAng&&this.wAng===this._cachedWAng)return this._cachedTextureMatrix;this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedUAng=this.uAng,this._cachedVAng=this.vAng,this._cachedWAng=this.wAng,this._cachedTextureMatrix||(this._cachedTextureMatrix=ie.Matrix.Zero(),this._rowGenerationMatrix=new ie.Matrix,this._t0=ie.Vector3.Zero(),this._t1=ie.Vector3.Zero(),this._t2=ie.Vector3.Zero()),ie.Matrix.RotationYawPitchRollToRef(this.vAng,this.uAng,this.wAng,this._rowGenerationMatrix),this._prepareRowForTextureGeneration(0,0,0,this._t0),this._prepareRowForTextureGeneration(1,0,0,this._t1),this._prepareRowForTextureGeneration(0,1,0,this._t2),this._t1.subtractInPlace(this._t0),this._t2.subtractInPlace(this._t0),ie.Matrix.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix.m[0]=this._t1.x,this._cachedTextureMatrix.m[1]=this._t1.y,this._cachedTextureMatrix.m[2]=this._t1.z,this._cachedTextureMatrix.m[4]=this._t2.x,this._cachedTextureMatrix.m[5]=this._t2.y,this._cachedTextureMatrix.m[6]=this._t2.z,this._cachedTextureMatrix.m[8]=this._t0.x,this._cachedTextureMatrix.m[9]=this._t0.y,this._cachedTextureMatrix.m[10]=this._t0.z;var e=this.getScene();return e&&e.markAllMaterialsAsDirty(ie.Material.TextureDirtyFlag,(function(e){return e.hasTexture(t)})),this._cachedTextureMatrix},f.prototype.getReflectionTextureMatrix=function(){var t=this,e=this.getScene();if(!e)return this._cachedTextureMatrix;if(this.uOffset===this._cachedUOffset&&this.vOffset===this._cachedVOffset&&this.uScale===this._cachedUScale&&this.vScale===this._cachedVScale&&this.coordinatesMode===this._cachedCoordinatesMode){if(this.coordinatesMode!==f.PROJECTION_MODE)return this._cachedTextureMatrix;if(this._cachedProjectionMatrixId===e.getProjectionMatrix().updateFlag)return this._cachedTextureMatrix}switch(this._cachedTextureMatrix||(this._cachedTextureMatrix=ie.Matrix.Zero()),this._projectionModeMatrix||(this._projectionModeMatrix=ie.Matrix.Zero()),this._cachedUOffset=this.uOffset,this._cachedVOffset=this.vOffset,this._cachedUScale=this.uScale,this._cachedVScale=this.vScale,this._cachedCoordinatesMode=this.coordinatesMode,this.coordinatesMode){case f.PLANAR_MODE:ie.Matrix.IdentityToRef(this._cachedTextureMatrix),this._cachedTextureMatrix[0]=this.uScale,this._cachedTextureMatrix[5]=this.vScale,this._cachedTextureMatrix[12]=this.uOffset,this._cachedTextureMatrix[13]=this.vOffset;break;case f.PROJECTION_MODE:ie.Matrix.IdentityToRef(this._projectionModeMatrix),this._projectionModeMatrix.m[0]=.5,this._projectionModeMatrix.m[5]=-.5,this._projectionModeMatrix.m[10]=0,this._projectionModeMatrix.m[12]=.5,this._projectionModeMatrix.m[13]=.5,this._projectionModeMatrix.m[14]=1,this._projectionModeMatrix.m[15]=1;var i=e.getProjectionMatrix();this._cachedProjectionMatrixId=i.updateFlag,i.multiplyToRef(this._projectionModeMatrix,this._cachedTextureMatrix);break;default:ie.Matrix.IdentityToRef(this._cachedTextureMatrix)}return e.markAllMaterialsAsDirty(ie.Material.TextureDirtyFlag,(function(e){return-1!==e.getActiveTextures().indexOf(t)})),this._cachedTextureMatrix},f.prototype.clone=function(){var e=this;return ie.SerializationHelper.Clone((function(){return new f(e._texture?e._texture.url:null,e.getScene(),e._noMipmap,e._invertY,e._samplingMode)}),this)},f.prototype.serialize=function(){var e=d.prototype.serialize.call(this);return"string"==typeof this._buffer&&"data:"===this._buffer.substr(0,5)&&(e.base64String=this._buffer,e.name=e.name.replace("data:","")),e.invertY=this._invertY,e.samplingMode=this.samplingMode,e},f.prototype.getClassName=function(){return"Texture"},f.prototype.dispose=function(){d.prototype.dispose.call(this),this.onLoadObservable.clear(),this._delayedOnLoad=null,this._delayedOnError=null},f.Parse=function(o,s,a){if(o.customType){var e=ie.Tools.Instantiate(o.customType).Parse(o,s,a);return o.samplingMode&&e.updateSamplingMode&&e._samplingMode&&e._samplingMode!==o.samplingMode&&e.updateSamplingMode(o.samplingMode),e}if(o.isCube)return ie.CubeTexture.Parse(o,s,a);if(!o.name&&!o.isRenderTarget)return null;var t=ie.SerializationHelper.Parse((function(){var e,t=!0;if(o.noMipmap&&(t=!1),o.mirrorPlane){var i=new ie.MirrorTexture(o.name,o.renderTargetSize,s,t);return i._waitingRenderList=o.renderList,i.mirrorPlane=ie.Plane.FromArray(o.mirrorPlane),i}if(o.isRenderTarget){var r=new ie.RenderTargetTexture(o.name,o.renderTargetSize,s,t);return r._waitingRenderList=o.renderList,r}if(o.base64String)e=f.CreateFromBase64String(o.base64String,o.name,s,!t);else{var n=a+o.name;f.UseSerializedUrlIfAny&&o.url&&(n=o.url),e=new f(n,s,!t,o.invertY)}return e}),o,s);if(o.samplingMode){var i=o.samplingMode;t._samplingMode!==i&&t.updateSamplingMode(i)}if(o.animations)for(var r=0;r<o.animations.length;r++){var n=o.animations[r];t.animations.push(ie.Animation.Parse(n))}return t},f.CreateFromBase64String=function(e,t,i,r,n,o,s,a,l){return void 0===o&&(o=f.TRILINEAR_SAMPLINGMODE),void 0===s&&(s=null),void 0===a&&(a=null),void 0===l&&(l=ie.Engine.TEXTUREFORMAT_RGBA),new f("data:"+t,i,r,n,o,s,a,e,!1,l)},f.LoadFromDataString=function(e,t,i,r,n,o,s,a,l,c){return void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===o&&(o=!0),void 0===s&&(s=f.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=null),void 0===l&&(l=null),void 0===c&&(c=ie.Engine.TEXTUREFORMAT_RGBA),"data:"!==e.substr(0,5)&&(e="data:"+e),new f(e,i,n,o,s,a,l,t,r,c)},f.NEAREST_SAMPLINGMODE=ie.Engine.TEXTURE_NEAREST_SAMPLINGMODE,f.NEAREST_NEAREST_MIPLINEAR=ie.Engine.TEXTURE_NEAREST_NEAREST_MIPLINEAR,f.BILINEAR_SAMPLINGMODE=ie.Engine.TEXTURE_BILINEAR_SAMPLINGMODE,f.LINEAR_LINEAR_MIPNEAREST=ie.Engine.TEXTURE_LINEAR_LINEAR_MIPNEAREST,f.TRILINEAR_SAMPLINGMODE=ie.Engine.TEXTURE_TRILINEAR_SAMPLINGMODE,f.LINEAR_LINEAR_MIPLINEAR=ie.Engine.TEXTURE_LINEAR_LINEAR_MIPLINEAR,f.NEAREST_NEAREST_MIPNEAREST=ie.Engine.TEXTURE_NEAREST_NEAREST_MIPNEAREST,f.NEAREST_LINEAR_MIPNEAREST=ie.Engine.TEXTURE_NEAREST_LINEAR_MIPNEAREST,f.NEAREST_LINEAR_MIPLINEAR=ie.Engine.TEXTURE_NEAREST_LINEAR_MIPLINEAR,f.NEAREST_LINEAR=ie.Engine.TEXTURE_NEAREST_LINEAR,f.NEAREST_NEAREST=ie.Engine.TEXTURE_NEAREST_NEAREST,f.LINEAR_NEAREST_MIPNEAREST=ie.Engine.TEXTURE_LINEAR_NEAREST_MIPNEAREST,f.LINEAR_NEAREST_MIPLINEAR=ie.Engine.TEXTURE_LINEAR_NEAREST_MIPLINEAR,f.LINEAR_LINEAR=ie.Engine.TEXTURE_LINEAR_LINEAR,f.LINEAR_NEAREST=ie.Engine.TEXTURE_LINEAR_NEAREST,f.EXPLICIT_MODE=ie.Engine.TEXTURE_EXPLICIT_MODE,f.SPHERICAL_MODE=ie.Engine.TEXTURE_SPHERICAL_MODE,f.PLANAR_MODE=ie.Engine.TEXTURE_PLANAR_MODE,f.CUBIC_MODE=ie.Engine.TEXTURE_CUBIC_MODE,f.PROJECTION_MODE=ie.Engine.TEXTURE_PROJECTION_MODE,f.SKYBOX_MODE=ie.Engine.TEXTURE_SKYBOX_MODE,f.INVCUBIC_MODE=ie.Engine.TEXTURE_INVCUBIC_MODE,f.EQUIRECTANGULAR_MODE=ie.Engine.TEXTURE_EQUIRECTANGULAR_MODE,f.FIXED_EQUIRECTANGULAR_MODE=ie.Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MODE,f.FIXED_EQUIRECTANGULAR_MIRRORED_MODE=ie.Engine.TEXTURE_FIXED_EQUIRECTANGULAR_MIRRORED_MODE,f.CLAMP_ADDRESSMODE=ie.Engine.TEXTURE_CLAMP_ADDRESSMODE,f.WRAP_ADDRESSMODE=ie.Engine.TEXTURE_WRAP_ADDRESSMODE,f.MIRROR_ADDRESSMODE=ie.Engine.TEXTURE_MIRROR_ADDRESSMODE,f.UseSerializedUrlIfAny=!1,b([ie.serialize()],f.prototype,"url",void 0),b([ie.serialize()],f.prototype,"uOffset",void 0),b([ie.serialize()],f.prototype,"vOffset",void 0),b([ie.serialize()],f.prototype,"uScale",void 0),b([ie.serialize()],f.prototype,"vScale",void 0),b([ie.serialize()],f.prototype,"uAng",void 0),b([ie.serialize()],f.prototype,"vAng",void 0),b([ie.serialize()],f.prototype,"wAng",void 0),b([ie.serialize()],f.prototype,"uRotationCenter",void 0),b([ie.serialize()],f.prototype,"vRotationCenter",void 0),b([ie.serialize()],f.prototype,"wRotationCenter",void 0),b([ie.serialize()],f.prototype,"isBlocking",null),f})(ie.BaseTexture),ie.Texture=re,(function(S){var e=function(){};S._CreationDataStorage=e;var m=function(){this.visibleInstances={},this.renderIdForInstances=new Array,this.batchCache=new t,this.instancesBufferSize=2048},t=function(){this.mustReturn=!1,this.visibleInstances=new Array,this.renderSelf=new Array};S._InstancesBatch=t;var i=(function(v){function _(e,t,i,r,n,o){void 0===t&&(t=null),void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=!0);var s=v.call(this,e,t)||this;if(s.delayLoadState=S.Engine.DELAYLOADSTATE_NONE,s.instances=new Array,s._LODLevels=new Array,s._instanceDataStorage=new m,s._originalBuilderSideOrientation=_.DEFAULTSIDE,s.overrideMaterialSideOrientation=null,s._areNormalsFrozen=!1,s._source=null,t=s.getScene(),r){if(r._geometry&&r._geometry.applyToMesh(s),S.Tools.DeepCopy(r,s,["name","material","skeleton","instances","parent","uniqueId","source","metadata","hasLODLevels","geometry","isBlocked","areNormalsFrozen","onBeforeDrawObservable","onBeforeRenderObservable","onAfterRenderObservable","onBeforeDraw"],["_poseMatrix"]),s._source=r,s._originalBuilderSideOrientation=r._originalBuilderSideOrientation,s._creationDataStorage=r._creationDataStorage,s._source._ranges){var a=s._source._ranges;for(var e in a)a.hasOwnProperty(e)&&a[e]&&s.createAnimationRange(e,a[e].from,a[e].to)}var l;if(r.metadata&&r.metadata.clone?s.metadata=r.metadata.clone():s.metadata=r.metadata,S.Tags&&S.Tags.HasTags(r)&&S.Tags.AddTagsTo(s,S.Tags.GetTags(r,!0)),s.parent=r.parent,s.setPivotMatrix(r.getPivotMatrix()),s.id=e+"."+r.id,s.material=r.material,!n)for(var c=r.getDescendants(!0),h=0;h<c.length;h++){var u=c[h];u.clone&&u.clone(e+"."+u.name,s)}var d=s.getScene().getPhysicsEngine();if(o&&d){var f=d.getImpostorForPhysicsObject(r);f&&(s.physicsImpostor=f.clone(s))}for(l=0;l<t.particleSystems.length;l++){var p=t.particleSystems[l];p.emitter===r&&p.clone(p.name,s)}s.refreshBoundingInfo(),s.computeWorldMatrix(!0)}return null!==i&&(s.parent=i),s}return T(_,v),Object.defineProperty(_.prototype,"onBeforeRenderObservable",{get:function(){return this._onBeforeRenderObservable||(this._onBeforeRenderObservable=new S.Observable),this._onBeforeRenderObservable},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"onAfterRenderObservable",{get:function(){return this._onAfterRenderObservable||(this._onAfterRenderObservable=new S.Observable),this._onAfterRenderObservable},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"onBeforeDrawObservable",{get:function(){return this._onBeforeDrawObservable||(this._onBeforeDrawObservable=new S.Observable),this._onBeforeDrawObservable},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"onBeforeDraw",{set:function(e){this._onBeforeDrawObserver&&this.onBeforeDrawObservable.remove(this._onBeforeDrawObserver),this._onBeforeDrawObserver=this.onBeforeDrawObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"morphTargetManager",{get:function(){return this._morphTargetManager},set:function(e){this._morphTargetManager!==e&&(this._morphTargetManager=e,this._syncGeometryWithMorphTargetManager())},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"source",{get:function(){return this._source},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"isUnIndexed",{get:function(){return this._unIndexed},set:function(e){this._unIndexed!==e&&(this._unIndexed=e,this._markSubMeshesAsAttributesDirty())},enumerable:!0,configurable:!0}),_.prototype.getClassName=function(){return"Mesh"},_.prototype.toString=function(e){var t=v.prototype.toString.call(this,e);if(t+=", n vertices: "+this.getTotalVertices(),t+=", parent: "+(this._waitingParentId?this._waitingParentId:this.parent?this.parent.name:"NONE"),this.animations)for(var i=0;i<this.animations.length;i++)t+=", animation[0]: "+this.animations[i].toString(e);if(e)if(this._geometry){var r=this.getIndices(),n=this.getVerticesData(S.VertexBuffer.PositionKind);n&&r&&(t+=", flat shading: "+(n.length/3===r.length?"YES":"NO"))}else t+=", flat shading: UNKNOWN";return t},_.prototype._unBindEffect=function(){v.prototype._unBindEffect.call(this);for(var e=0,t=this.instances;e<t.length;e++){t[e]._unBindEffect()}},Object.defineProperty(_.prototype,"hasLODLevels",{get:function(){return 0<this._LODLevels.length},enumerable:!0,configurable:!0}),_.prototype.getLODLevels=function(){return this._LODLevels},_.prototype._sortLODLevels=function(){this._LODLevels.sort((function(e,t){return e.distance<t.distance?1:e.distance>t.distance?-1:0}))},_.prototype.addLODLevel=function(e,t){if(t&&t._masterMesh)return S.Tools.Warn("You cannot use a mesh as LOD level twice"),this;var i=new S.MeshLODLevel(e,t);return this._LODLevels.push(i),t&&(t._masterMesh=this),this._sortLODLevels(),this},_.prototype.getLODLevelAtDistance=function(e){for(var t=0;t<this._LODLevels.length;t++){var i=this._LODLevels[t];if(i.distance===e)return i.mesh}return null},_.prototype.removeLODLevel=function(e){for(var t=0;t<this._LODLevels.length;t++)this._LODLevels[t].mesh===e&&(this._LODLevels.splice(t,1),e&&(e._masterMesh=null));return this._sortLODLevels(),this},_.prototype.getLOD=function(e,t){if(!this._LODLevels||0===this._LODLevels.length)return this;var i;t?i=t:i=this.getBoundingInfo().boundingSphere;var r=i.centerWorld.subtract(e.globalPosition).length();if(this._LODLevels[this._LODLevels.length-1].distance>r)return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,this._LODLevels[this._LODLevels.length-1].mesh),this;for(var n=0;n<this._LODLevels.length;n++){var o=this._LODLevels[n];if(o.distance<r)return o.mesh&&(o.mesh._preActivate(),o.mesh._updateSubMeshesBoundingInfo(this.worldMatrixFromCache)),this.onLODLevelSelection&&this.onLODLevelSelection(r,this,o.mesh),o.mesh}return this.onLODLevelSelection&&this.onLODLevelSelection(r,this,this),this},Object.defineProperty(_.prototype,"geometry",{get:function(){return this._geometry},enumerable:!0,configurable:!0}),_.prototype.getTotalVertices=function(){return null===this._geometry||void 0===this._geometry?0:this._geometry.getTotalVertices()},_.prototype.getVerticesData=function(e,t,i){return this._geometry?this._geometry.getVerticesData(e,t,i):null},_.prototype.getVertexBuffer=function(e){return this._geometry?this._geometry.getVertexBuffer(e):null},_.prototype.isVerticesDataPresent=function(e){return this._geometry?this._geometry.isVerticesDataPresent(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},_.prototype.isVertexBufferUpdatable=function(e){return this._geometry?this._geometry.isVertexBufferUpdatable(e):!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},_.prototype.getVerticesDataKinds=function(){if(!this._geometry){var r=new Array;return this._delayInfo&&this._delayInfo.forEach((function(e,t,i){r.push(e)})),r}return this._geometry.getVerticesDataKinds()},_.prototype.getTotalIndices=function(){return this._geometry?this._geometry.getTotalIndices():0},_.prototype.getIndices=function(e,t){return this._geometry?this._geometry.getIndices(e,t):[]},Object.defineProperty(_.prototype,"isBlocked",{get:function(){return null!==this._masterMesh&&void 0!==this._masterMesh},enumerable:!0,configurable:!0}),_.prototype.isReady=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),this.delayLoadState===S.Engine.DELAYLOADSTATE_LOADING)return!1;if(!v.prototype.isReady.call(this,e))return!1;if(!this.subMeshes||0===this.subMeshes.length)return!0;if(!e)return!0;var i=this.getEngine(),r=this.getScene(),n=t||i.getCaps().instancedArrays&&0<this.instances.length;this.computeWorldMatrix();var o=this.material||r.defaultMaterial;if(o)if(o.storeEffectOnSubMeshes)for(var s=0,a=this.subMeshes;s<a.length;s++){var l=(p=a[s]).getMaterial();if(l)if(l.storeEffectOnSubMeshes){if(!l.isReadyForSubMesh(this,p,n))return!1}else if(!l.isReady(this,n))return!1}else if(!o.isReady(this,n))return!1;for(var c=0,h=this._lightSources;c<h.length;c++){var u=h[c].getShadowGenerator();if(u)for(var d=0,f=this.subMeshes;d<f.length;d++){var p=f[d];if(!u.isReady(p,n))return!1}}for(var _=0,m=this._LODLevels;_<m.length;_++){var g=m[_];if(g.mesh&&!g.mesh.isReady(n))return!1}return!0},Object.defineProperty(_.prototype,"areNormalsFrozen",{get:function(){return this._areNormalsFrozen},enumerable:!0,configurable:!0}),_.prototype.freezeNormals=function(){return this._areNormalsFrozen=!0,this},_.prototype.unfreezeNormals=function(){return this._areNormalsFrozen=!1,this},Object.defineProperty(_.prototype,"overridenInstanceCount",{set:function(e){this._instanceDataStorage.overridenInstanceCount=e},enumerable:!0,configurable:!0}),_.prototype._preActivate=function(){var e=this.getScene().getRenderId();return this._preActivateId===e||(this._preActivateId=e,this._instanceDataStorage.visibleInstances=null),this},_.prototype._preActivateForIntermediateRendering=function(e){return this._instanceDataStorage.visibleInstances&&(this._instanceDataStorage.visibleInstances.intermediateDefaultRenderId=e),this},_.prototype._registerInstanceForRenderId=function(e,t){return this._instanceDataStorage.visibleInstances||(this._instanceDataStorage.visibleInstances={},this._instanceDataStorage.visibleInstances.defaultRenderId=t,this._instanceDataStorage.visibleInstances.selfDefaultRenderId=this._renderId),this._instanceDataStorage.visibleInstances[t]||(this._instanceDataStorage.visibleInstances[t]=new Array),this._instanceDataStorage.visibleInstances[t].push(e),this},_.prototype.refreshBoundingInfo=function(){return this._refreshBoundingInfo(!1)},_.prototype._refreshBoundingInfo=function(e){if(this._boundingInfo&&this._boundingInfo.isLocked)return this;var t=this._getPositionData(e);if(t){var i=this.geometry?this.geometry.boundingBias:null,r=S.Tools.ExtractMinAndMax(t,0,this.getTotalVertices(),i);this._boundingInfo=new S.BoundingInfo(r.minimum,r.maximum)}if(this.subMeshes)for(var n=0;n<this.subMeshes.length;n++)this.subMeshes[n].refreshBoundingInfo();return this._updateBoundingInfo(),this},_.prototype._getPositionData=function(e){var t=this.getVerticesData(S.VertexBuffer.PositionKind);if(t&&e&&this.skeleton){t=S.Tools.Slice(t);var i=this.getVerticesData(S.VertexBuffer.MatricesIndicesKind),r=this.getVerticesData(S.VertexBuffer.MatricesWeightsKind);if(r&&i)for(var n=4<this.numBoneInfluencers,o=n?this.getVerticesData(S.VertexBuffer.MatricesIndicesExtraKind):null,s=n?this.getVerticesData(S.VertexBuffer.MatricesWeightsExtraKind):null,a=this.skeleton.getTransformMatrices(this),l=S.Tmp.Vector3[0],c=S.Tmp.Matrix[0],h=S.Tmp.Matrix[1],u=0,d=0;d<t.length;d+=3,u+=4){var f,p;for(c.reset(),f=0;f<4;f++)0<(p=r[u+f])&&(S.Matrix.FromFloat32ArrayToRefScaled(a,Math.floor(16*i[u+f]),p,h),c.addToSelf(h));if(n)for(f=0;f<4;f++)0<(p=s[u+f])&&(S.Matrix.FromFloat32ArrayToRefScaled(a,Math.floor(16*o[u+f]),p,h),c.addToSelf(h));S.Vector3.TransformCoordinatesFromFloatsToRef(t[d],t[d+1],t[d+2],c,l),l.toArray(t,d)}}return t},_.prototype._createGlobalSubMesh=function(e){var t=this.getTotalVertices();if(!t||!this.getIndices())return null;if(this.subMeshes&&0<this.subMeshes.length){var i=this.getIndices();if(!i)return null;var r=i.length,n=!1;if(e)n=!0;else for(var o=0,s=this.subMeshes;o<s.length;o++){var a=s[o];if(a.indexStart+a.indexCount>=r){n=!0;break}if(a.verticesStart+a.verticesCount>=t){n=!0;break}}if(!n)return this.subMeshes[0]}return this.releaseSubMeshes(),new S.SubMesh(0,0,t,0,this.getTotalIndices(),this)},_.prototype.subdivide=function(e){if(!(e<1)){for(var t=this.getTotalIndices(),i=t/e|0,r=0;i%3!=0;)i++;this.releaseSubMeshes();for(var n=0;n<e&&!(t<=r);n++)S.SubMesh.CreateFromIndices(0,r,Math.min(i,t-r),this),r+=i;this.synchronizeInstances()}},_.prototype.setVerticesData=function(e,t,i,r){if(void 0===i&&(i=!1),this._geometry)this._geometry.setVerticesData(e,t,i,r);else{var n=new S.VertexData;n.set(t,e);var o=this.getScene();new S.Geometry(S.Geometry.RandomId(),o,n,i,this)}return this},_.prototype.markVerticesDataAsUpdatable=function(e,t){void 0===t&&(t=!0);var i=this.getVertexBuffer(e);i&&i.isUpdatable()!==t&&this.setVerticesData(e,this.getVerticesData(e),t)},_.prototype.setVerticesBuffer=function(e){return this._geometry||(this._geometry=S.Geometry.CreateGeometryForMesh(this)),this._geometry.setVerticesBuffer(e),this},_.prototype.updateVerticesData=function(e,t,i,r){return this._geometry&&(r?(this.makeGeometryUnique(),this.updateVerticesData(e,t,i,!1)):this._geometry.updateVerticesData(e,t,i)),this},_.prototype.updateMeshPositions=function(e,t){void 0===t&&(t=!0);var i=this.getVerticesData(S.VertexBuffer.PositionKind);if(!i)return this;if(e(i),this.updateVerticesData(S.VertexBuffer.PositionKind,i,!1,!1),t){var r=this.getIndices(),n=this.getVerticesData(S.VertexBuffer.NormalKind);if(!n)return this;S.VertexData.ComputeNormals(i,r,n),this.updateVerticesData(S.VertexBuffer.NormalKind,n,!1,!1)}return this},_.prototype.makeGeometryUnique=function(){if(!this._geometry)return this;var e=this._geometry,t=this._geometry.copy(S.Geometry.RandomId());return e.releaseForMesh(this,!0),t.applyToMesh(this),this},_.prototype.setIndices=function(e,t,i){if(void 0===t&&(t=null),void 0===i&&(i=!1),this._geometry)this._geometry.setIndices(e,t,i);else{var r=new S.VertexData;r.indices=e;var n=this.getScene();new S.Geometry(S.Geometry.RandomId(),n,r,i,this)}return this},_.prototype.updateIndices=function(e,t){return this._geometry&&this._geometry.updateIndices(e,t),this},_.prototype.toLeftHanded=function(){return this._geometry&&this._geometry.toLeftHanded(),this},_.prototype._bind=function(e,t,i){if(!this._geometry)return this;var r,n=this.getScene().getEngine();if(this._unIndexed)r=null;else switch(i){case S.Material.PointFillMode:r=null;break;case S.Material.WireFrameFillMode:r=e._getLinesIndexBuffer(this.getIndices(),n);break;default:case S.Material.TriangleFillMode:r=this._unIndexed?null:this._geometry.getIndexBuffer()}return this._geometry._bind(t,r),this},_.prototype._draw=function(e,t,i,r){if(void 0===r&&(r=!1),!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._onBeforeDrawObservable&&this._onBeforeDrawObservable.notifyObservers(this);var n=this.getScene(),o=n.getEngine();if(this._unIndexed||t==S.Material.PointFillMode?o.drawArraysType(t,e.verticesStart,e.verticesCount,i):t==S.Material.WireFrameFillMode?o.drawElementsType(t,0,e._linesIndexCount,i):o.drawElementsType(t,e.indexStart,e.indexCount,i),n._isAlternateRenderingEnabled&&!r){var s=e.effect||this._effectiveMaterial.getEffect();if(!s||!n.activeCamera)return this;n._switchToAlternateCameraConfiguration(!0),this._effectiveMaterial.bindView(s),this._effectiveMaterial.bindViewProjection(s),o.setViewport(n.activeCamera._alternateCamera.viewport),this._draw(e,t,i,!0),o.setViewport(n.activeCamera.viewport),n._switchToAlternateCameraConfiguration(!1),this._effectiveMaterial.bindView(s),this._effectiveMaterial.bindViewProjection(s)}return this},_.prototype.registerBeforeRender=function(e){return this.onBeforeRenderObservable.add(e),this},_.prototype.unregisterBeforeRender=function(e){return this.onBeforeRenderObservable.removeCallback(e),this},_.prototype.registerAfterRender=function(e){return this.onAfterRenderObservable.add(e),this},_.prototype.unregisterAfterRender=function(e){return this.onAfterRenderObservable.removeCallback(e),this},_.prototype._getInstancesRenderList=function(e){var t=this.getScene(),i=this._instanceDataStorage.batchCache;if(i.mustReturn=!1,i.renderSelf[e]=this.isEnabled()&&this.isVisible,i.visibleInstances[e]=null,this._instanceDataStorage.visibleInstances){var r=this._instanceDataStorage.visibleInstances,n=t.getRenderId(),o=t._isInIntermediateRendering()?r.intermediateDefaultRenderId:r.defaultRenderId;i.visibleInstances[e]=r[n];var s=this._renderId;!i.visibleInstances[e]&&o&&(i.visibleInstances[e]=r[o],n=Math.max(o,n),s=Math.max(r.selfDefaultRenderId,n));var a=i.visibleInstances[e];if(a&&a.length){if(this._instanceDataStorage.renderIdForInstances[e]===n)return i.mustReturn=!0,i;n!==s&&(i.renderSelf[e]=!1)}this._instanceDataStorage.renderIdForInstances[e]=n}return i},_.prototype._renderWithInstances=function(e,t,i,r,n){var o=i.visibleInstances[e._id];if(!o)return this;for(var s=16*(o.length+1)*4,a=this._instanceDataStorage,l=a.instancesBufferSize,c=a.instancesBuffer;a.instancesBufferSize<s;)a.instancesBufferSize*=2;a.instancesData&&l==a.instancesBufferSize||(a.instancesData=new Float32Array(a.instancesBufferSize/4));var h=0,u=0,d=this.getWorldMatrix();if(i.renderSelf[e._id]&&(d.copyToArray(a.instancesData,h),h+=16,u++),o)for(var f=0;f<o.length;f++){o[f].getWorldMatrix().copyToArray(a.instancesData,h),h+=16,u++}return c&&l==a.instancesBufferSize?c.updateDirectly(a.instancesData,0,u):(c&&c.dispose(),c=new S.Buffer(n,a.instancesData,!0,16,!1,!0),a.instancesBuffer=c,this.setVerticesBuffer(c.createVertexBuffer("world0",0,4)),this.setVerticesBuffer(c.createVertexBuffer("world1",4,4)),this.setVerticesBuffer(c.createVertexBuffer("world2",8,4)),this.setVerticesBuffer(c.createVertexBuffer("world3",12,4))),this._bind(e,r,t),this._draw(e,t,u),n.unbindInstanceAttributes(),this},_.prototype._processRendering=function(e,t,i,r,n,o,s){var a=this.getScene().getEngine();if(n)this._renderWithInstances(e,i,r,t,a);else{r.renderSelf[e._id]&&(o&&o(!1,this.getWorldMatrix(),s),this._draw(e,i,this._instanceDataStorage.overridenInstanceCount));var l=r.visibleInstances[e._id];if(l)for(var c=0;c<l.length;c++){var h=l[c].getWorldMatrix();o&&o(!0,h,s),this._draw(e,i)}}return this},_.prototype.render=function(e,t){if(this._checkOcclusionQuery())return this;var i=this.getScene(),r=this._getInstancesRenderList(e._id);if(r.mustReturn)return this;if(!this._geometry||!this._geometry.getVertexBuffers()||!this._unIndexed&&!this._geometry.getIndexBuffer())return this;this._onBeforeRenderObservable&&this._onBeforeRenderObservable.notifyObservers(this);var n,o=i.getEngine(),s=o.getCaps().instancedArrays&&null!==r.visibleInstances[e._id]&&void 0!==r.visibleInstances[e._id],a=e.getMaterial();if(!a)return this;if(this._effectiveMaterial=a,this._effectiveMaterial.storeEffectOnSubMeshes){if(!this._effectiveMaterial.isReadyForSubMesh(this,e,s))return this}else if(!this._effectiveMaterial.isReady(this,s))return this;t&&o.setAlphaMode(this._effectiveMaterial.alphaMode);for(var l=0,c=i._beforeRenderingMeshStage;l<c.length;l++){c[l].action(this,e,r)}if(!(n=this._effectiveMaterial.storeEffectOnSubMeshes?e.effect:this._effectiveMaterial.getEffect()))return this;var h=this.overrideMaterialSideOrientation;null==h&&(h=this._effectiveMaterial.sideOrientation,this._getWorldMatrixDeterminant()<0&&(h=h===S.Material.ClockWiseSideOrientation?S.Material.CounterClockWiseSideOrientation:S.Material.ClockWiseSideOrientation));var u=this._effectiveMaterial._preBind(n,h);this._effectiveMaterial.forceDepthWrite&&o.setDepthWrite(!0);var d=i.forcePointsCloud?S.Material.PointFillMode:i.forceWireframe?S.Material.WireFrameFillMode:this._effectiveMaterial.fillMode;s||this._bind(e,n,d);var f=this.getWorldMatrix();this._effectiveMaterial.storeEffectOnSubMeshes?this._effectiveMaterial.bindForSubMesh(f,this,e):this._effectiveMaterial.bind(f,this),!this._effectiveMaterial.backFaceCulling&&this._effectiveMaterial.separateCullingPass&&(o.setState(!0,this._effectiveMaterial.zOffset,!1,!u),this._processRendering(e,n,d,r,s,this._onBeforeDraw,this._effectiveMaterial),o.setState(!0,this._effectiveMaterial.zOffset,!1,u)),this._processRendering(e,n,d,r,s,this._onBeforeDraw,this._effectiveMaterial),this._effectiveMaterial.unbind();for(var p=0,_=i._afterRenderingMeshStage;p<_.length;p++){_[p].action(this,e,r)}return this._onAfterRenderObservable&&this._onAfterRenderObservable.notifyObservers(this),this},_.prototype._onBeforeDraw=function(e,t,i){e&&i&&i.bindOnlyWorldMatrix(t)},_.prototype.cleanMatrixWeights=function(){this.isVerticesDataPresent(S.VertexBuffer.MatricesWeightsKind)&&(this.isVerticesDataPresent(S.VertexBuffer.MatricesWeightsExtraKind)?this.normalizeSkinWeightsAndExtra():this.normalizeSkinFourWeights())},_.prototype.normalizeSkinFourWeights=function(){for(var e=this.getVerticesData(S.VertexBuffer.MatricesWeightsKind),t=e.length,i=0;i<t;i+=4){var r=e[i]+e[i+1]+e[i+2]+e[i+3];if(0===r)e[i]=1;else{var n=1/r;e[i]*=n,e[i+1]*=n,e[i+2]*=n,e[i+3]*=n}}this.setVerticesData(S.VertexBuffer.MatricesWeightsKind,e)},_.prototype.normalizeSkinWeightsAndExtra=function(){for(var e=this.getVerticesData(S.VertexBuffer.MatricesWeightsExtraKind),t=this.getVerticesData(S.VertexBuffer.MatricesWeightsKind),i=t.length,r=0;r<i;r+=4){var n=t[r]+t[r+1]+t[r+2]+t[r+3];if(0===(n+=e[r]+e[r+1]+e[r+2]+e[r+3]))t[r]=1;else{var o=1/n;t[r]*=o,t[r+1]*=o,t[r+2]*=o,t[r+3]*=o,e[r]*=o,e[r+1]*=o,e[r+2]*=o,e[r+3]*=o}}this.setVerticesData(S.VertexBuffer.MatricesWeightsKind,t),this.setVerticesData(S.VertexBuffer.MatricesWeightsKind,e)},_.prototype.validateSkinning=function(){var e=this.getVerticesData(S.VertexBuffer.MatricesWeightsExtraKind),t=this.getVerticesData(S.VertexBuffer.MatricesWeightsKind);if(null===t||null==this.skeleton)return{skinned:!1,valid:!0,report:"not skinned"};for(var i=t.length,r=0,n=0,o=0,s=0,a=null===e?4:8,l=new Array,c=0;c<=a;c++)l[c]=0;for(c=0;c<i;c+=4){for(var h=t[c],u=h,d=0===u?0:1,f=1;f<a;f++){var p=f<4?t[c+f]:e[c+f-4];h<p&&r++,0!==p&&d++,u+=p,h=p}if(l[d]++,o<d&&(o=d),0===u)n++;else{var _=1/u,m=0;for(f=0;f<a;f++)m+=f<4?Math.abs(t[c+f]-t[c+f]*_):Math.abs(e[c+f-4]-e[c+f-4]*_);.001<m&&s++}}var g=this.skeleton.bones.length,v=this.getVerticesData(S.VertexBuffer.MatricesIndicesKind),y=this.getVerticesData(S.VertexBuffer.MatricesIndicesExtraKind),b=0;for(c=0;c<i;c++)for(f=0;f<a;f++){var T=f<4?v[f]:y[f-4];(g<=T||T<0)&&b++}return{skinned:!0,valid:0===n&&0===s&&0===b,report:"Number of Weights = "+i/4+"\nMaximum influences = "+o+"\nMissing Weights = "+n+"\nNot Sorted = "+r+"\nNot Normalized = "+s+"\nWeightCounts = ["+l+"]\nNumber of bones = "+g+"\nBad Bone Indices = "+b}},_.prototype._checkDelayState=function(){var e=this.getScene();return this._geometry?this._geometry.load(e):this.delayLoadState===S.Engine.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=S.Engine.DELAYLOADSTATE_LOADING,this._queueLoad(e)),this},_.prototype._queueLoad=function(t){var i=this;t._addPendingData(this);var e=-1!==this.delayLoadingFile.indexOf(".babylonbinarymeshdata");return S.Tools.LoadFile(this.delayLoadingFile,(function(e){e instanceof ArrayBuffer?i._delayLoadingFunction(e,i):i._delayLoadingFunction(JSON.parse(e),i),i.instances.forEach((function(e){e._syncSubMeshes()})),i.delayLoadState=S.Engine.DELAYLOADSTATE_LOADED,t._removePendingData(i)}),(function(){}),t.database,e),this},_.prototype.isInFrustum=function(e){return this.delayLoadState!==S.Engine.DELAYLOADSTATE_LOADING&&(!!v.prototype.isInFrustum.call(this,e)&&(this._checkDelayState(),!0))},_.prototype.setMaterialByID=function(e){var t,i=this.getScene().materials;for(t=i.length-1;-1<t;t--)if(i[t].id===e)return this.material=i[t],this;var r=this.getScene().multiMaterials;for(t=r.length-1;-1<t;t--)if(r[t].id===e)return this.material=r[t],this;return this},_.prototype.getAnimatables=function(){var e=new Array;return this.material&&e.push(this.material),this.skeleton&&e.push(this.skeleton),e},_.prototype.bakeTransformIntoVertices=function(e){if(!this.isVerticesDataPresent(S.VertexBuffer.PositionKind))return this;var t=this.subMeshes.splice(0);this._resetPointsArrayCache();var i,r=this.getVerticesData(S.VertexBuffer.PositionKind),n=new Array;for(i=0;i<r.length;i+=3)S.Vector3.TransformCoordinates(S.Vector3.FromArray(r,i),e).toArray(n,i);if(this.setVerticesData(S.VertexBuffer.PositionKind,n,this.getVertexBuffer(S.VertexBuffer.PositionKind).isUpdatable()),this.isVerticesDataPresent(S.VertexBuffer.NormalKind)){for(r=this.getVerticesData(S.VertexBuffer.NormalKind),n=[],i=0;i<r.length;i+=3)S.Vector3.TransformNormal(S.Vector3.FromArray(r,i),e).normalize().toArray(n,i);this.setVerticesData(S.VertexBuffer.NormalKind,n,this.getVertexBuffer(S.VertexBuffer.NormalKind).isUpdatable())}return e.m[0]*e.m[5]*e.m[10]<0&&this.flipFaces(),this.releaseSubMeshes(),this.subMeshes=t,this},_.prototype.bakeCurrentTransformIntoVertices=function(){return this.bakeTransformIntoVertices(this.computeWorldMatrix(!0)),this.scaling.copyFromFloats(1,1,1),this.position.copyFromFloats(0,0,0),this.rotation.copyFromFloats(0,0,0),this.rotationQuaternion&&(this.rotationQuaternion=S.Quaternion.Identity()),this._worldMatrix=S.Matrix.Identity(),this},Object.defineProperty(_.prototype,"_positions",{get:function(){return this._geometry?this._geometry._positions:null},enumerable:!0,configurable:!0}),_.prototype._resetPointsArrayCache=function(){return this._geometry&&this._geometry._resetPointsArrayCache(),this},_.prototype._generatePointsArray=function(){return!!this._geometry&&this._geometry._generatePointsArray()},_.prototype.clone=function(e,t,i,r){return void 0===e&&(e=""),void 0===r&&(r=!0),new _(e,this.getScene(),t,this,i,r)},_.prototype.dispose=function(e,t){var i=this;for(void 0===t&&(t=!1),this.morphTargetManager=null,this._geometry&&this._geometry.releaseForMesh(this,!0),this._onBeforeDrawObservable&&this._onBeforeDrawObservable.clear(),this._onBeforeRenderObservable&&this._onBeforeRenderObservable.clear(),this._onAfterRenderObservable&&this._onAfterRenderObservable.clear(),this.getScene().meshes.forEach((function(e){var t=e;t._source&&t._source===i&&(t._source=null)})),this._source=null,this._instanceDataStorage.instancesBuffer&&(this._instanceDataStorage.instancesBuffer.dispose(),this._instanceDataStorage.instancesBuffer=null);this.instances.length;)this.instances[0].dispose();v.prototype.dispose.call(this,e,t)},_.prototype.applyDisplacementMap=function(e,s,a,l,c,h,u){var d=this;void 0===u&&(u=!1);var t=this.getScene();return S.Tools.LoadImage(e,(function(e){var t=document.createElement("canvas"),i=t.getContext("2d"),r=e.width,n=e.height;t.width=r,t.height=n,i.drawImage(e,0,0);var o=i.getImageData(0,0,r,n).data;d.applyDisplacementMapFromBuffer(o,r,n,s,a,c,h,u),l&&l(d)}),(function(){}),t.database),this},_.prototype.applyDisplacementMapFromBuffer=function(e,t,i,r,n,o,s,a){if(void 0===a&&(a=!1),!this.isVerticesDataPresent(S.VertexBuffer.PositionKind)||!this.isVerticesDataPresent(S.VertexBuffer.NormalKind)||!this.isVerticesDataPresent(S.VertexBuffer.UVKind))return S.Tools.Warn("Cannot call applyDisplacementMap: Given mesh is not complete. Position, Normal or UV are missing"),this;var l=this.getVerticesData(S.VertexBuffer.PositionKind,!0,!0),c=this.getVerticesData(S.VertexBuffer.NormalKind),h=this.getVerticesData(S.VertexBuffer.UVKind),u=S.Vector3.Zero(),d=S.Vector3.Zero(),f=S.Vector2.Zero();o=o||S.Vector2.Zero(),s=s||new S.Vector2(1,1);for(var p=0;p<l.length;p+=3){S.Vector3.FromArrayToRef(l,p,u),S.Vector3.FromArrayToRef(c,p,d),S.Vector2.FromArrayToRef(h,p/3*2,f);var _=4*((Math.abs(f.x*s.x+o.x)*t%t|0)+(Math.abs(f.y*s.y+o.y)*i%i|0)*t),m=.3*(e[_]/255)+.59*(e[_+1]/255)+.11*(e[_+2]/255);d.normalize(),d.scaleInPlace(r+(n-r)*m),(u=u.add(d)).toArray(l,p)}return S.VertexData.ComputeNormals(l,this.getIndices(),c),a?(this.setVerticesData(S.VertexBuffer.PositionKind,l),this.setVerticesData(S.VertexBuffer.NormalKind,c)):(this.updateVerticesData(S.VertexBuffer.PositionKind,l),this.updateVerticesData(S.VertexBuffer.NormalKind,c)),this},_.prototype.convertToFlatShadedMesh=function(){var e,t,i=this.getVerticesDataKinds(),r={},n={},o={},s=!1;for(e=0;e<i.length;e++){t=i[e];var a=this.getVertexBuffer(t);t!==S.VertexBuffer.NormalKind?(r[t]=a,n[t]=r[t].getData(),o[t]=[]):(s=a.isUpdatable(),i.splice(e,1),e--)}var l,c=this.subMeshes.slice(0),h=this.getIndices(),u=this.getTotalIndices();for(l=0;l<u;l++){var d=h[l];for(e=0;e<i.length;e++)for(var f=r[t=i[e]].getStrideSize(),p=0;p<f;p++)o[t].push(n[t][d*f+p])}var _=[],m=o[S.VertexBuffer.PositionKind];for(l=0;l<u;l+=3){h[l]=l,h[l+1]=l+1,h[l+2]=l+2;for(var g=S.Vector3.FromArray(m,3*l),v=S.Vector3.FromArray(m,3*(l+1)),y=S.Vector3.FromArray(m,3*(l+2)),b=g.subtract(v),T=y.subtract(v),E=S.Vector3.Normalize(S.Vector3.Cross(b,T)),x=0;x<3;x++)_.push(E.x),_.push(E.y),_.push(E.z)}for(this.setIndices(h),this.setVerticesData(S.VertexBuffer.NormalKind,_,s),e=0;e<i.length;e++)t=i[e],this.setVerticesData(t,o[t],r[t].isUpdatable());this.releaseSubMeshes();for(var P=0;P<c.length;P++){var A=c[P];S.SubMesh.AddToMesh(A.materialIndex,A.indexStart,A.indexCount,A.indexStart,A.indexCount,this)}return this.synchronizeInstances(),this},_.prototype.convertToUnIndexedMesh=function(){var e,t,i=this.getVerticesDataKinds(),r={},n={},o={};for(e=0;e<i.length;e++){t=i[e];var s=this.getVertexBuffer(t);r[t]=s,n[t]=r[t].getData(),o[t]=[]}var a,l=this.subMeshes.slice(0),c=this.getIndices(),h=this.getTotalIndices();for(a=0;a<h;a++){var u=c[a];for(e=0;e<i.length;e++)for(var d=r[t=i[e]].getStrideSize(),f=0;f<d;f++)o[t].push(n[t][u*d+f])}for(a=0;a<h;a+=3)c[a]=a,c[a+1]=a+1,c[a+2]=a+2;for(this.setIndices(c),e=0;e<i.length;e++)t=i[e],this.setVerticesData(t,o[t],r[t].isUpdatable());this.releaseSubMeshes();for(var p=0;p<l.length;p++){var _=l[p];S.SubMesh.AddToMesh(_.materialIndex,_.indexStart,_.indexCount,_.indexStart,_.indexCount,this)}return this._unIndexed=!0,this.synchronizeInstances(),this},_.prototype.flipFaces=function(e){void 0===e&&(e=!1);var t,i,r=S.VertexData.ExtractFromMesh(this);if(e&&this.isVerticesDataPresent(S.VertexBuffer.NormalKind)&&r.normals)for(t=0;t<r.normals.length;t++)r.normals[t]*=-1;if(r.indices)for(t=0;t<r.indices.length;t+=3)i=r.indices[t+1],r.indices[t+1]=r.indices[t+2],r.indices[t+2]=i;return r.applyToMesh(this),this},_.prototype.createInstance=function(e){return new S.InstancedMesh(e,this)},_.prototype.synchronizeInstances=function(){for(var e=0;e<this.instances.length;e++){this.instances[e]._syncSubMeshes()}return this},_.prototype.optimizeIndices=function(i){var r=this,n=this.getIndices(),e=this.getVerticesData(S.VertexBuffer.PositionKind);if(!e||!n)return this;for(var o=new Array,t=0;t<e.length;t+=3)o.push(S.Vector3.FromArray(e,t));var s=new Array;return S.AsyncLoop.SyncAsyncForLoop(o.length,40,(function(e){for(var t=o.length-1-e,i=o[t],r=0;r<t;++r){var n=o[r];if(i.equals(n)){s[t]=r;break}}}),(function(){for(var e=0;e<n.length;++e)n[e]=s[n[e]]||n[e];var t=r.subMeshes.slice(0);r.setIndices(n),r.subMeshes=t,i&&i(r)})),this},_.prototype.serialize=function(e){e.name=this.name,e.id=this.id,e.type=this.getClassName(),S.Tags&&S.Tags.HasTags(this)&&(e.tags=S.Tags.GetTags(this)),e.position=this.position.asArray(),this.rotationQuaternion?e.rotationQuaternion=this.rotationQuaternion.asArray():this.rotation&&(e.rotation=this.rotation.asArray()),e.scaling=this.scaling.asArray(),e.localMatrix=this.getPivotMatrix().asArray(),e.isEnabled=this.isEnabled(!1),e.isVisible=this.isVisible,e.infiniteDistance=this.infiniteDistance,e.pickable=this.isPickable,e.receiveShadows=this.receiveShadows,e.billboardMode=this.billboardMode,e.visibility=this.visibility,e.checkCollisions=this.checkCollisions,e.isBlocker=this.isBlocker,this.parent&&(e.parentId=this.parent.id),e.isUnIndexed=this.isUnIndexed;var t=this._geometry;if(t){var i=t.id;e.geometryId=i,e.subMeshes=[];for(var r=0;r<this.subMeshes.length;r++){var n=this.subMeshes[r];e.subMeshes.push({materialIndex:n.materialIndex,verticesStart:n.verticesStart,verticesCount:n.verticesCount,indexStart:n.indexStart,indexCount:n.indexCount})}}this.material?e.materialId=this.material.id:this.material=null,this.morphTargetManager&&(e.morphTargetManagerId=this.morphTargetManager.uniqueId),this.skeleton&&(e.skeletonId=this.skeleton.id);var o=this.getPhysicsImpostor();o&&(e.physicsMass=o.getParam("mass"),e.physicsFriction=o.getParam("friction"),e.physicsRestitution=o.getParam("mass"),e.physicsImpostor=o.type),this.metadata&&(e.metadata=this.metadata),e.instances=[];for(var s=0;s<this.instances.length;s++){var a=this.instances[s];if(!a.doNotSerialize){var l={name:a.name,id:a.id,position:a.position.asArray(),scaling:a.scaling.asArray()};a.parent&&(l.parentId=a.parent.id),a.rotationQuaternion?l.rotationQuaternion=a.rotationQuaternion.asArray():a.rotation&&(l.rotation=a.rotation.asArray()),e.instances.push(l),S.Animation.AppendSerializedAnimations(a,l),l.ranges=a.serializeAnimationRanges()}}S.Animation.AppendSerializedAnimations(this,e),e.ranges=this.serializeAnimationRanges(),e.layerMask=this.layerMask,e.alphaIndex=this.alphaIndex,e.hasVertexAlpha=this.hasVertexAlpha,e.overlayAlpha=this.overlayAlpha,e.overlayColor=this.overlayColor.asArray(),e.renderOverlay=this.renderOverlay,e.applyFog=this.applyFog,this.actionManager&&(e.actions=this.actionManager.serialize(this.name))},_.prototype._syncGeometryWithMorphTargetManager=function(){if(this.geometry){this._markSubMeshesAsAttributesDirty();var e=this._morphTargetManager;if(e&&e.vertexCount){if(e.vertexCount!==this.getTotalVertices())return S.Tools.Error("Mesh is incompatible with morph targets. Targets and mesh must all have the same vertices count."),void(this.morphTargetManager=null);for(var t=0;t<e.numInfluencers;t++){var i=e.getActiveTarget(t),r=i.getPositions();if(!r)return void S.Tools.Error("Invalid morph target. Target must have positions.");this.geometry.setVerticesData(S.VertexBuffer.PositionKind+t,r,!1,3);var n=i.getNormals();n&&this.geometry.setVerticesData(S.VertexBuffer.NormalKind+t,n,!1,3);var o=i.getTangents();o&&this.geometry.setVerticesData(S.VertexBuffer.TangentKind+t,o,!1,3)}}else for(t=0;this.geometry.isVerticesDataPresent(S.VertexBuffer.PositionKind+t);)this.geometry.removeVerticesData(S.VertexBuffer.PositionKind+t),this.geometry.isVerticesDataPresent(S.VertexBuffer.NormalKind+t)&&this.geometry.removeVerticesData(S.VertexBuffer.NormalKind+t),this.geometry.isVerticesDataPresent(S.VertexBuffer.TangentKind+t)&&this.geometry.removeVerticesData(S.VertexBuffer.TangentKind+t),t++}},_.Parse=function(e,t,i){var r;if((r=e.type&&"GroundMesh"===e.type?S.GroundMesh.Parse(e,t):new _(e.name,t)).id=e.id,S.Tags&&S.Tags.AddTagsTo(r,e.tags),r.position=S.Vector3.FromArray(e.position),void 0!==e.metadata&&(r.metadata=e.metadata),e.rotationQuaternion?r.rotationQuaternion=S.Quaternion.FromArray(e.rotationQuaternion):e.rotation&&(r.rotation=S.Vector3.FromArray(e.rotation)),r.scaling=S.Vector3.FromArray(e.scaling),e.localMatrix?r.setPreTransformMatrix(S.Matrix.FromArray(e.localMatrix)):e.pivotMatrix&&r.setPivotMatrix(S.Matrix.FromArray(e.pivotMatrix)),r.setEnabled(e.isEnabled),r.isVisible=e.isVisible,r.infiniteDistance=e.infiniteDistance,r.showBoundingBox=e.showBoundingBox,r.showSubMeshesBoundingBox=e.showSubMeshesBoundingBox,void 0!==e.applyFog&&(r.applyFog=e.applyFog),void 0!==e.pickable&&(r.isPickable=e.pickable),void 0!==e.alphaIndex&&(r.alphaIndex=e.alphaIndex),r.receiveShadows=e.receiveShadows,r.billboardMode=e.billboardMode,void 0!==e.visibility&&(r.visibility=e.visibility),r.checkCollisions=e.checkCollisions,void 0!==e.isBlocker&&(r.isBlocker=e.isBlocker),r._shouldGenerateFlatShading=e.useFlatShading,e.freezeWorldMatrix&&(r._waitingFreezeWorldMatrix=e.freezeWorldMatrix),e.parentId&&(r._waitingParentId=e.parentId),void 0!==e.actions&&(r._waitingActions=e.actions),void 0!==e.overlayAlpha&&(r.overlayAlpha=e.overlayAlpha),void 0!==e.overlayColor&&(r.overlayColor=S.Color3.FromArray(e.overlayColor)),void 0!==e.renderOverlay&&(r.renderOverlay=e.renderOverlay),r.isUnIndexed=!!e.isUnIndexed,r.hasVertexAlpha=e.hasVertexAlpha,e.delayLoadingFile?(r.delayLoadState=S.Engine.DELAYLOADSTATE_NOTLOADED,r.delayLoadingFile=i+e.delayLoadingFile,r._boundingInfo=new S.BoundingInfo(S.Vector3.FromArray(e.boundingBoxMinimum),S.Vector3.FromArray(e.boundingBoxMaximum)),e._binaryInfo&&(r._binaryInfo=e._binaryInfo),r._delayInfo=[],e.hasUVs&&r._delayInfo.push(S.VertexBuffer.UVKind),e.hasUVs2&&r._delayInfo.push(S.VertexBuffer.UV2Kind),e.hasUVs3&&r._delayInfo.push(S.VertexBuffer.UV3Kind),e.hasUVs4&&r._delayInfo.push(S.VertexBuffer.UV4Kind),e.hasUVs5&&r._delayInfo.push(S.VertexBuffer.UV5Kind),e.hasUVs6&&r._delayInfo.push(S.VertexBuffer.UV6Kind),e.hasColors&&r._delayInfo.push(S.VertexBuffer.ColorKind),e.hasMatricesIndices&&r._delayInfo.push(S.VertexBuffer.MatricesIndicesKind),e.hasMatricesWeights&&r._delayInfo.push(S.VertexBuffer.MatricesWeightsKind),r._delayLoadingFunction=S.Geometry._ImportGeometry,S.SceneLoader.ForceFullSceneLoadingForIncremental&&r._checkDelayState()):S.Geometry._ImportGeometry(e,r),e.materialId?r.setMaterialByID(e.materialId):r.material=null,-1<e.morphTargetManagerId&&(r.morphTargetManager=t.getMorphTargetManagerById(e.morphTargetManagerId)),-1<e.skeletonId&&(r.skeleton=t.getLastSkeletonByID(e.skeletonId),e.numBoneInfluencers&&(r.numBoneInfluencers=e.numBoneInfluencers)),e.animations){for(var n=0;n<e.animations.length;n++){var o=e.animations[n];r.animations.push(S.Animation.Parse(o))}S.Node.ParseAnimationRanges(r,e,t)}if(e.autoAnimate&&t.beginAnimation(r,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),e.layerMask&&!isNaN(e.layerMask)?r.layerMask=Math.abs(parseInt(e.layerMask)):r.layerMask=268435455,e.physicsImpostor&&(r.physicsImpostor=new S.PhysicsImpostor(r,e.physicsImpostor,{mass:e.physicsMass,friction:e.physicsFriction,restitution:e.physicsRestitution},t)),e.instances)for(var s=0;s<e.instances.length;s++){var a=e.instances[s],l=r.createInstance(a.name);if(a.id&&(l.id=a.id),S.Tags&&(a.tags?S.Tags.AddTagsTo(l,a.tags):S.Tags.AddTagsTo(l,e.tags)),l.position=S.Vector3.FromArray(a.position),a.parentId&&(l._waitingParentId=a.parentId),a.rotationQuaternion?l.rotationQuaternion=S.Quaternion.FromArray(a.rotationQuaternion):a.rotation&&(l.rotation=S.Vector3.FromArray(a.rotation)),l.scaling=S.Vector3.FromArray(a.scaling),null!=a.checkCollisions&&null!=a.checkCollisions&&(l.checkCollisions=a.checkCollisions),null!=a.pickable&&null!=a.pickable&&(l.isPickable=a.pickable),null!=a.showBoundingBox&&null!=a.showBoundingBox&&(l.showBoundingBox=a.showBoundingBox),null!=a.showSubMeshesBoundingBox&&null!=a.showSubMeshesBoundingBox&&(l.showSubMeshesBoundingBox=a.showSubMeshesBoundingBox),null!=a.alphaIndex&&null!=a.showSubMeshesBoundingBox&&(l.alphaIndex=a.alphaIndex),a.physicsImpostor&&(l.physicsImpostor=new S.PhysicsImpostor(l,a.physicsImpostor,{mass:a.physicsMass,friction:a.physicsFriction,restitution:a.physicsRestitution},t)),a.animations){for(n=0;n<a.animations.length;n++)o=a.animations[n],l.animations.push(S.Animation.Parse(o));S.Node.ParseAnimationRanges(l,a,t),a.autoAnimate&&t.beginAnimation(l,a.autoAnimateFrom,a.autoAnimateTo,a.autoAnimateLoop,a.autoAnimateSpeed||1)}}return r},_.CreateRibbon=function(e,t,i,r,n,o,s,a,l){return void 0===i&&(i=!1),void 0===s&&(s=!1),S.MeshBuilder.CreateRibbon(e,{pathArray:t,closeArray:i,closePath:r,offset:n,updatable:s,sideOrientation:a,instance:l},o)},_.CreateDisc=function(e,t,i,r,n,o){void 0===r&&(r=null);var s={radius:t,tessellation:i,sideOrientation:o,updatable:n};return S.MeshBuilder.CreateDisc(e,s,r)},_.CreateBox=function(e,t,i,r,n){void 0===i&&(i=null);var o={size:t,sideOrientation:n,updatable:r};return S.MeshBuilder.CreateBox(e,o,i)},_.CreateSphere=function(e,t,i,r,n,o){var s={segments:t,diameterX:i,diameterY:i,diameterZ:i,sideOrientation:o,updatable:n};return S.MeshBuilder.CreateSphere(e,s,r)},_.CreateCylinder=function(e,t,i,r,n,o,s,a,l){void 0!==s&&s instanceof S.Scene||(void 0!==s&&(l=a||_.DEFAULTSIDE,a=s),s=o,o=1);var c={height:t,diameterTop:i,diameterBottom:r,tessellation:n,subdivisions:o,sideOrientation:l,updatable:a};return S.MeshBuilder.CreateCylinder(e,c,s)},_.CreateTorus=function(e,t,i,r,n,o,s){var a={diameter:t,thickness:i,tessellation:r,sideOrientation:s,updatable:o};return S.MeshBuilder.CreateTorus(e,a,n)},_.CreateTorusKnot=function(e,t,i,r,n,o,s,a,l,c){var h={radius:t,tube:i,radialSegments:r,tubularSegments:n,p:o,q:s,sideOrientation:c,updatable:l};return S.MeshBuilder.CreateTorusKnot(e,h,a)},_.CreateLines=function(e,t,i,r,n){void 0===i&&(i=null),void 0===r&&(r=!1),void 0===n&&(n=null);var o={points:t,updatable:r,instance:n};return S.MeshBuilder.CreateLines(e,o,i)},_.CreateDashedLines=function(e,t,i,r,n,o,s,a){void 0===o&&(o=null);var l={points:t,dashSize:i,gapSize:r,dashNb:n,updatable:s,instance:a};return S.MeshBuilder.CreateDashedLines(e,l,o)},_.CreatePolygon=function(e,t,i,r,n,o){var s={shape:t,holes:r,updatable:n,sideOrientation:o};return S.MeshBuilder.CreatePolygon(e,s,i)},_.ExtrudePolygon=function(e,t,i,r,n,o,s){var a={shape:t,holes:n,depth:i,updatable:o,sideOrientation:s};return S.MeshBuilder.ExtrudePolygon(e,a,r)},_.ExtrudeShape=function(e,t,i,r,n,o,s,a,l,c){void 0===s&&(s=null);var h={shape:t,path:i,scale:r,rotation:n,cap:0===o?0:o||_.NO_CAP,sideOrientation:l,instance:c,updatable:a};return S.MeshBuilder.ExtrudeShape(e,h,s)},_.ExtrudeShapeCustom=function(e,t,i,r,n,o,s,a,l,c,h,u){var d={shape:t,path:i,scaleFunction:r,rotationFunction:n,ribbonCloseArray:o,ribbonClosePath:s,cap:0===a?0:a||_.NO_CAP,sideOrientation:h,instance:u,updatable:c};return S.MeshBuilder.ExtrudeShapeCustom(e,d,l)},_.CreateLathe=function(e,t,i,r,n,o,s){var a={shape:t,radius:i,tessellation:r,sideOrientation:s,updatable:o};return S.MeshBuilder.CreateLathe(e,a,n)},_.CreatePlane=function(e,t,i,r,n){var o={size:t,width:t,height:t,sideOrientation:n,updatable:r};return S.MeshBuilder.CreatePlane(e,o,i)},_.CreateGround=function(e,t,i,r,n,o){var s={width:t,height:i,subdivisions:r,updatable:o};return S.MeshBuilder.CreateGround(e,s,n)},_.CreateTiledGround=function(e,t,i,r,n,o,s,a,l){var c={xmin:t,zmin:i,xmax:r,zmax:n,subdivisions:o,precision:s,updatable:l};return S.MeshBuilder.CreateTiledGround(e,c,a)},_.CreateGroundFromHeightMap=function(e,t,i,r,n,o,s,a,l,c,h){var u={width:i,height:r,subdivisions:n,minHeight:o,maxHeight:s,updatable:l,onReady:c,alphaFilter:h};return S.MeshBuilder.CreateGroundFromHeightMap(e,t,u,a)},_.CreateTube=function(e,t,i,r,n,o,s,a,l,c){var h={path:t,radius:i,tessellation:r,radiusFunction:n,arc:1,cap:o,updatable:a,sideOrientation:l,instance:c};return S.MeshBuilder.CreateTube(e,h,s)},_.CreatePolyhedron=function(e,t,i){return S.MeshBuilder.CreatePolyhedron(e,t,i)},_.CreateIcoSphere=function(e,t,i){return S.MeshBuilder.CreateIcoSphere(e,t,i)},_.CreateDecal=function(e,t,i,r,n,o){var s={position:i,normal:r,size:n,angle:o};return S.MeshBuilder.CreateDecal(e,t,s)},_.prototype.setPositionsForCPUSkinning=function(){if(!this._sourcePositions){var e=this.getVerticesData(S.VertexBuffer.PositionKind);if(!e)return this._sourcePositions;this._sourcePositions=new Float32Array(e),this.isVertexBufferUpdatable(S.VertexBuffer.PositionKind)||this.setVerticesData(S.VertexBuffer.PositionKind,e,!0)}return this._sourcePositions},_.prototype.setNormalsForCPUSkinning=function(){if(!this._sourceNormals){var e=this.getVerticesData(S.VertexBuffer.NormalKind);if(!e)return this._sourceNormals;this._sourceNormals=new Float32Array(e),this.isVertexBufferUpdatable(S.VertexBuffer.NormalKind)||this.setVerticesData(S.VertexBuffer.NormalKind,e,!0)}return this._sourceNormals},_.prototype.applySkeleton=function(e){if(!this.geometry)return this;if(this.geometry._softwareSkinningFrameId==this.getScene().getFrameId())return this;if(this.geometry._softwareSkinningFrameId=this.getScene().getFrameId(),!this.isVerticesDataPresent(S.VertexBuffer.PositionKind))return this;if(!this.isVerticesDataPresent(S.VertexBuffer.NormalKind))return this;if(!this.isVerticesDataPresent(S.VertexBuffer.MatricesIndicesKind))return this;if(!this.isVerticesDataPresent(S.VertexBuffer.MatricesWeightsKind))return this;if(!this._sourcePositions){var t=this.subMeshes.slice();this.setPositionsForCPUSkinning(),this.subMeshes=t}this._sourceNormals||this.setNormalsForCPUSkinning();var i=this.getVerticesData(S.VertexBuffer.PositionKind);if(!i)return this;i instanceof Float32Array||(i=new Float32Array(i));var r=this.getVerticesData(S.VertexBuffer.NormalKind);if(!r)return this;r instanceof Float32Array||(r=new Float32Array(r));var n=this.getVerticesData(S.VertexBuffer.MatricesIndicesKind),o=this.getVerticesData(S.VertexBuffer.MatricesWeightsKind);if(!o||!n)return this;for(var s,a=4<this.numBoneInfluencers,l=a?this.getVerticesData(S.VertexBuffer.MatricesIndicesExtraKind):null,c=a?this.getVerticesData(S.VertexBuffer.MatricesWeightsExtraKind):null,h=e.getTransformMatrices(this),u=S.Vector3.Zero(),d=new S.Matrix,f=new S.Matrix,p=0,_=0;_<i.length;_+=3,p+=4){var m;for(s=0;s<4;s++)0<(m=o[p+s])&&(S.Matrix.FromFloat32ArrayToRefScaled(h,Math.floor(16*n[p+s]),m,f),d.addToSelf(f));if(a)for(s=0;s<4;s++)0<(m=c[p+s])&&(S.Matrix.FromFloat32ArrayToRefScaled(h,Math.floor(16*l[p+s]),m,f),d.addToSelf(f));S.Vector3.TransformCoordinatesFromFloatsToRef(this._sourcePositions[_],this._sourcePositions[_+1],this._sourcePositions[_+2],d,u),u.toArray(i,_),S.Vector3.TransformNormalFromFloatsToRef(this._sourceNormals[_],this._sourceNormals[_+1],this._sourceNormals[_+2],d,u),u.toArray(r,_),d.reset()}return this.updateVerticesData(S.VertexBuffer.PositionKind,i),this.updateVerticesData(S.VertexBuffer.NormalKind,r),this},_.MinMax=function(e){var n=null,o=null;return e.forEach((function(e,t,i){var r=e.getBoundingInfo().boundingBox;n&&o?(n.minimizeInPlace(r.minimumWorld),o.maximizeInPlace(r.maximumWorld)):(n=r.minimumWorld,o=r.maximumWorld)})),n&&o?{min:n,max:o}:{min:S.Vector3.Zero(),max:S.Vector3.Zero()}},_.Center=function(e){var t=e instanceof Array?_.MinMax(e):e;return S.Vector3.Center(t.min,t.max)},_.MergeMeshes=function(e,t,i,r,n){var o;if(void 0===t&&(t=!0),!i){var s=0;for(o=0;o<e.length;o++)if(e[o]&&65536<(s+=e[o].getTotalVertices()))return S.Tools.Warn("Cannot merge meshes because resulting mesh will have more than 65536 vertices. Please use allow32BitsIndices = true to use 32 bits indices"),null}var a,l=null,c=new Array,h=null;for(o=0;o<e.length;o++)if(e[o]){var u=e[o].computeWorldMatrix(!0);(a=S.VertexData.ExtractFromMesh(e[o],!0,!0)).transform(u),l?l.merge(a,i):(l=a,h=e[o]),n&&c.push(e[o].getTotalIndices())}if(h=h,r||(r=new _(h.name+"_merged",h.getScene())),l.applyToMesh(r),r.material=h.material,r.checkCollisions=h.checkCollisions,t)for(o=0;o<e.length;o++)e[o]&&e[o].dispose();if(n){r.releaseSubMeshes();for(var d=o=0;o<c.length;)S.SubMesh.CreateFromIndices(0,d,c[o],r),d+=c[o],o++}return r},_.FRONTSIDE=0,_.BACKSIDE=1,_.DOUBLESIDE=2,_.DEFAULTSIDE=0,_.NO_CAP=0,_.CAP_START=1,_.CAP_END=2,_.CAP_ALL=3,_})(S.AbstractMesh);S.Mesh=i})($a||($a={})),ne=$a||($a={}),oe=(function(){function e(){}return Object.defineProperty(e.prototype,"effect",{get:function(){return this._materialEffect},enumerable:!0,configurable:!0}),e.prototype.setEffect=function(e,t){void 0===t&&(t=null),this._materialEffect!==e?(this._materialDefines=t,this._materialEffect=e):e||(this._materialDefines=null)},e})(),se=(function(c){function h(e,t,i,r,n,o,s,a){void 0===a&&(a=!0);var l=c.call(this)||this;return l.materialIndex=e,l.verticesStart=t,l.verticesCount=i,l.indexStart=r,l.indexCount=n,l._renderId=0,l._mesh=o,l._renderingMesh=s||o,o.subMeshes.push(l),l._trianglePlanes=[],l._id=o.subMeshes.length-1,a&&(l.refreshBoundingInfo(),o.computeWorldMatrix(!0)),l}return T(h,c),h.AddToMesh=function(e,t,i,r,n,o,s,a){return void 0===a&&(a=!0),new h(e,t,i,r,n,o,s,a)},Object.defineProperty(h.prototype,"IsGlobal",{get:function(){return 0===this.verticesStart&&this.verticesCount===this._mesh.getTotalVertices()},enumerable:!0,configurable:!0}),h.prototype.getBoundingInfo=function(){return this.IsGlobal?this._mesh.getBoundingInfo():this._boundingInfo},h.prototype.setBoundingInfo=function(e){return this._boundingInfo=e,this},h.prototype.getMesh=function(){return this._mesh},h.prototype.getRenderingMesh=function(){return this._renderingMesh},h.prototype.getMaterial=function(){var e=this._renderingMesh.material;if(null==e)return this._mesh.getScene().defaultMaterial;if(e.getSubMaterial){var t=e.getSubMaterial(this.materialIndex);return this._currentMaterial!==t&&(this._currentMaterial=t,this._materialDefines=null),t}return e},h.prototype.refreshBoundingInfo=function(){if(this._lastColliderWorldVertices=null,this.IsGlobal||!this._renderingMesh||!this._renderingMesh.geometry)return this;var e=this._renderingMesh.getVerticesData(ne.VertexBuffer.PositionKind);if(!e)return this._boundingInfo=this._mesh.getBoundingInfo(),this;var t,i=this._renderingMesh.getIndices();if(0===this.indexStart&&this.indexCount===i.length){var r=this._renderingMesh.getBoundingInfo();t={minimum:r.minimum.clone(),maximum:r.maximum.clone()}}else t=ne.Tools.ExtractMinAndMaxIndexed(e,i,this.indexStart,this.indexCount,this._renderingMesh.geometry.boundingBias);return this._boundingInfo=new ne.BoundingInfo(t.minimum,t.maximum),this},h.prototype._checkCollision=function(e){return this.getBoundingInfo()._checkCollision(e)},h.prototype.updateBoundingInfo=function(e){var t=this.getBoundingInfo();return t||(this.refreshBoundingInfo(),t=this.getBoundingInfo()),t.update(e),this},h.prototype.isInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isInFrustum(e,this._mesh.cullingStrategy)},h.prototype.isCompletelyInFrustum=function(e){var t=this.getBoundingInfo();return!!t&&t.isCompletelyInFrustum(e)},h.prototype.render=function(e){return this._renderingMesh.render(this,e),this},h.prototype._getLinesIndexBuffer=function(e,t){if(!this._linesIndexBuffer){for(var i=[],r=this.indexStart;r<this.indexStart+this.indexCount;r+=3)i.push(e[r],e[r+1],e[r+1],e[r+2],e[r+2],e[r]);this._linesIndexBuffer=t.createIndexBuffer(i),this._linesIndexCount=i.length}return this._linesIndexBuffer},h.prototype.canIntersects=function(e){var t=this.getBoundingInfo();return!!t&&e.intersectsBox(t.boundingBox)},h.prototype.intersects=function(e,t,i,r){var n=this.getMaterial();if(!n)return null;switch(n.fillMode){case ne.Material.PointListDrawMode:case ne.Material.LineListDrawMode:case ne.Material.LineLoopDrawMode:case ne.Material.LineStripDrawMode:case ne.Material.TriangleFanDrawMode:case ne.Material.TriangleStripDrawMode:return null}if(ne.LinesMesh){var o=this._mesh instanceof ne.InstancedMesh?this._mesh.sourceMesh:this._mesh;if(o instanceof ne.LinesMesh){var s=o;return this._intersectLines(e,t,i,s.intersectionThreshold,r)}}return this._intersectTriangles(e,t,i,r)},h.prototype._intersectLines=function(e,t,i,r,n){for(var o=null,s=this.indexStart;s<this.indexStart+this.indexCount;s+=2){var a=t[i[s]],l=t[i[s+1]],c=e.intersectionSegment(a,l,r);if(!(c<0)&&((n||!o||c<o.distance)&&(o=new ne.IntersectionInfo(null,null,c),n)))break}return o},h.prototype._intersectTriangles=function(e,t,i,r){for(var n=null,o=this.indexStart;o<this.indexStart+this.indexCount;o+=3){var s=t[i[o]],a=t[i[o+1]],l=t[i[o+2]],c=e.intersectsTriangle(s,a,l);if(c){if(c.distance<0)continue;if((r||!n||c.distance<n.distance)&&((n=c).faceId=o/3,r))break}}return n},h.prototype._rebuild=function(){this._linesIndexBuffer&&(this._linesIndexBuffer=null)},h.prototype.clone=function(e,t){var i=new h(this.materialIndex,this.verticesStart,this.verticesCount,this.indexStart,this.indexCount,e,t,!1);if(!this.IsGlobal){var r=this.getBoundingInfo();if(!r)return i;i._boundingInfo=new ne.BoundingInfo(r.minimum,r.maximum)}return i},h.prototype.dispose=function(){this._linesIndexBuffer&&(this._mesh.getScene().getEngine()._releaseBuffer(this._linesIndexBuffer),this._linesIndexBuffer=null);var e=this._mesh.subMeshes.indexOf(this);this._mesh.subMeshes.splice(e,1)},h.CreateFromIndices=function(e,t,i,r,n){for(var o=Number.MAX_VALUE,s=-Number.MAX_VALUE,a=(n=n||r).getIndices(),l=t;l<t+i;l++){var c=a[l];c<o&&(o=c),s<c&&(s=c)}return new h(e,o,s-o+1,t,i,r,n)},h})(ne.BaseSubMesh=oe),ne.SubMesh=se;var le,ce,he,ue,de,fe,pe,_e,me,ge,ve,ye,be,Te,Ee,xe,Pe,Ae,Se,Me,Re,Ce,Oe,De,Ie,we,Le,Fe,Be,Ne,Ve,Ue,ze,Ge,ke,We,He,Xe,je,Ye,Ke,Qe,Ze,qe,Je,$e,et,tt,it,rt,nt,ot,st,at,lt,ct,ht,ut,dt,ft,pt,_t,mt,gt,vt,yt,bt,Tt,Et,xt,Pt,At,St,Mt,Rt,Ct,Ot,Dt,It,wt,Lt,Ft,Bt,Nt,Vt,Ut,zt,Gt,kt,Wt,Ht,Xt,jt,Yt,Kt,Qt,Zt,qt,Jt,$t,ei,ti,ii,ri,ni,oi,si,ai,li,ci,hi,ui,di,fi,pi,_i,mi,gi,vi,yi,bi,Ti,Ei,xi,Pi,Ai,Si,Mi,Ri,Ci,Oi,Di,Ii,wi,Li,Fi,Bi,Ni,Vi,Ui,zi,Gi,ki,Wi,Hi,Xi,ji,Yi,Ki,Qi,Zi,qi,Ji;ae=this&&this.__assign||function(){return(ae=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};!(function(l){var e=(function(){function e(){this._isDirty=!0,this._areLightsDirty=!0,this._areAttributesDirty=!0,this._areTexturesDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._normals=!1,this._uvs=!1,this._needNormals=!1,this._needUVs=!1}return Object.defineProperty(e.prototype,"isDirty",{get:function(){return this._isDirty},enumerable:!0,configurable:!0}),e.prototype.markAsProcessed=function(){this._isDirty=!1,this._areAttributesDirty=!1,this._areTexturesDirty=!1,this._areFresnelDirty=!1,this._areLightsDirty=!1,this._areMiscDirty=!1,this._areImageProcessingDirty=!1},e.prototype.markAsUnprocessed=function(){this._isDirty=!0},e.prototype.markAllAsDirty=function(){this._areTexturesDirty=!0,this._areAttributesDirty=!0,this._areLightsDirty=!0,this._areFresnelDirty=!0,this._areMiscDirty=!0,this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsImageProcessingDirty=function(){this._areImageProcessingDirty=!0,this._isDirty=!0},e.prototype.markAsLightDirty=function(){this._areLightsDirty=!0,this._isDirty=!0},e.prototype.markAsAttributesDirty=function(){this._areAttributesDirty=!0,this._isDirty=!0},e.prototype.markAsTexturesDirty=function(){this._areTexturesDirty=!0,this._isDirty=!0},e.prototype.markAsFresnelDirty=function(){this._areFresnelDirty=!0,this._isDirty=!0},e.prototype.markAsMiscDirty=function(){this._areMiscDirty=!0,this._isDirty=!0},e.prototype.rebuild=function(){this._keys&&delete this._keys,this._keys=[];for(var e=0,t=Object.keys(this);e<t.length;e++){var i=t[e];"_"!==i[0]&&this._keys.push(i)}},e.prototype.isEqual=function(e){if(this._keys.length!==e._keys.length)return!1;for(var t=0;t<this._keys.length;t++){var i=this._keys[t];if(this[i]!==e[i])return!1}return!0},e.prototype.cloneTo=function(e){this._keys.length!==e._keys.length&&(e._keys=this._keys.slice(0));for(var t=0;t<this._keys.length;t++){var i=this._keys[t];e[i]=this[i]}},e.prototype.reset=function(){for(var e=0;e<this._keys.length;e++){var t=this._keys[e];switch(typeof this[t]){case"number":this[t]=0;break;case"string":this[t]="";break;default:this[t]=!1}}},e.prototype.toString=function(){for(var e="",t=0;t<this._keys.length;t++){var i=this._keys[t],r=this[i];switch(typeof r){case"number":case"string":e+="#define "+i+" "+r+"\n";break;default:r&&(e+="#define "+i+"\n")}}return e},e})();l.MaterialDefines=e;var t=(function(){function n(e,t,i){this.checkReadyOnEveryCall=!1,this.checkReadyOnlyOnce=!1,this.state="",this._alpha=1,this._backFaceCulling=!0,this.doNotSerialize=!1,this.storeEffectOnSubMeshes=!1,this.onDisposeObservable=new l.Observable,this._alphaMode=l.Engine.ALPHA_COMBINE,this._needDepthPrePass=!1,this.disableDepthWrite=!1,this.forceDepthWrite=!1,this.separateCullingPass=!1,this._fogEnabled=!0,this.pointSize=1,this.zOffset=0,this._wasPreviouslyReady=!1,this._fillMode=n.TriangleFillMode,this.name=e,this.id=e||l.Tools.RandomId(),this._scene=t||l.Engine.LastCreatedScene,this.uniqueId=this._scene.getUniqueId(),this._scene.useRightHandedSystem?this.sideOrientation=n.ClockWiseSideOrientation:this.sideOrientation=n.CounterClockWiseSideOrientation,this._uniformBuffer=new l.UniformBuffer(this._scene.getEngine()),this._useUBO=this.getScene().getEngine().supportsUniformBuffers,i||(this._scene.materials.push(this),this._scene.onNewMaterialAddedObservable.notifyObservers(this))}return Object.defineProperty(n,"TriangleFillMode",{get:function(){return n._TriangleFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"WireFrameFillMode",{get:function(){return n._WireFrameFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"PointFillMode",{get:function(){return n._PointFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"PointListDrawMode",{get:function(){return n._PointListDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LineListDrawMode",{get:function(){return n._LineListDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LineLoopDrawMode",{get:function(){return n._LineLoopDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"LineStripDrawMode",{get:function(){return n._LineStripDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TriangleStripDrawMode",{get:function(){return n._TriangleStripDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"TriangleFanDrawMode",{get:function(){return n._TriangleFanDrawMode},enumerable:!0,configurable:!0}),Object.defineProperty(n,"ClockWiseSideOrientation",{get:function(){return n._ClockWiseSideOrientation},enumerable:!0,configurable:!0}),Object.defineProperty(n,"CounterClockWiseSideOrientation",{get:function(){return n._CounterClockWiseSideOrientation},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"alpha",{get:function(){return this._alpha},set:function(e){this._alpha!==e&&(this._alpha=e,this.markAsDirty(n.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"backFaceCulling",{get:function(){return this._backFaceCulling},set:function(e){this._backFaceCulling!==e&&(this._backFaceCulling=e,this.markAsDirty(n.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderTargetTextures",{get:function(){return!1},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onBindObservable",{get:function(){return this._onBindObservable||(this._onBindObservable=new l.Observable),this._onBindObservable},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onBind",{set:function(e){this._onBindObserver&&this.onBindObservable.remove(this._onBindObserver),this._onBindObserver=this.onBindObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onUnBindObservable",{get:function(){return this._onUnBindObservable||(this._onUnBindObservable=new l.Observable),this._onUnBindObservable},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"alphaMode",{get:function(){return this._alphaMode},set:function(e){this._alphaMode!==e&&(this._alphaMode=e,this.markAsDirty(n.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"needDepthPrePass",{get:function(){return this._needDepthPrePass},set:function(e){this._needDepthPrePass!==e&&(this._needDepthPrePass=e,this._needDepthPrePass&&(this.checkReadyOnEveryCall=!0))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"fogEnabled",{get:function(){return this._fogEnabled},set:function(e){this._fogEnabled!==e&&(this._fogEnabled=e,this.markAsDirty(n.MiscDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"wireframe",{get:function(){switch(this._fillMode){case n.WireFrameFillMode:case n.LineListDrawMode:case n.LineLoopDrawMode:case n.LineStripDrawMode:return!0}return this._scene.forceWireframe},set:function(e){this.fillMode=e?n.WireFrameFillMode:n.TriangleFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pointsCloud",{get:function(){switch(this._fillMode){case n.PointFillMode:case n.PointListDrawMode:return!0}return this._scene.forcePointsCloud},set:function(e){this.fillMode=e?n.PointFillMode:n.TriangleFillMode},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"fillMode",{get:function(){return this._fillMode},set:function(e){this._fillMode!==e&&(this._fillMode=e,this.markAsDirty(n.MiscDirtyFlag))},enumerable:!0,configurable:!0}),n.prototype.toString=function(e){return"Name: "+this.name},n.prototype.getClassName=function(){return"Material"},Object.defineProperty(n.prototype,"isFrozen",{get:function(){return this.checkReadyOnlyOnce},enumerable:!0,configurable:!0}),n.prototype.freeze=function(){this.checkReadyOnlyOnce=!0},n.prototype.unfreeze=function(){this.checkReadyOnlyOnce=!1},n.prototype.isReady=function(e,t){return!0},n.prototype.isReadyForSubMesh=function(e,t,i){return!1},n.prototype.getEffect=function(){return this._effect},n.prototype.getScene=function(){return this._scene},n.prototype.needAlphaBlending=function(){return this.alpha<1},n.prototype.needAlphaBlendingForMesh=function(e){return this.needAlphaBlending()||e.visibility<1||e.hasVertexAlpha},n.prototype.needAlphaTesting=function(){return!1},n.prototype.getAlphaTestTexture=function(){return null},n.prototype.markDirty=function(){this._wasPreviouslyReady=!1},n.prototype._preBind=function(e,t){void 0===t&&(t=null);var i=this._scene.getEngine(),r=(null==t?this.sideOrientation:t)===n.ClockWiseSideOrientation;return i.enableEffect(e||this._effect),i.setState(this.backFaceCulling,this.zOffset,!1,r),r},n.prototype.bind=function(e,t){},n.prototype.bindForSubMesh=function(e,t,i){},n.prototype.bindOnlyWorldMatrix=function(e){},n.prototype.bindSceneUniformBuffer=function(e,t){t.bindToEffect(e,"Scene")},n.prototype.bindView=function(e){this._useUBO?this.bindSceneUniformBuffer(e,this.getScene().getSceneUniformBuffer()):e.setMatrix("view",this.getScene().getViewMatrix())},n.prototype.bindViewProjection=function(e){this._useUBO?this.bindSceneUniformBuffer(e,this.getScene().getSceneUniformBuffer()):e.setMatrix("viewProjection",this.getScene().getTransformMatrix())},n.prototype._shouldTurnAlphaTestOn=function(e){return!this.needAlphaBlendingForMesh(e)&&this.needAlphaTesting()},n.prototype._afterBind=function(e){if((this._scene._cachedMaterial=this)._scene._cachedVisibility=e?e.visibility:1,this._onBindObservable&&e&&this._onBindObservable.notifyObservers(e),this.disableDepthWrite){var t=this._scene.getEngine();this._cachedDepthWriteState=t.getDepthWrite(),t.setDepthWrite(!1)}},n.prototype.unbind=function(){(this._onUnBindObservable&&this._onUnBindObservable.notifyObservers(this),this.disableDepthWrite)&&this._scene.getEngine().setDepthWrite(this._cachedDepthWriteState)},n.prototype.getActiveTextures=function(){return[]},n.prototype.hasTexture=function(e){return!1},n.prototype.clone=function(e){return null},n.prototype.getBindedMeshes=function(){for(var e=new Array,t=0;t<this._scene.meshes.length;t++){var i=this._scene.meshes[t];i.material===this&&e.push(i)}return e},n.prototype.forceCompilation=function(t,i,e){var r=this,n=ae({clipPlane:!1},e),o=new l.BaseSubMesh,s=this.getScene(),a=function(){if(r._scene&&r._scene.getEngine()){o._materialDefines&&(o._materialDefines._renderId=-1);var e=s.clipPlane;n.clipPlane&&(s.clipPlane=new l.Plane(0,0,0,1)),r.storeEffectOnSubMeshes?r.isReadyForSubMesh(t,o)?i&&i(r):setTimeout(a,16):r.isReady(t)?i&&i(r):setTimeout(a,16),n.clipPlane&&(s.clipPlane=e)}};a()},n.prototype.forceCompilationAsync=function(t,i){var r=this;return new Promise(function(e){r.forceCompilation(t,(function(){e()}),i)})},n.prototype.markAsDirty=function(e){e&n.TextureDirtyFlag&&this._markAllSubMeshesAsTexturesDirty(),e&n.LightDirtyFlag&&this._markAllSubMeshesAsLightsDirty(),e&n.FresnelDirtyFlag&&this._markAllSubMeshesAsFresnelDirty(),e&n.AttributesDirtyFlag&&this._markAllSubMeshesAsAttributesDirty(),e&n.MiscDirtyFlag&&this._markAllSubMeshesAsMiscDirty(),this.getScene().resetCachedMaterial()},n.prototype._markAllSubMeshesAsDirty=function(e){for(var t=0,i=this.getScene().meshes;t<i.length;t++){var r=i[t];if(r.subMeshes)for(var n=0,o=r.subMeshes;n<o.length;n++){var s=o[n];s.getMaterial()===this&&(s._materialDefines&&e(s._materialDefines))}}},n.prototype._markAllSubMeshesAsImageProcessingDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsImageProcessingDirty()}))},n.prototype._markAllSubMeshesAsTexturesDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsTexturesDirty()}))},n.prototype._markAllSubMeshesAsFresnelDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsFresnelDirty()}))},n.prototype._markAllSubMeshesAsFresnelAndMiscDirty=function(){this._markAllSubMeshesAsDirty((function(e){e.markAsFresnelDirty(),e.markAsMiscDirty()}))},n.prototype._markAllSubMeshesAsLightsDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsLightDirty()}))},n.prototype._markAllSubMeshesAsAttributesDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsAttributesDirty()}))},n.prototype._markAllSubMeshesAsMiscDirty=function(){this._markAllSubMeshesAsDirty((function(e){return e.markAsMiscDirty()}))},n.prototype._markAllSubMeshesAsTexturesAndMiscDirty=function(){this._markAllSubMeshesAsDirty((function(e){e.markAsTexturesDirty(),e.markAsMiscDirty()}))},n.prototype.dispose=function(e,t){this.getScene().stopAnimation(this),this.getScene().freeProcessedMaterials();var i=this._scene.materials.indexOf(this);for(0<=i&&this._scene.materials.splice(i,1),this._scene.onMaterialRemovedObservable.notifyObservers(this),i=0;i<this._scene.meshes.length;i++){var r=this._scene.meshes[i];if(r.material===this&&(r.material=null,r.geometry)){var n=r.geometry;if(this.storeEffectOnSubMeshes)for(var o=0,s=r.subMeshes;o<s.length;o++){var a=s[o];n._releaseVertexArrayObject(a._materialEffect),e&&a._materialEffect&&this._scene.getEngine()._releaseEffect(a._materialEffect)}else n._releaseVertexArrayObject(this._effect)}}this._uniformBuffer.dispose(),e&&this._effect&&(this.storeEffectOnSubMeshes||this._scene.getEngine()._releaseEffect(this._effect),this._effect=null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this._onBindObservable&&this._onBindObservable.clear(),this._onUnBindObservable&&this._onUnBindObservable.clear()},n.prototype.serialize=function(){return l.SerializationHelper.Serialize(this)},n.ParseMultiMaterial=function(e,t){var i=new l.MultiMaterial(e.name,t);i.id=e.id,l.Tags&&l.Tags.AddTagsTo(i,e.tags);for(var r=0;r<e.materials.length;r++){var n=e.materials[r];n?i.subMaterials.push(t.getMaterialByID(n)):i.subMaterials.push(null)}return i},n.Parse=function(e,t,i){return e.customType&&"BABYLON.StandardMaterial"!==e.customType?"BABYLON.PBRMaterial"!==e.customType||!e.overloadedAlbedo||(e.customType="BABYLON.LegacyPBRMaterial",l.LegacyPBRMaterial)?l.Tools.Instantiate(e.customType).Parse(e,t,i):void l.Tools.Error("Your scene is trying to load a legacy version of the PBRMaterial, please, include it from the materials library."):l.StandardMaterial.Parse(e,t,i)},n._TriangleFillMode=0,n._WireFrameFillMode=1,n._PointFillMode=2,n._PointListDrawMode=3,n._LineListDrawMode=4,n._LineLoopDrawMode=5,n._LineStripDrawMode=6,n._TriangleStripDrawMode=7,n._TriangleFanDrawMode=8,n._ClockWiseSideOrientation=0,n._CounterClockWiseSideOrientation=1,n.TextureDirtyFlag=1,n.LightDirtyFlag=2,n.FresnelDirtyFlag=4,n.AttributesDirtyFlag=8,n.MiscDirtyFlag=16,n.AllDirtyFlag=31,b([l.serialize()],n.prototype,"id",void 0),b([l.serialize()],n.prototype,"uniqueId",void 0),b([l.serialize()],n.prototype,"name",void 0),b([l.serialize()],n.prototype,"checkReadyOnEveryCall",void 0),b([l.serialize()],n.prototype,"checkReadyOnlyOnce",void 0),b([l.serialize()],n.prototype,"state",void 0),b([l.serialize("alpha")],n.prototype,"_alpha",void 0),b([l.serialize("backFaceCulling")],n.prototype,"_backFaceCulling",void 0),b([l.serialize()],n.prototype,"sideOrientation",void 0),b([l.serialize("alphaMode")],n.prototype,"_alphaMode",void 0),b([l.serialize()],n.prototype,"_needDepthPrePass",void 0),b([l.serialize()],n.prototype,"disableDepthWrite",void 0),b([l.serialize()],n.prototype,"forceDepthWrite",void 0),b([l.serialize()],n.prototype,"separateCullingPass",void 0),b([l.serialize("fogEnabled")],n.prototype,"_fogEnabled",void 0),b([l.serialize()],n.prototype,"pointSize",void 0),b([l.serialize()],n.prototype,"zOffset",void 0),b([l.serialize()],n.prototype,"wireframe",null),b([l.serialize()],n.prototype,"pointsCloud",null),b([l.serialize()],n.prototype,"fillMode",null),n})();l.Material=t})($a||($a={})),le=$a||($a={}),ce=(function(){function s(e,t,i){this._engine=e,this._noUBO=!e.supportsUniformBuffers,this._dynamic=i,this._data=t||[],this._uniformLocations={},this._uniformSizes={},this._uniformLocationPointer=0,this._needSync=!1,this._noUBO?(this.updateMatrix3x3=this._updateMatrix3x3ForEffect,this.updateMatrix2x2=this._updateMatrix2x2ForEffect,this.updateFloat=this._updateFloatForEffect,this.updateFloat2=this._updateFloat2ForEffect,this.updateFloat3=this._updateFloat3ForEffect,this.updateFloat4=this._updateFloat4ForEffect,this.updateMatrix=this._updateMatrixForEffect,this.updateVector3=this._updateVector3ForEffect,this.updateVector4=this._updateVector4ForEffect,this.updateColor3=this._updateColor3ForEffect,this.updateColor4=this._updateColor4ForEffect):(this._engine._uniformBuffers.push(this),this.updateMatrix3x3=this._updateMatrix3x3ForUniform,this.updateMatrix2x2=this._updateMatrix2x2ForUniform,this.updateFloat=this._updateFloatForUniform,this.updateFloat2=this._updateFloat2ForUniform,this.updateFloat3=this._updateFloat3ForUniform,this.updateFloat4=this._updateFloat4ForUniform,this.updateMatrix=this._updateMatrixForUniform,this.updateVector3=this._updateVector3ForUniform,this.updateVector4=this._updateVector4ForUniform,this.updateColor3=this._updateColor3ForUniform,this.updateColor4=this._updateColor4ForUniform)}return Object.defineProperty(s.prototype,"useUbo",{get:function(){return!this._noUBO},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"isSync",{get:function(){return!this._needSync},enumerable:!0,configurable:!0}),s.prototype.isDynamic=function(){return void 0!==this._dynamic},s.prototype.getData=function(){return this._bufferData},s.prototype.getBuffer=function(){return this._buffer},s.prototype._fillAlignment=function(e){var t;if(t=e<=2?e:4,this._uniformLocationPointer%t!=0){var i=this._uniformLocationPointer;this._uniformLocationPointer+=t-this._uniformLocationPointer%t;for(var r=this._uniformLocationPointer-i,n=0;n<r;n++)this._data.push(0)}},s.prototype.addUniform=function(e,t){if(!this._noUBO&&void 0===this._uniformLocations[e]){var i;if(t instanceof Array)t=(i=t).length;else{t=t,i=[];for(var r=0;r<t;r++)i.push(0)}this._fillAlignment(t),this._uniformSizes[e]=t,this._uniformLocations[e]=this._uniformLocationPointer,this._uniformLocationPointer+=t;for(r=0;r<t;r++)this._data.push(i[r]);this._needSync=!0}},s.prototype.addMatrix=function(e,t){this.addUniform(e,Array.prototype.slice.call(t.toArray()))},s.prototype.addFloat2=function(e,t,i){var r=[t,i];this.addUniform(e,r)},s.prototype.addFloat3=function(e,t,i,r){var n=[t,i,r];this.addUniform(e,n)},s.prototype.addColor3=function(e,t){var i=new Array;t.toArray(i),this.addUniform(e,i)},s.prototype.addColor4=function(e,t,i){var r=new Array;t.toArray(r),r.push(i),this.addUniform(e,r)},s.prototype.addVector3=function(e,t){var i=new Array;t.toArray(i),this.addUniform(e,i)},s.prototype.addMatrix3x3=function(e){this.addUniform(e,12)},s.prototype.addMatrix2x2=function(e){this.addUniform(e,8)},s.prototype.create=function(){this._noUBO||this._buffer||(this._fillAlignment(4),this._bufferData=new Float32Array(this._data),this._rebuild(),this._needSync=!0)},s.prototype._rebuild=function(){this._noUBO||(this._dynamic?this._buffer=this._engine.createDynamicUniformBuffer(this._bufferData):this._buffer=this._engine.createUniformBuffer(this._bufferData))},s.prototype.update=function(){this._buffer?(this._dynamic||this._needSync)&&(this._engine.updateUniformBuffer(this._buffer,this._bufferData),this._needSync=!1):this.create()},s.prototype.updateUniform=function(e,t,i){var r=this._uniformLocations[e];if(void 0===r){if(this._buffer)return void le.Tools.Error("Cannot add an uniform after UBO has been created.");this.addUniform(e,i),r=this._uniformLocations[e]}if(this._buffer||this.create(),this._dynamic)for(o=0;o<i;o++)this._bufferData[r+o]=t[o];else{for(var n=!1,o=0;o<i;o++)this._bufferData[r+o]!==t[o]&&(n=!0,this._bufferData[r+o]=t[o]);this._needSync=this._needSync||n}},s.prototype._updateMatrix3x3ForUniform=function(e,t){for(var i=0;i<3;i++)s._tempBuffer[4*i]=t[3*i],s._tempBuffer[4*i+1]=t[3*i+1],s._tempBuffer[4*i+2]=t[3*i+2],s._tempBuffer[4*i+3]=0;this.updateUniform(e,s._tempBuffer,12)},s.prototype._updateMatrix3x3ForEffect=function(e,t){this._currentEffect.setMatrix3x3(e,t)},s.prototype._updateMatrix2x2ForEffect=function(e,t){this._currentEffect.setMatrix2x2(e,t)},s.prototype._updateMatrix2x2ForUniform=function(e,t){for(var i=0;i<2;i++)s._tempBuffer[4*i]=t[2*i],s._tempBuffer[4*i+1]=t[2*i+1],s._tempBuffer[4*i+2]=0,s._tempBuffer[4*i+3]=0;this.updateUniform(e,s._tempBuffer,8)},s.prototype._updateFloatForEffect=function(e,t){this._currentEffect.setFloat(e,t)},s.prototype._updateFloatForUniform=function(e,t){s._tempBuffer[0]=t,this.updateUniform(e,s._tempBuffer,1)},s.prototype._updateFloat2ForEffect=function(e,t,i,r){void 0===r&&(r=""),this._currentEffect.setFloat2(e+r,t,i)},s.prototype._updateFloat2ForUniform=function(e,t,i,r){void 0===r&&(r=""),s._tempBuffer[0]=t,s._tempBuffer[1]=i,this.updateUniform(e,s._tempBuffer,2)},s.prototype._updateFloat3ForEffect=function(e,t,i,r,n){void 0===n&&(n=""),this._currentEffect.setFloat3(e+n,t,i,r)},s.prototype._updateFloat3ForUniform=function(e,t,i,r,n){void 0===n&&(n=""),s._tempBuffer[0]=t,s._tempBuffer[1]=i,s._tempBuffer[2]=r,this.updateUniform(e,s._tempBuffer,3)},s.prototype._updateFloat4ForEffect=function(e,t,i,r,n,o){void 0===o&&(o=""),this._currentEffect.setFloat4(e+o,t,i,r,n)},s.prototype._updateFloat4ForUniform=function(e,t,i,r,n,o){void 0===o&&(o=""),s._tempBuffer[0]=t,s._tempBuffer[1]=i,s._tempBuffer[2]=r,s._tempBuffer[3]=n,this.updateUniform(e,s._tempBuffer,4)},s.prototype._updateMatrixForEffect=function(e,t){this._currentEffect.setMatrix(e,t)},s.prototype._updateMatrixForUniform=function(e,t){this.updateUniform(e,t.toArray(),16)},s.prototype._updateVector3ForEffect=function(e,t){this._currentEffect.setVector3(e,t)},s.prototype._updateVector3ForUniform=function(e,t){t.toArray(s._tempBuffer),this.updateUniform(e,s._tempBuffer,3)},s.prototype._updateVector4ForEffect=function(e,t){this._currentEffect.setVector4(e,t)},s.prototype._updateVector4ForUniform=function(e,t){t.toArray(s._tempBuffer),this.updateUniform(e,s._tempBuffer,4)},s.prototype._updateColor3ForEffect=function(e,t,i){void 0===i&&(i=""),this._currentEffect.setColor3(e+i,t)},s.prototype._updateColor3ForUniform=function(e,t,i){void 0===i&&(i=""),t.toArray(s._tempBuffer),this.updateUniform(e,s._tempBuffer,3)},s.prototype._updateColor4ForEffect=function(e,t,i,r){void 0===r&&(r=""),this._currentEffect.setColor4(e+r,t,i)},s.prototype._updateColor4ForUniform=function(e,t,i,r){void 0===r&&(r=""),t.toArray(s._tempBuffer),s._tempBuffer[3]=i,this.updateUniform(e,s._tempBuffer,4)},s.prototype.setTexture=function(e,t){this._currentEffect.setTexture(e,t)},s.prototype.updateUniformDirectly=function(e,t){this.updateUniform(e,t,t.length),this.update()},s.prototype.bindToEffect=function(e,t){this._currentEffect=e,!this._noUBO&&this._buffer&&e.bindUniformBuffer(this._buffer,t)},s.prototype.dispose=function(){if(!this._noUBO){var e=this._engine._uniformBuffers.indexOf(this);-1!==e&&this._engine._uniformBuffers.splice(e,1),this._buffer&&this._engine._releaseBuffer(this._buffer)&&(this._buffer=null)}},s._MAX_UNIFORM_SIZE=256,s._tempBuffer=new Float32Array(s._MAX_UNIFORM_SIZE),s})(),le.UniformBuffer=ce,he=$a||($a={}),ue=(function(){function q(){}return q.prototype.set=function(e,t){switch(t){case he.VertexBuffer.PositionKind:this.positions=e;break;case he.VertexBuffer.NormalKind:this.normals=e;break;case he.VertexBuffer.TangentKind:this.tangents=e;break;case he.VertexBuffer.UVKind:this.uvs=e;break;case he.VertexBuffer.UV2Kind:this.uvs2=e;break;case he.VertexBuffer.UV3Kind:this.uvs3=e;break;case he.VertexBuffer.UV4Kind:this.uvs4=e;break;case he.VertexBuffer.UV5Kind:this.uvs5=e;break;case he.VertexBuffer.UV6Kind:this.uvs6=e;break;case he.VertexBuffer.ColorKind:this.colors=e;break;case he.VertexBuffer.MatricesIndicesKind:this.matricesIndices=e;break;case he.VertexBuffer.MatricesWeightsKind:this.matricesWeights=e;break;case he.VertexBuffer.MatricesIndicesExtraKind:this.matricesIndicesExtra=e;break;case he.VertexBuffer.MatricesWeightsExtraKind:this.matricesWeightsExtra=e}},q.prototype.applyToMesh=function(e,t){return this._applyTo(e,t),this},q.prototype.applyToGeometry=function(e,t){return this._applyTo(e,t),this},q.prototype.updateMesh=function(e,t,i){return this._update(e),this},q.prototype.updateGeometry=function(e,t,i){return this._update(e),this},q.prototype._applyTo=function(e,t){return void 0===t&&(t=!1),this.positions&&e.setVerticesData(he.VertexBuffer.PositionKind,this.positions,t),this.normals&&e.setVerticesData(he.VertexBuffer.NormalKind,this.normals,t),this.tangents&&e.setVerticesData(he.VertexBuffer.TangentKind,this.tangents,t),this.uvs&&e.setVerticesData(he.VertexBuffer.UVKind,this.uvs,t),this.uvs2&&e.setVerticesData(he.VertexBuffer.UV2Kind,this.uvs2,t),this.uvs3&&e.setVerticesData(he.VertexBuffer.UV3Kind,this.uvs3,t),this.uvs4&&e.setVerticesData(he.VertexBuffer.UV4Kind,this.uvs4,t),this.uvs5&&e.setVerticesData(he.VertexBuffer.UV5Kind,this.uvs5,t),this.uvs6&&e.setVerticesData(he.VertexBuffer.UV6Kind,this.uvs6,t),this.colors&&e.setVerticesData(he.VertexBuffer.ColorKind,this.colors,t),this.matricesIndices&&e.setVerticesData(he.VertexBuffer.MatricesIndicesKind,this.matricesIndices,t),this.matricesWeights&&e.setVerticesData(he.VertexBuffer.MatricesWeightsKind,this.matricesWeights,t),this.matricesIndicesExtra&&e.setVerticesData(he.VertexBuffer.MatricesIndicesExtraKind,this.matricesIndicesExtra,t),this.matricesWeightsExtra&&e.setVerticesData(he.VertexBuffer.MatricesWeightsExtraKind,this.matricesWeightsExtra,t),this.indices?e.setIndices(this.indices,null,t):e.setIndices([],null),this},q.prototype._update=function(e,t,i){return this.positions&&e.updateVerticesData(he.VertexBuffer.PositionKind,this.positions,t,i),this.normals&&e.updateVerticesData(he.VertexBuffer.NormalKind,this.normals,t,i),this.tangents&&e.updateVerticesData(he.VertexBuffer.TangentKind,this.tangents,t,i),this.uvs&&e.updateVerticesData(he.VertexBuffer.UVKind,this.uvs,t,i),this.uvs2&&e.updateVerticesData(he.VertexBuffer.UV2Kind,this.uvs2,t,i),this.uvs3&&e.updateVerticesData(he.VertexBuffer.UV3Kind,this.uvs3,t,i),this.uvs4&&e.updateVerticesData(he.VertexBuffer.UV4Kind,this.uvs4,t,i),this.uvs5&&e.updateVerticesData(he.VertexBuffer.UV5Kind,this.uvs5,t,i),this.uvs6&&e.updateVerticesData(he.VertexBuffer.UV6Kind,this.uvs6,t,i),this.colors&&e.updateVerticesData(he.VertexBuffer.ColorKind,this.colors,t,i),this.matricesIndices&&e.updateVerticesData(he.VertexBuffer.MatricesIndicesKind,this.matricesIndices,t,i),this.matricesWeights&&e.updateVerticesData(he.VertexBuffer.MatricesWeightsKind,this.matricesWeights,t,i),this.matricesIndicesExtra&&e.updateVerticesData(he.VertexBuffer.MatricesIndicesExtraKind,this.matricesIndicesExtra,t,i),this.matricesWeightsExtra&&e.updateVerticesData(he.VertexBuffer.MatricesWeightsExtraKind,this.matricesWeightsExtra,t,i),this.indices&&e.setIndices(this.indices,null),this},q.prototype.transform=function(e){var t,i=e.m[0]*e.m[5]*e.m[10]<0,r=he.Vector3.Zero();if(this.positions){var n=he.Vector3.Zero();for(t=0;t<this.positions.length;t+=3)he.Vector3.FromArrayToRef(this.positions,t,n),he.Vector3.TransformCoordinatesToRef(n,e,r),this.positions[t]=r.x,this.positions[t+1]=r.y,this.positions[t+2]=r.z}if(this.normals){var o=he.Vector3.Zero();for(t=0;t<this.normals.length;t+=3)he.Vector3.FromArrayToRef(this.normals,t,o),he.Vector3.TransformNormalToRef(o,e,r),this.normals[t]=r.x,this.normals[t+1]=r.y,this.normals[t+2]=r.z}if(this.tangents){var s=he.Vector4.Zero(),a=he.Vector4.Zero();for(t=0;t<this.tangents.length;t+=4)he.Vector4.FromArrayToRef(this.tangents,t,s),he.Vector4.TransformNormalToRef(s,e,a),this.tangents[t]=a.x,this.tangents[t+1]=a.y,this.tangents[t+2]=a.z,this.tangents[t+3]=a.w}if(i&&this.indices)for(t=0;t<this.indices.length;t+=3){var l=this.indices[t+1];this.indices[t+1]=this.indices[t+2],this.indices[t+2]=l}return this},q.prototype.merge=function(e,t){if(void 0===t&&(t=!1),this._validate(),e._validate(),!this.normals!=!e.normals||!this.tangents!=!e.tangents||!this.uvs!=!e.uvs||!this.uvs2!=!e.uvs2||!this.uvs3!=!e.uvs3||!this.uvs4!=!e.uvs4||!this.uvs5!=!e.uvs5||!this.uvs6!=!e.uvs6||!this.colors!=!e.colors||!this.matricesIndices!=!e.matricesIndices||!this.matricesWeights!=!e.matricesWeights||!this.matricesIndicesExtra!=!e.matricesIndicesExtra||!this.matricesWeightsExtra!=!e.matricesWeightsExtra)throw new Error("Cannot merge vertex data that do not have the same set of attributes");if(e.indices){this.indices||(this.indices=[]);var i=this.positions?this.positions.length/3:0;if(void 0!==this.indices.BYTES_PER_ELEMENT){var r=this.indices.length+e.indices.length,n=t||this.indices instanceof Uint32Array?new Uint32Array(r):new Uint16Array(r);n.set(this.indices);for(var o=this.indices.length,s=0;s<e.indices.length;s++)n[o+s]=e.indices[s]+i;this.indices=n}else for(s=0;s<e.indices.length;s++)this.indices.push(e.indices[s]+i)}return this.positions=this._mergeElement(this.positions,e.positions),this.normals=this._mergeElement(this.normals,e.normals),this.tangents=this._mergeElement(this.tangents,e.tangents),this.uvs=this._mergeElement(this.uvs,e.uvs),this.uvs2=this._mergeElement(this.uvs2,e.uvs2),this.uvs3=this._mergeElement(this.uvs3,e.uvs3),this.uvs4=this._mergeElement(this.uvs4,e.uvs4),this.uvs5=this._mergeElement(this.uvs5,e.uvs5),this.uvs6=this._mergeElement(this.uvs6,e.uvs6),this.colors=this._mergeElement(this.colors,e.colors),this.matricesIndices=this._mergeElement(this.matricesIndices,e.matricesIndices),this.matricesWeights=this._mergeElement(this.matricesWeights,e.matricesWeights),this.matricesIndicesExtra=this._mergeElement(this.matricesIndicesExtra,e.matricesIndicesExtra),this.matricesWeightsExtra=this._mergeElement(this.matricesWeightsExtra,e.matricesWeightsExtra),this},q.prototype._mergeElement=function(e,t){if(!e)return t;if(!t)return e;var i=t.length+e.length,r=e instanceof Float32Array,n=t instanceof Float32Array;if(r){var o=new Float32Array(i);return o.set(e),o.set(t,e.length),o}if(n){var s=e.slice(0),a=0;for(i=t.length;a<i;a++)s.push(t[a]);return s}return e.concat(t)},q.prototype._validate=function(){if(!this.positions)throw new Error("Positions are required");var r=function(e,t){var i=he.VertexBuffer.DeduceStride(e);if(t.length%i!=0)throw new Error("The "+e+"s array count must be a multiple of "+i);return t.length/i},n=r(he.VertexBuffer.PositionKind,this.positions),e=function(e,t){var i=r(e,t);if(i!==n)throw new Error("The "+e+"s element count ("+i+") does not match the positions count ("+n+")")};this.normals&&e(he.VertexBuffer.NormalKind,this.normals),this.tangents&&e(he.VertexBuffer.TangentKind,this.tangents),this.uvs&&e(he.VertexBuffer.UVKind,this.uvs),this.uvs2&&e(he.VertexBuffer.UV2Kind,this.uvs2),this.uvs3&&e(he.VertexBuffer.UV3Kind,this.uvs3),this.uvs4&&e(he.VertexBuffer.UV4Kind,this.uvs4),this.uvs5&&e(he.VertexBuffer.UV5Kind,this.uvs5),this.uvs6&&e(he.VertexBuffer.UV6Kind,this.uvs6),this.colors&&e(he.VertexBuffer.ColorKind,this.colors),this.matricesIndices&&e(he.VertexBuffer.MatricesIndicesKind,this.matricesIndices),this.matricesWeights&&e(he.VertexBuffer.MatricesWeightsKind,this.matricesWeights),this.matricesIndicesExtra&&e(he.VertexBuffer.MatricesIndicesExtraKind,this.matricesIndicesExtra),this.matricesWeightsExtra&&e(he.VertexBuffer.MatricesWeightsExtraKind,this.matricesWeightsExtra)},q.prototype.serialize=function(){var e=this.serialize();return this.positions&&(e.positions=this.positions),this.normals&&(e.normals=this.normals),this.tangents&&(e.tangents=this.tangents),this.uvs&&(e.uvs=this.uvs),this.uvs2&&(e.uvs2=this.uvs2),this.uvs3&&(e.uvs3=this.uvs3),this.uvs4&&(e.uvs4=this.uvs4),this.uvs5&&(e.uvs5=this.uvs5),this.uvs6&&(e.uvs6=this.uvs6),this.colors&&(e.colors=this.colors),this.matricesIndices&&(e.matricesIndices=this.matricesIndices,e.matricesIndices._isExpanded=!0),this.matricesWeights&&(e.matricesWeights=this.matricesWeights),this.matricesIndicesExtra&&(e.matricesIndicesExtra=this.matricesIndicesExtra,e.matricesIndicesExtra._isExpanded=!0),this.matricesWeightsExtra&&(e.matricesWeightsExtra=this.matricesWeightsExtra),e.indices=this.indices,e},q.ExtractFromMesh=function(e,t,i){return q._ExtractFrom(e,t,i)},q.ExtractFromGeometry=function(e,t,i){return q._ExtractFrom(e,t,i)},q._ExtractFrom=function(e,t,i){var r=new q;return e.isVerticesDataPresent(he.VertexBuffer.PositionKind)&&(r.positions=e.getVerticesData(he.VertexBuffer.PositionKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.NormalKind)&&(r.normals=e.getVerticesData(he.VertexBuffer.NormalKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.TangentKind)&&(r.tangents=e.getVerticesData(he.VertexBuffer.TangentKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.UVKind)&&(r.uvs=e.getVerticesData(he.VertexBuffer.UVKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.UV2Kind)&&(r.uvs2=e.getVerticesData(he.VertexBuffer.UV2Kind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.UV3Kind)&&(r.uvs3=e.getVerticesData(he.VertexBuffer.UV3Kind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.UV4Kind)&&(r.uvs4=e.getVerticesData(he.VertexBuffer.UV4Kind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.UV5Kind)&&(r.uvs5=e.getVerticesData(he.VertexBuffer.UV5Kind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.UV6Kind)&&(r.uvs6=e.getVerticesData(he.VertexBuffer.UV6Kind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.ColorKind)&&(r.colors=e.getVerticesData(he.VertexBuffer.ColorKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.MatricesIndicesKind)&&(r.matricesIndices=e.getVerticesData(he.VertexBuffer.MatricesIndicesKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.MatricesWeightsKind)&&(r.matricesWeights=e.getVerticesData(he.VertexBuffer.MatricesWeightsKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.MatricesIndicesExtraKind)&&(r.matricesIndicesExtra=e.getVerticesData(he.VertexBuffer.MatricesIndicesExtraKind,t,i)),e.isVerticesDataPresent(he.VertexBuffer.MatricesWeightsExtraKind)&&(r.matricesWeightsExtra=e.getVerticesData(he.VertexBuffer.MatricesWeightsExtraKind,t,i)),r.indices=e.getIndices(t,i),r},q.CreateRibbon=function(e){var t=e.pathArray,i=e.closeArray||!1,r=e.closePath||!1,n=e.invertUV||!1,o=Math.floor(t[0].length/2),s=e.offset||o;s=o<s?o:Math.floor(s);var a,l,c,h,u=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,d=e.uvs,f=e.colors,p=[],_=[],m=[],g=[],v=[],y=[],b=[],T=[],E=[],x=[];if(t.length<2){var P=[],A=[];for(c=0;c<t[0].length-s;c++)P.push(t[0][c]),A.push(t[0][c+s]);t=[P,A]}var S,M,R,C,O,D=0,I=r?1:0;for(a=t[0].length,l=0;l<t.length;l++){for(b[l]=0,v[l]=[0],a=a<(M=(S=t[l]).length)?a:M,h=0;h<M;)p.push(S[h].x,S[h].y,S[h].z),0<h&&(R=S[h].subtract(S[h-1]).length()+b[l],v[l].push(R),b[l]=R),h++;r&&(h--,p.push(S[0].x,S[0].y,S[0].z),R=S[h].subtract(S[0]).length()+b[l],v[l].push(R),b[l]=R),E[l]=M+I,x[l]=D,D+=M+I}var w,L,F=null,B=null;for(c=0;c<a+I;c++){for(T[c]=0,y[c]=[0],l=0;l<t.length-1;l++)C=t[l],O=t[l+1],c===a?(F=C[0],B=O[0]):(F=C[c],B=O[c]),R=B.subtract(F).length()+T[c],y[c].push(R),T[c]=R;i&&B&&F&&(C=t[l],O=t[0],c===a&&(B=O[0]),R=B.subtract(F).length()+T[c],T[c]=R)}if(d)for(l=0;l<d.length;l++)g.push(d[l].x,d[l].y);else for(l=0;l<t.length;l++)for(c=0;c<a+I;c++)w=0!=b[l]?v[l][c]/b[l]:0,L=0!=T[c]?y[c][l]/T[c]:0,n?g.push(L,w):g.push(w,L);for(var N=l=0,V=E[l]-1,U=E[l+1]-1,z=V<U?V:U,G=x[1]-x[0],k=i?E.length:E.length-1;N<=z&&l<k;)_.push(N,N+G,N+1),_.push(N+G+1,N+1,N+G),(N+=1)===z&&(++l===E.length-1?(G=x[0]-x[l],V=E[l]-1,U=E[0]-1):(G=x[l+1]-x[l],V=E[l]-1,U=E[l+1]-1),N=x[l],z=V<U?V+N:U+N);if(q.ComputeNormals(p,_,m),r){var W=0,H=0;for(l=0;l<t.length;l++)W=3*x[l],H=l+1<t.length?3*(x[l+1]-1):m.length-3,m[W]=.5*(m[W]+m[H]),m[W+1]=.5*(m[W+1]+m[H+1]),m[W+2]=.5*(m[W+2]+m[H+2]),m[H]=m[W],m[H+1]=m[W+1],m[H+2]=m[W+2]}q._ComputeSides(u,p,_,m,g,e.frontUVs,e.backUVs);var X=null;if(f){X=new Float32Array(4*f.length);for(var j=0;j<f.length;j++)X[4*j]=f[j].r,X[4*j+1]=f[j].g,X[4*j+2]=f[j].b,X[4*j+3]=f[j].a}var Y=new q,K=new Float32Array(p),Q=new Float32Array(m),Z=new Float32Array(g);return Y.indices=_,Y.positions=K,Y.normals=Q,Y.uvs=Z,X&&Y.set(X,he.VertexBuffer.ColorKind),r&&(Y._idx=x),Y},q.CreateBox=function(e){for(var t=[new he.Vector3(0,0,1),new he.Vector3(0,0,-1),new he.Vector3(1,0,0),new he.Vector3(-1,0,0),new he.Vector3(0,1,0),new he.Vector3(0,-1,0)],i=[],r=[],n=[],o=[],s=e.width||e.size||1,a=e.height||e.size||1,l=e.depth||e.size||1,c=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,h=e.faceUV||new Array(6),u=e.faceColors,d=[],f=0;f<6;f++)void 0===h[f]&&(h[f]=new he.Vector4(0,0,1,1)),u&&void 0===u[f]&&(u[f]=new he.Color4(1,1,1,1));for(var p=new he.Vector3(s/2,a/2,l/2),_=0;_<t.length;_++){var m=t[_],g=new he.Vector3(m.y,m.z,m.x),v=he.Vector3.Cross(m,g),y=r.length/3;i.push(y),i.push(y+1),i.push(y+2),i.push(y),i.push(y+2),i.push(y+3);var b=m.subtract(g).subtract(v).multiply(p);r.push(b.x,b.y,b.z),n.push(m.x,m.y,m.z),o.push(h[_].z,h[_].w),u&&d.push(u[_].r,u[_].g,u[_].b,u[_].a),b=m.subtract(g).add(v).multiply(p),r.push(b.x,b.y,b.z),n.push(m.x,m.y,m.z),o.push(h[_].x,h[_].w),u&&d.push(u[_].r,u[_].g,u[_].b,u[_].a),b=m.add(g).add(v).multiply(p),r.push(b.x,b.y,b.z),n.push(m.x,m.y,m.z),o.push(h[_].x,h[_].y),u&&d.push(u[_].r,u[_].g,u[_].b,u[_].a),b=m.add(g).subtract(v).multiply(p),r.push(b.x,b.y,b.z),n.push(m.x,m.y,m.z),o.push(h[_].z,h[_].y),u&&d.push(u[_].r,u[_].g,u[_].b,u[_].a)}q._ComputeSides(c,r,i,n,o,e.frontUVs,e.backUVs);var T=new q;if(T.indices=i,T.positions=r,T.normals=n,T.uvs=o,u){var E=c===he.Mesh.DOUBLESIDE?d.concat(d):d;T.colors=E}return T},q.CreateSphere=function(e){for(var t=e.segments||32,i=e.diameterX||e.diameter||1,r=e.diameterY||e.diameter||1,n=e.diameterZ||e.diameter||1,o=e.arc&&(e.arc<=0||1<e.arc)?1:e.arc||1,s=e.slice&&e.slice<=0?1:e.slice||1,a=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,l=new he.Vector3(i/2,r/2,n/2),c=2+t,h=2*c,u=[],d=[],f=[],p=[],_=0;_<=c;_++){for(var m=_/c,g=m*Math.PI*s,v=0;v<=h;v++){var y=v/h,b=y*Math.PI*2*o,T=he.Matrix.RotationZ(-g),E=he.Matrix.RotationY(b),x=he.Vector3.TransformCoordinates(he.Vector3.Up(),T),P=he.Vector3.TransformCoordinates(x,E),A=P.multiply(l),S=P.divide(l).normalize();d.push(A.x,A.y,A.z),f.push(S.x,S.y,S.z),p.push(y,m)}if(0<_)for(var M=d.length/3,R=M-2*(h+1);R+h+2<M;R++)u.push(R),u.push(R+1),u.push(R+h+1),u.push(R+h+1),u.push(R+1),u.push(R+h+2)}q._ComputeSides(a,d,u,f,p,e.frontUVs,e.backUVs);var C=new q;return C.indices=u,C.positions=d,C.normals=f,C.uvs=p,C},q.CreateCylinder=function(e){var t,p=e.height||2,_=0===e.diameterTop?0:e.diameterTop||e.diameter||1,m=0===e.diameterBottom?0:e.diameterBottom||e.diameter||1,g=e.tessellation||24,i=e.subdivisions||1,r=!!e.hasRings,n=!!e.enclose,v=e.arc&&(e.arc<=0||1<e.arc)?1:e.arc||1,o=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,y=e.faceUV||new Array(3),b=e.faceColors,T=2+(1+(1!==v&&n?2:0))*(r?i:1);for(t=0;t<T;t++)b&&void 0===b[t]&&(b[t]=new he.Color4(1,1,1,1));for(t=0;t<T;t++)y&&void 0===y[t]&&(y[t]=new he.Vector4(0,0,1,1));var s,a,l,c,h,u,E=new Array,x=new Array,P=new Array,A=new Array,S=new Array,d=2*Math.PI*v/g,f=(m-_)/2/p,M=he.Vector3.Zero(),R=he.Vector3.Zero(),C=he.Vector3.Zero(),O=he.Vector3.Zero(),D=he.Vector3.Zero(),I=he.Axis.Y,w=1,L=1,F=0,B=0;for(c=0;c<=i;c++)for(l=((a=c/i)*(_-m)+m)/2,w=r&&0!==c&&c!==i?2:1,u=0;u<w;u++){for(r&&(L+=u),n&&(L+=2*u),h=0;h<=g;h++)s=h*d,M.x=Math.cos(-s)*l,M.y=-p/2+a*p,M.z=Math.sin(-s)*l,0===_&&c===i?(R.x=P[P.length-3*(g+1)],R.y=P[P.length-3*(g+1)+1],R.z=P[P.length-3*(g+1)+2]):(R.x=M.x,R.z=M.z,R.y=Math.sqrt(R.x*R.x+R.z*R.z)*f,R.normalize()),0===h&&(C.copyFrom(M),O.copyFrom(R)),x.push(M.x,M.y,M.z),P.push(R.x,R.y,R.z),B=r?F!==L?y[L].y:y[L].w:y[L].y+(y[L].w-y[L].y)*a,A.push(y[L].x+(y[L].z-y[L].x)*h/g,B),b&&S.push(b[L].r,b[L].g,b[L].b,b[L].a);1!==v&&n&&(x.push(M.x,M.y,M.z),x.push(0,M.y,0),x.push(0,M.y,0),x.push(C.x,C.y,C.z),he.Vector3.CrossToRef(I,R,D),D.normalize(),P.push(D.x,D.y,D.z,D.x,D.y,D.z),he.Vector3.CrossToRef(O,I,D),D.normalize(),P.push(D.x,D.y,D.z,D.x,D.y,D.z),B=r?F!==L?y[L+1].y:y[L+1].w:y[L+1].y+(y[L+1].w-y[L+1].y)*a,A.push(y[L+1].x,B),A.push(y[L+1].z,B),B=r?F!==L?y[L+2].y:y[L+2].w:y[L+2].y+(y[L+2].w-y[L+2].y)*a,A.push(y[L+2].x,B),A.push(y[L+2].z,B),b&&(S.push(b[L+1].r,b[L+1].g,b[L+1].b,b[L+1].a),S.push(b[L+1].r,b[L+1].g,b[L+1].b,b[L+1].a),S.push(b[L+2].r,b[L+2].g,b[L+2].b,b[L+2].a),S.push(b[L+2].r,b[L+2].g,b[L+2].b,b[L+2].a))),F!==L&&(F=L)}var N=1!==v&&n?g+4:g;for(L=c=0;L<i;L++){var V=0,U=0,z=0,G=0;for(h=0;h<g;h++)V=c*(N+1)+h,U=(c+1)*(N+1)+h,z=c*(N+1)+(h+1),G=(c+1)*(N+1)+(h+1),E.push(V,U,z),E.push(G,z,U);1!==v&&n&&(E.push(V+2,U+2,z+2),E.push(G+2,z+2,U+2),E.push(V+4,U+4,z+4),E.push(G+4,z+4,U+4)),c=r?c+2:c+1}var k=function(e){var t=e?_/2:m/2;if(0!==t){var i,r,n,o=e?y[T-1]:y[0],s=null;b&&(s=e?b[T-1]:b[0]);var a=x.length/3,l=e?p/2:-p/2,c=new he.Vector3(0,l,0);x.push(c.x,c.y,c.z),P.push(0,e?1:-1,0),A.push(o.x+.5*(o.z-o.x),o.y+.5*(o.w-o.y)),s&&S.push(s.r,s.g,s.b,s.a);var h=new he.Vector2(.5,.5);for(n=0;n<=g;n++){i=2*Math.PI*n*v/g;var u=Math.cos(-i),d=Math.sin(-i);r=new he.Vector3(u*t,l,d*t);var f=new he.Vector2(u*h.x+.5,d*h.y+.5);x.push(r.x,r.y,r.z),P.push(0,e?1:-1,0),A.push(o.x+(o.z-o.x)*f.x,o.y+(o.w-o.y)*f.y),s&&S.push(s.r,s.g,s.b,s.a)}for(n=0;n<g;n++)e?(E.push(a),E.push(a+(n+2)),E.push(a+(n+1))):(E.push(a),E.push(a+(n+1)),E.push(a+(n+2)))}};k(!1),k(!0),q._ComputeSides(o,x,E,P,A,e.frontUVs,e.backUVs);var W=new q;return W.indices=E,W.positions=x,W.normals=P,W.uvs=A,b&&(W.colors=S),W},q.CreateTorus=function(e){for(var t=[],i=[],r=[],n=[],o=e.diameter||1,s=e.thickness||.5,a=e.tessellation||16,l=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,c=a+1,h=0;h<=a;h++)for(var u=h/a,d=h*Math.PI*2/a-Math.PI/2,f=he.Matrix.Translation(o/2,0,0).multiply(he.Matrix.RotationY(d)),p=0;p<=a;p++){var _=1-p/a,m=p*Math.PI*2/a+Math.PI,g=Math.cos(m),v=Math.sin(m),y=new he.Vector3(g,v,0),b=y.scale(s/2),T=new he.Vector2(u,_);b=he.Vector3.TransformCoordinates(b,f),y=he.Vector3.TransformNormal(y,f),i.push(b.x,b.y,b.z),r.push(y.x,y.y,y.z),n.push(T.x,T.y);var E=(h+1)%c,x=(p+1)%c;t.push(h*c+p),t.push(h*c+x),t.push(E*c+p),t.push(h*c+x),t.push(E*c+x),t.push(E*c+p)}q._ComputeSides(l,i,t,r,n,e.frontUVs,e.backUVs);var P=new q;return P.indices=t,P.positions=i,P.normals=r,P.uvs=n,P},q.CreateLineSystem=function(e){for(var t=[],i=[],r=e.lines,n=e.colors,o=[],s=0,a=0;a<r.length;a++)for(var l=r[a],c=0;c<l.length;c++){if(i.push(l[c].x,l[c].y,l[c].z),n){var h=n[a];o.push(h[c].r,h[c].g,h[c].b,h[c].a)}0<c&&(t.push(s-1),t.push(s)),s++}var u=new q;return u.indices=t,u.positions=i,n&&(u.colors=o),u},q.CreateDashedLines=function(e){var t,i,r=e.dashSize||3,n=e.gapSize||1,o=e.dashNb||200,s=e.points,a=new Array,l=new Array,c=he.Vector3.Zero(),h=0,u=0,d=0,f=0,p=0;for(p=0;p<s.length-1;p++)s[p+1].subtractToRef(s[p],c),h+=c.length();for(i=r*(t=h/o)/(r+n),p=0;p<s.length-1;p++){s[p+1].subtractToRef(s[p],c),u=Math.floor(c.length()/t),c.normalize();for(var _=0;_<u;_++)d=t*_,a.push(s[p].x+d*c.x,s[p].y+d*c.y,s[p].z+d*c.z),a.push(s[p].x+(d+i)*c.x,s[p].y+(d+i)*c.y,s[p].z+(d+i)*c.z),l.push(f,f+1),f+=2}var m=new q;return m.positions=a,m.indices=l,m},q.CreateGround=function(e){var t,i,r=[],n=[],o=[],s=[],a=e.width||1,l=e.height||1,c=e.subdivisionsX||e.subdivisions||1,h=e.subdivisionsY||e.subdivisions||1;for(t=0;t<=h;t++)for(i=0;i<=c;i++){var u=new he.Vector3(i*a/c-a/2,0,(h-t)*l/h-l/2),d=new he.Vector3(0,1,0);n.push(u.x,u.y,u.z),o.push(d.x,d.y,d.z),s.push(i/c,1-t/h)}for(t=0;t<h;t++)for(i=0;i<c;i++)r.push(i+1+(t+1)*(c+1)),r.push(i+1+t*(c+1)),r.push(i+t*(c+1)),r.push(i+(t+1)*(c+1)),r.push(i+1+(t+1)*(c+1)),r.push(i+t*(c+1));var f=new q;return f.indices=r,f.positions=n,f.normals=o,f.uvs=s,f},q.CreateTiledGround=function(e){var c,h,t,i,r=void 0!==e.xmin&&null!==e.xmin?e.xmin:-1,n=void 0!==e.zmin&&null!==e.zmin?e.zmin:-1,o=void 0!==e.xmax&&null!==e.xmax?e.xmax:1,s=void 0!==e.zmax&&null!==e.zmax?e.zmax:1,a=e.subdivisions||{w:1,h:1},u=e.precision||{w:1,h:1},d=new Array,f=new Array,p=new Array,_=new Array;a.h=a.h<1?1:a.h,a.w=a.w<1?1:a.w,u.w=u.w<1?1:u.w,u.h=u.h<1?1:u.h;var l=(o-r)/a.w,m=(s-n)/a.h;function g(e,t,i,r){var n=f.length/3,o=u.w+1;for(c=0;c<u.h;c++)for(h=0;h<u.w;h++){var s=[n+h+c*o,n+(h+1)+c*o,n+(h+1)+(c+1)*o,n+h+(c+1)*o];d.push(s[1]),d.push(s[2]),d.push(s[3]),d.push(s[0]),d.push(s[1]),d.push(s[3])}var a=he.Vector3.Zero(),l=new he.Vector3(0,1,0);for(c=0;c<=u.h;c++)for(a.z=c*(r-t)/u.h+t,h=0;h<=u.w;h++)a.x=h*(i-e)/u.w+e,a.y=0,f.push(a.x,a.y,a.z),p.push(l.x,l.y,l.z),_.push(h/u.w,c/u.h)}for(t=0;t<a.h;t++)for(i=0;i<a.w;i++)g(r+i*l,n+t*m,r+(i+1)*l,n+(t+1)*m);var v=new q;return v.indices=d,v.positions=f,v.normals=p,v.uvs=_,v},q.CreateGroundFromHeightMap=function(e){var t,i,r=[],n=[],o=[],s=[],a=e.colorFilter||new he.Color3(.3,.59,.11),l=e.alphaFilter||0;for(t=0;t<=e.subdivisions;t++)for(i=0;i<=e.subdivisions;i++){var c=new he.Vector3(i*e.width/e.subdivisions-e.width/2,0,(e.subdivisions-t)*e.height/e.subdivisions-e.height/2),h=4*(((c.x+e.width/2)/e.width*(e.bufferWidth-1)|0)+((1-(c.z+e.height/2)/e.height)*(e.bufferHeight-1)|0)*e.bufferWidth),u=e.buffer[h]/255,d=e.buffer[h+1]/255,f=e.buffer[h+2]/255,p=e.buffer[h+3]/255,_=u*a.r+d*a.g+f*a.b;c.y=l<=p?e.minHeight+(e.maxHeight-e.minHeight)*_:e.minHeight-he.Epsilon,n.push(c.x,c.y,c.z),o.push(0,0,0),s.push(i/e.subdivisions,1-t/e.subdivisions)}for(t=0;t<e.subdivisions;t++)for(i=0;i<e.subdivisions;i++){var m=i+1+(t+1)*(e.subdivisions+1),g=i+1+t*(e.subdivisions+1),v=i+t*(e.subdivisions+1),y=i+(t+1)*(e.subdivisions+1),b=n[3*m+1]>=e.minHeight,T=n[3*g+1]>=e.minHeight,E=n[3*v+1]>=e.minHeight;b&&T&&E&&(r.push(m),r.push(g),r.push(v)),n[3*y+1]>=e.minHeight&&b&&E&&(r.push(y),r.push(m),r.push(v))}q.ComputeNormals(n,r,o);var x=new q;return x.indices=r,x.positions=n,x.normals=o,x.uvs=s,x},q.CreatePlane=function(e){var t=[],i=[],r=[],n=[],o=e.width||e.size||1,s=e.height||e.size||1,a=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,l=o/2,c=s/2;i.push(-l,-c,0),r.push(0,0,-1),n.push(0,0),i.push(l,-c,0),r.push(0,0,-1),n.push(1,0),i.push(l,c,0),r.push(0,0,-1),n.push(1,1),i.push(-l,c,0),r.push(0,0,-1),n.push(0,1),t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),q._ComputeSides(a,i,t,r,n,e.frontUVs,e.backUVs);var h=new q;return h.indices=t,h.positions=i,h.normals=r,h.uvs=n,h},q.CreateDisc=function(e){var t=new Array,i=new Array,r=new Array,n=new Array,o=e.radius||.5,s=e.tessellation||64,a=e.arc&&(e.arc<=0||1<e.arc)?1:e.arc||1,l=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE;t.push(0,0,0),n.push(.5,.5);for(var c=2*Math.PI*a,h=c/s,u=0;u<c;u+=h){var d=Math.cos(u),f=Math.sin(u),p=(d+1)/2,_=(1-f)/2;t.push(o*d,o*f,0),n.push(p,_)}1===a&&(t.push(t[3],t[4],t[5]),n.push(n[2],n[3]));for(var m=t.length/3,g=1;g<m-1;g++)i.push(g+1,0,g);q.ComputeNormals(t,i,r),q._ComputeSides(l,t,i,r,n,e.frontUVs,e.backUVs);var v=new q;return v.indices=i,v.positions=t,v.normals=r,v.uvs=n,v},q.CreatePolygon=function(e,t,i,r,n,o){for(var s=i||new Array(3),a=r,l=[],c=0;c<3;c++)void 0===s[c]&&(s[c]=new he.Vector4(0,0,1,1)),a&&void 0===a[c]&&(a[c]=new he.Color4(1,1,1,1));for(var h=e.getVerticesData(he.VertexBuffer.PositionKind),u=e.getVerticesData(he.VertexBuffer.NormalKind),d=e.getVerticesData(he.VertexBuffer.UVKind),f=e.getIndices(),p=0,_=0,m=0;m<u.length;m+=3)Math.abs(u[m+1])<.001&&(_=1),Math.abs(u[m+1]-1)<.001&&(_=0),Math.abs(u[m+1]+1)<.001&&(_=2),d[2*(p=m/3)]=(1-d[2*p])*s[_].x+d[2*p]*s[_].z,d[2*p+1]=(1-d[2*p+1])*s[_].y+d[2*p+1]*s[_].w,a&&l.push(a[_].r,a[_].g,a[_].b,a[_].a);q._ComputeSides(t,h,f,u,d,n,o);var g=new q;if(g.indices=f,g.positions=h,g.normals=u,g.uvs=d,a){var v=t===he.Mesh.DOUBLESIDE?l.concat(l):l;g.colors=v}return g},q.CreateIcoSphere=function(e){var t,i=e.sideOrientation||he.Mesh.DEFAULTSIDE,r=e.radius||1,f=void 0===e.flat||e.flat,p=e.subdivisions||4,_=e.radiusX||r,m=e.radiusY||r,g=e.radiusZ||r,n=(1+Math.sqrt(5))/2,o=[-1,n,-0,1,n,0,-1,-n,0,1,-n,0,0,-1,-n,0,1,-n,0,-1,n,0,1,n,n,0,1,n,0,-1,-n,0,1,-n,0,-1],s=[0,11,5,0,5,1,0,1,7,0,7,10,12,22,23,1,5,20,5,11,4,23,22,13,22,18,6,7,1,8,14,21,4,14,4,2,16,13,6,15,6,19,3,8,9,4,21,5,13,17,23,6,13,22,19,6,18,9,8,1],a=[0,1,2,3,4,5,6,7,8,9,10,11,0,2,3,3,3,4,7,8,9,9,10,11],l=[5,1,3,1,6,4,0,0,5,3,4,2,2,2,4,0,2,0,1,1,6,0,6,2,0,4,3,3,4,4,3,1,4,2,4,4,0,2,1,1,2,2,3,3,1,3,2,4],c=[0,0,0,0,1,0,0,1,1,0,0,0,1,1,0,0,1,1,1,0],v=new Array,y=new Array,b=new Array,T=new Array,E=0,x=new Array(3),P=new Array(3);for(t=0;t<3;t++)x[t]=he.Vector3.Zero(),P[t]=he.Vector2.Zero();for(var h=0;h<20;h++){for(t=0;t<3;t++){var u=s[3*h+t];x[t].copyFromFloats(o[3*a[u]],o[3*a[u]+1],o[3*a[u]+2]),x[t].normalize().scaleInPlace(r),P[t].copyFromFloats(l[2*u]*(138/1024)+60/1024+c[h]*(-40/1024),l[2*u+1]*(239/1024)+26/1024+c[h]*(20/1024))}for(var d=function(e,t,i,r){var n,o=he.Vector3.Lerp(x[0],x[2],t/p),s=he.Vector3.Lerp(x[1],x[2],t/p),a=p===t?x[2]:he.Vector3.Lerp(o,s,e/(p-t));if(a.normalize(),f){var l=he.Vector3.Lerp(x[0],x[2],r/p),c=he.Vector3.Lerp(x[1],x[2],r/p);n=he.Vector3.Lerp(l,c,i/(p-r))}else n=new he.Vector3(a.x,a.y,a.z);n.x/=_,n.y/=m,n.z/=g,n.normalize();var h=he.Vector2.Lerp(P[0],P[2],t/p),u=he.Vector2.Lerp(P[1],P[2],t/p),d=p===t?P[2]:he.Vector2.Lerp(h,u,e/(p-t));y.push(a.x*_,a.y*m,a.z*g),b.push(n.x,n.y,n.z),T.push(d.x,d.y),v.push(E),E++},A=0;A<p;A++)for(var S=0;S+A<p;S++)d(S,A,S+1/3,A+1/3),d(S+1,A,S+1/3,A+1/3),d(S,A+1,S+1/3,A+1/3),S+A+1<p&&(d(S+1,A,S+2/3,A+2/3),d(S+1,A+1,S+2/3,A+2/3),d(S,A+1,S+2/3,A+2/3))}q._ComputeSides(i,y,v,b,T,e.frontUVs,e.backUVs);var M=new q;return M.indices=v,M.positions=y,M.normals=b,M.uvs=T,M},q.CreatePolyhedron=function(e){var t=[];t[0]={vertex:[[0,0,1.732051],[1.632993,0,-.5773503],[-.8164966,1.414214,-.5773503],[-.8164966,-1.414214,-.5773503]],face:[[0,1,2],[0,2,3],[0,3,1],[1,3,2]]},t[1]={vertex:[[0,0,1.414214],[1.414214,0,0],[0,1.414214,0],[-1.414214,0,0],[0,-1.414214,0],[0,0,-1.414214]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,1],[1,4,5],[1,5,2],[2,5,3],[3,5,4]]},t[2]={vertex:[[0,0,1.070466],[.7136442,0,.7978784],[-.3568221,.618034,.7978784],[-.3568221,-.618034,.7978784],[.7978784,.618034,.3568221],[.7978784,-.618034,.3568221],[-.9341724,.381966,.3568221],[.1362939,1,.3568221],[.1362939,-1,.3568221],[-.9341724,-.381966,.3568221],[.9341724,.381966,-.3568221],[.9341724,-.381966,-.3568221],[-.7978784,.618034,-.3568221],[-.1362939,1,-.3568221],[-.1362939,-1,-.3568221],[-.7978784,-.618034,-.3568221],[.3568221,.618034,-.7978784],[.3568221,-.618034,-.7978784],[-.7136442,0,-.7978784],[0,0,-1.070466]],face:[[0,1,4,7,2],[0,2,6,9,3],[0,3,8,5,1],[1,5,11,10,4],[2,7,13,12,6],[3,9,15,14,8],[4,10,16,13,7],[5,8,14,17,11],[6,12,18,15,9],[10,11,17,19,16],[12,13,16,19,18],[14,15,18,19,17]]},t[3]={vertex:[[0,0,1.175571],[1.051462,0,.5257311],[.3249197,1,.5257311],[-.8506508,.618034,.5257311],[-.8506508,-.618034,.5257311],[.3249197,-1,.5257311],[.8506508,.618034,-.5257311],[.8506508,-.618034,-.5257311],[-.3249197,1,-.5257311],[-1.051462,0,-.5257311],[-.3249197,-1,-.5257311],[0,0,-1.175571]],face:[[0,1,2],[0,2,3],[0,3,4],[0,4,5],[0,5,1],[1,5,7],[1,7,6],[1,6,2],[2,6,8],[2,8,3],[3,8,9],[3,9,4],[4,9,10],[4,10,5],[5,10,7],[6,7,11],[6,11,8],[7,10,11],[8,11,9],[9,11,10]]},t[4]={vertex:[[0,0,1.070722],[.7148135,0,.7971752],[-.104682,.7071068,.7971752],[-.6841528,.2071068,.7971752],[-.104682,-.7071068,.7971752],[.6101315,.7071068,.5236279],[1.04156,.2071068,.1367736],[.6101315,-.7071068,.5236279],[-.3574067,1,.1367736],[-.7888348,-.5,.5236279],[-.9368776,.5,.1367736],[-.3574067,-1,.1367736],[.3574067,1,-.1367736],[.9368776,-.5,-.1367736],[.7888348,.5,-.5236279],[.3574067,-1,-.1367736],[-.6101315,.7071068,-.5236279],[-1.04156,-.2071068,-.1367736],[-.6101315,-.7071068,-.5236279],[.104682,.7071068,-.7971752],[.6841528,-.2071068,-.7971752],[.104682,-.7071068,-.7971752],[-.7148135,0,-.7971752],[0,0,-1.070722]],face:[[0,2,3],[1,6,5],[4,9,11],[7,15,13],[8,16,10],[12,14,19],[17,22,18],[20,21,23],[0,1,5,2],[0,3,9,4],[0,4,7,1],[1,7,13,6],[2,5,12,8],[2,8,10,3],[3,10,17,9],[4,11,15,7],[5,6,14,12],[6,13,20,14],[8,12,19,16],[9,17,18,11],[10,16,22,17],[11,18,21,15],[13,15,21,20],[14,20,23,19],[16,19,23,22],[18,22,23,21]]},t[5]={vertex:[[0,0,1.322876],[1.309307,0,.1889822],[-.9819805,.8660254,.1889822],[.1636634,-1.299038,.1889822],[.3273268,.8660254,-.9449112],[-.8183171,-.4330127,-.9449112]],face:[[0,3,1],[2,4,5],[0,1,4,2],[0,2,5,3],[1,3,5,4]]},t[6]={vertex:[[0,0,1.159953],[1.013464,0,.5642542],[-.3501431,.9510565,.5642542],[-.7715208,-.6571639,.5642542],[.6633206,.9510565,-.03144481],[.8682979,-.6571639,-.3996071],[-1.121664,.2938926,-.03144481],[-.2348831,-1.063314,-.3996071],[.5181548,.2938926,-.9953061],[-.5850262,-.112257,-.9953061]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,9,7],[5,7,9,8],[0,3,7,5,1],[2,4,8,9,6]]},t[7]={vertex:[[0,0,1.118034],[.8944272,0,.6708204],[-.2236068,.8660254,.6708204],[-.7826238,-.4330127,.6708204],[.6708204,.8660254,.2236068],[1.006231,-.4330127,-.2236068],[-1.006231,.4330127,.2236068],[-.6708204,-.8660254,-.2236068],[.7826238,.4330127,-.6708204],[.2236068,-.8660254,-.6708204],[-.8944272,0,-.6708204],[0,0,-1.118034]],face:[[0,1,4,2],[0,2,6,3],[1,5,8,4],[3,6,10,7],[5,9,11,8],[7,10,11,9],[0,3,7,9,5,1],[2,4,8,11,10,6]]},t[8]={vertex:[[-.729665,.670121,.319155],[-.655235,-.29213,-.754096],[-.093922,-.607123,.537818],[.702196,.595691,.485187],[.776626,-.36656,-.588064]],face:[[1,4,2],[0,1,2],[3,0,2],[4,3,2],[4,1,0,3]]},t[9]={vertex:[[-.868849,-.100041,.61257],[-.329458,.976099,.28078],[-.26629,-.013796,-.477654],[-.13392,-1.034115,.229829],[.738834,.707117,-.307018],[.859683,-.535264,-.338508]],face:[[3,0,2],[5,3,2],[4,5,2],[1,4,2],[0,1,2],[0,3,5,4,1]]},t[10]={vertex:[[-.610389,.243975,.531213],[-.187812,-.48795,-.664016],[-.187812,.9759,-.664016],[.187812,-.9759,.664016],[.798201,.243975,.132803]],face:[[1,3,0],[3,4,0],[3,1,4],[0,2,1],[0,4,2],[2,4,1]]},t[11]={vertex:[[-1.028778,.392027,-.048786],[-.640503,-.646161,.621837],[-.125162,-.395663,-.540059],[.004683,.888447,-.651988],[.125161,.395663,.540059],[.632925,-.791376,.433102],[1.031672,.157063,-.354165]],face:[[3,2,0],[2,1,0],[2,5,1],[0,4,3],[0,1,4],[4,1,5],[2,3,6],[3,4,6],[5,2,6],[4,5,6]]},t[12]={vertex:[[-.669867,.334933,-.529576],[-.669867,.334933,.529577],[-.4043,1.212901,0],[-.334933,-.669867,-.529576],[-.334933,-.669867,.529577],[.334933,.669867,-.529576],[.334933,.669867,.529577],[.4043,-1.212901,0],[.669867,-.334933,-.529576],[.669867,-.334933,.529577]],face:[[8,9,7],[6,5,2],[3,8,7],[5,0,2],[4,3,7],[0,1,2],[9,4,7],[1,6,2],[9,8,5,6],[8,3,0,5],[3,4,1,0],[4,9,6,1]]},t[13]={vertex:[[-.931836,.219976,-.264632],[-.636706,.318353,.692816],[-.613483,-.735083,-.264632],[-.326545,.979634,0],[-.318353,-.636706,.692816],[-.159176,.477529,-.856368],[.159176,-.477529,-.856368],[.318353,.636706,.692816],[.326545,-.979634,0],[.613482,.735082,-.264632],[.636706,-.318353,.692816],[.931835,-.219977,-.264632]],face:[[11,10,8],[7,9,3],[6,11,8],[9,5,3],[2,6,8],[5,0,3],[4,2,8],[0,1,3],[10,4,8],[1,7,3],[10,11,9,7],[11,6,5,9],[6,2,0,5],[2,4,1,0],[4,10,7,1]]},t[14]={vertex:[[-.93465,.300459,-.271185],[-.838689,-.260219,-.516017],[-.711319,.717591,.128359],[-.710334,-.156922,.080946],[-.599799,.556003,-.725148],[-.503838,-.004675,-.969981],[-.487004,.26021,.48049],[-.460089,-.750282,-.512622],[-.376468,.973135,-.325605],[-.331735,-.646985,.084342],[-.254001,.831847,.530001],[-.125239,-.494738,-.966586],[.029622,.027949,.730817],[.056536,-.982543,-.262295],[.08085,1.087391,.076037],[.125583,-.532729,.485984],[.262625,.599586,.780328],[.391387,-.726999,-.716259],[.513854,-.868287,.139347],[.597475,.85513,.326364],[.641224,.109523,.783723],[.737185,-.451155,.538891],[.848705,-.612742,-.314616],[.976075,.365067,.32976],[1.072036,-.19561,.084927]],face:[[15,18,21],[12,20,16],[6,10,2],[3,0,1],[9,7,13],[2,8,4,0],[0,4,5,1],[1,5,11,7],[7,11,17,13],[13,17,22,18],[18,22,24,21],[21,24,23,20],[20,23,19,16],[16,19,14,10],[10,14,8,2],[15,9,13,18],[12,15,21,20],[6,12,16,10],[3,6,2,0],[9,3,1,7],[9,15,12,6,3],[22,17,11,5,4,8,14,19,23,24]]};var i,r,n,o,s,a,l=e.type&&(e.type<0||e.type>=t.length)?0:e.type||0,c=e.size,h=e.sizeX||c||1,u=e.sizeY||c||1,d=e.sizeZ||c||1,f=e.custom||t[l],p=f.face.length,_=e.faceUV||new Array(p),m=e.faceColors,g=void 0===e.flat||e.flat,v=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,y=new Array,b=new Array,T=new Array,E=new Array,x=new Array,P=0,A=0,S=new Array,M=0,R=0;if(g)for(R=0;R<p;R++)m&&void 0===m[R]&&(m[R]=new he.Color4(1,1,1,1)),_&&void 0===_[R]&&(_[R]=new he.Vector4(0,0,1,1));if(g)for(R=0;R<p;R++){var C=f.face[R].length;for(n=2*Math.PI/C,o=.5*Math.tan(n/2),s=.5,M=0;M<C;M++)y.push(f.vertex[f.face[R][M]][0]*h,f.vertex[f.face[R][M]][1]*u,f.vertex[f.face[R][M]][2]*d),S.push(P),P++,i=_[R].x+(_[R].z-_[R].x)*(.5+o),r=_[R].y+(_[R].w-_[R].y)*(s-.5),E.push(i,r),a=o*Math.cos(n)-s*Math.sin(n),s=o*Math.sin(n)+s*Math.cos(n),o=a,m&&x.push(m[R].r,m[R].g,m[R].b,m[R].a);for(M=0;M<C-2;M++)b.push(S[0+A],S[M+2+A],S[M+1+A]);A+=C}else{for(M=0;M<f.vertex.length;M++)y.push(f.vertex[M][0]*h,f.vertex[M][1]*u,f.vertex[M][2]*d),E.push(0,0);for(R=0;R<p;R++)for(M=0;M<f.face[R].length-2;M++)b.push(f.face[R][0],f.face[R][M+2],f.face[R][M+1])}q.ComputeNormals(y,b,T),q._ComputeSides(v,y,b,T,E,e.frontUVs,e.backUVs);var O=new q;return O.positions=y,O.indices=b,O.normals=T,O.uvs=E,m&&g&&(O.colors=x),O},q.CreateTorusKnot=function(e){var t,i,r=new Array,n=new Array,o=new Array,s=new Array,l=e.radius||2,a=e.tube||.5,c=e.radialSegments||32,h=e.tubularSegments||32,u=e.p||2,d=e.q||3,f=0===e.sideOrientation?0:e.sideOrientation||he.Mesh.DEFAULTSIDE,p=function(e){var t=Math.cos(e),i=Math.sin(e),r=d/u*e,n=Math.cos(r),o=l*(2+n)*.5*t,s=l*(2+n)*i*.5,a=l*Math.sin(r)*.5;return new he.Vector3(o,s,a)};for(t=0;t<=c;t++){var _=t%c/c*2*u*Math.PI,m=p(_),g=p(_+.01),v=g.subtract(m),y=g.add(m),b=he.Vector3.Cross(v,y);for(y=he.Vector3.Cross(b,v),b.normalize(),y.normalize(),i=0;i<h;i++){var T=i%h/h*2*Math.PI,E=-a*Math.cos(T),x=a*Math.sin(T);n.push(m.x+E*y.x+x*b.x),n.push(m.y+E*y.y+x*b.y),n.push(m.z+E*y.z+x*b.z),s.push(t/c),s.push(i/h)}}for(t=0;t<c;t++)for(i=0;i<h;i++){var P=(i+1)%h,A=t*h+i,S=(t+1)*h+i,M=(t+1)*h+P,R=t*h+P;r.push(R),r.push(S),r.push(A),r.push(R),r.push(M),r.push(S)}q.ComputeNormals(n,r,o),q._ComputeSides(f,n,r,o,s,e.frontUVs,e.backUVs);var C=new q;return C.indices=r,C.positions=n,C.normals=o,C.uvs=s,C},q.ComputeNormals=function(e,t,i,r){var n=0,o=0,s=0,a=0,l=0,c=0,h=0,u=0,d=0,f=0,p=0,_=0,m=0,g=0,v=0,y=0,b=0,T=0,E=0,x=0,P=!1,A=!1,S=!1,M=!1,R=1,C=0,O=null;if(r&&(P=!!r.facetNormals,A=!!r.facetPositions,S=!!r.facetPartitioning,R=!0===r.useRightHandedSystem?-1:1,C=r.ratio||0,M=!!r.depthSort,O=r.distanceTo,M)){void 0===O&&(O=he.Vector3.Zero());var D=r.depthSortedFacets}var I=0,w=0,L=0,F=0;if(S&&r&&r.bbSize){var B=0,N=0,V=0,U=0,z=0,G=0,k=0,W=0,H=0,X=0,j=0,Y=0,K=0,Q=0,Z=0,q=0,J=r.bbSize.x>r.bbSize.y?r.bbSize.x:r.bbSize.y;J=J>r.bbSize.z?J:r.bbSize.z,I=r.subDiv.X*C/r.bbSize.x,w=r.subDiv.Y*C/r.bbSize.y,L=r.subDiv.Z*C/r.bbSize.z,F=r.subDiv.max*r.subDiv.max,r.facetPartitioning.length=0}for(n=0;n<e.length;n++)i[n]=0;var $=t.length/3|0;for(n=0;n<$;n++){if(m=(_=3*t[3*n])+1,g=_+2,y=(v=3*t[3*n+1])+1,b=v+2,E=(T=3*t[3*n+2])+1,x=T+2,o=e[_]-e[v],s=e[m]-e[y],a=e[g]-e[b],l=e[T]-e[v],c=e[E]-e[y],u=R*(s*(h=e[x]-e[b])-a*c),d=R*(a*l-o*h),f=R*(o*c-s*l),u/=p=0===(p=Math.sqrt(u*u+d*d+f*f))?1:p,d/=p,f/=p,P&&r&&(r.facetNormals[n].x=u,r.facetNormals[n].y=d,r.facetNormals[n].z=f),A&&r&&(r.facetPositions[n].x=(e[_]+e[v]+e[T])/3,r.facetPositions[n].y=(e[m]+e[y]+e[E])/3,r.facetPositions[n].z=(e[g]+e[b]+e[x])/3),S&&r&&(B=Math.floor((r.facetPositions[n].x-r.bInfo.minimum.x*C)*I),N=Math.floor((r.facetPositions[n].y-r.bInfo.minimum.y*C)*w),V=Math.floor((r.facetPositions[n].z-r.bInfo.minimum.z*C)*L),U=Math.floor((e[_]-r.bInfo.minimum.x*C)*I),z=Math.floor((e[m]-r.bInfo.minimum.y*C)*w),G=Math.floor((e[g]-r.bInfo.minimum.z*C)*L),k=Math.floor((e[v]-r.bInfo.minimum.x*C)*I),W=Math.floor((e[y]-r.bInfo.minimum.y*C)*w),H=Math.floor((e[b]-r.bInfo.minimum.z*C)*L),X=Math.floor((e[T]-r.bInfo.minimum.x*C)*I),j=Math.floor((e[E]-r.bInfo.minimum.y*C)*w),Y=Math.floor((e[x]-r.bInfo.minimum.z*C)*L),Q=U+r.subDiv.max*z+F*G,Z=k+r.subDiv.max*W+F*H,q=X+r.subDiv.max*j+F*Y,K=B+r.subDiv.max*N+F*V,r.facetPartitioning[K]=r.facetPartitioning[K]?r.facetPartitioning[K]:new Array,r.facetPartitioning[Q]=r.facetPartitioning[Q]?r.facetPartitioning[Q]:new Array,r.facetPartitioning[Z]=r.facetPartitioning[Z]?r.facetPartitioning[Z]:new Array,r.facetPartitioning[q]=r.facetPartitioning[q]?r.facetPartitioning[q]:new Array,r.facetPartitioning[Q].push(n),Z!=Q&&r.facetPartitioning[Z].push(n),q!=Z&&q!=Q&&r.facetPartitioning[q].push(n),K!=Q&&K!=Z&&K!=q&&r.facetPartitioning[K].push(n)),M&&r&&r.facetPositions){var ee=D[n];ee.ind=3*n,ee.sqDistance=he.Vector3.DistanceSquared(r.facetPositions[n],O)}i[_]+=u,i[m]+=d,i[g]+=f,i[v]+=u,i[y]+=d,i[b]+=f,i[T]+=u,i[E]+=d,i[x]+=f}for(n=0;n<i.length/3;n++)u=i[3*n],d=i[3*n+1],f=i[3*n+2],u/=p=0===(p=Math.sqrt(u*u+d*d+f*f))?1:p,d/=p,f/=p,i[3*n]=u,i[3*n+1]=d,i[3*n+2]=f},q._ComputeSides=function(e,t,i,r,n,o,s){var a,l,c=i.length,h=r.length;switch(e=e||he.Mesh.DEFAULTSIDE){case he.Mesh.FRONTSIDE:break;case he.Mesh.BACKSIDE:var u;for(a=0;a<c;a+=3)u=i[a],i[a]=i[a+2],i[a+2]=u;for(l=0;l<h;l++)r[l]=-r[l];break;case he.Mesh.DOUBLESIDE:for(var d=t.length,f=d/3,p=0;p<d;p++)t[d+p]=t[p];for(a=0;a<c;a+=3)i[a+c]=i[a+2]+f,i[a+1+c]=i[a+1]+f,i[a+2+c]=i[a]+f;for(l=0;l<h;l++)r[h+l]=-r[l];var _=n.length,m=0;for(m=0;m<_;m++)n[m+_]=n[m];for(o=o||new he.Vector4(0,0,1,1),s=s||new he.Vector4(0,0,1,1),a=m=0;a<_/2;a++)n[m]=o.x+(o.z-o.x)*n[m],n[m+1]=o.y+(o.w-o.y)*n[m+1],n[m+_]=s.x+(s.z-s.x)*n[m+_],n[m+_+1]=s.y+(s.w-s.y)*n[m+_+1],m+=2}},q.ImportVertexData=function(e,t){var i=new q,r=e.positions;r&&i.set(r,he.VertexBuffer.PositionKind);var n=e.normals;n&&i.set(n,he.VertexBuffer.NormalKind);var o=e.tangents;o&&i.set(o,he.VertexBuffer.TangentKind);var s=e.uvs;s&&i.set(s,he.VertexBuffer.UVKind);var a=e.uv2s;a&&i.set(a,he.VertexBuffer.UV2Kind);var l=e.uv3s;l&&i.set(l,he.VertexBuffer.UV3Kind);var c=e.uv4s;c&&i.set(c,he.VertexBuffer.UV4Kind);var h=e.uv5s;h&&i.set(h,he.VertexBuffer.UV5Kind);var u=e.uv6s;u&&i.set(u,he.VertexBuffer.UV6Kind);var d=e.colors;d&&i.set(he.Color4.CheckColors4(d,r.length/3),he.VertexBuffer.ColorKind);var f=e.matricesIndices;f&&i.set(f,he.VertexBuffer.MatricesIndicesKind);var p=e.matricesWeights;p&&i.set(p,he.VertexBuffer.MatricesWeightsKind);var _=e.indices;_&&(i.indices=_),t.setAllVerticesData(i,e.updatable)},q})(),he.VertexData=ue,(function(I){var e=(function(){function D(e,t,i,r,n){void 0===r&&(r=!1),void 0===n&&(n=null),this.delayLoadState=I.Engine.DELAYLOADSTATE_NONE,this._totalVertices=0,this._isDisposed=!1,this._indexBufferIsUpdatable=!1,this.id=e,this._engine=t.getEngine(),this._meshes=[],this._scene=t,this._vertexBuffers={},this._indices=[],this._updatable=r,i?this.setAllVerticesData(i,r):(this._totalVertices=0,this._indices=[]),this._engine.getCaps().vertexArrayObject&&(this._vertexArrayObjects={}),n&&("LinesMesh"===n.getClassName()&&(this.boundingBias=new I.Vector2(0,n.intersectionThreshold),this._updateExtend()),this.applyToMesh(n),n.computeWorldMatrix(!0))}return Object.defineProperty(D.prototype,"boundingBias",{get:function(){return this._boundingBias},set:function(e){if(this._boundingBias){if(this._boundingBias.equals(e))return;this._boundingBias.copyFrom(e)}else this._boundingBias=e.clone();this._updateBoundingInfo(!0,null)},enumerable:!0,configurable:!0}),D.CreateGeometryForMesh=function(e){var t=new D(D.RandomId(),e.getScene());return t.applyToMesh(e),t},Object.defineProperty(D.prototype,"extend",{get:function(){return this._extend},enumerable:!0,configurable:!0}),D.prototype.getScene=function(){return this._scene},D.prototype.getEngine=function(){return this._engine},D.prototype.isReady=function(){return this.delayLoadState===I.Engine.DELAYLOADSTATE_LOADED||this.delayLoadState===I.Engine.DELAYLOADSTATE_NONE},Object.defineProperty(D.prototype,"doNotSerialize",{get:function(){for(var e=0;e<this._meshes.length;e++)if(!this._meshes[e].doNotSerialize)return!1;return!0},enumerable:!0,configurable:!0}),D.prototype._rebuild=function(){for(var e in this._vertexArrayObjects&&(this._vertexArrayObjects={}),0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._vertexBuffers){this._vertexBuffers[e]._rebuild()}},D.prototype.setAllVerticesData=function(e,t){e.applyToGeometry(this,t),this.notifyUpdate()},D.prototype.setVerticesData=function(e,t,i,r){void 0===i&&(i=!1);var n=new I.VertexBuffer(this._engine,t,e,i,0===this._meshes.length,r);this.setVerticesBuffer(n)},D.prototype.removeVerticesData=function(e){this._vertexBuffers[e]&&(this._vertexBuffers[e].dispose(),delete this._vertexBuffers[e])},D.prototype.setVerticesBuffer=function(e,t){void 0===t&&(t=null);var i=e.getKind();if(this._vertexBuffers[i]&&this._vertexBuffers[i].dispose(),this._vertexBuffers[i]=e,i===I.VertexBuffer.PositionKind){var r=e.getData();null!=t?this._totalVertices=t:null!=r&&(this._totalVertices=r.length/(e.byteStride/4)),this._updateExtend(r),this._resetPointsArrayCache();for(var n=this._meshes,o=n.length,s=0;s<o;s++){var a=n[s];a._boundingInfo=new I.BoundingInfo(this._extend.minimum,this._extend.maximum),a._createGlobalSubMesh(!1),a.computeWorldMatrix(!0)}}this.notifyUpdate(i),this._vertexArrayObjects&&(this._disposeVertexArrayObjects(),this._vertexArrayObjects={})},D.prototype.updateVerticesDataDirectly=function(e,t,i,r){void 0===r&&(r=!1);var n=this.getVertexBuffer(e);n&&(n.updateDirectly(t,i,r),this.notifyUpdate(e))},D.prototype.updateVerticesData=function(e,t,i){void 0===i&&(i=!1);var r=this.getVertexBuffer(e);r&&(r.update(t),e===I.VertexBuffer.PositionKind&&this._updateBoundingInfo(i,t),this.notifyUpdate(e))},D.prototype._updateBoundingInfo=function(e,t){e&&this._updateExtend(t);var i=this._meshes,r=i.length;this._resetPointsArrayCache();for(var n=0;n<r;n++){var o=i[n];if(e){o._boundingInfo=new I.BoundingInfo(this._extend.minimum,this._extend.maximum);for(var s=0;s<o.subMeshes.length;s++){o.subMeshes[s].refreshBoundingInfo()}}}},D.prototype._bind=function(e,t){if(e){void 0===t&&(t=this._indexBuffer);var i=this.getVertexBuffers();i&&(t==this._indexBuffer&&this._vertexArrayObjects?(this._vertexArrayObjects[e.key]||(this._vertexArrayObjects[e.key]=this._engine.recordVertexArrayObject(i,t,e)),this._engine.bindVertexArrayObject(this._vertexArrayObjects[e.key],t)):this._engine.bindBuffers(i,t,e))}},D.prototype.getTotalVertices=function(){return this.isReady()?this._totalVertices:0},D.prototype.getVerticesData=function(e,t,i){var r=this.getVertexBuffer(e);if(!r)return null;var n=r.getData();if(!n)return null;var o=r.getSize()*I.VertexBuffer.GetTypeByteLength(r.type),s=this._totalVertices*r.getSize();if(r.type!==I.VertexBuffer.FLOAT||r.byteStride!==o){var a=new Array(s);return r.forEach(s,(function(e,t){a[t]=e})),a}if(!(n instanceof Array||n instanceof Float32Array)||0!==r.byteOffset||n.length!==s){if(n instanceof Array){var l=r.byteOffset/4;return I.Tools.Slice(n,l,l+s)}if(n instanceof ArrayBuffer)return new Float32Array(n,r.byteOffset,s);l=n.byteOffset+r.byteOffset;if(i||t&&1!==this._meshes.length){var c=new Float32Array(s),h=new Float32Array(n.buffer,l,s);return c.set(h),c}return new Float32Array(n.buffer,l,s)}return i||t&&1!==this._meshes.length?I.Tools.Slice(n):n},D.prototype.isVertexBufferUpdatable=function(e){var t=this._vertexBuffers[e];return!!t&&t.isUpdatable()},D.prototype.getVertexBuffer=function(e){return this.isReady()?this._vertexBuffers[e]:null},D.prototype.getVertexBuffers=function(){return this.isReady()?this._vertexBuffers:null},D.prototype.isVerticesDataPresent=function(e){return this._vertexBuffers?void 0!==this._vertexBuffers[e]:!!this._delayInfo&&-1!==this._delayInfo.indexOf(e)},D.prototype.getVerticesDataKinds=function(){var e,t=[];if(!this._vertexBuffers&&this._delayInfo)for(e in this._delayInfo)t.push(e);else for(e in this._vertexBuffers)t.push(e);return t},D.prototype.updateIndices=function(e,t){this._indexBuffer&&(this._indexBufferIsUpdatable?this._engine.updateDynamicIndexBuffer(this._indexBuffer,e,t):this.setIndices(e,null,!0))},D.prototype.setIndices=function(e,t,i){void 0===t&&(t=null),void 0===i&&(i=!1),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._disposeVertexArrayObjects(),this._indices=e,this._indexBufferIsUpdatable=i,0!==this._meshes.length&&this._indices&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices,i)),null!=t&&(this._totalVertices=t);for(var r=this._meshes,n=r.length,o=0;o<n;o++)r[o]._createGlobalSubMesh(!0);this.notifyUpdate()},D.prototype.getTotalIndices=function(){return this.isReady()?this._indices.length:0},D.prototype.getIndices=function(e,t){if(!this.isReady())return null;var i=this._indices;if(t||e&&1!==this._meshes.length){for(var r=i.length,n=[],o=0;o<r;o++)n.push(i[o]);return n}return i},D.prototype.getIndexBuffer=function(){return this.isReady()?this._indexBuffer:null},D.prototype._releaseVertexArrayObject=function(e){void 0===e&&(e=null),e&&this._vertexArrayObjects&&this._vertexArrayObjects[e.key]&&(this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e.key]),delete this._vertexArrayObjects[e.key])},D.prototype.releaseForMesh=function(e,t){var i=this._meshes,r=i.indexOf(e);-1!==r&&(i.splice(r,1),e._geometry=null,0===i.length&&t&&this.dispose())},D.prototype.applyToMesh=function(e){if(e._geometry!==this){var t=e._geometry;t&&t.releaseForMesh(e);var i=this._meshes;(e._geometry=this)._scene.pushGeometry(this),i.push(e),this.isReady()?this._applyToMesh(e):e._boundingInfo=this._boundingInfo}},D.prototype._updateExtend=function(e){void 0===e&&(e=null),e||(e=this.getVerticesData(I.VertexBuffer.PositionKind)),this._extend=I.Tools.ExtractMinAndMax(e,0,this._totalVertices,this.boundingBias,3)},D.prototype._applyToMesh=function(e){var t=this._meshes.length;for(var i in this._vertexBuffers){1===t&&this._vertexBuffers[i].create();var r=this._vertexBuffers[i].getBuffer();r&&(r.references=t),i===I.VertexBuffer.PositionKind&&(this._extend||this._updateExtend(),e._boundingInfo=new I.BoundingInfo(this._extend.minimum,this._extend.maximum),e._createGlobalSubMesh(!1),e._updateBoundingInfo())}1===t&&this._indices&&0<this._indices.length&&(this._indexBuffer=this._engine.createIndexBuffer(this._indices)),this._indexBuffer&&(this._indexBuffer.references=t),e._syncGeometryWithMorphTargetManager()},D.prototype.notifyUpdate=function(e){this.onGeometryUpdated&&this.onGeometryUpdated(this,e);for(var t=0,i=this._meshes;t<i.length;t++){i[t]._markSubMeshesAsAttributesDirty()}},D.prototype.load=function(e,t){this.delayLoadState!==I.Engine.DELAYLOADSTATE_LOADING&&(this.isReady()?t&&t():(this.delayLoadState=I.Engine.DELAYLOADSTATE_LOADING,this._queueLoad(e,t)))},D.prototype._queueLoad=function(n,o){var s=this;this.delayLoadingFile&&(n._addPendingData(this),n._loadFile(this.delayLoadingFile,(function(e){if(s._delayLoadingFunction){s._delayLoadingFunction(JSON.parse(e),s),s.delayLoadState=I.Engine.DELAYLOADSTATE_LOADED,s._delayInfo=[],n._removePendingData(s);for(var t=s._meshes,i=t.length,r=0;r<i;r++)s._applyToMesh(t[r]);o&&o()}}),void 0,!0))},D.prototype.toLeftHanded=function(){var e=this.getIndices(!1);if(null!=e&&0<e.length){for(var t=0;t<e.length;t+=3){var i=e[t+0];e[t+0]=e[t+2],e[t+2]=i}this.setIndices(e)}var r=this.getVerticesData(I.VertexBuffer.PositionKind,!1);if(null!=r&&0<r.length){for(t=0;t<r.length;t+=3)r[t+2]=-r[t+2];this.setVerticesData(I.VertexBuffer.PositionKind,r,!1)}var n=this.getVerticesData(I.VertexBuffer.NormalKind,!1);if(null!=n&&0<n.length){for(t=0;t<n.length;t+=3)n[t+2]=-n[t+2];this.setVerticesData(I.VertexBuffer.NormalKind,n,!1)}},D.prototype._resetPointsArrayCache=function(){this._positions=null},D.prototype._generatePointsArray=function(){if(this._positions)return!0;var e=this.getVerticesData(I.VertexBuffer.PositionKind);if(!e||0===e.length)return!1;this._positions=[];for(var t=0;t<e.length;t+=3)this._positions.push(I.Vector3.FromArray(e,t));return!0},D.prototype.isDisposed=function(){return this._isDisposed},D.prototype._disposeVertexArrayObjects=function(){if(this._vertexArrayObjects){for(var e in this._vertexArrayObjects)this._engine.releaseVertexArrayObject(this._vertexArrayObjects[e]);this._vertexArrayObjects={}}},D.prototype.dispose=function(){var e,t=this._meshes,i=t.length;for(e=0;e<i;e++)this.releaseForMesh(t[e]);for(var r in this._meshes=[],this._disposeVertexArrayObjects(),this._vertexBuffers)this._vertexBuffers[r].dispose();this._vertexBuffers={},this._totalVertices=0,this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer),this._indexBuffer=null,this._indices=[],this.delayLoadState=I.Engine.DELAYLOADSTATE_NONE,this.delayLoadingFile=null,this._delayLoadingFunction=null,this._delayInfo=[],this._boundingInfo=null,this._scene.removeGeometry(this),this._isDisposed=!0},D.prototype.copy=function(e){var t=new I.VertexData;t.indices=[];var i=this.getIndices();if(i)for(var r=0;r<i.length;r++)t.indices.push(i[r]);var n,o=!1,s=!1;for(n in this._vertexBuffers){var a=this.getVerticesData(n);if(a instanceof Float32Array?t.set(new Float32Array(a),n):t.set(a.slice(0),n),!s){var l=this.getVertexBuffer(n);l&&(s=!(o=l.isUpdatable()))}}var c=new D(e,this._scene,t,o);for(n in c.delayLoadState=this.delayLoadState,c.delayLoadingFile=this.delayLoadingFile,c._delayLoadingFunction=this._delayLoadingFunction,this._delayInfo)c._delayInfo=c._delayInfo||[],c._delayInfo.push(n);return c._boundingInfo=new I.BoundingInfo(this._extend.minimum,this._extend.maximum),c},D.prototype.serialize=function(){var e={};return e.id=this.id,e.updatable=this._updatable,I.Tags&&I.Tags.HasTags(this)&&(e.tags=I.Tags.GetTags(this)),e},D.prototype.toNumberArray=function(e){return Array.isArray(e)?e:Array.prototype.slice.call(e)},D.prototype.serializeVerticeData=function(){var e=this.serialize();return this.isVerticesDataPresent(I.VertexBuffer.PositionKind)&&(e.positions=this.toNumberArray(this.getVerticesData(I.VertexBuffer.PositionKind)),this.isVertexBufferUpdatable(I.VertexBuffer.PositionKind)&&(e.positions._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.NormalKind)&&(e.normals=this.toNumberArray(this.getVerticesData(I.VertexBuffer.NormalKind)),this.isVertexBufferUpdatable(I.VertexBuffer.NormalKind)&&(e.normals._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.TangentKind)&&(e.tangets=this.toNumberArray(this.getVerticesData(I.VertexBuffer.TangentKind)),this.isVertexBufferUpdatable(I.VertexBuffer.TangentKind)&&(e.tangets._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.UVKind)&&(e.uvs=this.toNumberArray(this.getVerticesData(I.VertexBuffer.UVKind)),this.isVertexBufferUpdatable(I.VertexBuffer.UVKind)&&(e.uvs._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.UV2Kind)&&(e.uv2s=this.toNumberArray(this.getVerticesData(I.VertexBuffer.UV2Kind)),this.isVertexBufferUpdatable(I.VertexBuffer.UV2Kind)&&(e.uv2s._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.UV3Kind)&&(e.uv3s=this.toNumberArray(this.getVerticesData(I.VertexBuffer.UV3Kind)),this.isVertexBufferUpdatable(I.VertexBuffer.UV3Kind)&&(e.uv3s._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.UV4Kind)&&(e.uv4s=this.toNumberArray(this.getVerticesData(I.VertexBuffer.UV4Kind)),this.isVertexBufferUpdatable(I.VertexBuffer.UV4Kind)&&(e.uv4s._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.UV5Kind)&&(e.uv5s=this.toNumberArray(this.getVerticesData(I.VertexBuffer.UV5Kind)),this.isVertexBufferUpdatable(I.VertexBuffer.UV5Kind)&&(e.uv5s._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.UV6Kind)&&(e.uv6s=this.toNumberArray(this.getVerticesData(I.VertexBuffer.UV6Kind)),this.isVertexBufferUpdatable(I.VertexBuffer.UV6Kind)&&(e.uv6s._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.ColorKind)&&(e.colors=this.toNumberArray(this.getVerticesData(I.VertexBuffer.ColorKind)),this.isVertexBufferUpdatable(I.VertexBuffer.ColorKind)&&(e.colors._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.MatricesIndicesKind)&&(e.matricesIndices=this.toNumberArray(this.getVerticesData(I.VertexBuffer.MatricesIndicesKind)),e.matricesIndices._isExpanded=!0,this.isVertexBufferUpdatable(I.VertexBuffer.MatricesIndicesKind)&&(e.matricesIndices._updatable=!0)),this.isVerticesDataPresent(I.VertexBuffer.MatricesWeightsKind)&&(e.matricesWeights=this.toNumberArray(this.getVerticesData(I.VertexBuffer.MatricesWeightsKind)),this.isVertexBufferUpdatable(I.VertexBuffer.MatricesWeightsKind)&&(e.matricesWeights._updatable=!0)),e.indices=this.toNumberArray(this.getIndices()),e},D.ExtractFromMesh=function(e,t){var i=e._geometry;return i?i.copy(t):null},D.RandomId=function(){return I.Tools.RandomId()},D._ImportGeometry=function(e,t){var i=t.getScene(),r=e.geometryId;if(r){var n=i.getGeometryByID(r);n&&n.applyToMesh(t)}else if(e instanceof ArrayBuffer){var o=t._binaryInfo;if(o.positionsAttrDesc&&0<o.positionsAttrDesc.count){var s=new Float32Array(e,o.positionsAttrDesc.offset,o.positionsAttrDesc.count);t.setVerticesData(I.VertexBuffer.PositionKind,s,!1)}if(o.normalsAttrDesc&&0<o.normalsAttrDesc.count){var a=new Float32Array(e,o.normalsAttrDesc.offset,o.normalsAttrDesc.count);t.setVerticesData(I.VertexBuffer.NormalKind,a,!1)}if(o.tangetsAttrDesc&&0<o.tangetsAttrDesc.count){var l=new Float32Array(e,o.tangetsAttrDesc.offset,o.tangetsAttrDesc.count);t.setVerticesData(I.VertexBuffer.TangentKind,l,!1)}if(o.uvsAttrDesc&&0<o.uvsAttrDesc.count){var c=new Float32Array(e,o.uvsAttrDesc.offset,o.uvsAttrDesc.count);t.setVerticesData(I.VertexBuffer.UVKind,c,!1)}if(o.uvs2AttrDesc&&0<o.uvs2AttrDesc.count){var h=new Float32Array(e,o.uvs2AttrDesc.offset,o.uvs2AttrDesc.count);t.setVerticesData(I.VertexBuffer.UV2Kind,h,!1)}if(o.uvs3AttrDesc&&0<o.uvs3AttrDesc.count){var u=new Float32Array(e,o.uvs3AttrDesc.offset,o.uvs3AttrDesc.count);t.setVerticesData(I.VertexBuffer.UV3Kind,u,!1)}if(o.uvs4AttrDesc&&0<o.uvs4AttrDesc.count){var d=new Float32Array(e,o.uvs4AttrDesc.offset,o.uvs4AttrDesc.count);t.setVerticesData(I.VertexBuffer.UV4Kind,d,!1)}if(o.uvs5AttrDesc&&0<o.uvs5AttrDesc.count){var f=new Float32Array(e,o.uvs5AttrDesc.offset,o.uvs5AttrDesc.count);t.setVerticesData(I.VertexBuffer.UV5Kind,f,!1)}if(o.uvs6AttrDesc&&0<o.uvs6AttrDesc.count){var p=new Float32Array(e,o.uvs6AttrDesc.offset,o.uvs6AttrDesc.count);t.setVerticesData(I.VertexBuffer.UV6Kind,p,!1)}if(o.colorsAttrDesc&&0<o.colorsAttrDesc.count){var _=new Float32Array(e,o.colorsAttrDesc.offset,o.colorsAttrDesc.count);t.setVerticesData(I.VertexBuffer.ColorKind,_,!1,o.colorsAttrDesc.stride)}if(o.matricesIndicesAttrDesc&&0<o.matricesIndicesAttrDesc.count){for(var m=new Int32Array(e,o.matricesIndicesAttrDesc.offset,o.matricesIndicesAttrDesc.count),g=[],v=0;v<m.length;v++){var y=m[v];g.push(255&y),g.push((65280&y)>>8),g.push((16711680&y)>>16),g.push(y>>24)}t.setVerticesData(I.VertexBuffer.MatricesIndicesKind,g,!1)}if(o.matricesWeightsAttrDesc&&0<o.matricesWeightsAttrDesc.count){var b=new Float32Array(e,o.matricesWeightsAttrDesc.offset,o.matricesWeightsAttrDesc.count);t.setVerticesData(I.VertexBuffer.MatricesWeightsKind,b,!1)}if(o.indicesAttrDesc&&0<o.indicesAttrDesc.count){var T=new Int32Array(e,o.indicesAttrDesc.offset,o.indicesAttrDesc.count);t.setIndices(T,null)}if(o.subMeshesAttrDesc&&0<o.subMeshesAttrDesc.count){var E=new Int32Array(e,o.subMeshesAttrDesc.offset,5*o.subMeshesAttrDesc.count);t.subMeshes=[];for(v=0;v<o.subMeshesAttrDesc.count;v++){var x=E[5*v+0],P=E[5*v+1],A=E[5*v+2],S=E[5*v+3],M=E[5*v+4];I.SubMesh.AddToMesh(x,P,A,S,M,t)}}}else if(e.positions&&e.normals&&e.indices){if(t.setVerticesData(I.VertexBuffer.PositionKind,e.positions,e.positions._updatable),t.setVerticesData(I.VertexBuffer.NormalKind,e.normals,e.normals._updatable),e.tangents&&t.setVerticesData(I.VertexBuffer.TangentKind,e.tangents,e.tangents._updatable),e.uvs&&t.setVerticesData(I.VertexBuffer.UVKind,e.uvs,e.uvs._updatable),e.uvs2&&t.setVerticesData(I.VertexBuffer.UV2Kind,e.uvs2,e.uvs2._updatable),e.uvs3&&t.setVerticesData(I.VertexBuffer.UV3Kind,e.uvs3,e.uvs3._updatable),e.uvs4&&t.setVerticesData(I.VertexBuffer.UV4Kind,e.uvs4,e.uvs4._updatable),e.uvs5&&t.setVerticesData(I.VertexBuffer.UV5Kind,e.uvs5,e.uvs5._updatable),e.uvs6&&t.setVerticesData(I.VertexBuffer.UV6Kind,e.uvs6,e.uvs6._updatable),e.colors&&t.setVerticesData(I.VertexBuffer.ColorKind,I.Color4.CheckColors4(e.colors,e.positions.length/3),e.colors._updatable),e.matricesIndices)if(e.matricesIndices._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(I.VertexBuffer.MatricesIndicesKind,e.matricesIndices,e.matricesIndices._updatable);else{for(g=[],v=0;v<e.matricesIndices.length;v++){var R=e.matricesIndices[v];g.push(255&R),g.push((65280&R)>>8),g.push((16711680&R)>>16),g.push(R>>24)}t.setVerticesData(I.VertexBuffer.MatricesIndicesKind,g,e.matricesIndices._updatable)}if(e.matricesIndicesExtra)if(e.matricesIndicesExtra._isExpanded)delete e.matricesIndices._isExpanded,t.setVerticesData(I.VertexBuffer.MatricesIndicesExtraKind,e.matricesIndicesExtra,e.matricesIndicesExtra._updatable);else{for(g=[],v=0;v<e.matricesIndicesExtra.length;v++){R=e.matricesIndicesExtra[v];g.push(255&R),g.push((65280&R)>>8),g.push((16711680&R)>>16),g.push(R>>24)}t.setVerticesData(I.VertexBuffer.MatricesIndicesExtraKind,g,e.matricesIndicesExtra._updatable)}e.matricesWeights&&(D._CleanMatricesWeights(e,t),t.setVerticesData(I.VertexBuffer.MatricesWeightsKind,e.matricesWeights,e.matricesWeights._updatable)),e.matricesWeightsExtra&&t.setVerticesData(I.VertexBuffer.MatricesWeightsExtraKind,e.matricesWeightsExtra,e.matricesWeights._updatable),t.setIndices(e.indices,null)}if(e.subMeshes){t.subMeshes=[];for(var C=0;C<e.subMeshes.length;C++){var O=e.subMeshes[C];I.SubMesh.AddToMesh(O.materialIndex,O.verticesStart,O.verticesCount,O.indexStart,O.indexCount,t)}}t._shouldGenerateFlatShading&&(t.convertToFlatShadedMesh(),delete t._shouldGenerateFlatShading),t.computeWorldMatrix(!0),i.onMeshImportedObservable.notifyObservers(t)},D._CleanMatricesWeights=function(e,t){if(I.SceneLoader.CleanBoneMatrixWeights){var i=0;if(-1<e.skeletonId){var r=t.getScene().getLastSkeletonByID(e.skeletonId);if(r){i=r.bones.length;for(var n=t.getVerticesData(I.VertexBuffer.MatricesIndicesKind),o=t.getVerticesData(I.VertexBuffer.MatricesIndicesExtraKind),s=e.matricesWeights,a=e.matricesWeightsExtra,l=e.numBoneInfluencer,c=s.length,h=0;h<c;h+=4){for(var u=0,d=-1,f=0;f<4;f++){u+=p=s[h+f],p<.001&&d<0&&(d=f)}if(a)for(f=0;f<4;f++){var p;u+=p=a[h+f],p<.001&&d<0&&(d=f+4)}if((d<0||l-1<d)&&(d=l-1),.001<u){var _=1/u;for(f=0;f<4;f++)s[h+f]*=_;if(a)for(f=0;f<4;f++)a[h+f]*=_}else 4<=d?(a[h+d-4]=1-u,o[h+d-4]=i):(s[h+d]=1-u,n[h+d]=i)}t.setVerticesData(I.VertexBuffer.MatricesIndicesKind,n),e.matricesWeightsExtra&&t.setVerticesData(I.VertexBuffer.MatricesIndicesExtraKind,o)}}}},D.Parse=function(e,t,i){if(t.getGeometryByID(e.id))return null;var r=new D(e.id,t,void 0,e.updatable);return I.Tags&&I.Tags.AddTagsTo(r,e.tags),e.delayLoadingFile?(r.delayLoadState=I.Engine.DELAYLOADSTATE_NOTLOADED,r.delayLoadingFile=i+e.delayLoadingFile,r._boundingInfo=new I.BoundingInfo(I.Vector3.FromArray(e.boundingBoxMinimum),I.Vector3.FromArray(e.boundingBoxMaximum)),r._delayInfo=[],e.hasUVs&&r._delayInfo.push(I.VertexBuffer.UVKind),e.hasUVs2&&r._delayInfo.push(I.VertexBuffer.UV2Kind),e.hasUVs3&&r._delayInfo.push(I.VertexBuffer.UV3Kind),e.hasUVs4&&r._delayInfo.push(I.VertexBuffer.UV4Kind),e.hasUVs5&&r._delayInfo.push(I.VertexBuffer.UV5Kind),e.hasUVs6&&r._delayInfo.push(I.VertexBuffer.UV6Kind),e.hasColors&&r._delayInfo.push(I.VertexBuffer.ColorKind),e.hasMatricesIndices&&r._delayInfo.push(I.VertexBuffer.MatricesIndicesKind),e.hasMatricesWeights&&r._delayInfo.push(I.VertexBuffer.MatricesWeightsKind),r._delayLoadingFunction=I.VertexData.ImportVertexData):I.VertexData.ImportVertexData(e,r),t.pushGeometry(r,!0),r},D})(),t=(function(o){function e(e,t,i,r){void 0===i&&(i=!1),void 0===r&&(r=null);var n=o.call(this,e,t,void 0,!1,r)||this;return n._canBeRegenerated=i,n._beingRegenerated=!0,n.regenerate(),n._beingRegenerated=!1,n}return T(e,o),e.prototype.canBeRegenerated=function(){return this._canBeRegenerated},e.prototype.regenerate=function(){this._canBeRegenerated&&(this._beingRegenerated=!0,this.setAllVerticesData(this._regenerateVertexData(),!1),this._beingRegenerated=!1)},e.prototype.asNewGeometry=function(e){return o.prototype.copy.call(this,e)},e.prototype.setAllVerticesData=function(e,t){this._beingRegenerated&&o.prototype.setAllVerticesData.call(this,e,!1)},e.prototype.setVerticesData=function(e,t,i){this._beingRegenerated&&o.prototype.setVerticesData.call(this,e,t,!1)},e.prototype._regenerateVertexData=function(){throw new Error("Abstract method")},e.prototype.copy=function(e){throw new Error("Must be overriden in sub-classes.")},e.prototype.serialize=function(){var e=o.prototype.serialize.call(this);return e.canBeRegenerated=this.canBeRegenerated(),e},e})(I.Geometry=e),i=(function(h){function t(e,t,i,r,n,o,s,a,l){void 0===l&&(l=I.Mesh.DEFAULTSIDE);var c=h.call(this,e,t,s,a)||this;return c.pathArray=i,c.closeArray=r,c.closePath=n,c.offset=o,c.side=l,c}return T(t,h),t.prototype._regenerateVertexData=function(){return I.VertexData.CreateRibbon({pathArray:this.pathArray,closeArray:this.closeArray,closePath:this.closePath,offset:this.offset,sideOrientation:this.side})},t.prototype.copy=function(e){return new t(e,this.getScene(),this.pathArray,this.closeArray,this.closePath,this.offset,this.canBeRegenerated(),void 0,this.side)},t})(I._PrimitiveGeometry=t);I.RibbonGeometry=i;var r=(function(a){function r(e,t,i,r,n,o){void 0===n&&(n=null),void 0===o&&(o=I.Mesh.DEFAULTSIDE);var s=a.call(this,e,t,r,n)||this;return s.size=i,s.side=o,s}return T(r,a),r.prototype._regenerateVertexData=function(){return I.VertexData.CreateBox({size:this.size,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.size,this.canBeRegenerated(),void 0,this.side)},r.prototype.serialize=function(){var e=a.prototype.serialize.call(this);return e.size=this.size,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.size,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.BoxGeometry=r;var n=(function(l){function r(e,t,i,r,n,o,s){void 0===o&&(o=null),void 0===s&&(s=I.Mesh.DEFAULTSIDE);var a=l.call(this,e,t,n,o)||this;return a.segments=i,a.diameter=r,a.side=s,a}return T(r,l),r.prototype._regenerateVertexData=function(){return I.VertexData.CreateSphere({segments:this.segments,diameter:this.diameter,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.segments,this.diameter,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=l.prototype.serialize.call(this);return e.segments=this.segments,e.diameter=this.diameter,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.segments,e.diameter,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.SphereGeometry=n;var o=(function(l){function t(e,t,i,r,n,o,s){void 0===o&&(o=null),void 0===s&&(s=I.Mesh.DEFAULTSIDE);var a=l.call(this,e,t,n,o)||this;return a.radius=i,a.tessellation=r,a.side=s,a}return T(t,l),t.prototype._regenerateVertexData=function(){return I.VertexData.CreateDisc({radius:this.radius,tessellation:this.tessellation,sideOrientation:this.side})},t.prototype.copy=function(e){return new t(e,this.getScene(),this.radius,this.tessellation,this.canBeRegenerated(),null,this.side)},t})(t);I.DiscGeometry=o;var s=(function(u){function r(e,t,i,r,n,o,s,a,l,c){void 0===s&&(s=1),void 0===l&&(l=null),void 0===c&&(c=I.Mesh.DEFAULTSIDE);var h=u.call(this,e,t,a,l)||this;return h.height=i,h.diameterTop=r,h.diameterBottom=n,h.tessellation=o,h.subdivisions=s,h.side=c,h}return T(r,u),r.prototype._regenerateVertexData=function(){return I.VertexData.CreateCylinder({height:this.height,diameterTop:this.diameterTop,diameterBottom:this.diameterBottom,tessellation:this.tessellation,subdivisions:this.subdivisions,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.height,this.diameterTop,this.diameterBottom,this.tessellation,this.subdivisions,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=u.prototype.serialize.call(this);return e.height=this.height,e.diameterTop=this.diameterTop,e.diameterBottom=this.diameterBottom,e.tessellation=this.tessellation,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.height,e.diameterTop,e.diameterBottom,e.tessellation,e.subdivisions,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.CylinderGeometry=s;var a=(function(c){function r(e,t,i,r,n,o,s,a){void 0===s&&(s=null),void 0===a&&(a=I.Mesh.DEFAULTSIDE);var l=c.call(this,e,t,o,s)||this;return l.diameter=i,l.thickness=r,l.tessellation=n,l.side=a,l}return T(r,c),r.prototype._regenerateVertexData=function(){return I.VertexData.CreateTorus({diameter:this.diameter,thickness:this.thickness,tessellation:this.tessellation,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.diameter,this.thickness,this.tessellation,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=c.prototype.serialize.call(this);return e.diameter=this.diameter,e.thickness=this.thickness,e.tessellation=this.tessellation,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.diameter,e.thickness,e.tessellation,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.TorusGeometry=a;var l=(function(l){function r(e,t,i,r,n,o,s){void 0===s&&(s=null);var a=l.call(this,e,t,o,s)||this;return a.width=i,a.height=r,a.subdivisions=n,a}return T(r,l),r.prototype._regenerateVertexData=function(){return I.VertexData.CreateGround({width:this.width,height:this.height,subdivisions:this.subdivisions})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.width,this.height,this.subdivisions,this.canBeRegenerated(),null)},r.prototype.serialize=function(){var e=l.prototype.serialize.call(this);return e.width=this.width,e.height=this.height,e.subdivisions=this.subdivisions,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.width,e.height,e.subdivisions,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.GroundGeometry=l;var c=(function(u){function t(e,t,i,r,n,o,s,a,l,c){void 0===c&&(c=null);var h=u.call(this,e,t,l,c)||this;return h.xmin=i,h.zmin=r,h.xmax=n,h.zmax=o,h.subdivisions=s,h.precision=a,h}return T(t,u),t.prototype._regenerateVertexData=function(){return I.VertexData.CreateTiledGround({xmin:this.xmin,zmin:this.zmin,xmax:this.xmax,zmax:this.zmax,subdivisions:this.subdivisions,precision:this.precision})},t.prototype.copy=function(e){return new t(e,this.getScene(),this.xmin,this.zmin,this.xmax,this.zmax,this.subdivisions,this.precision,this.canBeRegenerated(),null)},t})(t);I.TiledGroundGeometry=c;var h=(function(a){function r(e,t,i,r,n,o){void 0===n&&(n=null),void 0===o&&(o=I.Mesh.DEFAULTSIDE);var s=a.call(this,e,t,r,n)||this;return s.size=i,s.side=o,s}return T(r,a),r.prototype._regenerateVertexData=function(){return I.VertexData.CreatePlane({size:this.size,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.size,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=a.prototype.serialize.call(this);return e.size=this.size,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.size,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.PlaneGeometry=h;var u=(function(d){function r(e,t,i,r,n,o,s,a,l,c,h){void 0===c&&(c=null),void 0===h&&(h=I.Mesh.DEFAULTSIDE);var u=d.call(this,e,t,l,c)||this;return u.radius=i,u.tube=r,u.radialSegments=n,u.tubularSegments=o,u.p=s,u.q=a,u.side=h,u}return T(r,d),r.prototype._regenerateVertexData=function(){return I.VertexData.CreateTorusKnot({radius:this.radius,tube:this.tube,radialSegments:this.radialSegments,tubularSegments:this.tubularSegments,p:this.p,q:this.q,sideOrientation:this.side})},r.prototype.copy=function(e){return new r(e,this.getScene(),this.radius,this.tube,this.radialSegments,this.tubularSegments,this.p,this.q,this.canBeRegenerated(),null,this.side)},r.prototype.serialize=function(){var e=d.prototype.serialize.call(this);return e.radius=this.radius,e.tube=this.tube,e.radialSegments=this.radialSegments,e.tubularSegments=this.tubularSegments,e.p=this.p,e.q=this.q,e},r.Parse=function(e,t){if(t.getGeometryByID(e.id))return null;var i=new r(e.id,t,e.radius,e.tube,e.radialSegments,e.tubularSegments,e.p,e.q,e.canBeRegenerated,null);return I.Tags&&I.Tags.AddTagsTo(i,e.tags),t.pushGeometry(i,!0),i},r})(t);I.TorusKnotGeometry=u})($a||($a={})),(function(i){var e=(function(){function e(e){void 0===e&&(e=30),this._enabled=!0,this._rollingFrameTime=new t(e)}return e.prototype.sampleFrame=function(e){if(void 0===e&&(e=i.Tools.Now),this._enabled){if(null!=this._lastFrameTimeMs){var t=e-this._lastFrameTimeMs;this._rollingFrameTime.add(t)}this._lastFrameTimeMs=e}},Object.defineProperty(e.prototype,"averageFrameTime",{get:function(){return this._rollingFrameTime.average},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"averageFrameTimeVariance",{get:function(){return this._rollingFrameTime.variance},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFrameTime",{get:function(){return this._rollingFrameTime.history(0)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"averageFPS",{get:function(){return 1e3/this._rollingFrameTime.average},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"instantaneousFPS",{get:function(){var e=this._rollingFrameTime.history(0);return 0===e?0:1e3/e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSaturated",{get:function(){return this._rollingFrameTime.isSaturated()},enumerable:!0,configurable:!0}),e.prototype.enable=function(){this._enabled=!0},e.prototype.disable=function(){this._enabled=!1,this._lastFrameTimeMs=null},Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._enabled},enumerable:!0,configurable:!0}),e.prototype.reset=function(){this._lastFrameTimeMs=null,this._rollingFrameTime.reset()},e})();i.PerformanceMonitor=e;var t=(function(){function e(e){this._samples=new Array(e),this.reset()}return e.prototype.add=function(e){var t;if(this.isSaturated()){var i=this._samples[this._pos];t=i-this.average,this.average-=t/(this._sampleCount-1),this._m2-=t*(i-this.average)}else this._sampleCount++;t=e-this.average,this.average+=t/this._sampleCount,this._m2+=t*(e-this.average),this.variance=this._m2/(this._sampleCount-1),this._samples[this._pos]=e,this._pos++,this._pos%=this._samples.length},e.prototype.history=function(e){if(e>=this._sampleCount||e>=this._samples.length)return 0;var t=this._wrapPosition(this._pos-1);return this._samples[this._wrapPosition(t-e)]},e.prototype.isSaturated=function(){return this._sampleCount>=this._samples.length},e.prototype.reset=function(){this.average=0,this.variance=0,this._sampleCount=0,this._pos=0,this._m2=0},e.prototype._wrapPosition=function(e){var t=this._samples.length;return(e%t+t)%t},e})();i.RollingAverage=t})($a||($a={})),de=$a||($a={}),fe=(function(){function u(){}return u.BindEyePosition=function(e,t){t._forcedViewPosition?e.setVector3("vEyePosition",t._forcedViewPosition):e.setVector3("vEyePosition",t._mirroredCameraPosition?t._mirroredCameraPosition:t.activeCamera.globalPosition)},u.PrepareDefinesForMergedUV=function(e,t,i){t._needUVs=!0,t[i]=!0,e.getTextureMatrix().isIdentity(!0)?(t[i+"DIRECTUV"]=e.coordinatesIndex+1,0===e.coordinatesIndex?t.MAINUV1=!0:t.MAINUV2=!0):t[i+"DIRECTUV"]=0},u.BindTextureMatrix=function(e,t,i){var r=e.getTextureMatrix();r.isIdentity(!0)||t.updateMatrix(i+"Matrix",r)},u.PrepareDefinesForMisc=function(e,t,i,r,n,o,s){s._areMiscDirty&&(s.LOGARITHMICDEPTH=i,s.POINTSIZE=r,s.FOG=t.fogEnabled&&e.applyFog&&t.fogMode!==de.Scene.FOGMODE_NONE&&n,s.NONUNIFORMSCALING=e.nonUniformScaling,s.ALPHATEST=o)},u.PrepareDefinesForFrameBoundValues=function(e,t,i,r,n){void 0===n&&(n=null);var o,s,a,l,c=!1;o=null==n?void 0!==e.clipPlane&&null!==e.clipPlane:n,s=null==n?void 0!==e.clipPlane2&&null!==e.clipPlane2:n,a=null==n?void 0!==e.clipPlane3&&null!==e.clipPlane3:n,l=null==n?void 0!==e.clipPlane4&&null!==e.clipPlane4:n,i.CLIPPLANE!==o&&(i.CLIPPLANE=o,c=!0),i.CLIPPLANE2!==s&&(i.CLIPPLANE2=s,c=!0),i.CLIPPLANE3!==a&&(i.CLIPPLANE3=a,c=!0),i.CLIPPLANE4!==l&&(i.CLIPPLANE4=l,c=!0),i.DEPTHPREPASS!==!t.getColorWrite()&&(i.DEPTHPREPASS=!i.DEPTHPREPASS,c=!0),i.INSTANCES!==r&&(i.INSTANCES=r,c=!0),c&&i.markAsUnprocessed()},u.PrepareDefinesForAttributes=function(e,t,i,r,n,o){if(void 0===n&&(n=!1),void 0===o&&(o=!0),!t._areAttributesDirty&&t._needNormals===t._normals&&t._needUVs===t._uvs)return!1;if(t._normals=t._needNormals,t._uvs=t._needUVs,t.NORMAL=t._needNormals&&e.isVerticesDataPresent(de.VertexBuffer.NormalKind),t._needNormals&&e.isVerticesDataPresent(de.VertexBuffer.TangentKind)&&(t.TANGENT=!0),t._needUVs?(t.UV1=e.isVerticesDataPresent(de.VertexBuffer.UVKind),t.UV2=e.isVerticesDataPresent(de.VertexBuffer.UV2Kind)):(t.UV1=!1,t.UV2=!1),i){var s=e.useVertexColors&&e.isVerticesDataPresent(de.VertexBuffer.ColorKind);t.VERTEXCOLOR=s,t.VERTEXALPHA=e.hasVertexAlpha&&s&&o}if(r&&(e.useBones&&e.computeBonesUsingShaders&&e.skeleton?(t.NUM_BONE_INFLUENCERS=e.numBoneInfluencers,t.BonesPerMesh=e.skeleton.bones.length+1):(t.NUM_BONE_INFLUENCERS=0,t.BonesPerMesh=0)),n){var a=e.morphTargetManager;a?(t.MORPHTARGETS_TANGENT=a.supportsTangents&&t.TANGENT,t.MORPHTARGETS_NORMAL=a.supportsNormals&&t.NORMAL,t.MORPHTARGETS=0<a.numInfluencers,t.NUM_MORPH_INFLUENCERS=a.numInfluencers):(t.MORPHTARGETS_TANGENT=!1,t.MORPHTARGETS_NORMAL=!1,t.MORPHTARGETS=!1,t.NUM_MORPH_INFLUENCERS=0)}return!0},u.PrepareDefinesForLights=function(e,t,i,r,n,o){if(void 0===n&&(n=4),void 0===o&&(o=!1),!i._areLightsDirty)return i._needNormals;var s=0,a=!1,l=!1,c=!1,h=!1,u=!1;if(e.lightsEnabled&&!o)for(var d=0,f=t._lightSources;d<f.length;d++){var p=f[d];switch(a=!0,void 0===i["LIGHT"+s]&&(l=!0),i["LIGHT"+s]=!0,i["SPOTLIGHT"+s]=!1,i["HEMILIGHT"+s]=!1,i["POINTLIGHT"+s]=!1,i["DIRLIGHT"+s]=!1,p.prepareLightSpecificDefines(i,s),i["LIGHT_FALLOFF_PHYSICAL"+s]=!1,i["LIGHT_FALLOFF_GLTF"+s]=!1,i["LIGHT_FALLOFF_STANDARD"+s]=!1,p.falloffType){case de.Light.FALLOFF_GLTF:i["LIGHT_FALLOFF_GLTF"+s]=!0;break;case de.Light.FALLOFF_PHYSICAL:i["LIGHT_FALLOFF_PHYSICAL"+s]=!0;break;case de.Light.FALLOFF_STANDARD:i["LIGHT_FALLOFF_STANDARD"+s]=!0}if(r&&!p.specular.equalsFloats(0,0,0)&&(u=!0),i["SHADOW"+s]=!1,i["SHADOWPCF"+s]=!1,i["SHADOWPCSS"+s]=!1,i["SHADOWPOISSON"+s]=!1,i["SHADOWESM"+s]=!1,i["SHADOWCUBE"+s]=!1,i["SHADOWLOWQUALITY"+s]=!1,i["SHADOWMEDIUMQUALITY"+s]=!1,t&&t.receiveShadows&&e.shadowsEnabled&&p.shadowEnabled){var _=p.getShadowGenerator();if(_){var m=_.getShadowMap();m&&m.renderList&&0<m.renderList.length&&(h=!0,_.prepareDefines(i,s))}}if(p.lightmapMode!=de.Light.LIGHTMAP_DEFAULT?(c=!0,i["LIGHTMAPEXCLUDED"+s]=!0,i["LIGHTMAPNOSPECULAR"+s]=p.lightmapMode==de.Light.LIGHTMAP_SHADOWSONLY):(i["LIGHTMAPEXCLUDED"+s]=!1,i["LIGHTMAPNOSPECULAR"+s]=!1),++s===n)break}i.SPECULARTERM=u,i.SHADOWS=h;for(var g=s;g<n;g++)void 0!==i["LIGHT"+g]&&(i["LIGHT"+g]=!1,i["HEMILIGHT"+s]=!1,i["POINTLIGHT"+s]=!1,i["DIRLIGHT"+s]=!1,i["SPOTLIGHT"+s]=!1,i["SHADOW"+s]=!1);var v=e.getEngine().getCaps();return void 0===i.SHADOWFLOAT&&(l=!0),i.SHADOWFLOAT=h&&(v.textureFloatRender&&v.textureFloatLinearFiltering||v.textureHalfFloatRender&&v.textureHalfFloatLinearFiltering),i.LIGHTMAPEXCLUDED=c,l&&i.rebuild(),a},u.PrepareUniformsAndSamplersList=function(e,t,i,r){var n;void 0===r&&(r=4);var o=null;if(e.uniformsNames){var s=e;n=s.uniformsNames,o=s.uniformBuffersNames,t=s.samplers,i=s.defines,r=s.maxSimultaneousLights}else n=e,t||(t=[]);for(var a=0;a<r&&i["LIGHT"+a];a++)n.push("vLightData"+a,"vLightDiffuse"+a,"vLightSpecular"+a,"vLightDirection"+a,"vLightFalloff"+a,"vLightGround"+a,"lightMatrix"+a,"shadowsInfo"+a,"depthValues"+a),o&&o.push("Light"+a),t.push("shadowSampler"+a),t.push("depthSampler"+a),i["PROJECTEDLIGHTTEXTURE"+a]&&(t.push("projectionLightSampler"+a),n.push("textureProjectionMatrix"+a));i.NUM_MORPH_INFLUENCERS&&n.push("morphTargetInfluences")},u.HandleFallbacksForShadows=function(e,t,i,r){void 0===i&&(i=4),void 0===r&&(r=0);for(var n=0,o=0;o<i&&e["LIGHT"+o];o++)0<o&&(n=r+o,t.addFallback(n,"LIGHT"+o)),e.SHADOWS||(e["SHADOW"+o]&&t.addFallback(r,"SHADOW"+o),e["SHADOWPCF"+o]&&t.addFallback(r,"SHADOWPCF"+o),e["SHADOWPCSS"+o]&&t.addFallback(r,"SHADOWPCSS"+o),e["SHADOWPOISSON"+o]&&t.addFallback(r,"SHADOWPOISSON"+o),e["SHADOWESM"+o]&&t.addFallback(r,"SHADOWESM"+o));return n++},u.PrepareAttributesForMorphTargets=function(e,t,i){var r=i.NUM_MORPH_INFLUENCERS;if(0<r&&de.Engine.LastCreatedEngine)for(var n=de.Engine.LastCreatedEngine.getCaps().maxVertexAttribs,o=t.morphTargetManager,s=o&&o.supportsNormals&&i.NORMAL,a=o&&o.supportsTangents&&i.TANGENT,l=0;l<r;l++)e.push(de.VertexBuffer.PositionKind+l),s&&e.push(de.VertexBuffer.NormalKind+l),a&&e.push(de.VertexBuffer.TangentKind+l),e.length>n&&de.Tools.Error("Cannot add more vertex attributes for mesh "+t.name)},u.PrepareAttributesForBones=function(e,t,i,r){0<i.NUM_BONE_INFLUENCERS&&(r.addCPUSkinningFallback(0,t),e.push(de.VertexBuffer.MatricesIndicesKind),e.push(de.VertexBuffer.MatricesWeightsKind),4<i.NUM_BONE_INFLUENCERS&&(e.push(de.VertexBuffer.MatricesIndicesExtraKind),e.push(de.VertexBuffer.MatricesWeightsExtraKind)))},u.PrepareAttributesForInstances=function(e,t){t.INSTANCES&&(e.push("world0"),e.push("world1"),e.push("world2"),e.push("world3"))},u.BindLightShadow=function(e,t,i,r,n){if(e.shadowEnabled&&i.receiveShadows){var o=e.getShadowGenerator();o&&o.bindShadowLight(r,n)}},u.BindLightProperties=function(e,t,i){e.transferToEffect(t,i+"")},u.BindLights=function(e,t,i,r,n,o){void 0===n&&(n=4),void 0===o&&(o=!1);for(var s=Math.min(t._lightSources.length,n),a=0;a<s;a++){var l=t._lightSources[a],c=a.toString(),h=l.getScaledIntensity();l._uniformBuffer.bindToEffect(i,"Light"+a),u.BindLightProperties(l,i,a),l.diffuse.scaleToRef(h,de.Tmp.Color3[0]),l._uniformBuffer.updateColor4("vLightDiffuse",de.Tmp.Color3[0],o?l.radius:l.range,c),r.SPECULARTERM&&(l.specular.scaleToRef(h,de.Tmp.Color3[1]),l._uniformBuffer.updateColor3("vLightSpecular",de.Tmp.Color3[1],c)),e.shadowsEnabled&&this.BindLightShadow(l,e,t,c,i),l._uniformBuffer.update()}},u.BindFogParameters=function(e,t,i,r){void 0===r&&(r=!1),e.fogEnabled&&t.applyFog&&e.fogMode!==de.Scene.FOGMODE_NONE&&(i.setFloat4("vFogInfos",e.fogMode,e.fogStart,e.fogEnd,e.fogDensity),r?(e.fogColor.toLinearSpaceToRef(this._tempFogColor),i.setColor3("vFogColor",this._tempFogColor)):i.setColor3("vFogColor",e.fogColor))},u.BindBonesParameters=function(e,t){if(t&&e&&(e.computeBonesUsingShaders&&t._bonesComputationForcedToCPU&&(e.computeBonesUsingShaders=!1),e.useBones&&e.computeBonesUsingShaders&&e.skeleton)){var i=e.skeleton.getTransformMatrices(e);i&&t.setMatrices("mBones",i)}},u.BindMorphTargetParameters=function(e,t){var i=e.morphTargetManager;e&&i&&t.setFloatArray("morphTargetInfluences",i.influences)},u.BindLogDepth=function(e,t,i){e.LOGARITHMICDEPTH&&t.setFloat("logarithmicDepthConstant",2/(Math.log(i.activeCamera.maxZ+1)/Math.LN2))},u.BindClipPlane=function(e,t){if(t.clipPlane){var i=t.clipPlane;e.setFloat4("vClipPlane",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane2){i=t.clipPlane2;e.setFloat4("vClipPlane2",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane3){i=t.clipPlane3;e.setFloat4("vClipPlane3",i.normal.x,i.normal.y,i.normal.z,i.d)}if(t.clipPlane4){i=t.clipPlane4;e.setFloat4("vClipPlane4",i.normal.x,i.normal.y,i.normal.z,i.d)}},u._tempFogColor=de.Color3.Black(),u})(),de.MaterialHelper=fe,pe=$a||($a={}),_e=(function(r){function e(e,t){var i=r.call(this,e,t)||this;return i._normalMatrix=new pe.Matrix,i.storeEffectOnSubMeshes=!0,i}return T(e,r),e.prototype.getEffect=function(){return this._activeEffect},e.prototype.isReady=function(e,t){return!!e&&(!e.subMeshes||0===e.subMeshes.length||this.isReadyForSubMesh(e,e.subMeshes[0],t))},e.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},e.prototype.bindOnlyNormalMatrix=function(e){this._activeEffect.setMatrix("normalMatrix",e)},e.prototype.bind=function(e,t){t&&this.bindForSubMesh(e,t,t.subMeshes[0])},e.prototype._afterBind=function(e,t){void 0===t&&(t=null),r.prototype._afterBind.call(this,e),this.getScene()._cachedEffect=t},e.prototype._mustRebind=function(e,t,i){return void 0===i&&(i=1),e.isCachedMaterialInvalid(this,t,i)},e})(pe.Material),pe.PushMaterial=_e,(function(p){var _=(function(t){function e(){var e=t.call(this)||this;return e.MAINUV1=!1,e.MAINUV2=!1,e.DIFFUSE=!1,e.DIFFUSEDIRECTUV=0,e.AMBIENT=!1,e.AMBIENTDIRECTUV=0,e.OPACITY=!1,e.OPACITYDIRECTUV=0,e.OPACITYRGB=!1,e.REFLECTION=!1,e.EMISSIVE=!1,e.EMISSIVEDIRECTUV=0,e.SPECULAR=!1,e.SPECULARDIRECTUV=0,e.BUMP=!1,e.BUMPDIRECTUV=0,e.PARALLAX=!1,e.PARALLAXOCCLUSION=!1,e.SPECULAROVERALPHA=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.ALPHAFROMDIFFUSE=!1,e.POINTSIZE=!1,e.FOG=!1,e.SPECULARTERM=!1,e.DIFFUSEFRESNEL=!1,e.OPACITYFRESNEL=!1,e.REFLECTIONFRESNEL=!1,e.REFRACTIONFRESNEL=!1,e.EMISSIVEFRESNEL=!1,e.FRESNEL=!1,e.NORMAL=!1,e.UV1=!1,e.UV2=!1,e.VERTEXCOLOR=!1,e.VERTEXALPHA=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.GLOSSINESS=!1,e.ROUGHNESS=!1,e.EMISSIVEASILLUMINATION=!1,e.LINKEMISSIVEWITHDIFFUSE=!1,e.REFLECTIONFRESNELFROMSPECULAR=!1,e.LIGHTMAP=!1,e.LIGHTMAPDIRECTUV=0,e.OBJECTSPACE_NORMALMAP=!1,e.USELIGHTMAPASSHADOWMAP=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.LOGARITHMICDEPTH=!1,e.REFRACTION=!1,e.REFRACTIONMAP_3D=!1,e.REFLECTIONOVERALPHA=!1,e.TWOSIDEDLIGHTING=!1,e.SHADOWFLOAT=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.NUM_MORPH_INFLUENCERS=0,e.NONUNIFORMSCALING=!1,e.PREMULTIPLYALPHA=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.IS_REFLECTION_LINEAR=!1,e.IS_REFRACTION_LINEAR=!1,e.EXPOSURE=!1,e.rebuild(),e}return T(e,t),e.prototype.setReflectionMode=function(e){for(var t=0,i=["REFLECTIONMAP_CUBIC","REFLECTIONMAP_EXPLICIT","REFLECTIONMAP_PLANAR","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_PROJECTION","REFLECTIONMAP_SKYBOX","REFLECTIONMAP_SPHERICAL","REFLECTIONMAP_EQUIRECTANGULAR","REFLECTIONMAP_EQUIRECTANGULAR_FIXED","REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED"];t<i.length;t++){var r=i[t];this[r]=r===e}},e})(p.MaterialDefines);p.StandardMaterialDefines=_;var e=(function(r){function f(e,t){var i=r.call(this,e,t)||this;return i.ambientColor=new p.Color3(0,0,0),i.diffuseColor=new p.Color3(1,1,1),i.specularColor=new p.Color3(1,1,1),i.emissiveColor=new p.Color3(0,0,0),i.specularPower=64,i._useAlphaFromDiffuseTexture=!1,i._useEmissiveAsIllumination=!1,i._linkEmissiveWithDiffuse=!1,i._useSpecularOverAlpha=!1,i._useReflectionOverAlpha=!1,i._disableLighting=!1,i._useObjectSpaceNormalMap=!1,i._useParallax=!1,i._useParallaxOcclusion=!1,i.parallaxScaleBias=.05,i._roughness=0,i.indexOfRefraction=.98,i.invertRefractionY=!0,i.alphaCutOff=.4,i._useLightmapAsShadowmap=!1,i._useReflectionFresnelFromSpecular=!1,i._useGlossinessFromSpecularMapAlpha=!1,i._maxSimultaneousLights=4,i._invertNormalMapX=!1,i._invertNormalMapY=!1,i._twoSidedLighting=!1,i._renderTargets=new p.SmartArray(16),i._worldViewProjectionMatrix=p.Matrix.Zero(),i._globalAmbientColor=new p.Color3(0,0,0),i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),f.ReflectionTextureEnabled&&i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),f.RefractionTextureEnabled&&i._refractionTexture&&i._refractionTexture.isRenderTarget&&i._renderTargets.push(i._refractionTexture),i._renderTargets},i}return T(f,r),Object.defineProperty(f.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!0,configurable:!0}),f.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(e){t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(f.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),Object.defineProperty(f.prototype,"hasRenderTargetTextures",{get:function(){return!!(f.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||!!(f.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},enumerable:!0,configurable:!0}),f.prototype.getClassName=function(){return"StandardMaterial"},Object.defineProperty(f.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported,this._markAllSubMeshesAsMiscDirty()},enumerable:!0,configurable:!0}),f.prototype.needAlphaBlending=function(){return this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromDiffuseTexture()||this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled},f.prototype.needAlphaTesting=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha},f.prototype._shouldUseAlphaFromDiffuseTexture=function(){return null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha&&this._useAlphaFromDiffuseTexture},f.prototype.getAlphaTestTexture=function(){return this._diffuseTexture},f.prototype.isReadyForSubMesh=function(e,t,i){if(void 0===i&&(i=!1),t.effect&&this.isFrozen&&this._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new _);var r=this.getScene(),n=t._materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&n._renderId===r.getRenderId())return!0;var o=r.getEngine();if(n._needNormals=p.MaterialHelper.PrepareDefinesForLights(r,e,n,!0,this._maxSimultaneousLights,this._disableLighting),n._areTexturesDirty){if(n._needUVs=!1,n.MAINUV1=!1,n.MAINUV2=!1,r.texturesEnabled){if(this._diffuseTexture&&f.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._diffuseTexture,n,"DIFFUSE")}else n.DIFFUSE=!1;if(this._ambientTexture&&f.AmbientTextureEnabled){if(!this._ambientTexture.isReadyOrNotBlocking())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture,n,"AMBIENT")}else n.AMBIENT=!1;if(this._opacityTexture&&f.OpacityTextureEnabled){if(!this._opacityTexture.isReadyOrNotBlocking())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture,n,"OPACITY"),n.OPACITYRGB=this._opacityTexture.getAlphaFromRGB}else n.OPACITY=!1;if(this._reflectionTexture&&f.ReflectionTextureEnabled){if(!this._reflectionTexture.isReadyOrNotBlocking())return!1;switch(n._needNormals=!0,n.REFLECTION=!0,n.ROUGHNESS=0<this._roughness,n.REFLECTIONOVERALPHA=this._useReflectionOverAlpha,n.INVERTCUBICMAP=this._reflectionTexture.coordinatesMode===p.Texture.INVCUBIC_MODE,n.REFLECTIONMAP_3D=this._reflectionTexture.isCube,this._reflectionTexture.coordinatesMode){case p.Texture.EXPLICIT_MODE:n.setReflectionMode("REFLECTIONMAP_EXPLICIT");break;case p.Texture.PLANAR_MODE:n.setReflectionMode("REFLECTIONMAP_PLANAR");break;case p.Texture.PROJECTION_MODE:n.setReflectionMode("REFLECTIONMAP_PROJECTION");break;case p.Texture.SKYBOX_MODE:n.setReflectionMode("REFLECTIONMAP_SKYBOX"),n.REFLECTIONMAP_SKYBOX_TRANSFORMED=!this._reflectionTexture.getReflectionTextureMatrix().isIdentity();break;case p.Texture.SPHERICAL_MODE:n.setReflectionMode("REFLECTIONMAP_SPHERICAL");break;case p.Texture.EQUIRECTANGULAR_MODE:n.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR");break;case p.Texture.FIXED_EQUIRECTANGULAR_MODE:n.setReflectionMode("REFLECTIONMAP_EQUIRECTANGULAR_FIXED");break;case p.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:n.setReflectionMode("REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED");break;case p.Texture.CUBIC_MODE:case p.Texture.INVCUBIC_MODE:default:n.setReflectionMode("REFLECTIONMAP_CUBIC")}n.USE_LOCAL_REFLECTIONMAP_CUBIC=!!this._reflectionTexture.boundingBoxSize}else n.REFLECTION=!1;if(this._emissiveTexture&&f.EmissiveTextureEnabled){if(!this._emissiveTexture.isReadyOrNotBlocking())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture,n,"EMISSIVE")}else n.EMISSIVE=!1;if(this._lightmapTexture&&f.LightmapTextureEnabled){if(!this._lightmapTexture.isReadyOrNotBlocking())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture,n,"LIGHTMAP"),n.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap}else n.LIGHTMAP=!1;if(this._specularTexture&&f.SpecularTextureEnabled){if(!this._specularTexture.isReadyOrNotBlocking())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._specularTexture,n,"SPECULAR"),n.GLOSSINESS=this._useGlossinessFromSpecularMapAlpha}else n.SPECULAR=!1;if(r.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&f.BumpTextureEnabled){if(!this._bumpTexture.isReady())return!1;p.MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture,n,"BUMP"),n.PARALLAX=this._useParallax,n.PARALLAXOCCLUSION=this._useParallaxOcclusion,n.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap}else n.BUMP=!1;if(this._refractionTexture&&f.RefractionTextureEnabled){if(!this._refractionTexture.isReadyOrNotBlocking())return!1;n._needUVs=!0,n.REFRACTION=!0,n.REFRACTIONMAP_3D=this._refractionTexture.isCube}else n.REFRACTION=!1;n.TWOSIDEDLIGHTING=!this._backFaceCulling&&this._twoSidedLighting}else n.DIFFUSE=!1,n.AMBIENT=!1,n.OPACITY=!1,n.REFLECTION=!1,n.EMISSIVE=!1,n.LIGHTMAP=!1,n.BUMP=!1,n.REFRACTION=!1;n.ALPHAFROMDIFFUSE=this._shouldUseAlphaFromDiffuseTexture(),n.EMISSIVEASILLUMINATION=this._useEmissiveAsIllumination,n.LINKEMISSIVEWITHDIFFUSE=this._linkEmissiveWithDiffuse,n.SPECULAROVERALPHA=this._useSpecularOverAlpha,n.PREMULTIPLYALPHA=this.alphaMode===p.Engine.ALPHA_PREMULTIPLIED||this.alphaMode===p.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF}if(n._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(n),n.IS_REFLECTION_LINEAR=null!=this.reflectionTexture&&!this.reflectionTexture.gammaSpace,n.IS_REFRACTION_LINEAR=null!=this.refractionTexture&&!this.refractionTexture.gammaSpace}if(n._areFresnelDirty&&(f.FresnelEnabled?(this._diffuseFresnelParameters||this._opacityFresnelParameters||this._emissiveFresnelParameters||this._refractionFresnelParameters||this._reflectionFresnelParameters)&&(n.DIFFUSEFRESNEL=this._diffuseFresnelParameters&&this._diffuseFresnelParameters.isEnabled,n.OPACITYFRESNEL=this._opacityFresnelParameters&&this._opacityFresnelParameters.isEnabled,n.REFLECTIONFRESNEL=this._reflectionFresnelParameters&&this._reflectionFresnelParameters.isEnabled,n.REFLECTIONFRESNELFROMSPECULAR=this._useReflectionFresnelFromSpecular,n.REFRACTIONFRESNEL=this._refractionFresnelParameters&&this._refractionFresnelParameters.isEnabled,n.EMISSIVEFRESNEL=this._emissiveFresnelParameters&&this._emissiveFresnelParameters.isEnabled,n._needNormals=!0,n.FRESNEL=!0):n.FRESNEL=!1),p.MaterialHelper.PrepareDefinesForMisc(e,r,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),n),p.MaterialHelper.PrepareDefinesForAttributes(e,n,!0,!0,!0),p.MaterialHelper.PrepareDefinesForFrameBoundValues(r,o,n,i),n.isDirty){n.markAsProcessed(),r.resetCachedMaterial();var s=new p.EffectFallbacks;n.REFLECTION&&s.addFallback(0,"REFLECTION"),n.SPECULAR&&s.addFallback(0,"SPECULAR"),n.BUMP&&s.addFallback(0,"BUMP"),n.PARALLAX&&s.addFallback(1,"PARALLAX"),n.PARALLAXOCCLUSION&&s.addFallback(0,"PARALLAXOCCLUSION"),n.SPECULAROVERALPHA&&s.addFallback(0,"SPECULAROVERALPHA"),n.FOG&&s.addFallback(1,"FOG"),n.POINTSIZE&&s.addFallback(0,"POINTSIZE"),n.LOGARITHMICDEPTH&&s.addFallback(0,"LOGARITHMICDEPTH"),p.MaterialHelper.HandleFallbacksForShadows(n,s,this._maxSimultaneousLights),n.SPECULARTERM&&s.addFallback(0,"SPECULARTERM"),n.DIFFUSEFRESNEL&&s.addFallback(1,"DIFFUSEFRESNEL"),n.OPACITYFRESNEL&&s.addFallback(2,"OPACITYFRESNEL"),n.REFLECTIONFRESNEL&&s.addFallback(3,"REFLECTIONFRESNEL"),n.EMISSIVEFRESNEL&&s.addFallback(4,"EMISSIVEFRESNEL"),n.FRESNEL&&s.addFallback(4,"FRESNEL");var a=[p.VertexBuffer.PositionKind];n.NORMAL&&a.push(p.VertexBuffer.NormalKind),n.UV1&&a.push(p.VertexBuffer.UVKind),n.UV2&&a.push(p.VertexBuffer.UV2Kind),n.VERTEXCOLOR&&a.push(p.VertexBuffer.ColorKind),p.MaterialHelper.PrepareAttributesForBones(a,e,n,s),p.MaterialHelper.PrepareAttributesForInstances(a,n),p.MaterialHelper.PrepareAttributesForMorphTargets(a,e,n);var l="default",c=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vDiffuseColor","vSpecularColor","vEmissiveColor","vFogInfos","vFogColor","pointSize","vDiffuseInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vEmissiveInfos","vSpecularInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","diffuseMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","specularMatrix","bumpMatrix","normalMatrix","lightmapMatrix","refractionMatrix","diffuseLeftColor","diffuseRightColor","opacityParts","reflectionLeftColor","reflectionRightColor","emissiveLeftColor","emissiveRightColor","refractionLeftColor","refractionRightColor","vReflectionPosition","vReflectionSize","logarithmicDepthConstant","vTangentSpaceParams","alphaCutOff"],h=["diffuseSampler","ambientSampler","opacitySampler","reflectionCubeSampler","reflection2DSampler","emissiveSampler","specularSampler","bumpSampler","lightmapSampler","refractionCubeSampler","refraction2DSampler"],u=["Material","Scene"];p.ImageProcessingConfiguration&&(p.ImageProcessingConfiguration.PrepareUniforms(c,n),p.ImageProcessingConfiguration.PrepareSamplers(h,n)),p.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:c,uniformBuffersNames:u,samplers:h,defines:n,maxSimultaneousLights:this._maxSimultaneousLights}),this.customShaderNameResolve&&(l=this.customShaderNameResolve(l,c,u,h,n));var d=n.toString();t.setEffect(r.getEngine().createEffect(l,{attributes:a,uniformsNames:c,uniformBuffersNames:u,samplers:h,defines:d,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:n.NUM_MORPH_INFLUENCERS}},o),n),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady())&&(n._renderId=r.getRenderId(),this._wasPreviouslyReady=!0)},f.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("diffuseLeftColor",4),this._uniformBuffer.addUniform("diffuseRightColor",4),this._uniformBuffer.addUniform("opacityParts",4),this._uniformBuffer.addUniform("reflectionLeftColor",4),this._uniformBuffer.addUniform("reflectionRightColor",4),this._uniformBuffer.addUniform("refractionLeftColor",4),this._uniformBuffer.addUniform("refractionRightColor",4),this._uniformBuffer.addUniform("emissiveLeftColor",4),this._uniformBuffer.addUniform("emissiveRightColor",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vAmbientInfos",2),this._uniformBuffer.addUniform("vOpacityInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("vReflectionPosition",3),this._uniformBuffer.addUniform("vReflectionSize",3),this._uniformBuffer.addUniform("vEmissiveInfos",2),this._uniformBuffer.addUniform("vLightmapInfos",2),this._uniformBuffer.addUniform("vSpecularInfos",2),this._uniformBuffer.addUniform("vBumpInfos",3),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("ambientMatrix",16),this._uniformBuffer.addUniform("opacityMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("emissiveMatrix",16),this._uniformBuffer.addUniform("lightmapMatrix",16),this._uniformBuffer.addUniform("specularMatrix",16),this._uniformBuffer.addUniform("bumpMatrix",16),this._uniformBuffer.addUniform("vTangentSpaceParams",2),this._uniformBuffer.addUniform("refractionMatrix",16),this._uniformBuffer.addUniform("vRefractionInfos",4),this._uniformBuffer.addUniform("vSpecularColor",4),this._uniformBuffer.addUniform("vEmissiveColor",3),this._uniformBuffer.addUniform("vDiffuseColor",4),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.create()},f.prototype.unbind=function(){if(this._activeEffect){var e=!1;this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&(this._activeEffect.setTexture("reflection2DSampler",null),e=!0),this._refractionTexture&&this._refractionTexture.isRenderTarget&&(this._activeEffect.setTexture("refraction2DSampler",null),e=!0),e&&this._markAllSubMeshesAsTexturesDirty()}r.prototype.unbind.call(this)},f.prototype.bindForSubMesh=function(e,t,i){var r=this.getScene(),n=i._materialDefines;if(n){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),n.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var s=this._mustRebind(r,o,t.visibility);if(p.MaterialHelper.BindBonesParameters(t,o),s){if(this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o),!this._uniformBuffer.useUbo||!this.isFrozen||!this._uniformBuffer.isSync){if(f.FresnelEnabled&&n.FRESNEL&&(this.diffuseFresnelParameters&&this.diffuseFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("diffuseLeftColor",this.diffuseFresnelParameters.leftColor,this.diffuseFresnelParameters.power),this._uniformBuffer.updateColor4("diffuseRightColor",this.diffuseFresnelParameters.rightColor,this.diffuseFresnelParameters.bias)),this.opacityFresnelParameters&&this.opacityFresnelParameters.isEnabled&&this._uniformBuffer.updateColor4("opacityParts",new p.Color3(this.opacityFresnelParameters.leftColor.toLuminance(),this.opacityFresnelParameters.rightColor.toLuminance(),this.opacityFresnelParameters.bias),this.opacityFresnelParameters.power),this.reflectionFresnelParameters&&this.reflectionFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("reflectionLeftColor",this.reflectionFresnelParameters.leftColor,this.reflectionFresnelParameters.power),this._uniformBuffer.updateColor4("reflectionRightColor",this.reflectionFresnelParameters.rightColor,this.reflectionFresnelParameters.bias)),this.refractionFresnelParameters&&this.refractionFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("refractionLeftColor",this.refractionFresnelParameters.leftColor,this.refractionFresnelParameters.power),this._uniformBuffer.updateColor4("refractionRightColor",this.refractionFresnelParameters.rightColor,this.refractionFresnelParameters.bias)),this.emissiveFresnelParameters&&this.emissiveFresnelParameters.isEnabled&&(this._uniformBuffer.updateColor4("emissiveLeftColor",this.emissiveFresnelParameters.leftColor,this.emissiveFresnelParameters.power),this._uniformBuffer.updateColor4("emissiveRightColor",this.emissiveFresnelParameters.rightColor,this.emissiveFresnelParameters.bias))),r.texturesEnabled){if(this._diffuseTexture&&f.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),p.MaterialHelper.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse"),this._diffuseTexture.hasAlpha&&o.setFloat("alphaCutOff",this.alphaCutOff)),this._ambientTexture&&f.AmbientTextureEnabled&&(this._uniformBuffer.updateFloat2("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level),p.MaterialHelper.BindTextureMatrix(this._ambientTexture,this._uniformBuffer,"ambient")),this._opacityTexture&&f.OpacityTextureEnabled&&(this._uniformBuffer.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),p.MaterialHelper.BindTextureMatrix(this._opacityTexture,this._uniformBuffer,"opacity")),this._reflectionTexture&&f.ReflectionTextureEnabled&&(this._uniformBuffer.updateFloat2("vReflectionInfos",this._reflectionTexture.level,this.roughness),this._uniformBuffer.updateMatrix("reflectionMatrix",this._reflectionTexture.getReflectionTextureMatrix()),this._reflectionTexture.boundingBoxSize)){var a=this._reflectionTexture;this._uniformBuffer.updateVector3("vReflectionPosition",a.boundingBoxPosition),this._uniformBuffer.updateVector3("vReflectionSize",a.boundingBoxSize)}if(this._emissiveTexture&&f.EmissiveTextureEnabled&&(this._uniformBuffer.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),p.MaterialHelper.BindTextureMatrix(this._emissiveTexture,this._uniformBuffer,"emissive")),this._lightmapTexture&&f.LightmapTextureEnabled&&(this._uniformBuffer.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),p.MaterialHelper.BindTextureMatrix(this._lightmapTexture,this._uniformBuffer,"lightmap")),this._specularTexture&&f.SpecularTextureEnabled&&(this._uniformBuffer.updateFloat2("vSpecularInfos",this._specularTexture.coordinatesIndex,this._specularTexture.level),p.MaterialHelper.BindTextureMatrix(this._specularTexture,this._uniformBuffer,"specular")),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&f.BumpTextureEnabled&&(this._uniformBuffer.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,1/this._bumpTexture.level,this.parallaxScaleBias),p.MaterialHelper.BindTextureMatrix(this._bumpTexture,this._uniformBuffer,"bump"),r._mirroredCameraPosition?this._uniformBuffer.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):this._uniformBuffer.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),this._refractionTexture&&f.RefractionTextureEnabled){var l=1;this._refractionTexture.isCube||(this._uniformBuffer.updateMatrix("refractionMatrix",this._refractionTexture.getReflectionTextureMatrix()),this._refractionTexture.depth&&(l=this._refractionTexture.depth)),this._uniformBuffer.updateFloat4("vRefractionInfos",this._refractionTexture.level,this.indexOfRefraction,l,this.invertRefractionY?-1:1)}}this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),n.SPECULARTERM&&this._uniformBuffer.updateColor4("vSpecularColor",this.specularColor,this.specularPower),this._uniformBuffer.updateColor3("vEmissiveColor",this.emissiveColor),this._uniformBuffer.updateColor4("vDiffuseColor",this.diffuseColor,this.alpha*t.visibility)}if(r.texturesEnabled&&(this._diffuseTexture&&f.DiffuseTextureEnabled&&o.setTexture("diffuseSampler",this._diffuseTexture),this._ambientTexture&&f.AmbientTextureEnabled&&o.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&f.OpacityTextureEnabled&&o.setTexture("opacitySampler",this._opacityTexture),this._reflectionTexture&&f.ReflectionTextureEnabled&&(this._reflectionTexture.isCube?o.setTexture("reflectionCubeSampler",this._reflectionTexture):o.setTexture("reflection2DSampler",this._reflectionTexture)),this._emissiveTexture&&f.EmissiveTextureEnabled&&o.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&f.LightmapTextureEnabled&&o.setTexture("lightmapSampler",this._lightmapTexture),this._specularTexture&&f.SpecularTextureEnabled&&o.setTexture("specularSampler",this._specularTexture),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&f.BumpTextureEnabled&&o.setTexture("bumpSampler",this._bumpTexture),this._refractionTexture&&f.RefractionTextureEnabled)){l=1;this._refractionTexture.isCube?o.setTexture("refractionCubeSampler",this._refractionTexture):o.setTexture("refraction2DSampler",this._refractionTexture)}p.MaterialHelper.BindClipPlane(o,r),r.ambientColor.multiplyToRef(this.ambientColor,this._globalAmbientColor),p.MaterialHelper.BindEyePosition(o,r),o.setColor3("vAmbientColor",this._globalAmbientColor)}!s&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&p.MaterialHelper.BindLights(r,t,o,n,this._maxSimultaneousLights),(r.fogEnabled&&t.applyFog&&r.fogMode!==p.Scene.FOGMODE_NONE||this._reflectionTexture||this._refractionTexture)&&this.bindView(o),p.MaterialHelper.BindFogParameters(r,t,o),n.NUM_MORPH_INFLUENCERS&&p.MaterialHelper.BindMorphTargetParameters(t,o),p.MaterialHelper.BindLogDepth(n,o,r),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect)}}},f.prototype.getAnimatables=function(){var e=[];return this._diffuseTexture&&this._diffuseTexture.animations&&0<this._diffuseTexture.animations.length&&e.push(this._diffuseTexture),this._ambientTexture&&this._ambientTexture.animations&&0<this._ambientTexture.animations.length&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&0<this._reflectionTexture.animations.length&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&0<this._emissiveTexture.animations.length&&e.push(this._emissiveTexture),this._specularTexture&&this._specularTexture.animations&&0<this._specularTexture.animations.length&&e.push(this._specularTexture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&0<this._lightmapTexture.animations.length&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&0<this._refractionTexture.animations.length&&e.push(this._refractionTexture),e},f.prototype.getActiveTextures=function(){var e=r.prototype.getActiveTextures.call(this);return this._diffuseTexture&&e.push(this._diffuseTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._specularTexture&&e.push(this._specularTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e},f.prototype.hasTexture=function(e){return!!r.prototype.hasTexture.call(this,e)||(this._diffuseTexture===e||(this._ambientTexture===e||(this._opacityTexture===e||(this._reflectionTexture===e||(this._emissiveTexture===e||(this._specularTexture===e||(this._bumpTexture===e||(this._lightmapTexture===e||this._refractionTexture===e))))))))},f.prototype.dispose=function(e,t){t&&(this._diffuseTexture&&this._diffuseTexture.dispose(),this._ambientTexture&&this._ambientTexture.dispose(),this._opacityTexture&&this._opacityTexture.dispose(),this._reflectionTexture&&this._reflectionTexture.dispose(),this._emissiveTexture&&this._emissiveTexture.dispose(),this._specularTexture&&this._specularTexture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._lightmapTexture&&this._lightmapTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose()),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),r.prototype.dispose.call(this,e,t)},f.prototype.clone=function(e){var t=this,i=p.SerializationHelper.Clone((function(){return new f(e,t.getScene())}),this);return i.name=e,i.id=e,i},f.prototype.serialize=function(){return p.SerializationHelper.Serialize(this)},f.Parse=function(e,t,i){return p.SerializationHelper.Parse((function(){return new f(e.name,t)}),e,t,i)},Object.defineProperty(f,"DiffuseTextureEnabled",{get:function(){return f._DiffuseTextureEnabled},set:function(e){f._DiffuseTextureEnabled!==e&&(f._DiffuseTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"AmbientTextureEnabled",{get:function(){return f._AmbientTextureEnabled},set:function(e){f._AmbientTextureEnabled!==e&&(f._AmbientTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"OpacityTextureEnabled",{get:function(){return f._OpacityTextureEnabled},set:function(e){f._OpacityTextureEnabled!==e&&(f._OpacityTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"ReflectionTextureEnabled",{get:function(){return f._ReflectionTextureEnabled},set:function(e){f._ReflectionTextureEnabled!==e&&(f._ReflectionTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"EmissiveTextureEnabled",{get:function(){return f._EmissiveTextureEnabled},set:function(e){f._EmissiveTextureEnabled!==e&&(f._EmissiveTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"SpecularTextureEnabled",{get:function(){return f._SpecularTextureEnabled},set:function(e){f._SpecularTextureEnabled!==e&&(f._SpecularTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"BumpTextureEnabled",{get:function(){return f._BumpTextureEnabled},set:function(e){f._BumpTextureEnabled!==e&&(f._BumpTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"LightmapTextureEnabled",{get:function(){return f._LightmapTextureEnabled},set:function(e){f._LightmapTextureEnabled!==e&&(f._LightmapTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"RefractionTextureEnabled",{get:function(){return f._RefractionTextureEnabled},set:function(e){f._RefractionTextureEnabled!==e&&(f._RefractionTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"ColorGradingTextureEnabled",{get:function(){return f._ColorGradingTextureEnabled},set:function(e){f._ColorGradingTextureEnabled!==e&&(f._ColorGradingTextureEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.TextureDirtyFlag))},enumerable:!0,configurable:!0}),Object.defineProperty(f,"FresnelEnabled",{get:function(){return f._FresnelEnabled},set:function(e){f._FresnelEnabled!==e&&(f._FresnelEnabled=e,p.Engine.MarkAllMaterialsAsDirty(p.Material.FresnelDirtyFlag))},enumerable:!0,configurable:!0}),f._DiffuseTextureEnabled=!0,f._AmbientTextureEnabled=!0,f._OpacityTextureEnabled=!0,f._ReflectionTextureEnabled=!0,f._EmissiveTextureEnabled=!0,f._SpecularTextureEnabled=!0,f._BumpTextureEnabled=!0,f._LightmapTextureEnabled=!0,f._RefractionTextureEnabled=!0,f._ColorGradingTextureEnabled=!0,f._FresnelEnabled=!0,b([p.serializeAsTexture("diffuseTexture")],f.prototype,"_diffuseTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],f.prototype,"diffuseTexture",void 0),b([p.serializeAsTexture("ambientTexture")],f.prototype,"_ambientTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"ambientTexture",void 0),b([p.serializeAsTexture("opacityTexture")],f.prototype,"_opacityTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],f.prototype,"opacityTexture",void 0),b([p.serializeAsTexture("reflectionTexture")],f.prototype,"_reflectionTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"reflectionTexture",void 0),b([p.serializeAsTexture("emissiveTexture")],f.prototype,"_emissiveTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"emissiveTexture",void 0),b([p.serializeAsTexture("specularTexture")],f.prototype,"_specularTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"specularTexture",void 0),b([p.serializeAsTexture("bumpTexture")],f.prototype,"_bumpTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"bumpTexture",void 0),b([p.serializeAsTexture("lightmapTexture")],f.prototype,"_lightmapTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"lightmapTexture",void 0),b([p.serializeAsTexture("refractionTexture")],f.prototype,"_refractionTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"refractionTexture",void 0),b([p.serializeAsColor3("ambient")],f.prototype,"ambientColor",void 0),b([p.serializeAsColor3("diffuse")],f.prototype,"diffuseColor",void 0),b([p.serializeAsColor3("specular")],f.prototype,"specularColor",void 0),b([p.serializeAsColor3("emissive")],f.prototype,"emissiveColor",void 0),b([p.serialize()],f.prototype,"specularPower",void 0),b([p.serialize("useAlphaFromDiffuseTexture")],f.prototype,"_useAlphaFromDiffuseTexture",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useAlphaFromDiffuseTexture",void 0),b([p.serialize("useEmissiveAsIllumination")],f.prototype,"_useEmissiveAsIllumination",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useEmissiveAsIllumination",void 0),b([p.serialize("linkEmissiveWithDiffuse")],f.prototype,"_linkEmissiveWithDiffuse",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"linkEmissiveWithDiffuse",void 0),b([p.serialize("useSpecularOverAlpha")],f.prototype,"_useSpecularOverAlpha",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useSpecularOverAlpha",void 0),b([p.serialize("useReflectionOverAlpha")],f.prototype,"_useReflectionOverAlpha",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useReflectionOverAlpha",void 0),b([p.serialize("disableLighting")],f.prototype,"_disableLighting",void 0),b([p.expandToProperty("_markAllSubMeshesAsLightsDirty")],f.prototype,"disableLighting",void 0),b([p.serialize("useObjectSpaceNormalMap")],f.prototype,"_useObjectSpaceNormalMap",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useObjectSpaceNormalMap",void 0),b([p.serialize("useParallax")],f.prototype,"_useParallax",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useParallax",void 0),b([p.serialize("useParallaxOcclusion")],f.prototype,"_useParallaxOcclusion",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useParallaxOcclusion",void 0),b([p.serialize()],f.prototype,"parallaxScaleBias",void 0),b([p.serialize("roughness")],f.prototype,"_roughness",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"roughness",void 0),b([p.serialize()],f.prototype,"indexOfRefraction",void 0),b([p.serialize()],f.prototype,"invertRefractionY",void 0),b([p.serialize()],f.prototype,"alphaCutOff",void 0),b([p.serialize("useLightmapAsShadowmap")],f.prototype,"_useLightmapAsShadowmap",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useLightmapAsShadowmap",void 0),b([p.serializeAsFresnelParameters("diffuseFresnelParameters")],f.prototype,"_diffuseFresnelParameters",void 0),b([p.expandToProperty("_markAllSubMeshesAsFresnelDirty")],f.prototype,"diffuseFresnelParameters",void 0),b([p.serializeAsFresnelParameters("opacityFresnelParameters")],f.prototype,"_opacityFresnelParameters",void 0),b([p.expandToProperty("_markAllSubMeshesAsFresnelAndMiscDirty")],f.prototype,"opacityFresnelParameters",void 0),b([p.serializeAsFresnelParameters("reflectionFresnelParameters")],f.prototype,"_reflectionFresnelParameters",void 0),b([p.expandToProperty("_markAllSubMeshesAsFresnelDirty")],f.prototype,"reflectionFresnelParameters",void 0),b([p.serializeAsFresnelParameters("refractionFresnelParameters")],f.prototype,"_refractionFresnelParameters",void 0),b([p.expandToProperty("_markAllSubMeshesAsFresnelDirty")],f.prototype,"refractionFresnelParameters",void 0),b([p.serializeAsFresnelParameters("emissiveFresnelParameters")],f.prototype,"_emissiveFresnelParameters",void 0),b([p.expandToProperty("_markAllSubMeshesAsFresnelDirty")],f.prototype,"emissiveFresnelParameters",void 0),b([p.serialize("useReflectionFresnelFromSpecular")],f.prototype,"_useReflectionFresnelFromSpecular",void 0),b([p.expandToProperty("_markAllSubMeshesAsFresnelDirty")],f.prototype,"useReflectionFresnelFromSpecular",void 0),b([p.serialize("useGlossinessFromSpecularMapAlpha")],f.prototype,"_useGlossinessFromSpecularMapAlpha",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"useGlossinessFromSpecularMapAlpha",void 0),b([p.serialize("maxSimultaneousLights")],f.prototype,"_maxSimultaneousLights",void 0),b([p.expandToProperty("_markAllSubMeshesAsLightsDirty")],f.prototype,"maxSimultaneousLights",void 0),b([p.serialize("invertNormalMapX")],f.prototype,"_invertNormalMapX",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"invertNormalMapX",void 0),b([p.serialize("invertNormalMapY")],f.prototype,"_invertNormalMapY",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"invertNormalMapY",void 0),b([p.serialize("twoSidedLighting")],f.prototype,"_twoSidedLighting",void 0),b([p.expandToProperty("_markAllSubMeshesAsTexturesDirty")],f.prototype,"twoSidedLighting",void 0),b([p.serialize()],f.prototype,"useLogarithmicDepth",null),f})(p.PushMaterial);p.StandardMaterial=e})($a||($a={})),(function(n){var e=(function(){function i(){this.x=n.Vector3.Zero(),this.y=n.Vector3.Zero(),this.z=n.Vector3.Zero(),this.xx=n.Vector3.Zero(),this.yy=n.Vector3.Zero(),this.zz=n.Vector3.Zero(),this.xy=n.Vector3.Zero(),this.yz=n.Vector3.Zero(),this.zx=n.Vector3.Zero()}return i.prototype.addAmbient=function(e){var t=new n.Vector3(e.r,e.g,e.b);this.xx=this.xx.add(t),this.yy=this.yy.add(t),this.zz=this.zz.add(t)},i.prototype.scale=function(e){this.x=this.x.scale(e),this.y=this.y.scale(e),this.z=this.z.scale(e),this.xx=this.xx.scale(e),this.yy=this.yy.scale(e),this.zz=this.zz.scale(e),this.yz=this.yz.scale(e),this.zx=this.zx.scale(e),this.xy=this.xy.scale(e)},i.FromHarmonics=function(e){var t=new i;return t.x=e.l11.scale(1.02333),t.y=e.l1_1.scale(1.02333),t.z=e.l10.scale(1.02333),t.xx=e.l00.scale(.886277).subtract(e.l20.scale(.247708)).add(e.lL22.scale(.429043)),t.yy=e.l00.scale(.886277).subtract(e.l20.scale(.247708)).subtract(e.lL22.scale(.429043)),t.zz=e.l00.scale(.886277).add(e.l20.scale(.495417)),t.yz=e.l2_1.scale(.858086),t.zx=e.l21.scale(.858086),t.xy=e.l2_2.scale(.858086),t.scale(1/Math.PI),t},i.FromArray=function(e){var t=new i;return n.Vector3.FromArrayToRef(e[0],0,t.x),n.Vector3.FromArrayToRef(e[1],0,t.y),n.Vector3.FromArrayToRef(e[2],0,t.z),n.Vector3.FromArrayToRef(e[3],0,t.xx),n.Vector3.FromArrayToRef(e[4],0,t.yy),n.Vector3.FromArrayToRef(e[5],0,t.zz),n.Vector3.FromArrayToRef(e[6],0,t.yz),n.Vector3.FromArrayToRef(e[7],0,t.zx),n.Vector3.FromArrayToRef(e[8],0,t.xy),t},i})();n.SphericalPolynomial=e;var t=(function(){function i(){this.l00=n.Vector3.Zero(),this.l1_1=n.Vector3.Zero(),this.l10=n.Vector3.Zero(),this.l11=n.Vector3.Zero(),this.l2_2=n.Vector3.Zero(),this.l2_1=n.Vector3.Zero(),this.l20=n.Vector3.Zero(),this.l21=n.Vector3.Zero(),this.lL22=n.Vector3.Zero()}return i.prototype.addLight=function(e,t,i){var r=new n.Vector3(t.r,t.g,t.b).scale(i);this.l00=this.l00.add(r.scale(.282095)),this.l1_1=this.l1_1.add(r.scale(.488603*e.y)),this.l10=this.l10.add(r.scale(.488603*e.z)),this.l11=this.l11.add(r.scale(.488603*e.x)),this.l2_2=this.l2_2.add(r.scale(1.092548*e.x*e.y)),this.l2_1=this.l2_1.add(r.scale(1.092548*e.y*e.z)),this.l21=this.l21.add(r.scale(1.092548*e.x*e.z)),this.l20=this.l20.add(r.scale(.315392*(3*e.z*e.z-1))),this.lL22=this.lL22.add(r.scale(.546274*(e.x*e.x-e.y*e.y)))},i.prototype.scale=function(e){this.l00=this.l00.scale(e),this.l1_1=this.l1_1.scale(e),this.l10=this.l10.scale(e),this.l11=this.l11.scale(e),this.l2_2=this.l2_2.scale(e),this.l2_1=this.l2_1.scale(e),this.l20=this.l20.scale(e),this.l21=this.l21.scale(e),this.lL22=this.lL22.scale(e)},i.prototype.convertIncidentRadianceToIrradiance=function(){this.l00=this.l00.scale(3.141593),this.l1_1=this.l1_1.scale(2.094395),this.l10=this.l10.scale(2.094395),this.l11=this.l11.scale(2.094395),this.l2_2=this.l2_2.scale(.785398),this.l2_1=this.l2_1.scale(.785398),this.l20=this.l20.scale(.785398),this.l21=this.l21.scale(.785398),this.lL22=this.lL22.scale(.785398)},i.prototype.convertIrradianceToLambertianRadiance=function(){this.scale(1/Math.PI)},i.FromPolynomial=function(e){var t=new i;return t.l00=e.xx.scale(.376127).add(e.yy.scale(.376127)).add(e.zz.scale(.376126)),t.l1_1=e.y.scale(.977204),t.l10=e.z.scale(.977204),t.l11=e.x.scale(.977204),t.l2_2=e.xy.scale(1.16538),t.l2_1=e.yz.scale(1.16538),t.l20=e.zz.scale(1.34567).subtract(e.xx.scale(.672834)).subtract(e.yy.scale(.672834)),t.l21=e.zx.scale(1.16538),t.lL22=e.xx.scale(1.16538).subtract(e.yy.scale(1.16538)),t.scale(Math.PI),t},i.FromArray=function(e){var t=new i;return n.Vector3.FromArrayToRef(e[0],0,t.l00),n.Vector3.FromArrayToRef(e[1],0,t.l1_1),n.Vector3.FromArrayToRef(e[2],0,t.l10),n.Vector3.FromArrayToRef(e[3],0,t.l11),n.Vector3.FromArrayToRef(e[4],0,t.l2_2),n.Vector3.FromArrayToRef(e[5],0,t.l2_1),n.Vector3.FromArrayToRef(e[6],0,t.l20),n.Vector3.FromArrayToRef(e[7],0,t.l21),n.Vector3.FromArrayToRef(e[8],0,t.lL22),t},i})();n.SphericalHarmonics=t})($a||($a={})),me=$a||($a={}),ge=function(e,t,i,r){this.name=e,this.worldAxisForNormal=t,this.worldAxisForFileX=i,this.worldAxisForFileY=r},ve=(function(){function e(){}return e.ConvertCubeMapTextureToSphericalPolynomial=function(e){if(!e.isCube)return null;var t,i,r=e.getSize().width,n=e.readPixels(0),o=e.readPixels(1);e.isRenderTarget?(t=e.readPixels(3),i=e.readPixels(2)):(t=e.readPixels(2),i=e.readPixels(3));var s=e.readPixels(4),a=e.readPixels(5),l=e.gammaSpace,c=me.Engine.TEXTUREFORMAT_RGBA,h=me.Engine.TEXTURETYPE_UNSIGNED_INT;e.textureType&&e.textureType!==me.Engine.TEXTURETYPE_UNSIGNED_INT&&(h=me.Engine.TEXTURETYPE_FLOAT);var u={size:r,right:n,left:o,up:t,down:i,front:s,back:a,format:c,type:h,gammaSpace:l};return this.ConvertCubeMapToSphericalPolynomial(u)},e.ConvertCubeMapToSphericalPolynomial=function(e){for(var t=new me.SphericalHarmonics,i=0,r=2/e.size,n=r,o=.5*r-1,s=0;s<6;s++)for(var a=this.FileFaces[s],l=e[a.name],c=o,h=e.format===me.Engine.TEXTUREFORMAT_RGBA?4:3,u=0;u<e.size;u++){for(var d=o,f=0;f<e.size;f++){var p=a.worldAxisForFileX.scale(d).add(a.worldAxisForFileY.scale(c)).add(a.worldAxisForNormal);p.normalize();var _=Math.pow(1+d*d+c*c,-1.5),m=l[u*e.size*h+f*h+0],g=l[u*e.size*h+f*h+1],v=l[u*e.size*h+f*h+2];e.type===me.Engine.TEXTURETYPE_UNSIGNED_INT&&(m/=255,g/=255,v/=255),e.gammaSpace&&(m=Math.pow(me.Scalar.Clamp(m),me.ToLinearSpace),g=Math.pow(me.Scalar.Clamp(g),me.ToLinearSpace),v=Math.pow(me.Scalar.Clamp(v),me.ToLinearSpace));var y=new me.Color3(m,g,v);t.addLight(p,y,_),i+=_,d+=r}c+=n}var b=6*(4*Math.PI)/6/i;return t.scale(b),t.convertIncidentRadianceToIrradiance(),t.convertIrradianceToLambertianRadiance(),me.SphericalPolynomial.FromHarmonics(t)},e.FileFaces=[new ge("right",new me.Vector3(1,0,0),new me.Vector3(0,0,-1),new me.Vector3(0,-1,0)),new ge("left",new me.Vector3(-1,0,0),new me.Vector3(0,0,1),new me.Vector3(0,-1,0)),new ge("up",new me.Vector3(0,1,0),new me.Vector3(1,0,0),new me.Vector3(0,0,1)),new ge("down",new me.Vector3(0,-1,0),new me.Vector3(1,0,0),new me.Vector3(0,0,-1)),new ge("front",new me.Vector3(0,0,1),new me.Vector3(1,0,0),new me.Vector3(0,-1,0)),new ge("back",new me.Vector3(0,0,-1),new me.Vector3(-1,0,0),new me.Vector3(0,-1,0))],e})(),me.CubeMapToSphericalPolynomialTools=ve,ye=$a||($a={}),be=(function(t){function e(){var e=t.call(this)||this;return e.PBR=!0,e.MAINUV1=!1,e.MAINUV2=!1,e.UV1=!1,e.UV2=!1,e.ALBEDO=!1,e.ALBEDODIRECTUV=0,e.VERTEXCOLOR=!1,e.AMBIENT=!1,e.AMBIENTDIRECTUV=0,e.AMBIENTINGRAYSCALE=!1,e.OPACITY=!1,e.VERTEXALPHA=!1,e.OPACITYDIRECTUV=0,e.OPACITYRGB=!1,e.ALPHATEST=!1,e.DEPTHPREPASS=!1,e.ALPHABLEND=!1,e.ALPHAFROMALBEDO=!1,e.ALPHATESTVALUE="0.5",e.SPECULAROVERALPHA=!1,e.RADIANCEOVERALPHA=!1,e.ALPHAFRESNEL=!1,e.LINEARALPHAFRESNEL=!1,e.PREMULTIPLYALPHA=!1,e.EMISSIVE=!1,e.EMISSIVEDIRECTUV=0,e.REFLECTIVITY=!1,e.REFLECTIVITYDIRECTUV=0,e.SPECULARTERM=!1,e.MICROSURFACEFROMREFLECTIVITYMAP=!1,e.MICROSURFACEAUTOMATIC=!1,e.LODBASEDMICROSFURACE=!1,e.MICROSURFACEMAP=!1,e.MICROSURFACEMAPDIRECTUV=0,e.METALLICWORKFLOW=!1,e.ROUGHNESSSTOREINMETALMAPALPHA=!1,e.ROUGHNESSSTOREINMETALMAPGREEN=!1,e.METALLNESSSTOREINMETALMAPBLUE=!1,e.AOSTOREINMETALMAPRED=!1,e.ENVIRONMENTBRDF=!1,e.NORMAL=!1,e.TANGENT=!1,e.BUMP=!1,e.BUMPDIRECTUV=0,e.OBJECTSPACE_NORMALMAP=!1,e.PARALLAX=!1,e.PARALLAXOCCLUSION=!1,e.NORMALXYSCALE=!0,e.LIGHTMAP=!1,e.LIGHTMAPDIRECTUV=0,e.USELIGHTMAPASSHADOWMAP=!1,e.GAMMALIGHTMAP=!1,e.REFLECTION=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.USESPHERICALFROMREFLECTIONMAP=!1,e.USESPHERICALINVERTEX=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.LODINREFLECTIONALPHA=!1,e.GAMMAREFLECTION=!1,e.RGBDREFLECTION=!1,e.RADIANCEOCCLUSION=!1,e.HORIZONOCCLUSION=!1,e.REFRACTION=!1,e.REFRACTIONMAP_3D=!1,e.REFRACTIONMAP_OPPOSITEZ=!1,e.LODINREFRACTIONALPHA=!1,e.GAMMAREFRACTION=!1,e.RGBDREFRACTION=!1,e.LINKREFRACTIONTOTRANSPARENCY=!1,e.INSTANCES=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.NONUNIFORMSCALING=!1,e.MORPHTARGETS=!1,e.MORPHTARGETS_NORMAL=!1,e.MORPHTARGETS_TANGENT=!1,e.NUM_MORPH_INFLUENCERS=0,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.USEPHYSICALLIGHTFALLOFF=!1,e.USEGLTFLIGHTFALLOFF=!1,e.TWOSIDEDLIGHTING=!1,e.SHADOWFLOAT=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.POINTSIZE=!1,e.FOG=!1,e.LOGARITHMICDEPTH=!1,e.FORCENORMALFORWARD=!1,e.SPECULARAA=!1,e.UNLIT=!1,e.rebuild(),e}return T(e,t),e.prototype.reset=function(){t.prototype.reset.call(this),this.ALPHATESTVALUE="0.5",this.PBR=!0},e})(ye.MaterialDefines),Te=(function(r){function p(e,t){var i=r.call(this,e,t)||this;return i._directIntensity=1,i._emissiveIntensity=1,i._environmentIntensity=1,i._specularIntensity=1,i._lightingInfos=new ye.Vector4(i._directIntensity,i._emissiveIntensity,i._environmentIntensity,i._specularIntensity),i._disableBumpMap=!1,i._ambientTextureStrength=1,i._ambientTextureImpactOnAnalyticalLights=ye.PBRMaterial.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,i._ambientColor=new ye.Color3(0,0,0),i._albedoColor=new ye.Color3(1,1,1),i._reflectivityColor=new ye.Color3(1,1,1),i._reflectionColor=new ye.Color3(1,1,1),i._emissiveColor=new ye.Color3(0,0,0),i._microSurface=.9,i._indexOfRefraction=.66,i._invertRefractionY=!1,i._linkRefractionWithTransparency=!1,i._useLightmapAsShadowmap=!1,i._useHorizonOcclusion=!0,i._useRadianceOcclusion=!0,i._useAlphaFromAlbedoTexture=!1,i._useSpecularOverAlpha=!0,i._useMicroSurfaceFromReflectivityMapAlpha=!1,i._useRoughnessFromMetallicTextureAlpha=!0,i._useRoughnessFromMetallicTextureGreen=!1,i._useMetallnessFromMetallicTextureBlue=!1,i._useAmbientOcclusionFromMetallicTextureRed=!1,i._useAmbientInGrayScale=!1,i._useAutoMicroSurfaceFromReflectivityMap=!1,i._lightFalloff=p.LIGHTFALLOFF_PHYSICAL,i._useRadianceOverAlpha=!0,i._useObjectSpaceNormalMap=!1,i._useParallax=!1,i._useParallaxOcclusion=!1,i._parallaxScaleBias=.05,i._disableLighting=!1,i._maxSimultaneousLights=4,i._invertNormalMapX=!1,i._invertNormalMapY=!1,i._twoSidedLighting=!1,i._alphaCutOff=.4,i._forceAlphaTest=!1,i._useAlphaFresnel=!1,i._useLinearAlphaFresnel=!1,i._transparencyMode=null,i._environmentBRDFTexture=null,i._forceIrradianceInFragment=!1,i._forceNormalForward=!1,i._enableSpecularAntiAliasing=!1,i._renderTargets=new ye.SmartArray(16),i._globalAmbientColor=new ye.Color3(0,0,0),i._unlit=!1,i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),ye.StandardMaterial.ReflectionTextureEnabled&&i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),ye.StandardMaterial.RefractionTextureEnabled&&i._refractionTexture&&i._refractionTexture.isRenderTarget&&i._renderTargets.push(i._refractionTexture),i._renderTargets},i._environmentBRDFTexture=ye.TextureTools.GetEnvironmentBRDFTexture(t),i}return T(p,r),p.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(e){t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(p.prototype,"hasRenderTargetTextures",{get:function(){return!!(ye.StandardMaterial.ReflectionTextureEnabled&&this._reflectionTexture&&this._reflectionTexture.isRenderTarget)||!!(ye.StandardMaterial.RefractionTextureEnabled&&this._refractionTexture&&this._refractionTexture.isRenderTarget)},enumerable:!0,configurable:!0}),p.prototype.getClassName=function(){return"PBRBaseMaterial"},Object.defineProperty(p.prototype,"useLogarithmicDepth",{get:function(){return this._useLogarithmicDepth},set:function(e){this._useLogarithmicDepth=e&&this.getScene().getEngine().getCaps().fragmentDepthSupported},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"transparencyMode",{get:function(){return this._transparencyMode},set:function(e){this._transparencyMode!==e&&(this._transparencyMode=e,this._forceAlphaTest=e===ye.PBRMaterial.PBRMATERIAL_ALPHATESTANDBLEND,this._markAllSubMeshesAsTexturesAndMiscDirty())},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"_disableAlphaBlending",{get:function(){return this._linkRefractionWithTransparency||this._transparencyMode===ye.PBRMaterial.PBRMATERIAL_OPAQUE||this._transparencyMode===ye.PBRMaterial.PBRMATERIAL_ALPHATEST},enumerable:!0,configurable:!0}),p.prototype.needAlphaBlending=function(){return!this._disableAlphaBlending&&(this.alpha<1||null!=this._opacityTexture||this._shouldUseAlphaFromAlbedoTexture())},p.prototype.needAlphaBlendingForMesh=function(e){return!this._disableAlphaBlending&&r.prototype.needAlphaBlendingForMesh.call(this,e)},p.prototype.needAlphaTesting=function(){return!!this._forceAlphaTest||!this._linkRefractionWithTransparency&&(null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&(null==this._transparencyMode||this._transparencyMode===ye.PBRMaterial.PBRMATERIAL_ALPHATEST))},p.prototype._shouldUseAlphaFromAlbedoTexture=function(){return null!=this._albedoTexture&&this._albedoTexture.hasAlpha&&this._useAlphaFromAlbedoTexture&&this._transparencyMode!==ye.PBRMaterial.PBRMATERIAL_OPAQUE},p.prototype.getAlphaTestTexture=function(){return this._albedoTexture},p.prototype.isReadyForSubMesh=function(e,t,i){if(t.effect&&this.isFrozen&&this._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new be);var r=t._materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&r._renderId===this.getScene().getRenderId())return!0;var n=this.getScene(),o=n.getEngine();if(r._areTexturesDirty&&n.texturesEnabled){if(this._albedoTexture&&ye.StandardMaterial.DiffuseTextureEnabled&&!this._albedoTexture.isReadyOrNotBlocking())return!1;if(this._ambientTexture&&ye.StandardMaterial.AmbientTextureEnabled&&!this._ambientTexture.isReadyOrNotBlocking())return!1;if(this._opacityTexture&&ye.StandardMaterial.OpacityTextureEnabled&&!this._opacityTexture.isReadyOrNotBlocking())return!1;var s=this._getReflectionTexture();if(s&&ye.StandardMaterial.ReflectionTextureEnabled&&!s.isReadyOrNotBlocking())return!1;if(this._lightmapTexture&&ye.StandardMaterial.LightmapTextureEnabled&&!this._lightmapTexture.isReadyOrNotBlocking())return!1;if(this._emissiveTexture&&ye.StandardMaterial.EmissiveTextureEnabled&&!this._emissiveTexture.isReadyOrNotBlocking())return!1;if(ye.StandardMaterial.SpecularTextureEnabled){if(this._metallicTexture){if(!this._metallicTexture.isReadyOrNotBlocking())return!1}else if(this._reflectivityTexture&&!this._reflectivityTexture.isReadyOrNotBlocking())return!1;if(this._microSurfaceTexture&&!this._microSurfaceTexture.isReadyOrNotBlocking())return!1}if(o.getCaps().standardDerivatives&&this._bumpTexture&&ye.StandardMaterial.BumpTextureEnabled&&!this._disableBumpMap&&!this._bumpTexture.isReady())return!1;var a=this._getRefractionTexture();if(a&&ye.StandardMaterial.RefractionTextureEnabled&&!a.isReadyOrNotBlocking())return!1;if(this._environmentBRDFTexture&&ye.StandardMaterial.ReflectionTextureEnabled&&!this._environmentBRDFTexture.isReady())return!1}if(r._areImageProcessingDirty&&this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.isReady())return!1;o.getCaps().standardDerivatives||e.isVerticesDataPresent(ye.VertexBuffer.NormalKind)||(e.createNormals(!0),ye.Tools.Warn("PBRMaterial: Normals have been created for the mesh: "+e.name));var l=this._prepareEffect(e,r,this.onCompiled,this.onError,i);return l&&(n.resetCachedMaterial(),t.setEffect(l,r),this.buildUniformLayout()),!(!t.effect||!t.effect.isReady())&&(r._renderId=n.getRenderId(),this._wasPreviouslyReady=!0)},p.prototype.isMetallicWorkflow=function(){return!(null==this._metallic&&null==this._roughness&&!this._metallicTexture)},p.prototype._prepareEffect=function(e,t,i,r,n,o){if(void 0===i&&(i=null),void 0===r&&(r=null),void 0===n&&(n=null),void 0===o&&(o=null),this._prepareDefines(e,t,n,o),!t.isDirty)return null;t.markAsProcessed();var s=this.getScene().getEngine(),a=new ye.EffectFallbacks,l=0;t.USESPHERICALINVERTEX&&a.addFallback(l++,"USESPHERICALINVERTEX"),t.FOG&&a.addFallback(l,"FOG"),t.SPECULARAA&&a.addFallback(l,"SPECULARAA"),t.POINTSIZE&&a.addFallback(l,"POINTSIZE"),t.LOGARITHMICDEPTH&&a.addFallback(l,"LOGARITHMICDEPTH"),t.PARALLAX&&a.addFallback(l,"PARALLAX"),t.PARALLAXOCCLUSION&&a.addFallback(l++,"PARALLAXOCCLUSION"),t.ENVIRONMENTBRDF&&a.addFallback(l++,"ENVIRONMENTBRDF"),t.TANGENT&&a.addFallback(l++,"TANGENT"),t.BUMP&&a.addFallback(l++,"BUMP"),l=ye.MaterialHelper.HandleFallbacksForShadows(t,a,this._maxSimultaneousLights,l++),t.SPECULARTERM&&a.addFallback(l++,"SPECULARTERM"),t.USESPHERICALFROMREFLECTIONMAP&&a.addFallback(l++,"USESPHERICALFROMREFLECTIONMAP"),t.LIGHTMAP&&a.addFallback(l++,"LIGHTMAP"),t.NORMAL&&a.addFallback(l++,"NORMAL"),t.AMBIENT&&a.addFallback(l++,"AMBIENT"),t.EMISSIVE&&a.addFallback(l++,"EMISSIVE"),t.VERTEXCOLOR&&a.addFallback(l++,"VERTEXCOLOR"),0<t.NUM_BONE_INFLUENCERS&&a.addCPUSkinningFallback(l++,e),t.MORPHTARGETS&&a.addFallback(l++,"MORPHTARGETS");var c=[ye.VertexBuffer.PositionKind];t.NORMAL&&c.push(ye.VertexBuffer.NormalKind),t.TANGENT&&c.push(ye.VertexBuffer.TangentKind),t.UV1&&c.push(ye.VertexBuffer.UVKind),t.UV2&&c.push(ye.VertexBuffer.UV2Kind),t.VERTEXCOLOR&&c.push(ye.VertexBuffer.ColorKind),ye.MaterialHelper.PrepareAttributesForBones(c,e,t,a),ye.MaterialHelper.PrepareAttributesForInstances(c,t),ye.MaterialHelper.PrepareAttributesForMorphTargets(c,e,t);var h=["world","view","viewProjection","vEyePosition","vLightsType","vAmbientColor","vAlbedoColor","vReflectivityColor","vEmissiveColor","vReflectionColor","vFogInfos","vFogColor","pointSize","vAlbedoInfos","vAmbientInfos","vOpacityInfos","vReflectionInfos","vReflectionPosition","vReflectionSize","vEmissiveInfos","vReflectivityInfos","vMicroSurfaceSamplerInfos","vBumpInfos","vLightmapInfos","vRefractionInfos","mBones","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","albedoMatrix","ambientMatrix","opacityMatrix","reflectionMatrix","emissiveMatrix","reflectivityMatrix","normalMatrix","microSurfaceSamplerMatrix","bumpMatrix","lightmapMatrix","refractionMatrix","vLightingIntensity","logarithmicDepthConstant","vSphericalX","vSphericalY","vSphericalZ","vSphericalXX","vSphericalYY","vSphericalZZ","vSphericalXY","vSphericalYZ","vSphericalZX","vReflectionMicrosurfaceInfos","vRefractionMicrosurfaceInfos","vTangentSpaceParams"],u=["albedoSampler","reflectivitySampler","ambientSampler","emissiveSampler","bumpSampler","lightmapSampler","opacitySampler","refractionSampler","refractionSamplerLow","refractionSamplerHigh","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh","microSurfaceSampler","environmentBrdfSampler"],d=["Material","Scene"];ye.ImageProcessingConfiguration&&(ye.ImageProcessingConfiguration.PrepareUniforms(h,t),ye.ImageProcessingConfiguration.PrepareSamplers(u,t)),ye.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:d,samplers:u,defines:t,maxSimultaneousLights:this._maxSimultaneousLights});var f=t.toString();return s.createEffect("pbr",{attributes:c,uniformsNames:h,uniformBuffersNames:d,samplers:u,defines:f,fallbacks:a,onCompiled:i,onError:r,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights,maxSimultaneousMorphTargets:t.NUM_MORPH_INFLUENCERS}},s)},p.prototype._prepareDefines=function(e,t,i,r){void 0===i&&(i=null),void 0===r&&(r=null);var n=this.getScene(),o=n.getEngine();if(ye.MaterialHelper.PrepareDefinesForLights(n,e,t,!0,this._maxSimultaneousLights,this._disableLighting),t._needNormals=!0,t.METALLICWORKFLOW=this.isMetallicWorkflow(),t._areTexturesDirty){if(t._needUVs=!1,n.texturesEnabled){n.getEngine().getCaps().textureLOD&&(t.LODBASEDMICROSFURACE=!0),this._albedoTexture&&ye.StandardMaterial.DiffuseTextureEnabled?ye.MaterialHelper.PrepareDefinesForMergedUV(this._albedoTexture,t,"ALBEDO"):t.ALBEDO=!1,this._ambientTexture&&ye.StandardMaterial.AmbientTextureEnabled?(ye.MaterialHelper.PrepareDefinesForMergedUV(this._ambientTexture,t,"AMBIENT"),t.AMBIENTINGRAYSCALE=this._useAmbientInGrayScale):t.AMBIENT=!1,this._opacityTexture&&ye.StandardMaterial.OpacityTextureEnabled?(ye.MaterialHelper.PrepareDefinesForMergedUV(this._opacityTexture,t,"OPACITY"),t.OPACITYRGB=this._opacityTexture.getAlphaFromRGB):t.OPACITY=!1;var s=this._getReflectionTexture();if(s&&ye.StandardMaterial.ReflectionTextureEnabled){switch(t.REFLECTION=!0,t.GAMMAREFLECTION=s.gammaSpace,t.RGBDREFLECTION=s.isRGBD,t.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!s.invertZ:s.invertZ,t.LODINREFLECTIONALPHA=s.lodLevelInAlpha,s.coordinatesMode===ye.Texture.INVCUBIC_MODE&&(t.INVERTCUBICMAP=!0),t.REFLECTIONMAP_3D=s.isCube,s.coordinatesMode){case ye.Texture.EXPLICIT_MODE:t.REFLECTIONMAP_EXPLICIT=!0;break;case ye.Texture.PLANAR_MODE:t.REFLECTIONMAP_PLANAR=!0;break;case ye.Texture.PROJECTION_MODE:t.REFLECTIONMAP_PROJECTION=!0;break;case ye.Texture.SKYBOX_MODE:t.REFLECTIONMAP_SKYBOX=!0;break;case ye.Texture.SPHERICAL_MODE:t.REFLECTIONMAP_SPHERICAL=!0;break;case ye.Texture.EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case ye.Texture.FIXED_EQUIRECTANGULAR_MODE:t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case ye.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case ye.Texture.CUBIC_MODE:case ye.Texture.INVCUBIC_MODE:default:t.REFLECTIONMAP_CUBIC=!0,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!!s.boundingBoxSize}s.coordinatesMode!==ye.Texture.SKYBOX_MODE?s.sphericalPolynomial&&(t.USESPHERICALFROMREFLECTIONMAP=!0,this._forceIrradianceInFragment||n.getEngine().getCaps().maxVaryingVectors<=8?t.USESPHERICALINVERTEX=!1:t.USESPHERICALINVERTEX=!0):t.REFLECTIONMAP_SKYBOX_TRANSFORMED=!s.getReflectionTextureMatrix().isIdentity()}else t.REFLECTION=!1,t.REFLECTIONMAP_3D=!1,t.REFLECTIONMAP_SPHERICAL=!1,t.REFLECTIONMAP_PLANAR=!1,t.REFLECTIONMAP_CUBIC=!1,t.USE_LOCAL_REFLECTIONMAP_CUBIC=!1,t.REFLECTIONMAP_PROJECTION=!1,t.REFLECTIONMAP_SKYBOX=!1,t.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,t.REFLECTIONMAP_EXPLICIT=!1,t.REFLECTIONMAP_EQUIRECTANGULAR=!1,t.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,t.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,t.INVERTCUBICMAP=!1,t.USESPHERICALFROMREFLECTIONMAP=!1,t.USESPHERICALINVERTEX=!1,t.REFLECTIONMAP_OPPOSITEZ=!1,t.LODINREFLECTIONALPHA=!1,t.GAMMAREFLECTION=!1,t.RGBDREFLECTION=!1;this._lightmapTexture&&ye.StandardMaterial.LightmapTextureEnabled?(ye.MaterialHelper.PrepareDefinesForMergedUV(this._lightmapTexture,t,"LIGHTMAP"),t.USELIGHTMAPASSHADOWMAP=this._useLightmapAsShadowmap,t.GAMMALIGHTMAP=this._lightmapTexture.gammaSpace):t.LIGHTMAP=!1,this._emissiveTexture&&ye.StandardMaterial.EmissiveTextureEnabled?ye.MaterialHelper.PrepareDefinesForMergedUV(this._emissiveTexture,t,"EMISSIVE"):t.EMISSIVE=!1,ye.StandardMaterial.SpecularTextureEnabled?(this._metallicTexture?(ye.MaterialHelper.PrepareDefinesForMergedUV(this._metallicTexture,t,"REFLECTIVITY"),t.ROUGHNESSSTOREINMETALMAPALPHA=this._useRoughnessFromMetallicTextureAlpha,t.ROUGHNESSSTOREINMETALMAPGREEN=!this._useRoughnessFromMetallicTextureAlpha&&this._useRoughnessFromMetallicTextureGreen,t.METALLNESSSTOREINMETALMAPBLUE=this._useMetallnessFromMetallicTextureBlue,t.AOSTOREINMETALMAPRED=this._useAmbientOcclusionFromMetallicTextureRed):this._reflectivityTexture?(ye.MaterialHelper.PrepareDefinesForMergedUV(this._reflectivityTexture,t,"REFLECTIVITY"),t.MICROSURFACEFROMREFLECTIVITYMAP=this._useMicroSurfaceFromReflectivityMapAlpha,t.MICROSURFACEAUTOMATIC=this._useAutoMicroSurfaceFromReflectivityMap):t.REFLECTIVITY=!1,this._microSurfaceTexture?ye.MaterialHelper.PrepareDefinesForMergedUV(this._microSurfaceTexture,t,"MICROSURFACEMAP"):t.MICROSURFACEMAP=!1):(t.REFLECTIVITY=!1,t.MICROSURFACEMAP=!1),n.getEngine().getCaps().standardDerivatives&&this._bumpTexture&&ye.StandardMaterial.BumpTextureEnabled&&!this._disableBumpMap?(ye.MaterialHelper.PrepareDefinesForMergedUV(this._bumpTexture,t,"BUMP"),this._useParallax&&this._albedoTexture&&ye.StandardMaterial.DiffuseTextureEnabled?(t.PARALLAX=!0,t.PARALLAXOCCLUSION=!!this._useParallaxOcclusion):t.PARALLAX=!1,t.OBJECTSPACE_NORMALMAP=this._useObjectSpaceNormalMap):t.BUMP=!1;var a=this._getRefractionTexture();a&&ye.StandardMaterial.RefractionTextureEnabled?(t.REFRACTION=!0,t.REFRACTIONMAP_3D=a.isCube,t.GAMMAREFRACTION=a.gammaSpace,t.RGBDREFRACTION=a.isRGBD,t.REFRACTIONMAP_OPPOSITEZ=a.invertZ,t.LODINREFRACTIONALPHA=a.lodLevelInAlpha,this._linkRefractionWithTransparency&&(t.LINKREFRACTIONTOTRANSPARENCY=!0)):t.REFRACTION=!1,this._environmentBRDFTexture&&ye.StandardMaterial.ReflectionTextureEnabled?t.ENVIRONMENTBRDF=!0:t.ENVIRONMENTBRDF=!1,this._shouldUseAlphaFromAlbedoTexture()?t.ALPHAFROMALBEDO=!0:t.ALPHAFROMALBEDO=!1}t.SPECULAROVERALPHA=this._useSpecularOverAlpha,this._lightFalloff===p.LIGHTFALLOFF_STANDARD?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!1):this._lightFalloff===p.LIGHTFALLOFF_GLTF?(t.USEPHYSICALLIGHTFALLOFF=!1,t.USEGLTFLIGHTFALLOFF=!0):(t.USEPHYSICALLIGHTFALLOFF=!0,t.USEGLTFLIGHTFALLOFF=!1),t.RADIANCEOVERALPHA=this._useRadianceOverAlpha,!this.backFaceCulling&&this._twoSidedLighting?t.TWOSIDEDLIGHTING=!0:t.TWOSIDEDLIGHTING=!1,t.ALPHATESTVALUE=this._alphaCutOff+(this._alphaCutOff%1==0?".":""),t.PREMULTIPLYALPHA=this.alphaMode===ye.Engine.ALPHA_PREMULTIPLIED||this.alphaMode===ye.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF,t.ALPHABLEND=this.needAlphaBlendingForMesh(e),t.ALPHAFRESNEL=this._useAlphaFresnel||this._useLinearAlphaFresnel,t.LINEARALPHAFRESNEL=this._useLinearAlphaFresnel,t.SPECULARAA=n.getEngine().getCaps().standardDerivatives&&this._enableSpecularAntiAliasing}t._areImageProcessingDirty&&this._imageProcessingConfiguration&&this._imageProcessingConfiguration.prepareDefines(t),t.FORCENORMALFORWARD=this._forceNormalForward,t.RADIANCEOCCLUSION=this._useRadianceOcclusion,t.HORIZONOCCLUSION=this._useHorizonOcclusion,t._areMiscDirty&&(ye.MaterialHelper.PrepareDefinesForMisc(e,n,this._useLogarithmicDepth,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e)||this._forceAlphaTest,t),t.UNLIT=this._unlit||(this.pointsCloud||this.wireframe)&&!e.isVerticesDataPresent(ye.VertexBuffer.NormalKind)),ye.MaterialHelper.PrepareDefinesForFrameBoundValues(n,o,t,!!i,r),ye.MaterialHelper.PrepareDefinesForAttributes(e,t,!0,!0,!0,this._transparencyMode!==ye.PBRMaterial.PBRMATERIAL_OPAQUE)},p.prototype.forceCompilation=function(e,t,i){var r=this,n=ae({clipPlane:!1},i),o=new be,s=this._prepareEffect(e,o,void 0,void 0,void 0,n.clipPlane);s.isReady()?t&&t(this):s.onCompileObservable.add((function(){t&&t(r)}))},p.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("vAlbedoInfos",2),this._uniformBuffer.addUniform("vAmbientInfos",4),this._uniformBuffer.addUniform("vOpacityInfos",2),this._uniformBuffer.addUniform("vEmissiveInfos",2),this._uniformBuffer.addUniform("vLightmapInfos",2),this._uniformBuffer.addUniform("vReflectivityInfos",3),this._uniformBuffer.addUniform("vMicroSurfaceSamplerInfos",2),this._uniformBuffer.addUniform("vRefractionInfos",4),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("vReflectionPosition",3),this._uniformBuffer.addUniform("vReflectionSize",3),this._uniformBuffer.addUniform("vBumpInfos",3),this._uniformBuffer.addUniform("albedoMatrix",16),this._uniformBuffer.addUniform("ambientMatrix",16),this._uniformBuffer.addUniform("opacityMatrix",16),this._uniformBuffer.addUniform("emissiveMatrix",16),this._uniformBuffer.addUniform("lightmapMatrix",16),this._uniformBuffer.addUniform("reflectivityMatrix",16),this._uniformBuffer.addUniform("microSurfaceSamplerMatrix",16),this._uniformBuffer.addUniform("bumpMatrix",16),this._uniformBuffer.addUniform("vTangentSpaceParams",2),this._uniformBuffer.addUniform("refractionMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("vReflectionColor",3),this._uniformBuffer.addUniform("vAlbedoColor",4),this._uniformBuffer.addUniform("vLightingIntensity",4),this._uniformBuffer.addUniform("vRefractionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("vReflectivityColor",4),this._uniformBuffer.addUniform("vEmissiveColor",3),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.create()},p.prototype.unbind=function(){this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),this._refractionTexture&&this._refractionTexture.isRenderTarget&&this._uniformBuffer.setTexture("refractionSampler",null),r.prototype.unbind.call(this)},p.prototype.bindForSubMesh=function(e,t,i){var r=this.getScene(),n=i._materialDefines;if(n){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),n.OBJECTSPACE_NORMALMAP&&(e.toNormalMatrix(this._normalMatrix),this.bindOnlyNormalMatrix(this._normalMatrix));var s=this._mustRebind(r,o,t.visibility);ye.MaterialHelper.BindBonesParameters(t,this._activeEffect);var a=null;if(s){this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o),a=this._getReflectionTexture();var l=this._getRefractionTexture();if(!this._uniformBuffer.useUbo||!this.isFrozen||!this._uniformBuffer.isSync){if(r.texturesEnabled){if(this._albedoTexture&&ye.StandardMaterial.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vAlbedoInfos",this._albedoTexture.coordinatesIndex,this._albedoTexture.level),ye.MaterialHelper.BindTextureMatrix(this._albedoTexture,this._uniformBuffer,"albedo")),this._ambientTexture&&ye.StandardMaterial.AmbientTextureEnabled&&(this._uniformBuffer.updateFloat4("vAmbientInfos",this._ambientTexture.coordinatesIndex,this._ambientTexture.level,this._ambientTextureStrength,this._ambientTextureImpactOnAnalyticalLights),ye.MaterialHelper.BindTextureMatrix(this._ambientTexture,this._uniformBuffer,"ambient")),this._opacityTexture&&ye.StandardMaterial.OpacityTextureEnabled&&(this._uniformBuffer.updateFloat2("vOpacityInfos",this._opacityTexture.coordinatesIndex,this._opacityTexture.level),ye.MaterialHelper.BindTextureMatrix(this._opacityTexture,this._uniformBuffer,"opacity")),a&&ye.StandardMaterial.ReflectionTextureEnabled){if(this._uniformBuffer.updateMatrix("reflectionMatrix",a.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",a.level,0),a.boundingBoxSize){var c=a;this._uniformBuffer.updateVector3("vReflectionPosition",c.boundingBoxPosition),this._uniformBuffer.updateVector3("vReflectionSize",c.boundingBoxSize)}var h=a.sphericalPolynomial;n.USESPHERICALFROMREFLECTIONMAP&&h&&(this._activeEffect.setFloat3("vSphericalX",h.x.x,h.x.y,h.x.z),this._activeEffect.setFloat3("vSphericalY",h.y.x,h.y.y,h.y.z),this._activeEffect.setFloat3("vSphericalZ",h.z.x,h.z.y,h.z.z),this._activeEffect.setFloat3("vSphericalXX_ZZ",h.xx.x-h.zz.x,h.xx.y-h.zz.y,h.xx.z-h.zz.z),this._activeEffect.setFloat3("vSphericalYY_ZZ",h.yy.x-h.zz.x,h.yy.y-h.zz.y,h.yy.z-h.zz.z),this._activeEffect.setFloat3("vSphericalZZ",h.zz.x,h.zz.y,h.zz.z),this._activeEffect.setFloat3("vSphericalXY",h.xy.x,h.xy.y,h.xy.z),this._activeEffect.setFloat3("vSphericalYZ",h.yz.x,h.yz.y,h.yz.z),this._activeEffect.setFloat3("vSphericalZX",h.zx.x,h.zx.y,h.zx.z)),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",a.getSize().width,a.lodGenerationScale,a.lodGenerationOffset)}if(this._emissiveTexture&&ye.StandardMaterial.EmissiveTextureEnabled&&(this._uniformBuffer.updateFloat2("vEmissiveInfos",this._emissiveTexture.coordinatesIndex,this._emissiveTexture.level),ye.MaterialHelper.BindTextureMatrix(this._emissiveTexture,this._uniformBuffer,"emissive")),this._lightmapTexture&&ye.StandardMaterial.LightmapTextureEnabled&&(this._uniformBuffer.updateFloat2("vLightmapInfos",this._lightmapTexture.coordinatesIndex,this._lightmapTexture.level),ye.MaterialHelper.BindTextureMatrix(this._lightmapTexture,this._uniformBuffer,"lightmap")),ye.StandardMaterial.SpecularTextureEnabled&&(this._metallicTexture?(this._uniformBuffer.updateFloat3("vReflectivityInfos",this._metallicTexture.coordinatesIndex,this._metallicTexture.level,this._ambientTextureStrength),ye.MaterialHelper.BindTextureMatrix(this._metallicTexture,this._uniformBuffer,"reflectivity")):this._reflectivityTexture&&(this._uniformBuffer.updateFloat3("vReflectivityInfos",this._reflectivityTexture.coordinatesIndex,this._reflectivityTexture.level,1),ye.MaterialHelper.BindTextureMatrix(this._reflectivityTexture,this._uniformBuffer,"reflectivity")),this._microSurfaceTexture&&(this._uniformBuffer.updateFloat2("vMicroSurfaceSamplerInfos",this._microSurfaceTexture.coordinatesIndex,this._microSurfaceTexture.level),ye.MaterialHelper.BindTextureMatrix(this._microSurfaceTexture,this._uniformBuffer,"microSurfaceSampler"))),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&ye.StandardMaterial.BumpTextureEnabled&&!this._disableBumpMap&&(this._uniformBuffer.updateFloat3("vBumpInfos",this._bumpTexture.coordinatesIndex,this._bumpTexture.level,this._parallaxScaleBias),ye.MaterialHelper.BindTextureMatrix(this._bumpTexture,this._uniformBuffer,"bump"),r._mirroredCameraPosition?this._uniformBuffer.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?1:-1,this._invertNormalMapY?1:-1):this._uniformBuffer.updateFloat2("vTangentSpaceParams",this._invertNormalMapX?-1:1,this._invertNormalMapY?-1:1)),l&&ye.StandardMaterial.RefractionTextureEnabled){this._uniformBuffer.updateMatrix("refractionMatrix",l.getReflectionTextureMatrix());var u=1;l.isCube||l.depth&&(u=l.depth),this._uniformBuffer.updateFloat4("vRefractionInfos",l.level,this._indexOfRefraction,u,this._invertRefractionY?-1:1),this._uniformBuffer.updateFloat3("vRefractionMicrosurfaceInfos",l.getSize().width,l.lodGenerationScale,l.lodGenerationOffset)}}this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),n.METALLICWORKFLOW?(ye.PBRMaterial._scaledReflectivity.r=void 0===this._metallic||null===this._metallic?1:this._metallic,ye.PBRMaterial._scaledReflectivity.g=void 0===this._roughness||null===this._roughness?1:this._roughness,this._uniformBuffer.updateColor4("vReflectivityColor",ye.PBRMaterial._scaledReflectivity,0)):this._uniformBuffer.updateColor4("vReflectivityColor",this._reflectivityColor,this._microSurface),this._uniformBuffer.updateColor3("vEmissiveColor",this._emissiveColor),this._uniformBuffer.updateColor3("vReflectionColor",this._reflectionColor),this._uniformBuffer.updateColor4("vAlbedoColor",this._albedoColor,this.alpha*t.visibility),this._lightingInfos.x=this._directIntensity,this._lightingInfos.y=this._emissiveIntensity,this._lightingInfos.z=this._environmentIntensity,this._lightingInfos.w=this._specularIntensity,this._uniformBuffer.updateVector4("vLightingIntensity",this._lightingInfos)}r.texturesEnabled&&(this._albedoTexture&&ye.StandardMaterial.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("albedoSampler",this._albedoTexture),this._ambientTexture&&ye.StandardMaterial.AmbientTextureEnabled&&this._uniformBuffer.setTexture("ambientSampler",this._ambientTexture),this._opacityTexture&&ye.StandardMaterial.OpacityTextureEnabled&&this._uniformBuffer.setTexture("opacitySampler",this._opacityTexture),a&&ye.StandardMaterial.ReflectionTextureEnabled&&(n.LODBASEDMICROSFURACE?this._uniformBuffer.setTexture("reflectionSampler",a):(this._uniformBuffer.setTexture("reflectionSampler",a._lodTextureMid||a),this._uniformBuffer.setTexture("reflectionSamplerLow",a._lodTextureLow||a),this._uniformBuffer.setTexture("reflectionSamplerHigh",a._lodTextureHigh||a))),n.ENVIRONMENTBRDF&&this._uniformBuffer.setTexture("environmentBrdfSampler",this._environmentBRDFTexture),l&&ye.StandardMaterial.RefractionTextureEnabled&&(n.LODBASEDMICROSFURACE?this._uniformBuffer.setTexture("refractionSampler",l):(this._uniformBuffer.setTexture("refractionSampler",l._lodTextureMid||l),this._uniformBuffer.setTexture("refractionSamplerLow",l._lodTextureLow||l),this._uniformBuffer.setTexture("refractionSamplerHigh",l._lodTextureHigh||l))),this._emissiveTexture&&ye.StandardMaterial.EmissiveTextureEnabled&&this._uniformBuffer.setTexture("emissiveSampler",this._emissiveTexture),this._lightmapTexture&&ye.StandardMaterial.LightmapTextureEnabled&&this._uniformBuffer.setTexture("lightmapSampler",this._lightmapTexture),ye.StandardMaterial.SpecularTextureEnabled&&(this._metallicTexture?this._uniformBuffer.setTexture("reflectivitySampler",this._metallicTexture):this._reflectivityTexture&&this._uniformBuffer.setTexture("reflectivitySampler",this._reflectivityTexture),this._microSurfaceTexture&&this._uniformBuffer.setTexture("microSurfaceSampler",this._microSurfaceTexture)),this._bumpTexture&&r.getEngine().getCaps().standardDerivatives&&ye.StandardMaterial.BumpTextureEnabled&&!this._disableBumpMap&&this._uniformBuffer.setTexture("bumpSampler",this._bumpTexture)),ye.MaterialHelper.BindClipPlane(this._activeEffect,r),r.ambientColor.multiplyToRef(this._ambientColor,this._globalAmbientColor);var d=r._forcedViewPosition?r._forcedViewPosition:r._mirroredCameraPosition?r._mirroredCameraPosition:r.activeCamera.globalPosition,f=r.useRightHandedSystem===(null!=r._mirroredCameraPosition);o.setFloat4("vEyePosition",d.x,d.y,d.z,f?-1:1),o.setColor3("vAmbientColor",this._globalAmbientColor)}!s&&this.isFrozen||(r.lightsEnabled&&!this._disableLighting&&ye.MaterialHelper.BindLights(r,t,this._activeEffect,n,this._maxSimultaneousLights,this._lightFalloff!==p.LIGHTFALLOFF_STANDARD),(r.fogEnabled&&t.applyFog&&r.fogMode!==ye.Scene.FOGMODE_NONE||a)&&this.bindView(o),ye.MaterialHelper.BindFogParameters(r,t,this._activeEffect,!0),n.NUM_MORPH_INFLUENCERS&&ye.MaterialHelper.BindMorphTargetParameters(t,this._activeEffect),this._imageProcessingConfiguration.bind(this._activeEffect),ye.MaterialHelper.BindLogDepth(n,this._activeEffect,r)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect)}}},p.prototype.getAnimatables=function(){var e=[];return this._albedoTexture&&this._albedoTexture.animations&&0<this._albedoTexture.animations.length&&e.push(this._albedoTexture),this._ambientTexture&&this._ambientTexture.animations&&0<this._ambientTexture.animations.length&&e.push(this._ambientTexture),this._opacityTexture&&this._opacityTexture.animations&&0<this._opacityTexture.animations.length&&e.push(this._opacityTexture),this._reflectionTexture&&this._reflectionTexture.animations&&0<this._reflectionTexture.animations.length&&e.push(this._reflectionTexture),this._emissiveTexture&&this._emissiveTexture.animations&&0<this._emissiveTexture.animations.length&&e.push(this._emissiveTexture),this._metallicTexture&&this._metallicTexture.animations&&0<this._metallicTexture.animations.length?e.push(this._metallicTexture):this._reflectivityTexture&&this._reflectivityTexture.animations&&0<this._reflectivityTexture.animations.length&&e.push(this._reflectivityTexture),this._bumpTexture&&this._bumpTexture.animations&&0<this._bumpTexture.animations.length&&e.push(this._bumpTexture),this._lightmapTexture&&this._lightmapTexture.animations&&0<this._lightmapTexture.animations.length&&e.push(this._lightmapTexture),this._refractionTexture&&this._refractionTexture.animations&&0<this._refractionTexture.animations.length&&e.push(this._refractionTexture),e},p.prototype._getReflectionTexture=function(){return this._reflectionTexture?this._reflectionTexture:this.getScene().environmentTexture},p.prototype._getRefractionTexture=function(){return this._refractionTexture?this._refractionTexture:this._linkRefractionWithTransparency?this.getScene().environmentTexture:null},p.prototype.dispose=function(e,t){t&&(this._albedoTexture&&this._albedoTexture.dispose(),this._ambientTexture&&this._ambientTexture.dispose(),this._opacityTexture&&this._opacityTexture.dispose(),this._reflectionTexture&&this._reflectionTexture.dispose(),this._environmentBRDFTexture&&this.getScene()._environmentBRDFTexture!==this._environmentBRDFTexture&&this._environmentBRDFTexture.dispose(),this._emissiveTexture&&this._emissiveTexture.dispose(),this._metallicTexture&&this._metallicTexture.dispose(),this._reflectivityTexture&&this._reflectivityTexture.dispose(),this._bumpTexture&&this._bumpTexture.dispose(),this._lightmapTexture&&this._lightmapTexture.dispose(),this._refractionTexture&&this._refractionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),r.prototype.dispose.call(this,e,t)},p.LIGHTFALLOFF_PHYSICAL=0,p.LIGHTFALLOFF_GLTF=1,p.LIGHTFALLOFF_STANDARD=2,p._scaledReflectivity=new ye.Color3,b([ye.serializeAsImageProcessingConfiguration()],p.prototype,"_imageProcessingConfiguration",void 0),b([ye.serialize()],p.prototype,"useLogarithmicDepth",null),b([ye.serialize()],p.prototype,"transparencyMode",null),p})(ye.PushMaterial),ye.PBRBaseMaterial=Te,Ee=$a||($a={}),xe=(function(r){function e(e,t){var i=r.call(this,e,t)||this;return i.maxSimultaneousLights=4,i.disableLighting=!1,i.invertNormalMapX=!1,i.invertNormalMapY=!1,i.emissiveColor=new Ee.Color3(0,0,0),i.occlusionStrength=1,i.useLightmapAsShadowmap=!1,i._useAlphaFromAlbedoTexture=!0,i._useAmbientInGrayScale=!0,i}return T(e,r),Object.defineProperty(e.prototype,"doubleSided",{get:function(){return this._twoSidedLighting},set:function(e){this._twoSidedLighting!==e&&(this._twoSidedLighting=e,this.backFaceCulling=!e,this._markAllSubMeshesAsTexturesDirty())},enumerable:!0,configurable:!0}),e.prototype.getActiveTextures=function(){var e=r.prototype.getActiveTextures.call(this);return this.environmentTexture&&e.push(this.environmentTexture),this.normalTexture&&e.push(this.normalTexture),this.emissiveTexture&&e.push(this.emissiveTexture),this.occlusionTexture&&e.push(this.occlusionTexture),this.lightmapTexture&&e.push(this.lightmapTexture),e},e.prototype.hasTexture=function(e){return!!r.prototype.hasTexture.call(this,e)||this.lightmapTexture===e},e.prototype.getClassName=function(){return"PBRBaseSimpleMaterial"},b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsLightsDirty")],e.prototype,"maxSimultaneousLights",void 0),b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsLightsDirty")],e.prototype,"disableLighting",void 0),b([Ee.serializeAsTexture(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty","_reflectionTexture")],e.prototype,"environmentTexture",void 0),b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertNormalMapX",void 0),b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"invertNormalMapY",void 0),b([Ee.serializeAsTexture(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty","_bumpTexture")],e.prototype,"normalTexture",void 0),b([Ee.serializeAsColor3("emissive"),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"emissiveColor",void 0),b([Ee.serializeAsTexture(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"emissiveTexture",void 0),b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty","_ambientTextureStrength")],e.prototype,"occlusionStrength",void 0),b([Ee.serializeAsTexture(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty","_ambientTexture")],e.prototype,"occlusionTexture",void 0),b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty","_alphaCutOff")],e.prototype,"alphaCutOff",void 0),b([Ee.serialize()],e.prototype,"doubleSided",null),b([Ee.serializeAsTexture(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty",null)],e.prototype,"lightmapTexture",void 0),b([Ee.serialize(),Ee.expandToProperty("_markAllSubMeshesAsTexturesDirty")],e.prototype,"useLightmapAsShadowmap",void 0),e})(Ee.PBRBaseMaterial),Ee.PBRBaseSimpleMaterial=xe,Pe=$a||($a={}),Ae=(function(r){function n(e,t){var i=r.call(this,e,t)||this;return i.directIntensity=1,i.emissiveIntensity=1,i.environmentIntensity=1,i.specularIntensity=1,i.disableBumpMap=!1,i.ambientTextureStrength=1,i.ambientTextureImpactOnAnalyticalLights=n.DEFAULT_AO_ON_ANALYTICAL_LIGHTS,i.ambientColor=new Pe.Color3(0,0,0),i.albedoColor=new Pe.Color3(1,1,1),i.reflectivityColor=new Pe.Color3(1,1,1),i.reflectionColor=new Pe.Color3(1,1,1),i.emissiveColor=new Pe.Color3(0,0,0),i.microSurface=1,i.indexOfRefraction=.66,i.invertRefractionY=!1,i.linkRefractionWithTransparency=!1,i.useLightmapAsShadowmap=!1,i.useAlphaFromAlbedoTexture=!1,i.forceAlphaTest=!1,i.alphaCutOff=.4,i.useSpecularOverAlpha=!0,i.useMicroSurfaceFromReflectivityMapAlpha=!1,i.useRoughnessFromMetallicTextureAlpha=!0,i.useRoughnessFromMetallicTextureGreen=!1,i.useMetallnessFromMetallicTextureBlue=!1,i.useAmbientOcclusionFromMetallicTextureRed=!1,i.useAmbientInGrayScale=!1,i.useAutoMicroSurfaceFromReflectivityMap=!1,i.useRadianceOverAlpha=!0,i.useObjectSpaceNormalMap=!1,i.useParallax=!1,i.useParallaxOcclusion=!1,i.parallaxScaleBias=.05,i.disableLighting=!1,i.forceIrradianceInFragment=!1,i.maxSimultaneousLights=4,i.invertNormalMapX=!1,i.invertNormalMapY=!1,i.twoSidedLighting=!1,i.useAlphaFresnel=!1,i.useLinearAlphaFresnel=!1,i.environmentBRDFTexture=null,i.forceNormalForward=!1,i.enableSpecularAntiAliasing=!1,i.useHorizonOcclusion=!0,i.useRadianceOcclusion=!0,i.unlit=!1,i._environmentBRDFTexture=Pe.TextureTools.GetEnvironmentBRDFTexture(t),i}return T(n,r),Object.defineProperty(n.prototype,"usePhysicalLightFalloff",{get:function(){return this._lightFalloff===Pe.PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL},set:function(e){e!==this.usePhysicalLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Pe.PBRBaseMaterial.LIGHTFALLOFF_PHYSICAL:Pe.PBRBaseMaterial.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"useGLTFLightFalloff",{get:function(){return this._lightFalloff===Pe.PBRBaseMaterial.LIGHTFALLOFF_GLTF},set:function(e){e!==this.useGLTFLightFalloff&&(this._markAllSubMeshesAsTexturesDirty(),this._lightFalloff=e?Pe.PBRBaseMaterial.LIGHTFALLOFF_GLTF:Pe.PBRBaseMaterial.LIGHTFALLOFF_STANDARD)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this._imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorCurves",{get:function(){return this._imageProcessingConfiguration.colorCurves},set:function(e){this._imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),n.prototype.getClassName=function(){return"PBRMaterial"},n.prototype.getActiveTextures=function(){var e=r.prototype.getActiveTextures.call(this);return this._albedoTexture&&e.push(this._albedoTexture),this._ambientTexture&&e.push(this._ambientTexture),this._opacityTexture&&e.push(this._opacityTexture),this._reflectionTexture&&e.push(this._reflectionTexture),this._emissiveTexture&&e.push(this._emissiveTexture),this._reflectivityTexture&&e.push(this._reflectivityTexture),this._metallicTexture&&e.push(this._metallicTexture),this._microSurfaceTexture&&e.push(this._microSurfaceTexture),this._bumpTexture&&e.push(this._bumpTexture),this._lightmapTexture&&e.push(this._lightmapTexture),this._refractionTexture&&e.push(this._refractionTexture),e},n.prototype.hasTexture=function(e){return!!r.prototype.hasTexture.call(this,e)||(this._albedoTexture===e||(this._ambientTexture===e||(this._opacityTexture===e||(this._reflectionTexture===e||(this._reflectivityTexture===e||(this._metallicTexture===e||(this._microSurfaceTexture===e||(this._bumpTexture===e||(this._lightmapTexture===e||this._refractionTexture===e)))))))))},n.prototype.clone=function(e){var t=this,i=Pe.SerializationHelper.Clone((function(){return new n(e,t.getScene())}),this);return i.id=e,i.name=e,i},n.prototype.serialize=function(){var e=Pe.SerializationHelper.Serialize(this);return e.customType="BABYLON.PBRMaterial",e},n.Parse=function(e,t,i){return Pe.SerializationHelper.Parse((function(){return new n(e.name,t)}),e,t,i)},n.PBRMATERIAL_OPAQUE=0,n.PBRMATERIAL_ALPHATEST=1,n.PBRMATERIAL_ALPHABLEND=2,n.PBRMATERIAL_ALPHATESTANDBLEND=3,n.DEFAULT_AO_ON_ANALYTICAL_LIGHTS=1,b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"directIntensity",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"emissiveIntensity",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"environmentIntensity",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"specularIntensity",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"disableBumpMap",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"albedoTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"ambientTexture",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"ambientTextureStrength",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"ambientTextureImpactOnAnalyticalLights",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],n.prototype,"opacityTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"emissiveTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectivityTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"metallicTexture",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"metallic",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"roughness",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"microSurfaceTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"bumpTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty",null)],n.prototype,"lightmapTexture",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"refractionTexture",void 0),b([Pe.serializeAsColor3("ambient"),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"ambientColor",void 0),b([Pe.serializeAsColor3("albedo"),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"albedoColor",void 0),b([Pe.serializeAsColor3("reflectivity"),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectivityColor",void 0),b([Pe.serializeAsColor3("reflection"),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionColor",void 0),b([Pe.serializeAsColor3("emissive"),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"emissiveColor",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"microSurface",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"indexOfRefraction",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"invertRefractionY",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"linkRefractionWithTransparency",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useLightmapAsShadowmap",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],n.prototype,"useAlphaFromAlbedoTexture",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],n.prototype,"forceAlphaTest",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesAndMiscDirty")],n.prototype,"alphaCutOff",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useSpecularOverAlpha",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useMicroSurfaceFromReflectivityMapAlpha",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useRoughnessFromMetallicTextureAlpha",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useRoughnessFromMetallicTextureGreen",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useMetallnessFromMetallicTextureBlue",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useAmbientOcclusionFromMetallicTextureRed",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useAmbientInGrayScale",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useAutoMicroSurfaceFromReflectivityMap",void 0),b([Pe.serialize()],n.prototype,"usePhysicalLightFalloff",null),b([Pe.serialize()],n.prototype,"useGLTFLightFalloff",null),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useRadianceOverAlpha",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useObjectSpaceNormalMap",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useParallax",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useParallaxOcclusion",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"parallaxScaleBias",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"disableLighting",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"forceIrradianceInFragment",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"maxSimultaneousLights",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"invertNormalMapX",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"invertNormalMapY",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"twoSidedLighting",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useAlphaFresnel",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useLinearAlphaFresnel",void 0),b([Pe.serializeAsTexture(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"environmentBRDFTexture",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"forceNormalForward",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"enableSpecularAntiAliasing",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useHorizonOcclusion",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useRadianceOcclusion",void 0),b([Pe.serialize(),Pe.expandToProperty("_markAllSubMeshesAsMiscDirty")],n.prototype,"unlit",void 0),n})(Pe.PBRBaseMaterial),Pe.PBRMaterial=Ae,Se=$a||($a={}),Me=(function(r){function n(e,t){var i=r.call(this,e,t)||this;return i._useRoughnessFromMetallicTextureAlpha=!1,i._useRoughnessFromMetallicTextureGreen=!0,i._useMetallnessFromMetallicTextureBlue=!0,i.metallic=1,i.roughness=1,i}return T(n,r),n.prototype.getClassName=function(){return"PBRMetallicRoughnessMaterial"},n.prototype.getActiveTextures=function(){var e=r.prototype.getActiveTextures.call(this);return this.baseTexture&&e.push(this.baseTexture),this.metallicRoughnessTexture&&e.push(this.metallicRoughnessTexture),e},n.prototype.hasTexture=function(e){return!!r.prototype.hasTexture.call(this,e)||(this.baseTexture===e||this.metallicRoughnessTexture===e)},n.prototype.clone=function(e){var t=this,i=Se.SerializationHelper.Clone((function(){return new n(e,t.getScene())}),this);return i.id=e,i.name=e,i},n.prototype.serialize=function(){var e=Se.SerializationHelper.Serialize(this);return e.customType="BABYLON.PBRMetallicRoughnessMaterial",e},n.Parse=function(e,t,i){return Se.SerializationHelper.Parse((function(){return new n(e.name,t)}),e,t,i)},b([Se.serializeAsColor3(),Se.expandToProperty("_markAllSubMeshesAsTexturesDirty","_albedoColor")],n.prototype,"baseColor",void 0),b([Se.serializeAsTexture(),Se.expandToProperty("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],n.prototype,"baseTexture",void 0),b([Se.serialize(),Se.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"metallic",void 0),b([Se.serialize(),Se.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"roughness",void 0),b([Se.serializeAsTexture(),Se.expandToProperty("_markAllSubMeshesAsTexturesDirty","_metallicTexture")],n.prototype,"metallicRoughnessTexture",void 0),n})(Se.PBRBaseSimpleMaterial),Se.PBRMetallicRoughnessMaterial=Me,Re=$a||($a={}),Ce=(function(r){function n(e,t){var i=r.call(this,e,t)||this;return i._useMicroSurfaceFromReflectivityMapAlpha=!0,i}return T(n,r),n.prototype.getClassName=function(){return"PBRSpecularGlossinessMaterial"},n.prototype.getActiveTextures=function(){var e=r.prototype.getActiveTextures.call(this);return this.diffuseTexture&&e.push(this.diffuseTexture),this.specularGlossinessTexture&&e.push(this.specularGlossinessTexture),e},n.prototype.hasTexture=function(e){return!!r.prototype.hasTexture.call(this,e)||(this.diffuseTexture===e||this.specularGlossinessTexture===e)},n.prototype.clone=function(e){var t=this,i=Re.SerializationHelper.Clone((function(){return new n(e,t.getScene())}),this);return i.id=e,i.name=e,i},n.prototype.serialize=function(){var e=Re.SerializationHelper.Serialize(this);return e.customType="BABYLON.PBRSpecularGlossinessMaterial",e},n.Parse=function(e,t,i){return Re.SerializationHelper.Parse((function(){return new n(e.name,t)}),e,t,i)},b([Re.serializeAsColor3("diffuse"),Re.expandToProperty("_markAllSubMeshesAsTexturesDirty","_albedoColor")],n.prototype,"diffuseColor",void 0),b([Re.serializeAsTexture(),Re.expandToProperty("_markAllSubMeshesAsTexturesDirty","_albedoTexture")],n.prototype,"diffuseTexture",void 0),b([Re.serializeAsColor3("specular"),Re.expandToProperty("_markAllSubMeshesAsTexturesDirty","_reflectivityColor")],n.prototype,"specularColor",void 0),b([Re.serialize(),Re.expandToProperty("_markAllSubMeshesAsTexturesDirty","_microSurface")],n.prototype,"glossiness",void 0),b([Re.serializeAsTexture(),Re.expandToProperty("_markAllSubMeshesAsTexturesDirty","_reflectivityTexture")],n.prototype,"specularGlossinessTexture",void 0),n})(Re.PBRBaseSimpleMaterial),Re.PBRSpecularGlossinessMaterial=Ce,(function(s){s.CameraInputTypes={};var e=(function(){function e(e){this.attached={},this.camera=e,this.checkInputs=function(){}}return e.prototype.add=function(e){var t=e.getSimpleName();this.attached[t]?s.Tools.Warn("camera input of type "+t+" already exists on camera"):((this.attached[t]=e).camera=this.camera,e.checkInputs&&(this.checkInputs=this._addCheckInputs(e.checkInputs.bind(e))),this.attachedElement&&e.attachControl(this.attachedElement))},e.prototype.remove=function(e){for(var t in this.attached){var i=this.attached[t];i===e&&(i.detachControl(this.attachedElement),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},e.prototype.removeByType=function(e){for(var t in this.attached){var i=this.attached[t];i.getClassName()===e&&(i.detachControl(this.attachedElement),i.camera=null,delete this.attached[t],this.rebuildInputCheck())}},e.prototype._addCheckInputs=function(e){var t=this.checkInputs;return function(){t(),e()}},e.prototype.attachInput=function(e){this.attachedElement&&e.attachControl(this.attachedElement,this.noPreventDefault)},e.prototype.attachElement=function(e,t){if(void 0===t&&(t=!1),!this.attachedElement)for(var i in t=!s.Camera.ForceAttachControlToAlwaysPreventDefault&&t,this.attachedElement=e,this.noPreventDefault=t,this.attached)this.attached[i].attachControl(e,t)},e.prototype.detachElement=function(e,t){if(void 0===t&&(t=!1),this.attachedElement===e){for(var i in this.attached)this.attached[i].detachControl(e),t&&(this.attached[i].camera=null);this.attachedElement=null}},e.prototype.rebuildInputCheck=function(){for(var e in this.checkInputs=function(){},this.attached){var t=this.attached[e];t.checkInputs&&(this.checkInputs=this._addCheckInputs(t.checkInputs.bind(t)))}},e.prototype.clear=function(){this.attachedElement&&this.detachElement(this.attachedElement,!0),this.attached={},this.attachedElement=null,this.checkInputs=function(){}},e.prototype.serialize=function(e){var t={};for(var i in this.attached){var r=this.attached[i],n=s.SerializationHelper.Serialize(r);t[r.getClassName()]=n}e.inputsmgr=t},e.prototype.parse=function(e){var t=e.inputsmgr;if(t)for(var i in this.clear(),t){if(o=s.CameraInputTypes[i]){var r=t[i],n=s.SerializationHelper.Parse((function(){return new o}),r,null);this.add(n)}}else for(var i in this.attached){var o;if(o=s.CameraInputTypes[this.attached[i].getClassName()]){n=s.SerializationHelper.Parse((function(){return new o}),e,null);this.remove(this.attached[i]),this.add(n)}}},e})();s.CameraInputsManager=e})($a||($a={})),Oe=$a||($a={}),De=(function(o){function r(e,t,i,r){void 0===r&&(r=!0);var n=o.call(this,e,t,i,r)||this;return n.cameraDirection=new Oe.Vector3(0,0,0),n.cameraRotation=new Oe.Vector2(0,0),n.rotation=new Oe.Vector3(0,0,0),n.speed=2,n.noRotationConstraint=!1,n.lockedTarget=null,n._currentTarget=Oe.Vector3.Zero(),n._viewMatrix=Oe.Matrix.Zero(),n._camMatrix=Oe.Matrix.Zero(),n._cameraTransformMatrix=Oe.Matrix.Zero(),n._cameraRotationMatrix=Oe.Matrix.Zero(),n._referencePoint=new Oe.Vector3(0,0,1),n._transformedReferencePoint=Oe.Vector3.Zero(),n._globalCurrentTarget=Oe.Vector3.Zero(),n._globalCurrentUpVector=Oe.Vector3.Zero(),n._defaultUp=Oe.Vector3.Up(),n._cachedRotationZ=0,n._cachedQuaternionRotationZ=0,n}return T(r,o),r.prototype.getFrontPosition=function(e){this.getWorldMatrix();var t=this.getTarget().subtract(this.position);return t.normalize(),t.scaleInPlace(e),this.globalPosition.add(t)},r.prototype._getLockedTargetPosition=function(){return this.lockedTarget?(this.lockedTarget.absolutePosition&&this.lockedTarget.computeWorldMatrix(),this.lockedTarget.absolutePosition||this.lockedTarget):null},r.prototype.storeState=function(){return this._storedPosition=this.position.clone(),this._storedRotation=this.rotation.clone(),this.rotationQuaternion&&(this._storedRotationQuaternion=this.rotationQuaternion.clone()),o.prototype.storeState.call(this)},r.prototype._restoreStateValues=function(){return!!o.prototype._restoreStateValues.call(this)&&(this.position=this._storedPosition.clone(),this.rotation=this._storedRotation.clone(),this.rotationQuaternion&&(this.rotationQuaternion=this._storedRotationQuaternion.clone()),this.cameraDirection.copyFromFloats(0,0,0),this.cameraRotation.copyFromFloats(0,0),!0)},r.prototype._initCache=function(){o.prototype._initCache.call(this),this._cache.lockedTarget=new Oe.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotation=new Oe.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.rotationQuaternion=new Oe.Quaternion(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE)},r.prototype._updateCache=function(e){e||o.prototype._updateCache.call(this);var t=this._getLockedTargetPosition();t?this._cache.lockedTarget?this._cache.lockedTarget.copyFrom(t):this._cache.lockedTarget=t.clone():this._cache.lockedTarget=null,this._cache.rotation.copyFrom(this.rotation),this.rotationQuaternion&&this._cache.rotationQuaternion.copyFrom(this.rotationQuaternion)},r.prototype._isSynchronizedViewMatrix=function(){if(!o.prototype._isSynchronizedViewMatrix.call(this))return!1;var e=this._getLockedTargetPosition();return(this._cache.lockedTarget?this._cache.lockedTarget.equals(e):!e)&&(this.rotationQuaternion?this.rotationQuaternion.equals(this._cache.rotationQuaternion):this._cache.rotation.equals(this.rotation))},r.prototype._computeLocalCameraSpeed=function(){var e=this.getEngine();return this.speed*Math.sqrt(e.getDeltaTime()/(100*e.getFps()))},r.prototype.setTarget=function(e){this.upVector.normalize(),this.position.z===e.z&&(this.position.z+=Oe.Epsilon),Oe.Matrix.LookAtLHToRef(this.position,e,this._defaultUp,this._camMatrix),this._camMatrix.invert(),this.rotation.x=Math.atan(this._camMatrix.m[6]/this._camMatrix.m[10]);var t=e.subtract(this.position);0<=t.x?this.rotation.y=-Math.atan(t.z/t.x)+Math.PI/2:this.rotation.y=-Math.atan(t.z/t.x)-Math.PI/2,this.rotation.z=0,isNaN(this.rotation.x)&&(this.rotation.x=0),isNaN(this.rotation.y)&&(this.rotation.y=0),isNaN(this.rotation.z)&&(this.rotation.z=0),this.rotationQuaternion&&Oe.Quaternion.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion)},r.prototype.getTarget=function(){return this._currentTarget},r.prototype._decideIfNeedsToMove=function(){return 0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},r.prototype._updatePosition=function(){if(this.parent)return this.parent.getWorldMatrix().invertToRef(Oe.Tmp.Matrix[0]),Oe.Vector3.TransformNormalToRef(this.cameraDirection,Oe.Tmp.Matrix[0],Oe.Tmp.Vector3[0]),void this.position.addInPlace(Oe.Tmp.Vector3[0]);this.position.addInPlace(this.cameraDirection)},r.prototype._checkInputs=function(){var e=this._decideIfNeedsToMove(),t=0<Math.abs(this.cameraRotation.x)||0<Math.abs(this.cameraRotation.y);if(e&&this._updatePosition(),t){if(this.rotation.x+=this.cameraRotation.x,this.rotation.y+=this.cameraRotation.y,this.rotationQuaternion)this.rotation.lengthSquared()&&Oe.Quaternion.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this.rotationQuaternion);if(!this.noRotationConstraint){var i=Math.PI/2*.95;this.rotation.x>i&&(this.rotation.x=i),this.rotation.x<-i&&(this.rotation.x=-i)}}e&&(Math.abs(this.cameraDirection.x)<this.speed*Oe.Epsilon&&(this.cameraDirection.x=0),Math.abs(this.cameraDirection.y)<this.speed*Oe.Epsilon&&(this.cameraDirection.y=0),Math.abs(this.cameraDirection.z)<this.speed*Oe.Epsilon&&(this.cameraDirection.z=0),this.cameraDirection.scaleInPlace(this.inertia)),t&&(Math.abs(this.cameraRotation.x)<this.speed*Oe.Epsilon&&(this.cameraRotation.x=0),Math.abs(this.cameraRotation.y)<this.speed*Oe.Epsilon&&(this.cameraRotation.y=0),this.cameraRotation.scaleInPlace(this.inertia)),o.prototype._checkInputs.call(this)},r.prototype._updateCameraRotationMatrix=function(){this.rotationQuaternion?this.rotationQuaternion.toRotationMatrix(this._cameraRotationMatrix):Oe.Matrix.RotationYawPitchRollToRef(this.rotation.y,this.rotation.x,this.rotation.z,this._cameraRotationMatrix)},r.prototype._rotateUpVectorWithCameraRotationMatrix=function(){return Oe.Vector3.TransformNormalToRef(this._defaultUp,this._cameraRotationMatrix,this.upVector),this},r.prototype._getViewMatrix=function(){return this.lockedTarget&&this.setTarget(this._getLockedTargetPosition()),this._updateCameraRotationMatrix(),this.rotationQuaternion&&this._cachedQuaternionRotationZ!=this.rotationQuaternion.z?(this._rotateUpVectorWithCameraRotationMatrix(),this._cachedQuaternionRotationZ=this.rotationQuaternion.z):this._cachedRotationZ!=this.rotation.z&&(this._rotateUpVectorWithCameraRotationMatrix(),this._cachedRotationZ=this.rotation.z),Oe.Vector3.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),this._computeViewMatrix(this.position,this._currentTarget,this.upVector),this._viewMatrix},r.prototype._computeViewMatrix=function(e,t,i){if(this.parent){var r=this.parent.getWorldMatrix();Oe.Vector3.TransformCoordinatesToRef(e,r,this._globalPosition),Oe.Vector3.TransformCoordinatesToRef(t,r,this._globalCurrentTarget),Oe.Vector3.TransformNormalToRef(i,r,this._globalCurrentUpVector),this._markSyncedWithParent()}else this._globalPosition.copyFrom(e),this._globalCurrentTarget.copyFrom(t),this._globalCurrentUpVector.copyFrom(i);this.getScene().useRightHandedSystem?Oe.Matrix.LookAtRHToRef(this._globalPosition,this._globalCurrentTarget,this._globalCurrentUpVector,this._viewMatrix):Oe.Matrix.LookAtLHToRef(this._globalPosition,this._globalCurrentTarget,this._globalCurrentUpVector,this._viewMatrix)},r.prototype.createRigCamera=function(e,t){if(this.cameraRigMode!==Oe.Camera.RIG_MODE_NONE){var i=new r(e,this.position.clone(),this.getScene());return this.cameraRigMode!==Oe.Camera.RIG_MODE_VR&&this.cameraRigMode!==Oe.Camera.RIG_MODE_WEBVR||(this.rotationQuaternion||(this.rotationQuaternion=new Oe.Quaternion),i._cameraRigParams={},i.rotationQuaternion=new Oe.Quaternion),i}return null},r.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];switch(this.cameraRigMode){case Oe.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case Oe.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case Oe.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:case Oe.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:var i=this.cameraRigMode===Oe.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?1:-1,r=this.cameraRigMode===Oe.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED?-1:1;this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle*i,e.position),this._getRigCamPosition(this._cameraRigParams.stereoHalfAngle*r,t.position),e.setTarget(this.getTarget()),t.setTarget(this.getTarget());break;case Oe.Camera.RIG_MODE_VR:e.rotationQuaternion?(e.rotationQuaternion.copyFrom(this.rotationQuaternion),t.rotationQuaternion.copyFrom(this.rotationQuaternion)):(e.rotation.copyFrom(this.rotation),t.rotation.copyFrom(this.rotation)),e.position.copyFrom(this.position),t.position.copyFrom(this.position)}o.prototype._updateRigCameras.call(this)},r.prototype._getRigCamPosition=function(e,t){this._rigCamTransformMatrix||(this._rigCamTransformMatrix=new Oe.Matrix);var i=this.getTarget();Oe.Matrix.Translation(-i.x,-i.y,-i.z).multiplyToRef(Oe.Matrix.RotationY(e),this._rigCamTransformMatrix),this._rigCamTransformMatrix=this._rigCamTransformMatrix.multiply(Oe.Matrix.Translation(i.x,i.y,i.z)),Oe.Vector3.TransformCoordinatesToRef(this.position,this._rigCamTransformMatrix,t)},r.prototype.getClassName=function(){return"TargetCamera"},b([Oe.serializeAsVector3()],r.prototype,"rotation",void 0),b([Oe.serialize()],r.prototype,"speed",void 0),b([Oe.serializeAsMeshReference("lockedTargetId")],r.prototype,"lockedTarget",void 0),r})(Oe.Camera),Oe.TargetCamera=De,Ie=$a||($a={}),we=(function(){function e(e){void 0===e&&(e=!0),this.touchEnabled=e,this.buttons=[0,1,2],this.angularSensibility=2e3,this.previousPosition=null}return e.prototype.attachControl=function(s,a){var l=this,c=this.camera.getEngine();this._pointerInput||(this._pointerInput=function(e,t){var i=e.event;if(!c.isInVRExclusivePointerMode&&(l.touchEnabled||"touch"!==i.pointerType)&&(e.type===Ie.PointerEventTypes.POINTERMOVE||-1!==l.buttons.indexOf(i.button))){var r=i.srcElement||i.target;if(e.type===Ie.PointerEventTypes.POINTERDOWN&&r){try{r.setPointerCapture(i.pointerId)}catch(e){}l.previousPosition={x:i.clientX,y:i.clientY},a||(i.preventDefault(),s.focus())}else if(e.type===Ie.PointerEventTypes.POINTERUP&&r){try{r.releasePointerCapture(i.pointerId)}catch(e){}l.previousPosition=null,a||i.preventDefault()}else if(e.type===Ie.PointerEventTypes.POINTERMOVE){if(!l.previousPosition||c.isPointerLock)return;var n=i.clientX-l.previousPosition.x;l.camera.getScene().useRightHandedSystem&&(n*=-1),l.camera.parent&&l.camera.parent._getWorldMatrixDeterminant()<0&&(n*=-1),l.camera.cameraRotation.y+=n/l.angularSensibility;var o=i.clientY-l.previousPosition.y;l.camera.cameraRotation.x+=o/l.angularSensibility,l.previousPosition={x:i.clientX,y:i.clientY},a||i.preventDefault()}}}),this._onMouseMove=function(e){if(c.isPointerLock&&!c.isInVRExclusivePointerMode){var t=e.movementX||e.mozMovementX||e.webkitMovementX||e.msMovementX||0;l.camera.getScene().useRightHandedSystem&&(t*=-1),l.camera.parent&&l.camera.parent._getWorldMatrixDeterminant()<0&&(t*=-1),l.camera.cameraRotation.y+=t/l.angularSensibility;var i=e.movementY||e.mozMovementY||e.webkitMovementY||e.msMovementY||0;l.camera.cameraRotation.x+=i/l.angularSensibility,l.previousPosition=null,a||e.preventDefault()}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,Ie.PointerEventTypes.POINTERDOWN|Ie.PointerEventTypes.POINTERUP|Ie.PointerEventTypes.POINTERMOVE),s.addEventListener("mousemove",this._onMouseMove,!1)},e.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._onMouseMove&&e.removeEventListener("mousemove",this._onMouseMove),this._observer=null,this._onMouseMove=null,this.previousPosition=null)},e.prototype.getClassName=function(){return"FreeCameraMouseInput"},e.prototype.getSimpleName=function(){return"mouse"},b([Ie.serialize()],e.prototype,"buttons",void 0),b([Ie.serialize()],e.prototype,"angularSensibility",void 0),e})(),Ie.FreeCameraMouseInput=we,Ie.CameraInputTypes.FreeCameraMouseInput=we,Le=$a||($a={}),Fe=(function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this._keys=new Array}return e.prototype.attachControl=function(e,r){var n=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){n._keys=[]})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(e){var t,i=e.event;e.type===Le.KeyboardEventTypes.KEYDOWN?-1===n.keysUp.indexOf(i.keyCode)&&-1===n.keysDown.indexOf(i.keyCode)&&-1===n.keysLeft.indexOf(i.keyCode)&&-1===n.keysRight.indexOf(i.keyCode)||(-1===(t=n._keys.indexOf(i.keyCode))&&n._keys.push(i.keyCode),r||i.preventDefault()):-1===n.keysUp.indexOf(i.keyCode)&&-1===n.keysDown.indexOf(i.keyCode)&&-1===n.keysLeft.indexOf(i.keyCode)&&-1===n.keysRight.indexOf(i.keyCode)||(0<=(t=n._keys.indexOf(i.keyCode))&&n._keys.splice(t,1),r||i.preventDefault())})))},e.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t],r=e._computeLocalCameraSpeed();-1!==this.keysLeft.indexOf(i)?e._localDirection.copyFromFloats(-r,0,0):-1!==this.keysUp.indexOf(i)?e._localDirection.copyFromFloats(0,0,r):-1!==this.keysRight.indexOf(i)?e._localDirection.copyFromFloats(r,0,0):-1!==this.keysDown.indexOf(i)&&e._localDirection.copyFromFloats(0,0,-r),e.getScene().useRightHandedSystem&&(e._localDirection.z*=-1),e.getViewMatrix().invertToRef(e._cameraTransformMatrix),Le.Vector3.TransformNormalToRef(e._localDirection,e._cameraTransformMatrix,e._transformedDirection),e.cameraDirection.addInPlace(e._transformedDirection)}},e.prototype.getClassName=function(){return"FreeCameraKeyboardMoveInput"},e.prototype._onLostFocus=function(e){this._keys=[]},e.prototype.getSimpleName=function(){return"keyboard"},b([Le.serialize()],e.prototype,"keysUp",void 0),b([Le.serialize()],e.prototype,"keysDown",void 0),b([Le.serialize()],e.prototype,"keysLeft",void 0),b([Le.serialize()],e.prototype,"keysRight",void 0),e})(),Le.FreeCameraKeyboardMoveInput=Fe,Le.CameraInputTypes.FreeCameraKeyboardMoveInput=Fe,Be=$a||($a={}),Ne=(function(t){function e(e){return t.call(this,e)||this}return T(e,t),e.prototype.addKeyboard=function(){return this.add(new Be.FreeCameraKeyboardMoveInput),this},e.prototype.addMouse=function(e){return void 0===e&&(e=!0),this.add(new Be.FreeCameraMouseInput(e)),this},e.prototype.addDeviceOrientation=function(){return this.add(new Be.FreeCameraDeviceOrientationInput),this},e.prototype.addTouch=function(){return this.add(new Be.FreeCameraTouchInput),this},e.prototype.addVirtualJoystick=function(){return this.add(new Be.FreeCameraVirtualJoystickInput),this},e})(Be.CameraInputsManager),Be.FreeCameraInputsManager=Ne,(function(s){s.Node.AddNodeConstructor("FreeCamera",(function(e,t){return function(){return new s.UniversalCamera(e,s.Vector3.Zero(),t)}}));var e=(function(o){function e(e,t,i,r){void 0===r&&(r=!0);var n=o.call(this,e,t,i,r)||this;return n.ellipsoid=new s.Vector3(.5,1,.5),n.ellipsoidOffset=new s.Vector3(0,0,0),n.checkCollisions=!1,n.applyGravity=!1,n._needMoveForGravity=!1,n._oldPosition=s.Vector3.Zero(),n._diffPosition=s.Vector3.Zero(),n._newPosition=s.Vector3.Zero(),n._collisionMask=-1,n._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),n.getScene().workerCollisions&&t.multiplyInPlace(n._collider._radius);var r;r=t,n._newPosition.copyFrom(r),n._newPosition.subtractToRef(n._oldPosition,n._diffPosition),n._diffPosition.length()>s.Engine.CollisionsEpsilon&&(n.position.addInPlace(n._diffPosition),n.onCollide&&i&&n.onCollide(i))},n.inputs=new s.FreeCameraInputsManager(n),n.inputs.addKeyboard().addMouse(),n}return T(e,o),Object.defineProperty(e.prototype,"angularSensibility",{get:function(){var e=this.inputs.attached.mouse;return e?e.angularSensibility:0},set:function(e){var t=this.inputs.attached.mouse;t&&(t.angularSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!0,configurable:!0}),e.prototype.attachControl=function(e,t){this.inputs.attachElement(e,t)},e.prototype.detachControl=function(e){this.inputs.detachElement(e),this.cameraDirection=new s.Vector3(0,0,0),this.cameraRotation=new s.Vector2(0,0)},Object.defineProperty(e.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),e.prototype._collideWithWorld=function(e){(this.parent?s.Vector3.TransformCoordinates(this.position,this.parent.getWorldMatrix()):this.position).subtractFromFloatsToRef(0,this.ellipsoid.y,0,this._oldPosition),this._oldPosition.addInPlace(this.ellipsoidOffset),this._collider||(this._collider=new s.Collider),this._collider._radius=this.ellipsoid,this._collider.collisionMask=this._collisionMask;var t=e;this.applyGravity&&(t=e.add(this.getScene().gravity)),this.getScene().collisionCoordinator.getNewPosition(this._oldPosition,t,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId)},e.prototype._checkInputs=function(){this._localDirection||(this._localDirection=s.Vector3.Zero(),this._transformedDirection=s.Vector3.Zero()),this.inputs.checkInputs(),o.prototype._checkInputs.call(this)},e.prototype._decideIfNeedsToMove=function(){return this._needMoveForGravity||0<Math.abs(this.cameraDirection.x)||0<Math.abs(this.cameraDirection.y)||0<Math.abs(this.cameraDirection.z)},e.prototype._updatePosition=function(){this.checkCollisions&&this.getScene().collisionsEnabled?this._collideWithWorld(this.cameraDirection):o.prototype._updatePosition.call(this)},e.prototype.dispose=function(){this.inputs.clear(),o.prototype.dispose.call(this)},e.prototype.getClassName=function(){return"FreeCamera"},b([s.serializeAsVector3()],e.prototype,"ellipsoid",void 0),b([s.serializeAsVector3()],e.prototype,"ellipsoidOffset",void 0),b([s.serialize()],e.prototype,"checkCollisions",void 0),b([s.serialize()],e.prototype,"applyGravity",void 0),e})(s.TargetCamera);s.FreeCamera=e})($a||($a={})),Ve=$a||($a={}),Ue=(function(){function e(){this.keysUp=[38],this.keysDown=[40],this.keysLeft=[37],this.keysRight=[39],this.keysReset=[220],this.panningSensibility=50,this.zoomingSensibility=25,this.useAltToZoom=!0,this.angularSpeed=.01,this._keys=new Array}return e.prototype.attachControl=function(e,r){var n=this;this._onCanvasBlurObserver||(this._scene=this.camera.getScene(),this._engine=this._scene.getEngine(),this._onCanvasBlurObserver=this._engine.onCanvasBlurObservable.add((function(){n._keys=[]})),this._onKeyboardObserver=this._scene.onKeyboardObservable.add((function(e){var t,i=e.event;e.type===Ve.KeyboardEventTypes.KEYDOWN?(n._ctrlPressed=i.ctrlKey,n._altPressed=i.altKey,(-1!==n.keysUp.indexOf(i.keyCode)||-1!==n.keysDown.indexOf(i.keyCode)||-1!==n.keysLeft.indexOf(i.keyCode)||-1!==n.keysRight.indexOf(i.keyCode)||-1!==n.keysReset.indexOf(i.keyCode))&&(-1===(t=n._keys.indexOf(i.keyCode))&&n._keys.push(i.keyCode),i.preventDefault&&(r||i.preventDefault()))):-1===n.keysUp.indexOf(i.keyCode)&&-1===n.keysDown.indexOf(i.keyCode)&&-1===n.keysLeft.indexOf(i.keyCode)&&-1===n.keysRight.indexOf(i.keyCode)&&-1===n.keysReset.indexOf(i.keyCode)||(0<=(t=n._keys.indexOf(i.keyCode))&&n._keys.splice(t,1),i.preventDefault&&(r||i.preventDefault()))})))},e.prototype.detachControl=function(e){this._scene&&(this._onKeyboardObserver&&this._scene.onKeyboardObservable.remove(this._onKeyboardObserver),this._onCanvasBlurObserver&&this._engine.onCanvasBlurObservable.remove(this._onCanvasBlurObserver),this._onKeyboardObserver=null,this._onCanvasBlurObserver=null),this._keys=[]},e.prototype.checkInputs=function(){if(this._onKeyboardObserver)for(var e=this.camera,t=0;t<this._keys.length;t++){var i=this._keys[t];-1!==this.keysLeft.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningX-=1/this.panningSensibility:e.inertialAlphaOffset-=this.angularSpeed:-1!==this.keysUp.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningY+=1/this.panningSensibility:this._altPressed&&this.useAltToZoom?e.inertialRadiusOffset+=1/this.zoomingSensibility:e.inertialBetaOffset-=this.angularSpeed:-1!==this.keysRight.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningX+=1/this.panningSensibility:e.inertialAlphaOffset+=this.angularSpeed:-1!==this.keysDown.indexOf(i)?this._ctrlPressed&&this.camera._useCtrlForPanning?e.inertialPanningY-=1/this.panningSensibility:this._altPressed&&this.useAltToZoom?e.inertialRadiusOffset-=1/this.zoomingSensibility:e.inertialBetaOffset+=this.angularSpeed:-1!==this.keysReset.indexOf(i)&&e.useInputToRestoreState&&e.restoreState()}},e.prototype.getClassName=function(){return"ArcRotateCameraKeyboardMoveInput"},e.prototype.getSimpleName=function(){return"keyboard"},b([Ve.serialize()],e.prototype,"keysUp",void 0),b([Ve.serialize()],e.prototype,"keysDown",void 0),b([Ve.serialize()],e.prototype,"keysLeft",void 0),b([Ve.serialize()],e.prototype,"keysRight",void 0),b([Ve.serialize()],e.prototype,"keysReset",void 0),b([Ve.serialize()],e.prototype,"panningSensibility",void 0),b([Ve.serialize()],e.prototype,"zoomingSensibility",void 0),b([Ve.serialize()],e.prototype,"useAltToZoom",void 0),b([Ve.serialize()],e.prototype,"angularSpeed",void 0),e})(),Ve.ArcRotateCameraKeyboardMoveInput=Ue,Ve.CameraInputTypes.ArcRotateCameraKeyboardMoveInput=Ue,ze=$a||($a={}),Ge=(function(){function e(){this.wheelPrecision=3,this.wheelDeltaPercentage=0}return e.prototype.attachControl=function(e,o){var s=this;this._wheel=function(e,t){if(e.type===ze.PointerEventTypes.POINTERWHEEL){var i=e.event,r=0;if(i.wheelDelta)if(s.wheelDeltaPercentage){var n=.01*i.wheelDelta*s.wheelDeltaPercentage*s.camera.radius;r=0<i.wheelDelta?n/(1+s.wheelDeltaPercentage):n*(1+s.wheelDeltaPercentage)}else r=i.wheelDelta/(40*s.wheelPrecision);else i.detail&&(r=-i.detail/s.wheelPrecision);r&&(s.camera.inertialRadiusOffset+=r),i.preventDefault&&(o||i.preventDefault())}},this._observer=this.camera.getScene().onPointerObservable.add(this._wheel,ze.PointerEventTypes.POINTERWHEEL)},e.prototype.detachControl=function(e){this._observer&&e&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._wheel=null)},e.prototype.getClassName=function(){return"ArcRotateCameraMouseWheelInput"},e.prototype.getSimpleName=function(){return"mousewheel"},b([ze.serialize()],e.prototype,"wheelPrecision",void 0),b([ze.serialize()],e.prototype,"wheelDeltaPercentage",void 0),e})(),ze.ArcRotateCameraMouseWheelInput=Ge,ze.CameraInputTypes.ArcRotateCameraMouseWheelInput=Ge,ke=$a||($a={}),We=(function(){function e(){this.buttons=[0,1,2],this.angularSensibilityX=1e3,this.angularSensibilityY=1e3,this.pinchPrecision=12,this.pinchDeltaPercentage=0,this.panningSensibility=1e3,this.multiTouchPanning=!0,this.multiTouchPanAndZoom=!0,this.pinchInwards=!0,this._isPanClick=!1}return e.prototype.attachControl=function(g,v){var y,b=this,T=this.camera.getEngine(),E=null,x=null,P=0,A=0,S=0,M={x:0,y:0,isPaning:!1,isPinching:!1};this._pointerInput=function(e,t){var i=e.event,r="touch"===e.event.pointerType;if(!T.isInVRExclusivePointerMode&&(e.type===ke.PointerEventTypes.POINTERMOVE||-1!==b.buttons.indexOf(i.button))){var n=i.srcElement||i.target;if(e.type===ke.PointerEventTypes.POINTERDOWN&&n){try{n.setPointerCapture(i.pointerId)}catch(e){}b._isPanClick=i.button===b.camera._panningMouseButton,y={x:i.clientX,y:i.clientY,pointerId:i.pointerId,type:i.pointerType},null===E?E=y:null===x&&(x=y),v||(i.preventDefault(),g.focus())}else if(e.type===ke.PointerEventTypes.POINTERDOUBLETAP)b.camera.useInputToRestoreState&&b.camera.restoreState();else if(e.type===ke.PointerEventTypes.POINTERUP&&n){try{n.releasePointerCapture(i.pointerId)}catch(e){}y=null,P=0,M.isPaning=!1,M.isPinching=!1,A=S=0,r||(x=null),T._badOS?E=x=null:x&&E&&E.pointerId==i.pointerId?(E=x,x=null,y={x:E.x,y:E.y,pointerId:E.pointerId,type:i.pointerType}):E&&x&&x.pointerId==i.pointerId?(x=null,y={x:E.x,y:E.y,pointerId:E.pointerId,type:i.pointerType}):E=x=null,v||i.preventDefault()}else if(e.type===ke.PointerEventTypes.POINTERMOVE)if(v||i.preventDefault(),E&&null===x&&y){if(0!==b.panningSensibility&&(i.ctrlKey&&b.camera._useCtrlForPanning||b._isPanClick))b.camera.inertialPanningX+=-(i.clientX-y.x)/b.panningSensibility,b.camera.inertialPanningY+=(i.clientY-y.y)/b.panningSensibility;else{var o=i.clientX-y.x,s=i.clientY-y.y;b.camera.inertialAlphaOffset-=o/b.angularSensibilityX,b.camera.inertialBetaOffset-=s/b.angularSensibilityY}y.x=i.clientX,y.y=i.clientY}else if(E&&x){var a=E.pointerId===i.pointerId?E:x;a.x=i.clientX,a.y=i.clientY;var l=b.pinchInwards?1:-1,c=E.x-x.x,h=E.y-x.y,u=c*c+h*h,d=Math.sqrt(u);if(0===P)return A=d,P=u,M.x=(E.x+x.x)/2,void(M.y=(E.y+x.y)/2);if(b.multiTouchPanAndZoom){if(b.pinchDeltaPercentage?b.camera.inertialRadiusOffset+=.001*(u-P)*b.camera.radius*b.pinchDeltaPercentage:b.camera.inertialRadiusOffset+=(u-P)/(b.pinchPrecision*((b.angularSensibilityX+b.angularSensibilityY)/2)*l),0!==b.panningSensibility){var f=(E.x+x.x)/2,p=(E.y+x.y)/2,_=f-M.x,m=p-M.y;M.x=f,M.y=p,b.camera.inertialPanningX+=-_/b.panningSensibility,b.camera.inertialPanningY+=m/b.panningSensibility}}else{if(S++,M.isPinching||S<20&&Math.abs(d-A)>b.camera.pinchToPanMaxDistance)b.pinchDeltaPercentage?b.camera.inertialRadiusOffset+=.001*(u-P)*b.camera.radius*b.pinchDeltaPercentage:b.camera.inertialRadiusOffset+=(u-P)/(b.pinchPrecision*((b.angularSensibilityX+b.angularSensibilityY)/2)*l),M.isPaning=!1,M.isPinching=!0;else if(y&&y.pointerId===a.pointerId&&0!==b.panningSensibility&&b.multiTouchPanning){if(!M.isPaning)return M.isPaning=!0,M.isPinching=!1,M.x=a.x,void(M.y=a.y);b.camera.inertialPanningX+=-(a.x-M.x)/b.panningSensibility,b.camera.inertialPanningY+=(a.y-M.y)/b.panningSensibility}y&&y.pointerId===i.pointerId&&(M.x=a.x,M.y=a.y)}P=u}}},this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,ke.PointerEventTypes.POINTERDOWN|ke.PointerEventTypes.POINTERUP|ke.PointerEventTypes.POINTERMOVE|ke.PointerEventTypes.POINTERDOUBLETAP),this._onContextMenu=function(e){e.preventDefault()},this.camera._useCtrlForPanning||g.addEventListener("contextmenu",this._onContextMenu,!1),this._onLostFocus=function(){E=x=null,P=0,M.isPaning=!1,M.isPinching=!1,y=null,A=S=0},this._onMouseMove=function(e){if(T.isPointerLock){var t=e.movementX||e.mozMovementX||e.webkitMovementX||e.msMovementX||0,i=e.movementY||e.mozMovementY||e.webkitMovementY||e.msMovementY||0;b.camera.inertialAlphaOffset-=t/b.angularSensibilityX,b.camera.inertialBetaOffset-=i/b.angularSensibilityY,v||e.preventDefault()}},this._onGestureStart=function(e){void 0!==window.MSGesture&&(b._MSGestureHandler||(b._MSGestureHandler=new MSGesture,b._MSGestureHandler.target=g),b._MSGestureHandler.addPointer(e.pointerId))},this._onGesture=function(e){b.camera.radius*=e.scale,e.preventDefault&&(v||(e.stopPropagation(),e.preventDefault()))},g.addEventListener("mousemove",this._onMouseMove,!1),g.addEventListener("MSPointerDown",this._onGestureStart,!1),g.addEventListener("MSGestureChange",this._onGesture,!1),ke.Tools.RegisterTopRootEvents([{name:"blur",handler:this._onLostFocus}])},e.prototype.detachControl=function(e){this._onLostFocus&&ke.Tools.UnregisterTopRootEvents([{name:"blur",handler:this._onLostFocus}]),e&&this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null,this._onContextMenu&&e.removeEventListener("contextmenu",this._onContextMenu),this._onMouseMove&&e.removeEventListener("mousemove",this._onMouseMove),this._onGestureStart&&e.removeEventListener("MSPointerDown",this._onGestureStart),this._onGesture&&e.removeEventListener("MSGestureChange",this._onGesture),this._isPanClick=!1,this.pinchInwards=!0,this._onMouseMove=null,this._onGestureStart=null,this._onGesture=null,this._MSGestureHandler=null,this._onLostFocus=null,this._onContextMenu=null)},e.prototype.getClassName=function(){return"ArcRotateCameraPointersInput"},e.prototype.getSimpleName=function(){return"pointers"},b([ke.serialize()],e.prototype,"buttons",void 0),b([ke.serialize()],e.prototype,"angularSensibilityX",void 0),b([ke.serialize()],e.prototype,"angularSensibilityY",void 0),b([ke.serialize()],e.prototype,"pinchPrecision",void 0),b([ke.serialize()],e.prototype,"pinchDeltaPercentage",void 0),b([ke.serialize()],e.prototype,"panningSensibility",void 0),b([ke.serialize()],e.prototype,"multiTouchPanning",void 0),b([ke.serialize()],e.prototype,"multiTouchPanAndZoom",void 0),e})(),ke.ArcRotateCameraPointersInput=We,ke.CameraInputTypes.ArcRotateCameraPointersInput=We,He=$a||($a={}),Xe=(function(t){function e(e){return t.call(this,e)||this}return T(e,t),e.prototype.addMouseWheel=function(){return this.add(new He.ArcRotateCameraMouseWheelInput),this},e.prototype.addPointers=function(){return this.add(new He.ArcRotateCameraPointersInput),this},e.prototype.addKeyboard=function(){return this.add(new He.ArcRotateCameraKeyboardMoveInput),this},e.prototype.addVRDeviceOrientation=function(){return this.add(new He.ArcRotateCameraVRDeviceOrientationInput),this},e})(He.CameraInputsManager),He.ArcRotateCameraInputsManager=Xe,(function(l){l.Node.AddNodeConstructor("ArcRotateCamera",(function(e,t){return function(){return new i(e,0,0,1,l.Vector3.Zero(),t)}}));var i=(function(a){function n(e,t,i,r,n,o,s){void 0===s&&(s=!0);var c=a.call(this,e,l.Vector3.Zero(),o,s)||this;return c.inertialAlphaOffset=0,c.inertialBetaOffset=0,c.inertialRadiusOffset=0,c.lowerAlphaLimit=null,c.upperAlphaLimit=null,c.lowerBetaLimit=.01,c.upperBetaLimit=Math.PI,c.lowerRadiusLimit=null,c.upperRadiusLimit=null,c.inertialPanningX=0,c.inertialPanningY=0,c.pinchToPanMaxDistance=20,c.panningDistanceLimit=null,c.panningOriginTarget=l.Vector3.Zero(),c.panningInertia=.9,c.zoomOnFactor=1,c.targetScreenOffset=l.Vector2.Zero(),c.allowUpsideDown=!0,c.useInputToRestoreState=!0,c._viewMatrix=new l.Matrix,c.panningAxis=new l.Vector3(1,1,0),c.onMeshTargetChangedObservable=new l.Observable,c.checkCollisions=!1,c.collisionRadius=new l.Vector3(.5,.5,.5),c._previousPosition=l.Vector3.Zero(),c._collisionVelocity=l.Vector3.Zero(),c._newPosition=l.Vector3.Zero(),c._computationVector=l.Vector3.Zero(),c._onCollisionPositionChange=function(e,t,i){void 0===i&&(i=null),c.getScene().workerCollisions&&c.checkCollisions&&t.multiplyInPlace(c._collider._radius),i?(c.setPosition(t),c.onCollide&&c.onCollide(i)):c._previousPosition.copyFrom(c.position);var r=Math.cos(c.alpha),n=Math.sin(c.alpha),o=Math.cos(c.beta),s=Math.sin(c.beta);0===s&&(s=1e-4);var a=c._getTargetPosition();c._computationVector.copyFromFloats(c.radius*r*s,c.radius*o,c.radius*n*s),a.addToRef(c._computationVector,c._newPosition),c.position.copyFrom(c._newPosition);var l=c.upVector;c.allowUpsideDown&&c.beta<0&&(l=(l=l.clone()).negate()),c._computeViewMatrix(c.position,a,l),c._viewMatrix.m[12]+=c.targetScreenOffset.x,c._viewMatrix.m[13]+=c.targetScreenOffset.y,c._collisionTriggered=!1},c._target=l.Vector3.Zero(),n&&c.setTarget(n),c.alpha=t,c.beta=i,c.radius=r,c.getViewMatrix(),c.inputs=new l.ArcRotateCameraInputsManager(c),c.inputs.addKeyboard().addMouseWheel().addPointers(),c}return T(n,a),Object.defineProperty(n.prototype,"target",{get:function(){return this._target},set:function(e){this.setTarget(e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"angularSensibilityX",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityX:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityX=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"angularSensibilityY",{get:function(){var e=this.inputs.attached.pointers;return e?e.angularSensibilityY:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.angularSensibilityY=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pinchPrecision",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchPrecision:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchPrecision=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"pinchDeltaPercentage",{get:function(){var e=this.inputs.attached.pointers;return e?e.pinchDeltaPercentage:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.pinchDeltaPercentage=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"panningSensibility",{get:function(){var e=this.inputs.attached.pointers;return e?e.panningSensibility:0},set:function(e){var t=this.inputs.attached.pointers;t&&(t.panningSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"keysUp",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysUp:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysUp=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"keysDown",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysDown:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysDown=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"keysLeft",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysLeft:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysLeft=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"keysRight",{get:function(){var e=this.inputs.attached.keyboard;return e?e.keysRight:[]},set:function(e){var t=this.inputs.attached.keyboard;t&&(t.keysRight=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"wheelPrecision",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelPrecision:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelPrecision=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"wheelDeltaPercentage",{get:function(){var e=this.inputs.attached.mousewheel;return e?e.wheelDeltaPercentage:0},set:function(e){var t=this.inputs.attached.mousewheel;t&&(t.wheelDeltaPercentage=e)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"bouncingBehavior",{get:function(){return this._bouncingBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"useBouncingBehavior",{get:function(){return null!=this._bouncingBehavior},set:function(e){e!==this.useBouncingBehavior&&(e?(this._bouncingBehavior=new l.BouncingBehavior,this.addBehavior(this._bouncingBehavior)):this._bouncingBehavior&&(this.removeBehavior(this._bouncingBehavior),this._bouncingBehavior=null))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"framingBehavior",{get:function(){return this._framingBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"useFramingBehavior",{get:function(){return null!=this._framingBehavior},set:function(e){e!==this.useFramingBehavior&&(e?(this._framingBehavior=new l.FramingBehavior,this.addBehavior(this._framingBehavior)):this._framingBehavior&&(this.removeBehavior(this._framingBehavior),this._framingBehavior=null))},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"autoRotationBehavior",{get:function(){return this._autoRotationBehavior},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"useAutoRotationBehavior",{get:function(){return null!=this._autoRotationBehavior},set:function(e){e!==this.useAutoRotationBehavior&&(e?(this._autoRotationBehavior=new l.AutoRotationBehavior,this.addBehavior(this._autoRotationBehavior)):this._autoRotationBehavior&&(this.removeBehavior(this._autoRotationBehavior),this._autoRotationBehavior=null))},enumerable:!0,configurable:!0}),n.prototype._initCache=function(){a.prototype._initCache.call(this),this._cache._target=new l.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cache.alpha=void 0,this._cache.beta=void 0,this._cache.radius=void 0,this._cache.targetScreenOffset=l.Vector2.Zero()},n.prototype._updateCache=function(e){e||a.prototype._updateCache.call(this),this._cache._target.copyFrom(this._getTargetPosition()),this._cache.alpha=this.alpha,this._cache.beta=this.beta,this._cache.radius=this.radius,this._cache.targetScreenOffset.copyFrom(this.targetScreenOffset)},n.prototype._getTargetPosition=function(){if(this._targetHost&&this._targetHost.getAbsolutePosition){var e=this._targetHost.getAbsolutePosition();this._targetBoundingCenter?e.addToRef(this._targetBoundingCenter,this._target):this._target.copyFrom(e)}var t=this._getLockedTargetPosition();return t||this._target},n.prototype.storeState=function(){return this._storedAlpha=this.alpha,this._storedBeta=this.beta,this._storedRadius=this.radius,this._storedTarget=this._getTargetPosition().clone(),a.prototype.storeState.call(this)},n.prototype._restoreStateValues=function(){return!!a.prototype._restoreStateValues.call(this)&&(this.alpha=this._storedAlpha,this.beta=this._storedBeta,this.radius=this._storedRadius,this.setTarget(this._storedTarget.clone()),this.inertialAlphaOffset=0,this.inertialBetaOffset=0,this.inertialRadiusOffset=0,this.inertialPanningX=0,!(this.inertialPanningY=0))},n.prototype._isSynchronizedViewMatrix=function(){return!!a.prototype._isSynchronizedViewMatrix.call(this)&&(this._cache._target.equals(this._getTargetPosition())&&this._cache.alpha===this.alpha&&this._cache.beta===this.beta&&this._cache.radius===this.radius&&this._cache.targetScreenOffset.equals(this.targetScreenOffset))},n.prototype.attachControl=function(e,t,i,r){var n=this;void 0===i&&(i=!0),void 0===r&&(r=2),this._useCtrlForPanning=i,this._panningMouseButton=r,this.inputs.attachElement(e,t),this._reset=function(){n.inertialAlphaOffset=0,n.inertialBetaOffset=0,n.inertialRadiusOffset=0,n.inertialPanningX=0,n.inertialPanningY=0}},n.prototype.detachControl=function(e){this.inputs.detachElement(e),this._reset&&this._reset()},n.prototype._checkInputs=function(){if(!this._collisionTriggered){if(this.inputs.checkInputs(),0!==this.inertialAlphaOffset||0!==this.inertialBetaOffset||0!==this.inertialRadiusOffset){var e=this.inertialAlphaOffset;this.beta<=0&&(e*=-1),this.getScene().useRightHandedSystem&&(e*=-1),this.parent&&this.parent._getWorldMatrixDeterminant()<0&&(e*=-1),this.alpha+=e,this.beta+=this.inertialBetaOffset,this.radius-=this.inertialRadiusOffset,this.inertialAlphaOffset*=this.inertia,this.inertialBetaOffset*=this.inertia,this.inertialRadiusOffset*=this.inertia,Math.abs(this.inertialAlphaOffset)<l.Epsilon&&(this.inertialAlphaOffset=0),Math.abs(this.inertialBetaOffset)<l.Epsilon&&(this.inertialBetaOffset=0),Math.abs(this.inertialRadiusOffset)<this.speed*l.Epsilon&&(this.inertialRadiusOffset=0)}if(0!==this.inertialPanningX||0!==this.inertialPanningY){if(this._localDirection||(this._localDirection=l.Vector3.Zero(),this._transformedDirection=l.Vector3.Zero()),this._localDirection.copyFromFloats(this.inertialPanningX,this.inertialPanningY,this.inertialPanningY),this._localDirection.multiplyInPlace(this.panningAxis),this._viewMatrix.invertToRef(this._cameraTransformMatrix),l.Vector3.TransformNormalToRef(this._localDirection,this._cameraTransformMatrix,this._transformedDirection),this.panningAxis.y||(this._transformedDirection.y=0),!this._targetHost)if(this.panningDistanceLimit)this._transformedDirection.addInPlace(this._target),l.Vector3.DistanceSquared(this._transformedDirection,this.panningOriginTarget)<=this.panningDistanceLimit*this.panningDistanceLimit&&this._target.copyFrom(this._transformedDirection);else this._target.addInPlace(this._transformedDirection);this.inertialPanningX*=this.panningInertia,this.inertialPanningY*=this.panningInertia,Math.abs(this.inertialPanningX)<this.speed*l.Epsilon&&(this.inertialPanningX=0),Math.abs(this.inertialPanningY)<this.speed*l.Epsilon&&(this.inertialPanningY=0)}this._checkLimits(),a.prototype._checkInputs.call(this)}},n.prototype._checkLimits=function(){null===this.lowerBetaLimit||void 0===this.lowerBetaLimit?this.allowUpsideDown&&this.beta>Math.PI&&(this.beta=this.beta-2*Math.PI):this.beta<this.lowerBetaLimit&&(this.beta=this.lowerBetaLimit),null===this.upperBetaLimit||void 0===this.upperBetaLimit?this.allowUpsideDown&&this.beta<-Math.PI&&(this.beta=this.beta+2*Math.PI):this.beta>this.upperBetaLimit&&(this.beta=this.upperBetaLimit),null!==this.lowerAlphaLimit&&this.alpha<this.lowerAlphaLimit&&(this.alpha=this.lowerAlphaLimit),null!==this.upperAlphaLimit&&this.alpha>this.upperAlphaLimit&&(this.alpha=this.upperAlphaLimit),null!==this.lowerRadiusLimit&&this.radius<this.lowerRadiusLimit&&(this.radius=this.lowerRadiusLimit),null!==this.upperRadiusLimit&&this.radius>this.upperRadiusLimit&&(this.radius=this.upperRadiusLimit)},n.prototype.rebuildAnglesAndRadius=function(){this.position.subtractToRef(this._getTargetPosition(),this._computationVector),this.radius=this._computationVector.length(),0===this.radius&&(this.radius=1e-4),this.alpha=Math.acos(this._computationVector.x/Math.sqrt(Math.pow(this._computationVector.x,2)+Math.pow(this._computationVector.z,2))),this._computationVector.z<0&&(this.alpha=2*Math.PI-this.alpha),this.beta=Math.acos(this._computationVector.y/this.radius),this._checkLimits()},n.prototype.setPosition=function(e){this.position.equals(e)||(this.position.copyFrom(e),this.rebuildAnglesAndRadius())},n.prototype.setTarget=function(e,t,i){if(void 0===t&&(t=!1),void 0===i&&(i=!1),e.getBoundingInfo)this._targetBoundingCenter=t?e.getBoundingInfo().boundingBox.centerWorld.clone():null,this._targetHost=e,this._target=this._getTargetPosition(),this.onMeshTargetChangedObservable.notifyObservers(this._targetHost);else{var r=e,n=this._getTargetPosition();if(n&&!i&&n.equals(r))return;this._targetHost=null,this._target=r,this._targetBoundingCenter=null,this.onMeshTargetChangedObservable.notifyObservers(null)}this.rebuildAnglesAndRadius()},n.prototype._getViewMatrix=function(){var e=Math.cos(this.alpha),t=Math.sin(this.alpha),i=Math.cos(this.beta),r=Math.sin(this.beta);0===r&&(r=1e-4);var n=this._getTargetPosition();if(this._computationVector.copyFromFloats(this.radius*e*r,this.radius*i,this.radius*t*r),n.addToRef(this._computationVector,this._newPosition),this.getScene().collisionsEnabled&&this.checkCollisions)this._collider||(this._collider=new l.Collider),this._collider._radius=this.collisionRadius,this._newPosition.subtractToRef(this.position,this._collisionVelocity),this._collisionTriggered=!0,this.getScene().collisionCoordinator.getNewPosition(this.position,this._collisionVelocity,this._collider,3,null,this._onCollisionPositionChange,this.uniqueId);else{this.position.copyFrom(this._newPosition);var o=this.upVector;this.allowUpsideDown&&r<0&&(o=(o=o.clone()).negate()),this._computeViewMatrix(this.position,n,o),this._viewMatrix.m[12]+=this.targetScreenOffset.x,this._viewMatrix.m[13]+=this.targetScreenOffset.y}return this._currentTarget=n,this._viewMatrix},n.prototype.zoomOn=function(e,t){void 0===t&&(t=!1),e=e||this.getScene().meshes;var i=l.Mesh.MinMax(e),r=l.Vector3.Distance(i.min,i.max);this.radius=r*this.zoomOnFactor,this.focusOn({min:i.min,max:i.max,distance:r},t)},n.prototype.focusOn=function(e,t){var i,r;if(void 0===t&&(t=!1),void 0===e.min){var n=e||this.getScene().meshes;i=l.Mesh.MinMax(n),r=l.Vector3.Distance(i.min,i.max)}else{var o=e;r=(i=o).distance}this._target=l.Mesh.Center(i),t||(this.maxZ=2*r)},n.prototype.createRigCamera=function(e,t){var i=0;switch(this.cameraRigMode){case l.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case l.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case l.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:case l.Camera.RIG_MODE_VR:i=this._cameraRigParams.stereoHalfAngle*(0===t?1:-1);break;case l.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:i=this._cameraRigParams.stereoHalfAngle*(0===t?-1:1)}var r=new n(e,this.alpha+i,this.beta,this.radius,this._target,this.getScene());return r._cameraRigParams={},r},n.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];switch(e.beta=t.beta=this.beta,e.radius=t.radius=this.radius,this.cameraRigMode){case l.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH:case l.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:case l.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER:case l.Camera.RIG_MODE_VR:e.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle;break;case l.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_CROSSEYED:e.alpha=this.alpha+this._cameraRigParams.stereoHalfAngle,t.alpha=this.alpha-this._cameraRigParams.stereoHalfAngle}a.prototype._updateRigCameras.call(this)},n.prototype.dispose=function(){this.inputs.clear(),a.prototype.dispose.call(this)},n.prototype.getClassName=function(){return"ArcRotateCamera"},b([l.serialize()],n.prototype,"alpha",void 0),b([l.serialize()],n.prototype,"beta",void 0),b([l.serialize()],n.prototype,"radius",void 0),b([l.serializeAsVector3("target")],n.prototype,"_target",void 0),b([l.serialize()],n.prototype,"inertialAlphaOffset",void 0),b([l.serialize()],n.prototype,"inertialBetaOffset",void 0),b([l.serialize()],n.prototype,"inertialRadiusOffset",void 0),b([l.serialize()],n.prototype,"lowerAlphaLimit",void 0),b([l.serialize()],n.prototype,"upperAlphaLimit",void 0),b([l.serialize()],n.prototype,"lowerBetaLimit",void 0),b([l.serialize()],n.prototype,"upperBetaLimit",void 0),b([l.serialize()],n.prototype,"lowerRadiusLimit",void 0),b([l.serialize()],n.prototype,"upperRadiusLimit",void 0),b([l.serialize()],n.prototype,"inertialPanningX",void 0),b([l.serialize()],n.prototype,"inertialPanningY",void 0),b([l.serialize()],n.prototype,"pinchToPanMaxDistance",void 0),b([l.serialize()],n.prototype,"panningDistanceLimit",void 0),b([l.serializeAsVector3()],n.prototype,"panningOriginTarget",void 0),b([l.serialize()],n.prototype,"panningInertia",void 0),b([l.serialize()],n.prototype,"zoomOnFactor",void 0),b([l.serialize()],n.prototype,"targetScreenOffset",void 0),b([l.serialize()],n.prototype,"allowUpsideDown",void 0),b([l.serialize()],n.prototype,"useInputToRestoreState",void 0),n})(l.TargetCamera);l.ArcRotateCamera=i})($a||($a={})),(function(o){o.Node.AddNodeConstructor("Light_Type_3",(function(e,t){return function(){return new i(e,o.Vector3.Zero(),t)}}));var i=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r.groundColor=new o.Color3(0,0,0),r.direction=t||o.Vector3.Up(),r}return T(e,n),e.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("vLightGround",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},e.prototype.getClassName=function(){return"HemisphericLight"},e.prototype.setDirectionToTarget=function(e){return this.direction=o.Vector3.Normalize(e.subtract(o.Vector3.Zero())),this.direction},e.prototype.getShadowGenerator=function(){return null},e.prototype.transferToEffect=function(e,t){var i=o.Vector3.Normalize(this.direction);return this._uniformBuffer.updateFloat4("vLightData",i.x,i.y,i.z,0,t),this._uniformBuffer.updateColor3("vLightGround",this.groundColor.scale(this.intensity),t),this},e.prototype.computeWorldMatrix=function(e,t){return this._worldMatrix||(this._worldMatrix=o.Matrix.Identity()),this._worldMatrix},e.prototype.getTypeID=function(){return o.Light.LIGHTTYPEID_HEMISPHERICLIGHT},e.prototype.prepareLightSpecificDefines=function(e,t){e["HEMILIGHT"+t]=!0},b([o.serializeAsColor3()],e.prototype,"groundColor",void 0),b([o.serializeAsVector3()],e.prototype,"direction",void 0),e})(o.Light);o.HemisphericLight=i})($a||($a={})),je=$a||($a={}),Ye=(function(t){function e(){var e=null!==t&&t.apply(this,arguments)||this;return e._needProjectionMatrixCompute=!0,e}return T(e,t),e.prototype._setPosition=function(e){this._position=e},Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._setPosition(e)},enumerable:!0,configurable:!0}),e.prototype._setDirection=function(e){this._direction=e},Object.defineProperty(e.prototype,"direction",{get:function(){return this._direction},set:function(e){this._setDirection(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowMinZ",{get:function(){return this._shadowMinZ},set:function(e){this._shadowMinZ=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowMaxZ",{get:function(){return this._shadowMaxZ},set:function(e){this._shadowMaxZ=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),e.prototype.computeTransformedInformation=function(){return!(!this.parent||!this.parent.getWorldMatrix)&&(this.transformedPosition||(this.transformedPosition=je.Vector3.Zero()),je.Vector3.TransformCoordinatesToRef(this.position,this.parent.getWorldMatrix(),this.transformedPosition),this.direction&&(this.transformedDirection||(this.transformedDirection=je.Vector3.Zero()),je.Vector3.TransformNormalToRef(this.direction,this.parent.getWorldMatrix(),this.transformedDirection)),!0)},e.prototype.getDepthScale=function(){return 50},e.prototype.getShadowDirection=function(e){return this.transformedDirection?this.transformedDirection:this.direction},e.prototype.getAbsolutePosition=function(){return this.transformedPosition?this.transformedPosition:this.position},e.prototype.setDirectionToTarget=function(e){return this.direction=je.Vector3.Normalize(e.subtract(this.position)),this.direction},e.prototype.getRotation=function(){this.direction.normalize();var e=je.Vector3.Cross(this.direction,je.Axis.Y),t=je.Vector3.Cross(e,this.direction);return je.Vector3.RotationFromAxis(e,t,this.direction)},e.prototype.needCube=function(){return!1},e.prototype.needProjectionMatrixCompute=function(){return this._needProjectionMatrixCompute},e.prototype.forceProjectionMatrixCompute=function(){this._needProjectionMatrixCompute=!0},e.prototype._initCache=function(){t.prototype._initCache.call(this),this._cache.position=je.Vector3.Zero()},e.prototype._isSynchronized=function(){return!!this._cache.position.equals(this.position)},e.prototype.computeWorldMatrix=function(e){return!e&&this.isSynchronized()?this._currentRenderId=this.getScene().getRenderId():(this._updateCache(),this._cache.position.copyFrom(this.position),this._worldMatrix||(this._worldMatrix=je.Matrix.Identity()),je.Matrix.TranslationToRef(this.position.x,this.position.y,this.position.z,this._worldMatrix),this.parent&&this.parent.getWorldMatrix&&(this._worldMatrix.multiplyToRef(this.parent.getWorldMatrix(),this._worldMatrix),this._markSyncedWithParent()),this._worldMatrixDeterminant=this._worldMatrix.determinant()),this._worldMatrix},e.prototype.getDepthMinZ=function(e){return void 0!==this.shadowMinZ?this.shadowMinZ:e.minZ},e.prototype.getDepthMaxZ=function(e){return void 0!==this.shadowMaxZ?this.shadowMaxZ:e.maxZ},e.prototype.setShadowProjectionMatrix=function(e,t,i){return this.customProjectionMatrixBuilder?this.customProjectionMatrixBuilder(t,i,e):this._setDefaultShadowProjectionMatrix(e,t,i),this},b([je.serializeAsVector3()],e.prototype,"position",null),b([je.serializeAsVector3()],e.prototype,"direction",null),b([je.serialize()],e.prototype,"shadowMinZ",null),b([je.serialize()],e.prototype,"shadowMaxZ",null),e})(je.Light),je.ShadowLight=Ye,(function(o){o.Node.AddNodeConstructor("Light_Type_0",(function(e,t){return function(){return new i(e,o.Vector3.Zero(),t)}}));var i=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r._shadowAngle=Math.PI/2,r.position=t,r}return T(e,n),Object.defineProperty(e.prototype,"shadowAngle",{get:function(){return this._shadowAngle},set:function(e){this._shadowAngle=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"direction",{get:function(){return this._direction},set:function(e){var t=this.needCube();this._direction=e,this.needCube()!==t&&this._shadowGenerator&&this._shadowGenerator.recreateShadowMap()},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"PointLight"},e.prototype.getTypeID=function(){return o.Light.LIGHTTYPEID_POINTLIGHT},e.prototype.needCube=function(){return!this.direction},e.prototype.getShadowDirection=function(e){if(this.direction)return n.prototype.getShadowDirection.call(this,e);switch(e){case 0:return new o.Vector3(1,0,0);case 1:return new o.Vector3(-1,0,0);case 2:return new o.Vector3(0,-1,0);case 3:return new o.Vector3(0,1,0);case 4:return new o.Vector3(0,0,1);case 5:return new o.Vector3(0,0,-1)}return o.Vector3.Zero()},e.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var r=this.getScene().activeCamera;r&&o.Matrix.PerspectiveFovLHToRef(this.shadowAngle,1,this.getDepthMinZ(r),this.getDepthMaxZ(r),e)},e.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},e.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,0,t):this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,0,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,0,0,t),this},e.prototype.prepareLightSpecificDefines=function(e,t){e["POINTLIGHT"+t]=!0},b([o.serialize()],e.prototype,"shadowAngle",null),e})(o.ShadowLight);o.PointLight=i})($a||($a={})),(function(u){u.Node.AddNodeConstructor("Light_Type_1",(function(e,t){return function(){return new i(e,u.Vector3.Zero(),t)}}));var i=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r._shadowFrustumSize=0,r._shadowOrthoScale=.1,r.autoUpdateExtends=!0,r._orthoLeft=Number.MAX_VALUE,r._orthoRight=Number.MIN_VALUE,r._orthoTop=Number.MIN_VALUE,r._orthoBottom=Number.MAX_VALUE,r.position=t.scale(-1),r.direction=t,r}return T(e,n),Object.defineProperty(e.prototype,"shadowFrustumSize",{get:function(){return this._shadowFrustumSize},set:function(e){this._shadowFrustumSize=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowOrthoScale",{get:function(){return this._shadowOrthoScale},set:function(e){this._shadowOrthoScale=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"DirectionalLight"},e.prototype.getTypeID=function(){return u.Light.LIGHTTYPEID_DIRECTIONALLIGHT},e.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){0<this.shadowFrustumSize?this._setDefaultFixedFrustumShadowProjectionMatrix(e,t):this._setDefaultAutoExtendShadowProjectionMatrix(e,t,i)},e.prototype._setDefaultFixedFrustumShadowProjectionMatrix=function(e,t){var i=this.getScene().activeCamera;i&&u.Matrix.OrthoLHToRef(this.shadowFrustumSize,this.shadowFrustumSize,void 0!==this.shadowMinZ?this.shadowMinZ:i.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:i.maxZ,e)},e.prototype._setDefaultAutoExtendShadowProjectionMatrix=function(e,t,i){var r=this.getScene().activeCamera;if(r){if(this.autoUpdateExtends||this._orthoLeft===Number.MAX_VALUE){var n=u.Vector3.Zero();this._orthoLeft=Number.MAX_VALUE,this._orthoRight=Number.MIN_VALUE,this._orthoTop=Number.MIN_VALUE,this._orthoBottom=Number.MAX_VALUE;for(var o=0;o<i.length;o++){var s=i[o];if(s)for(var a=s.getBoundingInfo().boundingBox,l=0;l<a.vectorsWorld.length;l++)u.Vector3.TransformCoordinatesToRef(a.vectorsWorld[l],t,n),n.x<this._orthoLeft&&(this._orthoLeft=n.x),n.y<this._orthoBottom&&(this._orthoBottom=n.y),n.x>this._orthoRight&&(this._orthoRight=n.x),n.y>this._orthoTop&&(this._orthoTop=n.y)}}var c=this._orthoRight-this._orthoLeft,h=this._orthoTop-this._orthoBottom;u.Matrix.OrthoOffCenterLHToRef(this._orthoLeft-c*this.shadowOrthoScale,this._orthoRight+c*this.shadowOrthoScale,this._orthoBottom-h*this.shadowOrthoScale,this._orthoTop+h*this.shadowOrthoScale,void 0!==this.shadowMinZ?this.shadowMinZ:r.minZ,void 0!==this.shadowMaxZ?this.shadowMaxZ:r.maxZ,e)}},e.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},e.prototype.transferToEffect=function(e,t){return this.computeTransformedInformation()?this._uniformBuffer.updateFloat4("vLightData",this.transformedDirection.x,this.transformedDirection.y,this.transformedDirection.z,1,t):this._uniformBuffer.updateFloat4("vLightData",this.direction.x,this.direction.y,this.direction.z,1,t),this},e.prototype.getDepthMinZ=function(e){return 1},e.prototype.getDepthMaxZ=function(e){return 1},e.prototype.prepareLightSpecificDefines=function(e,t){e["DIRLIGHT"+t]=!0},b([u.serialize()],e.prototype,"shadowFrustumSize",null),b([u.serialize()],e.prototype,"shadowOrthoScale",null),b([u.serialize()],e.prototype,"autoUpdateExtends",void 0),e})(u.ShadowLight);u.DirectionalLight=i})($a||($a={})),(function(l){l.Node.AddNodeConstructor("Light_Type_2",(function(e,t){return function(){return new i(e,l.Vector3.Zero(),l.Vector3.Zero(),0,0,t)}}));var i=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,o)||this;return s._innerAngle=0,s._projectionTextureMatrix=l.Matrix.Zero(),s._projectionTextureLightNear=1e-6,s._projectionTextureLightFar=1e3,s._projectionTextureUpDirection=l.Vector3.Up(),s._projectionTextureViewLightDirty=!0,s._projectionTextureProjectionLightDirty=!0,s._projectionTextureDirty=!0,s._projectionTextureViewTargetVector=l.Vector3.Zero(),s._projectionTextureViewLightMatrix=l.Matrix.Zero(),s._projectionTextureProjectionLightMatrix=l.Matrix.Zero(),s._projectionTextureScalingMatrix=l.Matrix.FromValues(.5,0,0,0,0,.5,0,0,0,0,.5,0,.5,.5,.5,1),s.position=t,s.direction=i,s.angle=r,s.exponent=n,s}return T(e,a),Object.defineProperty(e.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._cosHalfAngle=Math.cos(.5*e),this._projectionTextureProjectionLightDirty=!0,this.forceProjectionMatrixCompute(),this._computeAngleValues()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"innerAngle",{get:function(){return this._innerAngle},set:function(e){this._innerAngle=e,this._computeAngleValues()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shadowAngleScale",{get:function(){return this._shadowAngleScale},set:function(e){this._shadowAngleScale=e,this.forceProjectionMatrixCompute()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"projectionTextureMatrix",{get:function(){return this._projectionTextureMatrix},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"projectionTextureLightNear",{get:function(){return this._projectionTextureLightNear},set:function(e){this._projectionTextureLightNear=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"projectionTextureLightFar",{get:function(){return this._projectionTextureLightFar},set:function(e){this._projectionTextureLightFar=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"projectionTextureUpDirection",{get:function(){return this._projectionTextureUpDirection},set:function(e){this._projectionTextureUpDirection=e,this._projectionTextureProjectionLightDirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"projectionTexture",{get:function(){return this._projectionTexture},set:function(e){this._projectionTexture=e,this._projectionTextureDirty=!0},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"SpotLight"},e.prototype.getTypeID=function(){return l.Light.LIGHTTYPEID_SPOTLIGHT},e.prototype._setDirection=function(e){a.prototype._setDirection.call(this,e),this._projectionTextureViewLightDirty=!0},e.prototype._setPosition=function(e){a.prototype._setPosition.call(this,e),this._projectionTextureViewLightDirty=!0},e.prototype._setDefaultShadowProjectionMatrix=function(e,t,i){var r=this.getScene().activeCamera;if(r){this._shadowAngleScale=this._shadowAngleScale||1;var n=this._shadowAngleScale*this._angle;l.Matrix.PerspectiveFovLHToRef(n,1,this.getDepthMinZ(r),this.getDepthMaxZ(r),e)}},e.prototype._computeProjectionTextureViewLightMatrix=function(){this._projectionTextureViewLightDirty=!1,this._projectionTextureDirty=!0,this.position.addToRef(this.direction,this._projectionTextureViewTargetVector),l.Matrix.LookAtLHToRef(this.position,this._projectionTextureViewTargetVector,this._projectionTextureUpDirection,this._projectionTextureViewLightMatrix)},e.prototype._computeProjectionTextureProjectionLightMatrix=function(){this._projectionTextureProjectionLightDirty=!1,this._projectionTextureDirty=!0;var e=this.projectionTextureLightFar,t=this.projectionTextureLightNear,i=e/(e-t),r=-i*t,n=1/Math.tan(this._angle/2);l.Matrix.FromValuesToRef(n/1,0,0,0,0,n,0,0,0,0,i,1,0,0,r,0,this._projectionTextureProjectionLightMatrix)},e.prototype._computeProjectionTextureMatrix=function(){this._projectionTextureDirty=!1,this._projectionTextureViewLightMatrix.multiplyToRef(this._projectionTextureProjectionLightMatrix,this._projectionTextureMatrix),this._projectionTextureMatrix.multiplyToRef(this._projectionTextureScalingMatrix,this._projectionTextureMatrix)},e.prototype._buildUniformLayout=function(){this._uniformBuffer.addUniform("vLightData",4),this._uniformBuffer.addUniform("vLightDiffuse",4),this._uniformBuffer.addUniform("vLightSpecular",3),this._uniformBuffer.addUniform("vLightDirection",3),this._uniformBuffer.addUniform("vLightFalloff",4),this._uniformBuffer.addUniform("shadowsInfo",3),this._uniformBuffer.addUniform("depthValues",2),this._uniformBuffer.create()},e.prototype._computeAngleValues=function(){this._lightAngleScale=1/Math.max(.001,Math.cos(.5*this._innerAngle)-this._cosHalfAngle),this._lightAngleOffset=-this._cosHalfAngle*this._lightAngleScale},e.prototype.transferToEffect=function(e,t){var i;return this.computeTransformedInformation()?(this._uniformBuffer.updateFloat4("vLightData",this.transformedPosition.x,this.transformedPosition.y,this.transformedPosition.z,this.exponent,t),i=l.Vector3.Normalize(this.transformedDirection)):(this._uniformBuffer.updateFloat4("vLightData",this.position.x,this.position.y,this.position.z,this.exponent,t),i=l.Vector3.Normalize(this.direction)),this._uniformBuffer.updateFloat4("vLightDirection",i.x,i.y,i.z,this._cosHalfAngle,t),this._uniformBuffer.updateFloat4("vLightFalloff",this.range,this._inverseSquaredRange,this._lightAngleScale,this._lightAngleOffset,t),this.projectionTexture&&this.projectionTexture.isReady()&&(this._projectionTextureViewLightDirty&&this._computeProjectionTextureViewLightMatrix(),this._projectionTextureProjectionLightDirty&&this._computeProjectionTextureProjectionLightMatrix(),this._projectionTextureDirty&&this._computeProjectionTextureMatrix(),e.setMatrix("textureProjectionMatrix"+t,this._projectionTextureMatrix),e.setTexture("projectionLightSampler"+t,this.projectionTexture)),this},e.prototype.dispose=function(){a.prototype.dispose.call(this),this._projectionTexture&&this._projectionTexture.dispose()},e.prototype.prepareLightSpecificDefines=function(e,t){e["SPOTLIGHT"+t]=!0,e["PROJECTEDLIGHTTEXTURE"+t]=!!this.projectionTexture},b([l.serialize()],e.prototype,"angle",null),b([l.serialize()],e.prototype,"innerAngle",null),b([l.serialize()],e.prototype,"shadowAngleScale",null),b([l.serialize()],e.prototype,"exponent",void 0),b([l.serialize()],e.prototype,"projectionTextureLightNear",null),b([l.serialize()],e.prototype,"projectionTextureLightFar",null),b([l.serialize()],e.prototype,"projectionTextureUpDirection",null),b([l.serializeAsTexture("projectedLightTexture")],e.prototype,"_projectionTexture",void 0),e})(l.ShadowLight);l.SpotLight=i})($a||($a={})),Ke=$a||($a={}),Qe=function(){this.enableBlending=!1,this.blendingSpeed=.01,this.loopMode=Ke.Animation.ANIMATIONLOOPMODE_CYCLE},Ke.AnimationPropertiesOverride=Qe,(function(d){var r=(function(){function e(e,t,i){this.name=e,this.from=t,this.to=i}return e.prototype.clone=function(){return new e(this.name,this.from,this.to)},e})();d.AnimationRange=r;var e=(function(){function e(e,t,i){this.frame=e,this.action=t,this.onlyOnce=i,this.isDone=!1}return e.prototype._clone=function(){return new e(this.frame,this.action,this.onlyOnce)},e})();d.AnimationEvent=e;var E,t,i=(function(){function e(e){this.path=e,this._onchange=new Array,this.value=0,this.animations=new Array}return e.prototype.getPoint=function(){var e=this.path.getPointAtLengthPosition(this.value);return new d.Vector3(e.x,0,e.y)},e.prototype.moveAhead=function(e){return void 0===e&&(e=.002),this.move(e),this},e.prototype.moveBack=function(e){return void 0===e&&(e=.002),this.move(-e),this},e.prototype.move=function(e){if(1<Math.abs(e))throw"step size should be less than 1.";return this.value+=e,this.ensureLimits(),this.raiseOnChange(),this},e.prototype.ensureLimits=function(){for(;1<this.value;)this.value-=1;for(;this.value<0;)this.value+=1;return this},e.prototype.raiseOnChange=function(){var t=this;return this._onchange.forEach((function(e){return e(t)})),this},e.prototype.onchange=function(e){return this._onchange.push(e),this},e})();d.PathCursor=i,(t=E=d.AnimationKeyInterpolation||(d.AnimationKeyInterpolation={}))[t.STEP=1]="STEP";var n=(function(){function T(e,t,i,r,n,o){this.name=e,this.targetProperty=t,this.framePerSecond=i,this.dataType=r,this.loopMode=n,this.enableBlending=o,this._runtimeAnimations=new Array,this._events=new Array,this.blendingSpeed=.01,this._ranges={},this.targetPropertyPath=t.split("."),this.dataType=r,this.loopMode=void 0===n?T.ANIMATIONLOOPMODE_CYCLE:n}return T._PrepareAnimation=function(e,t,i,r,n,o,s,a){var l=void 0;if(!isNaN(parseFloat(n))&&isFinite(n)?l=T.ANIMATIONTYPE_FLOAT:n instanceof d.Quaternion?l=T.ANIMATIONTYPE_QUATERNION:n instanceof d.Vector3?l=T.ANIMATIONTYPE_VECTOR3:n instanceof d.Vector2?l=T.ANIMATIONTYPE_VECTOR2:n instanceof d.Color3?l=T.ANIMATIONTYPE_COLOR3:n instanceof d.Size&&(l=T.ANIMATIONTYPE_SIZE),null==l)return null;var c=new T(e,t,i,l,s),h=[{frame:0,value:n},{frame:r,value:o}];return c.setKeys(h),void 0!==a&&c.setEasingFunction(a),c},T.CreateAnimation=function(e,t,i,r){var n=new T(e+"Animation",e,i,t,T.ANIMATIONLOOPMODE_CONSTANT);return n.setEasingFunction(r),n},T.CreateAndStartAnimation=function(e,t,i,r,n,o,s,a,l,c){var h=T._PrepareAnimation(e,i,r,n,o,s,a,l);return h?t.getScene().beginDirectAnimation(t,[h],0,n,1===h.loopMode,1,c):null},T.CreateAndStartHierarchyAnimation=function(e,t,i,r,n,o,s,a,l,c,h){var u=T._PrepareAnimation(e,r,n,o,s,a,l,c);return u?t.getScene().beginDirectHierarchyAnimation(t,i,[u],0,o,1===u.loopMode,1,h):null},T.CreateMergeAndStartAnimation=function(e,t,i,r,n,o,s,a,l,c){var h=T._PrepareAnimation(e,i,r,n,o,s,a,l);return h?(t.animations.push(h),t.getScene().beginAnimation(t,0,n,1===h.loopMode,1,c)):null},T.TransitionTo=function(e,t,i,r,n,o,s,a){if(void 0===a&&(a=null),s<=0)return i[e]=t,a&&a(),null;var l=n*(s/1e3);o.setKeys([{frame:0,value:i[e].clone?i[e].clone():i[e]},{frame:l,value:t}]),i.animations||(i.animations=[]),i.animations.push(o);var c=r.beginAnimation(i,0,l,!1);return c.onAnimationEnd=a,c},Object.defineProperty(T.prototype,"runtimeAnimations",{get:function(){return this._runtimeAnimations},enumerable:!0,configurable:!0}),Object.defineProperty(T.prototype,"hasRunningRuntimeAnimations",{get:function(){for(var e=0,t=this._runtimeAnimations;e<t.length;e++){if(!t[e].isStopped)return!0}return!1},enumerable:!0,configurable:!0}),T.prototype.toString=function(e){var t="Name: "+this.name+", property: "+this.targetProperty;if(t+=", datatype: "+["Float","Vector3","Quaternion","Matrix","Color3","Vector2"][this.dataType],t+=", nKeys: "+(this._keys?this._keys.length:"none"),t+=", nRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i=!0;for(var r in this._ranges)i&&(t+=", ",i=!1),t+=r;t+="}"}return t},T.prototype.addEvent=function(e){this._events.push(e)},T.prototype.removeEvents=function(e){for(var t=0;t<this._events.length;t++)this._events[t].frame===e&&(this._events.splice(t,1),t--)},T.prototype.getEvents=function(){return this._events},T.prototype.createRange=function(e,t,i){this._ranges[e]||(this._ranges[e]=new r(e,t,i))},T.prototype.deleteRange=function(e,t){void 0===t&&(t=!0);var i=this._ranges[e];if(i){if(t)for(var r=i.from,n=i.to,o=this._keys.length-1;0<=o;o--)this._keys[o].frame>=r&&this._keys[o].frame<=n&&this._keys.splice(o,1);this._ranges[e]=null}},T.prototype.getRange=function(e){return this._ranges[e]},T.prototype.getKeys=function(){return this._keys},T.prototype.getHighestFrame=function(){for(var e=0,t=0,i=this._keys.length;t<i;t++)e<this._keys[t].frame&&(e=this._keys[t].frame);return e},T.prototype.getEasingFunction=function(){return this._easingFunction},T.prototype.setEasingFunction=function(e){this._easingFunction=e},T.prototype.floatInterpolateFunction=function(e,t,i){return d.Scalar.Lerp(e,t,i)},T.prototype.floatInterpolateFunctionWithTangents=function(e,t,i,r,n){return d.Scalar.Hermite(e,t,i,r,n)},T.prototype.quaternionInterpolateFunction=function(e,t,i){return d.Quaternion.Slerp(e,t,i)},T.prototype.quaternionInterpolateFunctionWithTangents=function(e,t,i,r,n){return d.Quaternion.Hermite(e,t,i,r,n).normalize()},T.prototype.vector3InterpolateFunction=function(e,t,i){return d.Vector3.Lerp(e,t,i)},T.prototype.vector3InterpolateFunctionWithTangents=function(e,t,i,r,n){return d.Vector3.Hermite(e,t,i,r,n)},T.prototype.vector2InterpolateFunction=function(e,t,i){return d.Vector2.Lerp(e,t,i)},T.prototype.vector2InterpolateFunctionWithTangents=function(e,t,i,r,n){return d.Vector2.Hermite(e,t,i,r,n)},T.prototype.sizeInterpolateFunction=function(e,t,i){return d.Size.Lerp(e,t,i)},T.prototype.color3InterpolateFunction=function(e,t,i){return d.Color3.Lerp(e,t,i)},T.prototype._getKeyValue=function(e){return"function"==typeof e?e():e},T.prototype._interpolate=function(e,t,i,r,n,o){if(r===T.ANIMATIONLOOPMODE_CONSTANT&&0<t)return o.clone?o.clone():o;var s=this.getKeys(),a=Math.max(0,Math.min(s.length-1,Math.floor(s.length*(e-s[0].frame)/(s[s.length-1].frame-s[0].frame))-1));if(s[a].frame>=e)for(;0<=a-1&&s[a].frame>=e;)a--;for(var l=a;l<s.length;l++){var c=s[l+1];if(c.frame>=e){var h=s[l],u=this._getKeyValue(h.value);if(h.interpolation===E.STEP)return u;var d=this._getKeyValue(c.value),f=void 0!==h.outTangent&&void 0!==c.inTangent,p=c.frame-h.frame,_=(e-h.frame)/p,m=this.getEasingFunction();switch(null!=m&&(_=m.ease(_)),this.dataType){case T.ANIMATIONTYPE_FLOAT:var g=f?this.floatInterpolateFunctionWithTangents(u,h.outTangent*p,d,c.inTangent*p,_):this.floatInterpolateFunction(u,d,_);switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:return g;case T.ANIMATIONLOOPMODE_RELATIVE:return n*t+g}break;case T.ANIMATIONTYPE_QUATERNION:var v=f?this.quaternionInterpolateFunctionWithTangents(u,h.outTangent.scale(p),d,c.inTangent.scale(p),_):this.quaternionInterpolateFunction(u,d,_);switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:return v;case T.ANIMATIONLOOPMODE_RELATIVE:return v.addInPlace(n.scale(t))}return v;case T.ANIMATIONTYPE_VECTOR3:var y=f?this.vector3InterpolateFunctionWithTangents(u,h.outTangent.scale(p),d,c.inTangent.scale(p),_):this.vector3InterpolateFunction(u,d,_);switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:return y;case T.ANIMATIONLOOPMODE_RELATIVE:return y.add(n.scale(t))}case T.ANIMATIONTYPE_VECTOR2:var b=f?this.vector2InterpolateFunctionWithTangents(u,h.outTangent.scale(p),d,c.inTangent.scale(p),_):this.vector2InterpolateFunction(u,d,_);switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:return b;case T.ANIMATIONLOOPMODE_RELATIVE:return b.add(n.scale(t))}case T.ANIMATIONTYPE_SIZE:switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:return this.sizeInterpolateFunction(u,d,_);case T.ANIMATIONLOOPMODE_RELATIVE:return this.sizeInterpolateFunction(u,d,_).add(n.scale(t))}case T.ANIMATIONTYPE_COLOR3:switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:return this.color3InterpolateFunction(u,d,_);case T.ANIMATIONLOOPMODE_RELATIVE:return this.color3InterpolateFunction(u,d,_).add(n.scale(t))}case T.ANIMATIONTYPE_MATRIX:switch(r){case T.ANIMATIONLOOPMODE_CYCLE:case T.ANIMATIONLOOPMODE_CONSTANT:if(T.AllowMatricesInterpolation)return this.matrixInterpolateFunction(u,d,_,i);case T.ANIMATIONLOOPMODE_RELATIVE:return u}}break}}return this._getKeyValue(s[s.length-1].value)},T.prototype.matrixInterpolateFunction=function(e,t,i,r){return T.AllowMatrixDecomposeForInterpolation?r?(d.Matrix.DecomposeLerpToRef(e,t,i,r),r):d.Matrix.DecomposeLerp(e,t,i):r?(d.Matrix.LerpToRef(e,t,i,r),r):d.Matrix.Lerp(e,t,i)},T.prototype.clone=function(){var e=new T(this.name,this.targetPropertyPath.join("."),this.framePerSecond,this.dataType,this.loopMode);if(e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed,this._keys&&e.setKeys(this._keys),this._ranges)for(var t in e._ranges={},this._ranges){var i=this._ranges[t];i&&(e._ranges[t]=i.clone())}return e},T.prototype.setKeys=function(e){this._keys=e.slice(0)},T.prototype.serialize=function(){var e={};e.name=this.name,e.property=this.targetProperty,e.framePerSecond=this.framePerSecond,e.dataType=this.dataType,e.loopBehavior=this.loopMode,e.enableBlending=this.enableBlending,e.blendingSpeed=this.blendingSpeed;var t=this.dataType;e.keys=[];for(var i=this.getKeys(),r=0;r<i.length;r++){var n=i[r],o={};switch(o.frame=n.frame,t){case T.ANIMATIONTYPE_FLOAT:o.values=[n.value];break;case T.ANIMATIONTYPE_QUATERNION:case T.ANIMATIONTYPE_MATRIX:case T.ANIMATIONTYPE_VECTOR3:case T.ANIMATIONTYPE_COLOR3:o.values=n.value.asArray()}e.keys.push(o)}for(var s in e.ranges=[],this._ranges){var a=this._ranges[s];if(a){var l={};l.name=s,l.from=a.from,l.to=a.to,e.ranges.push(l)}}return e},Object.defineProperty(T,"ANIMATIONTYPE_FLOAT",{get:function(){return T._ANIMATIONTYPE_FLOAT},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONTYPE_VECTOR3",{get:function(){return T._ANIMATIONTYPE_VECTOR3},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONTYPE_VECTOR2",{get:function(){return T._ANIMATIONTYPE_VECTOR2},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONTYPE_SIZE",{get:function(){return T._ANIMATIONTYPE_SIZE},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONTYPE_QUATERNION",{get:function(){return T._ANIMATIONTYPE_QUATERNION},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONTYPE_MATRIX",{get:function(){return T._ANIMATIONTYPE_MATRIX},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONTYPE_COLOR3",{get:function(){return T._ANIMATIONTYPE_COLOR3},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONLOOPMODE_RELATIVE",{get:function(){return T._ANIMATIONLOOPMODE_RELATIVE},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONLOOPMODE_CYCLE",{get:function(){return T._ANIMATIONLOOPMODE_CYCLE},enumerable:!0,configurable:!0}),Object.defineProperty(T,"ANIMATIONLOOPMODE_CONSTANT",{get:function(){return T._ANIMATIONLOOPMODE_CONSTANT},enumerable:!0,configurable:!0}),T._UniversalLerp=function(e,t,i){var r=e.constructor;return r.Lerp?r.Lerp(e,t,i):r.Slerp?r.Slerp(e,t,i):e.toFixed?e*(1-i)+i*t:t},T.Parse=function(e){var t,i,r=new T(e.name,e.property,e.framePerSecond,e.dataType,e.loopBehavior),n=e.dataType,o=[];for(e.enableBlending&&(r.enableBlending=e.enableBlending),e.blendingSpeed&&(r.blendingSpeed=e.blendingSpeed),i=0;i<e.keys.length;i++){var s,a,l=e.keys[i];switch(n){case T.ANIMATIONTYPE_FLOAT:t=l.values[0],1<=l.values.length&&(s=l.values[1]),2<=l.values.length&&(a=l.values[2]);break;case T.ANIMATIONTYPE_QUATERNION:if(t=d.Quaternion.FromArray(l.values),8<=l.values.length){var c=d.Quaternion.FromArray(l.values.slice(4,8));c.equals(d.Quaternion.Zero())||(s=c)}if(12<=l.values.length){var h=d.Quaternion.FromArray(l.values.slice(8,12));h.equals(d.Quaternion.Zero())||(a=h)}break;case T.ANIMATIONTYPE_MATRIX:t=d.Matrix.FromArray(l.values);break;case T.ANIMATIONTYPE_COLOR3:t=d.Color3.FromArray(l.values);break;case T.ANIMATIONTYPE_VECTOR3:default:t=d.Vector3.FromArray(l.values)}var u={};u.frame=l.frame,u.value=t,null!=s&&(u.inTangent=s),null!=a&&(u.outTangent=a),o.push(u)}if(r.setKeys(o),e.ranges)for(i=0;i<e.ranges.length;i++)t=e.ranges[i],r.createRange(t.name,t.from,t.to);return r},T.AppendSerializedAnimations=function(e,t){if(e.animations){t.animations=[];for(var i=0;i<e.animations.length;i++){var r=e.animations[i];t.animations.push(r.serialize())}}},T.AllowMatricesInterpolation=!1,T.AllowMatrixDecomposeForInterpolation=!0,T._ANIMATIONTYPE_FLOAT=0,T._ANIMATIONTYPE_VECTOR3=1,T._ANIMATIONTYPE_QUATERNION=2,T._ANIMATIONTYPE_MATRIX=3,T._ANIMATIONTYPE_COLOR3=4,T._ANIMATIONTYPE_VECTOR2=5,T._ANIMATIONTYPE_SIZE=6,T._ANIMATIONLOOPMODE_RELATIVE=0,T._ANIMATIONLOOPMODE_CYCLE=1,T._ANIMATIONLOOPMODE_CONSTANT=2,T})();d.Animation=n})($a||($a={})),(function(l){var e=function(){};l.TargetedAnimation=e;var t=(function(){function e(e,t){void 0===t&&(t=null),this.name=e,this._targetedAnimations=new Array,this._animatables=new Array,this._from=Number.MAX_VALUE,this._to=-Number.MAX_VALUE,this._speedRatio=1,this.onAnimationEndObservable=new l.Observable,this.onAnimationGroupEndObservable=new l.Observable,this.onAnimationGroupPauseObservable=new l.Observable,this._scene=t||l.Engine.LastCreatedScene,this._scene.animationGroups.push(this)}return Object.defineProperty(e.prototype,"from",{get:function(){return this._from},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"to",{get:function(){return this._to},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isStarted",{get:function(){return this._isStarted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){if(this._speedRatio!==e){this._speedRatio=e;for(var t=0;t<this._animatables.length;t++){this._animatables[t].speedRatio=this._speedRatio}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"targetedAnimations",{get:function(){return this._targetedAnimations},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animatables",{get:function(){return this._animatables},enumerable:!0,configurable:!0}),e.prototype.addTargetedAnimation=function(e,t){var i={animation:e,target:t},r=e.getKeys();return this._from>r[0].frame&&(this._from=r[0].frame),this._to<r[r.length-1].frame&&(this._to=r[r.length-1].frame),this._targetedAnimations.push(i),i},e.prototype.normalize=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null),null==e&&(e=this._from),null==t&&(t=this._to);for(var i=0;i<this._targetedAnimations.length;i++){var r=this._targetedAnimations[i].animation.getKeys(),n=r[0],o=r[r.length-1];if(n.frame>e){var s={frame:e,value:n.value,inTangent:n.inTangent,outTangent:n.outTangent,interpolation:n.interpolation};r.splice(0,0,s)}if(o.frame<t){s={frame:t,value:o.value,inTangent:o.outTangent,outTangent:o.outTangent,interpolation:o.interpolation};r.push(s)}}return this._from=e,this._to=t,this},e.prototype.start=function(i,r,n,o){var s=this;if(void 0===i&&(i=!1),void 0===r&&(r=1),this._isStarted||0===this._targetedAnimations.length)return this;for(var e=function(e){var t=a._scene.beginDirectAnimation(e.target,[e.animation],void 0!==n?n:a._from,void 0!==o?o:a._to,i,r);t.onAnimationEnd=function(){s.onAnimationEndObservable.notifyObservers(e),s._checkAnimationGroupEnded(t)},a._animatables.push(t)},a=this,t=0,l=this._targetedAnimations;t<l.length;t++){e(l[t])}return this._speedRatio=r,this._isStarted=!0,this},e.prototype.pause=function(){if(!this._isStarted)return this;for(var e=0;e<this._animatables.length;e++){this._animatables[e].pause()}return this.onAnimationGroupPauseObservable.notifyObservers(this),this},e.prototype.play=function(e){if(this.isStarted&&this._animatables.length===this._targetedAnimations.length){if(void 0!==e)for(var t=0;t<this._animatables.length;t++){this._animatables[t].loopAnimation=e}this.restart()}else this.stop(),this.start(e,this._speedRatio);return this},e.prototype.reset=function(){if(!this._isStarted)return this;for(var e=0;e<this._animatables.length;e++){this._animatables[e].reset()}return this},e.prototype.restart=function(){if(!this._isStarted)return this;for(var e=0;e<this._animatables.length;e++){this._animatables[e].restart()}return this},e.prototype.stop=function(){if(!this._isStarted)return this;for(var e=this._animatables.slice(),t=0;t<e.length;t++)e[t].stop();return this._isStarted=!1,this},e.prototype.setWeightForAllAnimatables=function(e){for(var t=0;t<this._animatables.length;t++){this._animatables[t].weight=e}return this},e.prototype.syncAllAnimationsWith=function(e){for(var t=0;t<this._animatables.length;t++){this._animatables[t].syncWith(e)}return this},e.prototype.goToFrame=function(e){if(!this._isStarted)return this;for(var t=0;t<this._animatables.length;t++){this._animatables[t].goToFrame(e)}return this},e.prototype.dispose=function(){this._targetedAnimations=[],this._animatables=[];var e=this._scene.animationGroups.indexOf(this);-1<e&&this._scene.animationGroups.splice(e,1)},e.prototype._checkAnimationGroupEnded=function(e){var t=this._animatables.indexOf(e);-1<t&&this._animatables.splice(t,1),0===this._animatables.length&&(this._isStarted=!1,this.onAnimationGroupEndObservable.notifyObservers(this))},e.Parse=function(e,t){for(var i=new l.AnimationGroup(e.name,t),r=0;r<e.targetedAnimations.length;r++){var n=e.targetedAnimations[r],o=l.Animation.Parse(n.animation),s=n.targetId,a=t.getNodeByID(s);null!=a&&i.addTargetedAnimation(o,a)}return null!==e.from&&null!==e.from&&i.normalize(e.from,e.to),i},e.prototype.getClassName=function(){return"AnimationGroup"},e.prototype.toString=function(e){var t="Name: "+this.name;return t+=", type: "+this.getClassName(),e&&(t+=", from: "+this._from,t+=", to: "+this._to,t+=", isStarted: "+this._isStarted,t+=", speedRatio: "+this._speedRatio,t+=", targetedAnimations length: "+this._targetedAnimations.length,t+=", animatables length: "+this._animatables),t},e})();l.AnimationGroup=t})($a||($a={})),Ze=$a||($a={}),qe=Object.freeze(new Ze.Quaternion(0,0,0,0)),Je=Object.freeze(Ze.Vector3.Zero()),$e=Object.freeze(Ze.Vector2.Zero()),et=Object.freeze(Ze.Size.Zero()),tt=Object.freeze(Ze.Color3.Black()),it=(function(){function e(e,t,i,r){var n=this;this._events=new Array,this._currentFrame=0,this._originalValue=new Array,this._offsetsCache={},this._highLimitsCache={},this._stopped=!1,this._blendingFactor=0,this._targetPath="",this._weight=1,this._ratioOffset=0,this._previousDelay=0,this._previousRatio=0,this._animation=t,this._target=e,this._scene=i,this._host=r,t._runtimeAnimations.push(this);var o=t.getEvents();o&&0<o.length&&o.forEach((function(e){n._events.push(e._clone())}))}return Object.defineProperty(e.prototype,"currentFrame",{get:function(){return this._currentFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentValue",{get:function(){return this._currentValue},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"targetPath",{get:function(){return this._targetPath},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"target",{get:function(){return this._activeTarget},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animation",{get:function(){return this._animation},enumerable:!0,configurable:!0}),e.prototype.reset=function(e){if(void 0===e&&(e=!1),e)if(this._target instanceof Array)for(var t=0,i=0,r=this._target;i<r.length;i++){var n=r[i];void 0!==this._originalValue[t]&&this._setValue(n,this._originalValue[t],-1),t++}else void 0!==this._originalValue[0]&&this._setValue(this._target,this._originalValue[0],-1);this._offsetsCache={},this._highLimitsCache={},this._currentFrame=0,this._blendingFactor=0,this._originalValue=new Array;for(t=0;t<this._events.length;t++)this._events[t].isDone=!1},e.prototype.isStopped=function(){return this._stopped},e.prototype.dispose=function(){var e=this._animation.runtimeAnimations.indexOf(this);-1<e&&this._animation.runtimeAnimations.splice(e,1)},e.prototype._interpolate=function(e,t,i,r,n){return this._currentFrame=e,this._animation.dataType!==Ze.Animation.ANIMATIONTYPE_MATRIX||this._workValue||(this._workValue=Ze.Matrix.Zero()),this._animation._interpolate(e,t,this._workValue,i,r,n)},e.prototype.setValue=function(e,t){if(void 0===t&&(t=1),this._target instanceof Array)for(var i=0,r=0,n=this._target;r<n.length;r++){var o=n[r];this._setValue(o,e,t,i),i++}else this._setValue(this._target,e,t)},e.prototype._setValue=function(e,t,i,r){var n,o;void 0===r&&(r=0);var s=this._animation.targetPropertyPath;if(1<s.length){for(var a=e[s[0]],l=1;l<s.length-1;l++)a=a[s[l]];n=s[s.length-1],o=a}else n=s[0],o=e;if(this._targetPath=n,this._activeTarget=o,this._weight=i,void 0===this._originalValue[r]){var c=void 0;(c=o.getRestPose&&"_matrix"===n?o.getRestPose():o[n])&&c.clone?this._originalValue[r]=c.clone():this._originalValue[r]=c}if((e&&e.animationPropertiesOverride?e.animationPropertiesOverride.enableBlending:this._animation.enableBlending)&&this._blendingFactor<=1){if(!this._originalBlendValue)(c=o[n]).clone?this._originalBlendValue=c.clone():this._originalBlendValue=c;this._originalBlendValue.m?Ze.Animation.AllowMatrixDecomposeForInterpolation?this._currentValue?Ze.Matrix.DecomposeLerpToRef(this._originalBlendValue,t,this._blendingFactor,this._currentValue):this._currentValue=Ze.Matrix.DecomposeLerp(this._originalBlendValue,t,this._blendingFactor):this._currentValue?Ze.Matrix.LerpToRef(this._originalBlendValue,t,this._blendingFactor,this._currentValue):this._currentValue=Ze.Matrix.Lerp(this._originalBlendValue,t,this._blendingFactor):this._currentValue=Ze.Animation._UniversalLerp(this._originalBlendValue,t,this._blendingFactor);var h=e&&e.animationPropertiesOverride?e.animationPropertiesOverride.blendingSpeed:this._animation.blendingSpeed;this._blendingFactor+=h}else this._currentValue=t;-1!==i?this._scene._registerTargetForLateAnimationBinding(this,this._originalValue[r]):o[n]=this._currentValue,e.markAsDirty&&e.markAsDirty(this._animation.targetProperty)},e.prototype._getCorrectLoopMode=function(){return this._target&&this._target.animationPropertiesOverride?this._target.animationPropertiesOverride.loopMode:this._animation.loopMode},e.prototype.goToFrame=function(e){var t=this._animation.getKeys();e<t[0].frame?e=t[0].frame:e>t[t.length-1].frame&&(e=t[t.length-1].frame);var i=this._interpolate(e,0,this._getCorrectLoopMode());this.setValue(i,-1)},e.prototype._prepareForSpeedRatioChange=function(e){var t=this._previousDelay*(this._animation.framePerSecond*e)/1e3;this._ratioOffset=this._previousRatio-t},e.prototype.animate=function(e,t,i,r,n,o){void 0===o&&(o=-1);var s=this._animation.targetPropertyPath;if(!s||s.length<1)return!(this._stopped=!0);var a=!0,l=this._animation.getKeys();if(0!==l[0].frame){var c={frame:0,value:l[0].value};l.splice(0,0,c)}else if(1===l.length){c={frame:.001,value:l[0].value};l.push(c)}(t<l[0].frame||t>l[l.length-1].frame)&&(t=l[0].frame),(i<l[0].frame||i>l[l.length-1].frame)&&(i=l[l.length-1].frame),t===i&&(t>l[0].frame?t--:i<l[l.length-1].frame&&i++);var h,u=i-t,d=e*(this._animation.framePerSecond*n)/1e3+this._ratioOffset,f=0;if(this._previousDelay=e,this._previousRatio=d,(t<i&&u<=d||i<t&&d<=u)&&!r)a=!1,f=this._animation._getKeyValue(l[l.length-1].value);else if(this._getCorrectLoopMode()!==Ze.Animation.ANIMATIONLOOPMODE_CYCLE){var p=i.toString()+t.toString();if(!this._offsetsCache[p]){var _=this._interpolate(t,0,Ze.Animation.ANIMATIONLOOPMODE_CYCLE),m=this._interpolate(i,0,Ze.Animation.ANIMATIONLOOPMODE_CYCLE);switch(this._animation.dataType){case Ze.Animation.ANIMATIONTYPE_FLOAT:this._offsetsCache[p]=m-_;break;case Ze.Animation.ANIMATIONTYPE_QUATERNION:this._offsetsCache[p]=m.subtract(_);break;case Ze.Animation.ANIMATIONTYPE_VECTOR3:this._offsetsCache[p]=m.subtract(_);case Ze.Animation.ANIMATIONTYPE_VECTOR2:this._offsetsCache[p]=m.subtract(_);case Ze.Animation.ANIMATIONTYPE_SIZE:this._offsetsCache[p]=m.subtract(_);case Ze.Animation.ANIMATIONTYPE_COLOR3:this._offsetsCache[p]=m.subtract(_)}this._highLimitsCache[p]=m}f=this._highLimitsCache[p],h=this._offsetsCache[p]}if(void 0===h)switch(this._animation.dataType){case Ze.Animation.ANIMATIONTYPE_FLOAT:h=0;break;case Ze.Animation.ANIMATIONTYPE_QUATERNION:h=qe;break;case Ze.Animation.ANIMATIONTYPE_VECTOR3:h=Je;break;case Ze.Animation.ANIMATIONTYPE_VECTOR2:h=$e;break;case Ze.Animation.ANIMATIONTYPE_SIZE:h=et;break;case Ze.Animation.ANIMATIONTYPE_COLOR3:h=tt}var g=d/u>>0,v=a?t+d%u:i;if(this._host&&this._host.syncRoot){var y=this._host.syncRoot;v=t+(i-t)*((y.masterFrame-y.fromFrame)/(y.toFrame-y.fromFrame))}var b=this._events;if(0<u&&this.currentFrame>v||u<0&&this.currentFrame<v)for(var T=0;T<b.length;T++)b[T].onlyOnce||(b[T].isDone=!1);var E=this._interpolate(v,g,this._getCorrectLoopMode(),h,f);this.setValue(E,o);for(T=0;T<b.length;T++)if(0<u&&v>=b[T].frame&&b[T].frame>=t||u<0&&v<=b[T].frame&&b[T].frame<=t){var x=b[T];x.isDone||(x.onlyOnce&&(b.splice(T,1),T--),x.isDone=!0,x.action(v))}return a||(this._stopped=!0),a},e})(),Ze.RuntimeAnimation=it,rt=$a||($a={}),nt=(function(){function e(e,t,i,r,n,o,s,a){void 0===i&&(i=0),void 0===r&&(r=100),void 0===n&&(n=!1),void 0===o&&(o=1),this.target=t,this.fromFrame=i,this.toFrame=r,this.loopAnimation=n,this.onAnimationEnd=s,this._localDelayOffset=null,this._pausedDelay=null,this._runtimeAnimations=new Array,this._paused=!1,this._speedRatio=1,this._weight=-1,this.disposeOnEnd=!0,this.animationStarted=!1,this.onAnimationEndObservable=new rt.Observable,this._scene=e,a&&this.appendAnimations(t,a),this._speedRatio=o,e._activeAnimatables.push(this)}return Object.defineProperty(e.prototype,"syncRoot",{get:function(){return this._syncRoot},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"masterFrame",{get:function(){return 0===this._runtimeAnimations.length?0:this._runtimeAnimations[0].currentFrame},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._weight},set:function(e){this._weight=-1!==e?Math.min(Math.max(e,0),1):-1},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"speedRatio",{get:function(){return this._speedRatio},set:function(e){for(var t=0;t<this._runtimeAnimations.length;t++){this._runtimeAnimations[t]._prepareForSpeedRatioChange(e)}this._speedRatio=e},enumerable:!0,configurable:!0}),e.prototype.syncWith=function(e){if(this._syncRoot=e){var t=this._scene._activeAnimatables.indexOf(this);-1<t&&(this._scene._activeAnimatables.splice(t,1),this._scene._activeAnimatables.push(this))}return this},e.prototype.getAnimations=function(){return this._runtimeAnimations},e.prototype.appendAnimations=function(e,t){for(var i=0;i<t.length;i++){var r=t[i];this._runtimeAnimations.push(new rt.RuntimeAnimation(e,r,this._scene,this))}},e.prototype.getAnimationByTargetProperty=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)if(t[i].animation.targetProperty===e)return t[i].animation;return null},e.prototype.getRuntimeAnimationByTargetProperty=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)if(t[i].animation.targetProperty===e)return t[i];return null},e.prototype.reset=function(){for(var e=this._runtimeAnimations,t=0;t<e.length;t++)e[t].reset(!0);this._localDelayOffset=null,this._pausedDelay=null},e.prototype.enableBlending=function(e){for(var t=this._runtimeAnimations,i=0;i<t.length;i++)t[i].animation.enableBlending=!0,t[i].animation.blendingSpeed=e},e.prototype.disableBlending=function(){for(var e=this._runtimeAnimations,t=0;t<e.length;t++)e[t].animation.enableBlending=!1},e.prototype.goToFrame=function(e){var t=this._runtimeAnimations;if(t[0]){var i=t[0].animation.framePerSecond,r=1e3*(e-t[0].currentFrame)/(i*this.speedRatio);null===this._localDelayOffset&&(this._localDelayOffset=0),this._localDelayOffset-=r}for(var n=0;n<t.length;n++)t[n].goToFrame(e)},e.prototype.pause=function(){this._paused||(this._paused=!0)},e.prototype.restart=function(){this._paused=!1},e.prototype._raiseOnAnimationEnd=function(){this.onAnimationEnd&&this.onAnimationEnd(),this.onAnimationEndObservable.notifyObservers(this)},e.prototype.stop=function(e,t){if(e||t){var i=this._scene._activeAnimatables.indexOf(this);if(-1<i){for(var r=(o=this._runtimeAnimations).length-1;0<=r;r--){var n=o[r];e&&n.animation.name!=e||(t&&!t(n.target)||(n.dispose(),o.splice(r,1)))}0==o.length&&(this._scene._activeAnimatables.splice(i,1),this._raiseOnAnimationEnd())}}else{if(-1<(r=this._scene._activeAnimatables.indexOf(this))){this._scene._activeAnimatables.splice(r,1);var o=this._runtimeAnimations;for(r=0;r<o.length;r++)o[r].dispose();this._raiseOnAnimationEnd()}}},e.prototype.waitAsync=function(){var i=this;return new Promise(function(e,t){i.onAnimationEndObservable.add((function(){e(i)}),void 0,void 0,i,!0)})},e.prototype._animate=function(e){if(this._paused)return this.animationStarted=!1,null===this._pausedDelay&&(this._pausedDelay=e),!0;if(null===this._localDelayOffset?(this._localDelayOffset=e,this._pausedDelay=null):null!==this._pausedDelay&&(this._localDelayOffset+=e-this._pausedDelay,this._pausedDelay=null),0===this._weight)return!0;var t,i=!1,r=this._runtimeAnimations;for(t=0;t<r.length;t++){var n=r[t].animate(e-this._localDelayOffset,this.fromFrame,this.toFrame,this.loopAnimation,this._speedRatio,this._weight);i=i||n}if(!(this.animationStarted=i)){if(this.disposeOnEnd)for(t=this._scene._activeAnimatables.indexOf(this),this._scene._activeAnimatables.splice(t,1),t=0;t<r.length;t++)r[t].dispose();this._raiseOnAnimationEnd(),this.disposeOnEnd&&(this.onAnimationEnd=null,this.onAnimationEndObservable.clear())}return i},e})(),rt.Animatable=nt,(function(t){var e=(function(){function t(){this._easingMode=t.EASINGMODE_EASEIN}return t.prototype.setEasingMode=function(e){var t=Math.min(Math.max(e,0),2);this._easingMode=t},t.prototype.getEasingMode=function(){return this._easingMode},t.prototype.easeInCore=function(e){throw new Error("You must implement this method")},t.prototype.ease=function(e){switch(this._easingMode){case t.EASINGMODE_EASEIN:return this.easeInCore(e);case t.EASINGMODE_EASEOUT:return 1-this.easeInCore(1-e)}return.5<=e?.5*(1-this.easeInCore(2*(1-e)))+.5:.5*this.easeInCore(2*e)},t.EASINGMODE_EASEIN=0,t.EASINGMODE_EASEOUT=1,t.EASINGMODE_EASEINOUT=2,t})(),i=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.easeInCore=function(e){return e=Math.max(0,Math.min(1,e)),1-Math.sqrt(1-e*e)},t})(t.EasingFunction=e);t.CircleEase=i;var r=(function(i){function e(e){void 0===e&&(e=1);var t=i.call(this)||this;return t.amplitude=e,t}return T(e,i),e.prototype.easeInCore=function(e){var t=Math.max(0,this.amplitude);return Math.pow(e,3)-e*t*Math.sin(3.141592653589793*e)},e})(e);t.BackEase=r;var n=(function(r){function e(e,t){void 0===e&&(e=3),void 0===t&&(t=2);var i=r.call(this)||this;return i.bounces=e,i.bounciness=t,i}return T(e,r),e.prototype.easeInCore=function(e){var t=Math.max(0,this.bounces),i=this.bounciness;i<=1&&(i=1.001);var r=Math.pow(i,t),n=1-i,o=(1-r)/n+.5*r,s=e*o,a=Math.log(-s*(1-i)+1)/Math.log(i),l=Math.floor(a),c=l+1,h=(1-Math.pow(i,l))/(n*o),u=.5*(h+(1-Math.pow(i,c))/(n*o)),d=e-u,f=u-h;return-Math.pow(1/i,t-l)/(f*f)*(d-f)*(d+f)},e})(e);t.BounceEase=n;var o=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.easeInCore=function(e){return e*e*e},t})(e);t.CubicEase=o;var s=(function(r){function e(e,t){void 0===e&&(e=3),void 0===t&&(t=3);var i=r.call(this)||this;return i.oscillations=e,i.springiness=t,i}return T(e,r),e.prototype.easeInCore=function(e){var t=Math.max(0,this.oscillations),i=Math.max(0,this.springiness);return(0==i?e:(Math.exp(i*e)-1)/(Math.exp(i)-1))*Math.sin((6.283185307179586*t+1.5707963267948966)*e)},e})(e);t.ElasticEase=s;var a=(function(i){function e(e){void 0===e&&(e=2);var t=i.call(this)||this;return t.exponent=e,t}return T(e,i),e.prototype.easeInCore=function(e){return this.exponent<=0?e:(Math.exp(this.exponent*e)-1)/(Math.exp(this.exponent)-1)},e})(e);t.ExponentialEase=a;var l=(function(i){function e(e){void 0===e&&(e=2);var t=i.call(this)||this;return t.power=e,t}return T(e,i),e.prototype.easeInCore=function(e){var t=Math.max(0,this.power);return Math.pow(e,t)},e})(e);t.PowerEase=l;var c=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.easeInCore=function(e){return e*e},t})(e);t.QuadraticEase=c;var h=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.easeInCore=function(e){return e*e*e*e},t})(e);t.QuarticEase=h;var u=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.easeInCore=function(e){return e*e*e*e*e},t})(e);t.QuinticEase=u;var d=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.easeInCore=function(e){return 1-Math.sin(1.5707963267948966*(1-e))},t})(e);t.SineEase=d;var f=(function(o){function e(e,t,i,r){void 0===e&&(e=0),void 0===t&&(t=0),void 0===i&&(i=1),void 0===r&&(r=1);var n=o.call(this)||this;return n.x1=e,n.y1=t,n.x2=i,n.y2=r,n}return T(e,o),e.prototype.easeInCore=function(e){return t.BezierCurve.Interpolate(e,this.x1,this.y1,this.x2,this.y2)},e})(e);t.BezierCurveEase=f})($a||($a={})),(function(t){var e=(function(){function e(e){this._actionManager=e}return e.prototype.isValid=function(){return!0},e.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},e.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},e.prototype.serialize=function(){},e.prototype._serialize=function(e){return{type:2,children:[],name:e.name,properties:e.properties}},e})(),i=(function(s){function a(e,t,i,r,n){void 0===n&&(n=a.IsEqual);var o=s.call(this,e)||this;return o.propertyPath=i,o.value=r,o.operator=n,o._target=t,o._effectiveTarget=o._getEffectiveTarget(t,o.propertyPath),o._property=o._getProperty(o.propertyPath),o}return T(a,s),Object.defineProperty(a,"IsEqual",{get:function(){return a._IsEqual},enumerable:!0,configurable:!0}),Object.defineProperty(a,"IsDifferent",{get:function(){return a._IsDifferent},enumerable:!0,configurable:!0}),Object.defineProperty(a,"IsGreater",{get:function(){return a._IsGreater},enumerable:!0,configurable:!0}),Object.defineProperty(a,"IsLesser",{get:function(){return a._IsLesser},enumerable:!0,configurable:!0}),a.prototype.isValid=function(){switch(this.operator){case a.IsGreater:return this._effectiveTarget[this._property]>this.value;case a.IsLesser:return this._effectiveTarget[this._property]<this.value;case a.IsEqual:case a.IsDifferent:var e;return e=this.value.equals?this.value.equals(this._effectiveTarget[this._property]):this.value===this._effectiveTarget[this._property],this.operator===a.IsEqual?e:!e}return!1},a.prototype.serialize=function(){return this._serialize({name:"ValueCondition",properties:[t.Action._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:t.Action._SerializeValueAsString(this.value)},{name:"operator",value:a.GetOperatorName(this.operator)}]})},a.GetOperatorName=function(e){switch(e){case a._IsEqual:return"IsEqual";case a._IsDifferent:return"IsDifferent";case a._IsGreater:return"IsGreater";case a._IsLesser:return"IsLesser";default:return""}},a._IsEqual=0,a._IsDifferent=1,a._IsGreater=2,a._IsLesser=3,a})(t.Condition=e);t.ValueCondition=i;var r=(function(r){function e(e,t){var i=r.call(this,e)||this;return i.predicate=t,i}return T(e,r),e.prototype.isValid=function(){return this.predicate()},e})(e);t.PredicateCondition=r;var n=(function(n){function e(e,t,i){var r=n.call(this,e)||this;return r.value=i,r._target=t,r}return T(e,n),e.prototype.isValid=function(){return this._target.state===this.value},e.prototype.serialize=function(){return this._serialize({name:"StateCondition",properties:[t.Action._GetTargetProperty(this._target),{name:"value",value:this.value}]})},e})(e);t.StateCondition=n})($a||($a={})),ot=$a||($a={}),st=(function(){function e(e,t){this.triggerOptions=e,this.onBeforeExecuteObservable=new ot.Observable,e.parameter?(this.trigger=e.trigger,this._triggerParameter=e.parameter):e.trigger?this.trigger=e.trigger:this.trigger=e,(this._nextActiveAction=this)._condition=t}return e.prototype._prepare=function(){},e.prototype.getTriggerParameter=function(){return this._triggerParameter},e.prototype._executeCurrent=function(e){if(this._nextActiveAction._condition){var t=this._nextActiveAction._condition,i=this._actionManager.getScene().getRenderId();if(t._evaluationId===i){if(!t._currentResult)return}else{if(t._evaluationId=i,!t.isValid())return void(t._currentResult=!1);t._currentResult=!0}}this.onBeforeExecuteObservable.notifyObservers(this),this._nextActiveAction.execute(e),this.skipToNextActiveAction()},e.prototype.execute=function(e){},e.prototype.skipToNextActiveAction=function(){this._nextActiveAction._child?(this._nextActiveAction._child._actionManager||(this._nextActiveAction._child._actionManager=this._actionManager),this._nextActiveAction=this._nextActiveAction._child):this._nextActiveAction=this},e.prototype.then=function(e){return(this._child=e)._actionManager=this._actionManager,e._prepare(),e},e.prototype._getProperty=function(e){return this._actionManager._getProperty(e)},e.prototype._getEffectiveTarget=function(e,t){return this._actionManager._getEffectiveTarget(e,t)},e.prototype.serialize=function(e){},e.prototype._serialize=function(e,t){var i={type:1,children:[],name:e.name,properties:e.properties||[]};if(this._child&&this._child.serialize(i),this._condition){var r=this._condition.serialize();return r.children.push(i),t&&t.children.push(r),r}return t&&t.children.push(i),i},e._SerializeValueAsString=function(e){return"number"==typeof e?e.toString():"boolean"==typeof e?e?"true":"false":e instanceof ot.Vector2?e.x+", "+e.y:e instanceof ot.Vector3?e.x+", "+e.y+", "+e.z:e instanceof ot.Color3?e.r+", "+e.g+", "+e.b:e instanceof ot.Color4?e.r+", "+e.g+", "+e.b+", "+e.a:e},e._GetTargetProperty=function(e){return{name:"target",targetType:e instanceof ot.Mesh?"MeshProperties":e instanceof ot.Light?"LightProperties":e instanceof ot.Camera?"CameraProperties":"SceneProperties",value:e instanceof ot.Scene?"Scene":e.name}},e})(),ot.Action=st,(function(S){var e=(function(){function n(e,t,i,r,n,o){this.source=e,this.pointerX=t,this.pointerY=i,this.meshUnderPointer=r,this.sourceEvent=n,this.additionalData=o}return n.CreateNew=function(e,t,i){var r=e.getScene();return new n(e,r.pointerX,r.pointerY,r.meshUnderPointer,t,i)},n.CreateNewFromSprite=function(e,t,i,r){return new n(e,t.pointerX,t.pointerY,t.meshUnderPointer,i,r)},n.CreateNewFromScene=function(e,t){return new n(null,e.pointerX,e.pointerY,e.meshUnderPointer,t)},n.CreateNewFromPrimitive=function(e,t,i,r){return new n(e,t.x,t.y,null,i,r)},n})();S.ActionEvent=e;var t=(function(){function A(e){this.actions=new Array,this.hoverCursor="",this._scene=e||S.Engine.LastCreatedScene,e.actionManagers.push(this)}return A.prototype.dispose=function(){for(var e=this._scene.actionManagers.indexOf(this),t=0;t<this.actions.length;t++){var i=this.actions[t];A.Triggers[i.trigger]--,0===A.Triggers[i.trigger]&&delete A.Triggers[i.trigger]}-1<e&&this._scene.actionManagers.splice(e,1)},A.prototype.getScene=function(){return this._scene},A.prototype.hasSpecificTriggers=function(e){for(var t=0;t<this.actions.length;t++){var i=this.actions[t];if(-1<e.indexOf(i.trigger))return!0}return!1},A.prototype.hasSpecificTriggers2=function(e,t){for(var i=0;i<this.actions.length;i++){var r=this.actions[i];if(e==r.trigger||t==r.trigger)return!0}return!1},A.prototype.hasSpecificTrigger=function(e,t){for(var i=0;i<this.actions.length;i++){var r=this.actions[i];if(r.trigger===e){if(!t)return!0;if(t(r.getTriggerParameter()))return!0}}return!1},Object.defineProperty(A.prototype,"hasPointerTriggers",{get:function(){for(var e=0;e<this.actions.length;e++){var t=this.actions[e];if(t.trigger>=A.OnPickTrigger&&t.trigger<=A.OnPointerOutTrigger)return!0}return!1},enumerable:!0,configurable:!0}),Object.defineProperty(A.prototype,"hasPickTriggers",{get:function(){for(var e=0;e<this.actions.length;e++){var t=this.actions[e];if(t.trigger>=A.OnPickTrigger&&t.trigger<=A.OnPickUpTrigger)return!0}return!1},enumerable:!0,configurable:!0}),Object.defineProperty(A,"HasTriggers",{get:function(){for(var e in A.Triggers)if(A.Triggers.hasOwnProperty(e))return!0;return!1},enumerable:!0,configurable:!0}),Object.defineProperty(A,"HasPickTriggers",{get:function(){for(var e in A.Triggers)if(A.Triggers.hasOwnProperty(e)){var t=parseInt(e);if(A.OnPickTrigger<=t&&t<=A.OnPickUpTrigger)return!0}return!1},enumerable:!0,configurable:!0}),A.HasSpecificTrigger=function(e){for(var t in A.Triggers){if(A.Triggers.hasOwnProperty(t))if(parseInt(t)===e)return!0}return!1},A.prototype.registerAction=function(e){return e.trigger===A.OnEveryFrameTrigger&&this.getScene().actionManager!==this?(S.Tools.Warn("OnEveryFrameTrigger can only be used with scene.actionManager"),null):(this.actions.push(e),A.Triggers[e.trigger]?A.Triggers[e.trigger]++:A.Triggers[e.trigger]=1,e._actionManager=this,e._prepare(),e)},A.prototype.unregisterAction=function(e){var t=this.actions.indexOf(e);return-1!==t&&(this.actions.splice(t,1),A.Triggers[e.trigger]-=1,0===A.Triggers[e.trigger]&&delete A.Triggers[e.trigger],delete e._actionManager,!0)},A.prototype.processTrigger=function(e,t){for(var i=0;i<this.actions.length;i++){var r=this.actions[i];if(r.trigger===e){if(t&&(e===A.OnKeyUpTrigger||e===A.OnKeyDownTrigger)){var n=r.getTriggerParameter();if(n&&n!==t.sourceEvent.keyCode){if(!n.toLowerCase)continue;var o=n.toLowerCase();if(o!==t.sourceEvent.key){var s=t.sourceEvent.charCode?t.sourceEvent.charCode:t.sourceEvent.keyCode;if(String.fromCharCode(s).toLowerCase()!==o)continue}}}r._executeCurrent(t)}}},A.prototype._getEffectiveTarget=function(e,t){for(var i=t.split("."),r=0;r<i.length-1;r++)e=e[i[r]];return e},A.prototype._getProperty=function(e){var t=e.split(".");return t[t.length-1]},A.prototype.serialize=function(e){for(var t={children:new Array,name:e,type:3,properties:new Array},i=0;i<this.actions.length;i++){var r={type:0,children:new Array,name:A.GetTriggerName(this.actions[i].trigger),properties:new Array},n=this.actions[i].triggerOptions;if(n&&"number"!=typeof n)if(n.parameter instanceof S.Node)r.properties.push(S.Action._GetTargetProperty(n.parameter));else{var o={};S.Tools.DeepCopy(n.parameter,o,["mesh"]),n.parameter&&n.parameter.mesh&&(o._meshId=n.parameter.mesh.id),r.properties.push({name:"parameter",targetType:null,value:o})}this.actions[i].serialize(r),t.children.push(r)}return t},A.Parse=function(e,t,T){var E=new A(T);null===t?T.actionManager=E:t.actionManager=E;for(var x=function(e,t,i,r){if(null===r){var n=parseFloat(t);return"true"===t||"false"===t?"true"===t:isNaN(n)?t:n}for(var o=r.split("."),s=t.split(","),a=0;a<o.length;a++)i=i[o[a]];if("boolean"==typeof i)return"true"===s[0];if("string"==typeof i)return s[0];var l=new Array;for(a=0;a<s.length;a++)l.push(parseFloat(s[a]));return i instanceof S.Vector3?S.Vector3.FromArray(l):i instanceof S.Vector4?S.Vector4.FromArray(l):i instanceof S.Color3?S.Color3.FromArray(l):i instanceof S.Color4?S.Color4.FromArray(l):parseFloat(s[0])},P=function(e,t,i,r,n){if(void 0===n&&(n=null),!e.detached){var o=new Array,s=null,a=null,l=e.combine&&0<e.combine.length;if(2===e.type?o.push(E):o.push(t),l){for(var c=new Array,h=0;h<e.combine.length;h++)P(e.combine[h],A.NothingTrigger,i,r,c);o.push(c)}else for(var u=0;u<e.properties.length;u++){var d=e.properties[u].value,f=e.properties[u].name,p=e.properties[u].targetType;"target"===f?d=s=null!==p&&"SceneProperties"===p?T:T.getNodeByName(d):"parent"===f?d=T.getNodeByName(d):"sound"===f?T.getSoundByName&&(d=T.getSoundByName(d)):"propertyPath"!==f?d=2===e.type&&"operator"===f?S.ValueCondition[d]:x(0,d,s,"value"===f?a:null):a=d,o.push(d)}if(null===n?o.push(i):o.push(null),"InterpolateValueAction"===e.name){var _=o[o.length-2];o[o.length-1]=_,o[o.length-2]=i}var m,g,v,y=(m=e.name,g=o,(v=Object.create(S.Tools.Instantiate("BABYLON."+m).prototype)).constructor.apply(v,g),v);if(y instanceof S.Condition&&null!==i){var b=new S.DoNothingAction(t,i);r?r.then(b):E.registerAction(b),r=b}null===n?y instanceof S.Condition?(i=y,y=r):(i=null,r?r.then(y):E.registerAction(y)):n.push(y);for(u=0;u<e.children.length;u++)P(e.children[u],t,i,y,null)}},i=0;i<e.children.length;i++){var r,n=e.children[i];if(0<n.properties.length){var o=n.properties[0].value,s=null===n.properties[0].targetType?o:T.getMeshByName(o);s._meshId&&(s.mesh=T.getMeshByID(s._meshId)),r={trigger:A[n.name],parameter:s}}else r=A[n.name];for(var a=0;a<n.children.length;a++)n.detached||P(n.children[a],r,null,null)}},A.GetTriggerName=function(e){switch(e){case 0:return"NothingTrigger";case 1:return"OnPickTrigger";case 2:return"OnLeftPickTrigger";case 3:return"OnRightPickTrigger";case 4:return"OnCenterPickTrigger";case 5:return"OnPickDownTrigger";case 6:return"OnPickUpTrigger";case 7:return"OnLongPressTrigger";case 8:return"OnPointerOverTrigger";case 9:return"OnPointerOutTrigger";case 10:return"OnEveryFrameTrigger";case 11:return"OnIntersectionEnterTrigger";case 12:return"OnIntersectionExitTrigger";case 13:return"OnKeyDownTrigger";case 14:return"OnKeyUpTrigger";case 15:return"OnPickOutTrigger";default:return""}},A.NothingTrigger=0,A.OnPickTrigger=1,A.OnLeftPickTrigger=2,A.OnRightPickTrigger=3,A.OnCenterPickTrigger=4,A.OnPickDownTrigger=5,A.OnDoublePickTrigger=6,A.OnPickUpTrigger=7,A.OnPickOutTrigger=16,A.OnLongPressTrigger=8,A.OnPointerOverTrigger=9,A.OnPointerOutTrigger=10,A.OnEveryFrameTrigger=11,A.OnIntersectionEnterTrigger=12,A.OnIntersectionExitTrigger=13,A.OnKeyDownTrigger=14,A.OnKeyUpTrigger=15,A.Triggers={},A})();S.ActionManager=t})($a||($a={})),at=$a||($a={}),lt=(function(c){function e(e,t,i,r,n,o,s,a){void 0===n&&(n=1e3);var l=c.call(this,e,o)||this;return l.duration=1e3,l.onInterpolationDoneObservable=new at.Observable,l.propertyPath=i,l.value=r,l.duration=n,l.stopOtherAnimations=s,l.onInterpolationDone=a,l._target=l._effectiveTarget=t,l}return T(e,c),e.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},e.prototype.execute=function(){var e,t=this,i=this._actionManager.getScene(),r=[{frame:0,value:this._effectiveTarget[this._property]},{frame:100,value:this.value}];if("number"==typeof this.value)e=at.Animation.ANIMATIONTYPE_FLOAT;else if(this.value instanceof at.Color3)e=at.Animation.ANIMATIONTYPE_COLOR3;else if(this.value instanceof at.Vector3)e=at.Animation.ANIMATIONTYPE_VECTOR3;else if(this.value instanceof at.Matrix)e=at.Animation.ANIMATIONTYPE_MATRIX;else{if(!(this.value instanceof at.Quaternion))return void at.Tools.Warn("InterpolateValueAction: Unsupported type ("+typeof this.value+")");e=at.Animation.ANIMATIONTYPE_QUATERNION}var n=new at.Animation("InterpolateValueAction",this._property,1e3/this.duration*100,e,at.Animation.ANIMATIONLOOPMODE_CONSTANT);n.setKeys(r),this.stopOtherAnimations&&i.stopAnimation(this._effectiveTarget);i.beginDirectAnimation(this._effectiveTarget,[n],0,100,!1,1,(function(){t.onInterpolationDoneObservable.notifyObservers(t),t.onInterpolationDone&&t.onInterpolationDone()}))},e.prototype.serialize=function(e){return c.prototype._serialize.call(this,{name:"InterpolateValueAction",properties:[at.Action._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:at.Action._SerializeValueAsString(this.value)},{name:"duration",value:at.Action._SerializeValueAsString(this.duration)},{name:"stopOtherAnimations",value:at.Action._SerializeValueAsString(this.stopOtherAnimations)||!1}]},e)},e})(at.Action),at.InterpolateValueAction=lt,(function(r){var e=(function(o){function e(e,t,i,r){var n=o.call(this,e,r)||this;return n.propertyPath=i,n._target=n._effectiveTarget=t,n}return T(e,o),e.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},e.prototype.execute=function(){this._effectiveTarget[this._property]=!this._effectiveTarget[this._property]},e.prototype.serialize=function(e){return o.prototype._serialize.call(this,{name:"SwitchBooleanAction",properties:[r.Action._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath}]},e)},e})(r.Action);r.SwitchBooleanAction=e;var t=(function(o){function e(e,t,i,r){var n=o.call(this,e,r)||this;return n.value=i,n._target=t,n}return T(e,o),e.prototype.execute=function(){this._target.state=this.value},e.prototype.serialize=function(e){return o.prototype._serialize.call(this,{name:"SetStateAction",properties:[r.Action._GetTargetProperty(this._target),{name:"value",value:this.value}]},e)},e})(r.Action);r.SetStateAction=t;var i=(function(s){function e(e,t,i,r,n){var o=s.call(this,e,n)||this;return o.propertyPath=i,o.value=r,o._target=o._effectiveTarget=t,o}return T(e,s),e.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath)},e.prototype.execute=function(){this._effectiveTarget[this._property]=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},e.prototype.serialize=function(e){return s.prototype._serialize.call(this,{name:"SetValueAction",properties:[r.Action._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:r.Action._SerializeValueAsString(this.value)}]},e)},e})(r.Action);r.SetValueAction=i;var n=(function(s){function e(e,t,i,r,n){var o=s.call(this,e,n)||this;return o.propertyPath=i,o.value=r,o._target=o._effectiveTarget=t,o}return T(e,s),e.prototype._prepare=function(){this._effectiveTarget=this._getEffectiveTarget(this._effectiveTarget,this.propertyPath),this._property=this._getProperty(this.propertyPath),"number"!=typeof this._effectiveTarget[this._property]&&r.Tools.Warn("Warning: IncrementValueAction can only be used with number values")},e.prototype.execute=function(){this._effectiveTarget[this._property]+=this.value,this._target.markAsDirty&&this._target.markAsDirty(this._property)},e.prototype.serialize=function(e){return s.prototype._serialize.call(this,{name:"IncrementValueAction",properties:[r.Action._GetTargetProperty(this._target),{name:"propertyPath",value:this.propertyPath},{name:"value",value:r.Action._SerializeValueAsString(this.value)}]},e)},e})(r.Action);r.IncrementValueAction=n;var o=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,o)||this;return s.from=i,s.to=r,s.loop=n,s._target=t,s}return T(e,a),e.prototype._prepare=function(){},e.prototype.execute=function(){this._actionManager.getScene().beginAnimation(this._target,this.from,this.to,this.loop)},e.prototype.serialize=function(e){return a.prototype._serialize.call(this,{name:"PlayAnimationAction",properties:[r.Action._GetTargetProperty(this._target),{name:"from",value:String(this.from)},{name:"to",value:String(this.to)},{name:"loop",value:r.Action._SerializeValueAsString(this.loop)||!1}]},e)},e})(r.Action);r.PlayAnimationAction=o;var s=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r._target=t,r}return T(e,n),e.prototype._prepare=function(){},e.prototype.execute=function(){this._actionManager.getScene().stopAnimation(this._target)},e.prototype.serialize=function(e){return n.prototype._serialize.call(this,{name:"StopAnimationAction",properties:[r.Action._GetTargetProperty(this._target)]},e)},e})(r.Action);r.StopAnimationAction=s;var a=(function(i){function e(e,t){return void 0===e&&(e=r.ActionManager.NothingTrigger),i.call(this,e,t)||this}return T(e,i),e.prototype.execute=function(){},e.prototype.serialize=function(e){return i.prototype._serialize.call(this,{name:"DoNothingAction",properties:[]},e)},e})(r.Action);r.DoNothingAction=a;var l=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r.children=t,r}return T(e,n),e.prototype._prepare=function(){for(var e=0;e<this.children.length;e++)this.children[e]._actionManager=this._actionManager,this.children[e]._prepare()},e.prototype.execute=function(e){for(var t=0;t<this.children.length;t++)this.children[t].execute(e)},e.prototype.serialize=function(e){for(var t=n.prototype._serialize.call(this,{name:"CombineAction",properties:[],combine:[]},e),i=0;i<this.children.length;i++)t.combine.push(this.children[i].serialize(null));return t},e})(r.Action);r.CombineAction=l;var c=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r.func=t,r}return T(e,n),e.prototype.execute=function(e){this.func(e)},e})(r.Action);r.ExecuteCodeAction=c;var h=(function(o){function e(e,t,i,r){var n=o.call(this,e,r)||this;return n._target=t,n._parent=i,n}return T(e,o),e.prototype._prepare=function(){},e.prototype.execute=function(){if(this._target.parent!==this._parent){var e=this._parent.getWorldMatrix().clone();e.invert(),this._target.position=r.Vector3.TransformCoordinates(this._target.position,e),this._target.parent=this._parent}},e.prototype.serialize=function(e){return o.prototype._serialize.call(this,{name:"SetParentAction",properties:[r.Action._GetTargetProperty(this._target),r.Action._GetTargetProperty(this._parent)]},e)},e})(r.Action);r.SetParentAction=h})($a||($a={})),ct=$a||($a={}),ht=(function(){function e(e,t,i,r,n,o,s){if(void 0===o&&(o=.01),void 0===s&&(s=ct.Texture.TRILINEAR_SAMPLINGMODE),this.name=e,this.sprites=new Array,this.renderingGroupId=0,this.layerMask=268435455,this.fogEnabled=!0,this.isPickable=!1,this.onDisposeObservable=new ct.Observable,this._vertexBuffers={},n._getComponent(ct.SceneComponentConstants.NAME_SPRITE)||n._addComponent(new ct.SpriteSceneComponent(n)),this._capacity=i,this._spriteTexture=new ct.Texture(t,n,!0,!1,s),this._spriteTexture.wrapU=ct.Texture.CLAMP_ADDRESSMODE,this._spriteTexture.wrapV=ct.Texture.CLAMP_ADDRESSMODE,r.width&&r.height)this.cellWidth=r.width,this.cellHeight=r.height;else{if(void 0===r)return;this.cellWidth=r,this.cellHeight=r}this._epsilon=o,this._scene=n,this._scene.spriteManagers.push(this);for(var a=[],l=0,c=0;c<i;c++)a.push(l),a.push(l+1),a.push(l+2),a.push(l),a.push(l+2),a.push(l+3),l+=4;this._indexBuffer=n.getEngine().createIndexBuffer(a),this._vertexData=new Float32Array(16*i*4),this._buffer=new ct.Buffer(n.getEngine(),this._vertexData,!0,16);var h=this._buffer.createVertexBuffer(ct.VertexBuffer.PositionKind,0,4),u=this._buffer.createVertexBuffer("options",4,4),d=this._buffer.createVertexBuffer("cellInfo",8,4),f=this._buffer.createVertexBuffer(ct.VertexBuffer.ColorKind,12,4);this._vertexBuffers[ct.VertexBuffer.PositionKind]=h,this._vertexBuffers.options=u,this._vertexBuffers.cellInfo=d,this._vertexBuffers[ct.VertexBuffer.ColorKind]=f,this._effectBase=this._scene.getEngine().createEffect("sprites",[ct.VertexBuffer.PositionKind,"options","cellInfo",ct.VertexBuffer.ColorKind],["view","projection","textureInfos","alphaTest"],["diffuseSampler"],""),this._effectFog=this._scene.getEngine().createEffect("sprites",[ct.VertexBuffer.PositionKind,"options","cellInfo",ct.VertexBuffer.ColorKind],["view","projection","textureInfos","alphaTest","vFogInfos","vFogColor"],["diffuseSampler"],"#define FOG")}return Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"texture",{get:function(){return this._spriteTexture},set:function(e){this._spriteTexture=e},enumerable:!0,configurable:!0}),e.prototype._appendSpriteVertex=function(e,t,i,r,n){var o=16*e;0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===r?r=this._epsilon:1===r&&(r=1-this._epsilon),this._vertexData[o]=t.position.x,this._vertexData[o+1]=t.position.y,this._vertexData[o+2]=t.position.z,this._vertexData[o+3]=t.angle,this._vertexData[o+4]=t.width,this._vertexData[o+5]=t.height,this._vertexData[o+6]=i,this._vertexData[o+7]=r,this._vertexData[o+8]=t.invertU?1:0,this._vertexData[o+9]=t.invertV?1:0;var s=t.cellIndex/n>>0;this._vertexData[o+10]=t.cellIndex-s*n,this._vertexData[o+11]=s,this._vertexData[o+12]=t.color.r,this._vertexData[o+13]=t.color.g,this._vertexData[o+14]=t.color.b,this._vertexData[o+15]=t.color.a},e.prototype.intersects=function(e,t,i,r){for(var n=Math.min(this._capacity,this.sprites.length),o=ct.Vector3.Zero(),s=ct.Vector3.Zero(),a=Number.MAX_VALUE,l=null,c=ct.Vector3.Zero(),h=t.getViewMatrix(),u=0;u<n;u++){var d=this.sprites[u];if(d){if(i){if(!i(d))continue}else if(!d.isPickable)continue;if(ct.Vector3.TransformCoordinatesToRef(d.position,h,c),o.copyFromFloats(c.x-d.width/2,c.y-d.height/2,c.z),s.copyFromFloats(c.x+d.width/2,c.y+d.height/2,c.z),e.intersectsBoxMinMax(o,s)){var f=ct.Vector3.Distance(c,e.origin);if(f<a&&(a=f,l=d,r))break}}}if(l){var p=new ct.PickingInfo;return p.hit=!0,p.pickedSprite=l,p.distance=a,p}return null},e.prototype.render=function(){if(this._effectBase.isReady()&&this._effectFog.isReady()&&this._spriteTexture&&this._spriteTexture.isReady()){for(var e=this._scene.getEngine(),t=this._spriteTexture.getBaseSize(),i=e.getDeltaTime(),r=Math.min(this._capacity,this.sprites.length),n=t.width/this.cellWidth,o=0,s=0;s<r;s++){var a=this.sprites[s];a&&a.isVisible&&(a._animate(i),this._appendSpriteVertex(o++,a,0,0,n),this._appendSpriteVertex(o++,a,1,0,n),this._appendSpriteVertex(o++,a,1,1,n),this._appendSpriteVertex(o++,a,0,1,n))}this._buffer.update(this._vertexData);var l=this._effectBase;this._scene.fogEnabled&&this._scene.fogMode!==ct.Scene.FOGMODE_NONE&&this.fogEnabled&&(l=this._effectFog),e.enableEffect(l);var c=this._scene.getViewMatrix();l.setTexture("diffuseSampler",this._spriteTexture),l.setMatrix("view",c),l.setMatrix("projection",this._scene.getProjectionMatrix()),l.setFloat2("textureInfos",this.cellWidth/t.width,this.cellHeight/t.height),this._scene.fogEnabled&&this._scene.fogMode!==ct.Scene.FOGMODE_NONE&&this.fogEnabled&&(l.setFloat4("vFogInfos",this._scene.fogMode,this._scene.fogStart,this._scene.fogEnd,this._scene.fogDensity),l.setColor3("vFogColor",this._scene.fogColor)),e.bindBuffers(this._vertexBuffers,this._indexBuffer,l),e.setDepthFunctionToLessOrEqual(),l.setBool("alphaTest",!0),e.setColorWrite(!1),e.drawElementsType(ct.Material.TriangleFillMode,0,o/4*6),e.setColorWrite(!0),l.setBool("alphaTest",!1),e.setAlphaMode(ct.Engine.ALPHA_COMBINE),e.drawElementsType(ct.Material.TriangleFillMode,0,o/4*6),e.setAlphaMode(ct.Engine.ALPHA_DISABLE)}},e.prototype.dispose=function(){this._buffer&&(this._buffer.dispose(),this._buffer=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._spriteTexture&&(this._spriteTexture.dispose(),this._spriteTexture=null);var e=this._scene.spriteManagers.indexOf(this);this._scene.spriteManagers.splice(e,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},e})(),ct.SpriteManager=ht,ut=$a||($a={}),dt=(function(){function e(e,t){this.name=e,this.color=new ut.Color4(1,1,1,1),this.width=1,this.height=1,this.angle=0,this.cellIndex=0,this.invertU=0,this.invertV=0,this.animations=new Array,this.isPickable=!1,this._animationStarted=!1,this._loopAnimation=!1,this._fromIndex=0,this._toIndex=0,this._delay=0,this._direction=1,this._time=0,this.isVisible=!0,this._manager=t,this._manager.sprites.push(this),this.position=ut.Vector3.Zero()}return Object.defineProperty(e.prototype,"size",{get:function(){return this.width},set:function(e){this.width=e,this.height=e},enumerable:!0,configurable:!0}),e.prototype.playAnimation=function(e,t,i,r,n){this._fromIndex=e,this._toIndex=t,this._loopAnimation=i,this._delay=r,this._animationStarted=!0,this._direction=e<t?1:-1,this.cellIndex=e,this._time=0,this._onAnimationEnd=n},e.prototype.stopAnimation=function(){this._animationStarted=!1},e.prototype._animate=function(e){this._animationStarted&&(this._time+=e,this._time>this._delay&&(this._time=this._time%this._delay,this.cellIndex+=this._direction,this.cellIndex>this._toIndex&&(this._loopAnimation?this.cellIndex=this._fromIndex:(this.cellIndex=this._toIndex,this._animationStarted=!1,this._onAnimationEnd&&this._onAnimationEnd(),this.disposeWhenFinishedAnimating&&this.dispose()))))},e.prototype.dispose=function(){for(var e=0;e<this._manager.sprites.length;e++)this._manager.sprites[e]==this&&this._manager.sprites.splice(e,1)},e})(),ut.Sprite=dt,(function(l){l.Scene.prototype._internalPickSprites=function(e,t,i,r){if(!l.PickingInfo)return null;var n=null;if(!r){if(!this.activeCamera)return null;r=this.activeCamera}if(0<this.spriteManagers.length)for(var o=0;o<this.spriteManagers.length;o++){var s=this.spriteManagers[o];if(s.isPickable){var a=s.intersects(e,r,t,i);if(a&&a.hit&&(i||null==n||!(a.distance>=n.distance))&&(n=a,i))break}}return n||new l.PickingInfo},l.Scene.prototype.pickSprite=function(e,t,i,r,n){return this.createPickingRayInCameraSpaceToRef(e,t,this._tempSpritePickingRay,n),this._internalPickSprites(this._tempSpritePickingRay,i,r,n)},l.Scene.prototype.pickSpriteWithRay=function(e,t,i,r){if(!this._tempSpritePickingRay)return null;if(!r){if(!this.activeCamera)return null;r=this.activeCamera}return l.Ray.TransformToRef(e,r.getViewMatrix(),this._tempSpritePickingRay),this._internalPickSprites(this._tempSpritePickingRay,t,i,r)},l.Scene.prototype.setPointerOverSprite=function(e){this._pointerOverSprite!==e&&(this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(l.ActionManager.OnPointerOutTrigger,l.ActionEvent.CreateNewFromSprite(this._pointerOverSprite,this)),this._pointerOverSprite=e,this._pointerOverSprite&&this._pointerOverSprite.actionManager&&this._pointerOverSprite.actionManager.processTrigger(l.ActionManager.OnPointerOverTrigger,l.ActionEvent.CreateNewFromSprite(this._pointerOverSprite,this)))},l.Scene.prototype.getPointerOverSprite=function(){return this._pointerOverSprite};var e=(function(){function e(e){this.name=l.SceneComponentConstants.NAME_SPRITE,this.scene=e,this.scene.spriteManagers=new Array,this.scene._tempSpritePickingRay=l.Ray?l.Ray.Zero():null,this.scene.onBeforeSpritesRenderingObservable=new l.Observable,this.scene.onAfterSpritesRenderingObservable=new l.Observable,this._spritePredicate=function(e){return!!e.actionManager&&(e.isPickable&&e.actionManager.hasPointerTriggers)}}return e.prototype.register=function(){this.scene._pointerMoveStage.registerStep(l.SceneComponentConstants.STEP_POINTERMOVE_SPRITE,this,this._pointerMove),this.scene._pointerDownStage.registerStep(l.SceneComponentConstants.STEP_POINTERDOWN_SPRITE,this,this._pointerDown),this.scene._pointerUpStage.registerStep(l.SceneComponentConstants.STEP_POINTERUP_SPRITE,this,this._pointerUp)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){this.scene.onBeforeSpritesRenderingObservable.clear(),this.scene.onAfterSpritesRenderingObservable.clear();for(var e=this.scene.spriteManagers;e.length;)e[0].dispose()},e.prototype._pickSpriteButKeepRay=function(e,t,i,r,n){var o=this.scene.pickSprite(t,i,this._spritePredicate,r,n);return o&&(o.ray=e?e.ray:null),o},e.prototype._pointerMove=function(e,t,i,r,n){var o=this.scene;return r?o.setPointerOverSprite(null):(i=this._pickSpriteButKeepRay(i,e,t,!1,o.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite?(o.setPointerOverSprite(i.pickedSprite),o._pointerOverSprite&&o._pointerOverSprite.actionManager&&o._pointerOverSprite.actionManager.hoverCursor?n.style.cursor=o._pointerOverSprite.actionManager.hoverCursor:n.style.cursor=o.hoverCursor):o.setPointerOverSprite(null),i},e.prototype._pointerDown=function(e,t,i,r){var n=this.scene;if(n._pickedDownSprite=null,0<n.spriteManagers.length&&(i=n.pickSprite(e,t,this._spritePredicate,!1,n.cameraToUseForPointers||void 0))&&i.hit&&i.pickedSprite&&i.pickedSprite.actionManager){switch(n._pickedDownSprite=i.pickedSprite,r.button){case 0:i.pickedSprite.actionManager.processTrigger(l.ActionManager.OnLeftPickTrigger,l.ActionEvent.CreateNewFromSprite(i.pickedSprite,n,r));break;case 1:i.pickedSprite.actionManager.processTrigger(l.ActionManager.OnCenterPickTrigger,l.ActionEvent.CreateNewFromSprite(i.pickedSprite,n,r));break;case 2:i.pickedSprite.actionManager.processTrigger(l.ActionManager.OnRightPickTrigger,l.ActionEvent.CreateNewFromSprite(i.pickedSprite,n,r))}i.pickedSprite.actionManager&&i.pickedSprite.actionManager.processTrigger(l.ActionManager.OnPickDownTrigger,l.ActionEvent.CreateNewFromSprite(i.pickedSprite,n,r))}return i},e.prototype._pointerUp=function(e,t,i,r){var n=this.scene;if(0<n.spriteManagers.length){var o=n.pickSprite(e,t,this._spritePredicate,!1,n.cameraToUseForPointers||void 0);o&&(o.hit&&o.pickedSprite&&o.pickedSprite.actionManager&&(o.pickedSprite.actionManager.processTrigger(l.ActionManager.OnPickUpTrigger,l.ActionEvent.CreateNewFromSprite(o.pickedSprite,n,r)),o.pickedSprite.actionManager&&(this.scene._isPointerSwiping()||o.pickedSprite.actionManager.processTrigger(l.ActionManager.OnPickTrigger,l.ActionEvent.CreateNewFromSprite(o.pickedSprite,n,r)))),n._pickedDownSprite&&n._pickedDownSprite.actionManager&&n._pickedDownSprite!==o.pickedSprite&&n._pickedDownSprite.actionManager.processTrigger(l.ActionManager.OnPickOutTrigger,l.ActionEvent.CreateNewFromSprite(n._pickedDownSprite,n,r)))}return i},e})();l.SpriteSceneComponent=e})($a||($a={})),(function(_){var e=function(e,t,i){this.bu=e,this.bv=t,this.distance=i,this.faceId=0,this.subMeshId=0};_.IntersectionInfo=e;var t=(function(){function e(){this.hit=!1,this.distance=0,this.pickedPoint=null,this.pickedMesh=null,this.bu=0,this.bv=0,this.faceId=-1,this.subMeshId=0,this.pickedSprite=null,this.originMesh=null,this.ray=null}return e.prototype.getNormal=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!0),!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(_.VertexBuffer.NormalKind))return null;var i,r=this.pickedMesh.getIndices();if(!r)return null;if(t){var n=this.pickedMesh.getVerticesData(_.VertexBuffer.NormalKind),o=_.Vector3.FromArray(n,3*r[3*this.faceId]),s=_.Vector3.FromArray(n,3*r[3*this.faceId+1]),a=_.Vector3.FromArray(n,3*r[3*this.faceId+2]);o=o.scale(this.bu),s=s.scale(this.bv),a=a.scale(1-this.bu-this.bv),i=new _.Vector3(o.x+s.x+a.x,o.y+s.y+a.y,o.z+s.z+a.z)}else{var l=this.pickedMesh.getVerticesData(_.VertexBuffer.PositionKind),c=_.Vector3.FromArray(l,3*r[3*this.faceId]),h=_.Vector3.FromArray(l,3*r[3*this.faceId+1]),u=_.Vector3.FromArray(l,3*r[3*this.faceId+2]),d=c.subtract(h),f=u.subtract(h);i=_.Vector3.Cross(d,f)}if(e){var p=this.pickedMesh.getWorldMatrix();this.pickedMesh.nonUniformScaling&&(_.Tmp.Matrix[0].copyFrom(p),(p=_.Tmp.Matrix[0]).setTranslationFromFloats(0,0,0),p.invert(),p.transposeToRef(_.Tmp.Matrix[1]),p=_.Tmp.Matrix[1]),i=_.Vector3.TransformNormal(i,p)}return i.normalize(),i},e.prototype.getTextureCoordinates=function(){if(!this.pickedMesh||!this.pickedMesh.isVerticesDataPresent(_.VertexBuffer.UVKind))return null;var e=this.pickedMesh.getIndices();if(!e)return null;var t=this.pickedMesh.getVerticesData(_.VertexBuffer.UVKind);if(!t)return null;var i=_.Vector2.FromArray(t,2*e[3*this.faceId]),r=_.Vector2.FromArray(t,2*e[3*this.faceId+1]),n=_.Vector2.FromArray(t,2*e[3*this.faceId+2]);return i=i.scale(1-this.bu-this.bv),r=r.scale(this.bu),n=n.scale(this.bv),new _.Vector2(i.x+r.x+n.x,i.y+r.y+n.y)},e})();_.PickingInfo=t})($a||($a={})),ft=$a||($a={}),pt=(function(){function T(e,t,i){void 0===i&&(i=Number.MAX_VALUE),this.origin=e,this.direction=t,this.length=i}return T.prototype.intersectsBoxMinMax=function(e,t){var i,r,n,o,s=0,a=Number.MAX_VALUE;if(Math.abs(this.direction.x)<1e-7){if(this.origin.x<e.x||this.origin.x>t.x)return!1}else if(i=1/this.direction.x,r=(e.x-this.origin.x)*i,(n=(t.x-this.origin.x)*i)===-1/0&&(n=1/0),n<r&&(o=r,r=n,n=o),s=Math.max(r,s),(a=Math.min(n,a))<s)return!1;if(Math.abs(this.direction.y)<1e-7){if(this.origin.y<e.y||this.origin.y>t.y)return!1}else if(i=1/this.direction.y,r=(e.y-this.origin.y)*i,(n=(t.y-this.origin.y)*i)===-1/0&&(n=1/0),n<r&&(o=r,r=n,n=o),s=Math.max(r,s),(a=Math.min(n,a))<s)return!1;if(Math.abs(this.direction.z)<1e-7){if(this.origin.z<e.z||this.origin.z>t.z)return!1}else if(i=1/this.direction.z,r=(e.z-this.origin.z)*i,(n=(t.z-this.origin.z)*i)===-1/0&&(n=1/0),n<r&&(o=r,r=n,n=o),s=Math.max(r,s),(a=Math.min(n,a))<s)return!1;return!0},T.prototype.intersectsBox=function(e){return this.intersectsBoxMinMax(e.minimum,e.maximum)},T.prototype.intersectsSphere=function(e){var t=e.center.x-this.origin.x,i=e.center.y-this.origin.y,r=e.center.z-this.origin.z,n=t*t+i*i+r*r,o=e.radius*e.radius;if(n<=o)return!0;var s=t*this.direction.x+i*this.direction.y+r*this.direction.z;return!(s<0)&&n-s*s<=o},T.prototype.intersectsTriangle=function(e,t,i){this._edge1||(this._edge1=ft.Vector3.Zero(),this._edge2=ft.Vector3.Zero(),this._pvec=ft.Vector3.Zero(),this._tvec=ft.Vector3.Zero(),this._qvec=ft.Vector3.Zero()),t.subtractToRef(e,this._edge1),i.subtractToRef(e,this._edge2),ft.Vector3.CrossToRef(this.direction,this._edge2,this._pvec);var r=ft.Vector3.Dot(this._edge1,this._pvec);if(0===r)return null;var n=1/r;this.origin.subtractToRef(e,this._tvec);var o=ft.Vector3.Dot(this._tvec,this._pvec)*n;if(o<0||1<o)return null;ft.Vector3.CrossToRef(this._tvec,this._edge1,this._qvec);var s=ft.Vector3.Dot(this.direction,this._qvec)*n;if(s<0||1<o+s)return null;var a=ft.Vector3.Dot(this._edge2,this._qvec)*n;return a>this.length?null:new ft.IntersectionInfo(o,s,a)},T.prototype.intersectsPlane=function(e){var t,i=ft.Vector3.Dot(e.normal,this.direction);if(Math.abs(i)<9.99999997475243e-7)return null;var r=ft.Vector3.Dot(e.normal,this.origin);return(t=(-e.d-r)/i)<0?t<-9.99999997475243e-7?null:0:t},T.prototype.intersectsMesh=function(e,t){var i=ft.Tmp.Matrix[0];return e.getWorldMatrix().invertToRef(i),this._tmpRay?T.TransformToRef(this,i,this._tmpRay):this._tmpRay=T.Transform(this,i),e.intersects(this._tmpRay,t)},T.prototype.intersectsMeshes=function(e,t,i){i?i.length=0:i=[];for(var r=0;r<e.length;r++){var n=this.intersectsMesh(e[r],t);n.hit&&i.push(n)}return i.sort(this._comparePickingInfo),i},T.prototype._comparePickingInfo=function(e,t){return e.distance<t.distance?-1:e.distance>t.distance?1:0},T.prototype.intersectionSegment=function(e,t,i){var r,n,o,s,a=this.origin.add(this.direction.multiplyByFloats(T.rayl,T.rayl,T.rayl)),l=t.subtract(e),c=a.subtract(this.origin),h=e.subtract(this.origin),u=ft.Vector3.Dot(l,l),d=ft.Vector3.Dot(l,c),f=ft.Vector3.Dot(c,c),p=ft.Vector3.Dot(l,h),_=ft.Vector3.Dot(c,h),m=u*f-d*d,g=m,v=m;m<T.smallnum?(n=0,g=1,s=_,v=f):(s=u*_-d*p,(n=d*_-f*p)<0?(n=0,s=_,v=f):g<n&&(n=g,s=_+d,v=f)),s<0?-p<(s=0)?n=0:u<-p?n=g:(n=-p,g=u):v<s&&(s=v,-p+d<0?n=0:u<-p+d?n=g:(n=-p+d,g=u)),r=Math.abs(n)<T.smallnum?0:n/g,o=Math.abs(s)<T.smallnum?0:s/v;var y=c.multiplyByFloats(o,o,o),b=h.add(l.multiplyByFloats(r,r,r)).subtract(y);return 0<o&&o<=this.length&&b.lengthSquared()<i*i?y.length():-1},T.prototype.update=function(e,t,i,r,n,o,s){return ft.Vector3.UnprojectFloatsToRef(e,t,0,i,r,n,o,s,this.origin),ft.Vector3.UnprojectFloatsToRef(e,t,1,i,r,n,o,s,ft.Tmp.Vector3[0]),ft.Tmp.Vector3[0].subtractToRef(this.origin,this.direction),this.direction.normalize(),this},T.Zero=function(){return new T(ft.Vector3.Zero(),ft.Vector3.Zero())},T.CreateNew=function(e,t,i,r,n,o,s){return T.Zero().update(e,t,i,r,n,o,s)},T.CreateNewFromTo=function(e,t,i){void 0===i&&(i=ft.Matrix.Identity());var r=t.subtract(e),n=Math.sqrt(r.x*r.x+r.y*r.y+r.z*r.z);return r.normalize(),T.Transform(new T(e,r,n),i)},T.Transform=function(e,t){var i=new T(new ft.Vector3(0,0,0),new ft.Vector3(0,0,0));return T.TransformToRef(e,t,i),i},T.TransformToRef=function(e,t,i){ft.Vector3.TransformCoordinatesToRef(e.origin,t,i.origin),ft.Vector3.TransformNormalToRef(e.direction,t,i.direction),i.length=e.length;var r=i.direction,n=r.length();if(0!==n&&1!==n){var o=1/n;r.x*=o,r.y*=o,r.z*=o,i.length*=n}},T.smallnum=1e-8,T.rayl=1e9,T})(),ft.Ray=pt,_t=$a||($a={}),mt={root:0,found:!1},gt=function(e,t,i,r){mt.root=0,mt.found=!1;var n=t*t-4*e*i;if(n<0)return mt;var o=Math.sqrt(n),s=(-t-o)/(2*e),a=(-t+o)/(2*e);if(a<s){var l=a;a=s,s=l}return 0<s&&s<r?(mt.root=s,mt.found=!0):0<a&&a<r&&(mt.root=a,mt.found=!0),mt},vt=(function(){function e(){this._collisionPoint=_t.Vector3.Zero(),this._planeIntersectionPoint=_t.Vector3.Zero(),this._tempVector=_t.Vector3.Zero(),this._tempVector2=_t.Vector3.Zero(),this._tempVector3=_t.Vector3.Zero(),this._tempVector4=_t.Vector3.Zero(),this._edge=_t.Vector3.Zero(),this._baseToVertex=_t.Vector3.Zero(),this._destinationPoint=_t.Vector3.Zero(),this._slidePlaneNormal=_t.Vector3.Zero(),this._displacementVector=_t.Vector3.Zero(),this._radius=_t.Vector3.One(),this._retry=0,this._basePointWorld=_t.Vector3.Zero(),this._velocityWorld=_t.Vector3.Zero(),this._normalizedVelocity=_t.Vector3.Zero(),this._collisionMask=-1}return Object.defineProperty(e.prototype,"collisionMask",{get:function(){return this._collisionMask},set:function(e){this._collisionMask=isNaN(e)?-1:e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"slidePlaneNormal",{get:function(){return this._slidePlaneNormal},enumerable:!0,configurable:!0}),e.prototype._initialize=function(e,t,i){this._velocity=t,_t.Vector3.NormalizeToRef(t,this._normalizedVelocity),(this._basePoint=e).multiplyToRef(this._radius,this._basePointWorld),t.multiplyToRef(this._radius,this._velocityWorld),this._velocityWorldLength=this._velocityWorld.length(),this._epsilon=i,this.collisionFound=!1},e.prototype._checkPointInTriangle=function(e,t,i,r,n){t.subtractToRef(e,this._tempVector),i.subtractToRef(e,this._tempVector2),_t.Vector3.CrossToRef(this._tempVector,this._tempVector2,this._tempVector4);var o=_t.Vector3.Dot(this._tempVector4,n);return!(o<0)&&(r.subtractToRef(e,this._tempVector3),_t.Vector3.CrossToRef(this._tempVector2,this._tempVector3,this._tempVector4),!((o=_t.Vector3.Dot(this._tempVector4,n))<0)&&(_t.Vector3.CrossToRef(this._tempVector3,this._tempVector,this._tempVector4),0<=(o=_t.Vector3.Dot(this._tempVector4,n))))},e.prototype._canDoCollision=function(e,t,i,r){var n,o,s,a,l=_t.Vector3.Distance(this._basePointWorld,e),c=Math.max(this._radius.x,this._radius.y,this._radius.z);return!(l>this._velocityWorldLength+c+t)&&(n=i,o=r,s=this._basePointWorld,a=this._velocityWorldLength+c,!(n.x>s.x+a||s.x-a>o.x||n.y>s.y+a||s.y-a>o.y||n.z>s.z+a||s.z-a>o.z))},e.prototype._testTriangle=function(e,t,i,r,n,o){var s,a=!1;t||(t=[]),t[e]||(t[e]=new _t.Plane(0,0,0,0),t[e].copyFromPoints(i,r,n));var l=t[e];if(o||l.isFrontFacingTo(this._normalizedVelocity,0)){var c=l.signedDistanceTo(this._basePoint),h=_t.Vector3.Dot(l.normal,this._velocity);if(0==h){if(1<=Math.abs(c))return;a=!0,s=0}else{var u=(1-c)/h;if(u<(s=(-1-c)/h)){var d=u;u=s,s=d}if(1<s||u<0)return;s<0&&(s=0),1<s&&(s=1)}this._collisionPoint.copyFromFloats(0,0,0);var f=!1,p=1;if(a||(this._basePoint.subtractToRef(l.normal,this._planeIntersectionPoint),this._velocity.scaleToRef(s,this._tempVector),this._planeIntersectionPoint.addInPlace(this._tempVector),this._checkPointInTriangle(this._planeIntersectionPoint,i,r,n,l.normal)&&(f=!0,p=s,this._collisionPoint.copyFrom(this._planeIntersectionPoint))),!f){var _=this._velocity.lengthSquared(),m=_;this._basePoint.subtractToRef(i,this._tempVector);var g=2*_t.Vector3.Dot(this._velocity,this._tempVector),v=this._tempVector.lengthSquared()-1,y=gt(m,g,v,p);y.found&&(p=y.root,f=!0,this._collisionPoint.copyFrom(i)),this._basePoint.subtractToRef(r,this._tempVector),g=2*_t.Vector3.Dot(this._velocity,this._tempVector),v=this._tempVector.lengthSquared()-1,(y=gt(m,g,v,p)).found&&(p=y.root,f=!0,this._collisionPoint.copyFrom(r)),this._basePoint.subtractToRef(n,this._tempVector),g=2*_t.Vector3.Dot(this._velocity,this._tempVector),v=this._tempVector.lengthSquared()-1,(y=gt(m,g,v,p)).found&&(p=y.root,f=!0,this._collisionPoint.copyFrom(n)),r.subtractToRef(i,this._edge),i.subtractToRef(this._basePoint,this._baseToVertex);var b=this._edge.lengthSquared(),T=_t.Vector3.Dot(this._edge,this._velocity),E=_t.Vector3.Dot(this._edge,this._baseToVertex);if(m=b*-_+T*T,g=b*(2*_t.Vector3.Dot(this._velocity,this._baseToVertex))-2*T*E,v=b*(1-this._baseToVertex.lengthSquared())+E*E,(y=gt(m,g,v,p)).found){var x=(T*y.root-E)/b;0<=x&&x<=1&&(p=y.root,f=!0,this._edge.scaleInPlace(x),i.addToRef(this._edge,this._collisionPoint))}n.subtractToRef(r,this._edge),r.subtractToRef(this._basePoint,this._baseToVertex),b=this._edge.lengthSquared(),T=_t.Vector3.Dot(this._edge,this._velocity),E=_t.Vector3.Dot(this._edge,this._baseToVertex),m=b*-_+T*T,g=b*(2*_t.Vector3.Dot(this._velocity,this._baseToVertex))-2*T*E,v=b*(1-this._baseToVertex.lengthSquared())+E*E,(y=gt(m,g,v,p)).found&&0<=(x=(T*y.root-E)/b)&&x<=1&&(p=y.root,f=!0,this._edge.scaleInPlace(x),r.addToRef(this._edge,this._collisionPoint)),i.subtractToRef(n,this._edge),n.subtractToRef(this._basePoint,this._baseToVertex),b=this._edge.lengthSquared(),T=_t.Vector3.Dot(this._edge,this._velocity),E=_t.Vector3.Dot(this._edge,this._baseToVertex),m=b*-_+T*T,g=b*(2*_t.Vector3.Dot(this._velocity,this._baseToVertex))-2*T*E,v=b*(1-this._baseToVertex.lengthSquared())+E*E,(y=gt(m,g,v,p)).found&&0<=(x=(T*y.root-E)/b)&&x<=1&&(p=y.root,f=!0,this._edge.scaleInPlace(x),n.addToRef(this._edge,this._collisionPoint))}if(f){var P=p*this._velocity.length();(!this.collisionFound||P<this._nearestDistance)&&(this.intersectionPoint?this.intersectionPoint.copyFrom(this._collisionPoint):this.intersectionPoint=this._collisionPoint.clone(),this._nearestDistance=P,this.collisionFound=!0)}}},e.prototype._collide=function(e,t,i,r,n,o,s){for(var a=r;a<n;a+=3){var l=t[i[a]-o],c=t[i[a+1]-o],h=t[i[a+2]-o];this._testTriangle(a,e,h,c,l,s)}},e.prototype._getResponse=function(e,t){e.addToRef(t,this._destinationPoint),t.scaleInPlace(this._nearestDistance/t.length()),this._basePoint.addToRef(t,e),e.subtractToRef(this.intersectionPoint,this._slidePlaneNormal),this._slidePlaneNormal.normalize(),this._slidePlaneNormal.scaleToRef(this._epsilon,this._displacementVector),e.addInPlace(this._displacementVector),this.intersectionPoint.addInPlace(this._displacementVector),this._slidePlaneNormal.scaleInPlace(_t.Plane.SignedDistanceToPlaneFromPositionAndNormal(this.intersectionPoint,this._slidePlaneNormal,this._destinationPoint)),this._destinationPoint.subtractInPlace(this._slidePlaneNormal),this._destinationPoint.subtractToRef(this.intersectionPoint,t)},e})(),_t.Collider=vt,(function(h){var l,e,s,t;h.CollisionWorker="",(e=l=h.WorkerTaskType||(h.WorkerTaskType={}))[e.INIT=0]="INIT",e[e.UPDATE=1]="UPDATE",e[e.COLLIDE=2]="COLLIDE",(t=s=h.WorkerReplyType||(h.WorkerReplyType={}))[t.SUCCESS=0]="SUCCESS",t[t.UNKNOWN_ERROR=1]="UNKNOWN_ERROR";var i=(function(){function t(){var o=this;this._scaledPosition=h.Vector3.Zero(),this._scaledVelocity=h.Vector3.Zero(),this.onMeshUpdated=function(e){o._addUpdateMeshesList[e.uniqueId]=t.SerializeMesh(e)},this.onGeometryUpdated=function(e){o._addUpdateGeometriesList[e.id]=t.SerializeGeometry(e)},this._afterRender=function(){if(o._init&&!(0==o._toRemoveGeometryArray.length&&0==o._toRemoveMeshesArray.length&&0==Object.keys(o._addUpdateGeometriesList).length&&0==Object.keys(o._addUpdateMeshesList).length||4<o._runningUpdated)){++o._runningUpdated;var e={updatedMeshes:o._addUpdateMeshesList,updatedGeometries:o._addUpdateGeometriesList,removedGeometries:o._toRemoveGeometryArray,removedMeshes:o._toRemoveMeshesArray},t={payload:e,taskType:l.UPDATE},i=[];for(var r in e.updatedGeometries)e.updatedGeometries.hasOwnProperty(r)&&(i.push(t.payload.updatedGeometries[r].indices.buffer),i.push(t.payload.updatedGeometries[r].normals.buffer),i.push(t.payload.updatedGeometries[r].positions.buffer));o._worker.postMessage(t,i),o._addUpdateMeshesList={},o._addUpdateGeometriesList={},o._toRemoveGeometryArray=[],o._toRemoveMeshesArray=[]}},this._onMessageFromWorker=function(e){var t=e.data;if(t.error==s.SUCCESS)switch(t.taskType){case l.INIT:o._init=!0,o._scene.meshes.forEach((function(e){o.onMeshAdded(e)})),o._scene.getGeometries().forEach((function(e){o.onGeometryAdded(e)}));break;case l.UPDATE:o._runningUpdated--;break;case l.COLLIDE:var i=t.payload;if(!o._collisionsCallbackArray[i.collisionId])return;var r=o._collisionsCallbackArray[i.collisionId];if(r){var n=o._scene.getMeshByUniqueID(i.collidedMeshUniqueId);n&&r(i.collisionId,h.Vector3.FromArray(i.newPosition),n)}o._collisionsCallbackArray[i.collisionId]=null}else h.Tools.Warn("error returned from worker!")},this._collisionsCallbackArray=[],this._init=!1,this._runningUpdated=0,this._addUpdateMeshesList={},this._addUpdateGeometriesList={},this._toRemoveGeometryArray=[],this._toRemoveMeshesArray=[]}return t.prototype.getNewPosition=function(e,t,i,r,n,o,s){if(this._init&&!this._collisionsCallbackArray[s]&&!this._collisionsCallbackArray[s+1e5]){e.divideToRef(i._radius,this._scaledPosition),t.divideToRef(i._radius,this._scaledVelocity),this._collisionsCallbackArray[s]=o;var a={payload:{collider:{position:this._scaledPosition.asArray(),velocity:this._scaledVelocity.asArray(),radius:i._radius.asArray()},collisionId:s,excludedMeshUniqueId:n?n.uniqueId:null,maximumRetry:r},taskType:l.COLLIDE};this._worker.postMessage(a)}},t.prototype.init=function(e){this._scene=e,this._scene.registerAfterRender(this._afterRender);var t=h.WorkerIncluded?h.Engine.CodeRepository+"Collisions/babylon.collisionWorker.js":URL.createObjectURL(new Blob([h.CollisionWorker],{type:"application/javascript"}));this._worker=new Worker(t),this._worker.onmessage=this._onMessageFromWorker;var i={payload:{},taskType:l.INIT};this._worker.postMessage(i)},t.prototype.destroy=function(){this._scene.unregisterAfterRender(this._afterRender),this._worker.terminate()},t.prototype.onMeshAdded=function(e){e.registerAfterWorldMatrixUpdate(this.onMeshUpdated),this.onMeshUpdated(e)},t.prototype.onMeshRemoved=function(e){this._toRemoveMeshesArray.push(e.uniqueId)},t.prototype.onGeometryAdded=function(e){e.onGeometryUpdated=this.onGeometryUpdated,this.onGeometryUpdated(e)},t.prototype.onGeometryDeleted=function(e){this._toRemoveGeometryArray.push(e.id)},t.SerializeMesh=function(e){var t=[];e.subMeshes&&(t=e.subMeshes.map((function(e,t){var i=e.getBoundingInfo();return{position:t,verticesStart:e.verticesStart,verticesCount:e.verticesCount,indexStart:e.indexStart,indexCount:e.indexCount,hasMaterial:!!e.getMaterial(),sphereCenter:i.boundingSphere.centerWorld.asArray(),sphereRadius:i.boundingSphere.radiusWorld,boxMinimum:i.boundingBox.minimumWorld.asArray(),boxMaximum:i.boundingBox.maximumWorld.asArray()}})));var i=null;if(e instanceof h.Mesh)i=(r=e.geometry)?r.id:null;else if(e instanceof h.InstancedMesh){var r;i=(r=e.sourceMesh&&e.sourceMesh.geometry)?r.id:null}var n=e.getBoundingInfo();return{uniqueId:e.uniqueId,id:e.id,name:e.name,geometryId:i,sphereCenter:n.boundingSphere.centerWorld.asArray(),sphereRadius:n.boundingSphere.radiusWorld,boxMinimum:n.boundingBox.minimumWorld.asArray(),boxMaximum:n.boundingBox.maximumWorld.asArray(),worldMatrixFromCache:e.worldMatrixFromCache.asArray(),subMeshes:t,checkCollisions:e.checkCollisions}},t.SerializeGeometry=function(e){return{id:e.id,positions:new Float32Array(e.getVerticesData(h.VertexBuffer.PositionKind)||[]),normals:new Float32Array(e.getVerticesData(h.VertexBuffer.NormalKind)||[]),indices:new Uint32Array(e.getIndices()||[])}},t})();h.CollisionCoordinatorWorker=i;var r=(function(){function e(){this._scaledPosition=h.Vector3.Zero(),this._scaledVelocity=h.Vector3.Zero(),this._finalPosition=h.Vector3.Zero()}return e.prototype.getNewPosition=function(e,t,i,r,n,o,s){e.divideToRef(i._radius,this._scaledPosition),t.divideToRef(i._radius,this._scaledVelocity),i.collidedMesh=null,i._retry=0,i._initialVelocity=this._scaledVelocity,i._initialPosition=this._scaledPosition,this._collideWithWorld(this._scaledPosition,this._scaledVelocity,i,r,this._finalPosition,n),this._finalPosition.multiplyInPlace(i._radius),o(s,this._finalPosition,i.collidedMesh)},e.prototype.init=function(e){this._scene=e},e.prototype.destroy=function(){},e.prototype.onMeshAdded=function(e){},e.prototype.onMeshUpdated=function(e){},e.prototype.onMeshRemoved=function(e){},e.prototype.onGeometryAdded=function(e){},e.prototype.onGeometryUpdated=function(e){},e.prototype.onGeometryDeleted=function(e){},e.prototype._collideWithWorld=function(e,t,i,r,n,o){void 0===o&&(o=null);var s=10*h.Engine.CollisionsEpsilon;if(i._retry>=r)n.copyFrom(e);else{var a=o?o.collisionMask:i.collisionMask;i._initialize(e,t,s);for(var l=0;l<this._scene.meshes.length;l++){var c=this._scene.meshes[l];c.isEnabled()&&c.checkCollisions&&c.subMeshes&&c!==o&&0!=(a&c.collisionGroup)&&c._checkCollision(i)}i.collisionFound?(0===t.x&&0===t.y&&0===t.z||i._getResponse(e,t),t.length()<=s?n.copyFrom(e):(i._retry++,this._collideWithWorld(e,t,i,r,n,o))):e.addToRef(t,n)}},e})();h.CollisionCoordinatorLegacy=r})($a||($a={})),yt=$a||($a={}),bt=(function(){function t(e){this.particleSystem=e,this.position=yt.Vector3.Zero(),this.direction=yt.Vector3.Zero(),this.color=new yt.Color4(0,0,0,0),this.colorStep=new yt.Color4(0,0,0,0),this.lifeTime=1,this.age=0,this.size=0,this.scale=new yt.Vector2(1,1),this.angle=0,this.angularSpeed=0,this.cellIndex=0,this._attachedSubEmitters=null,this._currentColor1=new yt.Color4(0,0,0,0),this._currentColor2=new yt.Color4(0,0,0,0),this._currentSize1=0,this._currentSize2=0,this._currentAngularSpeed1=0,this._currentAngularSpeed2=0,this._currentVelocity1=0,this._currentVelocity2=0,this._currentLimitVelocity1=0,this._currentLimitVelocity2=0,this._currentDrag1=0,this._currentDrag2=0,this.id=t._Count++,this.particleSystem.isAnimationSheetEnabled&&this.updateCellInfoFromSystem()}return t.prototype.updateCellInfoFromSystem=function(){this.cellIndex=this.particleSystem.startSpriteCellID},t.prototype.updateCellIndex=function(){var e=this.age,t=this.particleSystem.spriteCellChangeSpeed;this.particleSystem.spriteRandomStartCell&&(void 0===this._randomCellOffset&&(this._randomCellOffset=Math.random()*this.lifeTime),0===t?(t=1,e=this._randomCellOffset):e+=this._randomCellOffset);var i=this._initialEndSpriteCellID-this._initialStartSpriteCellID,r=yt.Scalar.Clamp(e*t%this.lifeTime/this.lifeTime);this.cellIndex=this._initialStartSpriteCellID+r*i|0},t.prototype._inheritParticleInfoToSubEmitter=function(e){if(e.particleSystem.emitter.position){var t=e.particleSystem.emitter;t.position.copyFrom(this.position),e.inheritDirection&&(t.position.subtractToRef(this.direction,yt.Tmp.Vector3[0]),t.lookAt(yt.Tmp.Vector3[0],0,Math.PI/2))}else{e.particleSystem.emitter.copyFrom(this.position)}this.direction.scaleToRef(e.inheritedVelocityAmount/2,yt.Tmp.Vector3[0]),e.particleSystem._inheritedVelocityOffset.copyFrom(yt.Tmp.Vector3[0])},t.prototype._inheritParticleInfoToSubEmitters=function(){var t=this;this._attachedSubEmitters&&0<this._attachedSubEmitters.length&&this._attachedSubEmitters.forEach((function(e){t._inheritParticleInfoToSubEmitter(e)}))},t.prototype._reset=function(){this.age=0,this._currentColorGradient=null,this._currentSizeGradient=null,this._currentAngularSpeedGradient=null,this._currentVelocityGradient=null,this._currentLimitVelocityGradient=null,this._currentDragGradient=null,this.cellIndex=this.particleSystem.startSpriteCellID,this._randomCellOffset=void 0},t.prototype.copyTo=function(e){e.position.copyFrom(this.position),this._initialDirection?e._initialDirection?e._initialDirection.copyFrom(this._initialDirection):e._initialDirection=this._initialDirection.clone():e._initialDirection=null,e.direction.copyFrom(this.direction),e.color.copyFrom(this.color),e.colorStep.copyFrom(this.colorStep),e.lifeTime=this.lifeTime,e.age=this.age,e._randomCellOffset=this._randomCellOffset,e.size=this.size,e.scale.copyFrom(this.scale),e.angle=this.angle,e.angularSpeed=this.angularSpeed,e.particleSystem=this.particleSystem,e.cellIndex=this.cellIndex,e.id=this.id,e._attachedSubEmitters=this._attachedSubEmitters,this._currentColorGradient&&(e._currentColorGradient=this._currentColorGradient,e._currentColor1.copyFrom(this._currentColor1),e._currentColor2.copyFrom(this._currentColor2)),this._currentSizeGradient&&(e._currentSizeGradient=this._currentSizeGradient,e._currentSize1=this._currentSize1,e._currentSize2=this._currentSize2),this._currentAngularSpeedGradient&&(e._currentAngularSpeedGradient=this._currentAngularSpeedGradient,e._currentAngularSpeed1=this._currentAngularSpeed1,e._currentAngularSpeed2=this._currentAngularSpeed2),this._currentVelocityGradient&&(e._currentVelocityGradient=this._currentVelocityGradient,e._currentVelocity1=this._currentVelocity1,e._currentVelocity2=this._currentVelocity2),this._currentLimitVelocityGradient&&(e._currentLimitVelocityGradient=this._currentLimitVelocityGradient,e._currentLimitVelocity1=this._currentLimitVelocity1,e._currentLimitVelocity2=this._currentLimitVelocity2),this._currentDragGradient&&(e._currentDragGradient=this._currentDragGradient,e._currentDrag1=this._currentDrag1,e._currentDrag2=this._currentDrag2),this.particleSystem.isAnimationSheetEnabled&&(e._initialStartSpriteCellID=this._initialStartSpriteCellID,e._initialEndSpriteCellID=this._initialEndSpriteCellID),this.particleSystem.useRampGradients&&e.remapData.copyFrom(this.remapData),this._randomNoiseCoordinates1&&(e._randomNoiseCoordinates1?(e._randomNoiseCoordinates1.copyFrom(this._randomNoiseCoordinates1),e._randomNoiseCoordinates2.copyFrom(this._randomNoiseCoordinates2)):(e._randomNoiseCoordinates1=this._randomNoiseCoordinates1.clone(),e._randomNoiseCoordinates2=this._randomNoiseCoordinates2.clone()))},t._Count=0,t})(),yt.Particle=bt,Tt=$a||($a={}),Et=(function(){function e(e){this.animations=[],this.renderingGroupId=0,this.emitter=null,this.emitRate=10,this.manualEmitCount=-1,this.updateSpeed=.01,this.targetStopDuration=0,this.disposeOnStop=!1,this.minEmitPower=1,this.maxEmitPower=1,this.minLifeTime=1,this.maxLifeTime=1,this.minSize=1,this.maxSize=1,this.minScaleX=1,this.maxScaleX=1,this.minScaleY=1,this.maxScaleY=1,this.minInitialRotation=0,this.maxInitialRotation=0,this.minAngularSpeed=0,this.maxAngularSpeed=0,this.layerMask=268435455,this.customShader=null,this.preventAutoStart=!1,this.noiseStrength=new Tt.Vector3(10,10,10),this.onAnimationEnd=null,this.blendMode=Tt.ParticleSystem.BLENDMODE_ONEONE,this.forceDepthWrite=!1,this.preWarmCycles=0,this.preWarmStepOffset=1,this.spriteCellChangeSpeed=1,this.startSpriteCellID=0,this.endSpriteCellID=0,this.spriteCellWidth=0,this.spriteCellHeight=0,this.spriteRandomStartCell=!1,this.translationPivot=new Tt.Vector2(0,0),this.beginAnimationOnStart=!1,this.beginAnimationFrom=0,this.beginAnimationTo=60,this.beginAnimationLoop=!1,this.gravity=Tt.Vector3.Zero(),this._colorGradients=null,this._sizeGradients=null,this._lifeTimeGradients=null,this._angularSpeedGradients=null,this._velocityGradients=null,this._limitVelocityGradients=null,this._dragGradients=null,this._emitRateGradients=null,this._startSizeGradients=null,this._rampGradients=null,this._colorRemapGradients=null,this._alphaRemapGradients=null,this.startDelay=0,this.limitVelocityDamping=.4,this.color1=new Tt.Color4(1,1,1,1),this.color2=new Tt.Color4(1,1,1,1),this.colorDead=new Tt.Color4(0,0,0,1),this.textureMask=new Tt.Color4(1,1,1,1),this._isSubEmitter=!1,this.billboardMode=Tt.ParticleSystem.BILLBOARDMODE_ALL,this._isBillboardBased=!0,this._imageProcessingConfigurationDefines=new Tt.ImageProcessingConfigurationDefines,this.id=e,this.name=e}return Object.defineProperty(e.prototype,"isAnimationSheetEnabled",{get:function(){return this._isAnimationSheetEnabled},set:function(e){this._isAnimationSheetEnabled!=e&&(this._isAnimationSheetEnabled=e,this._reset())},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},e.prototype._hasTargetStopDurationDependantGradient=function(){return this._startSizeGradients&&0<this._startSizeGradients.length||this._emitRateGradients&&0<this._emitRateGradients.length||this._lifeTimeGradients&&0<this._lifeTimeGradients.length},e.prototype.getDragGradients=function(){return this._dragGradients},e.prototype.getLimitVelocityGradients=function(){return this._limitVelocityGradients},e.prototype.getColorGradients=function(){return this._colorGradients},e.prototype.getSizeGradients=function(){return this._sizeGradients},e.prototype.getColorRemapGradients=function(){return this._colorRemapGradients},e.prototype.getAlphaRemapGradients=function(){return this._alphaRemapGradients},e.prototype.getLifeTimeGradients=function(){return this._lifeTimeGradients},e.prototype.getAngularSpeedGradients=function(){return this._angularSpeedGradients},e.prototype.getVelocityGradients=function(){return this._velocityGradients},e.prototype.getStartSizeGradients=function(){return this._startSizeGradients},e.prototype.getEmitRateGradients=function(){return this._emitRateGradients},Object.defineProperty(e.prototype,"direction1",{get:function(){return this.particleEmitterType.direction1?this.particleEmitterType.direction1:Tt.Vector3.Zero()},set:function(e){this.particleEmitterType.direction1&&(this.particleEmitterType.direction1=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"direction2",{get:function(){return this.particleEmitterType.direction2?this.particleEmitterType.direction2:Tt.Vector3.Zero()},set:function(e){this.particleEmitterType.direction2&&(this.particleEmitterType.direction2=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minEmitBox",{get:function(){return this.particleEmitterType.minEmitBox?this.particleEmitterType.minEmitBox:Tt.Vector3.Zero()},set:function(e){this.particleEmitterType.minEmitBox&&(this.particleEmitterType.minEmitBox=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxEmitBox",{get:function(){return this.particleEmitterType.maxEmitBox?this.particleEmitterType.maxEmitBox:Tt.Vector3.Zero()},set:function(e){this.particleEmitterType.maxEmitBox&&(this.particleEmitterType.maxEmitBox=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isBillboardBased",{get:function(){return this._isBillboardBased},set:function(e){this._isBillboardBased!==e&&(this._isBillboardBased=e,this._reset())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!0,configurable:!0}),e.prototype._attachImageProcessingConfiguration=function(e){e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration=e||this._scene.imageProcessingConfiguration)},e.prototype._reset=function(){},e.prototype._removeGradientAndTexture=function(e,t,i){if(!t)return this;for(var r=0,n=0,o=t;n<o.length;n++){if(o[n].gradient===e){t.splice(r,1);break}r++}return i&&i.dispose(),this},e.prototype.createPointEmitter=function(e,t){var i=new Tt.PointParticleEmitter;return i.direction1=e,i.direction2=t,this.particleEmitterType=i},e.prototype.createHemisphericEmitter=function(e,t){void 0===e&&(e=1),void 0===t&&(t=1);var i=new Tt.HemisphericParticleEmitter(e,t);return this.particleEmitterType=i},e.prototype.createSphereEmitter=function(e,t){void 0===e&&(e=1),void 0===t&&(t=1);var i=new Tt.SphereParticleEmitter(e,t);return this.particleEmitterType=i},e.prototype.createDirectedSphereEmitter=function(e,t,i){void 0===e&&(e=1),void 0===t&&(t=new Tt.Vector3(0,1,0)),void 0===i&&(i=new Tt.Vector3(0,1,0));var r=new Tt.SphereDirectedParticleEmitter(e,t,i);return this.particleEmitterType=r},e.prototype.createCylinderEmitter=function(e,t,i,r){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===r&&(r=0);var n=new Tt.CylinderParticleEmitter(e,t,i,r);return this.particleEmitterType=n},e.prototype.createDirectedCylinderEmitter=function(e,t,i,r,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===r&&(r=new Tt.Vector3(0,1,0)),void 0===n&&(n=new Tt.Vector3(0,1,0));var o=new Tt.CylinderDirectedParticleEmitter(e,t,i,r,n);return this.particleEmitterType=o},e.prototype.createConeEmitter=function(e,t){void 0===e&&(e=1),void 0===t&&(t=Math.PI/4);var i=new Tt.ConeParticleEmitter(e,t);return this.particleEmitterType=i},e.prototype.createBoxEmitter=function(e,t,i,r){var n=new Tt.BoxParticleEmitter;return this.particleEmitterType=n,this.direction1=e,this.direction2=t,this.minEmitBox=i,this.maxEmitBox=r,n},e.BLENDMODE_ONEONE=0,e.BLENDMODE_STANDARD=1,e.BLENDMODE_ADD=2,e.BLENDMODE_MULTIPLY=3,e.BLENDMODE_MULTIPLYADD=4,e})(),Tt.BaseParticleSystem=Et,xt=$a||($a={}),Pt=(function(s){function _(e,t,i,r,n,o){void 0===r&&(r=null),void 0===n&&(n=!1),void 0===o&&(o=.01);var _=s.call(this,e)||this;return _._inheritedVelocityOffset=new xt.Vector3,_.onDisposeObservable=new xt.Observable,_._particles=new Array,_._stockParticles=new Array,_._newPartsExcess=0,_._vertexBuffers={},_._scaledColorStep=new xt.Color4(0,0,0,0),_._colorDiff=new xt.Color4(0,0,0,0),_._scaledDirection=xt.Vector3.Zero(),_._scaledGravity=xt.Vector3.Zero(),_._currentRenderId=-1,_._useInstancing=!1,_._started=!1,_._stopped=!1,_._actualFrame=0,_._currentEmitRate1=0,_._currentEmitRate2=0,_._currentStartSize1=0,_._currentStartSize2=0,_._rawTextureWidth=256,_._useRampGradients=!1,_._disposeEmitterOnDispose=!1,_.recycleParticle=function(e){var t=_._particles.pop();t!==e&&t.copyTo(e),_._stockParticles.push(t)},_._createParticle=function(){var i;if(0!==_._stockParticles.length?(i=_._stockParticles.pop())._reset():i=new xt.Particle(_),_._subEmitters&&0<_._subEmitters.length){var e=_._subEmitters[Math.floor(Math.random()*_._subEmitters.length)];i._attachedSubEmitters=[],e.forEach((function(e){if(e.type===xt.SubEmitterType.ATTACHED){var t=e.clone();i._attachedSubEmitters.push(t),t.particleSystem.start()}}))}return i},_._emitFromParticle=function(i){if(_._subEmitters&&0!==_._subEmitters.length){var e=Math.floor(Math.random()*_._subEmitters.length);_._subEmitters[e].forEach((function(e){if(e.type===xt.SubEmitterType.END){var t=e.clone();i._inheritParticleInfoToSubEmitter(t),(t.particleSystem._rootParticleSystem=_).activeSubSystems.push(t.particleSystem),t.particleSystem.start()}}))}},_._capacity=t,_._epsilon=o,_._isAnimationSheetEnabled=n,_._scene=i||xt.Engine.LastCreatedScene,_._attachImageProcessingConfiguration(null),_._customEffect=r,_._scene.particleSystems.push(_),_._useInstancing=_._scene.getEngine().getCaps().instancedArrays,_._createIndexBuffer(),_._createVertexBuffers(),_.particleEmitterType=new xt.BoxParticleEmitter,_.updateFunction=function(h){var u=null,d=null;_.noiseTexture&&(u=_.noiseTexture.getSize(),d=_.noiseTexture.getContent());for(var f,e=function(){f=h[p];var e=_._scaledUpdateSpeed,t=f.age;if(f.age+=e,f.age>f.lifeTime){var i=f.age-t;e=(f.lifeTime-t)*e/i,f.age=f.lifeTime}var r=f.age/f.lifeTime;_._colorGradients&&0<_._colorGradients.length?xt.Tools.GetCurrentGradient(r,_._colorGradients,(function(e,t,i){e!==f._currentColorGradient&&(f._currentColor1.copyFrom(f._currentColor2),t.getColorToRef(f._currentColor2),f._currentColorGradient=e),xt.Color4.LerpToRef(f._currentColor1,f._currentColor2,i,f.color)})):(f.colorStep.scaleToRef(e,_._scaledColorStep),f.color.addInPlace(_._scaledColorStep),f.color.a<0&&(f.color.a=0)),_._angularSpeedGradients&&0<_._angularSpeedGradients.length&&xt.Tools.GetCurrentGradient(r,_._angularSpeedGradients,(function(e,t,i){e!==f._currentAngularSpeedGradient&&(f._currentAngularSpeed1=f._currentAngularSpeed2,f._currentAngularSpeed2=t.getFactor(),f._currentAngularSpeedGradient=e),f.angularSpeed=xt.Scalar.Lerp(f._currentAngularSpeed1,f._currentAngularSpeed2,i)})),f.angle+=f.angularSpeed*e;var n=e;if(_._velocityGradients&&0<_._velocityGradients.length&&xt.Tools.GetCurrentGradient(r,_._velocityGradients,(function(e,t,i){e!==f._currentVelocityGradient&&(f._currentVelocity1=f._currentVelocity2,f._currentVelocity2=t.getFactor(),f._currentVelocityGradient=e),n*=xt.Scalar.Lerp(f._currentVelocity1,f._currentVelocity2,i)})),f.direction.scaleToRef(n,_._scaledDirection),_._limitVelocityGradients&&0<_._limitVelocityGradients.length&&xt.Tools.GetCurrentGradient(r,_._limitVelocityGradients,(function(e,t,i){e!==f._currentLimitVelocityGradient&&(f._currentLimitVelocity1=f._currentLimitVelocity2,f._currentLimitVelocity2=t.getFactor(),f._currentLimitVelocityGradient=e),xt.Scalar.Lerp(f._currentLimitVelocity1,f._currentLimitVelocity2,i)<f.direction.length()&&f.direction.scaleInPlace(_.limitVelocityDamping)})),_._dragGradients&&0<_._dragGradients.length&&xt.Tools.GetCurrentGradient(r,_._dragGradients,(function(e,t,i){e!==f._currentDragGradient&&(f._currentDrag1=f._currentDrag2,f._currentDrag2=t.getFactor(),f._currentDragGradient=e);var r=xt.Scalar.Lerp(f._currentDrag1,f._currentDrag2,i);_._scaledDirection.scaleInPlace(1-r)})),f.position.addInPlace(_._scaledDirection),d&&u){var o=_._fetchR(f._randomNoiseCoordinates1.x,f._randomNoiseCoordinates1.y,u.width,u.height,d),s=_._fetchR(f._randomNoiseCoordinates1.z,f._randomNoiseCoordinates2.x,u.width,u.height,d),a=_._fetchR(f._randomNoiseCoordinates2.y,f._randomNoiseCoordinates2.z,u.width,u.height,d),l=xt.Tmp.Vector3[0],c=xt.Tmp.Vector3[1];l.copyFromFloats((2*o-1)*_.noiseStrength.x,(2*s-1)*_.noiseStrength.y,(2*a-1)*_.noiseStrength.z),l.scaleToRef(e,c),f.direction.addInPlace(c)}if(_.gravity.scaleToRef(e,_._scaledGravity),f.direction.addInPlace(_._scaledGravity),_._sizeGradients&&0<_._sizeGradients.length&&xt.Tools.GetCurrentGradient(r,_._sizeGradients,(function(e,t,i){e!==f._currentSizeGradient&&(f._currentSize1=f._currentSize2,f._currentSize2=t.getFactor(),f._currentSizeGradient=e),f.size=xt.Scalar.Lerp(f._currentSize1,f._currentSize2,i)})),_._useRampGradients&&(_._colorRemapGradients&&0<_._colorRemapGradients.length&&xt.Tools.GetCurrentGradient(r,_._colorRemapGradients,(function(e,t,i){var r=xt.Scalar.Lerp(e.factor1,t.factor1,i),n=xt.Scalar.Lerp(e.factor2,t.factor2,i);f.remapData.x=r,f.remapData.y=n-r})),_._alphaRemapGradients&&0<_._alphaRemapGradients.length&&xt.Tools.GetCurrentGradient(r,_._alphaRemapGradients,(function(e,t,i){var r=xt.Scalar.Lerp(e.factor1,t.factor1,i),n=xt.Scalar.Lerp(e.factor2,t.factor2,i);f.remapData.z=r,f.remapData.w=n-r}))),_._isAnimationSheetEnabled&&f.updateCellIndex(),f._inheritParticleInfoToSubEmitters(),f.age>=f.lifeTime)return _._emitFromParticle(f),f._attachedSubEmitters&&(f._attachedSubEmitters.forEach((function(e){e.particleSystem.disposeOnStop=!0,e.particleSystem.stop()})),f._attachedSubEmitters=null),_.recycleParticle(f),p--,"continue"},p=0;p<h.length;p++)e()},_}return T(_,s),Object.defineProperty(_.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"useRampGradients",{get:function(){return this._useRampGradients},set:function(e){this._useRampGradients!==e&&(this._useRampGradients=e,this._resetEffect())},enumerable:!0,configurable:!0}),Object.defineProperty(_.prototype,"particles",{get:function(){return this._particles},enumerable:!0,configurable:!0}),_.prototype.getClassName=function(){return"ParticleSystem"},_.prototype._addFactorGradient=function(e,t,i,r){var n=new xt.FactorGradient;n.gradient=t,n.factor1=i,n.factor2=r,e.push(n),e.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0}))},_.prototype._removeFactorGradient=function(e,t){if(e)for(var i=0,r=0,n=e;r<n.length;r++){if(n[r].gradient===t){e.splice(i,1);break}i++}},_.prototype.addLifeTimeGradient=function(e,t,i){return this._lifeTimeGradients||(this._lifeTimeGradients=[]),this._addFactorGradient(this._lifeTimeGradients,e,t,i),this},_.prototype.removeLifeTimeGradient=function(e){return this._removeFactorGradient(this._lifeTimeGradients,e),this},_.prototype.addSizeGradient=function(e,t,i){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t,i),this},_.prototype.removeSizeGradient=function(e){return this._removeFactorGradient(this._sizeGradients,e),this},_.prototype.addColorRemapGradient=function(e,t,i){return this._colorRemapGradients||(this._colorRemapGradients=[]),this._addFactorGradient(this._colorRemapGradients,e,t,i),this},_.prototype.removeColorRemapGradient=function(e){return this._removeFactorGradient(this._colorRemapGradients,e),this},_.prototype.addAlphaRemapGradient=function(e,t,i){return this._alphaRemapGradients||(this._alphaRemapGradients=[]),this._addFactorGradient(this._alphaRemapGradients,e,t,i),this},_.prototype.removeAlphaRemapGradient=function(e){return this._removeFactorGradient(this._alphaRemapGradients,e),this},_.prototype.addAngularSpeedGradient=function(e,t,i){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t,i),this},_.prototype.removeAngularSpeedGradient=function(e){return this._removeFactorGradient(this._angularSpeedGradients,e),this},_.prototype.addVelocityGradient=function(e,t,i){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t,i),this},_.prototype.removeVelocityGradient=function(e){return this._removeFactorGradient(this._velocityGradients,e),this},_.prototype.addLimitVelocityGradient=function(e,t,i){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t,i),this},_.prototype.removeLimitVelocityGradient=function(e){return this._removeFactorGradient(this._limitVelocityGradients,e),this},_.prototype.addDragGradient=function(e,t,i){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t,i),this},_.prototype.removeDragGradient=function(e){return this._removeFactorGradient(this._dragGradients,e),this},_.prototype.addEmitRateGradient=function(e,t,i){return this._emitRateGradients||(this._emitRateGradients=[]),this._addFactorGradient(this._emitRateGradients,e,t,i),this},_.prototype.removeEmitRateGradient=function(e){return this._removeFactorGradient(this._emitRateGradients,e),this},_.prototype.addStartSizeGradient=function(e,t,i){return this._startSizeGradients||(this._startSizeGradients=[]),this._addFactorGradient(this._startSizeGradients,e,t,i),this},_.prototype.removeStartSizeGradient=function(e){return this._removeFactorGradient(this._emitRateGradients,e),this},_.prototype._createRampGradientTexture=function(){if(this._rampGradients&&this._rampGradients.length&&!this._rampGradientsTexture){for(var r=new Uint8Array(4*this._rawTextureWidth),n=xt.Tmp.Color3[0],o=0;o<this._rawTextureWidth;o++){var e=o/this._rawTextureWidth;xt.Tools.GetCurrentGradient(e,this._rampGradients,(function(e,t,i){xt.Color3.LerpToRef(e.color,t.color,i,n),r[4*o]=255*n.r,r[4*o+1]=255*n.g,r[4*o+2]=255*n.b,r[4*o+3]=255}))}this._rampGradientsTexture=xt.RawTexture.CreateRGBATexture(r,this._rawTextureWidth,1,this._scene,!1,!1,xt.Texture.NEAREST_SAMPLINGMODE)}},_.prototype.getRampGradients=function(){return this._rampGradients},_.prototype.addRampGradient=function(e,t){this._rampGradients||(this._rampGradients=[]);var i=new xt.Color3Gradient;return i.gradient=e,i.color=t,this._rampGradients.push(i),this._rampGradients.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._createRampGradientTexture(),this},_.prototype.removeRampGradient=function(e){return this._removeGradientAndTexture(e,this._rampGradients,this._rampGradientsTexture),this._rampGradientsTexture=null,this._rampGradients&&0<this._rampGradients.length&&this._createRampGradientTexture(),this},_.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var r=new xt.ColorGradient;return r.gradient=e,r.color1=t,r.color2=i,this._colorGradients.push(r),this._colorGradients.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this},_.prototype.removeColorGradient=function(e){if(!this._colorGradients)return this;for(var t=0,i=0,r=this._colorGradients;i<r.length;i++){if(r[i].gradient===e){this._colorGradients.splice(t,1);break}t++}return this},_.prototype._fetchR=function(e,t,i,r,n){return n[4*(((e=.5*Math.abs(e)+.5)*i%i|0)+((t=.5*Math.abs(t)+.5)*r%r|0)*i)]/255},_.prototype._reset=function(){this._resetEffect()},_.prototype._resetEffect=function(){this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._createVertexBuffers()},_.prototype._createVertexBuffers=function(){this._vertexBufferSize=this._useInstancing?10:12,this._isAnimationSheetEnabled&&(this._vertexBufferSize+=1),this._isBillboardBased&&this.billboardMode!==_.BILLBOARDMODE_STRETCHED||(this._vertexBufferSize+=3),this._useRampGradients&&(this._vertexBufferSize+=4);var e=this._scene.getEngine();this._vertexData=new Float32Array(this._capacity*this._vertexBufferSize*(this._useInstancing?1:4)),this._vertexBuffer=new xt.Buffer(e,this._vertexData,!0,this._vertexBufferSize);var t=0,i=this._vertexBuffer.createVertexBuffer(xt.VertexBuffer.PositionKind,t,3,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[xt.VertexBuffer.PositionKind]=i,t+=3;var r=this._vertexBuffer.createVertexBuffer(xt.VertexBuffer.ColorKind,t,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers[xt.VertexBuffer.ColorKind]=r,t+=4;var n=this._vertexBuffer.createVertexBuffer("angle",t,1,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.angle=n,t+=1;var o,s=this._vertexBuffer.createVertexBuffer("size",t,2,this._vertexBufferSize,this._useInstancing);if(this._vertexBuffers.size=s,t+=2,this._isAnimationSheetEnabled){var a=this._vertexBuffer.createVertexBuffer("cellIndex",t,1,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.cellIndex=a,t+=1}if(!this._isBillboardBased||this.billboardMode===_.BILLBOARDMODE_STRETCHED){var l=this._vertexBuffer.createVertexBuffer("direction",t,3,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.direction=l,t+=3}if(this._useRampGradients){var c=this._vertexBuffer.createVertexBuffer("remapData",t,4,this._vertexBufferSize,this._useInstancing);this._vertexBuffers.remapData=c,t+=4}if(this._useInstancing){var h=new Float32Array([0,0,1,0,1,1,0,1]);this._spriteBuffer=new xt.Buffer(e,h,!1,2),o=this._spriteBuffer.createVertexBuffer("offset",0,2)}else o=this._vertexBuffer.createVertexBuffer("offset",t,2,this._vertexBufferSize,this._useInstancing),t+=2;this._vertexBuffers.offset=o},_.prototype._createIndexBuffer=function(){if(!this._useInstancing){for(var e=[],t=0,i=0;i<this._capacity;i++)e.push(t),e.push(t+1),e.push(t+2),e.push(t),e.push(t+2),e.push(t+3),t+=4;this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)}},_.prototype.getCapacity=function(){return this._capacity},_.prototype.isAlive=function(){return this._alive},_.prototype.isStarted=function(){return this._started},_.prototype._prepareSubEmitterInternalArray=function(){var t=this;this._subEmitters=new Array,this.subEmitters&&this.subEmitters.forEach((function(e){e instanceof _?t._subEmitters.push([new xt.SubEmitter(e)]):e instanceof xt.SubEmitter?t._subEmitters.push([e]):e instanceof Array&&t._subEmitters.push(e)}))},_.prototype.start=function(e){var t=this;if(void 0===e&&(e=this.startDelay),!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";if(e)setTimeout((function(){t.start(0)}),e);else{if(this._prepareSubEmitterInternalArray(),this._started=!0,this._stopped=!1,this._actualFrame=0,this._subEmitters&&0!=this._subEmitters.length&&(this.activeSubSystems=new Array),this._emitRateGradients&&(0<this._emitRateGradients.length&&(this._currentEmitRateGradient=this._emitRateGradients[0],this._currentEmitRate1=this._currentEmitRateGradient.getFactor(),this._currentEmitRate2=this._currentEmitRate1),1<this._emitRateGradients.length&&(this._currentEmitRate2=this._emitRateGradients[1].getFactor())),this._startSizeGradients&&(0<this._startSizeGradients.length&&(this._currentStartSizeGradient=this._startSizeGradients[0],this._currentStartSize1=this._currentStartSizeGradient.getFactor(),this._currentStartSize2=this._currentStartSize1),1<this._startSizeGradients.length&&(this._currentStartSize2=this._startSizeGradients[1].getFactor())),this.preWarmCycles){this.emitter instanceof xt.AbstractMesh&&this.emitter.computeWorldMatrix(!0);var i=this.noiseTexture;if(i&&i.onGeneratedObservable)i.onGeneratedObservable.addOnce((function(){setTimeout((function(){for(var e=0;e<t.preWarmCycles;e++)t.animate(!0),i.render()}))}));else for(var r=0;r<this.preWarmCycles;r++)this.animate(!0)}this.beginAnimationOnStart&&this.animations&&0<this.animations.length&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop)}},_.prototype.stop=function(e){void 0===e&&(e=!0),this._stopped=!0,e&&this._stopSubEmitters()},_.prototype.reset=function(){this._stockParticles=[],this._particles=[]},_.prototype._appendParticleVertex=function(e,t,i,r){var n=e*this._vertexBufferSize;this._vertexData[n++]=t.position.x,this._vertexData[n++]=t.position.y,this._vertexData[n++]=t.position.z,this._vertexData[n++]=t.color.r,this._vertexData[n++]=t.color.g,this._vertexData[n++]=t.color.b,this._vertexData[n++]=t.color.a,this._vertexData[n++]=t.angle,this._vertexData[n++]=t.scale.x*t.size,this._vertexData[n++]=t.scale.y*t.size,this._isAnimationSheetEnabled&&(this._vertexData[n++]=t.cellIndex),this._isBillboardBased?this.billboardMode===_.BILLBOARDMODE_STRETCHED&&(this._vertexData[n++]=t.direction.x,this._vertexData[n++]=t.direction.y,this._vertexData[n++]=t.direction.z):t._initialDirection?(this._vertexData[n++]=t._initialDirection.x,this._vertexData[n++]=t._initialDirection.y,this._vertexData[n++]=t._initialDirection.z):(this._vertexData[n++]=t.direction.x,this._vertexData[n++]=t.direction.y,this._vertexData[n++]=t.direction.z),this._useRampGradients&&(this._vertexData[n++]=t.remapData.x,this._vertexData[n++]=t.remapData.y,this._vertexData[n++]=t.remapData.z,this._vertexData[n++]=t.remapData.w),this._useInstancing||(this._isAnimationSheetEnabled&&(0===i?i=this._epsilon:1===i&&(i=1-this._epsilon),0===r?r=this._epsilon:1===r&&(r=1-this._epsilon)),this._vertexData[n++]=i,this._vertexData[n++]=r)},_.prototype._stopSubEmitters=function(){this.activeSubSystems&&(this.activeSubSystems.forEach((function(e){e.stop(!0)})),this.activeSubSystems=new Array)},_.prototype._removeFromRoot=function(){if(this._rootParticleSystem){var e=this._rootParticleSystem.activeSubSystems.indexOf(this);-1!==e&&this._rootParticleSystem.activeSubSystems.splice(e,1),this._rootParticleSystem=null}},_.prototype._update=function(e){var c,n=this;if(this._alive=0<this._particles.length,this.emitter.position){var t=this.emitter;this._emitterWorldMatrix=t.getWorldMatrix()}else{var i=this.emitter;this._emitterWorldMatrix=xt.Matrix.Translation(i.x,i.y,i.z)}this.updateFunction(this._particles);for(var r,o=function(){if(s._particles.length===s._capacity)return"break";c=s._createParticle(),s._particles.push(c);var e=xt.Scalar.RandomRange(s.minEmitPower,s.maxEmitPower);if(s.startPositionFunction?s.startPositionFunction(s._emitterWorldMatrix,c.position,c):s.particleEmitterType.startPositionFunction(s._emitterWorldMatrix,c.position,c),s.startDirectionFunction?s.startDirectionFunction(s._emitterWorldMatrix,c.direction,c):s.particleEmitterType.startDirectionFunction(s._emitterWorldMatrix,c.direction,c),0===e?c._initialDirection?c._initialDirection.copyFrom(c.direction):c._initialDirection=c.direction.clone():c._initialDirection=null,c.direction.scaleInPlace(e),s.targetStopDuration&&s._lifeTimeGradients&&0<s._lifeTimeGradients.length){var l=xt.Scalar.Clamp(s._actualFrame/s.targetStopDuration);xt.Tools.GetCurrentGradient(l,s._lifeTimeGradients,(function(e,t,i){var r=e,n=t,o=r.getFactor(),s=n.getFactor(),a=(l-r.gradient)/(n.gradient-r.gradient);c.lifeTime=xt.Scalar.Lerp(o,s,a)}))}else c.lifeTime=xt.Scalar.RandomRange(s.minLifeTime,s.maxLifeTime);if(s._sizeGradients&&0!==s._sizeGradients.length?(c._currentSizeGradient=s._sizeGradients[0],c._currentSize1=c._currentSizeGradient.getFactor(),c.size=c._currentSize1,1<s._sizeGradients.length?c._currentSize2=s._sizeGradients[1].getFactor():c._currentSize2=c._currentSize1):c.size=xt.Scalar.RandomRange(s.minSize,s.maxSize),c.scale.copyFromFloats(xt.Scalar.RandomRange(s.minScaleX,s.maxScaleX),xt.Scalar.RandomRange(s.minScaleY,s.maxScaleY)),s._startSizeGradients&&s._startSizeGradients[0]&&s.targetStopDuration){var t=s._actualFrame/s.targetStopDuration;xt.Tools.GetCurrentGradient(t,s._startSizeGradients,(function(e,t,i){e!==n._currentStartSizeGradient&&(n._currentStartSize1=n._currentStartSize2,n._currentStartSize2=t.getFactor(),n._currentStartSizeGradient=e);var r=xt.Scalar.Lerp(n._currentStartSize1,n._currentStartSize2,i);c.scale.scaleInPlace(r)}))}s._angularSpeedGradients&&0!==s._angularSpeedGradients.length?(c._currentAngularSpeedGradient=s._angularSpeedGradients[0],c.angularSpeed=c._currentAngularSpeedGradient.getFactor(),c._currentAngularSpeed1=c.angularSpeed,1<s._angularSpeedGradients.length?c._currentAngularSpeed2=s._angularSpeedGradients[1].getFactor():c._currentAngularSpeed2=c._currentAngularSpeed1):c.angularSpeed=xt.Scalar.RandomRange(s.minAngularSpeed,s.maxAngularSpeed),c.angle=xt.Scalar.RandomRange(s.minInitialRotation,s.maxInitialRotation),s._velocityGradients&&0<s._velocityGradients.length&&(c._currentVelocityGradient=s._velocityGradients[0],c._currentVelocity1=c._currentVelocityGradient.getFactor(),1<s._velocityGradients.length?c._currentVelocity2=s._velocityGradients[1].getFactor():c._currentVelocity2=c._currentVelocity1),s._limitVelocityGradients&&0<s._limitVelocityGradients.length&&(c._currentLimitVelocityGradient=s._limitVelocityGradients[0],c._currentLimitVelocity1=c._currentLimitVelocityGradient.getFactor(),1<s._limitVelocityGradients.length?c._currentLimitVelocity2=s._limitVelocityGradients[1].getFactor():c._currentLimitVelocity2=c._currentLimitVelocity1),s._dragGradients&&0<s._dragGradients.length&&(c._currentDragGradient=s._dragGradients[0],c._currentDrag1=c._currentDragGradient.getFactor(),1<s._dragGradients.length?c._currentDrag2=s._dragGradients[1].getFactor():c._currentDrag2=c._currentDrag1),s._colorGradients&&0!==s._colorGradients.length?(c._currentColorGradient=s._colorGradients[0],c._currentColorGradient.getColorToRef(c.color),c._currentColor1.copyFrom(c.color),1<s._colorGradients.length?s._colorGradients[1].getColorToRef(c._currentColor2):c._currentColor2.copyFrom(c.color)):(r=xt.Scalar.RandomRange(0,1),xt.Color4.LerpToRef(s.color1,s.color2,r,c.color),s.colorDead.subtractToRef(c.color,s._colorDiff),s._colorDiff.scaleToRef(1/c.lifeTime,c.colorStep)),s._isAnimationSheetEnabled&&(c._initialStartSpriteCellID=s.startSpriteCellID,c._initialEndSpriteCellID=s.endSpriteCellID),c.direction.addInPlace(s._inheritedVelocityOffset),s._useRampGradients&&(c.remapData=new xt.Vector4(0,1,0,1)),s.noiseTexture&&(c._randomNoiseCoordinates1?(c._randomNoiseCoordinates1.copyFromFloats(Math.random(),Math.random(),Math.random()),c._randomNoiseCoordinates2.copyFromFloats(Math.random(),Math.random(),Math.random())):(c._randomNoiseCoordinates1=new xt.Vector3(Math.random(),Math.random(),Math.random()),c._randomNoiseCoordinates2=new xt.Vector3(Math.random(),Math.random(),Math.random()))),c._inheritParticleInfoToSubEmitters()},s=this,a=0;a<e;a++){if("break"===o())break}},_._GetAttributeNamesOrOptions=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1);var r=[xt.VertexBuffer.PositionKind,xt.VertexBuffer.ColorKind,"angle","offset","size"];return e&&r.push("cellIndex"),t||r.push("direction"),i&&r.push("remapData"),r},_._GetEffectCreationOptions=function(e){void 0===e&&(e=!1);var t=["invView","view","projection","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","textureMask","translationPivot","eyePosition"];return e&&t.push("particlesInfos"),t},_.prototype._getEffect=function(e){if(this._customEffect)return this._customEffect;var t=[];if(this._scene.clipPlane&&t.push("#define CLIPPLANE"),this._scene.clipPlane2&&t.push("#define CLIPPLANE2"),this._scene.clipPlane3&&t.push("#define CLIPPLANE3"),this._scene.clipPlane4&&t.push("#define CLIPPLANE4"),this._isAnimationSheetEnabled&&t.push("#define ANIMATESHEET"),e===_.BLENDMODE_MULTIPLY&&t.push("#define BLENDMULTIPLYMODE"),this._useRampGradients&&t.push("#define RAMPGRADIENT"),this._isBillboardBased)switch(t.push("#define BILLBOARD"),this.billboardMode){case _.BILLBOARDMODE_Y:t.push("#define BILLBOARDY");break;case _.BILLBOARDMODE_STRETCHED:t.push("#define BILLBOARDSTRETCHED")}this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),t.push(this._imageProcessingConfigurationDefines.toString()));var i=t.join("\n");if(this._cachedDefines!==i){this._cachedDefines=i;var r=_._GetAttributeNamesOrOptions(this._isAnimationSheetEnabled,this._isBillboardBased&&this.billboardMode!==_.BILLBOARDMODE_STRETCHED,this._useRampGradients),n=_._GetEffectCreationOptions(this._isAnimationSheetEnabled),o=["diffuseSampler","rampSampler"];xt.ImageProcessingConfiguration&&(xt.ImageProcessingConfiguration.PrepareUniforms(n,this._imageProcessingConfigurationDefines),xt.ImageProcessingConfiguration.PrepareSamplers(o,this._imageProcessingConfigurationDefines)),this._effect=this._scene.getEngine().createEffect("particles",r,n,o,i)}return this._effect},_.prototype.animate=function(e){var r=this;if(void 0===e&&(e=!1),this._started){if(!e){if(!this.isReady())return;if(this._currentRenderId===this._scene.getRenderId())return;this._currentRenderId=this._scene.getRenderId()}var t;if(this._scaledUpdateSpeed=this.updateSpeed*(e?this.preWarmStepOffset:this._scene.getAnimationRatio()),-1<this.manualEmitCount)t=this.manualEmitCount,this._newPartsExcess=0,this.manualEmitCount=0;else{var n=this.emitRate;if(this._emitRateGradients&&0<this._emitRateGradients.length&&this.targetStopDuration){var i=this._actualFrame/this.targetStopDuration;xt.Tools.GetCurrentGradient(i,this._emitRateGradients,(function(e,t,i){e!==r._currentEmitRateGradient&&(r._currentEmitRate1=r._currentEmitRate2,r._currentEmitRate2=t.getFactor(),r._currentEmitRateGradient=e),n=xt.Scalar.Lerp(r._currentEmitRate1,r._currentEmitRate2,i)}))}t=n*this._scaledUpdateSpeed>>0,this._newPartsExcess+=n*this._scaledUpdateSpeed-t}if(1<this._newPartsExcess&&(t+=this._newPartsExcess>>0,this._newPartsExcess-=this._newPartsExcess>>0),this._alive=!1,this._stopped?t=0:(this._actualFrame+=this._scaledUpdateSpeed,this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()),this._update(t),this._stopped&&(this._alive||(this._started=!1,this.onAnimationEnd&&this.onAnimationEnd(),this.disposeOnStop&&this._scene._toBeDisposed.push(this))),!e){for(var o=0,s=0;s<this._particles.length;s++){var a=this._particles[s];this._appendParticleVertices(o,a),o+=this._useInstancing?1:4}this._vertexBuffer&&this._vertexBuffer.update(this._vertexData)}0===this.manualEmitCount&&this.disposeOnStop&&this.stop()}},_.prototype._appendParticleVertices=function(e,t){this._appendParticleVertex(e++,t,0,0),this._useInstancing||(this._appendParticleVertex(e++,t,1,0),this._appendParticleVertex(e++,t,1,1),this._appendParticleVertex(e++,t,0,1))},_.prototype.rebuild=function(){this._createIndexBuffer(),this._vertexBuffer&&this._vertexBuffer._rebuild()},_.prototype.isReady=function(){if(!(this.emitter&&this._imageProcessingConfiguration.isReady()&&this.particleTexture&&this.particleTexture.isReady()))return!1;if(this.blendMode!==_.BLENDMODE_MULTIPLYADD){if(!this._getEffect(this.blendMode).isReady())return!1}else{if(!this._getEffect(_.BLENDMODE_MULTIPLY).isReady())return!1;if(!this._getEffect(_.BLENDMODE_ADD).isReady())return!1}return!0},_.prototype._render=function(e){var t=this._getEffect(e),i=this._scene.getEngine();i.enableEffect(t);var r=this._scene.getViewMatrix();if(t.setTexture("diffuseSampler",this.particleTexture),t.setMatrix("view",r),t.setMatrix("projection",this._scene.getProjectionMatrix()),this._isAnimationSheetEnabled&&this.particleTexture){var n=this.particleTexture.getBaseSize();t.setFloat3("particlesInfos",this.spriteCellWidth/n.width,this.spriteCellHeight/n.height,n.width/this.spriteCellWidth)}if(t.setVector2("translationPivot",this.translationPivot),t.setFloat4("textureMask",this.textureMask.r,this.textureMask.g,this.textureMask.b,this.textureMask.a),this._isBillboardBased){var o=this._scene.activeCamera;t.setVector3("eyePosition",o.globalPosition)}if(this._rampGradientsTexture&&t.setTexture("rampSampler",this._rampGradientsTexture),this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4){var s=r.clone();s.invert(),t.setMatrix("invView",s),xt.MaterialHelper.BindClipPlane(t,this._scene)}switch(i.bindBuffers(this._vertexBuffers,this._indexBuffer,t),this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(t),e){case _.BLENDMODE_ADD:i.setAlphaMode(xt.Engine.ALPHA_ADD);break;case _.BLENDMODE_ONEONE:i.setAlphaMode(xt.Engine.ALPHA_ONEONE);break;case _.BLENDMODE_STANDARD:i.setAlphaMode(xt.Engine.ALPHA_COMBINE);break;case _.BLENDMODE_MULTIPLY:i.setAlphaMode(xt.Engine.ALPHA_MULTIPLY)}return this._useInstancing?i.drawArraysType(xt.Material.TriangleFanDrawMode,0,4,this._particles.length):i.drawElementsType(xt.Material.TriangleFillMode,0,6*this._particles.length),this._particles.length},_.prototype.render=function(){if(!this.isReady()||!this._particles.length)return 0;var e=this._scene.getEngine();e.setState(!1),this.forceDepthWrite&&e.setDepthWrite(!0);var t=0;return this.blendMode===_.BLENDMODE_MULTIPLYADD&&(t=this._render(_.BLENDMODE_MULTIPLY)+this._render(_.BLENDMODE_ADD)),t=this._render(this.blendMode),e.unbindInstanceAttributes(),e.setAlphaMode(xt.Engine.ALPHA_DISABLE),t},_.prototype.dispose=function(e){if(void 0===e&&(e=!0),this._vertexBuffer&&(this._vertexBuffer.dispose(),this._vertexBuffer=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this._rampGradientsTexture&&(this._rampGradientsTexture.dispose(),this._rampGradientsTexture=null),this._removeFromRoot(),this._subEmitters&&this._subEmitters.length){for(var t=0;t<this._subEmitters.length;t++)for(var i=0,r=this._subEmitters[t];i<r.length;i++){r[i].dispose()}this._subEmitters=[],this.subEmitters=[]}this._disposeEmitterOnDispose&&this.emitter&&this.emitter.dispose&&this.emitter.dispose(!0),-1<(t=this._scene.particleSystems.indexOf(this))&&this._scene.particleSystems.splice(t,1),this._scene._activeParticleSystems.dispose(),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.reset()},_.prototype.clone=function(e,t){var i=null,r=null;if(null!=this.customShader){var n=0<(r=this.customShader).shaderOptions.defines.length?r.shaderOptions.defines.join("\n"):"";i=this._scene.getEngine().createEffectForParticles(r.shaderPath.fragmentElement,r.shaderOptions.uniforms,r.shaderOptions.samplers,n)}else this._customEffect&&(i=this._customEffect);var o=new _(e,this._capacity,this._scene,i);return o.customShader=r,xt.Tools.DeepCopy(this,o,["particles","customShader","noiseTexture"]),void 0===t&&(t=this.emitter),o.noiseTexture=this.noiseTexture,o.emitter=t,this.particleTexture&&(o.particleTexture=new xt.Texture(this.particleTexture.url,this._scene)),this._colorGradients&&this._colorGradients.forEach((function(e){o.addColorGradient(e.gradient,e.color1,e.color2)})),this._dragGradients&&this._dragGradients.forEach((function(e){o.addDragGradient(e.gradient,e.factor1,e.factor2)})),this._angularSpeedGradients&&this._angularSpeedGradients.forEach((function(e){o.addAngularSpeedGradient(e.gradient,e.factor1,e.factor2)})),this._emitRateGradients&&this._emitRateGradients.forEach((function(e){o.addEmitRateGradient(e.gradient,e.factor1,e.factor2)})),this._lifeTimeGradients&&this._lifeTimeGradients.forEach((function(e){o.addLifeTimeGradient(e.gradient,e.factor1,e.factor2)})),this._limitVelocityGradients&&this._limitVelocityGradients.forEach((function(e){o.addLimitVelocityGradient(e.gradient,e.factor1,e.factor2)})),this._sizeGradients&&this._sizeGradients.forEach((function(e){o.addSizeGradient(e.gradient,e.factor1,e.factor2)})),this._startSizeGradients&&this._startSizeGradients.forEach((function(e){o.addStartSizeGradient(e.gradient,e.factor1,e.factor2)})),this._velocityGradients&&this._velocityGradients.forEach((function(e){o.addVelocityGradient(e.gradient,e.factor1,e.factor2)})),this._rampGradients&&this._rampGradients.forEach((function(e){o.addRampGradient(e.gradient,e.color)})),this._colorRemapGradients&&this._colorRemapGradients.forEach((function(e){o.addColorRemapGradient(e.gradient,e.factor1,e.factor2)})),this._alphaRemapGradients&&this._alphaRemapGradients.forEach((function(e){o.addAlphaRemapGradient(e.gradient,e.factor1,e.factor2)})),this.preventAutoStart||o.start(),o},_.prototype.serialize=function(){var e={};if(_._Serialize(e,this),e.textureMask=this.textureMask.asArray(),e.customShader=this.customShader,e.preventAutoStart=this.preventAutoStart,this.subEmitters){e.subEmitters=[],this._subEmitters||this._prepareSubEmitterInternalArray();for(var t=0,i=this._subEmitters;t<i.length;t++){for(var r=[],n=0,o=i[t];n<o.length;n++){var s=o[n];r.push(s.serialize())}e.subEmitters.push(r)}}return e},_._Serialize=function(e,t){if(e.name=t.name,e.id=t.id,e.capacity=t.getCapacity(),t.emitter.position){var i=t.emitter;e.emitterId=i.id}else{var r=t.emitter;e.emitter=r.asArray()}t.particleEmitterType&&(e.particleEmitterType=t.particleEmitterType.serialize()),t.particleTexture&&(e.textureName=t.particleTexture.name,e.invertY=t.particleTexture._invertY),xt.Animation.AppendSerializedAnimations(t,e),e.beginAnimationOnStart=t.beginAnimationOnStart,e.beginAnimationFrom=t.beginAnimationFrom,e.beginAnimationTo=t.beginAnimationTo,e.beginAnimationLoop=t.beginAnimationLoop,e.startDelay=t.startDelay,e.renderingGroupId=t.renderingGroupId,e.isBillboardBased=t.isBillboardBased,e.billboardMode=t.billboardMode,e.minAngularSpeed=t.minAngularSpeed,e.maxAngularSpeed=t.maxAngularSpeed,e.minSize=t.minSize,e.maxSize=t.maxSize,e.minScaleX=t.minScaleX,e.maxScaleX=t.maxScaleX,e.minScaleY=t.minScaleY,e.maxScaleY=t.maxScaleY,e.minEmitPower=t.minEmitPower,e.maxEmitPower=t.maxEmitPower,e.minLifeTime=t.minLifeTime,e.maxLifeTime=t.maxLifeTime,e.emitRate=t.emitRate,e.gravity=t.gravity.asArray(),e.noiseStrength=t.noiseStrength.asArray(),e.color1=t.color1.asArray(),e.color2=t.color2.asArray(),e.colorDead=t.colorDead.asArray(),e.updateSpeed=t.updateSpeed,e.targetStopDuration=t.targetStopDuration,e.blendMode=t.blendMode,e.preWarmCycles=t.preWarmCycles,e.preWarmStepOffset=t.preWarmStepOffset,e.minInitialRotation=t.minInitialRotation,e.maxInitialRotation=t.maxInitialRotation,e.startSpriteCellID=t.startSpriteCellID,e.endSpriteCellID=t.endSpriteCellID,e.spriteCellChangeSpeed=t.spriteCellChangeSpeed,e.spriteCellWidth=t.spriteCellWidth,e.spriteCellHeight=t.spriteCellHeight,e.spriteRandomStartCell=t.spriteRandomStartCell,e.isAnimationSheetEnabled=t.isAnimationSheetEnabled;var n=t.getColorGradients();if(n){e.colorGradients=[];for(var o=0,s=n;o<s.length;o++){var a=s[o],l={gradient:a.gradient,color1:a.color1.asArray()};a.color2&&(l.color2=a.color2.asArray()),e.colorGradients.push(l)}}var c=t.getRampGradients();if(c){e.rampGradients=[];for(var h=0,u=c;h<u.length;h++){var d=u[h];l={gradient:d.gradient,color:d.color.asArray()};e.rampGradients.push(l)}e.useRampGradients=t.useRampGradients}var f=t.getColorRemapGradients();if(f){e.colorRemapGradients=[];for(var p=0,_=f;p<_.length;p++){var m=_[p];l={gradient:m.gradient,factor1:m.factor1};void 0!==m.factor2&&(l.factor2=m.factor2),e.colorRemapGradients.push(l)}}var g=t.getAlphaRemapGradients();if(g){e.alphaRemapGradients=[];for(var v=0,y=g;v<y.length;v++){var b=y[v];l={gradient:b.gradient,factor1:b.factor1};void 0!==b.factor2&&(l.factor2=b.factor2),e.alphaRemapGradients.push(l)}}var T=t.getSizeGradients();if(T){e.sizeGradients=[];for(var E=0,x=T;E<x.length;E++){var P=x[E];l={gradient:P.gradient,factor1:P.factor1};void 0!==P.factor2&&(l.factor2=P.factor2),e.sizeGradients.push(l)}}var A=t.getAngularSpeedGradients();if(A){e.angularSpeedGradients=[];for(var S=0,M=A;S<M.length;S++){var R=M[S];l={gradient:R.gradient,factor1:R.factor1};void 0!==R.factor2&&(l.factor2=R.factor2),e.angularSpeedGradients.push(l)}}var C=t.getVelocityGradients();if(C){e.velocityGradients=[];for(var O=0,D=C;O<D.length;O++){var I=D[O];l={gradient:I.gradient,factor1:I.factor1};void 0!==I.factor2&&(l.factor2=I.factor2),e.velocityGradients.push(l)}}var w=t.getDragGradients();if(w){e.dragyGradients=[];for(var L=0,F=w;L<F.length;L++){var B=F[L];l={gradient:B.gradient,factor1:B.factor1};void 0!==B.factor2&&(l.factor2=B.factor2),e.dragGradients.push(l)}}var N=t.getEmitRateGradients();if(N){e.emitRateGradients=[];for(var V=0,U=N;V<U.length;V++){var z=U[V];l={gradient:z.gradient,factor1:z.factor1};void 0!==z.factor2&&(l.factor2=z.factor2),e.emitRateGradients.push(l)}}var G=t.getStartSizeGradients();if(G){e.startSizeGradients=[];for(var k=0,W=G;k<W.length;k++){var H=W[k];l={gradient:H.gradient,factor1:H.factor1};void 0!==H.factor2&&(l.factor2=H.factor2),e.startSizeGradients.push(l)}}var X=t.getLifeTimeGradients();if(X){e.lifeTimeGradients=[];for(var j=0,Y=X;j<Y.length;j++){var K=Y[j];l={gradient:K.gradient,factor1:K.factor1};void 0!==K.factor2&&(l.factor2=K.factor2),e.lifeTimeGradients.push(l)}}var Q=t.getLimitVelocityGradients();if(Q){e.limitVelocityGradients=[];for(var Z=0,q=Q;Z<q.length;Z++){var J=q[Z];l={gradient:J.gradient,factor1:J.factor1};void 0!==J.factor2&&(l.factor2=J.factor2),e.limitVelocityGradients.push(l)}e.limitVelocityDamping=t.limitVelocityDamping}t.noiseTexture&&(e.noiseTexture=t.noiseTexture.serialize())},_._Parse=function(e,t,i,r){if(e.textureName&&(t.particleTexture=new xt.Texture(r+e.textureName,i,!1,void 0===e.invertY||e.invertY),t.particleTexture.name=e.textureName),e.emitterId||0===e.emitterId||void 0!==e.emitter?e.emitterId?t.emitter=i.getLastMeshByID(e.emitterId):t.emitter=xt.Vector3.FromArray(e.emitter):t.emitter=xt.Vector3.Zero(),void 0!==e.renderingGroupId&&(t.renderingGroupId=e.renderingGroupId),void 0!==e.isBillboardBased&&(t.isBillboardBased=e.isBillboardBased),void 0!==e.billboardMode&&(t.billboardMode=e.billboardMode),e.animations){for(var n=0;n<e.animations.length;n++){var o=e.animations[n];t.animations.push(xt.Animation.Parse(o))}t.beginAnimationOnStart=e.beginAnimationOnStart,t.beginAnimationFrom=e.beginAnimationFrom,t.beginAnimationTo=e.beginAnimationTo,t.beginAnimationLoop=e.beginAnimationLoop}if(e.autoAnimate&&i.beginAnimation(t,e.autoAnimateFrom,e.autoAnimateTo,e.autoAnimateLoop,e.autoAnimateSpeed||1),t.startDelay=0|e.startDelay,t.minAngularSpeed=e.minAngularSpeed,t.maxAngularSpeed=e.maxAngularSpeed,t.minSize=e.minSize,t.maxSize=e.maxSize,e.minScaleX&&(t.minScaleX=e.minScaleX,t.maxScaleX=e.maxScaleX,t.minScaleY=e.minScaleY,t.maxScaleY=e.maxScaleY),void 0!==e.preWarmCycles&&(t.preWarmCycles=e.preWarmCycles,t.preWarmStepOffset=e.preWarmStepOffset),void 0!==e.minInitialRotation&&(t.minInitialRotation=e.minInitialRotation,t.maxInitialRotation=e.maxInitialRotation),t.minLifeTime=e.minLifeTime,t.maxLifeTime=e.maxLifeTime,t.minEmitPower=e.minEmitPower,t.maxEmitPower=e.maxEmitPower,t.emitRate=e.emitRate,t.gravity=xt.Vector3.FromArray(e.gravity),e.noiseStrength&&(t.noiseStrength=xt.Vector3.FromArray(e.noiseStrength)),t.color1=xt.Color4.FromArray(e.color1),t.color2=xt.Color4.FromArray(e.color2),t.colorDead=xt.Color4.FromArray(e.colorDead),t.updateSpeed=e.updateSpeed,t.targetStopDuration=e.targetStopDuration,t.blendMode=e.blendMode,e.colorGradients)for(var s=0,a=e.colorGradients;s<a.length;s++){var l=a[s];t.addColorGradient(l.gradient,xt.Color4.FromArray(l.color1),l.color2?xt.Color4.FromArray(l.color2):void 0)}if(e.rampGradients){for(var c=0,h=e.rampGradients;c<h.length;c++){var u=h[c];t.addRampGradient(u.gradient,xt.Color3.FromArray(u.color))}t.useRampGradients=e.useRampGradients}if(e.colorRemapGradients)for(var d=0,f=e.colorRemapGradients;d<f.length;d++){var p=f[d];t.addColorRemapGradient(p.gradient,void 0!==p.factor1?p.factor1:p.factor,p.factor2)}if(e.alphaRemapGradients)for(var _=0,m=e.alphaRemapGradients;_<m.length;_++){var g=m[_];t.addAlphaRemapGradient(g.gradient,void 0!==g.factor1?g.factor1:g.factor,g.factor2)}if(e.sizeGradients)for(var v=0,y=e.sizeGradients;v<y.length;v++){var b=y[v];t.addSizeGradient(b.gradient,void 0!==b.factor1?b.factor1:b.factor,b.factor2)}if(e.sizeGradients)for(var T=0,E=e.sizeGradients;T<E.length;T++){b=E[T];t.addSizeGradient(b.gradient,void 0!==b.factor1?b.factor1:b.factor,b.factor2)}if(e.angularSpeedGradients)for(var x=0,P=e.angularSpeedGradients;x<P.length;x++){var A=P[x];t.addAngularSpeedGradient(A.gradient,void 0!==A.factor1?A.factor1:A.factor,A.factor2)}if(e.velocityGradients)for(var S=0,M=e.velocityGradients;S<M.length;S++){var R=M[S];t.addVelocityGradient(R.gradient,void 0!==R.factor1?R.factor1:R.factor,R.factor2)}if(e.dragGradients)for(var C=0,O=e.dragGradients;C<O.length;C++){var D=O[C];t.addDragGradient(D.gradient,void 0!==D.factor1?D.factor1:D.factor,D.factor2)}if(e.emitRateGradients)for(var I=0,w=e.emitRateGradients;I<w.length;I++){var L=w[I];t.addEmitRateGradient(L.gradient,void 0!==L.factor1?L.factor1:L.factor,L.factor2)}if(e.startSizeGradients)for(var F=0,B=e.startSizeGradients;F<B.length;F++){var N=B[F];t.addStartSizeGradient(N.gradient,void 0!==N.factor1?N.factor1:N.factor,N.factor2)}if(e.lifeTimeGradients)for(var V=0,U=e.lifeTimeGradients;V<U.length;V++){var z=U[V];t.addLifeTimeGradient(z.gradient,void 0!==z.factor1?z.factor1:z.factor,z.factor2)}if(e.limitVelocityGradients){for(var G=0,k=e.limitVelocityGradients;G<k.length;G++){var W=k[G];t.addLimitVelocityGradient(W.gradient,void 0!==W.factor1?W.factor1:W.factor,W.factor2)}t.limitVelocityDamping=e.limitVelocityDamping}var H;if(e.noiseTexture&&(t.noiseTexture=xt.ProceduralTexture.Parse(e.noiseTexture,i,r)),e.particleEmitterType){switch(e.particleEmitterType.type){case"SphereParticleEmitter":H=new xt.SphereParticleEmitter;break;case"SphereDirectedParticleEmitter":H=new xt.SphereDirectedParticleEmitter;break;case"ConeEmitter":case"ConeParticleEmitter":H=new xt.ConeParticleEmitter;break;case"CylinderParticleEmitter":H=new xt.CylinderParticleEmitter;break;case"HemisphericParticleEmitter":H=new xt.HemisphericParticleEmitter;break;case"BoxEmitter":case"BoxParticleEmitter":default:H=new xt.BoxParticleEmitter}H.parse(e.particleEmitterType)}else(H=new xt.BoxParticleEmitter).parse(e);t.particleEmitterType=H,t.startSpriteCellID=e.startSpriteCellID,t.endSpriteCellID=e.endSpriteCellID,t.spriteCellWidth=e.spriteCellWidth,t.spriteCellHeight=e.spriteCellHeight,t.spriteCellChangeSpeed=e.spriteCellChangeSpeed,t.spriteRandomStartCell=e.spriteRandomStartCell},_.Parse=function(e,t,i,r){void 0===r&&(r=!1);var n=e.name,o=null,s=null;if(e.customShader){var a=0<(s=e.customShader).shaderOptions.defines.length?s.shaderOptions.defines.join("\n"):"";o=t.getEngine().createEffectForParticles(s.shaderPath.fragmentElement,s.shaderOptions.uniforms,s.shaderOptions.samplers,a)}var l=new _(n,e.capacity,t,o,e.isAnimationSheetEnabled);if(l.customShader=s,e.id&&(l.id=e.id),e.subEmitters){l.subEmitters=[];for(var c=0,h=e.subEmitters;c<h.length;c++){for(var u=[],d=0,f=h[c];d<f.length;d++){var p=f[d];u.push(xt.SubEmitter.Parse(p,t,i))}l.subEmitters.push(u)}}return _._Parse(e,l,t,i),l.textureMask=xt.Color4.FromArray(e.textureMask),e.preventAutoStart&&(l.preventAutoStart=e.preventAutoStart),r||l.preventAutoStart||l.start(),l},_.BILLBOARDMODE_Y=2,_.BILLBOARDMODE_ALL=7,_.BILLBOARDMODE_STRETCHED=8,_})(xt.BaseParticleSystem),xt.ParticleSystem=Pt,At=$a||($a={}),St=(function(){function t(){this.direction1=new At.Vector3(0,1,0),this.direction2=new At.Vector3(0,1,0),this.minEmitBox=new At.Vector3(-.5,-.5,-.5),this.maxEmitBox=new At.Vector3(.5,.5,.5)}return t.prototype.startDirectionFunction=function(e,t,i){var r=At.Scalar.RandomRange(this.direction1.x,this.direction2.x),n=At.Scalar.RandomRange(this.direction1.y,this.direction2.y),o=At.Scalar.RandomRange(this.direction1.z,this.direction2.z);At.Vector3.TransformNormalFromFloatsToRef(r,n,o,e,t)},t.prototype.startPositionFunction=function(e,t,i){var r=At.Scalar.RandomRange(this.minEmitBox.x,this.maxEmitBox.x),n=At.Scalar.RandomRange(this.minEmitBox.y,this.maxEmitBox.y),o=At.Scalar.RandomRange(this.minEmitBox.z,this.maxEmitBox.z);At.Vector3.TransformCoordinatesFromFloatsToRef(r,n,o,e,t)},t.prototype.clone=function(){var e=new t;return At.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2),e.setVector3("minEmitBox",this.minEmitBox),e.setVector3("maxEmitBox",this.maxEmitBox)},t.prototype.getEffectDefines=function(){return"#define BOXEMITTER"},t.prototype.getClassName=function(){return"BoxParticleEmitter"},t.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e.minEmitBox=this.minEmitBox.asArray(),e.maxEmitBox=this.maxEmitBox.asArray(),e},t.prototype.parse=function(e){At.Vector3.FromArrayToRef(e.direction1,0,this.direction1),At.Vector3.FromArrayToRef(e.direction2,0,this.direction2),At.Vector3.FromArrayToRef(e.minEmitBox,0,this.minEmitBox),At.Vector3.FromArrayToRef(e.maxEmitBox,0,this.maxEmitBox)},t})(),At.BoxParticleEmitter=St,Mt=$a||($a={}),Rt=(function(){function t(e,t,i,r){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===r&&(r=0),this.radius=e,this.height=t,this.radiusRange=i,this.directionRandomizer=r}return t.prototype.startDirectionFunction=function(e,t,i){var r=i.position.subtract(e.getTranslation()).normalize(),n=Mt.Scalar.RandomRange(-this.directionRandomizer/2,this.directionRandomizer/2),o=Math.atan2(r.x,r.z);o+=Mt.Scalar.RandomRange(-Math.PI/2,Math.PI/2)*this.directionRandomizer,r.y=n,r.x=Math.sin(o),r.z=Math.cos(o),r.normalize(),Mt.Vector3.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},t.prototype.startPositionFunction=function(e,t,i){var r=Mt.Scalar.RandomRange(-this.height/2,this.height/2),n=Mt.Scalar.RandomRange(0,2*Math.PI),o=Mt.Scalar.RandomRange((1-this.radiusRange)*(1-this.radiusRange),1),s=Math.sqrt(o)*this.radius,a=s*Math.cos(n),l=s*Math.sin(n);Mt.Vector3.TransformCoordinatesFromFloatsToRef(a,r,l,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.directionRandomizer);return Mt.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},t.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER"},t.prototype.getClassName=function(){return"CylinderParticleEmitter"},t.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.height=this.height,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},t.prototype.parse=function(e){this.radius=e.radius,this.height=e.height,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},t})(),Ct=(function(s){function t(e,t,i,r,n){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=1),void 0===r&&(r=new Mt.Vector3(0,1,0)),void 0===n&&(n=new Mt.Vector3(0,1,0));var o=s.call(this,e,t,i)||this;return o.direction1=r,o.direction2=n,o}return T(t,s),t.prototype.startDirectionFunction=function(e,t,i){var r=Mt.Scalar.RandomRange(this.direction1.x,this.direction2.x),n=Mt.Scalar.RandomRange(this.direction1.y,this.direction2.y),o=Mt.Scalar.RandomRange(this.direction1.z,this.direction2.z);Mt.Vector3.TransformNormalFromFloatsToRef(r,n,o,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.height,this.radiusRange,this.direction1,this.direction2);return Mt.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("height",this.height),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define CYLINDEREMITTER\n#define DIRECTEDCYLINDEREMITTER"},t.prototype.getClassName=function(){return"CylinderDirectedParticleEmitter"},t.prototype.serialize=function(){var e=s.prototype.serialize.call(this);return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},t.prototype.parse=function(e){s.prototype.parse.call(this,e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)},t})(Mt.CylinderParticleEmitter=Rt),Mt.CylinderDirectedParticleEmitter=Ct,Ot=$a||($a={}),Dt=(function(){function t(e,t,i){void 0===e&&(e=1),void 0===t&&(t=Math.PI),void 0===i&&(i=0),this.directionRandomizer=i,this.radiusRange=1,this.heightRange=1,this.emitFromSpawnPointOnly=!1,this.angle=t,this.radius=e}return Object.defineProperty(t.prototype,"radius",{get:function(){return this._radius},set:function(e){this._radius=e,this._buildHeight()},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"angle",{get:function(){return this._angle},set:function(e){this._angle=e,this._buildHeight()},enumerable:!0,configurable:!0}),t.prototype._buildHeight=function(){0!==this._angle?this._height=this._radius/Math.tan(this._angle/2):this._height=1},t.prototype.startDirectionFunction=function(e,t,i){if(1===Math.abs(Math.cos(this._angle)))Ot.Vector3.TransformNormalFromFloatsToRef(0,1,0,e,t);else{var r=i.position.subtract(e.getTranslation()).normalize(),n=Ot.Scalar.RandomRange(0,this.directionRandomizer),o=Ot.Scalar.RandomRange(0,this.directionRandomizer),s=Ot.Scalar.RandomRange(0,this.directionRandomizer);r.x+=n,r.y+=o,r.z+=s,r.normalize(),Ot.Vector3.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)}},t.prototype.startPositionFunction=function(e,t,i){var r,n=Ot.Scalar.RandomRange(0,2*Math.PI);r=this.emitFromSpawnPointOnly?1e-4:1-(r=Ot.Scalar.RandomRange(0,this.heightRange))*r;var o=this._radius-Ot.Scalar.RandomRange(0,this._radius*this.radiusRange),s=(o*=r)*Math.sin(n),a=o*Math.cos(n),l=r*this._height;Ot.Vector3.TransformCoordinatesFromFloatsToRef(s,l,a,e,t)},t.prototype.clone=function(){var e=new t(this._radius,this._angle,this.directionRandomizer);return Ot.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat2("radius",this._radius,this.radiusRange),e.setFloat("coneAngle",this._angle),e.setFloat2("height",this._height,this.heightRange),e.setFloat("directionRandomizer",this.directionRandomizer)},t.prototype.getEffectDefines=function(){var e="#define CONEEMITTER";return this.emitFromSpawnPointOnly&&(e+="\n#define CONEEMITTERSPAWNPOINT"),e},t.prototype.getClassName=function(){return"ConeParticleEmitter"},t.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this._radius,e.angle=this._angle,e.directionRandomizer=this.directionRandomizer,e},t.prototype.parse=function(e){this.radius=e.radius,this.angle=e.angle,this.directionRandomizer=e.directionRandomizer},t})(),Ot.ConeParticleEmitter=Dt,It=$a||($a={}),wt=(function(){function t(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return t.prototype.startDirectionFunction=function(e,t,i){var r=i.position.subtract(e.getTranslation()).normalize(),n=It.Scalar.RandomRange(0,this.directionRandomizer),o=It.Scalar.RandomRange(0,this.directionRandomizer),s=It.Scalar.RandomRange(0,this.directionRandomizer);r.x+=n,r.y+=o,r.z+=s,r.normalize(),It.Vector3.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},t.prototype.startPositionFunction=function(e,t,i){var r=this.radius-It.Scalar.RandomRange(0,this.radius*this.radiusRange),n=It.Scalar.RandomRange(0,1),o=It.Scalar.RandomRange(0,2*Math.PI),s=Math.acos(2*n-1),a=r*Math.cos(o)*Math.sin(s),l=r*Math.cos(s),c=r*Math.sin(o)*Math.sin(s);It.Vector3.TransformCoordinatesFromFloatsToRef(a,l,c,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.directionRandomizer);return It.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},t.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER"},t.prototype.getClassName=function(){return"SphereParticleEmitter"},t.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},t.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},t})(),Lt=(function(n){function t(e,t,i){void 0===e&&(e=1),void 0===t&&(t=new It.Vector3(0,1,0)),void 0===i&&(i=new It.Vector3(0,1,0));var r=n.call(this,e)||this;return r.direction1=t,r.direction2=i,r}return T(t,n),t.prototype.startDirectionFunction=function(e,t,i){var r=It.Scalar.RandomRange(this.direction1.x,this.direction2.x),n=It.Scalar.RandomRange(this.direction1.y,this.direction2.y),o=It.Scalar.RandomRange(this.direction1.z,this.direction2.z);It.Vector3.TransformNormalFromFloatsToRef(r,n,o,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.direction1,this.direction2);return It.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define SPHEREEMITTER\n#define DIRECTEDSPHEREEMITTER"},t.prototype.getClassName=function(){return"SphereDirectedParticleEmitter"},t.prototype.serialize=function(){var e=n.prototype.serialize.call(this);return e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},t.prototype.parse=function(e){n.prototype.parse.call(this,e),this.direction1.copyFrom(e.direction1),this.direction2.copyFrom(e.direction2)},t})(It.SphereParticleEmitter=wt),It.SphereDirectedParticleEmitter=Lt,Ft=$a||($a={}),Bt=(function(){function t(e,t,i){void 0===e&&(e=1),void 0===t&&(t=1),void 0===i&&(i=0),this.radius=e,this.radiusRange=t,this.directionRandomizer=i}return t.prototype.startDirectionFunction=function(e,t,i){var r=i.position.subtract(e.getTranslation()).normalize(),n=Ft.Scalar.RandomRange(0,this.directionRandomizer),o=Ft.Scalar.RandomRange(0,this.directionRandomizer),s=Ft.Scalar.RandomRange(0,this.directionRandomizer);r.x+=n,r.y+=o,r.z+=s,r.normalize(),Ft.Vector3.TransformNormalFromFloatsToRef(r.x,r.y,r.z,e,t)},t.prototype.startPositionFunction=function(e,t,i){var r=this.radius-Ft.Scalar.RandomRange(0,this.radius*this.radiusRange),n=Ft.Scalar.RandomRange(0,1),o=Ft.Scalar.RandomRange(0,2*Math.PI),s=Math.acos(2*n-1),a=r*Math.cos(o)*Math.sin(s),l=r*Math.cos(s),c=r*Math.sin(o)*Math.sin(s);Ft.Vector3.TransformCoordinatesFromFloatsToRef(a,Math.abs(l),c,e,t)},t.prototype.clone=function(){var e=new t(this.radius,this.directionRandomizer);return Ft.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setFloat("radius",this.radius),e.setFloat("radiusRange",this.radiusRange),e.setFloat("directionRandomizer",this.directionRandomizer)},t.prototype.getEffectDefines=function(){return"#define HEMISPHERICEMITTER"},t.prototype.getClassName=function(){return"HemisphericParticleEmitter"},t.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.radius=this.radius,e.radiusRange=this.radiusRange,e.directionRandomizer=this.directionRandomizer,e},t.prototype.parse=function(e){this.radius=e.radius,this.radiusRange=e.radiusRange,this.directionRandomizer=e.directionRandomizer},t})(),Ft.HemisphericParticleEmitter=Bt,Nt=$a||($a={}),Vt=(function(){function t(){this.direction1=new Nt.Vector3(0,1,0),this.direction2=new Nt.Vector3(0,1,0)}return t.prototype.startDirectionFunction=function(e,t,i){var r=Nt.Scalar.RandomRange(this.direction1.x,this.direction2.x),n=Nt.Scalar.RandomRange(this.direction1.y,this.direction2.y),o=Nt.Scalar.RandomRange(this.direction1.z,this.direction2.z);Nt.Vector3.TransformNormalFromFloatsToRef(r,n,o,e,t)},t.prototype.startPositionFunction=function(e,t,i){Nt.Vector3.TransformCoordinatesFromFloatsToRef(0,0,0,e,t)},t.prototype.clone=function(){var e=new t;return Nt.Tools.DeepCopy(this,e),e},t.prototype.applyToShader=function(e){e.setVector3("direction1",this.direction1),e.setVector3("direction2",this.direction2)},t.prototype.getEffectDefines=function(){return"#define POINTEMITTER"},t.prototype.getClassName=function(){return"PointParticleEmitter"},t.prototype.serialize=function(){var e={};return e.type=this.getClassName(),e.direction1=this.direction1.asArray(),e.direction2=this.direction2.asArray(),e},t.prototype.parse=function(e){Nt.Vector3.FromArrayToRef(e.direction1,0,this.direction1),Nt.Vector3.FromArrayToRef(e.direction2,0,this.direction2)},t})(),Nt.PointParticleEmitter=Vt,(Ut=$a||($a={})).AbstractScene.AddParser(Ut.SceneComponentConstants.NAME_PARTICLESYSTEM,(function(e,t,i,r){var n=Ut.AbstractScene.GetIndividualParser(Ut.SceneComponentConstants.NAME_PARTICLESYSTEM);if(n&&void 0!==e.particleSystems&&null!==e.particleSystems)for(var o=0,s=e.particleSystems.length;o<s;o++){var a=e.particleSystems[o];i.particleSystems.push(n(a,t,r))}})),Ut.AbstractScene.AddIndividualParser(Ut.SceneComponentConstants.NAME_PARTICLESYSTEM,(function(e,t,i){return e.activeParticleCount?Ut.GPUParticleSystem.Parse(e,t,i):Ut.ParticleSystem.Parse(e,t,i)})),Ut.Engine.prototype.createEffectForParticles=function(e,t,i,r,n,o,s){void 0===t&&(t=[]),void 0===i&&(i=[]),void 0===r&&(r="");var a=Ut.ParticleSystem._GetAttributeNamesOrOptions(),l=Ut.ParticleSystem._GetEffectCreationOptions();return-1===r.indexOf(" BILLBOARD")&&(r+="\n#define BILLBOARD\n"),-1===i.indexOf("diffuseSampler")&&i.push("diffuseSampler"),this.createEffect({vertex:"particles",fragmentElement:e},a,l.concat(t),i,r,n,o,s)},Ut.Mesh.prototype.getEmittedParticleSystems=function(){for(var e=new Array,t=0;t<this.getScene().particleSystems.length;t++){var i=this.getScene().particleSystems[t];i.emitter===this&&e.push(i)}return e},Ut.Mesh.prototype.getHierarchyEmittedParticleSystems=function(){var e=new Array,t=this.getDescendants();t.push(this);for(var i=0;i<this.getScene().particleSystems.length;i++){var r=this.getScene().particleSystems[i],n=r.emitter;n.position&&-1!==t.indexOf(n)&&e.push(r)}return e},(function(s){var t,e;(e=t=s.SubEmitterType||(s.SubEmitterType={}))[e.ATTACHED=0]="ATTACHED",e[e.END=1]="END";var i=(function(){function o(e){this.particleSystem=e,this.type=t.END,this.inheritDirection=!1,this.inheritedVelocityAmount=0,e.emitter&&e.emitter.dispose||(e.emitter=new s.AbstractMesh("SubemitterSystemEmitter",e.getScene())),e.onDisposeObservable.add((function(){e.emitter&&e.emitter.dispose&&e.emitter.dispose()}))}return o.prototype.clone=function(){var e=this.particleSystem.emitter;e?e instanceof s.Vector3?e=e.clone():e instanceof s.AbstractMesh&&((e=new s.Mesh("",e.getScene())).isVisible=!1):e=new s.Vector3;var t=new o(this.particleSystem.clone("",e));return t.type=this.type,t.inheritDirection=this.inheritDirection,t.inheritedVelocityAmount=this.inheritedVelocityAmount,t.particleSystem._disposeEmitterOnDispose=!0,t.particleSystem.disposeOnStop=!0,t},o.prototype.serialize=function(){var e={};return e.type=this.type,e.inheritDirection=this.inheritDirection,e.inheritedVelocityAmount=this.inheritedVelocityAmount,e.particleSystem=this.particleSystem.serialize(),e},o.Parse=function(e,t,i){var r=e.particleSystem,n=new o(s.ParticleSystem.Parse(r,t,i));return n.type=e.type,n.inheritDirection=e.inheritDirection,n.inheritedVelocityAmount=e.inheritedVelocityAmount,n.particleSystem._isSubEmitter=!0,n},o.prototype.dispose=function(){this.particleSystem.dispose()},o})();s.SubEmitter=i})($a||($a={})),zt=$a||($a={}),Gt=(function(o){function c(e,t,i,r){void 0===r&&(r={});var n=o.call(this,e,t)||this;return n._textures={},n._textureArrays={},n._floats={},n._ints={},n._floatsArrays={},n._colors3={},n._colors3Arrays={},n._colors4={},n._vectors2={},n._vectors3={},n._vectors4={},n._matrices={},n._matrices3x3={},n._matrices2x2={},n._vectors2Arrays={},n._vectors3Arrays={},n._cachedWorldViewMatrix=new zt.Matrix,n._shaderPath=i,n._options=ae({needAlphaBlending:!1,needAlphaTesting:!1,attributes:["position","normal","uv"],uniforms:["worldViewProjection"],uniformBuffers:[],samplers:[],defines:[]},r),n}return T(c,o),c.prototype.getClassName=function(){return"ShaderMaterial"},c.prototype.needAlphaBlending=function(){return this.alpha<1||this._options.needAlphaBlending},c.prototype.needAlphaTesting=function(){return this._options.needAlphaTesting},c.prototype._checkUniform=function(e){-1===this._options.uniforms.indexOf(e)&&this._options.uniforms.push(e)},c.prototype.setTexture=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._textures[e]=t,this},c.prototype.setTextureArray=function(e,t){return-1===this._options.samplers.indexOf(e)&&this._options.samplers.push(e),this._checkUniform(e),this._textureArrays[e]=t,this},c.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},c.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},c.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},c.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},c.prototype.setColor3Array=function(e,t){return this._checkUniform(e),this._colors3Arrays[e]=t.reduce((function(e,t){return t.toArray(e,e.length),e}),[]),this},c.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},c.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},c.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},c.prototype.setVector4=function(e,t){return this._checkUniform(e),this._vectors4[e]=t,this},c.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},c.prototype.setMatrix3x3=function(e,t){return this._checkUniform(e),this._matrices3x3[e]=t,this},c.prototype.setMatrix2x2=function(e,t){return this._checkUniform(e),this._matrices2x2[e]=t,this},c.prototype.setArray2=function(e,t){return this._checkUniform(e),this._vectors2Arrays[e]=t,this},c.prototype.setArray3=function(e,t){return this._checkUniform(e),this._vectors3Arrays[e]=t,this},c.prototype._checkCache=function(e,t,i){return!t||(this._effect&&this._effect.defines.indexOf("#define INSTANCES"),!1)},c.prototype.isReady=function(e,t){var i=this.getScene(),r=i.getEngine();if(!this.checkReadyOnEveryCall&&this._renderId===i.getRenderId()&&this._checkCache(i,e,t))return!0;for(var n=[],o=[],s=new zt.EffectFallbacks,a=0;a<this._options.defines.length;a++)n.push(this._options.defines[a]);for(a=0;a<this._options.attributes.length;a++)o.push(this._options.attributes[a]);for(var l in e&&e.isVerticesDataPresent(zt.VertexBuffer.ColorKind)&&(o.push(zt.VertexBuffer.ColorKind),n.push("#define VERTEXCOLOR")),t&&(n.push("#define INSTANCES"),zt.MaterialHelper.PrepareAttributesForInstances(o,n)),e&&e.useBones&&e.computeBonesUsingShaders&&e.skeleton?(o.push(zt.VertexBuffer.MatricesIndicesKind),o.push(zt.VertexBuffer.MatricesWeightsKind),4<e.numBoneInfluencers&&(o.push(zt.VertexBuffer.MatricesIndicesExtraKind),o.push(zt.VertexBuffer.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+e.numBoneInfluencers),n.push("#define BonesPerMesh "+(e.skeleton.bones.length+1)),s.addCPUSkinningFallback(0,e),-1===this._options.uniforms.indexOf("mBones")&&this._options.uniforms.push("mBones")):n.push("#define NUM_BONE_INFLUENCERS 0"),this._textures)if(!this._textures[l].isReady())return!1;e&&this._shouldTurnAlphaTestOn(e)&&n.push("#define ALPHATEST");var c=this._effect,h=n.join("\n");return this._effect=r.createEffect(this._shaderPath,{attributes:o,uniformsNames:this._options.uniforms,uniformBuffersNames:this._options.uniformBuffers,samplers:this._options.samplers,defines:h,fallbacks:s,onCompiled:this.onCompiled,onError:this.onError},r),!!this._effect.isReady()&&(c!==this._effect&&i.resetCachedMaterial(),this._renderId=i.getRenderId(),!0)},c.prototype.bindOnlyWorldMatrix=function(e){var t=this.getScene();this._effect&&(-1!==this._options.uniforms.indexOf("world")&&this._effect.setMatrix("world",e),-1!==this._options.uniforms.indexOf("worldView")&&(e.multiplyToRef(t.getViewMatrix(),this._cachedWorldViewMatrix),this._effect.setMatrix("worldView",this._cachedWorldViewMatrix)),-1!==this._options.uniforms.indexOf("worldViewProjection")&&this._effect.setMatrix("worldViewProjection",e.multiply(t.getTransformMatrix())))},c.prototype.bind=function(e,t){if(this.bindOnlyWorldMatrix(e),this._effect&&this.getScene().getCachedMaterial()!==this){var i;for(i in-1!==this._options.uniforms.indexOf("view")&&this._effect.setMatrix("view",this.getScene().getViewMatrix()),-1!==this._options.uniforms.indexOf("projection")&&this._effect.setMatrix("projection",this.getScene().getProjectionMatrix()),-1!==this._options.uniforms.indexOf("viewProjection")&&this._effect.setMatrix("viewProjection",this.getScene().getTransformMatrix()),zt.MaterialHelper.BindBonesParameters(t,this._effect),this._textures)this._effect.setTexture(i,this._textures[i]);for(i in this._textureArrays)this._effect.setTextureArray(i,this._textureArrays[i]);for(i in this._ints)this._effect.setInt(i,this._ints[i]);for(i in this._floats)this._effect.setFloat(i,this._floats[i]);for(i in this._floatsArrays)this._effect.setArray(i,this._floatsArrays[i]);for(i in this._colors3)this._effect.setColor3(i,this._colors3[i]);for(i in this._colors3Arrays)this._effect.setArray3(i,this._colors3Arrays[i]);for(i in this._colors4){var r=this._colors4[i];this._effect.setFloat4(i,r.r,r.g,r.b,r.a)}for(i in this._vectors2)this._effect.setVector2(i,this._vectors2[i]);for(i in this._vectors3)this._effect.setVector3(i,this._vectors3[i]);for(i in this._vectors4)this._effect.setVector4(i,this._vectors4[i]);for(i in this._matrices)this._effect.setMatrix(i,this._matrices[i]);for(i in this._matrices3x3)this._effect.setMatrix3x3(i,this._matrices3x3[i]);for(i in this._matrices2x2)this._effect.setMatrix2x2(i,this._matrices2x2[i]);for(i in this._vectors2Arrays)this._effect.setArray2(i,this._vectors2Arrays[i]);for(i in this._vectors3Arrays)this._effect.setArray3(i,this._vectors3Arrays[i])}this._afterBind(t)},c.prototype.getActiveTextures=function(){var e=o.prototype.getActiveTextures.call(this);for(var t in this._textures)e.push(this._textures[t]);for(var t in this._textureArrays)for(var i=this._textureArrays[t],r=0;r<i.length;r++)e.push(i[r]);return e},c.prototype.hasTexture=function(e){if(o.prototype.hasTexture.call(this,e))return!0;for(var t in this._textures)if(this._textures[t]===e)return!0;for(var t in this._textureArrays)for(var i=this._textureArrays[t],r=0;r<i.length;r++)if(i[r]===e)return!0;return!1},c.prototype.clone=function(e){return new c(e,this.getScene(),this._shaderPath,this._options)},c.prototype.dispose=function(e,t){if(t){var i;for(i in this._textures)this._textures[i].dispose();for(i in this._textureArrays)for(var r=this._textureArrays[i],n=0;n<r.length;n++)r[n].dispose()}this._textures={},o.prototype.dispose.call(this,e,t)},c.prototype.serialize=function(){var e,t=zt.SerializationHelper.Serialize(this);for(e in t.customType="BABYLON.ShaderMaterial",t.options=this._options,t.shaderPath=this._shaderPath,t.textures={},this._textures)t.textures[e]=this._textures[e].serialize();for(e in t.textureArrays={},this._textureArrays){t.textureArrays[e]=[];for(var i=this._textureArrays[e],r=0;r<i.length;r++)t.textureArrays[e].push(i[r].serialize())}for(e in t.floats={},this._floats)t.floats[e]=this._floats[e];for(e in t.FloatArrays={},this._floatsArrays)t.FloatArrays[e]=this._floatsArrays[e];for(e in t.colors3={},this._colors3)t.colors3[e]=this._colors3[e].asArray();for(e in t.colors3Arrays={},this._colors3Arrays)t.colors3Arrays[e]=this._colors3Arrays[e];for(e in t.colors4={},this._colors4)t.colors4[e]=this._colors4[e].asArray();for(e in t.vectors2={},this._vectors2)t.vectors2[e]=this._vectors2[e].asArray();for(e in t.vectors3={},this._vectors3)t.vectors3[e]=this._vectors3[e].asArray();for(e in t.vectors4={},this._vectors4)t.vectors4[e]=this._vectors4[e].asArray();for(e in t.matrices={},this._matrices)t.matrices[e]=this._matrices[e].asArray();for(e in t.matrices3x3={},this._matrices3x3)t.matrices3x3[e]=this._matrices3x3[e];for(e in t.matrices2x2={},this._matrices2x2)t.matrices2x2[e]=this._matrices2x2[e];for(e in t.vectors2Arrays={},this._vectors2Arrays)t.vectors2Arrays[e]=this._vectors2Arrays[e];for(e in t.vectors3Arrays={},this._vectors3Arrays)t.vectors3Arrays[e]=this._vectors3Arrays[e];return t},c.Parse=function(e,t,i){var r,n=zt.SerializationHelper.Parse((function(){return new c(e.name,t,e.shaderPath,e.options)}),e,t,i);for(r in e.textures)n.setTexture(r,zt.Texture.Parse(e.textures[r],t,i));for(r in e.textureArrays){for(var o=e.textureArrays[r],s=new Array,a=0;a<o.length;a++)s.push(zt.Texture.Parse(o[a],t,i));n.setTextureArray(r,s)}for(r in e.floats)n.setFloat(r,e.floats[r]);for(r in e.floatsArrays)n.setFloats(r,e.floatsArrays[r]);for(r in e.colors3)n.setColor3(r,zt.Color3.FromArray(e.colors3[r]));for(r in e.colors3Arrays){var l=e.colors3Arrays[r].reduce((function(e,t,i){return i%3==0?e.push([t]):e[e.length-1].push(t),e}),[]).map((function(e){return zt.Color3.FromArray(e)}));n.setColor3Array(r,l)}for(r in e.colors4)n.setColor4(r,zt.Color4.FromArray(e.colors4[r]));for(r in e.vectors2)n.setVector2(r,zt.Vector2.FromArray(e.vectors2[r]));for(r in e.vectors3)n.setVector3(r,zt.Vector3.FromArray(e.vectors3[r]));for(r in e.vectors4)n.setVector4(r,zt.Vector4.FromArray(e.vectors4[r]));for(r in e.matrices)n.setMatrix(r,zt.Matrix.FromArray(e.matrices[r]));for(r in e.matrices3x3)n.setMatrix3x3(r,e.matrices3x3[r]);for(r in e.matrices2x2)n.setMatrix2x2(r,e.matrices2x2[r]);for(r in e.vectors2Arrays)n.setArray2(r,e.vectors2Arrays[r]);for(r in e.vectors3Arrays)n.setArray3(r,e.vectors3Arrays[r]);return n},c})(zt.Material),zt.ShaderMaterial=Gt,kt=$a||($a={}),Wt=(function(r){function n(e,t){var i=r.call(this,e,t)||this;return i.generateOctree=!1,i}return T(n,r),n.prototype.getClassName=function(){return"GroundMesh"},Object.defineProperty(n.prototype,"subdivisions",{get:function(){return Math.min(this._subdivisionsX,this._subdivisionsY)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"subdivisionsX",{get:function(){return this._subdivisionsX},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"subdivisionsY",{get:function(){return this._subdivisionsY},enumerable:!0,configurable:!0}),n.prototype.optimize=function(e,t){void 0===t&&(t=32),this._subdivisionsX=e,this._subdivisionsY=e,this.subdivide(e);this.createOrUpdateSubmeshesOctree&&this.createOrUpdateSubmeshesOctree(t)},n.prototype.getHeightAtCoordinates=function(e,t){var i=this.getWorldMatrix(),r=kt.Tmp.Matrix[5];i.invertToRef(r);var n=kt.Tmp.Vector3[8];if(kt.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,r,n),e=n.x,t=n.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this.position.y;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var o=this._getFacetAt(e,t),s=-(o.x*e+o.z*t+o.w)/o.y;return kt.Vector3.TransformCoordinatesFromFloatsToRef(0,s,0,i,n),n.y},n.prototype.getNormalAtCoordinates=function(e,t){var i=new kt.Vector3(0,1,0);return this.getNormalAtCoordinatesToRef(e,t,i),i},n.prototype.getNormalAtCoordinatesToRef=function(e,t,i){var r=this.getWorldMatrix(),n=kt.Tmp.Matrix[5];r.invertToRef(n);var o=kt.Tmp.Vector3[8];if(kt.Vector3.TransformCoordinatesFromFloatsToRef(e,0,t,n,o),e=o.x,t=o.z,e<this._minX||e>this._maxX||t<this._minZ||t>this._maxZ)return this;this._heightQuads&&0!=this._heightQuads.length||(this._initHeightQuads(),this._computeHeightQuads());var s=this._getFacetAt(e,t);return kt.Vector3.TransformNormalFromFloatsToRef(s.x,s.y,s.z,r,i),this},n.prototype.updateCoordinateHeights=function(){return this._heightQuads&&0!=this._heightQuads.length||this._initHeightQuads(),this._computeHeightQuads(),this},n.prototype._getFacetAt=function(e,t){var i=Math.floor((e+this._maxX)*this._subdivisionsX/this._width),r=Math.floor(-(t+this._maxZ)*this._subdivisionsY/this._height+this._subdivisionsY),n=this._heightQuads[r*this._subdivisionsX+i];return t<n.slope.x*e+n.slope.y?n.facet1:n.facet2},n.prototype._initHeightQuads=function(){var e=this._subdivisionsX,t=this._subdivisionsY;this._heightQuads=new Array;for(var i=0;i<t;i++)for(var r=0;r<e;r++){var n={slope:kt.Vector2.Zero(),facet1:new kt.Vector4(0,0,0,0),facet2:new kt.Vector4(0,0,0,0)};this._heightQuads[i*e+r]=n}return this},n.prototype._computeHeightQuads=function(){var e=this.getVerticesData(kt.VertexBuffer.PositionKind);if(!e)return this;for(var t=kt.Tmp.Vector3[3],i=kt.Tmp.Vector3[2],r=kt.Tmp.Vector3[1],n=kt.Tmp.Vector3[0],o=kt.Tmp.Vector3[4],s=kt.Tmp.Vector3[5],a=kt.Tmp.Vector3[6],l=kt.Tmp.Vector3[7],c=kt.Tmp.Vector3[8],h=0,u=0,d=0,f=0,p=0,_=0,m=0,g=this._subdivisionsX,v=this._subdivisionsY,y=0;y<v;y++)for(var b=0;b<g;b++){h=3*b,u=y*(g+1)*3,d=(y+1)*(g+1)*3,t.x=e[u+h],t.y=e[u+h+1],t.z=e[u+h+2],i.x=e[u+h+3],i.y=e[u+h+4],i.z=e[u+h+5],r.x=e[d+h],r.y=e[d+h+1],r.z=e[d+h+2],n.x=e[d+h+3],n.y=e[d+h+4],n.z=e[d+h+5],f=(n.z-t.z)/(n.x-t.x),p=t.z-f*t.x,i.subtractToRef(t,o),r.subtractToRef(t,s),n.subtractToRef(t,a),kt.Vector3.CrossToRef(a,s,l),kt.Vector3.CrossToRef(o,a,c),l.normalize(),c.normalize(),_=-(l.x*t.x+l.y*t.y+l.z*t.z),m=-(c.x*i.x+c.y*i.y+c.z*i.z);var T=this._heightQuads[y*g+b];T.slope.copyFromFloats(f,p),T.facet1.copyFromFloats(l.x,l.y,l.z,_),T.facet2.copyFromFloats(c.x,c.y,c.z,m)}return this},n.prototype.serialize=function(e){r.prototype.serialize.call(this,e),e.subdivisionsX=this._subdivisionsX,e.subdivisionsY=this._subdivisionsY,e.minX=this._minX,e.maxX=this._maxX,e.minZ=this._minZ,e.maxZ=this._maxZ,e.width=this._width,e.height=this._height},n.Parse=function(e,t){var i=new n(e.name,t);return i._subdivisionsX=e.subdivisionsX||1,i._subdivisionsY=e.subdivisionsY||1,i._minX=e.minX,i._maxX=e.maxX,i._minZ=e.minZ,i._maxZ=e.maxZ,i._width=e.width,i._height=e.height,i},n})(kt.Mesh),kt.GroundMesh=Wt,Ht=$a||($a={}),Xt=(function(r){function e(e,t){var i=r.call(this,e,t.getScene())||this;return t.instances.push(i),i._sourceMesh=t,i.position.copyFrom(t.position),i.rotation.copyFrom(t.rotation),i.scaling.copyFrom(t.scaling),t.rotationQuaternion&&(i.rotationQuaternion=t.rotationQuaternion.clone()),i.infiniteDistance=t.infiniteDistance,i.setPivotMatrix(t.getPivotMatrix()),i.refreshBoundingInfo(),i._syncSubMeshes(),i}return T(e,r),e.prototype.getClassName=function(){return"InstancedMesh"},Object.defineProperty(e.prototype,"receiveShadows",{get:function(){return this._sourceMesh.receiveShadows},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"material",{get:function(){return this._sourceMesh.material},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"visibility",{get:function(){return this._sourceMesh.visibility},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"skeleton",{get:function(){return this._sourceMesh.skeleton},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._sourceMesh.renderingGroupId},set:function(e){this._sourceMesh&&e!==this._sourceMesh.renderingGroupId&&Ht.Tools.Warn("Note - setting renderingGroupId of an instanced mesh has no effect on the scene")},enumerable:!0,configurable:!0}),e.prototype.getTotalVertices=function(){return this._sourceMesh.getTotalVertices()},Object.defineProperty(e.prototype,"sourceMesh",{get:function(){return this._sourceMesh},enumerable:!0,configurable:!0}),e.prototype.isReady=function(e){return void 0===e&&(e=!1),this._sourceMesh.isReady(e,!0)},e.prototype.getVerticesData=function(e,t){return this._sourceMesh.getVerticesData(e,t)},e.prototype.setVerticesData=function(e,t,i,r){return this.sourceMesh&&this.sourceMesh.setVerticesData(e,t,i,r),this.sourceMesh},e.prototype.updateVerticesData=function(e,t,i,r){return this.sourceMesh&&this.sourceMesh.updateVerticesData(e,t,i,r),this.sourceMesh},e.prototype.setIndices=function(e,t){return void 0===t&&(t=null),this.sourceMesh&&this.sourceMesh.setIndices(e,t),this.sourceMesh},e.prototype.isVerticesDataPresent=function(e){return this._sourceMesh.isVerticesDataPresent(e)},e.prototype.getIndices=function(){return this._sourceMesh.getIndices()},Object.defineProperty(e.prototype,"_positions",{get:function(){return this._sourceMesh._positions},enumerable:!0,configurable:!0}),e.prototype.refreshBoundingInfo=function(){var e=this._sourceMesh.getBoundingInfo();return this._boundingInfo=new Ht.BoundingInfo(e.minimum.clone(),e.maximum.clone()),this._updateBoundingInfo(),this},e.prototype._preActivate=function(){return this._currentLOD&&this._currentLOD._preActivate(),this},e.prototype._activate=function(e){return this._currentLOD&&this._currentLOD._registerInstanceForRenderId(this,e),this},e.prototype.getLOD=function(e){if(!e)return this;var t=this.getBoundingInfo();return this._currentLOD=this.sourceMesh.getLOD(e,t.boundingSphere),this._currentLOD===this.sourceMesh?this:this._currentLOD},e.prototype._syncSubMeshes=function(){if(this.releaseSubMeshes(),this._sourceMesh.subMeshes)for(var e=0;e<this._sourceMesh.subMeshes.length;e++)this._sourceMesh.subMeshes[e].clone(this,this._sourceMesh);return this},e.prototype._generatePointsArray=function(){return this._sourceMesh._generatePointsArray()},e.prototype.clone=function(e,t,i){var r=this._sourceMesh.createInstance(e);if(Ht.Tools.DeepCopy(this,r,["name","subMeshes","uniqueId"],[]),this.refreshBoundingInfo(),t&&(r.parent=t),!i)for(var n=0;n<this.getScene().meshes.length;n++){var o=this.getScene().meshes[n];o.parent===this&&o.clone(o.name,r)}return r.computeWorldMatrix(!0),r},e.prototype.dispose=function(e,t){void 0===t&&(t=!1);var i=this._sourceMesh.instances.indexOf(this);this._sourceMesh.instances.splice(i,1),r.prototype.dispose.call(this,e,t)},e})(Ht.AbstractMesh),Ht.InstancedMesh=Xt,jt=$a||($a={}),Yt=(function(c){function r(e,t,i,r,n,o,s){void 0===t&&(t=null),void 0===i&&(i=null);var a=c.call(this,e,t,i,r,n)||this;a.useVertexColor=o,a.useVertexAlpha=s,a.color=new jt.Color3(1,1,1),a.alpha=1,r&&(a.color=r.color.clone(),a.alpha=r.alpha,a.useVertexColor=r.useVertexColor,a.useVertexAlpha=r.useVertexAlpha),a._intersectionThreshold=.1;var l={attributes:[jt.VertexBuffer.PositionKind,"world0","world1","world2","world3"],uniforms:["world","viewProjection"],needAlphaBlending:!0,defines:[]};return!1===s&&(l.needAlphaBlending=!1),o?(l.defines.push("#define VERTEXCOLOR"),l.attributes.push(jt.VertexBuffer.ColorKind)):l.uniforms.push("color"),a._colorShader=new jt.ShaderMaterial("colorShader",a.getScene(),"color",l),a}return T(r,c),Object.defineProperty(r.prototype,"intersectionThreshold",{get:function(){return this._intersectionThreshold},set:function(e){this._intersectionThreshold!==e&&(this._intersectionThreshold=e,this.geometry&&(this.geometry.boundingBias=new jt.Vector2(0,e)))},enumerable:!0,configurable:!0}),r.prototype.getClassName=function(){return"LinesMesh"},Object.defineProperty(r.prototype,"material",{get:function(){return this._colorShader},set:function(e){},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"checkCollisions",{get:function(){return!1},enumerable:!0,configurable:!0}),r.prototype._bind=function(e,t,i){return this._geometry&&(this._geometry._bind(this._colorShader.getEffect()),this.useVertexColor||this._colorShader.setColor4("color",this.color.toColor4(this.alpha))),this},r.prototype._draw=function(e,t,i){return this._geometry&&this._geometry.getVertexBuffers()&&(this._unIndexed||this._geometry.getIndexBuffer())&&this.getScene().getEngine().drawElementsType(jt.Material.LineListDrawMode,e.indexStart,e.indexCount,i),this},r.prototype.dispose=function(e){this._colorShader.dispose(),c.prototype.dispose.call(this,e)},r.prototype.clone=function(e,t,i){return new r(e,this.getScene(),t,this,i)},r})(jt.Mesh),jt.LinesMesh=Yt,Kt=$a||($a={}),Qt=(function(){function e(){this._count=0,this._data={}}return e.prototype.copyFrom=function(e){var i=this;this.clear(),e.forEach((function(e,t){return i.add(e,t)}))},e.prototype.get=function(e){var t=this._data[e];if(void 0!==t)return t},e.prototype.getOrAddWithFactory=function(e,t){var i=this.get(e);return void 0!==i||(i=t(e))&&this.add(e,i),i},e.prototype.getOrAdd=function(e,t){var i=this.get(e);return void 0!==i?i:(this.add(e,t),t)},e.prototype.contains=function(e){return void 0!==this._data[e]},e.prototype.add=function(e,t){return void 0===this._data[e]&&(this._data[e]=t,++this._count,!0)},e.prototype.set=function(e,t){return void 0!==this._data[e]&&(this._data[e]=t,!0)},e.prototype.getAndRemove=function(e){var t=this.get(e);return void 0!==t?(delete this._data[e],--this._count,t):null},e.prototype.remove=function(e){return!!this.contains(e)&&(delete this._data[e],--this._count,!0)},e.prototype.clear=function(){this._data={},this._count=0},Object.defineProperty(e.prototype,"count",{get:function(){return this._count},enumerable:!0,configurable:!0}),e.prototype.forEach=function(e){for(var t in this._data){e(t,this._data[t])}},e.prototype.first=function(e){for(var t in this._data){var i=e(t,this._data[t]);if(i)return i}return null},e})(),Kt.StringDictionary=Qt,Zt=$a||($a={}),qt=Zt.Debug||(Zt.Debug={}),Jt=(function(){function e(e,t,i,r,n){void 0===r&&(r=!0),void 0===n&&(n=1),this.skeleton=e,this.mesh=t,this.autoUpdateBonesMatrices=r,this.renderingGroupId=n,this.color=Zt.Color3.White(),this._debugLines=new Array,this._isEnabled=!1,this._scene=i,this.update(),this._renderFunction=this.update.bind(this)}return Object.defineProperty(e.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&((this._isEnabled=e)?this._scene.registerBeforeRender(this._renderFunction):this._scene.unregisterBeforeRender(this._renderFunction))},enumerable:!0,configurable:!0}),e.prototype._getBonePosition=function(e,t,i,r,n,o){void 0===r&&(r=0),void 0===n&&(n=0),void 0===o&&(o=0);var s=Zt.Tmp.Matrix[0],a=t.getParent();if(s.copyFrom(t.getLocalMatrix()),0!==r||0!==n||0!==o){var l=Zt.Tmp.Matrix[1];Zt.Matrix.IdentityToRef(l),l.m[12]=r,l.m[13]=n,l.m[14]=o,l.multiplyToRef(s,s)}a&&s.multiplyToRef(a.getAbsoluteTransform(),s),s.multiplyToRef(i,s),e.x=s.m[12],e.y=s.m[13],e.z=s.m[14]},e.prototype._getLinesForBonesWithLength=function(e,t){for(var i=e.length,r=this.mesh.position,n=0;n<i;n++){var o=e[n],s=this._debugLines[n];s||(s=[Zt.Vector3.Zero(),Zt.Vector3.Zero()],this._debugLines[n]=s),this._getBonePosition(s[0],o,t),this._getBonePosition(s[1],o,t,0,o.length,0),s[0].subtractInPlace(r),s[1].subtractInPlace(r)}},e.prototype._getLinesForBonesNoLength=function(e,t){for(var i=e.length,r=0,n=this.mesh.position,o=i-1;0<=o;o--){var s=e[o],a=s.getParent();if(a){var l=this._debugLines[r];l||(l=[Zt.Vector3.Zero(),Zt.Vector3.Zero()],this._debugLines[r]=l),s.getAbsolutePositionToRef(this.mesh,l[0]),a.getAbsolutePositionToRef(this.mesh,l[1]),l[0].subtractInPlace(n),l[1].subtractInPlace(n),r++}}},e.prototype.update=function(){this.autoUpdateBonesMatrices&&this.skeleton.computeAbsoluteTransforms(),void 0===this.skeleton.bones[0].length?this._getLinesForBonesNoLength(this.skeleton.bones,this.mesh.getWorldMatrix()):this._getLinesForBonesWithLength(this.skeleton.bones,this.mesh.getWorldMatrix()),this._debugMesh?Zt.MeshBuilder.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:this._debugMesh},this._scene):(this._debugMesh=Zt.MeshBuilder.CreateLineSystem("",{lines:this._debugLines,updatable:!0,instance:null},this._scene),this._debugMesh.renderingGroupId=this.renderingGroupId),this._debugMesh.position.copyFrom(this.mesh.position),this._debugMesh.color=this.color},e.prototype.dispose=function(){this._debugMesh&&(this.isEnabled=!1,this._debugMesh.dispose(),this._debugMesh=null)},e})(),qt.SkeletonViewer=Jt,$t=$a||($a={}),ei=$t.Debug||($t.Debug={}),ti=(function(){function e(e,t){void 0===t&&(t=1),this._xline=[$t.Vector3.Zero(),$t.Vector3.Zero()],this._yline=[$t.Vector3.Zero(),$t.Vector3.Zero()],this._zline=[$t.Vector3.Zero(),$t.Vector3.Zero()],this.scaleLines=1,this.scaleLines=t,this._xmesh=$t.Mesh.CreateLines("xline",this._xline,e,!0),this._ymesh=$t.Mesh.CreateLines("yline",this._yline,e,!0),this._zmesh=$t.Mesh.CreateLines("zline",this._zline,e,!0),this._xmesh.renderingGroupId=2,this._ymesh.renderingGroupId=2,this._zmesh.renderingGroupId=2,this._xmesh.material.checkReadyOnlyOnce=!0,this._xmesh.color=new $t.Color3(1,0,0),this._ymesh.material.checkReadyOnlyOnce=!0,this._ymesh.color=new $t.Color3(0,1,0),this._zmesh.material.checkReadyOnlyOnce=!0,this._zmesh.color=new $t.Color3(0,0,1),this.scene=e}return e.prototype.update=function(e,t,i,r){var n=this.scaleLines;this._xmesh&&this._xmesh.position.copyFrom(e),this._ymesh&&this._ymesh.position.copyFrom(e),this._zmesh&&this._zmesh.position.copyFrom(e);var o=this._xline[1];o.x=t.x*n,o.y=t.y*n,o.z=t.z*n,$t.Mesh.CreateLines("",this._xline,null,!1,this._xmesh),(o=this._yline[1]).x=i.x*n,o.y=i.y*n,o.z=i.z*n,$t.Mesh.CreateLines("",this._yline,null,!1,this._ymesh),(o=this._zline[1]).x=r.x*n,o.y=r.y*n,o.z=r.z*n,$t.Mesh.CreateLines("",this._zline,null,!1,this._zmesh)},e.prototype.dispose=function(){this._xmesh&&this._xmesh.dispose(),this._ymesh&&this._ymesh.dispose(),this._zmesh&&this._zmesh.dispose(),this._xmesh=null,this._ymesh=null,this._zmesh=null,this.scene=null},e})(),ei.AxesViewer=ti,ii=$a||($a={}),ri=ii.Debug||(ii.Debug={}),ni=(function(o){function e(e,t,i,r){void 0===r&&(r=1);var n=o.call(this,e,r)||this;return n.pos=ii.Vector3.Zero(),n.xaxis=ii.Vector3.Zero(),n.yaxis=ii.Vector3.Zero(),n.zaxis=ii.Vector3.Zero(),n.mesh=i,n.bone=t,n}return T(e,o),e.prototype.update=function(){if(this.mesh&&this.bone){var e=this.bone;e.getAbsolutePositionToRef(this.mesh,this.pos),e.getDirectionToRef(ii.Axis.X,this.mesh,this.xaxis),e.getDirectionToRef(ii.Axis.Y,this.mesh,this.yaxis),e.getDirectionToRef(ii.Axis.Z,this.mesh,this.zaxis),o.prototype.update.call(this,this.pos,this.xaxis,this.yaxis,this.zaxis)}},e.prototype.dispose=function(){this.mesh&&(this.mesh=null,this.bone=null,o.prototype.dispose.call(this))},e})(ri.AxesViewer),ri.BoneAxesViewer=ni,oi=$a||($a={}),si=(function(){function n(e){this.ray=e}return n.CreateAndShow=function(e,t,i){var r=new n(e);return r.show(t,i),r},n.prototype.show=function(e,t){if(!this._renderFunction&&this.ray){var i=this.ray;this._renderFunction=this._render.bind(this),this._scene=e,this._renderPoints=[i.origin,i.origin.add(i.direction.scale(i.length))],this._renderLine=oi.Mesh.CreateLines("ray",this._renderPoints,e,!0),this._renderFunction&&this._scene.registerBeforeRender(this._renderFunction)}t&&this._renderLine&&this._renderLine.color.copyFrom(t)},n.prototype.hide=function(){this._renderFunction&&this._scene&&(this._scene.unregisterBeforeRender(this._renderFunction),this._scene=null,this._renderFunction=null,this._renderLine&&(this._renderLine.dispose(),this._renderLine=null),this._renderPoints=[])},n.prototype._render=function(){var e=this.ray;if(e){var t=this._renderPoints[1],i=Math.min(e.length,1e6);t.copyFrom(e.direction),t.scaleInPlace(i),t.addInPlace(e.origin),oi.Mesh.CreateLines("ray",this._renderPoints,this._scene,!0,this._renderLine)}},n.prototype.attachToMesh=function(e,t,i,r){this._attachedToMesh=e;var n=this.ray;n&&(n.direction||(n.direction=oi.Vector3.Zero()),n.origin||(n.origin=oi.Vector3.Zero()),r&&(n.length=r),i||(i=oi.Vector3.Zero()),t||(t=new oi.Vector3(0,0,-1)),this._meshSpaceDirection?(this._meshSpaceDirection.copyFrom(t),this._meshSpaceOrigin.copyFrom(i)):(this._meshSpaceDirection=t.clone(),this._meshSpaceOrigin=i.clone()),this._updateToMeshFunction||(this._updateToMeshFunction=this._updateToMesh.bind(this),this._attachedToMesh.getScene().registerBeforeRender(this._updateToMeshFunction)),this._updateToMesh())},n.prototype.detachFromMesh=function(){this._attachedToMesh&&(this._updateToMeshFunction&&this._attachedToMesh.getScene().unregisterBeforeRender(this._updateToMeshFunction),this._attachedToMesh=null,this._updateToMeshFunction=null)},n.prototype._updateToMesh=function(){var e=this.ray;this._attachedToMesh&&e&&(this._attachedToMesh._isDisposed?this.detachFromMesh():(this._attachedToMesh.getDirectionToRef(this._meshSpaceDirection,e.direction),oi.Vector3.TransformCoordinatesToRef(this._meshSpaceOrigin,this._attachedToMesh.getWorldMatrix(),e.origin)))},n.prototype.dispose=function(){this.hide(),this.detachFromMesh(),this.ray=null},n})(),oi.RayHelper=si,(function(i){Object.defineProperty(i.Scene.prototype,"debugLayer",{get:function(){return this._debugLayer||(this._debugLayer=new e(this)),this._debugLayer},enumerable:!0,configurable:!0});var e=(function(){function t(e){var t=this;this.BJSINSPECTOR="undefined"!=typeof INSPECTOR?INSPECTOR:void 0,this.onPropertyChangedObservable=new i.Observable,this._scene=e,this._scene.onDisposeObservable.add((function(){t._scene._debugLayer&&t._scene._debugLayer.hide()}))}return t.prototype._createInspector=function(e){void 0===e&&(e={});var t=e.popup||!1,i=e.initialTab||0,r=e.parentElement||null;this._inspector||(this.BJSINSPECTOR=this.BJSINSPECTOR||"undefined"!=typeof INSPECTOR?INSPECTOR:void 0,this._inspector=new this.BJSINSPECTOR.Inspector(this._scene,t,i,r,e.newColors))},t.prototype.isVisible=function(){return!!this._inspector},t.prototype.hide=function(){if(this._inspector){try{this._inspector.dispose()}catch(e){}this.onPropertyChangedObservable.clear(),this._inspector=null}},t.prototype.show=function(e){void 0===e&&(e={}),void 0===this.BJSINSPECTOR?i.Tools.LoadScript(t.InspectorURL,this._createInspector.bind(this,e)):this._createInspector(e)},t.prototype.getActiveTab=function(){return this._inspector?this._inspector.getActiveTabIndex():-1},t.InspectorURL="https://preview.babylonjs.com/inspector/babylon.inspector.bundle.js",t})();i.DebugLayer=e})($a||($a={})),ai=$a||($a={}),li=ai.Debug||(ai.Debug={}),ci=(function(){function e(e){this._impostors=[],this._meshes=[],this._numMeshes=0,this._scene=e||ai.Engine.LastCreatedScene;var t=this._scene.getPhysicsEngine();t&&(this._physicsEnginePlugin=t.getPhysicsPlugin())}return e.prototype._updateDebugMeshes=function(){for(var e=this._physicsEnginePlugin,t=0;t<this._numMeshes;t++){var i=this._impostors[t];if(i)if(i.isDisposed)this.hideImpostor(this._impostors[t--]);else{var r=this._meshes[t];r&&e&&e.syncMeshWithImpostor(r,i)}}},e.prototype.showImpostor=function(e){if(this._scene){for(var t=0;t<this._numMeshes;t++)if(this._impostors[t]==e)return;var i=this._getDebugMesh(e,this._scene);i&&(this._impostors[this._numMeshes]=e,this._meshes[this._numMeshes]=i,0===this._numMeshes&&(this._renderFunction=this._updateDebugMeshes.bind(this),this._scene.registerBeforeRender(this._renderFunction)),this._numMeshes++)}},e.prototype.hideImpostor=function(e){if(e&&this._scene){for(var t=!1,i=0;i<this._numMeshes;i++)if(this._impostors[i]==e){var r=this._meshes[i];if(!r)continue;this._scene.removeMesh(r),r.dispose(),this._numMeshes--,0<this._numMeshes?(this._meshes[i]=this._meshes[this._numMeshes],this._impostors[i]=this._impostors[this._numMeshes],this._meshes[this._numMeshes]=null,this._impostors[this._numMeshes]=null):(this._meshes[0]=null,this._impostors[0]=null),t=!0;break}t&&0===this._numMeshes&&this._scene.unregisterBeforeRender(this._renderFunction)}},e.prototype._getDebugMaterial=function(e){return this._debugMaterial||(this._debugMaterial=new ai.StandardMaterial("",e),this._debugMaterial.wireframe=!0),this._debugMaterial},e.prototype._getDebugBoxMesh=function(e){return this._debugBoxMesh||(this._debugBoxMesh=ai.MeshBuilder.CreateBox("physicsBodyBoxViewMesh",{size:1},e),this._debugBoxMesh.renderingGroupId=1,this._debugBoxMesh.rotationQuaternion=ai.Quaternion.Identity(),this._debugBoxMesh.material=this._getDebugMaterial(e),e.removeMesh(this._debugBoxMesh)),this._debugBoxMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugSphereMesh=function(e){return this._debugSphereMesh||(this._debugSphereMesh=ai.MeshBuilder.CreateSphere("physicsBodySphereViewMesh",{diameter:1},e),this._debugSphereMesh.renderingGroupId=1,this._debugSphereMesh.rotationQuaternion=ai.Quaternion.Identity(),this._debugSphereMesh.material=this._getDebugMaterial(e),e.removeMesh(this._debugSphereMesh)),this._debugSphereMesh.createInstance("physicsBodyBoxViewInstance")},e.prototype._getDebugMesh=function(e,t){var i=null;if(e.type==ai.PhysicsImpostor.BoxImpostor)i=this._getDebugBoxMesh(t),e.getBoxSizeToRef(i.scaling);else if(e.type==ai.PhysicsImpostor.SphereImpostor){i=this._getDebugSphereMesh(t);var r=e.getRadius();i.scaling.x=2*r,i.scaling.y=2*r,i.scaling.z=2*r}return i},e.prototype.dispose=function(){for(var e=0;e<this._numMeshes;e++)this.hideImpostor(this._impostors[e]);this._debugBoxMesh&&this._debugBoxMesh.dispose(),this._debugSphereMesh&&this._debugSphereMesh.dispose(),this._debugMaterial&&this._debugMaterial.dispose(),this._impostors.length=0,this._scene=null,this._physicsEnginePlugin=null},e})(),li.PhysicsViewer=ci,(function(l){Object.defineProperty(l.Scene.prototype,"forceShowBoundingBoxes",{get:function(){return this._forceShowBoundingBoxes||!1},set:function(e){(this._forceShowBoundingBoxes=e)&&this.getBoundingBoxRenderer()},enumerable:!0,configurable:!0}),l.Scene.prototype.getBoundingBoxRenderer=function(){return this._boundingBoxRenderer||(this._boundingBoxRenderer=new e(this)),this._boundingBoxRenderer},Object.defineProperty(l.AbstractMesh.prototype,"showBoundingBox",{get:function(){return this._showBoundingBox||!1},set:function(e){(this._showBoundingBox=e)&&this.getScene().getBoundingBoxRenderer()},enumerable:!0,configurable:!0});var e=(function(){function e(e){this.name=l.SceneComponentConstants.NAME_BOUNDINGBOXRENDERER,this.frontColor=new l.Color3(1,1,1),this.backColor=new l.Color3(.1,.1,.1),this.showBackLines=!0,this.renderList=new l.SmartArray(32),this._vertexBuffers={},(this.scene=e)._addComponent(this)}return e.prototype.register=function(){this.scene._beforeEvaluateActiveMeshStage.registerStep(l.SceneComponentConstants.STEP_BEFOREEVALUATEACTIVEMESH_BOUNDINGBOXRENDERER,this,this.reset),this.scene._activeMeshStage.registerStep(l.SceneComponentConstants.STEP_ACTIVEMESH_BOUNDINGBOXRENDERER,this,this._activeMesh),this.scene._evaluateSubMeshStage.registerStep(l.SceneComponentConstants.STEP_EVALUATESUBMESH_BOUNDINGBOXRENDERER,this,this._evaluateSubMesh),this.scene._afterRenderingGroupDrawStage.registerStep(l.SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_BOUNDINGBOXRENDERER,this,this.render)},e.prototype._evaluateSubMesh=function(e,t){if(e.showSubMeshesBoundingBox){var i=t.getBoundingInfo();null!=i&&(i.boundingBox._tag=e.renderingGroupId,this.renderList.push(i.boundingBox))}},e.prototype._activeMesh=function(e,t){if(e.showBoundingBox||this.scene.forceShowBoundingBoxes){var i=e.getBoundingInfo();i.boundingBox._tag=t.renderingGroupId,this.renderList.push(i.boundingBox)}},e.prototype._prepareRessources=function(){if(!this._colorShader){this._colorShader=new l.ShaderMaterial("colorShader",this.scene,"color",{attributes:[l.VertexBuffer.PositionKind],uniforms:["world","viewProjection","color"]});var e=this.scene.getEngine(),t=l.VertexData.CreateBox({size:1});this._vertexBuffers[l.VertexBuffer.PositionKind]=new l.VertexBuffer(e,t.positions,l.VertexBuffer.PositionKind,!1),this._createIndexBuffer()}},e.prototype._createIndexBuffer=function(){var e=this.scene.getEngine();this._indexBuffer=e.createIndexBuffer([0,1,1,2,2,3,3,0,4,5,5,6,6,7,7,4,0,7,1,6,2,5,3,4])},e.prototype.rebuild=function(){var e=this._vertexBuffers[l.VertexBuffer.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.reset=function(){this.renderList.reset()},e.prototype.render=function(e){if(0!==this.renderList.length&&(this._prepareRessources(),this._colorShader.isReady())){var t=this.scene.getEngine();t.setDepthWrite(!1),this._colorShader._preBind();for(var i=0;i<this.renderList.length;i++){var r=this.renderList.data[i];if(r._tag===e){var n=r.minimum,o=r.maximum.subtract(n),s=n.add(o.scale(.5)),a=l.Matrix.Scaling(o.x,o.y,o.z).multiply(l.Matrix.Translation(s.x,s.y,s.z)).multiply(r.getWorldMatrix());t.bindBuffers(this._vertexBuffers,this._indexBuffer,this._colorShader.getEffect()),this.showBackLines&&(t.setDepthFunctionToGreaterOrEqual(),this.scene.resetCachedMaterial(),this._colorShader.setColor4("color",this.backColor.toColor4()),this._colorShader.bind(a),t.drawElementsType(l.Material.LineListDrawMode,0,24)),t.setDepthFunctionToLess(),this.scene.resetCachedMaterial(),this._colorShader.setColor4("color",this.frontColor.toColor4()),this._colorShader.bind(a),t.drawElementsType(l.Material.LineListDrawMode,0,24)}}this._colorShader.unbind(),t.setDepthFunctionToLessOrEqual(),t.setDepthWrite(!0)}},e.prototype.renderOcclusionBoundingBox=function(e){if(this._prepareRessources(),this._colorShader.isReady()&&e._boundingInfo){var t=this.scene.getEngine();t.setDepthWrite(!1),t.setColorWrite(!1),this._colorShader._preBind();var i=e._boundingInfo.boundingBox,r=i.minimum,n=i.maximum.subtract(r),o=r.add(n.scale(.5)),s=l.Matrix.Scaling(n.x,n.y,n.z).multiply(l.Matrix.Translation(o.x,o.y,o.z)).multiply(i.getWorldMatrix());t.bindBuffers(this._vertexBuffers,this._indexBuffer,this._colorShader.getEffect()),t.setDepthFunctionToLess(),this.scene.resetCachedMaterial(),this._colorShader.bind(s),t.drawElementsType(l.Material.LineListDrawMode,0,24),this._colorShader.unbind(),t.setDepthFunctionToLessOrEqual(),t.setDepthWrite(!0),t.setColorWrite(!0)}},e.prototype.dispose=function(){if(this._colorShader){this.renderList.dispose(),this._colorShader.dispose();var e=this._vertexBuffers[l.VertexBuffer.PositionKind];e&&(e.dispose(),this._vertexBuffers[l.VertexBuffer.PositionKind]=null),this.scene.getEngine()._releaseBuffer(this._indexBuffer)}},e})();l.BoundingBoxRenderer=e})($a||($a={})),(hi=$a||($a={})).Engine.prototype.createTransformFeedback=function(){return this._gl.createTransformFeedback()},hi.Engine.prototype.deleteTransformFeedback=function(e){this._gl.deleteTransformFeedback(e)},hi.Engine.prototype.bindTransformFeedback=function(e){this._gl.bindTransformFeedback(this._gl.TRANSFORM_FEEDBACK,e)},hi.Engine.prototype.beginTransformFeedback=function(e){void 0===e&&(e=!0),this._gl.beginTransformFeedback(e?this._gl.POINTS:this._gl.TRIANGLES)},hi.Engine.prototype.endTransformFeedback=function(){this._gl.endTransformFeedback()},hi.Engine.prototype.setTranformFeedbackVaryings=function(e,t){this._gl.transformFeedbackVaryings(e,t,this._gl.INTERLEAVED_ATTRIBS)},hi.Engine.prototype.bindTransformFeedbackBuffer=function(e){this._gl.bindBufferBase(this._gl.TRANSFORM_FEEDBACK_BUFFER,0,e)},ui=$a||($a={}),di=(function(h){function o(e,t,i,r){void 0===r&&(r=!1);var n=h.call(this,e)||this;n.layerMask=268435455,n._accumulatedCount=0,n._targetIndex=0,n._currentRenderId=-1,n._started=!1,n._stopped=!1,n._timeDelta=0,n._attributesStrideSize=21,n._actualFrame=0,n._rawTextureWidth=256,n.onDisposeObservable=new ui.Observable,n.forceDepthWrite=!1,n._preWarmDone=!1,n._scene=i||ui.Engine.LastCreatedScene,n._attachImageProcessingConfiguration(null),n._engine=n._scene.getEngine(),t.randomTextureSize||delete t.randomTextureSize;var o=ae({capacity:5e4,randomTextureSize:n._engine.getCaps().maxTextureSize},t),s=t;isFinite(s)&&(o.capacity=s),n._capacity=o.capacity,n._activeCount=o.capacity,n._currentActiveCount=0,n._isAnimationSheetEnabled=r,n._scene.particleSystems.push(n),n._updateEffectOptions={attributes:["position","age","life","seed","size","color","direction","initialDirection","angle","cellIndex","cellStartOffset","noiseCoordinates1","noiseCoordinates2"],uniformsNames:["currentCount","timeDelta","emitterWM","lifeTime","color1","color2","sizeRange","scaleRange","gravity","emitPower","direction1","direction2","minEmitBox","maxEmitBox","radius","directionRandomizer","height","coneAngle","stopFactor","angleRange","radiusRange","cellInfos","noiseStrength","limitVelocityDamping"],uniformBuffersNames:[],samplers:["randomSampler","randomSampler2","sizeGradientSampler","angularSpeedGradientSampler","velocityGradientSampler","limitVelocityGradientSampler","noiseSampler","dragGradientSampler"],defines:"",fallbacks:null,onCompiled:null,onError:null,indexParameters:null,maxSimultaneousLights:0,transformFeedbackVaryings:[]},n.particleEmitterType=new ui.BoxParticleEmitter;for(var a=Math.min(n._engine.getCaps().maxTextureSize,o.randomTextureSize),l=[],c=0;c<a;++c)l.push(Math.random()),l.push(Math.random()),l.push(Math.random()),l.push(Math.random());n._randomTexture=new ui.RawTexture(new Float32Array(l),a,1,ui.Engine.TEXTUREFORMAT_RGBA,n._scene,!1,!1,ui.Texture.NEAREST_SAMPLINGMODE,ui.Engine.TEXTURETYPE_FLOAT),n._randomTexture.wrapU=ui.Texture.WRAP_ADDRESSMODE,n._randomTexture.wrapV=ui.Texture.WRAP_ADDRESSMODE,l=[];for(c=0;c<a;++c)l.push(Math.random()),l.push(Math.random()),l.push(Math.random()),l.push(Math.random());return n._randomTexture2=new ui.RawTexture(new Float32Array(l),a,1,ui.Engine.TEXTUREFORMAT_RGBA,n._scene,!1,!1,ui.Texture.NEAREST_SAMPLINGMODE,ui.Engine.TEXTURETYPE_FLOAT),n._randomTexture2.wrapU=ui.Texture.WRAP_ADDRESSMODE,n._randomTexture2.wrapV=ui.Texture.WRAP_ADDRESSMODE,n._randomTextureSize=a,n}return T(o,h),Object.defineProperty(o,"IsSupported",{get:function(){return!!ui.Engine.LastCreatedEngine&&1<ui.Engine.LastCreatedEngine.webGLVersion},enumerable:!0,configurable:!0}),o.prototype.getCapacity=function(){return this._capacity},Object.defineProperty(o.prototype,"activeParticleCount",{get:function(){return this._activeCount},set:function(e){this._activeCount=Math.min(e,this._capacity)},enumerable:!0,configurable:!0}),o.prototype.isReady=function(){return this._updateEffect?!!(this.emitter&&this._updateEffect.isReady()&&this._imageProcessingConfiguration.isReady()&&this._renderEffect.isReady()&&this.particleTexture&&this.particleTexture.isReady()):(this._recreateUpdateEffect(),this._recreateRenderEffect(),!1)},o.prototype.isStarted=function(){return this._started},o.prototype.start=function(e){var t=this;if(void 0===e&&(e=this.startDelay),!this.targetStopDuration&&this._hasTargetStopDurationDependantGradient())throw"Particle system started with a targetStopDuration dependant gradient (eg. startSizeGradients) but no targetStopDuration set";e?setTimeout((function(){t.start(0)}),e):(this._started=!0,this._stopped=!1,this._preWarmDone=!1,this.beginAnimationOnStart&&this.animations&&0<this.animations.length&&this.getScene().beginAnimation(this,this.beginAnimationFrom,this.beginAnimationTo,this.beginAnimationLoop))},o.prototype.stop=function(){this._stopped=!0},o.prototype.reset=function(){this._releaseBuffers(),this._releaseVAOs(),this._currentActiveCount=0,this._targetIndex=0},o.prototype.getClassName=function(){return"GPUParticleSystem"},o.prototype._removeGradientAndTexture=function(e,t,i){return h.prototype._removeGradientAndTexture.call(this,e,t,i),this._releaseBuffers(),this},o.prototype.addColorGradient=function(e,t,i){this._colorGradients||(this._colorGradients=[]);var r=new ui.ColorGradient;return r.gradient=e,r.color1=t,this._colorGradients.push(r),this._colorGradients.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._releaseBuffers(),this},o.prototype.removeColorGradient=function(e){return this._removeGradientAndTexture(e,this._colorGradients,this._colorGradientsTexture),this._colorGradientsTexture=null,this},o.prototype._addFactorGradient=function(e,t,i){var r=new ui.FactorGradient;r.gradient=t,r.factor1=i,e.push(r),e.sort((function(e,t){return e.gradient<t.gradient?-1:e.gradient>t.gradient?1:0})),this._releaseBuffers()},o.prototype.addSizeGradient=function(e,t){return this._sizeGradients||(this._sizeGradients=[]),this._addFactorGradient(this._sizeGradients,e,t),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._releaseBuffers(),this},o.prototype.removeSizeGradient=function(e){return this._removeGradientAndTexture(e,this._sizeGradients,this._sizeGradientsTexture),this._sizeGradientsTexture=null,this},o.prototype.addAngularSpeedGradient=function(e,t){return this._angularSpeedGradients||(this._angularSpeedGradients=[]),this._addFactorGradient(this._angularSpeedGradients,e,t),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._releaseBuffers(),this},o.prototype.removeAngularSpeedGradient=function(e){return this._removeGradientAndTexture(e,this._angularSpeedGradients,this._angularSpeedGradientsTexture),this._angularSpeedGradientsTexture=null,this},o.prototype.addVelocityGradient=function(e,t){return this._velocityGradients||(this._velocityGradients=[]),this._addFactorGradient(this._velocityGradients,e,t),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._releaseBuffers(),this},o.prototype.removeVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._velocityGradients,this._velocityGradientsTexture),this._velocityGradientsTexture=null,this},o.prototype.addLimitVelocityGradient=function(e,t){return this._limitVelocityGradients||(this._limitVelocityGradients=[]),this._addFactorGradient(this._limitVelocityGradients,e,t),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._releaseBuffers(),this},o.prototype.removeLimitVelocityGradient=function(e){return this._removeGradientAndTexture(e,this._limitVelocityGradients,this._limitVelocityGradientsTexture),this._limitVelocityGradientsTexture=null,this},o.prototype.addDragGradient=function(e,t){return this._dragGradients||(this._dragGradients=[]),this._addFactorGradient(this._dragGradients,e,t),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._releaseBuffers(),this},o.prototype.removeDragGradient=function(e){return this._removeGradientAndTexture(e,this._dragGradients,this._dragGradientsTexture),this._dragGradientsTexture=null,this},o.prototype.addEmitRateGradient=function(e,t,i){return this},o.prototype.removeEmitRateGradient=function(e){return this},o.prototype.addStartSizeGradient=function(e,t,i){return this},o.prototype.removeStartSizeGradient=function(e){return this},o.prototype.addColorRemapGradient=function(e,t,i){return this},o.prototype.removeColorRemapGradient=function(e){return this},o.prototype.addAlphaRemapGradient=function(e,t,i){return this},o.prototype.removeAlphaRemapGradient=function(e){return this},o.prototype.addRampGradient=function(e,t){return this},o.prototype.removeRampGradient=function(e){return this},o.prototype.getRampGradients=function(){return null},Object.defineProperty(o.prototype,"useRampGradients",{get:function(){return!1},set:function(e){},enumerable:!0,configurable:!0}),o.prototype.addLifeTimeGradient=function(e,t,i){return this},o.prototype.removeLifeTimeGradient=function(e){return this},o.prototype._reset=function(){this._releaseBuffers()},o.prototype._createUpdateVAO=function(e){var t={};t.position=e.createVertexBuffer("position",0,3),t.age=e.createVertexBuffer("age",3,1),t.life=e.createVertexBuffer("life",4,1),t.seed=e.createVertexBuffer("seed",5,4),t.size=e.createVertexBuffer("size",9,3);var i=12;this._colorGradientsTexture||(t.color=e.createVertexBuffer("color",i,4),i+=4),t.direction=e.createVertexBuffer("direction",i,3),i+=3,this._isBillboardBased||(t.initialDirection=e.createVertexBuffer("initialDirection",i,3),i+=3),this._angularSpeedGradientsTexture?(t.angle=e.createVertexBuffer("angle",i,1),i+=1):(t.angle=e.createVertexBuffer("angle",i,2),i+=2),this._isAnimationSheetEnabled&&(t.cellIndex=e.createVertexBuffer("cellIndex",i,1),i+=1,this.spriteRandomStartCell&&(t.cellStartOffset=e.createVertexBuffer("cellStartOffset",i,1),i+=1)),this.noiseTexture&&(t.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",i,3),i+=3,t.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",i,3),i+=3);var r=this._engine.recordVertexArrayObject(t,null,this._updateEffect);return this._engine.bindArrayBuffer(null),r},o.prototype._createRenderVAO=function(e,t){var i={};i.position=e.createVertexBuffer("position",0,3,this._attributesStrideSize,!0),i.age=e.createVertexBuffer("age",3,1,this._attributesStrideSize,!0),i.life=e.createVertexBuffer("life",4,1,this._attributesStrideSize,!0),i.size=e.createVertexBuffer("size",9,3,this._attributesStrideSize,!0);var r=12;this._colorGradientsTexture||(i.color=e.createVertexBuffer("color",r,4,this._attributesStrideSize,!0),r+=4),this.billboardMode===ui.ParticleSystem.BILLBOARDMODE_STRETCHED&&(i.direction=e.createVertexBuffer("direction",r,3,this._attributesStrideSize,!0)),r+=3,this._isBillboardBased||(i.initialDirection=e.createVertexBuffer("initialDirection",r,3,this._attributesStrideSize,!0),r+=3),i.angle=e.createVertexBuffer("angle",r,1,this._attributesStrideSize,!0),this._angularSpeedGradientsTexture?r++:r+=2,this._isAnimationSheetEnabled&&(i.cellIndex=e.createVertexBuffer("cellIndex",r,1,this._attributesStrideSize,!0),r+=1,this.spriteRandomStartCell&&(i.cellStartOffset=e.createVertexBuffer("cellStartOffset",r,1,this._attributesStrideSize,!0),r+=1)),this.noiseTexture&&(i.noiseCoordinates1=e.createVertexBuffer("noiseCoordinates1",r,3,this._attributesStrideSize,!0),r+=3,i.noiseCoordinates2=e.createVertexBuffer("noiseCoordinates2",r,3,this._attributesStrideSize,!0),r+=3),i.offset=t.createVertexBuffer("offset",0,2),i.uv=t.createVertexBuffer("uv",2,2);var n=this._engine.recordVertexArrayObject(i,null,this._renderEffect);return this._engine.bindArrayBuffer(null),n},o.prototype._initialize=function(e){if(void 0===e&&(e=!1),!this._buffer0||e){var t=this._scene.getEngine(),i=new Array;this.isBillboardBased||(this._attributesStrideSize+=3),this._colorGradientsTexture&&(this._attributesStrideSize-=4),this._angularSpeedGradientsTexture&&(this._attributesStrideSize-=1),this._isAnimationSheetEnabled&&(this._attributesStrideSize+=1,this.spriteRandomStartCell&&(this._attributesStrideSize+=1)),this.noiseTexture&&(this._attributesStrideSize+=6);for(var r=0;r<this._capacity;r++)i.push(0),i.push(0),i.push(0),i.push(0),i.push(0),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(0),i.push(0),i.push(0),this._colorGradientsTexture||(i.push(0),i.push(0),i.push(0),i.push(0)),i.push(0),i.push(0),i.push(0),this.isBillboardBased||(i.push(0),i.push(0),i.push(0)),i.push(0),this._angularSpeedGradientsTexture||i.push(0),this._isAnimationSheetEnabled&&(i.push(0),this.spriteRandomStartCell&&i.push(0)),this.noiseTexture&&(i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()),i.push(Math.random()));var n=new Float32Array([.5,.5,1,1,-.5,.5,0,1,-.5,-.5,0,0,.5,-.5,1,0]);this._buffer0=new ui.Buffer(t,i,!1,this._attributesStrideSize),this._buffer1=new ui.Buffer(t,i,!1,this._attributesStrideSize),this._spriteBuffer=new ui.Buffer(t,n,!1,4),this._updateVAO=[],this._updateVAO.push(this._createUpdateVAO(this._buffer0)),this._updateVAO.push(this._createUpdateVAO(this._buffer1)),this._renderVAO=[],this._renderVAO.push(this._createRenderVAO(this._buffer1,this._spriteBuffer)),this._renderVAO.push(this._createRenderVAO(this._buffer0,this._spriteBuffer)),this._sourceBuffer=this._buffer0,this._targetBuffer=this._buffer1}},o.prototype._recreateUpdateEffect=function(){var e=this.particleEmitterType?this.particleEmitterType.getEffectDefines():"";this._isBillboardBased&&(e+="\n#define BILLBOARD"),this._colorGradientsTexture&&(e+="\n#define COLORGRADIENTS"),this._sizeGradientsTexture&&(e+="\n#define SIZEGRADIENTS"),this._angularSpeedGradientsTexture&&(e+="\n#define ANGULARSPEEDGRADIENTS"),this._velocityGradientsTexture&&(e+="\n#define VELOCITYGRADIENTS"),this._limitVelocityGradientsTexture&&(e+="\n#define LIMITVELOCITYGRADIENTS"),this._dragGradientsTexture&&(e+="\n#define DRAGGRADIENTS"),this.isAnimationSheetEnabled&&(e+="\n#define ANIMATESHEET",this.spriteRandomStartCell&&(e+="\n#define ANIMATESHEETRANDOMSTART")),this.noiseTexture&&(e+="\n#define NOISE"),this._updateEffect&&this._updateEffectOptions.defines===e||(this._updateEffectOptions.transformFeedbackVaryings=["outPosition","outAge","outLife","outSeed","outSize"],this._colorGradientsTexture||this._updateEffectOptions.transformFeedbackVaryings.push("outColor"),this._updateEffectOptions.transformFeedbackVaryings.push("outDirection"),this._isBillboardBased||this._updateEffectOptions.transformFeedbackVaryings.push("outInitialDirection"),this._updateEffectOptions.transformFeedbackVaryings.push("outAngle"),this.isAnimationSheetEnabled&&(this._updateEffectOptions.transformFeedbackVaryings.push("outCellIndex"),this.spriteRandomStartCell&&this._updateEffectOptions.transformFeedbackVaryings.push("outCellStartOffset")),this.noiseTexture&&(this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates1"),this._updateEffectOptions.transformFeedbackVaryings.push("outNoiseCoordinates2")),this._updateEffectOptions.defines=e,this._updateEffect=new ui.Effect("gpuUpdateParticles",this._updateEffectOptions,this._scene.getEngine()))},o.prototype._recreateRenderEffect=function(){var e="";if(this._scene.clipPlane&&(e="\n#define CLIPPLANE"),this._scene.clipPlane2&&(e="\n#define CLIPPLANE2"),this._scene.clipPlane3&&(e="\n#define CLIPPLANE3"),this._scene.clipPlane4&&(e="\n#define CLIPPLANE4"),this.blendMode===ui.ParticleSystem.BLENDMODE_MULTIPLY&&(e="\n#define BLENDMULTIPLYMODE"),this._isBillboardBased)switch(e+="\n#define BILLBOARD",this.billboardMode){case ui.ParticleSystem.BILLBOARDMODE_Y:e+="\n#define BILLBOARDY";break;case ui.ParticleSystem.BILLBOARDMODE_STRETCHED:e+="\n#define BILLBOARDSTRETCHED";break;case ui.ParticleSystem.BILLBOARDMODE_ALL:}if(this._colorGradientsTexture&&(e+="\n#define COLORGRADIENTS"),this.isAnimationSheetEnabled&&(e+="\n#define ANIMATESHEET"),this._imageProcessingConfiguration&&(this._imageProcessingConfiguration.prepareDefines(this._imageProcessingConfigurationDefines),e+="\n"+this._imageProcessingConfigurationDefines.toString()),!this._renderEffect||this._renderEffect.defines!==e){var t=["view","projection","colorDead","invView","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","sheetInfos","translationPivot","eyePosition"],i=["textureSampler","colorGradientSampler"];ui.ImageProcessingConfiguration&&(ui.ImageProcessingConfiguration.PrepareUniforms(t,this._imageProcessingConfigurationDefines),ui.ImageProcessingConfiguration.PrepareSamplers(i,this._imageProcessingConfigurationDefines)),this._renderEffect=new ui.Effect("gpuRenderParticles",["position","age","life","size","color","offset","uv","direction","initialDirection","angle","cellIndex"],t,i,this._scene.getEngine(),e)}},o.prototype.animate=function(e){void 0===e&&(e=!1),this._timeDelta=this.updateSpeed*(e?this.preWarmStepOffset:this._scene.getAnimationRatio()),this._actualFrame+=this._timeDelta,this._stopped||this.targetStopDuration&&this._actualFrame>=this.targetStopDuration&&this.stop()},o.prototype._createFactorGradientTexture=function(e,t){var i=this[t];if(e&&e.length&&!i){for(var r=new Float32Array(this._rawTextureWidth),n=0;n<this._rawTextureWidth;n++){var o=n/this._rawTextureWidth;ui.Tools.GetCurrentGradient(o,e,(function(e,t,i){r[n]=ui.Scalar.Lerp(e.factor1,t.factor1,i)}))}this[t]=ui.RawTexture.CreateRTexture(r,this._rawTextureWidth,1,this._scene,!1,!1,ui.Texture.NEAREST_SAMPLINGMODE)}},o.prototype._createSizeGradientTexture=function(){this._createFactorGradientTexture(this._sizeGradients,"_sizeGradientsTexture")},o.prototype._createAngularSpeedGradientTexture=function(){this._createFactorGradientTexture(this._angularSpeedGradients,"_angularSpeedGradientsTexture")},o.prototype._createVelocityGradientTexture=function(){this._createFactorGradientTexture(this._velocityGradients,"_velocityGradientsTexture")},o.prototype._createLimitVelocityGradientTexture=function(){this._createFactorGradientTexture(this._limitVelocityGradients,"_limitVelocityGradientsTexture")},o.prototype._createDragGradientTexture=function(){this._createFactorGradientTexture(this._dragGradients,"_dragGradientsTexture")},o.prototype._createColorGradientTexture=function(){if(this._colorGradients&&this._colorGradients.length&&!this._colorGradientsTexture){for(var r=new Uint8Array(4*this._rawTextureWidth),n=ui.Tmp.Color4[0],o=0;o<this._rawTextureWidth;o++){var e=o/this._rawTextureWidth;ui.Tools.GetCurrentGradient(e,this._colorGradients,(function(e,t,i){ui.Color4.LerpToRef(e.color1,t.color1,i,n),r[4*o]=255*n.r,r[4*o+1]=255*n.g,r[4*o+2]=255*n.b,r[4*o+3]=255*n.a}))}this._colorGradientsTexture=ui.RawTexture.CreateRGBATexture(r,this._rawTextureWidth,1,this._scene,!1,!1,ui.Texture.NEAREST_SAMPLINGMODE)}},o.prototype.render=function(e){if(void 0===e&&(e=!1),!this._started)return 0;if(this._createColorGradientTexture(),this._createSizeGradientTexture(),this._createAngularSpeedGradientTexture(),this._createVelocityGradientTexture(),this._createLimitVelocityGradientTexture(),this._createDragGradientTexture(),this._recreateUpdateEffect(),this._recreateRenderEffect(),!this.isReady())return 0;if(!e){if(!this._preWarmDone&&this.preWarmCycles){for(var t=0;t<this.preWarmCycles;t++)this.animate(!0),this.render(!0);this._preWarmDone=!0}if(this._currentRenderId===this._scene.getRenderId())return 0;this._currentRenderId=this._scene.getRenderId()}if(this._initialize(),this._accumulatedCount+=this.emitRate*this._timeDelta,1<this._accumulatedCount){var i=0|this._accumulatedCount;this._accumulatedCount-=i,this._currentActiveCount=Math.min(this._activeCount,this._currentActiveCount+i)}if(!this._currentActiveCount)return 0;var r;if(this._engine.enableEffect(this._updateEffect),this._engine.setState(!1),this._updateEffect.setFloat("currentCount",this._currentActiveCount),this._updateEffect.setFloat("timeDelta",this._timeDelta),this._updateEffect.setFloat("stopFactor",this._stopped?0:1),this._updateEffect.setTexture("randomSampler",this._randomTexture),this._updateEffect.setTexture("randomSampler2",this._randomTexture2),this._updateEffect.setFloat2("lifeTime",this.minLifeTime,this.maxLifeTime),this._updateEffect.setFloat2("emitPower",this.minEmitPower,this.maxEmitPower),this._colorGradientsTexture||(this._updateEffect.setDirectColor4("color1",this.color1),this._updateEffect.setDirectColor4("color2",this.color2)),this._updateEffect.setFloat2("sizeRange",this.minSize,this.maxSize),this._updateEffect.setFloat4("scaleRange",this.minScaleX,this.maxScaleX,this.minScaleY,this.maxScaleY),this._updateEffect.setFloat4("angleRange",this.minAngularSpeed,this.maxAngularSpeed,this.minInitialRotation,this.maxInitialRotation),this._updateEffect.setVector3("gravity",this.gravity),this._sizeGradientsTexture&&this._updateEffect.setTexture("sizeGradientSampler",this._sizeGradientsTexture),this._angularSpeedGradientsTexture&&this._updateEffect.setTexture("angularSpeedGradientSampler",this._angularSpeedGradientsTexture),this._velocityGradientsTexture&&this._updateEffect.setTexture("velocityGradientSampler",this._velocityGradientsTexture),this._limitVelocityGradientsTexture&&(this._updateEffect.setTexture("limitVelocityGradientSampler",this._limitVelocityGradientsTexture),this._updateEffect.setFloat("limitVelocityDamping",this.limitVelocityDamping)),this._dragGradientsTexture&&this._updateEffect.setTexture("dragGradientSampler",this._dragGradientsTexture),this.particleEmitterType&&this.particleEmitterType.applyToShader(this._updateEffect),this._isAnimationSheetEnabled&&this._updateEffect.setFloat3("cellInfos",this.startSpriteCellID,this.endSpriteCellID,this.spriteCellChangeSpeed),this.noiseTexture&&(this._updateEffect.setTexture("noiseSampler",this.noiseTexture),this._updateEffect.setVector3("noiseStrength",this.noiseStrength)),this.emitter.position){r=this.emitter.getWorldMatrix()}else{var n=this.emitter;r=ui.Matrix.Translation(n.x,n.y,n.z)}if(this._updateEffect.setMatrix("emitterWM",r),this._engine.bindVertexArrayObject(this._updateVAO[this._targetIndex],null),this._engine.bindTransformFeedbackBuffer(this._targetBuffer.getBuffer()),this._engine.setRasterizerState(!1),this._engine.beginTransformFeedback(!0),this._engine.drawArraysType(ui.Material.PointListDrawMode,0,this._currentActiveCount),this._engine.endTransformFeedback(),this._engine.setRasterizerState(!0),this._engine.bindTransformFeedbackBuffer(null),!e){this._engine.enableEffect(this._renderEffect);var o=this._scene.getViewMatrix();if(this._renderEffect.setMatrix("view",o),this._renderEffect.setMatrix("projection",this._scene.getProjectionMatrix()),this._renderEffect.setTexture("textureSampler",this.particleTexture),this._renderEffect.setVector2("translationPivot",this.translationPivot),this._colorGradientsTexture?this._renderEffect.setTexture("colorGradientSampler",this._colorGradientsTexture):this._renderEffect.setDirectColor4("colorDead",this.colorDead),this._isAnimationSheetEnabled&&this.particleTexture){var s=this.particleTexture.getBaseSize();this._renderEffect.setFloat3("sheetInfos",this.spriteCellWidth/s.width,this.spriteCellHeight/s.height,s.width/this.spriteCellWidth)}if(this._isBillboardBased){var a=this._scene.activeCamera;this._renderEffect.setVector3("eyePosition",a.globalPosition)}if(this._scene.clipPlane||this._scene.clipPlane2||this._scene.clipPlane3||this._scene.clipPlane4){var l=o.clone();l.invert(),this._renderEffect.setMatrix("invView",l),ui.MaterialHelper.BindClipPlane(this._renderEffect,this._scene)}switch(this._imageProcessingConfiguration&&!this._imageProcessingConfiguration.applyByPostProcess&&this._imageProcessingConfiguration.bind(this._renderEffect),this.blendMode){case ui.ParticleSystem.BLENDMODE_ADD:this._engine.setAlphaMode(ui.Engine.ALPHA_ADD);break;case ui.ParticleSystem.BLENDMODE_ONEONE:this._engine.setAlphaMode(ui.Engine.ALPHA_ONEONE);break;case ui.ParticleSystem.BLENDMODE_STANDARD:this._engine.setAlphaMode(ui.Engine.ALPHA_COMBINE);break;case ui.ParticleSystem.BLENDMODE_MULTIPLY:this._engine.setAlphaMode(ui.Engine.ALPHA_MULTIPLY)}this.forceDepthWrite&&this._engine.setDepthWrite(!0),this._engine.bindVertexArrayObject(this._renderVAO[this._targetIndex],null),this._engine.drawArraysType(ui.Material.TriangleFanDrawMode,0,4,this._currentActiveCount),this._engine.setAlphaMode(ui.Engine.ALPHA_DISABLE)}this._targetIndex++,2===this._targetIndex&&(this._targetIndex=0);var c=this._sourceBuffer;return this._sourceBuffer=this._targetBuffer,this._targetBuffer=c,this._currentActiveCount},o.prototype.rebuild=function(){this._initialize(!0)},o.prototype._releaseBuffers=function(){this._buffer0&&(this._buffer0.dispose(),this._buffer0=null),this._buffer1&&(this._buffer1.dispose(),this._buffer1=null),this._spriteBuffer&&(this._spriteBuffer.dispose(),this._spriteBuffer=null)},o.prototype._releaseVAOs=function(){if(this._updateVAO){for(var e=0;e<this._updateVAO.length;e++)this._engine.releaseVertexArrayObject(this._updateVAO[e]);this._updateVAO=[];for(e=0;e<this._renderVAO.length;e++)this._engine.releaseVertexArrayObject(this._renderVAO[e]);this._renderVAO=[]}},o.prototype.dispose=function(e){void 0===e&&(e=!0);var t=this._scene.particleSystems.indexOf(this);-1<t&&this._scene.particleSystems.splice(t,1),this._releaseBuffers(),this._releaseVAOs(),this._colorGradientsTexture&&(this._colorGradientsTexture.dispose(),this._colorGradientsTexture=null),this._sizeGradientsTexture&&(this._sizeGradientsTexture.dispose(),this._sizeGradientsTexture=null),this._angularSpeedGradientsTexture&&(this._angularSpeedGradientsTexture.dispose(),this._angularSpeedGradientsTexture=null),this._velocityGradientsTexture&&(this._velocityGradientsTexture.dispose(),this._velocityGradientsTexture=null),this._limitVelocityGradientsTexture&&(this._limitVelocityGradientsTexture.dispose(),this._limitVelocityGradientsTexture=null),this._dragGradientsTexture&&(this._dragGradientsTexture.dispose(),this._dragGradientsTexture=null),this._randomTexture&&(this._randomTexture.dispose(),this._randomTexture=null),this._randomTexture2&&(this._randomTexture2.dispose(),this._randomTexture2=null),e&&this.particleTexture&&(this.particleTexture.dispose(),this.particleTexture=null),e&&this.noiseTexture&&(this.noiseTexture.dispose(),this.noiseTexture=null),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear()},o.prototype.clone=function(e,t){var i=new o(e,{capacity:this._capacity,randomTextureSize:this._randomTextureSize},this._scene);return ui.Tools.DeepCopy(this,i),void 0===t&&(t=this.emitter),i.emitter=t,this.particleTexture&&(i.particleTexture=new ui.Texture(this.particleTexture.url,this._scene)),i},o.prototype.serialize=function(){var e={};return ui.ParticleSystem._Serialize(e,this),e.activeParticleCount=this.activeParticleCount,e},o.Parse=function(e,t,i,r){void 0===r&&(r=!1);var n=new o(e.name,{capacity:e.capacity,randomTextureSize:e.randomTextureSize},t);return e.activeParticleCount&&(n.activeParticleCount=e.activeParticleCount),ui.ParticleSystem._Parse(e,n,t,i),e.preventAutoStart&&(n.preventAutoStart=e.preventAutoStart),r||n.preventAutoStart||n.start(),n},o})(ui.BaseParticleSystem),ui.GPUParticleSystem=di,(function(l){var e=(function(){function e(e,t,i,r,n,o,s,a){void 0===a&&(a=null),this.idx=0,this.color=new l.Color4(1,1,1,1),this.position=l.Vector3.Zero(),this.rotation=l.Vector3.Zero(),this.scaling=l.Vector3.One(),this.uvs=new l.Vector4(0,0,1,1),this.velocity=l.Vector3.Zero(),this.pivot=l.Vector3.Zero(),this.translateFromPivot=!1,this.alive=!0,this.isVisible=!0,this._pos=0,this._ind=0,this.shapeId=0,this.idxInShape=0,this._stillInvisible=!1,this._rotationMatrix=[1,0,0,0,1,0,0,0,1],this.parentId=null,this._globalPosition=l.Vector3.Zero(),this.idx=e,this._pos=t,this._ind=i,this._model=r,this.shapeId=n,this.idxInShape=o,this._sps=s,a&&(this._modelBoundingInfo=a,this._boundingInfo=new l.BoundingInfo(a.minimum,a.maximum))}return Object.defineProperty(e.prototype,"scale",{get:function(){return this.scaling},set:function(e){this.scaling=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"quaternion",{get:function(){return this.rotationQuaternion},set:function(e){this.rotationQuaternion=e},enumerable:!0,configurable:!0}),e.prototype.intersectsMesh=function(e){return!(!this._boundingInfo||!e._boundingInfo)&&(this._sps._bSphereOnly?l.BoundingSphere.Intersects(this._boundingInfo.boundingSphere,e._boundingInfo.boundingSphere):this._boundingInfo.intersects(e._boundingInfo,!1))},e})();l.SolidParticle=e;var t=function(e,t,i,r,n,o){this._indicesLength=0,this.shapeID=e,this._shape=t,this._indicesLength=i,this._shapeUV=r,this._positionFunction=n,this._vertexFunction=o};l.ModelShape=t;var i=function(){this.ind=0,this.indicesLength=0,this.sqDistance=0};l.DepthSortedParticle=i})($a||($a={})),fi=$a||($a={}),pi=(function(){function e(e,t,i){this.particles=new Array,this.nbParticles=0,this.billboard=!1,this.recomputeNormals=!0,this.counter=0,this.vars={},this._bSphereOnly=!1,this._bSphereRadiusFactor=1,this._positions=new Array,this._indices=new Array,this._normals=new Array,this._colors=new Array,this._uvs=new Array,this._index=0,this._updatable=!0,this._pickable=!1,this._isVisibilityBoxLocked=!1,this._alwaysVisible=!1,this._depthSort=!1,this._shapeCounter=0,this._copy=new fi.SolidParticle(0,0,0,null,0,0,this),this._color=new fi.Color4(0,0,0,0),this._computeParticleColor=!0,this._computeParticleTexture=!0,this._computeParticleRotation=!0,this._computeParticleVertex=!1,this._computeBoundingBox=!1,this._depthSortParticles=!0,this._cam_axisZ=fi.Vector3.Zero(),this._cam_axisY=fi.Vector3.Zero(),this._cam_axisX=fi.Vector3.Zero(),this._axisZ=fi.Axis.Z,this._camDir=fi.Vector3.Zero(),this._camInvertedPosition=fi.Vector3.Zero(),this._rotMatrix=new fi.Matrix,this._invertMatrix=new fi.Matrix,this._rotated=fi.Vector3.Zero(),this._quaternion=new fi.Quaternion,this._vertex=fi.Vector3.Zero(),this._normal=fi.Vector3.Zero(),this._yaw=0,this._pitch=0,this._roll=0,this._halfroll=0,this._halfpitch=0,this._halfyaw=0,this._sinRoll=0,this._cosRoll=0,this._sinPitch=0,this._cosPitch=0,this._sinYaw=0,this._cosYaw=0,this._mustUnrotateFixedNormals=!1,this._minimum=fi.Vector3.Zero(),this._maximum=fi.Vector3.Zero(),this._minBbox=fi.Vector3.Zero(),this._maxBbox=fi.Vector3.Zero(),this._particlesIntersect=!1,this._depthSortFunction=function(e,t){return t.sqDistance-e.sqDistance},this._needs32Bits=!1,this._pivotBackTranslation=fi.Vector3.Zero(),this._scaledPivot=fi.Vector3.Zero(),this._particleHasParent=!1,this.name=e,this._scene=t||fi.Engine.LastCreatedScene,this._camera=t.activeCamera,this._pickable=!!i&&i.isPickable,this._depthSort=!!i&&i.enableDepthSort,this._particlesIntersect=!!i&&i.particleIntersection,this._bSphereOnly=!!i&&i.boundingSphereOnly,this._bSphereRadiusFactor=i&&i.bSphereRadiusFactor?i.bSphereRadiusFactor:1,i&&void 0!==i.updatable?this._updatable=i.updatable:this._updatable=!0,this._pickable&&(this.pickedParticles=[]),this._depthSort&&(this.depthSortedParticles=[])}return e.prototype.buildMesh=function(){if(0===this.nbParticles){var e=fi.MeshBuilder.CreateDisc("",{radius:1,tessellation:3},this._scene);this.addShape(e,1),e.dispose()}this._indices32=this._needs32Bits?new Uint32Array(this._indices):new Uint16Array(this._indices),this._positions32=new Float32Array(this._positions),this._uvs32=new Float32Array(this._uvs),this._colors32=new Float32Array(this._colors),this.recomputeNormals&&fi.VertexData.ComputeNormals(this._positions32,this._indices32,this._normals),this._normals32=new Float32Array(this._normals),this._fixedNormal32=new Float32Array(this._normals),this._mustUnrotateFixedNormals&&this._unrotateFixedNormals();var t=new fi.VertexData;t.indices=this._depthSort?this._indices:this._indices32,t.set(this._positions32,fi.VertexBuffer.PositionKind),t.set(this._normals32,fi.VertexBuffer.NormalKind),0<this._uvs32.length&&t.set(this._uvs32,fi.VertexBuffer.UVKind),0<this._colors32.length&&t.set(this._colors32,fi.VertexBuffer.ColorKind);var i=new fi.Mesh(this.name,this._scene);return t.applyToMesh(i,this._updatable),this.mesh=i,this.mesh.isPickable=this._pickable,this._depthSort||(this._indices=null),this._positions=null,this._normals=null,this._uvs=null,this._colors=null,this._updatable||(this.particles.length=0),i},e.prototype.digest=function(e,t){var i=t&&t.facetNb||1,r=t&&t.number||0,n=t&&t.delta||0,o=e.getVerticesData(fi.VertexBuffer.PositionKind),s=e.getIndices(),a=e.getVerticesData(fi.VertexBuffer.UVKind),l=e.getVerticesData(fi.VertexBuffer.ColorKind),c=e.getVerticesData(fi.VertexBuffer.NormalKind),h=0,u=s.length/3;r?(r=u<r?u:r,i=Math.round(u/r),n=0):i=u<i?u:i;for(var d=[],f=[],p=[],_=[],m=fi.Vector3.Zero(),g=i;h<u;){u-(i=g+Math.floor((1+n)*Math.random()))<h&&(i=u-h),d.length=0,f.length=0,p.length=0;for(var v=_.length=0,y=3*h;y<3*(h+i);y++){f.push(v);var b=s[y];d.push(o[3*b],o[3*b+1],o[3*b+2]),a&&p.push(a[2*b],a[2*b+1]),l&&_.push(l[4*b],l[4*b+1],l[4*b+2],l[4*b+3]),v++}var T,E,x=this.nbParticles,P=this._posToShape(d),A=this._uvsToShapeUV(p);for(T=0;T<P.length;T++)m.addInPlace(P[T]);for(m.scaleInPlace(1/P.length),T=0;T<P.length;T++)P[T].subtractInPlace(m);this._particlesIntersect&&(E=new fi.BoundingInfo(m,m));var S=new fi.ModelShape(this._shapeCounter,P,3*i,A,null,null),M=this._positions.length,R=this._indices.length;this._meshBuilder(this._index,P,this._positions,f,this._indices,p,this._uvs,_,this._colors,c,this._normals,x,0,null),this._addParticle(x,M,R,S,this._shapeCounter,0,E),this.particles[this.nbParticles].position.addInPlace(m),this._index+=P.length,x++,this.nbParticles++,this._shapeCounter++,h+=i}return this},e.prototype._unrotateFixedNormals=function(){for(var e=0,t=0,i=0;i<this.particles.length;i++){this._particle=this.particles[i],this._shape=this._particle._model._shape,this._particle.rotationQuaternion?this._quaternion.copyFrom(this._particle.rotationQuaternion):(this._yaw=this._particle.rotation.y,this._pitch=this._particle.rotation.x,this._roll=this._particle.rotation.z,this._quaternionRotationYPR()),this._quaternionToRotationMatrix(),this._rotMatrix.invertToRef(this._invertMatrix);for(var r=0;r<this._shape.length;r++)t=e+3*r,fi.Vector3.TransformNormalFromFloatsToRef(this._normals32[t],this._normals32[t+1],this._normals32[t+2],this._invertMatrix,this._normal),this._fixedNormal32[t]=this._normal.x,this._fixedNormal32[t+1]=this._normal.y,this._fixedNormal32[t+2]=this._normal.z;e=t+3}},e.prototype._resetCopy=function(){this._copy.position.x=0,this._copy.position.y=0,this._copy.position.z=0,this._copy.rotation.x=0,this._copy.rotation.y=0,this._copy.rotation.z=0,this._copy.rotationQuaternion=null,this._copy.scaling.x=1,this._copy.scaling.y=1,this._copy.scaling.z=1,this._copy.uvs.x=0,this._copy.uvs.y=0,this._copy.uvs.z=1,this._copy.uvs.w=1,this._copy.color=null,this._copy.translateFromPivot=!1},e.prototype._meshBuilder=function(e,t,i,r,n,o,s,a,l,c,h,u,d,f){var p,_=0,m=0,g=0;for(this._resetCopy(),f&&f.positionFunction&&(f.positionFunction(this._copy,u,d),this._mustUnrotateFixedNormals=!0),this._copy.rotationQuaternion?this._quaternion.copyFrom(this._copy.rotationQuaternion):(this._yaw=this._copy.rotation.y,this._pitch=this._copy.rotation.x,this._roll=this._copy.rotation.z,this._quaternionRotationYPR()),this._quaternionToRotationMatrix(),this._scaledPivot.x=this._copy.pivot.x*this._copy.scaling.x,this._scaledPivot.y=this._copy.pivot.y*this._copy.scaling.y,this._scaledPivot.z=this._copy.pivot.z*this._copy.scaling.z,this._copy.translateFromPivot?this._pivotBackTranslation.copyFromFloats(0,0,0):this._pivotBackTranslation.copyFrom(this._scaledPivot),p=0;p<t.length;p++)this._vertex.x=t[p].x,this._vertex.y=t[p].y,this._vertex.z=t[p].z,f&&f.vertexFunction&&f.vertexFunction(this._copy,this._vertex,p),this._vertex.x*=this._copy.scaling.x,this._vertex.y*=this._copy.scaling.y,this._vertex.z*=this._copy.scaling.z,this._vertex.x-=this._scaledPivot.x,this._vertex.y-=this._scaledPivot.y,this._vertex.z-=this._scaledPivot.z,fi.Vector3.TransformCoordinatesToRef(this._vertex,this._rotMatrix,this._rotated),this._rotated.addInPlace(this._pivotBackTranslation),i.push(this._copy.position.x+this._rotated.x,this._copy.position.y+this._rotated.y,this._copy.position.z+this._rotated.z),o&&(s.push((this._copy.uvs.z-this._copy.uvs.x)*o[_]+this._copy.uvs.x,(this._copy.uvs.w-this._copy.uvs.y)*o[_+1]+this._copy.uvs.y),_+=2),this._copy.color?this._color=this._copy.color:a&&void 0!==a[m]?(this._color.r=a[m],this._color.g=a[m+1],this._color.b=a[m+2],this._color.a=a[m+3]):(this._color.r=1,this._color.g=1,this._color.b=1,this._color.a=1),l.push(this._color.r,this._color.g,this._color.b,this._color.a),m+=4,!this.recomputeNormals&&c&&(this._normal.x=c[g],this._normal.y=c[g+1],this._normal.z=c[g+2],fi.Vector3.TransformNormalToRef(this._normal,this._rotMatrix,this._normal),h.push(this._normal.x,this._normal.y,this._normal.z),g+=3);for(p=0;p<r.length;p++){var v=e+r[p];n.push(v),65535<v&&(this._needs32Bits=!0)}if(this._pickable){var y=r.length/3;for(p=0;p<y;p++)this.pickedParticles.push({idx:u,faceId:p})}return this._depthSort&&this.depthSortedParticles.push(new fi.DepthSortedParticle),this._copy},e.prototype._posToShape=function(e){for(var t=[],i=0;i<e.length;i+=3)t.push(new fi.Vector3(e[i],e[i+1],e[i+2]));return t},e.prototype._uvsToShapeUV=function(e){var t=[];if(e)for(var i=0;i<e.length;i++)t.push(e[i]);return t},e.prototype._addParticle=function(e,t,i,r,n,o,s){void 0===s&&(s=null);var a=new fi.SolidParticle(e,t,i,r,n,o,this,s);return this.particles.push(a),a},e.prototype.addShape=function(e,t,i){var r,n=e.getVerticesData(fi.VertexBuffer.PositionKind),o=e.getIndices(),s=e.getVerticesData(fi.VertexBuffer.UVKind),a=e.getVerticesData(fi.VertexBuffer.ColorKind),l=e.getVerticesData(fi.VertexBuffer.NormalKind);this._particlesIntersect&&(r=e.getBoundingInfo());for(var c,h,u=this._posToShape(n),d=this._uvsToShapeUV(s),f=i?i.positionFunction:null,p=i?i.vertexFunction:null,_=new fi.ModelShape(this._shapeCounter,u,o.length,d,f,p),m=this.nbParticles,g=0;g<t;g++){var v=this._positions.length,y=this._indices.length;h=this._meshBuilder(this._index,u,this._positions,o,this._indices,s,this._uvs,a,this._colors,l,this._normals,m,g,i),this._updatable&&((c=this._addParticle(m,v,y,_,this._shapeCounter,g,r)).position.copyFrom(h.position),c.rotation.copyFrom(h.rotation),h.rotationQuaternion&&c.rotationQuaternion&&c.rotationQuaternion.copyFrom(h.rotationQuaternion),h.color&&c.color&&c.color.copyFrom(h.color),c.scaling.copyFrom(h.scaling),c.uvs.copyFrom(h.uvs)),this._index+=u.length,m++}return this.nbParticles+=t,this._shapeCounter++,this._shapeCounter-1},e.prototype._rebuildParticle=function(e){this._resetCopy(),e._model._positionFunction&&e._model._positionFunction(this._copy,e.idx,e.idxInShape),this._copy.rotationQuaternion?this._quaternion.copyFrom(this._copy.rotationQuaternion):(this._yaw=this._copy.rotation.y,this._pitch=this._copy.rotation.x,this._roll=this._copy.rotation.z,this._quaternionRotationYPR()),this._quaternionToRotationMatrix(),this._scaledPivot.x=this._particle.pivot.x*this._particle.scaling.x,this._scaledPivot.y=this._particle.pivot.y*this._particle.scaling.y,this._scaledPivot.z=this._particle.pivot.z*this._particle.scaling.z,this._copy.translateFromPivot?this._pivotBackTranslation.copyFromFloats(0,0,0):this._pivotBackTranslation.copyFrom(this._scaledPivot),this._shape=e._model._shape;for(var t=0;t<this._shape.length;t++)this._vertex.x=this._shape[t].x,this._vertex.y=this._shape[t].y,this._vertex.z=this._shape[t].z,e._model._vertexFunction&&e._model._vertexFunction(this._copy,this._vertex,t),this._vertex.x*=this._copy.scaling.x,this._vertex.y*=this._copy.scaling.y,this._vertex.z*=this._copy.scaling.z,this._vertex.x-=this._scaledPivot.x,this._vertex.y-=this._scaledPivot.y,this._vertex.z-=this._scaledPivot.z,fi.Vector3.TransformCoordinatesToRef(this._vertex,this._rotMatrix,this._rotated),this._rotated.addInPlace(this._pivotBackTranslation),this._positions32[e._pos+3*t]=this._copy.position.x+this._rotated.x,this._positions32[e._pos+3*t+1]=this._copy.position.y+this._rotated.y,this._positions32[e._pos+3*t+2]=this._copy.position.z+this._rotated.z;e.position.x=0,e.position.y=0,e.position.z=0,e.rotation.x=0,e.rotation.y=0,e.rotation.z=0,e.rotationQuaternion=null,e.scaling.x=1,e.scaling.y=1,e.scaling.z=1,e.uvs.x=0,e.uvs.y=0,e.uvs.z=1,e.uvs.w=1,e.pivot.x=0,e.pivot.y=0,e.pivot.z=0,e.translateFromPivot=!1,e.parentId=null},e.prototype.rebuildMesh=function(){for(var e=0;e<this.particles.length;e++)this._rebuildParticle(this.particles[e]);return this.mesh.updateVerticesData(fi.VertexBuffer.PositionKind,this._positions32,!1,!1),this},e.prototype.setParticles=function(e,t,i){if(void 0===e&&(e=0),void 0===t&&(t=this.nbParticles-1),void 0===i&&(i=!0),!this._updatable)return this;if(this.beforeUpdateParticles(e,t,i),this._cam_axisX.x=1,this._cam_axisX.y=0,this._cam_axisX.z=0,this._cam_axisY.x=0,this._cam_axisY.y=1,this._cam_axisY.z=0,this._cam_axisZ.x=0,this._cam_axisZ.y=0,this._cam_axisZ.z=1,(this.billboard||this._depthSort)&&(this.mesh.computeWorldMatrix(!0),this.mesh._worldMatrix.invertToRef(this._invertMatrix)),this.billboard){this._camera.getDirectionToRef(this._axisZ,this._camDir),fi.Vector3.TransformNormalToRef(this._camDir,this._invertMatrix,this._cam_axisZ),this._cam_axisZ.normalize();var r=this._camera.getViewMatrix(!0);fi.Vector3.TransformNormalFromFloatsToRef(r.m[1],r.m[5],r.m[9],this._invertMatrix,this._cam_axisY),fi.Vector3.CrossToRef(this._cam_axisY,this._cam_axisZ,this._cam_axisX),this._cam_axisY.normalize(),this._cam_axisX.normalize()}this._depthSort&&fi.Vector3.TransformCoordinatesToRef(this._camera.globalPosition,this._invertMatrix,this._camInvertedPosition),fi.Matrix.IdentityToRef(this._rotMatrix);var n=0,o=0,s=0,a=0,l=0,c=0,h=0;this.mesh.isFacetDataEnabled&&(this._computeBoundingBox=!0),t=t>=this.nbParticles?this.nbParticles-1:t,this._computeBoundingBox&&(0==e&&t==this.nbParticles-1?(fi.Vector3.FromFloatsToRef(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,this._minimum),fi.Vector3.FromFloatsToRef(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,this._maximum)):this.mesh._boundingInfo&&(this._minimum.copyFrom(this.mesh._boundingInfo.boundingBox.minimum),this._maximum.copyFrom(this.mesh._boundingInfo.boundingBox.maximum)));var u=(o=this.particles[e]._pos)/3|0;a=4*u,c=2*u;for(var d=e;d<=t;d++){if(this._particle=this.particles[d],this._shape=this._particle._model._shape,this._shapeUV=this._particle._model._shapeUV,this.updateParticle(this._particle),this._depthSort&&this._depthSortParticles){var f=this.depthSortedParticles[d];f.ind=this._particle._ind,f.indicesLength=this._particle._model._indicesLength,f.sqDistance=fi.Vector3.DistanceSquared(this._particle.position,this._camInvertedPosition)}if(!this._particle.alive||this._particle._stillInvisible&&!this._particle.isVisible)o+=3*(h=this._shape.length),a+=4*h,c+=2*h;else{if(this._particle.isVisible)for(this._particle._stillInvisible=!1,this._particleHasParent=null!==this._particle.parentId,this._scaledPivot.x=this._particle.pivot.x*this._particle.scaling.x,this._scaledPivot.y=this._particle.pivot.y*this._particle.scaling.y,this._scaledPivot.z=this._particle.pivot.z*this._particle.scaling.z,this.billboard&&(this._particle.rotation.x=0,this._particle.rotation.y=0),(this._computeParticleRotation||this.billboard)&&(this._particle.rotationQuaternion?this._quaternion.copyFrom(this._particle.rotationQuaternion):(this._yaw=this._particle.rotation.y,this._pitch=this._particle.rotation.x,this._roll=this._particle.rotation.z,this._quaternionRotationYPR()),this._quaternionToRotationMatrix()),this._particleHasParent?(this._parent=this.particles[this._particle.parentId],this._rotated.x=this._particle.position.x*this._parent._rotationMatrix[0]+this._particle.position.y*this._parent._rotationMatrix[3]+this._particle.position.z*this._parent._rotationMatrix[6],this._rotated.y=this._particle.position.x*this._parent._rotationMatrix[1]+this._particle.position.y*this._parent._rotationMatrix[4]+this._particle.position.z*this._parent._rotationMatrix[7],this._rotated.z=this._particle.position.x*this._parent._rotationMatrix[2]+this._particle.position.y*this._parent._rotationMatrix[5]+this._particle.position.z*this._parent._rotationMatrix[8],this._particle._globalPosition.x=this._parent._globalPosition.x+this._rotated.x,this._particle._globalPosition.y=this._parent._globalPosition.y+this._rotated.y,this._particle._globalPosition.z=this._parent._globalPosition.z+this._rotated.z,(this._computeParticleRotation||this.billboard)&&(this._particle._rotationMatrix[0]=this._rotMatrix.m[0]*this._parent._rotationMatrix[0]+this._rotMatrix.m[1]*this._parent._rotationMatrix[3]+this._rotMatrix.m[2]*this._parent._rotationMatrix[6],this._particle._rotationMatrix[1]=this._rotMatrix.m[0]*this._parent._rotationMatrix[1]+this._rotMatrix.m[1]*this._parent._rotationMatrix[4]+this._rotMatrix.m[2]*this._parent._rotationMatrix[7],this._particle._rotationMatrix[2]=this._rotMatrix.m[0]*this._parent._rotationMatrix[2]+this._rotMatrix.m[1]*this._parent._rotationMatrix[5]+this._rotMatrix.m[2]*this._parent._rotationMatrix[8],this._particle._rotationMatrix[3]=this._rotMatrix.m[4]*this._parent._rotationMatrix[0]+this._rotMatrix.m[5]*this._parent._rotationMatrix[3]+this._rotMatrix.m[6]*this._parent._rotationMatrix[6],this._particle._rotationMatrix[4]=this._rotMatrix.m[4]*this._parent._rotationMatrix[1]+this._rotMatrix.m[5]*this._parent._rotationMatrix[4]+this._rotMatrix.m[6]*this._parent._rotationMatrix[7],this._particle._rotationMatrix[5]=this._rotMatrix.m[4]*this._parent._rotationMatrix[2]+this._rotMatrix.m[5]*this._parent._rotationMatrix[5]+this._rotMatrix.m[6]*this._parent._rotationMatrix[8],this._particle._rotationMatrix[6]=this._rotMatrix.m[8]*this._parent._rotationMatrix[0]+this._rotMatrix.m[9]*this._parent._rotationMatrix[3]+this._rotMatrix.m[10]*this._parent._rotationMatrix[6],this._particle._rotationMatrix[7]=this._rotMatrix.m[8]*this._parent._rotationMatrix[1]+this._rotMatrix.m[9]*this._parent._rotationMatrix[4]+this._rotMatrix.m[10]*this._parent._rotationMatrix[7],this._particle._rotationMatrix[8]=this._rotMatrix.m[8]*this._parent._rotationMatrix[2]+this._rotMatrix.m[9]*this._parent._rotationMatrix[5]+this._rotMatrix.m[10]*this._parent._rotationMatrix[8])):(this._particle._globalPosition.x=this._particle.position.x,this._particle._globalPosition.y=this._particle.position.y,this._particle._globalPosition.z=this._particle.position.z,(this._computeParticleRotation||this.billboard)&&(this._particle._rotationMatrix[0]=this._rotMatrix.m[0],this._particle._rotationMatrix[1]=this._rotMatrix.m[1],this._particle._rotationMatrix[2]=this._rotMatrix.m[2],this._particle._rotationMatrix[3]=this._rotMatrix.m[4],this._particle._rotationMatrix[4]=this._rotMatrix.m[5],this._particle._rotationMatrix[5]=this._rotMatrix.m[6],this._particle._rotationMatrix[6]=this._rotMatrix.m[8],this._particle._rotationMatrix[7]=this._rotMatrix.m[9],this._particle._rotationMatrix[8]=this._rotMatrix.m[10])),this._particle.translateFromPivot?(this._pivotBackTranslation.x=0,this._pivotBackTranslation.y=0,this._pivotBackTranslation.z=0):(this._pivotBackTranslation.x=this._scaledPivot.x,this._pivotBackTranslation.y=this._scaledPivot.y,this._pivotBackTranslation.z=this._scaledPivot.z),h=0;h<this._shape.length;h++)n=o+3*h,s=a+4*h,l=c+2*h,this._vertex.x=this._shape[h].x,this._vertex.y=this._shape[h].y,this._vertex.z=this._shape[h].z,this._computeParticleVertex&&this.updateParticleVertex(this._particle,this._vertex,h),this._vertex.x*=this._particle.scaling.x,this._vertex.y*=this._particle.scaling.y,this._vertex.z*=this._particle.scaling.z,this._vertex.x-=this._scaledPivot.x,this._vertex.y-=this._scaledPivot.y,this._vertex.z-=this._scaledPivot.z,this._rotated.x=this._vertex.x*this._particle._rotationMatrix[0]+this._vertex.y*this._particle._rotationMatrix[3]+this._vertex.z*this._particle._rotationMatrix[6],this._rotated.y=this._vertex.x*this._particle._rotationMatrix[1]+this._vertex.y*this._particle._rotationMatrix[4]+this._vertex.z*this._particle._rotationMatrix[7],this._rotated.z=this._vertex.x*this._particle._rotationMatrix[2]+this._vertex.y*this._particle._rotationMatrix[5]+this._vertex.z*this._particle._rotationMatrix[8],this._rotated.x+=this._pivotBackTranslation.x,this._rotated.y+=this._pivotBackTranslation.y,this._rotated.z+=this._pivotBackTranslation.z,this._positions32[n]=this._particle._globalPosition.x+this._cam_axisX.x*this._rotated.x+this._cam_axisY.x*this._rotated.y+this._cam_axisZ.x*this._rotated.z,this._positions32[n+1]=this._particle._globalPosition.y+this._cam_axisX.y*this._rotated.x+this._cam_axisY.y*this._rotated.y+this._cam_axisZ.y*this._rotated.z,this._positions32[n+2]=this._particle._globalPosition.z+this._cam_axisX.z*this._rotated.x+this._cam_axisY.z*this._rotated.y+this._cam_axisZ.z*this._rotated.z,this._computeBoundingBox&&(this._positions32[n]<this._minimum.x&&(this._minimum.x=this._positions32[n]),this._positions32[n]>this._maximum.x&&(this._maximum.x=this._positions32[n]),this._positions32[n+1]<this._minimum.y&&(this._minimum.y=this._positions32[n+1]),this._positions32[n+1]>this._maximum.y&&(this._maximum.y=this._positions32[n+1]),this._positions32[n+2]<this._minimum.z&&(this._minimum.z=this._positions32[n+2]),this._positions32[n+2]>this._maximum.z&&(this._maximum.z=this._positions32[n+2])),this._computeParticleVertex||(this._normal.x=this._fixedNormal32[n],this._normal.y=this._fixedNormal32[n+1],this._normal.z=this._fixedNormal32[n+2],this._rotated.x=this._normal.x*this._particle._rotationMatrix[0]+this._normal.y*this._particle._rotationMatrix[3]+this._normal.z*this._particle._rotationMatrix[6],this._rotated.y=this._normal.x*this._particle._rotationMatrix[1]+this._normal.y*this._particle._rotationMatrix[4]+this._normal.z*this._particle._rotationMatrix[7],this._rotated.z=this._normal.x*this._particle._rotationMatrix[2]+this._normal.y*this._particle._rotationMatrix[5]+this._normal.z*this._particle._rotationMatrix[8],this._normals32[n]=this._cam_axisX.x*this._rotated.x+this._cam_axisY.x*this._rotated.y+this._cam_axisZ.x*this._rotated.z,this._normals32[n+1]=this._cam_axisX.y*this._rotated.x+this._cam_axisY.y*this._rotated.y+this._cam_axisZ.y*this._rotated.z,this._normals32[n+2]=this._cam_axisX.z*this._rotated.x+this._cam_axisY.z*this._rotated.y+this._cam_axisZ.z*this._rotated.z),this._computeParticleColor&&this._particle.color&&(this._colors32[s]=this._particle.color.r,this._colors32[s+1]=this._particle.color.g,this._colors32[s+2]=this._particle.color.b,this._colors32[s+3]=this._particle.color.a),this._computeParticleTexture&&(this._uvs32[l]=this._shapeUV[2*h]*(this._particle.uvs.z-this._particle.uvs.x)+this._particle.uvs.x,this._uvs32[l+1]=this._shapeUV[2*h+1]*(this._particle.uvs.w-this._particle.uvs.y)+this._particle.uvs.y);else for(this._particle._stillInvisible=!0,h=0;h<this._shape.length;h++)n=o+3*h,s=a+4*h,l=c+2*h,this._positions32[n]=0,this._positions32[n+1]=0,this._positions32[n+2]=0,this._normals32[n]=0,this._normals32[n+1]=0,this._normals32[n+2]=0,this._computeParticleColor&&this._particle.color&&(this._colors32[s]=this._particle.color.r,this._colors32[s+1]=this._particle.color.g,this._colors32[s+2]=this._particle.color.b,this._colors32[s+3]=this._particle.color.a),this._computeParticleTexture&&(this._uvs32[l]=this._shapeUV[2*h]*(this._particle.uvs.z-this._particle.uvs.x)+this._particle.uvs.x,this._uvs32[l+1]=this._shapeUV[2*h+1]*(this._particle.uvs.w-this._particle.uvs.y)+this._particle.uvs.y);if(this._particlesIntersect){var p=this._particle._boundingInfo,_=p.boundingBox,m=p.boundingSphere;if(!this._bSphereOnly){for(var g=0;g<_.vectors.length;g++)this._vertex.x=this._particle._modelBoundingInfo.boundingBox.vectors[g].x*this._particle.scaling.x,this._vertex.y=this._particle._modelBoundingInfo.boundingBox.vectors[g].y*this._particle.scaling.y,this._vertex.z=this._particle._modelBoundingInfo.boundingBox.vectors[g].z*this._particle.scaling.z,this._rotated.x=this._vertex.x*this._particle._rotationMatrix[0]+this._vertex.y*this._particle._rotationMatrix[3]+this._vertex.z*this._particle._rotationMatrix[6],this._rotated.y=this._vertex.x*this._particle._rotationMatrix[1]+this._vertex.y*this._particle._rotationMatrix[4]+this._vertex.z*this._particle._rotationMatrix[7],this._rotated.z=this._vertex.x*this._particle._rotationMatrix[2]+this._vertex.y*this._particle._rotationMatrix[5]+this._vertex.z*this._particle._rotationMatrix[8],_.vectors[g].x=this._particle.position.x+this._cam_axisX.x*this._rotated.x+this._cam_axisY.x*this._rotated.y+this._cam_axisZ.x*this._rotated.z,_.vectors[g].y=this._particle.position.y+this._cam_axisX.y*this._rotated.x+this._cam_axisY.y*this._rotated.y+this._cam_axisZ.y*this._rotated.z,_.vectors[g].z=this._particle.position.z+this._cam_axisX.z*this._rotated.x+this._cam_axisY.z*this._rotated.y+this._cam_axisZ.z*this._rotated.z;_._update(this.mesh._worldMatrix)}this._minBbox.x=this._particle._modelBoundingInfo.minimum.x*this._particle.scaling.x,this._minBbox.y=this._particle._modelBoundingInfo.minimum.y*this._particle.scaling.y,this._minBbox.z=this._particle._modelBoundingInfo.minimum.z*this._particle.scaling.z,this._maxBbox.x=this._particle._modelBoundingInfo.maximum.x*this._particle.scaling.x,this._maxBbox.y=this._particle._modelBoundingInfo.maximum.y*this._particle.scaling.y,this._maxBbox.z=this._particle._modelBoundingInfo.maximum.z*this._particle.scaling.z,m.center.x=this._particle._globalPosition.x+.5*(this._minBbox.x+this._maxBbox.x),m.center.y=this._particle._globalPosition.y+.5*(this._minBbox.y+this._maxBbox.y),m.center.z=this._particle._globalPosition.z+.5*(this._minBbox.z+this._maxBbox.z),m.radius=.5*this._bSphereRadiusFactor*Math.sqrt((this._maxBbox.x-this._minBbox.x)*(this._maxBbox.x-this._minBbox.x)+(this._maxBbox.y-this._minBbox.y)*(this._maxBbox.y-this._minBbox.y)+(this._maxBbox.z-this._minBbox.z)*(this._maxBbox.z-this._minBbox.z)),m._update(this.mesh._worldMatrix)}o=n+3,a=s+4,c=l+2}}if(i){if(this._computeParticleColor&&this.mesh.updateVerticesData(fi.VertexBuffer.ColorKind,this._colors32,!1,!1),this._computeParticleTexture&&this.mesh.updateVerticesData(fi.VertexBuffer.UVKind,this._uvs32,!1,!1),this.mesh.updateVerticesData(fi.VertexBuffer.PositionKind,this._positions32,!1,!1),!this.mesh.areNormalsFrozen||this.mesh.isFacetDataEnabled){if(this._computeParticleVertex||this.mesh.isFacetDataEnabled){var v=this.mesh.isFacetDataEnabled?this.mesh.getFacetDataParameters():null;fi.VertexData.ComputeNormals(this._positions32,this._indices32,this._normals32,v);for(var y=0;y<this._normals32.length;y++)this._fixedNormal32[y]=this._normals32[y]}this.mesh.areNormalsFrozen||this.mesh.updateVerticesData(fi.VertexBuffer.NormalKind,this._normals32,!1,!1)}if(this._depthSort&&this._depthSortParticles){this.depthSortedParticles.sort(this._depthSortFunction);var b=this.depthSortedParticles.length,T=0,E=0,x=0,P=0;for(T=0;T<b;T++){E=this.depthSortedParticles[T].indicesLength,x=this.depthSortedParticles[T].ind;for(y=0;y<E;y++)this._indices32[P]=this._indices[x+y],P++}this.mesh.updateIndices(this._indices32)}}return this._computeBoundingBox&&(this.mesh._boundingInfo=new fi.BoundingInfo(this._minimum,this._maximum),this.mesh._boundingInfo.update(this.mesh._worldMatrix)),this.afterUpdateParticles(e,t,i),this},e.prototype._quaternionRotationYPR=function(){this._halfroll=.5*this._roll,this._halfpitch=.5*this._pitch,this._halfyaw=.5*this._yaw,this._sinRoll=Math.sin(this._halfroll),this._cosRoll=Math.cos(this._halfroll),this._sinPitch=Math.sin(this._halfpitch),this._cosPitch=Math.cos(this._halfpitch),this._sinYaw=Math.sin(this._halfyaw),this._cosYaw=Math.cos(this._halfyaw),this._quaternion.x=this._cosYaw*this._sinPitch*this._cosRoll+this._sinYaw*this._cosPitch*this._sinRoll,this._quaternion.y=this._sinYaw*this._cosPitch*this._cosRoll-this._cosYaw*this._sinPitch*this._sinRoll,this._quaternion.z=this._cosYaw*this._cosPitch*this._sinRoll-this._sinYaw*this._sinPitch*this._cosRoll,this._quaternion.w=this._cosYaw*this._cosPitch*this._cosRoll+this._sinYaw*this._sinPitch*this._sinRoll},e.prototype._quaternionToRotationMatrix=function(){this._rotMatrix.m[0]=1-2*(this._quaternion.y*this._quaternion.y+this._quaternion.z*this._quaternion.z),this._rotMatrix.m[1]=2*(this._quaternion.x*this._quaternion.y+this._quaternion.z*this._quaternion.w),this._rotMatrix.m[2]=2*(this._quaternion.z*this._quaternion.x-this._quaternion.y*this._quaternion.w),this._rotMatrix.m[3]=0,this._rotMatrix.m[4]=2*(this._quaternion.x*this._quaternion.y-this._quaternion.z*this._quaternion.w),this._rotMatrix.m[5]=1-2*(this._quaternion.z*this._quaternion.z+this._quaternion.x*this._quaternion.x),this._rotMatrix.m[6]=2*(this._quaternion.y*this._quaternion.z+this._quaternion.x*this._quaternion.w),this._rotMatrix.m[7]=0,this._rotMatrix.m[8]=2*(this._quaternion.z*this._quaternion.x+this._quaternion.y*this._quaternion.w),this._rotMatrix.m[9]=2*(this._quaternion.y*this._quaternion.z-this._quaternion.x*this._quaternion.w),this._rotMatrix.m[10]=1-2*(this._quaternion.y*this._quaternion.y+this._quaternion.x*this._quaternion.x),this._rotMatrix.m[11]=0,this._rotMatrix.m[12]=0,this._rotMatrix.m[13]=0,this._rotMatrix.m[14]=0,this._rotMatrix.m[15]=1},e.prototype.dispose=function(){this.mesh.dispose(),this.vars=null,this._positions=null,this._indices=null,this._normals=null,this._uvs=null,this._colors=null,this._indices32=null,this._positions32=null,this._normals32=null,this._fixedNormal32=null,this._uvs32=null,this._colors32=null,this.pickedParticles=null},e.prototype.refreshVisibleSize=function(){return this._isVisibilityBoxLocked||this.mesh.refreshBoundingInfo(),this},e.prototype.setVisibilityBox=function(e){var t=e/2;this.mesh._boundingInfo=new fi.BoundingInfo(new fi.Vector3(-t,-t,-t),new fi.Vector3(t,t,t))},Object.defineProperty(e.prototype,"isAlwaysVisible",{get:function(){return this._alwaysVisible},set:function(e){this._alwaysVisible=e,this.mesh.alwaysSelectAsActiveMesh=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isVisibilityBoxLocked",{get:function(){return this._isVisibilityBoxLocked},set:function(e){this._isVisibilityBoxLocked=e,this.mesh.getBoundingInfo().isLocked=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleRotation",{get:function(){return this._computeParticleRotation},set:function(e){this._computeParticleRotation=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleColor",{get:function(){return this._computeParticleColor},set:function(e){this._computeParticleColor=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleTexture",{get:function(){return this._computeParticleTexture},set:function(e){this._computeParticleTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computeParticleVertex",{get:function(){return this._computeParticleVertex},set:function(e){this._computeParticleVertex=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"computeBoundingBox",{get:function(){return this._computeBoundingBox},set:function(e){this._computeBoundingBox=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthSortParticles",{get:function(){return this._depthSortParticles},set:function(e){this._depthSortParticles=e},enumerable:!0,configurable:!0}),e.prototype.initParticles=function(){},e.prototype.recycleParticle=function(e){return e},e.prototype.updateParticle=function(e){return e},e.prototype.updateParticleVertex=function(e,t,i){return t},e.prototype.beforeUpdateParticles=function(e,t,i){},e.prototype.afterUpdateParticles=function(e,t,i){},e})(),fi.SolidParticleSystem=pi,_i=$a||($a={}),mi=(function(){function x(){}return x.updateSideOrientation=function(e){return e==_i.Mesh.DOUBLESIDE?_i.Mesh.DOUBLESIDE:null==e?_i.Mesh.FRONTSIDE:e},x.CreateBox=function(e,t,i){void 0===i&&(i=null);var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateBox(t).applyToMesh(r,t.updatable),r},x.CreateSphere=function(e,t,i){var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateSphere(t).applyToMesh(r,t.updatable),r},x.CreateDisc=function(e,t,i){void 0===i&&(i=null);var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateDisc(t).applyToMesh(r,t.updatable),r},x.CreateIcoSphere=function(e,t,i){var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateIcoSphere(t).applyToMesh(r,t.updatable),r},x.CreateRibbon=function(e,t,i){void 0===i&&(i=null);var h=t.pathArray,r=t.closeArray,n=t.closePath,o=x.updateSideOrientation(t.sideOrientation),u=t.instance,s=t.updatable;if(u){_i.Vector3.FromFloatsToRef(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE,_i.Tmp.Vector3[0]),_i.Vector3.FromFloatsToRef(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE,_i.Tmp.Vector3[1]);var a=u.getVerticesData(_i.VertexBuffer.PositionKind);if(function(e){for(var t=h[0].length,i=u,r=0,n=i._originalBuilderSideOrientation===_i.Mesh.DOUBLESIDE?2:1,o=1;o<=n;o++)for(var s=0;s<h.length;s++){var a=h[s],l=a.length;t=t<l?t:l;for(var c=0;c<t;)e[r]=a[c].x,e[r+1]=a[c].y,e[r+2]=a[c].z,a[c].x<_i.Tmp.Vector3[0].x&&(_i.Tmp.Vector3[0].x=a[c].x),a[c].x>_i.Tmp.Vector3[1].x&&(_i.Tmp.Vector3[1].x=a[c].x),a[c].y<_i.Tmp.Vector3[0].y&&(_i.Tmp.Vector3[0].y=a[c].y),a[c].y>_i.Tmp.Vector3[1].y&&(_i.Tmp.Vector3[1].y=a[c].y),a[c].z<_i.Tmp.Vector3[0].z&&(_i.Tmp.Vector3[0].z=a[c].z),a[c].z>_i.Tmp.Vector3[1].z&&(_i.Tmp.Vector3[1].z=a[c].z),c++,r+=3;i._creationDataStorage&&i._creationDataStorage.closePath&&(e[r]=a[0].x,e[r+1]=a[0].y,e[r+2]=a[0].z,r+=3)}}(a),u._boundingInfo=new _i.BoundingInfo(_i.Tmp.Vector3[2],_i.Tmp.Vector3[3]),u._boundingInfo.update(u._worldMatrix),u.updateVerticesData(_i.VertexBuffer.PositionKind,a,!1,!1),t.colors){for(var l=u.getVerticesData(_i.VertexBuffer.ColorKind),c=0;c<t.colors.length;c++)l[4*c]=t.colors[c].r,l[4*c+1]=t.colors[c].g,l[4*c+2]=t.colors[c].b,l[4*c+3]=t.colors[c].a;u.updateVerticesData(_i.VertexBuffer.ColorKind,l,!1,!1)}if(t.uvs){for(var d=u.getVerticesData(_i.VertexBuffer.UVKind),f=0;f<t.uvs.length;f++)d[2*f]=t.uvs[f].x,d[2*f+1]=t.uvs[f].y;u.updateVerticesData(_i.VertexBuffer.UVKind,d,!1,!1)}if(!u.areNormalsFrozen||u.isFacetDataEnabled){var p=u.getIndices(),_=u.getVerticesData(_i.VertexBuffer.NormalKind),m=u.isFacetDataEnabled?u.getFacetDataParameters():null;if(_i.VertexData.ComputeNormals(a,p,_,m),u._creationDataStorage&&u._creationDataStorage.closePath)for(var g=0,v=0,y=0;y<h.length;y++)g=3*u._creationDataStorage.idx[y],v=y+1<h.length?3*(u._creationDataStorage.idx[y+1]-1):_.length-3,_[g]=.5*(_[g]+_[v]),_[g+1]=.5*(_[g+1]+_[v+1]),_[g+2]=.5*(_[g+2]+_[v+2]),_[v]=_[g],_[v+1]=_[g+1],_[v+2]=_[g+2];u.areNormalsFrozen||u.updateVerticesData(_i.VertexBuffer.NormalKind,_,!1,!1)}return u}var b=new _i.Mesh(e,i);b._originalBuilderSideOrientation=o,b._creationDataStorage=new _i._CreationDataStorage;var T=_i.VertexData.CreateRibbon(t);return n&&(b._creationDataStorage.idx=T._idx),b._creationDataStorage.closePath=n,b._creationDataStorage.closeArray=r,T.applyToMesh(b,s),b},x.CreateCylinder=function(e,t,i){var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateCylinder(t).applyToMesh(r,t.updatable),r},x.CreateTorus=function(e,t,i){var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateTorus(t).applyToMesh(r,t.updatable),r},x.CreateTorusKnot=function(e,t,i){var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreateTorusKnot(t).applyToMesh(r,t.updatable),r},x.CreateLineSystem=function(e,t,i){var r=t.instance,n=t.lines,o=t.colors;if(r){var s,a,l=r.getVerticesData(_i.VertexBuffer.PositionKind);o&&(s=r.getVerticesData(_i.VertexBuffer.ColorKind));for(var c=0,h=0,u=0;u<n.length;u++)for(var d=n[u],f=0;f<d.length;f++)l[c]=d[f].x,l[c+1]=d[f].y,l[c+2]=d[f].z,o&&s&&(a=o[u],s[h]=a[f].r,s[h+1]=a[f].g,s[h+2]=a[f].b,s[h+3]=a[f].a,h+=4),c+=3;return r.updateVerticesData(_i.VertexBuffer.PositionKind,l,!1,!1),o&&s&&r.updateVerticesData(_i.VertexBuffer.ColorKind,s,!1,!1),r}var p=!!o,_=new _i.LinesMesh(e,i,null,void 0,void 0,p,t.useVertexAlpha);return _i.VertexData.CreateLineSystem(t).applyToMesh(_,t.updatable),_},x.CreateLines=function(e,t,i){void 0===i&&(i=null);var r=t.colors?[t.colors]:null;return x.CreateLineSystem(e,{lines:[t.points],updatable:t.updatable,instance:t.instance,colors:r,useVertexAlpha:t.useVertexAlpha},i)},x.CreateDashedLines=function(e,t,i){void 0===i&&(i=null);var d=t.points,f=t.instance,r=t.gapSize||1,n=t.dashSize||3;if(f){return f.updateMeshPositions((function(e){var t,i,r=_i.Vector3.Zero(),n=e.length/6,o=0,s=0,a=0,l=0,c=0,h=0;for(c=0;c<d.length-1;c++)d[c+1].subtractToRef(d[c],r),o+=r.length();t=o/n;var u=f._creationDataStorage.dashSize;for(i=u*t/(u+f._creationDataStorage.gapSize),c=0;c<d.length-1;c++)for(d[c+1].subtractToRef(d[c],r),s=Math.floor(r.length()/t),r.normalize(),h=0;h<s&&l<e.length;)a=t*h,e[l]=d[c].x+a*r.x,e[l+1]=d[c].y+a*r.y,e[l+2]=d[c].z+a*r.z,e[l+3]=d[c].x+(a+i)*r.x,e[l+4]=d[c].y+(a+i)*r.y,e[l+5]=d[c].z+(a+i)*r.z,l+=6,h++;for(;l<e.length;)e[l]=d[c].x,e[l+1]=d[c].y,e[l+2]=d[c].z,l+=3}),!1),f}var o=new _i.LinesMesh(e,i);return _i.VertexData.CreateDashedLines(t).applyToMesh(o,t.updatable),o._creationDataStorage=new _i._CreationDataStorage,o._creationDataStorage.dashSize=n,o._creationDataStorage.gapSize=r,o},x.ExtrudeShape=function(e,t,i){void 0===i&&(i=null);var r=t.path,n=t.shape,o=t.scale||1,s=t.rotation||0,a=0===t.cap?0:t.cap||_i.Mesh.NO_CAP,l=t.updatable,c=x.updateSideOrientation(t.sideOrientation),h=t.instance||null,u=t.invertUV||!1;return x._ExtrudeShapeGeneric(e,n,r,o,s,null,null,!1,!1,a,!1,i,!!l,c,h,u,t.frontUVs||null,t.backUVs||null)},x.ExtrudeShapeCustom=function(e,t,i){var r=t.path,n=t.shape,o=t.scaleFunction||function(){return 1},s=t.rotationFunction||function(){return 0},a=t.ribbonCloseArray||!1,l=t.ribbonClosePath||!1,c=0===t.cap?0:t.cap||_i.Mesh.NO_CAP,h=t.updatable,u=x.updateSideOrientation(t.sideOrientation),d=t.instance,f=t.invertUV||!1;return x._ExtrudeShapeGeneric(e,n,r,null,null,o,s,a,l,c,!0,i,!!h,u,d||null,f,t.frontUVs||null,t.backUVs||null)},x.CreateLathe=function(e,t,i){var r,n=t.arc?t.arc<=0||1<t.arc?1:t.arc:1,o=void 0===t.closed||t.closed,s=t.shape,a=t.radius||1,l=t.tessellation||64,c=t.clip||0,h=t.updatable,u=x.updateSideOrientation(t.sideOrientation),d=t.cap||_i.Mesh.NO_CAP,f=2*Math.PI,p=new Array,_=t.invertUV||!1,m=0,g=0,v=f/l*n,y=new Array;for(m=0;m<=l-c;m++){y=[];for(d!=_i.Mesh.CAP_START&&d!=_i.Mesh.CAP_ALL||(y.push(new _i.Vector3(0,s[0].y,0)),y.push(new _i.Vector3(Math.cos(m*v)*s[0].x*a,s[0].y,Math.sin(m*v)*s[0].x*a))),g=0;g<s.length;g++)r=new _i.Vector3(Math.cos(m*v)*s[g].x*a,s[g].y,Math.sin(m*v)*s[g].x*a),y.push(r);d!=_i.Mesh.CAP_END&&d!=_i.Mesh.CAP_ALL||(y.push(new _i.Vector3(Math.cos(m*v)*s[s.length-1].x*a,s[s.length-1].y,Math.sin(m*v)*s[s.length-1].x*a)),y.push(new _i.Vector3(0,s[s.length-1].y,0))),p.push(y)}return x.CreateRibbon(e,{pathArray:p,closeArray:o,sideOrientation:u,updatable:h,invertUV:_,frontUVs:t.frontUVs,backUVs:t.backUVs},i)},x.CreatePlane=function(e,t,i){var r=new _i.Mesh(e,i);if(t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreatePlane(t).applyToMesh(r,t.updatable),t.sourcePlane){r.translate(t.sourcePlane.normal,t.sourcePlane.d);var n=Math.acos(_i.Vector3.Dot(t.sourcePlane.normal,_i.Axis.Z)),o=_i.Vector3.Cross(_i.Axis.Z,t.sourcePlane.normal);o.lengthSquared()>_i.Epsilon&&r.rotate(o,n)}return r},x.CreateGround=function(e,t,i){var r=new _i.GroundMesh(e,i);return r._setReady(!1),r._subdivisionsX=t.subdivisionsX||t.subdivisions||1,r._subdivisionsY=t.subdivisionsY||t.subdivisions||1,r._width=t.width||1,r._height=t.height||1,r._maxX=r._width/2,r._maxZ=r._height/2,r._minX=-r._maxX,r._minZ=-r._maxZ,_i.VertexData.CreateGround(t).applyToMesh(r,t.updatable),r._setReady(!0),r},x.CreateTiledGround=function(e,t,i){var r=new _i.Mesh(e,i);return _i.VertexData.CreateTiledGround(t).applyToMesh(r,t.updatable),r},x.CreateGroundFromHeightMap=function(e,t,i,s){var a=i.width||10,l=i.height||10,c=i.subdivisions||1,h=i.minHeight||0,u=i.maxHeight||1,d=i.colorFilter||new _i.Color3(.3,.59,.11),f=i.alphaFilter||0,p=i.updatable,_=i.onReady,m=new _i.GroundMesh(e,s);m._subdivisionsX=c,m._subdivisionsY=c,m._width=a,m._height=l,m._maxX=m._width/2,m._maxZ=m._height/2,m._minX=-m._maxX,m._minZ=-m._maxZ,m._setReady(!1);return _i.Tools.LoadImage(t,(function(e){var t=document.createElement("canvas"),i=t.getContext("2d");if(!i)throw new Error("Unable to get 2d context for CreateGroundFromHeightMap");if(!s.isDisposed){var r=e.width,n=e.height;t.width=r,t.height=n,i.drawImage(e,0,0);var o=i.getImageData(0,0,r,n).data;_i.VertexData.CreateGroundFromHeightMap({width:a,height:l,subdivisions:c,minHeight:h,maxHeight:u,colorFilter:d,buffer:o,bufferWidth:r,bufferHeight:n,alphaFilter:f}).applyToMesh(m,p),_&&_(m),m._setReady(!0)}}),(function(){}),s.database),m},x.CreatePolygon=function(e,t,i){t.sideOrientation=x.updateSideOrientation(t.sideOrientation);for(var r=t.shape,n=t.holes||[],o=t.depth||0,s=[],a=[],l=0;l<r.length;l++)s[l]=new _i.Vector2(r[l].x,r[l].z);s[0].equalsWithEpsilon(s[s.length-1],1e-8)&&s.pop();for(var c=new _i.PolygonMeshBuilder(e,s,i),h=0;h<n.length;h++){a=[];for(var u=0;u<n[h].length;u++)a.push(new _i.Vector2(n[h][u].x,n[h][u].z));c.addHole(a)}var d=c.build(t.updatable,o);return d._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreatePolygon(d,t.sideOrientation,t.faceUV,t.faceColors,t.frontUVs,t.backUVs).applyToMesh(d,t.updatable),d},x.ExtrudePolygon=function(e,t,i){return x.CreatePolygon(e,t,i)},x.CreateTube=function(e,t,i){var r=t.path,n=t.instance,o=1;void 0!==t.radius?o=t.radius:n&&(o=n._creationDataStorage.radius);var s=t.tessellation||64,a=t.radiusFunction||null,l=t.cap||_i.Mesh.NO_CAP,c=t.invertUV||!1,h=t.updatable,u=x.updateSideOrientation(t.sideOrientation);t.arc=t.arc&&(t.arc<=0||1<t.arc)?1:t.arc||1;var d,f,p=function(n,e,t,i,r,o,s,a){for(var l,c,h,u,d=e.getTangents(),f=e.getNormals(),p=e.getDistances(),_=2*Math.PI/r*a,m=o||function(){return i},g=_i.Tmp.Matrix[0],v=s===_i.Mesh.NO_CAP||s===_i.Mesh.CAP_END?0:2,y=0;y<n.length;y++){c=m(y,p[y]),l=Array(),h=f[y];for(var b=0;b<r;b++)_i.Matrix.RotationAxisToRef(d[y],_*b,g),u=l[b]?l[b]:_i.Vector3.Zero(),_i.Vector3.TransformCoordinatesToRef(h,g,u),u.scaleInPlace(c).addInPlace(n[y]),l[b]=u;t[v]=l,v++}var T=function(e,t){for(var i=Array(),r=0;r<e;r++)i.push(n[t]);return i};switch(s){case _i.Mesh.NO_CAP:break;case _i.Mesh.CAP_START:t[0]=T(r,0),t[1]=t[2].slice(0);break;case _i.Mesh.CAP_END:t[v]=t[v-1].slice(0),t[v+1]=T(r,n.length-1);break;case _i.Mesh.CAP_ALL:t[0]=T(r,0),t[1]=t[2].slice(0),t[v]=t[v-1].slice(0),t[v+1]=T(r,n.length-1)}return t};if(n){var _=n._creationDataStorage,m=t.arc||_.arc;return f=p(r,d=_.path3D.update(r),_.pathArray,o,_.tessellation,a,_.cap,m),n=x.CreateRibbon("",{pathArray:f,instance:n}),_.path3D=d,_.pathArray=f,_.arc=m,_.radius=o,n}f=p(r,d=new _i.Path3D(r),new Array,o,s,a,l=l<0||3<l?0:l,t.arc);var g=x.CreateRibbon(e,{pathArray:f,closePath:!0,closeArray:!1,updatable:h,sideOrientation:u,invertUV:c,frontUVs:t.frontUVs,backUVs:t.backUVs},i);return g._creationDataStorage.pathArray=f,g._creationDataStorage.path3D=d,g._creationDataStorage.tessellation=s,g._creationDataStorage.cap=l,g._creationDataStorage.arc=t.arc,g._creationDataStorage.radius=o,g},x.CreatePolyhedron=function(e,t,i){var r=new _i.Mesh(e,i);return t.sideOrientation=x.updateSideOrientation(t.sideOrientation),r._originalBuilderSideOrientation=t.sideOrientation,_i.VertexData.CreatePolyhedron(t).applyToMesh(r,t.updatable),r},x.CreateDecal=function(e,t,i){var r=t.getIndices(),n=t.getVerticesData(_i.VertexBuffer.PositionKind),o=t.getVerticesData(_i.VertexBuffer.NormalKind),s=i.position||_i.Vector3.Zero(),a=i.normal||_i.Vector3.Up(),f=i.size||_i.Vector3.One(),l=i.angle||0;if(!a){var c=new _i.Vector3(0,0,1),h=t.getScene().activeCamera,u=_i.Vector3.TransformCoordinates(c,h.getWorldMatrix());a=h.globalPosition.subtract(u)}var d=-Math.atan2(a.z,a.x)-Math.PI/2,p=Math.sqrt(a.x*a.x+a.z*a.z),_=Math.atan2(a.y,p),m=_i.Matrix.RotationYawPitchRoll(d,_,l).multiply(_i.Matrix.Translation(s.x,s.y,s.z)),g=_i.Matrix.Invert(m),v=t.getWorldMatrix().multiply(g),y=new _i.VertexData;y.indices=[],y.positions=[],y.normals=[],y.uvs=[];for(var b=0,T=function(e){var t=new _i.PositionNormalVertex;if(!r||!n||!o)return t;var i=r[e];return t.position=new _i.Vector3(n[3*i],n[3*i+1],n[3*i+2]),t.position=_i.Vector3.TransformCoordinates(t.position,v),t.normal=new _i.Vector3(o[3*i],o[3*i+1],o[3*i+2]),t.normal=_i.Vector3.TransformNormal(t.normal,v),t},E=function(e,r){if(0===e.length)return e;for(var n=.5*Math.abs(_i.Vector3.Dot(f,r)),t=function(e,t){var i=_i.Vector3.GetClipFactor(e.position,t.position,r,n);return new _i.PositionNormalVertex(_i.Vector3.Lerp(e.position,t.position,i),_i.Vector3.Lerp(e.normal,t.normal,i))},i=new Array,o=0;o<e.length;o+=3){var s,a,l,c=null,h=null,u=null,d=null;switch(((s=0<_i.Vector3.Dot(e[o].position,r)-n)?1:0)+((a=0<_i.Vector3.Dot(e[o+1].position,r)-n)?1:0)+((l=0<_i.Vector3.Dot(e[o+2].position,r)-n)?1:0)){case 0:i.push(e[o]),i.push(e[o+1]),i.push(e[o+2]);break;case 1:if(s&&(c=e[o+1],h=e[o+2],u=t(e[o],c),d=t(e[o],h)),a){c=e[o],h=e[o+2],u=t(e[o+1],c),d=t(e[o+1],h),i.push(u),i.push(h.clone()),i.push(c.clone()),i.push(h.clone()),i.push(u.clone()),i.push(d);break}l&&(c=e[o],h=e[o+1],u=t(e[o+2],c),d=t(e[o+2],h)),c&&h&&u&&d&&(i.push(c.clone()),i.push(h.clone()),i.push(u),i.push(d),i.push(u.clone()),i.push(h.clone()));break;case 2:s||(h=t(c=e[o].clone(),e[o+1]),u=t(c,e[o+2]),i.push(c),i.push(h),i.push(u)),a||(h=t(c=e[o+1].clone(),e[o+2]),u=t(c,e[o]),i.push(c),i.push(h),i.push(u)),l||(h=t(c=e[o+2].clone(),e[o]),u=t(c,e[o+1]),i.push(c),i.push(h),i.push(u))}}return i},x=0;x<r.length;x+=3){var P=new Array;if(P.push(T(x)),P.push(T(x+1)),P.push(T(x+2)),0!==(P=E(P=E(P=E(P=E(P=E(P=E(P,new _i.Vector3(1,0,0)),new _i.Vector3(-1,0,0)),new _i.Vector3(0,1,0)),new _i.Vector3(0,-1,0)),new _i.Vector3(0,0,1)),new _i.Vector3(0,0,-1))).length)for(var A=0;A<P.length;A++){var S=P[A];y.indices.push(b),S.position.toArray(y.positions,3*b),S.normal.toArray(y.normals,3*b),y.uvs.push(.5+S.position.x/f.x),y.uvs.push(.5+S.position.y/f.y),b++}}var M=new _i.Mesh(e,t.getScene());return y.applyToMesh(M),M.position=s.clone(),M.rotation=new _i.Vector3(_,d,l),M},x._ExtrudeShapeGeneric=function(e,t,i,r,n,o,s,a,l,c,h,u,d,f,p,_,m,g){var v,y,b=function(e,t,i,r,n,o,s,a,l,c){for(var h=i.getTangents(),u=i.getNormals(),d=i.getBinormals(),f=i.getDistances(),p=0,_=c&&a?a:function(){return null!==o?o:0},m=c&&s?s:function(){return null!==n?n:1},g=l===_i.Mesh.NO_CAP||l===_i.Mesh.CAP_END?0:2,v=_i.Tmp.Matrix[0],y=0;y<t.length;y++){for(var b=new Array,T=_(y,f[y]),E=m(y,f[y]),x=0;x<e.length;x++){_i.Matrix.RotationAxisToRef(h[y],p,v);var P=h[y].scale(e[x].z).add(u[y].scale(e[x].x)).add(d[y].scale(e[x].y)),A=b[x]?b[x]:_i.Vector3.Zero();_i.Vector3.TransformCoordinatesToRef(P,v,A),A.scaleInPlace(E).addInPlace(t[y]),b[x]=A}r[g]=b,p+=T,g++}var S=function(e){var t,i=Array(),r=_i.Vector3.Zero();for(t=0;t<e.length;t++)r.addInPlace(e[t]);for(r.scaleInPlace(1/e.length),t=0;t<e.length;t++)i.push(r);return i};switch(l){case _i.Mesh.NO_CAP:break;case _i.Mesh.CAP_START:r[0]=S(r[2]),r[1]=r[2];break;case _i.Mesh.CAP_END:r[g]=r[g-1],r[g+1]=S(r[g-1]);break;case _i.Mesh.CAP_ALL:r[0]=S(r[2]),r[1]=r[2],r[g]=r[g-1],r[g+1]=S(r[g-1])}return r};if(p){var T=p._creationDataStorage;return v=T.path3D.update(i),y=b(t,i,T.path3D,T.pathArray,r,n,o,s,T.cap,h),p=_i.Mesh.CreateRibbon("",y,!1,!1,0,u||void 0,!1,0,p)}y=b(t,i,v=new _i.Path3D(i),new Array,r,n,o,s,c=c<0||3<c?0:c,h);var E=x.CreateRibbon(e,{pathArray:y,closeArray:a,closePath:l,updatable:d,sideOrientation:f,invertUV:_,frontUVs:m||void 0,backUVs:g||void 0},u);return E._creationDataStorage.pathArray=y,E._creationDataStorage.path3D=v,E._creationDataStorage.cap=c,E},x})(),_i.MeshBuilder=mi,gi=$a||($a={}),vi=(function(){function r(){}return Object.defineProperty(r,"DecoderAvailable",{get:function(){if("undefined"!=typeof DracoDecoderModule)return!0;var e=r.Configuration.decoder;if(e){if(e.wasmUrl&&e.wasmBinaryUrl&&"object"==typeof WebAssembly)return!0;if(e.fallbackUrl)return!0}return!1},enumerable:!0,configurable:!0}),r.prototype.dispose=function(){},r.prototype.decodeMeshAsync=function(e,y){var b=e instanceof ArrayBuffer?new Uint8Array(e):e;return r._GetDecoderModule().then((function(e){var t=e.module,i=new gi.VertexData,r=new t.DecoderBuffer;r.Init(b,b.byteLength);var n,o,s=new t.Decoder;try{var a=s.GetEncodedGeometryType(r);switch(a){case t.TRIANGULAR_MESH:n=new t.Mesh,o=s.DecodeBufferToMesh(r,n);break;case t.POINT_CLOUD:n=new t.PointCloud,o=s.DecodeBufferToPointCloud(r,n);break;default:throw new Error("Invalid geometry type "+a)}if(!o.ok()||!n.ptr)throw new Error(o.error_msg());var l=n.num_points();if(a===t.TRIANGULAR_MESH){var c=n.num_faces(),h=new t.DracoInt32Array;try{for(var u=new Uint32Array(3*c),d=0;d<c;d++){s.GetFaceFromMesh(n,d,h);var f=3*d;u[f+0]=h.GetValue(0),u[f+1]=h.GetValue(1),u[f+2]=h.GetValue(2)}i.indices=u}finally{t.destroy(h)}}for(var p in y){var _=y[p],m=s.GetAttributeByUniqueId(n,_),g=new t.DracoFloat32Array;try{s.GetAttributeFloatForAllPoints(n,m,g);var v=new Float32Array(l*m.num_components());for(d=0;d<v.length;d++)v[d]=g.GetValue(d);i.set(v,p)}finally{t.destroy(g)}}}finally{n&&t.destroy(n),t.destroy(s),t.destroy(r)}return i}))},r._GetDecoderModule=function(){if(!r._DecoderModulePromise){var e=null,i={};if("undefined"!=typeof DracoDecoderModule)e=Promise.resolve();else{var t=r.Configuration.decoder;t&&(t.wasmUrl&&t.wasmBinaryUrl&&"object"==typeof WebAssembly?e=Promise.all([r._LoadScriptAsync(t.wasmUrl),r._LoadFileAsync(t.wasmBinaryUrl).then((function(e){i.wasmBinary=e}))]):t.fallbackUrl&&(e=r._LoadScriptAsync(t.fallbackUrl)))}if(!e)throw new Error("Draco decoder module is not available");r._DecoderModulePromise=e.then((function(){return new Promise(function(t){i.onModuleLoaded=function(e){t({module:e})},DracoDecoderModule(i)})}))}return r._DecoderModulePromise},r._LoadScriptAsync=function(i){return new Promise(function(e,t){gi.Tools.LoadScript(i,(function(){e()}),(function(e){t(new Error(e))}))})},r._LoadFileAsync=function(e){return new Promise(function(t,i){gi.Tools.LoadFile(e,(function(e){t(e)}),void 0,void 0,!0,(function(e,t){i(t)}))})},r.Configuration={decoder:{wasmUrl:"https://preview.babylonjs.com/draco_wasm_wrapper_gltf.js",wasmBinaryUrl:"https://preview.babylonjs.com/draco_decoder_gltf.wasm",fallbackUrl:"https://preview.babylonjs.com/draco_decoder_gltf.js"}},r})(),gi.DracoCompression=vi,(function(r){r.Engine.AudioEngineFactory=function(e){return new t(e)};var t=(function(){function e(e){void 0===e&&(e=null);var t=this;this._audioContext=null,this._audioContextInitialized=!1,this._muteButton=null,this.canUseWebAudio=!1,this.WarnedWebAudioUnsupported=!1,this.isMP3supported=!1,this.isOGGsupported=!1,this.unlocked=!0,this.useCustomUnlockedButton=!1,this.onAudioUnlockedObservable=new r.Observable,this.onAudioLockedObservable=new r.Observable,this._tryToRun=!1,this._onResize=function(){t._moveButtonToTopLeft()},void 0===window.AudioContext&&void 0===window.webkitAudioContext||(window.AudioContext=window.AudioContext||window.webkitAudioContext,this.canUseWebAudio=!0);var i=document.createElement("audio");this._hostElement=e;try{i&&i.canPlayType&&i.canPlayType('audio/mpeg; codecs="mp3"').replace(/^no$/,"")&&(this.isMP3supported=!0)}catch(e){}try{i&&i.canPlayType&&i.canPlayType('audio/ogg; codecs="vorbis"').replace(/^no$/,"")&&(this.isOGGsupported=!0)}catch(e){}}return Object.defineProperty(e.prototype,"audioContext",{get:function(){return this._audioContextInitialized?this.unlocked||this._muteButton||this._displayMuteButton():this._initializeAudioContext(),this._audioContext},enumerable:!0,configurable:!0}),e.prototype.lock=function(){this._triggerSuspendedState()},e.prototype.unlock=function(){this._triggerRunningState()},e.prototype._resumeAudioContext=function(){var e;return this._audioContext.resume&&(e=this._audioContext.resume()),e||Promise.resolve()},e.prototype._initializeAudioContext=function(){try{this.canUseWebAudio&&(this._audioContext=new AudioContext,this.masterGain=this._audioContext.createGain(),this.masterGain.gain.value=1,this.masterGain.connect(this._audioContext.destination),this._audioContextInitialized=!0,"running"===this._audioContext.state&&this._triggerRunningState())}catch(e){this.canUseWebAudio=!1,r.Tools.Error("Web Audio: "+e.message)}},e.prototype._triggerRunningState=function(){var e=this;this._tryToRun||(this._tryToRun=!0,this._resumeAudioContext().then((function(){e._tryToRun=!1,e._muteButton&&e._hideMuteButton()})).catch((function(){e._tryToRun=!1,e.unlocked=!1})),this.unlocked=!0,this.onAudioUnlockedObservable.notifyObservers(this))},e.prototype._triggerSuspendedState=function(){this.unlocked=!1,this.onAudioLockedObservable.notifyObservers(this),this._displayMuteButton()},e.prototype._displayMuteButton=function(){var e=this;if(!this.useCustomUnlockedButton){this._muteButton=document.createElement("BUTTON"),this._muteButton.className="babylonUnmuteIcon",this._muteButton.id="babylonUnmuteIconBtn",this._muteButton.title="Unmute";var t=document.createElement("style");t.appendChild(document.createTextNode(".babylonUnmuteIcon { position: absolute; left: 20px; top: 20px; height: 40px; width: 60px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20version%3D%221.1%22%20xmlns%3D%22http%3A%2F%2Fwww.w3.org%2F2000%2Fsvg%22%20width%3D%2239%22%20height%3D%2232%22%20viewBox%3D%220%200%2039%2032%22%3E%3Cpath%20fill%3D%22white%22%20d%3D%22M9.625%2018.938l-0.031%200.016h-4.953q-0.016%200-0.031-0.016v-12.453q0-0.016%200.031-0.016h4.953q0.031%200%200.031%200.016v12.453zM12.125%207.688l8.719-8.703v27.453l-8.719-8.719-0.016-0.047v-9.938zM23.359%207.875l1.406-1.406%204.219%204.203%204.203-4.203%201.422%201.406-4.219%204.219%204.219%204.203-1.484%201.359-4.141-4.156-4.219%204.219-1.406-1.422%204.219-4.203z%22%3E%3C%2Fpath%3E%3C%2Fsvg%3E); background-size: 80%; background-repeat:no-repeat; background-position: center; background-position-y: 4px; border: none; outline: none; transition: transform 0.125s ease-out; cursor: pointer; z-index: 9999; } .babylonUnmuteIcon:hover { transform: scale(1.05) } .babylonUnmuteIcon:active { background-color: rgba(51,51,51,1) }")),document.getElementsByTagName("head")[0].appendChild(t),document.body.appendChild(this._muteButton),this._moveButtonToTopLeft(),this._muteButton.addEventListener("touchend",(function(){e._triggerRunningState()}),!0),this._muteButton.addEventListener("click",(function(){e._triggerRunningState()}),!0),window.addEventListener("resize",this._onResize)}},e.prototype._moveButtonToTopLeft=function(){this._hostElement&&this._muteButton&&(this._muteButton.style.top=this._hostElement.offsetTop+20+"px",this._muteButton.style.left=this._hostElement.offsetLeft+20+"px")},e.prototype._hideMuteButton=function(){this._muteButton&&(document.body.removeChild(this._muteButton),this._muteButton=null)},e.prototype.dispose=function(){this.canUseWebAudio&&this._audioContextInitialized&&(this._connectedAnalyser&&this._audioContext&&(this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser.dispose(),this.masterGain.disconnect(),this.masterGain.connect(this._audioContext.destination),this._connectedAnalyser=null),this.masterGain.gain.value=1),this.WarnedWebAudioUnsupported=!1,this._hideMuteButton(),window.removeEventListener("resize",this._onResize),this.onAudioUnlockedObservable.clear(),this.onAudioLockedObservable.clear()},e.prototype.getGlobalVolume=function(){return this.canUseWebAudio&&this._audioContextInitialized?this.masterGain.gain.value:-1},e.prototype.setGlobalVolume=function(e){this.canUseWebAudio&&this._audioContextInitialized&&(this.masterGain.gain.value=e)},e.prototype.connectToAnalyser=function(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this.canUseWebAudio&&this._audioContextInitialized&&this._audioContext&&(this._connectedAnalyser=e,this.masterGain.disconnect(),this._connectedAnalyser.connectAudioNodes(this.masterGain,this._audioContext.destination))},e})();r.AudioEngine=t})($a||($a={})),yi=$a||($a={}),bi=(function(){function d(e,t,i,r,n){void 0===r&&(r=null);var o=this;this.autoplay=!1,this.loop=!1,this.useCustomAttenuation=!1,this.isPlaying=!1,this.isPaused=!1,this.spatialSound=!1,this.refDistance=1,this.rolloffFactor=1,this.maxDistance=100,this.distanceModel="linear",this.onEndedObservable=new yi.Observable,this._panningModel="equalpower",this._playbackRate=1,this._streaming=!1,this._startTime=0,this._startOffset=0,this._position=yi.Vector3.Zero(),this._positionInEmitterSpace=!1,this._localDirection=new yi.Vector3(1,0,0),this._volume=1,this._isReadyToPlay=!1,this._isDirectional=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._coneOuterGain=0,this._isOutputConnected=!1,this._urlType="Unknown",this.name=e;var s=(this._scene=i)._getComponent(yi.SceneComponentConstants.NAME_AUDIO);if(s||(s=new yi.AudioSceneComponent(i),i._addComponent(s)),this._readyToPlayCallback=r,this._customAttenuationFunction=function(e,t,i,r,n){return t<i?e*(1-t/i):0},n&&(this.autoplay=n.autoplay||!1,this.loop=n.loop||!1,void 0!==n.volume&&(this._volume=n.volume),this.spatialSound=n.spatialSound||!1,this.maxDistance=n.maxDistance||100,this.useCustomAttenuation=n.useCustomAttenuation||!1,this.rolloffFactor=n.rolloffFactor||1,this.refDistance=n.refDistance||1,this.distanceModel=n.distanceModel||"linear",this._playbackRate=n.playbackRate||1,this._streaming=n.streaming||!1),yi.Engine.audioEngine.canUseWebAudio&&yi.Engine.audioEngine.audioContext){this._soundGain=yi.Engine.audioEngine.audioContext.createGain(),this._soundGain.gain.value=this._volume,this._inputAudioNode=this._soundGain,this._outputAudioNode=this._soundGain,this.spatialSound&&this._createSpatialParameters(),this._scene.mainSoundTrack.AddSound(this);var a=!0;if(t)try{"string"==typeof t?this._urlType="String":t instanceof ArrayBuffer?this._urlType="ArrayBuffer":t instanceof MediaStream?this._urlType="MediaStream":Array.isArray(t)&&(this._urlType="Array");var l=[],c=!1;switch(this._urlType){case"MediaStream":this._streaming=!0,this._isReadyToPlay=!0,this._streamingSource=yi.Engine.audioEngine.audioContext.createMediaElementSource(t),this.autoplay&&this.play(),this._readyToPlayCallback&&this._readyToPlayCallback();break;case"ArrayBuffer":0<t.byteLength&&(c=!0,this._soundLoaded(t));break;case"String":l.push(t);case"Array":0===l.length&&(l=t);for(var h=0;h<l.length;h++){var u=l[h];if(-1!==u.indexOf(".mp3",u.length-4)&&yi.Engine.audioEngine.isMP3supported&&(c=!0),-1!==u.indexOf(".ogg",u.length-4)&&yi.Engine.audioEngine.isOGGsupported&&(c=!0),-1!==u.indexOf(".wav",u.length-4)&&(c=!0),-1!==u.indexOf("blob:")&&(c=!0),c){this._streaming?(this._htmlAudioElement=new Audio(u),this._htmlAudioElement.controls=!1,this._htmlAudioElement.loop=this.loop,yi.Tools.SetCorsBehavior(u,this._htmlAudioElement),this._htmlAudioElement.preload="auto",this._htmlAudioElement.addEventListener("canplaythrough",(function(){o._isReadyToPlay=!0,o.autoplay&&o.play(),o._readyToPlayCallback&&o._readyToPlayCallback()})),document.body.appendChild(this._htmlAudioElement),this._htmlAudioElement.load()):this._scene._loadFile(u,(function(e){o._soundLoaded(e)}),void 0,!0,!0,(function(e){e&&yi.Tools.Error("XHR "+e.status+" error on: "+u+"."),yi.Tools.Error("Sound creation aborted."),o._scene.mainSoundTrack.RemoveSound(o)}));break}}break;default:a=!1}a?c||(this._isReadyToPlay=!0,this._readyToPlayCallback&&window.setTimeout((function(){o._readyToPlayCallback&&o._readyToPlayCallback()}),1e3)):yi.Tools.Error("Parameter must be a URL to the sound, an Array of URLs (.mp3 & .ogg) or an ArrayBuffer of the sound.")}catch(e){yi.Tools.Error("Unexpected error. Sound creation aborted."),this._scene.mainSoundTrack.RemoveSound(this)}}else this._scene.mainSoundTrack.AddSound(this),yi.Engine.audioEngine.WarnedWebAudioUnsupported||(yi.Tools.Error("Web Audio is not supported by your browser."),yi.Engine.audioEngine.WarnedWebAudioUnsupported=!0),this._readyToPlayCallback&&window.setTimeout((function(){o._readyToPlayCallback&&o._readyToPlayCallback()}),1e3)}return d.prototype.dispose=function(){yi.Engine.audioEngine.canUseWebAudio&&(this.isPlaying&&this.stop(),this._isReadyToPlay=!1,-1===this.soundTrackId?this._scene.mainSoundTrack.RemoveSound(this):this._scene.soundTracks&&this._scene.soundTracks[this.soundTrackId].RemoveSound(this),this._soundGain&&(this._soundGain.disconnect(),this._soundGain=null),this._soundPanner&&(this._soundPanner.disconnect(),this._soundPanner=null),this._soundSource&&(this._soundSource.disconnect(),this._soundSource=null),this._audioBuffer=null,this._htmlAudioElement&&(this._htmlAudioElement.pause(),this._htmlAudioElement.src="",document.body.removeChild(this._htmlAudioElement)),this._streamingSource&&this._streamingSource.disconnect(),this._connectedMesh&&this._registerFunc&&(this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._connectedMesh=null))},d.prototype.isReady=function(){return this._isReadyToPlay},d.prototype._soundLoaded=function(e){var t=this;yi.Engine.audioEngine.audioContext&&yi.Engine.audioEngine.audioContext.decodeAudioData(e,(function(e){t._audioBuffer=e,t._isReadyToPlay=!0,t.autoplay&&t.play(),t._readyToPlayCallback&&t._readyToPlayCallback()}),(function(e){yi.Tools.Error("Error while decoding audio data for: "+t.name+" / Error: "+e)}))},d.prototype.setAudioBuffer=function(e){yi.Engine.audioEngine.canUseWebAudio&&(this._audioBuffer=e,this._isReadyToPlay=!0)},d.prototype.updateOptions=function(e){e&&(this.loop=e.loop||this.loop,this.maxDistance=e.maxDistance||this.maxDistance,this.useCustomAttenuation=e.useCustomAttenuation||this.useCustomAttenuation,this.rolloffFactor=e.rolloffFactor||this.rolloffFactor,this.refDistance=e.refDistance||this.refDistance,this.distanceModel=e.distanceModel||this.distanceModel,this._playbackRate=e.playbackRate||this._playbackRate,this._updateSpatialParameters(),this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate)))},d.prototype._createSpatialParameters=function(){yi.Engine.audioEngine.canUseWebAudio&&yi.Engine.audioEngine.audioContext&&(this._scene.headphone&&(this._panningModel="HRTF"),this._soundPanner=yi.Engine.audioEngine.audioContext.createPanner(),this._updateSpatialParameters(),this._soundPanner.connect(this._outputAudioNode),this._inputAudioNode=this._soundPanner)},d.prototype._updateSpatialParameters=function(){this.spatialSound&&this._soundPanner&&(this.useCustomAttenuation?(this._soundPanner.distanceModel="linear",this._soundPanner.maxDistance=Number.MAX_VALUE,this._soundPanner.refDistance=1,this._soundPanner.rolloffFactor=1):(this._soundPanner.distanceModel=this.distanceModel,this._soundPanner.maxDistance=this.maxDistance,this._soundPanner.refDistance=this.refDistance,this._soundPanner.rolloffFactor=this.rolloffFactor),this._soundPanner.panningModel=this._panningModel)},d.prototype.switchPanningModelToHRTF=function(){this._panningModel="HRTF",this._switchPanningModel()},d.prototype.switchPanningModelToEqualPower=function(){this._panningModel="equalpower",this._switchPanningModel()},d.prototype._switchPanningModel=function(){yi.Engine.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.panningModel=this._panningModel)},d.prototype.connectToSoundTrackAudioNode=function(e){yi.Engine.audioEngine.canUseWebAudio&&(this._isOutputConnected&&this._outputAudioNode.disconnect(),this._outputAudioNode.connect(e),this._isOutputConnected=!0)},d.prototype.setDirectionalCone=function(e,t,i){t<e?yi.Tools.Error("setDirectionalCone(): outer angle of the cone must be superior or equal to the inner angle."):(this._coneInnerAngle=e,this._coneOuterAngle=t,this._coneOuterGain=i,this._isDirectional=!0,this.isPlaying&&this.loop&&(this.stop(),this.play()))},Object.defineProperty(d.prototype,"directionalConeInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){if(e!=this._coneInnerAngle){if(this._coneOuterAngle<e)return void yi.Tools.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneInnerAngle=e,yi.Engine.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.coneInnerAngle=this._coneInnerAngle)}},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"directionalConeOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){if(e!=this._coneOuterAngle){if(e<this._coneInnerAngle)return void yi.Tools.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneOuterAngle=e,yi.Engine.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&(this._soundPanner.coneOuterAngle=this._coneOuterAngle)}},enumerable:!0,configurable:!0}),d.prototype.setPosition=function(e){this._position=e,yi.Engine.audioEngine.canUseWebAudio&&this.spatialSound&&this._soundPanner&&!isNaN(this._position.x)&&!isNaN(this._position.y)&&!isNaN(this._position.z)&&this._soundPanner.setPosition(this._position.x,this._position.y,this._position.z)},d.prototype.setLocalDirectionToMesh=function(e){this._localDirection=e,yi.Engine.audioEngine.canUseWebAudio&&this._connectedMesh&&this.isPlaying&&this._updateDirection()},d.prototype._updateDirection=function(){if(this._connectedMesh&&this._soundPanner){var e=this._connectedMesh.getWorldMatrix(),t=yi.Vector3.TransformNormal(this._localDirection,e);t.normalize(),this._soundPanner.setOrientation(t.x,t.y,t.z)}},d.prototype.updateDistanceFromListener=function(){if(yi.Engine.audioEngine.canUseWebAudio&&this._connectedMesh&&this.useCustomAttenuation&&this._soundGain&&this._scene.activeCamera){var e=this._connectedMesh.getDistanceToCamera(this._scene.activeCamera);this._soundGain.gain.value=this._customAttenuationFunction(this._volume,e,this.maxDistance,this.refDistance,this.rolloffFactor)}},d.prototype.setAttenuationFunction=function(e){this._customAttenuationFunction=e},d.prototype.play=function(e,t){var i=this;if(this._isReadyToPlay&&this._scene.audioEnabled&&yi.Engine.audioEngine.audioContext)try{this._startOffset<0&&(e=-this._startOffset,this._startOffset=0);var r=e?yi.Engine.audioEngine.audioContext.currentTime+e:yi.Engine.audioEngine.audioContext.currentTime;if(this._soundSource&&this._streamingSource||this.spatialSound&&this._soundPanner&&(isNaN(this._position.x)||isNaN(this._position.y)||isNaN(this._position.z)||this._soundPanner.setPosition(this._position.x,this._position.y,this._position.z),this._isDirectional&&(this._soundPanner.coneInnerAngle=this._coneInnerAngle,this._soundPanner.coneOuterAngle=this._coneOuterAngle,this._soundPanner.coneOuterGain=this._coneOuterGain,this._connectedMesh?this._updateDirection():this._soundPanner.setOrientation(this._localDirection.x,this._localDirection.y,this._localDirection.z))),this._streaming){if(this._streamingSource||(this._streamingSource=yi.Engine.audioEngine.audioContext.createMediaElementSource(this._htmlAudioElement),this._htmlAudioElement.onended=function(){i._onended()},this._htmlAudioElement.playbackRate=this._playbackRate),this._streamingSource.disconnect(),this._streamingSource.connect(this._inputAudioNode),this._htmlAudioElement){var n=function(){if(yi.Engine.audioEngine.unlocked){var e=i._htmlAudioElement.play();void 0!==e&&e.catch((function(e){yi.Engine.audioEngine.lock(),yi.Engine.audioEngine.onAudioUnlockedObservable.addOnce((function(){n()}))}))}else yi.Engine.audioEngine.onAudioUnlockedObservable.addOnce((function(){n()}))};n()}}else this._soundSource=yi.Engine.audioEngine.audioContext.createBufferSource(),this._soundSource.buffer=this._audioBuffer,this._soundSource.connect(this._inputAudioNode),this._soundSource.loop=this.loop,this._soundSource.playbackRate.value=this._playbackRate,this._soundSource.onended=function(){i._onended()},this._soundSource.buffer&&this._soundSource.start(r,this.isPaused?this._startOffset%this._soundSource.buffer.duration:t||0);this._startTime=r,this.isPlaying=!0,this.isPaused=!1}catch(e){yi.Tools.Error("Error while trying to play audio: "+this.name+", "+e.message)}},d.prototype._onended=function(){this.isPlaying=!1,this.onended&&this.onended(),this.onEndedObservable.notifyObservers(this)},d.prototype.stop=function(e){if(this.isPlaying){if(this._streaming)this._htmlAudioElement?(this._htmlAudioElement.pause(),0<this._htmlAudioElement.currentTime&&(this._htmlAudioElement.currentTime=0)):this._streamingSource.disconnect();else if(yi.Engine.audioEngine.audioContext&&this._soundSource){var t=e?yi.Engine.audioEngine.audioContext.currentTime+e:yi.Engine.audioEngine.audioContext.currentTime;this._soundSource.stop(t),this._soundSource.onended=function(){},this.isPaused||(this._startOffset=0)}this.isPlaying=!1}},d.prototype.pause=function(){this.isPlaying&&(this.isPaused=!0,this._streaming?this._htmlAudioElement?this._htmlAudioElement.pause():this._streamingSource.disconnect():yi.Engine.audioEngine.audioContext&&(this.stop(0),this._startOffset+=yi.Engine.audioEngine.audioContext.currentTime-this._startTime))},d.prototype.setVolume=function(e,t){yi.Engine.audioEngine.canUseWebAudio&&this._soundGain&&(t&&yi.Engine.audioEngine.audioContext?(this._soundGain.gain.cancelScheduledValues(yi.Engine.audioEngine.audioContext.currentTime),this._soundGain.gain.setValueAtTime(this._soundGain.gain.value,yi.Engine.audioEngine.audioContext.currentTime),this._soundGain.gain.linearRampToValueAtTime(e,yi.Engine.audioEngine.audioContext.currentTime+t)):this._soundGain.gain.value=e),this._volume=e},d.prototype.setPlaybackRate=function(e){this._playbackRate=e,this.isPlaying&&(this._streaming&&this._htmlAudioElement?this._htmlAudioElement.playbackRate=this._playbackRate:this._soundSource&&(this._soundSource.playbackRate.value=this._playbackRate))},d.prototype.getVolume=function(){return this._volume},d.prototype.attachToMesh=function(e){var t=this;this._connectedMesh&&this._registerFunc&&(this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null),this._connectedMesh=e,this.spatialSound||(this.spatialSound=!0,this._createSpatialParameters(),this.isPlaying&&this.loop&&(this.stop(),this.play())),this._onRegisterAfterWorldMatrixUpdate(this._connectedMesh),this._registerFunc=function(e){return t._onRegisterAfterWorldMatrixUpdate(e)},e.registerAfterWorldMatrixUpdate(this._registerFunc)},d.prototype.detachFromMesh=function(){this._connectedMesh&&this._registerFunc&&(this._connectedMesh.unregisterAfterWorldMatrixUpdate(this._registerFunc),this._registerFunc=null,this._connectedMesh=null)},d.prototype._onRegisterAfterWorldMatrixUpdate=function(e){if(e.getBoundingInfo){var t=e;if(this._positionInEmitterSpace)t.worldMatrixFromCache.invertToRef(yi.Tmp.Matrix[0]),this.setPosition(yi.Tmp.Matrix[0].getTranslation());else{var i=t.getBoundingInfo();this.setPosition(i.boundingSphere.centerWorld)}yi.Engine.audioEngine.canUseWebAudio&&this._isDirectional&&this.isPlaying&&this._updateDirection()}},d.prototype.clone=function(){var e=this;if(this._streaming)return null;var t=function(){e._isReadyToPlay?(r._audioBuffer=e.getAudioBuffer(),r._isReadyToPlay=!0,r.autoplay&&r.play()):window.setTimeout(t,300)},i={autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,useCustomAttenuation:this.useCustomAttenuation,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel},r=new d(this.name+"_cloned",new ArrayBuffer(0),this._scene,null,i);return this.useCustomAttenuation&&r.setAttenuationFunction(this._customAttenuationFunction),r.setPosition(this._position),r.setPlaybackRate(this._playbackRate),t(),r},d.prototype.getAudioBuffer=function(){return this._audioBuffer},d.prototype.serialize=function(){var e={name:this.name,url:this.name,autoplay:this.autoplay,loop:this.loop,volume:this._volume,spatialSound:this.spatialSound,maxDistance:this.maxDistance,rolloffFactor:this.rolloffFactor,refDistance:this.refDistance,distanceModel:this.distanceModel,playbackRate:this._playbackRate,panningModel:this._panningModel,soundTrackId:this.soundTrackId};return this.spatialSound&&(this._connectedMesh&&(e.connectedMeshId=this._connectedMesh.id),e.position=this._position.asArray(),e.refDistance=this.refDistance,e.distanceModel=this.distanceModel,e.isDirectional=this._isDirectional,e.localDirectionToMesh=this._localDirection.asArray(),e.coneInnerAngle=this._coneInnerAngle,e.coneOuterAngle=this._coneOuterAngle,e.coneOuterGain=this._coneOuterGain),e},d.Parse=function(e,t,i,r){var n,o=e.name;n=e.url?i+e.url:i+o;var s,a={autoplay:e.autoplay,loop:e.loop,volume:e.volume,spatialSound:e.spatialSound,maxDistance:e.maxDistance,rolloffFactor:e.rolloffFactor,refDistance:e.refDistance,distanceModel:e.distanceModel,playbackRate:e.playbackRate};if(r){var l=function(){r._isReadyToPlay?(s._audioBuffer=r.getAudioBuffer(),s._isReadyToPlay=!0,s.autoplay&&s.play()):window.setTimeout(l,300)};s=new d(o,new ArrayBuffer(0),t,null,a),l()}else s=new d(o,n,t,function(){t._removePendingData(s)},a),t._addPendingData(s);if(e.position){var c=yi.Vector3.FromArray(e.position);s.setPosition(c)}if(e.isDirectional&&(s.setDirectionalCone(e.coneInnerAngle||360,e.coneOuterAngle||360,e.coneOuterGain||0),e.localDirectionToMesh)){var h=yi.Vector3.FromArray(e.localDirectionToMesh);s.setLocalDirectionToMesh(h)}if(e.connectedMeshId){var u=t.getMeshByID(e.connectedMeshId);u&&s.attachToMesh(u)}return s},d})(),yi.Sound=bi,Ti=$a||($a={}),Ei=(function(){function e(e,t){void 0===t&&(t={}),this.id=-1,this._isMainTrack=!1,this._isInitialized=!1,this._scene=e,this.soundCollection=new Array,this._options=t,!this._isMainTrack&&this._scene.soundTracks&&(this._scene.soundTracks.push(this),this.id=this._scene.soundTracks.length-1)}return e.prototype._initializeSoundTrackAudioGraph=function(){Ti.Engine.audioEngine.canUseWebAudio&&Ti.Engine.audioEngine.audioContext&&(this._outputAudioNode=Ti.Engine.audioEngine.audioContext.createGain(),this._outputAudioNode.connect(Ti.Engine.audioEngine.masterGain),this._options&&(this._options.volume&&(this._outputAudioNode.gain.value=this._options.volume),this._options.mainTrack&&(this._isMainTrack=this._options.mainTrack)),this._isInitialized=!0)},e.prototype.dispose=function(){if(Ti.Engine.audioEngine&&Ti.Engine.audioEngine.canUseWebAudio){for(this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas();this.soundCollection.length;)this.soundCollection[0].dispose();this._outputAudioNode&&this._outputAudioNode.disconnect(),this._outputAudioNode=null}},e.prototype.AddSound=function(e){this._isInitialized||this._initializeSoundTrackAudioGraph(),Ti.Engine.audioEngine.canUseWebAudio&&this._outputAudioNode&&e.connectToSoundTrackAudioNode(this._outputAudioNode),e.soundTrackId&&(-1===e.soundTrackId?this._scene.mainSoundTrack.RemoveSound(e):this._scene.soundTracks&&this._scene.soundTracks[e.soundTrackId].RemoveSound(e)),this.soundCollection.push(e),e.soundTrackId=this.id},e.prototype.RemoveSound=function(e){var t=this.soundCollection.indexOf(e);-1!==t&&this.soundCollection.splice(t,1)},e.prototype.setVolume=function(e){Ti.Engine.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.gain.value=e)},e.prototype.switchPanningModelToHRTF=function(){if(Ti.Engine.audioEngine.canUseWebAudio)for(var e=0;e<this.soundCollection.length;e++)this.soundCollection[e].switchPanningModelToHRTF()},e.prototype.switchPanningModelToEqualPower=function(){if(Ti.Engine.audioEngine.canUseWebAudio)for(var e=0;e<this.soundCollection.length;e++)this.soundCollection[e].switchPanningModelToEqualPower()},e.prototype.connectToAnalyser=function(e){this._connectedAnalyser&&this._connectedAnalyser.stopDebugCanvas(),this._connectedAnalyser=e,Ti.Engine.audioEngine.canUseWebAudio&&this._outputAudioNode&&(this._outputAudioNode.disconnect(),this._connectedAnalyser.connectAudioNodes(this._outputAudioNode,Ti.Engine.audioEngine.masterGain))},e})(),Ti.SoundTrack=Ei,xi=$a||($a={}),Pi=(function(){function e(e){this.SMOOTHING=.75,this.FFT_SIZE=512,this.BARGRAPHAMPLITUDE=256,this.DEBUGCANVASPOS={x:20,y:20},this.DEBUGCANVASSIZE={width:320,height:200},this._scene=e,this._audioEngine=xi.Engine.audioEngine,this._audioEngine.canUseWebAudio&&this._audioEngine.audioContext&&(this._webAudioAnalyser=this._audioEngine.audioContext.createAnalyser(),this._webAudioAnalyser.minDecibels=-140,this._webAudioAnalyser.maxDecibels=0,this._byteFreqs=new Uint8Array(this._webAudioAnalyser.frequencyBinCount),this._byteTime=new Uint8Array(this._webAudioAnalyser.frequencyBinCount),this._floatFreqs=new Float32Array(this._webAudioAnalyser.frequencyBinCount))}return e.prototype.getFrequencyBinCount=function(){return this._audioEngine.canUseWebAudio?this._webAudioAnalyser.frequencyBinCount:0},e.prototype.getByteFrequencyData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getByteFrequencyData(this._byteFreqs)),this._byteFreqs},e.prototype.getByteTimeDomainData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getByteTimeDomainData(this._byteTime)),this._byteTime},e.prototype.getFloatFrequencyData=function(){return this._audioEngine.canUseWebAudio&&(this._webAudioAnalyser.smoothingTimeConstant=this.SMOOTHING,this._webAudioAnalyser.fftSize=this.FFT_SIZE,this._webAudioAnalyser.getFloatFrequencyData(this._floatFreqs)),this._floatFreqs},e.prototype.drawDebugCanvas=function(){var e=this;if(this._audioEngine.canUseWebAudio&&(this._debugCanvas||(this._debugCanvas=document.createElement("canvas"),this._debugCanvas.width=this.DEBUGCANVASSIZE.width,this._debugCanvas.height=this.DEBUGCANVASSIZE.height,this._debugCanvas.style.position="absolute",this._debugCanvas.style.top=this.DEBUGCANVASPOS.y+"px",this._debugCanvas.style.left=this.DEBUGCANVASPOS.x+"px",this._debugCanvasContext=this._debugCanvas.getContext("2d"),document.body.appendChild(this._debugCanvas),this._registerFunc=function(){e.drawDebugCanvas()},this._scene.registerBeforeRender(this._registerFunc)),this._registerFunc&&this._debugCanvasContext)){var t=this.getByteFrequencyData();this._debugCanvasContext.fillStyle="rgb(0, 0, 0)",this._debugCanvasContext.fillRect(0,0,this.DEBUGCANVASSIZE.width,this.DEBUGCANVASSIZE.height);for(var i=0;i<this.getFrequencyBinCount();i++){var r=t[i]/this.BARGRAPHAMPLITUDE,n=this.DEBUGCANVASSIZE.height*r,o=this.DEBUGCANVASSIZE.height-n-1,s=this.DEBUGCANVASSIZE.width/this.getFrequencyBinCount(),a=i/this.getFrequencyBinCount()*360;this._debugCanvasContext.fillStyle="hsl("+a+", 100%, 50%)",this._debugCanvasContext.fillRect(i*s,o,s,n)}}},e.prototype.stopDebugCanvas=function(){this._debugCanvas&&(this._registerFunc&&(this._scene.unregisterBeforeRender(this._registerFunc),this._registerFunc=null),document.body.removeChild(this._debugCanvas),this._debugCanvas=null,this._debugCanvasContext=null)},e.prototype.connectAudioNodes=function(e,t){this._audioEngine.canUseWebAudio&&(e.connect(this._webAudioAnalyser),this._webAudioAnalyser.connect(t))},e.prototype.dispose=function(){this._audioEngine.canUseWebAudio&&this._webAudioAnalyser.disconnect()},e})(),xi.Analyser=Pi,Ai=$a||($a={}),Si=(function(){function e(e,t,i){var r=this;if(this.loop=!1,this._coneInnerAngle=360,this._coneOuterAngle=360,this._volume=1,this.isPlaying=!1,this.isPaused=!1,this._sounds=[],this._weights=[],t.length!==i.length)throw new Error("Sounds length does not equal weights length");this.loop=e;for(var n=0,o=0,s=this._weights=i;o<s.length;o++){n+=s[o]}for(var a=0<n?1/n:0,l=0;l<this._weights.length;l++)this._weights[l]*=a;this._sounds=t;for(var c=0,h=this._sounds;c<h.length;c++){h[c].onEndedObservable.add((function(){r._onended()}))}}return Object.defineProperty(e.prototype,"directionalConeInnerAngle",{get:function(){return this._coneInnerAngle},set:function(e){if(e!==this._coneInnerAngle){if(this._coneOuterAngle<e)return void Ai.Tools.Error("directionalConeInnerAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneInnerAngle=e;for(var t=0,i=this._sounds;t<i.length;t++){i[t].directionalConeInnerAngle=e}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"directionalConeOuterAngle",{get:function(){return this._coneOuterAngle},set:function(e){if(e!==this._coneOuterAngle){if(e<this._coneInnerAngle)return void Ai.Tools.Error("directionalConeOuterAngle: outer angle of the cone must be superior or equal to the inner angle.");this._coneOuterAngle=e;for(var t=0,i=this._sounds;t<i.length;t++){i[t].directionalConeOuterAngle=e}}},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"volume",{get:function(){return this._volume},set:function(e){if(e!==this._volume)for(var t=0,i=this._sounds;t<i.length;t++){i[t].setVolume(e)}},enumerable:!0,configurable:!0}),e.prototype._onended=function(){void 0!==this._currentIndex&&(this._sounds[this._currentIndex].autoplay=!1),this.loop&&this.isPlaying?this.play():this.isPlaying=!1},e.prototype.pause=function(){this.isPaused=!0,void 0!==this._currentIndex&&this._sounds[this._currentIndex].pause()},e.prototype.stop=function(){this.isPlaying=!1,void 0!==this._currentIndex&&this._sounds[this._currentIndex].stop()},e.prototype.play=function(e){if(!this.isPaused){this.stop();for(var t=Math.random(),i=0,r=0;r<this._weights.length;r++)if(t<=(i+=this._weights[r])){this._currentIndex=r;break}}var n=this._sounds[this._currentIndex];n.isReady()?n.play(0,this.isPaused?void 0:e):n.autoplay=!0,this.isPlaying=!0,this.isPaused=!1},e})(),Ai.WeightedSound=Si,(function(c){c.AbstractScene.AddParser(c.SceneComponentConstants.NAME_AUDIO,(function(e,t,i,r){var n,o=[];if(i.sounds=i.sounds||[],void 0!==e.sounds&&null!==e.sounds)for(var s=0,a=e.sounds.length;s<a;s++){var l=e.sounds[s];c.Engine.audioEngine.canUseWebAudio?(l.url||(l.url=l.name),o[l.url]?i.sounds.push(c.Sound.Parse(l,t,r,o[l.url])):(n=c.Sound.Parse(l,t,r),o[l.url]=n,i.sounds.push(n))):i.sounds.push(new c.Sound(l.name,null,t))}o=[]})),Object.defineProperty(c.Scene.prototype,"mainSoundTrack",{get:function(){var e=this._getComponent(c.SceneComponentConstants.NAME_AUDIO);return e||(e=new i(this),this._addComponent(e)),this._mainSoundTrack||(this._mainSoundTrack=new c.SoundTrack(this,{mainTrack:!0})),this._mainSoundTrack},enumerable:!0,configurable:!0}),c.Scene.prototype.getSoundByName=function(e){var t;for(t=0;t<this.mainSoundTrack.soundCollection.length;t++)if(this.mainSoundTrack.soundCollection[t].name===e)return this.mainSoundTrack.soundCollection[t];if(this.soundTracks)for(var i=0;i<this.soundTracks.length;i++)for(t=0;t<this.soundTracks[i].soundCollection.length;t++)if(this.soundTracks[i].soundCollection[t].name===e)return this.soundTracks[i].soundCollection[t];return null},Object.defineProperty(c.Scene.prototype,"audioEnabled",{get:function(){var e=this._getComponent(c.SceneComponentConstants.NAME_AUDIO);return e||(e=new i(this),this._addComponent(e)),e.audioEnabled},set:function(e){var t=this._getComponent(c.SceneComponentConstants.NAME_AUDIO);t||(t=new i(this),this._addComponent(t)),e?t.enableAudio():t.disableAudio()},enumerable:!0,configurable:!0}),Object.defineProperty(c.Scene.prototype,"headphone",{get:function(){var e=this._getComponent(c.SceneComponentConstants.NAME_AUDIO);return e||(e=new i(this),this._addComponent(e)),e.headphone},set:function(e){var t=this._getComponent(c.SceneComponentConstants.NAME_AUDIO);t||(t=new i(this),this._addComponent(t)),e?t.switchAudioModeForHeadphones():t.switchAudioModeForNormalSpeakers()},enumerable:!0,configurable:!0});var i=(function(){function e(e){this.name=c.SceneComponentConstants.NAME_AUDIO,this._audioEnabled=!0,this._headphone=!1,(this.scene=e).soundTracks=new Array,e.sounds=new Array}return Object.defineProperty(e.prototype,"audioEnabled",{get:function(){return this._audioEnabled},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"headphone",{get:function(){return this._headphone},enumerable:!0,configurable:!0}),e.prototype.register=function(){this.scene._afterRenderStage.registerStep(c.SceneComponentConstants.STEP_AFTERRENDER_AUDIO,this,this._afterRender)},e.prototype.rebuild=function(){},e.prototype.serialize=function(e){if(e.sounds=[],this.scene.soundTracks)for(var t=0;t<this.scene.soundTracks.length;t++)for(var i=this.scene.soundTracks[t],r=0;r<i.soundCollection.length;r++)e.sounds.push(i.soundCollection[r].serialize())},e.prototype.addFromContainer=function(e){var t=this;e.sounds&&e.sounds.forEach((function(e){e.play(),e.autoplay=!0,t.scene.mainSoundTrack.AddSound(e)}))},e.prototype.removeFromContainer=function(e){var t=this;e.sounds&&e.sounds.forEach((function(e){e.stop(),e.autoplay=!1,t.scene.mainSoundTrack.RemoveSound(e)}))},e.prototype.dispose=function(){var e=this.scene;if(e._mainSoundTrack&&e.mainSoundTrack.dispose(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].dispose()},e.prototype.disableAudio=function(){var e,t=this.scene;for(this._audioEnabled=!1,e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].pause();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(var i=0;i<t.soundTracks[e].soundCollection.length;i++)t.soundTracks[e].soundCollection[i].pause()},e.prototype.enableAudio=function(){var e,t=this.scene;for(this._audioEnabled=!0,e=0;e<t.mainSoundTrack.soundCollection.length;e++)t.mainSoundTrack.soundCollection[e].isPaused&&t.mainSoundTrack.soundCollection[e].play();if(t.soundTracks)for(e=0;e<t.soundTracks.length;e++)for(var i=0;i<t.soundTracks[e].soundCollection.length;i++)t.soundTracks[e].soundCollection[i].isPaused&&t.soundTracks[e].soundCollection[i].play()},e.prototype.switchAudioModeForHeadphones=function(){var e=this.scene;if(this._headphone=!0,e.mainSoundTrack.switchPanningModelToHRTF(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToHRTF()},e.prototype.switchAudioModeForNormalSpeakers=function(){var e=this.scene;if(this._headphone=!1,e.mainSoundTrack.switchPanningModelToEqualPower(),e.soundTracks)for(var t=0;t<e.soundTracks.length;t++)e.soundTracks[t].switchPanningModelToEqualPower()},e.prototype._afterRender=function(){var e=this.scene;if(this._audioEnabled&&e._mainSoundTrack&&e.soundTracks&&(0!==e._mainSoundTrack.soundCollection.length||1!==e.soundTracks.length)){var t,i=c.Engine.audioEngine;if((t=0<e.activeCameras.length?e.activeCameras[0]:e.activeCamera)&&i.audioContext){i.audioContext.listener.setPosition(t.position.x,t.position.y,t.position.z),t.rigCameras&&0<t.rigCameras.length&&(t=t.rigCameras[0]);var r,n=c.Matrix.Invert(t.getViewMatrix()),o=c.Vector3.TransformNormal(new c.Vector3(0,0,-1),n);for(o.normalize(),isNaN(o.x)||isNaN(o.y)||isNaN(o.z)||i.audioContext.listener.setOrientation(o.x,o.y,o.z,0,1,0),r=0;r<e.mainSoundTrack.soundCollection.length;r++){var s=e.mainSoundTrack.soundCollection[r];s.useCustomAttenuation&&s.updateDistanceFromListener()}if(e.soundTracks)for(r=0;r<e.soundTracks.length;r++)for(var a=0;a<e.soundTracks[r].soundCollection.length;a++)(s=e.soundTracks[r].soundCollection[a]).useCustomAttenuation&&s.updateDistanceFromListener()}}},e})();c.AudioSceneComponent=i})($a||($a={})),(function(e){var t=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r._sound=t,r}return T(e,n),e.prototype._prepare=function(){},e.prototype.execute=function(){void 0!==this._sound&&this._sound.play()},e.prototype.serialize=function(e){return n.prototype._serialize.call(this,{name:"PlaySoundAction",properties:[{name:"sound",value:this._sound.name}]},e)},e})(e.Action);e.PlaySoundAction=t;var i=(function(n){function e(e,t,i){var r=n.call(this,e,i)||this;return r._sound=t,r}return T(e,n),e.prototype._prepare=function(){},e.prototype.execute=function(){void 0!==this._sound&&this._sound.stop()},e.prototype.serialize=function(e){return n.prototype._serialize.call(this,{name:"StopSoundAction",properties:[{name:"sound",value:this._sound.name}]},e)},e})(e.Action);e.StopSoundAction=i})($a||($a={})),Mi=$a||($a={}),Ri=(function(y){function s(e,t,i,r,n,o,s,a,l,c,h,u,d){void 0===i&&(i=null),void 0===r&&(r=!1),void 0===n&&(n=null),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=Mi.Engine.TEXTUREFORMAT_RGBA),void 0===l&&(l=!1),void 0===c&&(c=null),void 0===h&&(h=!1),void 0===u&&(u=.8),void 0===d&&(d=0);var f=y.call(this,t)||this;if(f.boundingBoxPosition=Mi.Vector3.Zero(),f._rotationY=0,f._prefiltered=!1,f.name=e,f.url=e,f._noMipmap=r,f.hasAlpha=!1,f._format=a,f.isCube=!0,f._textureMatrix=Mi.Matrix.Identity(),f._createPolynomials=h,f.coordinatesMode=Mi.Texture.CUBIC_MODE,!e&&!n)return f;var p=e.lastIndexOf("."),_=c||(-1<p?e.substring(p).toLowerCase():""),m=".dds"===_,g=".env"===_;if(g?(f.gammaSpace=!1,f._prefiltered=!1):(f._prefiltered=l)&&(f.gammaSpace=!1),f._texture=f._getFromCache(e,r),!n&&(g||m||i||(i=["_px.jpg","_py.jpg","_pz.jpg","_nx.jpg","_ny.jpg","_nz.jpg"]),n=[],i))for(var v=0;v<i.length;v++)n.push(e+i[v]);return f._files=n,f._texture?o&&(f._texture.isReady?Mi.Tools.SetImmediate((function(){return o()})):f._texture.onLoadedObservable.add(o)):t.useDelayedTextureLoading?f.delayLoadState=Mi.Engine.DELAYLOADSTATE_NOTLOADED:f._texture=l?t.getEngine().createPrefilteredCubeTexture(e,t,u,d,o,s,a,c,f._createPolynomials):t.getEngine().createCubeTexture(e,t,n,r,o,s,f._format,c,!1,u,d),f}return T(s,y),Object.defineProperty(s.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){if(!this._boundingBoxSize||!this._boundingBoxSize.equals(e)){this._boundingBoxSize=e;var t=this.getScene();t&&t.markAllMaterialsAsDirty(Mi.Material.TextureDirtyFlag)}},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(Mi.Matrix.RotationY(this._rotationY))},enumerable:!0,configurable:!0}),s.CreateFromImages=function(e,t,i){var r="";return e.forEach((function(e){return r+=e})),new s(r,t,null,i,e)},s.CreateFromPrefilteredData=function(e,t,i,r){return void 0===i&&(i=null),void 0===r&&(r=!0),new s(e,t,null,!1,null,null,null,void 0,!0,i,r)},s.prototype.delayLoad=function(){if(this.delayLoadState===Mi.Engine.DELAYLOADSTATE_NOTLOADED){var e=this.getScene();e&&(this.delayLoadState=Mi.Engine.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||(this._prefiltered?this._texture=e.getEngine().createPrefilteredCubeTexture(this.url,e,this.lodGenerationScale,this.lodGenerationOffset,void 0,void 0,this._format,void 0,this._createPolynomials):this._texture=e.getEngine().createCubeTexture(this.url,e,this._files,this._noMipmap,void 0,void 0,this._format)))}},s.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},s.prototype.setReflectionTextureMatrix=function(e){this._textureMatrix=e},s.Parse=function(t,i,r){var e=Mi.SerializationHelper.Parse((function(){var e=!1;return t.prefiltered&&(e=t.prefiltered),new s(r+t.name,i,t.extensions,!1,null,null,null,void 0,e)}),t,i);if(t.boundingBoxPosition&&(e.boundingBoxPosition=Mi.Vector3.FromArray(t.boundingBoxPosition)),t.boundingBoxSize&&(e.boundingBoxSize=Mi.Vector3.FromArray(t.boundingBoxSize)),t.animations)for(var n=0;n<t.animations.length;n++){var o=t.animations[n];e.animations.push(Mi.Animation.Parse(o))}return e},s.prototype.clone=function(){var t=this;return Mi.SerializationHelper.Clone((function(){var e=t.getScene();return e?new s(t.url,e,t._extensions,t._noMipmap,t._files):t}),this)},b([Mi.serialize("rotationY")],s.prototype,"rotationY",null),s})(Mi.BaseTexture),Mi.CubeTexture=Ri,Ci=$a||($a={}),Oi=(function(h){function n(e,t,i,r,n,o,s,a,l){void 0===r&&(r=Ci.Engine.TEXTUREFORMAT_RGBA),void 0===n&&(n=Ci.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=Ci.Texture.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=null);var c=h.call(this,"",e)||this;return c._texture=e.getEngine().createRawCubeTexture(t,i,r,n,o,s,a,l),c}return T(n,h),n.prototype.update=function(e,t,i,r,n,o){void 0===n&&(n=null),void 0===o&&(o=0),this._texture.getEngine().updateRawCubeTexture(this._texture,e,t,i,r,n)},n.prototype.updateRGBDAsync=function(e,t,i,r){return void 0===t&&(t=null),void 0===i&&(i=.8),void 0===r&&(r=0),n._UpdateRGBDAsync(this._texture,e,t,i,r)},n.prototype.clone=function(){var r=this;return Ci.SerializationHelper.Clone((function(){var e=r.getScene(),t=r._texture,i=new n(e,t._bufferViewArray,t.width,t.format,t.type,t.generateMipMaps,t.invertY,t.samplingMode,t._compression);return t.dataSource===Ci.InternalTexture.DATASOURCE_CUBERAW_RGBD&&i.updateRGBDAsync(t._bufferViewArrayArray,t._sphericalPolynomial,t._lodGenerationScale,t._lodGenerationOffset),i}),this)},n._UpdateRGBDAsync=function(e,t,i,r,n){return e._dataSource=Ci.InternalTexture.DATASOURCE_CUBERAW_RGBD,e._bufferViewArrayArray=t,e._lodGenerationScale=r,e._lodGenerationOffset=n,e._sphericalPolynomial=i,Ci.EnvironmentTextureTools.UploadLevelsAsync(e,t).then((function(){e.isReady=!0}))},n})(Ci.CubeTexture),Ci.RawCubeTexture=Oi,Di=$a||($a={}),Ii=(function(f){function i(e,t,i,r,n,o,s,a,l,c,h,u){void 0===n&&(n=!0),void 0===o&&(o=Di.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===s&&(s=!1),void 0===a&&(a=Di.Texture.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=!0),void 0===c&&(c=!1),void 0===h&&(h=!1),void 0===u&&(u=Di.Engine.TEXTUREFORMAT_RGBA);var d=f.call(this,null,i,!r)||this;return d.isCube=s,d.renderParticles=!0,d.renderSprites=!1,d.coordinatesMode=Di.Texture.PROJECTION_MODE,d.ignoreCameraViewport=!1,d.onBeforeBindObservable=new Di.Observable,d.onAfterUnbindObservable=new Di.Observable,d.onBeforeRenderObservable=new Di.Observable,d.onAfterRenderObservable=new Di.Observable,d.onClearObservable=new Di.Observable,d._currentRefreshId=-1,d._refreshRate=1,d._samples=1,d.boundingBoxPosition=Di.Vector3.Zero(),(i=d.getScene())?(d.renderList=new Array,d._engine=i.getEngine(),d.name=e,d.isRenderTarget=!0,d._initialSizeParameter=t,d._processSizeParameter(t),d._resizeObserver=d.getScene().getEngine().onResizeObservable.add((function(){})),d._generateMipMaps=!!r,d._doNotChangeAspectRatio=n,d._renderingManager=new Di.RenderingManager(i),d._renderingManager._useSceneAutoClearSetup=!0,h||(d._renderTargetOptions={generateMipMaps:r,type:o,format:u,samplingMode:a,generateDepthBuffer:l,generateStencilBuffer:c},a===Di.Texture.NEAREST_SAMPLINGMODE&&(d.wrapU=Di.Texture.CLAMP_ADDRESSMODE,d.wrapV=Di.Texture.CLAMP_ADDRESSMODE),s?(d._texture=i.getEngine().createRenderTargetCubeTexture(d.getRenderSize(),d._renderTargetOptions),d.coordinatesMode=Di.Texture.INVCUBIC_MODE,d._textureMatrix=Di.Matrix.Identity()):d._texture=i.getEngine().createRenderTargetTexture(d._size,d._renderTargetOptions)),d):d}return T(i,f),Object.defineProperty(i.prototype,"renderList",{get:function(){return this._renderList},set:function(e){this._renderList=e,this._renderList&&this._hookArray(this._renderList)},enumerable:!0,configurable:!0}),i.prototype._hookArray=function(n){var o=this,s=n.push;n.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=0===n.length,r=s.apply(n,e);return i&&o.getScene().meshes.forEach((function(e){e._markSubMeshesAsLightDirty()})),r};var r=n.splice;n.splice=function(e,t){var i=r.apply(n,[e,t]);return 0===n.length&&o.getScene().meshes.forEach((function(e){e._markSubMeshesAsLightDirty()})),i}},Object.defineProperty(i.prototype,"onAfterUnbind",{set:function(e){this._onAfterUnbindObserver&&this.onAfterUnbindObservable.remove(this._onAfterUnbindObserver),this._onAfterUnbindObserver=this.onAfterUnbindObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"onClear",{set:function(e){this._onClearObserver&&this.onClearObservable.remove(this._onClearObserver),this._onClearObserver=this.onClearObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"renderTargetOptions",{get:function(){return this._renderTargetOptions},enumerable:!0,configurable:!0}),i.prototype._onRatioRescale=function(){this._sizeRatio&&this.resize(this._initialSizeParameter)},Object.defineProperty(i.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){if(!this._boundingBoxSize||!this._boundingBoxSize.equals(e)){this._boundingBoxSize=e;var t=this.getScene();t&&t.markAllMaterialsAsDirty(Di.Material.TextureDirtyFlag)}},enumerable:!0,configurable:!0}),i.prototype.createDepthStencilTexture=function(e,t,i){if(void 0===e&&(e=0),void 0===t&&(t=!0),void 0===i&&(i=!1),this.getScene()){var r=this.getScene().getEngine();this.depthStencilTexture=r.createDepthStencilTexture(this._size,{bilinearFiltering:t,comparisonFunction:e,generateStencil:i,isCube:this.isCube}),r.setFrameBufferDepthStencilTexture(this)}},i.prototype._processSizeParameter=function(e){e.ratio?(this._sizeRatio=e.ratio,this._size={width:this._bestReflectionRenderTargetDimension(this._engine.getRenderWidth(),this._sizeRatio),height:this._bestReflectionRenderTargetDimension(this._engine.getRenderHeight(),this._sizeRatio)}):this._size=e},Object.defineProperty(i.prototype,"samples",{get:function(){return this._samples},set:function(e){if(this._samples!==e){var t=this.getScene();t&&(this._samples=t.getEngine().updateRenderTargetTextureSampleCount(this._texture,e))}},enumerable:!0,configurable:!0}),i.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},Object.defineProperty(i.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!0,configurable:!0}),i.prototype.addPostProcess=function(e){if(!this._postProcessManager){var t=this.getScene();if(!t)return;this._postProcessManager=new Di.PostProcessManager(t),this._postProcesses=new Array}this._postProcesses.push(e),this._postProcesses[0].autoClear=!1},i.prototype.clearPostProcesses=function(e){if(void 0===e&&(e=!1),this._postProcesses){if(e)for(var t=0,i=this._postProcesses;t<i.length;t++){i[t].dispose()}this._postProcesses=[]}},i.prototype.removePostProcess=function(e){if(this._postProcesses){var t=this._postProcesses.indexOf(e);-1!==t&&(this._postProcesses.splice(t,1),0<this._postProcesses.length&&(this._postProcesses[0].autoClear=!1))}},i.prototype._shouldRender=function(){return-1===this._currentRefreshId?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)},i.prototype.getRenderSize=function(){return this.getRenderWidth()},i.prototype.getRenderWidth=function(){return this._size.width?this._size.width:this._size},i.prototype.getRenderHeight=function(){return this._size.width?this._size.height:this._size},Object.defineProperty(i.prototype,"canRescale",{get:function(){return!0},enumerable:!0,configurable:!0}),i.prototype.scale=function(e){var t=this.getRenderSize()*e;this.resize(t)},i.prototype.getReflectionTextureMatrix=function(){return this.isCube?this._textureMatrix:f.prototype.getReflectionTextureMatrix.call(this)},i.prototype.resize=function(e){this.releaseInternalTexture();var t=this.getScene();t&&(this._processSizeParameter(e),this.isCube?this._texture=t.getEngine().createRenderTargetCubeTexture(this.getRenderSize(),this._renderTargetOptions):this._texture=t.getEngine().createRenderTargetTexture(this._size,this._renderTargetOptions))},i.prototype.render=function(e,t){if(void 0===e&&(e=!1),void 0===t&&(t=!1),a=this.getScene()){var i,r=a.getEngine();if(void 0!==this.useCameraPostProcesses&&(e=this.useCameraPostProcesses),this._waitingRenderList){this.renderList=[];for(var n=0;n<this._waitingRenderList.length;n++){var o=this._waitingRenderList[n],s=a.getMeshByID(o);s&&this.renderList.push(s)}delete this._waitingRenderList}if(this.renderListPredicate){var a;if(this.renderList?this.renderList.splice(0):this.renderList=[],!(a=this.getScene()))return;var l=a.meshes;for(n=0;n<l.length;n++){var c=l[n];this.renderListPredicate(c)&&this.renderList.push(c)}}this.onBeforeBindObservable.notifyObservers(this),this.activeCamera?(i=this.activeCamera,r.setViewport(this.activeCamera.viewport,this.getRenderWidth(),this.getRenderHeight()),this.activeCamera!==a.activeCamera&&a.setTransformMatrix(this.activeCamera.getViewMatrix(),this.activeCamera.getProjectionMatrix(!0))):(i=a.activeCamera)&&r.setViewport(i.viewport,this.getRenderWidth(),this.getRenderHeight()),this._renderingManager.reset();for(var h=this.renderList?this.renderList:a.getActiveMeshes().data,u=this.renderList?this.renderList.length:a.getActiveMeshes().length,d=a.getRenderId(),f=0;f<u;f++){if(c=h[f]){if(!c.isReady(0===this.refreshRate)){this.resetRefreshCounter();continue}c._preActivateForIntermediateRendering(d);var p=void 0;if(p=!(this.renderList||!i)&&0==(c.layerMask&i.layerMask),c.isEnabled()&&c.isVisible&&c.subMeshes&&!p){c._activate(d);for(var _=0;_<c.subMeshes.length;_++){var m=c.subMeshes[_];a._activeIndices.addCount(m.indexCount,!1),this._renderingManager.dispatch(m,c)}}}}for(var g=0;g<a.particleSystems.length;g++){var v=a.particleSystems[g],y=v.emitter;v.isStarted()&&y&&y.position&&y.isEnabled()&&(0<=h.indexOf(y)&&this._renderingManager.dispatchParticles(v))}if(this.isCube)for(var b=0;b<6;b++)this.renderToTarget(b,h,u,e,t),a.incrementRenderId(),a.resetCachedMaterial();else this.renderToTarget(0,h,u,e,t);this.onAfterUnbindObservable.notifyObservers(this),a.activeCamera&&(this.activeCamera&&this.activeCamera!==a.activeCamera&&a.setTransformMatrix(a.activeCamera.getViewMatrix(),a.activeCamera.getProjectionMatrix(!0)),r.setViewport(a.activeCamera.viewport)),a.resetCachedMaterial()}},i.prototype._bestReflectionRenderTargetDimension=function(e,t){var i=e*t,r=Di.Tools.NearestPOT(i+16384/(128+i));return Math.min(Di.Tools.FloorPOT(e),r)},i.prototype.unbindFrameBuffer=function(e,t){var i=this;this._texture&&e.unBindFramebuffer(this._texture,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},i.prototype.renderToTarget=function(e,t,i,r,n){var o=this.getScene();if(o){var s=o.getEngine();this._texture&&(this._postProcessManager?this._postProcessManager._prepareFrame(this._texture,this._postProcesses):r&&o.postProcessManager._prepareFrame(this._texture)||this._texture&&s.bindFramebuffer(this._texture,this.isCube?e:void 0,void 0,void 0,this.ignoreCameraViewport,this.depthStencilTexture?this.depthStencilTexture:void 0),this.onBeforeRenderObservable.notifyObservers(e),this.onClearObservable.hasObservers()?this.onClearObservable.notifyObservers(s):s.clear(this.clearColor||o.clearColor,!0,!0,!0),this._doNotChangeAspectRatio||o.updateTransformMatrix(!0),this._renderingManager.render(this.customRenderFunction,t,this.renderParticles,this.renderSprites),this._postProcessManager?this._postProcessManager._finalizeFrame(!1,this._texture,e,this._postProcesses,this.ignoreCameraViewport):r&&o.postProcessManager._finalizeFrame(!1,this._texture,e),this._doNotChangeAspectRatio||o.updateTransformMatrix(!0),n&&Di.Tools.DumpFramebuffer(this.getRenderWidth(),this.getRenderHeight(),s),this.isCube&&5!==e?this.onAfterRenderObservable.notifyObservers(e):(this.isCube&&5===e&&s.generateMipMapsForCubemap(this._texture),this.unbindFrameBuffer(s,e)))}},i.prototype.setRenderingOrder=function(e,t,i,r){void 0===t&&(t=null),void 0===i&&(i=null),void 0===r&&(r=null),this._renderingManager.setRenderingOrder(e,t,i,r)},i.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderingManager.setRenderingAutoClearDepthStencil(e,t),this._renderingManager._useSceneAutoClearSetup=!1},i.prototype.clone=function(){var e=this.getSize(),t=new i(this.name,e,this.getScene(),this._renderTargetOptions.generateMipMaps,this._doNotChangeAspectRatio,this._renderTargetOptions.type,this.isCube,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer,this._renderTargetOptions.generateStencilBuffer);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,this.renderList&&(t.renderList=this.renderList.slice(0)),t},i.prototype.serialize=function(){if(!this.name)return null;var e=f.prototype.serialize.call(this);if(e.renderTargetSize=this.getRenderSize(),e.renderList=[],this.renderList)for(var t=0;t<this.renderList.length;t++)e.renderList.push(this.renderList[t].id);return e},i.prototype.disposeFramebufferObjects=function(){var e=this.getInternalTexture(),t=this.getScene();e&&t&&t.getEngine()._releaseFramebufferObjects(e)},i.prototype.dispose=function(){this._postProcessManager&&(this._postProcessManager.dispose(),this._postProcessManager=null),this.clearPostProcesses(!0),this._resizeObserver&&(this.getScene().getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this.renderList=null;var e=this.getScene();if(e){var t=e.customRenderTargets.indexOf(this);0<=t&&e.customRenderTargets.splice(t,1);for(var i=0,r=e.cameras;i<r.length;i++){var n=r[i];0<=(t=n.customRenderTargets.indexOf(this))&&n.customRenderTargets.splice(t,1)}f.prototype.dispose.call(this)}},i.prototype._rebuild=function(){this.refreshRate===i.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=i.REFRESHRATE_RENDER_ONCE),this._postProcessManager&&this._postProcessManager._rebuild()},i.prototype.freeRenderingGroups=function(){this._renderingManager&&this._renderingManager.freeRenderingGroups()},i.REFRESHRATE_RENDER_ONCE=0,i.REFRESHRATE_RENDER_ONEVERYFRAME=1,i.REFRESHRATE_RENDER_ONEVERYTWOFRAMES=2,i})(Di.Texture),Di.RenderTargetTexture=Ii,wi=$a||($a={}),Li=(function(p){function e(e,t,i,r,n){var o=this,s=!(!n||!n.generateMipMaps)&&n.generateMipMaps,a=!(!n||!n.generateDepthTexture)&&n.generateDepthTexture,l=!n||void 0===n.doNotChangeAspectRatio||n.doNotChangeAspectRatio;if((o=p.call(this,e,t,r,s,l)||this)._engine=r.getEngine(),o.isSupported){for(var c=[],h=[],u=0;u<i;u++)n&&n.types&&void 0!==n.types[u]?c.push(n.types[u]):c.push(n&&n.defaultType?n.defaultType:wi.Engine.TEXTURETYPE_UNSIGNED_INT),n&&n.samplingModes&&void 0!==n.samplingModes[u]?h.push(n.samplingModes[u]):h.push(wi.Texture.BILINEAR_SAMPLINGMODE);var d=!n||void 0===n.generateDepthBuffer||n.generateDepthBuffer,f=!(!n||void 0===n.generateStencilBuffer)&&n.generateStencilBuffer;return o._size=t,o._multiRenderTargetOptions={samplingModes:h,generateMipMaps:s,generateDepthBuffer:d,generateStencilBuffer:f,generateDepthTexture:a,types:c,textureCount:i},o._createInternalTextures(),o._createTextures(),o}o.dispose()}return T(e,p),Object.defineProperty(e.prototype,"isSupported",{get:function(){return 1<this._engine.webGLVersion||this._engine.getCaps().drawBuffersExtension},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textures",{get:function(){return this._textures},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthTexture",{get:function(){return this._textures[this._textures.length-1]},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"wrapU",{set:function(e){if(this._textures)for(var t=0;t<this._textures.length;t++)this._textures[t].wrapU=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"wrapV",{set:function(e){if(this._textures)for(var t=0;t<this._textures.length;t++)this._textures[t].wrapV=e},enumerable:!0,configurable:!0}),e.prototype._rebuild=function(){this.releaseInternalTextures(),this._createInternalTextures();for(var e=0;e<this._internalTextures.length;e++){this._textures[e]._texture=this._internalTextures[e]}this._texture=this._internalTextures[0]},e.prototype._createInternalTextures=function(){this._internalTextures=this._engine.createMultipleRenderTarget(this._size,this._multiRenderTargetOptions)},e.prototype._createTextures=function(){this._textures=[];for(var e=0;e<this._internalTextures.length;e++){var t=new wi.Texture(null,this.getScene());t._texture=this._internalTextures[e],this._textures.push(t)}this._texture=this._internalTextures[0]},Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=this._engine.updateMultipleRenderTargetTextureSampleCount(this._internalTextures,e))},enumerable:!0,configurable:!0}),e.prototype.resize=function(e){this.releaseInternalTextures(),this._internalTextures=this._engine.createMultipleRenderTarget(e,this._multiRenderTargetOptions),this._createInternalTextures()},e.prototype.unbindFrameBuffer=function(e,t){var i=this;e.unBindMultiColorAttachmentFramebuffer(this._internalTextures,this.isCube,(function(){i.onAfterRenderObservable.notifyObservers(t)}))},e.prototype.dispose=function(){this.releaseInternalTextures(),p.prototype.dispose.call(this)},e.prototype.releaseInternalTextures=function(){if(this._internalTextures)for(var e=this._internalTextures.length-1;0<=e;e--)void 0!==this._internalTextures[e]&&(this._internalTextures[e].dispose(),this._internalTextures.splice(e,1))},e})(wi.RenderTargetTexture),wi.MultiRenderTarget=Li,Fi=$a||($a={}),Bi=(function(l){function r(e,t,i,r,n,o,s){void 0===n&&(n=Fi.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===o&&(o=Fi.Texture.BILINEAR_SAMPLINGMODE),void 0===s&&(s=!0);var a=l.call(this,e,t,i,r,!0,n,!1,o,s)||this;return a.scene=i,a.mirrorPlane=new Fi.Plane(0,1,0,1),a._transformMatrix=Fi.Matrix.Zero(),a._mirrorMatrix=Fi.Matrix.Zero(),a._adaptiveBlurKernel=0,a._blurKernelX=0,a._blurKernelY=0,a._blurRatio=1,a.ignoreCameraViewport=!0,a._updateGammaSpace(),a._imageProcessingConfigChangeObserver=i.imageProcessingConfiguration.onUpdateParameters.add((function(){a._updateGammaSpace})),a.onBeforeRenderObservable.add((function(){Fi.Matrix.ReflectionToRef(a.mirrorPlane,a._mirrorMatrix),a._savedViewMatrix=i.getViewMatrix(),a._mirrorMatrix.multiplyToRef(a._savedViewMatrix,a._transformMatrix),i.setTransformMatrix(a._transformMatrix,i.getProjectionMatrix()),i.clipPlane=a.mirrorPlane,i.getEngine().cullBackFaces=!1,i._mirroredCameraPosition=Fi.Vector3.TransformCoordinates(i.activeCamera.globalPosition,a._mirrorMatrix)})),a.onAfterRenderObservable.add((function(){i.setTransformMatrix(a._savedViewMatrix,i.getProjectionMatrix()),i.getEngine().cullBackFaces=!0,i._mirroredCameraPosition=null,delete i.clipPlane})),a}return T(r,l),Object.defineProperty(r.prototype,"blurRatio",{get:function(){return this._blurRatio},set:function(e){this._blurRatio!==e&&(this._blurRatio=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"adaptiveBlurKernel",{set:function(e){this._adaptiveBlurKernel=e,this._autoComputeBlurKernel()},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"blurKernel",{set:function(e){this.blurKernelX=e,this.blurKernelY=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"blurKernelX",{get:function(){return this._blurKernelX},set:function(e){this._blurKernelX!==e&&(this._blurKernelX=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"blurKernelY",{get:function(){return this._blurKernelY},set:function(e){this._blurKernelY!==e&&(this._blurKernelY=e,this._preparePostProcesses())},enumerable:!0,configurable:!0}),r.prototype._autoComputeBlurKernel=function(){var e=this.getScene().getEngine(),t=this.getRenderWidth()/e.getRenderWidth(),i=this.getRenderHeight()/e.getRenderHeight();this.blurKernelX=this._adaptiveBlurKernel*t,this.blurKernelY=this._adaptiveBlurKernel*i},r.prototype._onRatioRescale=function(){this._sizeRatio&&(this.resize(this._initialSizeParameter),this._adaptiveBlurKernel||this._preparePostProcesses()),this._adaptiveBlurKernel&&this._autoComputeBlurKernel()},r.prototype._updateGammaSpace=function(){this.gammaSpace=!this.scene.imageProcessingConfiguration.isEnabled||!this.scene.imageProcessingConfiguration.applyByPostProcess},r.prototype._preparePostProcesses=function(){if(this.clearPostProcesses(!0),this._blurKernelX&&this._blurKernelY){var e=this.getScene().getEngine(),t=e.getCaps().textureFloatRender?Fi.Engine.TEXTURETYPE_FLOAT:Fi.Engine.TEXTURETYPE_HALF_FLOAT;this._blurX=new Fi.BlurPostProcess("horizontal blur",new Fi.Vector2(1,0),this._blurKernelX,this._blurRatio,null,Fi.Texture.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurX.autoClear=!1,1===this._blurRatio&&this.samples<2&&this._texture?this._blurX.inputTexture=this._texture:this._blurX.alwaysForcePOT=!0,this._blurY=new Fi.BlurPostProcess("vertical blur",new Fi.Vector2(0,1),this._blurKernelY,this._blurRatio,null,Fi.Texture.BILINEAR_SAMPLINGMODE,e,!1,t),this._blurY.autoClear=!1,this._blurY.alwaysForcePOT=1!==this._blurRatio,this.addPostProcess(this._blurX),this.addPostProcess(this._blurY)}else this._blurY&&(this.removePostProcess(this._blurY),this._blurY.dispose(),this._blurY=null),this._blurX&&(this.removePostProcess(this._blurX),this._blurX.dispose(),this._blurX=null)},r.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize(),i=new r(this.name,t.width,e,this._renderTargetOptions.generateMipMaps,this._renderTargetOptions.type,this._renderTargetOptions.samplingMode,this._renderTargetOptions.generateDepthBuffer);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.mirrorPlane=this.mirrorPlane.clone(),this.renderList&&(i.renderList=this.renderList.slice(0)),i},r.prototype.serialize=function(){if(!this.name)return null;var e=l.prototype.serialize.call(this);return e.mirrorPlane=this.mirrorPlane.asArray(),e},r.prototype.dispose=function(){l.prototype.dispose.call(this),this.scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigChangeObserver)},r})(Fi.RenderTargetTexture),Fi.MirrorTexture=Bi,Ni=$a||($a={}),Vi=(function(o){function r(e,t,i,r){var n=o.call(this,e,t,i,r,!0)||this;return n.refractionPlane=new Ni.Plane(0,1,0,1),n.depth=2,n.onBeforeRenderObservable.add((function(){i.clipPlane=n.refractionPlane})),n.onAfterRenderObservable.add((function(){delete i.clipPlane})),n}return T(r,o),r.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize(),i=new r(this.name,t.width,e,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.refractionPlane=this.refractionPlane.clone(),this.renderList&&(i.renderList=this.renderList.slice(0)),i.depth=this.depth,i},r.prototype.serialize=function(){if(!this.name)return null;var e=o.prototype.serialize.call(this);return e.mirrorPlane=this.refractionPlane.asArray(),e.depth=this.depth,e},r})(Ni.RenderTargetTexture),Ni.RefractionTexture=Vi,Ui=$a||($a={}),zi=(function(l){function r(e,t,i,r,n,o){void 0===i&&(i=null),void 0===n&&(n=Ui.Texture.TRILINEAR_SAMPLINGMODE),void 0===o&&(o=Ui.Engine.TEXTUREFORMAT_RGBA);var s=l.call(this,null,i,!r,void 0,n,void 0,void 0,void 0,void 0,o)||this;s.name=e,s._engine=s.getScene().getEngine(),s.wrapU=Ui.Texture.CLAMP_ADDRESSMODE,s.wrapV=Ui.Texture.CLAMP_ADDRESSMODE,s._generateMipMaps=r,t.getContext?(s._canvas=t,s._texture=s._engine.createDynamicTexture(t.width,t.height,r,n)):(s._canvas=document.createElement("canvas"),t.width||0===t.width?s._texture=s._engine.createDynamicTexture(t.width,t.height,r,n):s._texture=s._engine.createDynamicTexture(t,t,r,n));var a=s.getSize();return s._canvas.width=a.width,s._canvas.height=a.height,s._context=s._canvas.getContext("2d"),s}return T(r,l),Object.defineProperty(r.prototype,"canRescale",{get:function(){return!0},enumerable:!0,configurable:!0}),r.prototype._recreate=function(e){this._canvas.width=e.width,this._canvas.height=e.height,this.releaseInternalTexture(),this._texture=this._engine.createDynamicTexture(e.width,e.height,this._generateMipMaps,this._samplingMode)},r.prototype.scale=function(e){var t=this.getSize();t.width*=e,t.height*=e,this._recreate(t)},r.prototype.scaleTo=function(e,t){var i=this.getSize();i.width=e,i.height=t,this._recreate(i)},r.prototype.getContext=function(){return this._context},r.prototype.clear=function(){var e=this.getSize();this._context.fillRect(0,0,e.width,e.height)},r.prototype.update=function(e,t){void 0===t&&(t=!1),this._engine.updateDynamicTexture(this._texture,this._canvas,void 0===e||e,t,this._format||void 0)},r.prototype.drawText=function(e,t,i,r,n,o,s,a){void 0===a&&(a=!0);var l=this.getSize();if(o&&(this._context.fillStyle=o,this._context.fillRect(0,0,l.width,l.height)),this._context.font=r,null==t){var c=this._context.measureText(e);t=(l.width-c.width)/2}if(null==i){var h=parseInt(r.replace(/\D/g,""));i=l.height/2+h/3.65}this._context.fillStyle=n,this._context.fillText(e,t,i),a&&this.update(s)},r.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=this.getSize(),i=new r(this.name,t,e,this._generateMipMaps);return i.hasAlpha=this.hasAlpha,i.level=this.level,i.wrapU=this.wrapU,i.wrapV=this.wrapV,i},r.prototype.serialize=function(){var e=this.getScene();e&&!e.isReady()&&Ui.Tools.Warn("The scene must be ready before serializing the dynamic texture");var t=l.prototype.serialize.call(this);return t.base64String=this._canvas.toDataURL(),t.invertY=this._invertY,t.samplingMode=this.samplingMode,t},r.prototype._rebuild=function(){this.update()},r})(Ui.Texture),Ui.DynamicTexture=zi,Gi=$a||($a={}),ki=(function(l){function o(e,t,i,r,n,o,s){void 0===r&&(r=!1),void 0===n&&(n=!1),void 0===o&&(o=Gi.Texture.TRILINEAR_SAMPLINGMODE),void 0===s&&(s={autoPlay:!0,loop:!0,autoUpdateTexture:!0});var a=l.call(this,null,i,!r,n)||this;return a._onUserActionRequestedObservable=null,a._stillImageCaptured=!1,a._poster=!1,a._createInternalTexture=function(){if(null!=a._texture){if(!a._poster)return;a._texture.dispose(),a._poster=!1}if(!a._engine.needPOTTextures||Gi.Tools.IsExponentOfTwo(a.video.videoWidth)&&Gi.Tools.IsExponentOfTwo(a.video.videoHeight)?(a.wrapU=Gi.Texture.WRAP_ADDRESSMODE,a.wrapV=Gi.Texture.WRAP_ADDRESSMODE):(a.wrapU=Gi.Texture.CLAMP_ADDRESSMODE,a.wrapV=Gi.Texture.CLAMP_ADDRESSMODE,a._generateMipMaps=!1),a._texture=a._engine.createDynamicTexture(a.video.videoWidth,a.video.videoHeight,a._generateMipMaps,a._samplingMode),a.video.autoplay)a._texture.isReady=!0,a._updateInternalTexture(),a.onLoadObservable.hasObservers()&&a.onLoadObservable.notifyObservers(a);else{var e=a.video.onplaying,t=!1;a.video.onplaying=function(){a.video.onplaying=e,a._texture.isReady=!0,a._updateInternalTexture(),t||a.video.pause(),a.onLoadObservable.hasObservers()&&a.onLoadObservable.notifyObservers(a)};var i=a.video.play();i?i.then((function(){})).catch((function(){t=!0,a._onUserActionRequestedObservable&&a._onUserActionRequestedObservable.hasObservers()&&a._onUserActionRequestedObservable.notifyObservers(a)})):(a.video.onplaying=e,a._texture.isReady=!0,a._updateInternalTexture(),a.onLoadObservable.hasObservers()&&a.onLoadObservable.notifyObservers(a))}},a.reset=function(){null!=a._texture&&(a._poster||(a._texture.dispose(),a._texture=null))},a._updateInternalTexture=function(e){null!=a._texture&&a._texture.isReady&&(a.video.readyState<a.video.HAVE_CURRENT_DATA||a._engine.updateVideoTexture(a._texture,a.video,a._invertY))},a._engine=a.getScene().getEngine(),a._generateMipMaps=r,a._samplingMode=o,a.autoUpdateTexture=s.autoUpdateTexture,a.name=e||a._getName(t),a.video=a._getVideo(t),s.poster&&(a.video.poster=s.poster),void 0!==s.autoPlay&&(a.video.autoplay=s.autoPlay),void 0!==s.loop&&(a.video.loop=s.loop),a.video.setAttribute("playsinline",""),a.video.addEventListener("canplay",a._createInternalTexture),a.video.addEventListener("paused",a._updateInternalTexture),a.video.addEventListener("seeked",a._updateInternalTexture),a.video.addEventListener("emptied",a.reset),a.video.readyState>=a.video.HAVE_CURRENT_DATA&&a._createInternalTexture(),s.poster&&(a._texture=a._engine.createTexture(s.poster,!1,!0,i),a._poster=!0),a}return T(o,l),Object.defineProperty(o.prototype,"onUserActionRequestedObservable",{get:function(){return this._onUserActionRequestedObservable||(this._onUserActionRequestedObservable=new Gi.Observable),this._onUserActionRequestedObservable},enumerable:!0,configurable:!0}),o.prototype._getName=function(e){return e instanceof HTMLVideoElement?e.currentSrc:"object"==typeof e?e.toString():e},o.prototype._getVideo=function(e){if(e instanceof HTMLVideoElement)return Gi.Tools.SetCorsBehavior(e.currentSrc,e),e;var i=document.createElement("video");return"string"==typeof e?(Gi.Tools.SetCorsBehavior(e,i),i.src=e):(Gi.Tools.SetCorsBehavior(e[0],i),e.forEach((function(e){var t=document.createElement("source");t.src=e,i.appendChild(t)}))),i},o.prototype._rebuild=function(){this.update()},o.prototype.update=function(){this.autoUpdateTexture&&this.updateTexture(!0)},o.prototype.updateTexture=function(e){e&&(this.video.paused&&this._stillImageCaptured||(this._stillImageCaptured=!0,this._updateInternalTexture()))},o.prototype.updateURL=function(e){this.video.src=e},o.prototype.dispose=function(){l.prototype.dispose.call(this),this._onUserActionRequestedObservable&&(this._onUserActionRequestedObservable.clear(),this._onUserActionRequestedObservable=null),this.video.removeEventListener("canplay",this._createInternalTexture),this.video.removeEventListener("paused",this._updateInternalTexture),this.video.removeEventListener("seeked",this._updateInternalTexture),this.video.removeEventListener("emptied",this.reset),this.video.pause()},o.CreateFromWebCam=function(i,r,e){var t,n=document.createElement("video");n.setAttribute("autoplay",""),n.setAttribute("muted",""),n.setAttribute("playsinline",""),e&&e.deviceId&&(t={exact:e.deviceId}),window.URL=window.URL||window.webkitURL||window.mozURL||window.msURL,navigator.mediaDevices?navigator.mediaDevices.getUserMedia({video:e}).then((function(e){void 0!==n.mozSrcObject?n.mozSrcObject=e:n.srcObject=e;var t=function(){r&&r(new o("video",n,i,!0,!0)),n.removeEventListener("playing",t)};n.addEventListener("playing",t),n.play()})).catch((function(e){Gi.Tools.Error(e.name)})):(navigator.getUserMedia=navigator.getUserMedia||navigator.webkitGetUserMedia||navigator.mozGetUserMedia||navigator.msGetUserMedia,navigator.getUserMedia&&navigator.getUserMedia({video:{deviceId:t,width:{min:e&&e.minWidth||256,max:e&&e.maxWidth||640},height:{min:e&&e.minHeight||256,max:e&&e.maxHeight||480}}},(function(e){void 0!==n.mozSrcObject?n.mozSrcObject=e:n.src=window.URL&&window.URL.createObjectURL(e)||e,n.play(),r&&r(new o("video",n,i,!0,!0))}),(function(e){Gi.Tools.Error(e.name)})))},o})(Gi.Texture),Gi.VideoTexture=ki,Wi=$a||($a={}),Hi=(function(h){function l(e,t,i,r,n,o,s,a,l){void 0===o&&(o=!0),void 0===s&&(s=!1),void 0===a&&(a=Wi.Texture.TRILINEAR_SAMPLINGMODE),void 0===l&&(l=Wi.Engine.TEXTURETYPE_UNSIGNED_INT);var c=h.call(this,null,n,!o,s)||this;return c.format=r,c._engine=n.getEngine(),c._texture=n.getEngine().createRawTexture(e,t,i,r,o,s,a,null,l),c.wrapU=Wi.Texture.CLAMP_ADDRESSMODE,c.wrapV=Wi.Texture.CLAMP_ADDRESSMODE,c}return T(l,h),l.prototype.update=function(e){this._engine.updateRawTexture(this._texture,e,this._texture.format,this._texture.invertY,void 0,this._texture.type)},l.CreateLuminanceTexture=function(e,t,i,r,n,o,s){return void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=Wi.Texture.TRILINEAR_SAMPLINGMODE),new l(e,t,i,Wi.Engine.TEXTUREFORMAT_LUMINANCE,r,n,o,s)},l.CreateLuminanceAlphaTexture=function(e,t,i,r,n,o,s){return void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=Wi.Texture.TRILINEAR_SAMPLINGMODE),new l(e,t,i,Wi.Engine.TEXTUREFORMAT_LUMINANCE_ALPHA,r,n,o,s)},l.CreateAlphaTexture=function(e,t,i,r,n,o,s){return void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=Wi.Texture.TRILINEAR_SAMPLINGMODE),new l(e,t,i,Wi.Engine.TEXTUREFORMAT_ALPHA,r,n,o,s)},l.CreateRGBTexture=function(e,t,i,r,n,o,s,a){return void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=Wi.Texture.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=Wi.Engine.TEXTURETYPE_UNSIGNED_INT),new l(e,t,i,Wi.Engine.TEXTUREFORMAT_RGB,r,n,o,s,a)},l.CreateRGBATexture=function(e,t,i,r,n,o,s,a){return void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=Wi.Texture.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=Wi.Engine.TEXTURETYPE_UNSIGNED_INT),new l(e,t,i,Wi.Engine.TEXTUREFORMAT_RGBA,r,n,o,s,a)},l.CreateRTexture=function(e,t,i,r,n,o,s,a){return void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=Wi.Texture.TRILINEAR_SAMPLINGMODE),void 0===a&&(a=Wi.Engine.TEXTURETYPE_FLOAT),new l(e,t,i,Wi.Engine.TEXTUREFORMAT_R,r,n,o,s,a)},l})(Wi.Texture),Wi.RawTexture=Hi,Xi=$a||($a={}),ji=(function(u){function e(e,t,i,r,n,o,s,a,l,c){void 0===s&&(s=!0),void 0===a&&(a=!1),void 0===l&&(l=Xi.Texture.TRILINEAR_SAMPLINGMODE),void 0===c&&(c=Xi.Engine.TEXTURETYPE_UNSIGNED_INT);var h=u.call(this,null,o,!s,a)||this;return h.format=n,h._engine=o.getEngine(),h._texture=o.getEngine().createRawTexture3D(e,t,i,r,n,s,a,l,void 0,c),h.is3D=!0,h}return T(e,u),e.prototype.update=function(e){this._texture&&this._engine.updateRawTexture3D(this._texture,e,this._texture.format,this._texture.invertY,void 0,this._texture.type)},e})(Xi.Texture),Xi.RawTexture3D=ji,Yi=$a||($a={}),Ki=(function(){function e(e){this._vertexBuffers={},this._scene=e}return e.prototype._prepareBuffers=function(){if(!this._vertexBuffers[Yi.VertexBuffer.PositionKind]){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1),this._vertexBuffers[Yi.VertexBuffer.PositionKind]=new Yi.VertexBuffer(this._scene.getEngine(),e,Yi.VertexBuffer.PositionKind,!1,!1,2),this._buildIndexBuffer()}},e.prototype._buildIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._scene.getEngine().createIndexBuffer(e)},e.prototype._rebuild=function(){var e=this._vertexBuffers[Yi.VertexBuffer.PositionKind];e&&(e._rebuild(),this._buildIndexBuffer())},e.prototype._prepareFrame=function(e,t){void 0===e&&(e=null),void 0===t&&(t=null);var i=this._scene.activeCamera;return!!i&&(!(!(t=t||i._postProcesses.filter((function(e){return null!=e})))||0===t.length||!this._scene.postProcessesEnabled)&&(t[0].activate(i,e,null!=t),!0))},e.prototype.directRender=function(e,t,i,r,n){void 0===t&&(t=null),void 0===i&&(i=!1),void 0===r&&(r=0),void 0===n&&(n=0);for(var o=this._scene.getEngine(),s=0;s<e.length;s++){s<e.length-1?e[s+1].activate(this._scene.activeCamera,t):t?o.bindFramebuffer(t,r,void 0,void 0,i,void 0,n):o.restoreDefaultFramebuffer();var a=e[s],l=a.apply();l&&(a.onBeforeRenderObservable.notifyObservers(l),this._prepareBuffers(),o.bindBuffers(this._vertexBuffers,this._indexBuffer,l),o.drawElementsType(Yi.Material.TriangleFillMode,0,6),a.onAfterRenderObservable.notifyObservers(l))}o.setDepthBuffer(!0),o.setDepthWrite(!0)},e.prototype._finalizeFrame=function(e,t,i,r,n){void 0===n&&(n=!1);var o=this._scene.activeCamera;if(o&&0!==(r=r||o._postProcesses.filter((function(e){return null!=e}))).length&&this._scene.postProcessesEnabled){for(var s=this._scene.getEngine(),a=0,l=r.length;a<l;a++){var c=r[a];if(a<l-1?c._outputTexture=r[a+1].activate(o,t):t?(s.bindFramebuffer(t,i,void 0,void 0,n),c._outputTexture=t):(s.restoreDefaultFramebuffer(),c._outputTexture=null),e)break;var h=c.apply();h&&(c.onBeforeRenderObservable.notifyObservers(h),this._prepareBuffers(),s.bindBuffers(this._vertexBuffers,this._indexBuffer,h),s.drawElementsType(Yi.Material.TriangleFillMode,0,6),c.onAfterRenderObservable.notifyObservers(h))}s.setDepthBuffer(!0),s.setDepthWrite(!0),s.setAlphaMode(Yi.Engine.ALPHA_DISABLE)}},e.prototype.dispose=function(){var e=this._vertexBuffers[Yi.VertexBuffer.PositionKind];e&&(e.dispose(),this._vertexBuffers[Yi.VertexBuffer.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null)},e})(),Yi.PostProcessManager=Ki,Qi=$a||($a={}),Zi=(function(){function e(e,t,i,r,n,o,s,a,l,c,h,u,d,f){void 0===s&&(s=Qi.Texture.NEAREST_SAMPLINGMODE),void 0===c&&(c=null),void 0===h&&(h=Qi.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===u&&(u="postprocess"),void 0===f&&(f=!1),this.name=e,this.width=-1,this.height=-1,this._outputTexture=null,this.autoClear=!0,this.alphaMode=Qi.Engine.ALPHA_DISABLE,this.animations=new Array,this.enablePixelPerfectMode=!1,this.forceFullscreenViewport=!0,this.scaleMode=Qi.Engine.SCALEMODE_FLOOR,this.alwaysForcePOT=!1,this._samples=1,this.adaptScaleToCurrentViewport=!1,this._reusable=!1,this._textures=new Qi.SmartArray(2),this._currentRenderTextureInd=0,this._scaleRatio=new Qi.Vector2(1,1),this._texelSize=Qi.Vector2.Zero(),this.onActivateObservable=new Qi.Observable,this.onSizeChangedObservable=new Qi.Observable,this.onApplyObservable=new Qi.Observable,this.onBeforeRenderObservable=new Qi.Observable,this.onAfterRenderObservable=new Qi.Observable,null!=o?(this._camera=o,this._scene=o.getScene(),o.attachPostProcess(this),this._engine=this._scene.getEngine(),this._scene.postProcesses.push(this)):a&&(this._engine=a,this._engine.postProcesses.push(this)),this._options=n,this.renderTargetSamplingMode=s||Qi.Texture.NEAREST_SAMPLINGMODE,this._reusable=l||!1,this._textureType=h,this._samplers=r||[],this._samplers.push("textureSampler"),this._fragmentUrl=t,this._vertexUrl=u,this._parameters=i||[],this._parameters.push("scale"),this._indexParameters=d,f||this.updateEffect(c)}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._samples},set:function(e){var t=this;this._samples=e,this._textures.forEach((function(e){e.samples!==t._samples&&t._engine.updateRenderTargetTextureSampleCount(e,t._samples)}))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onActivate",{set:function(e){this._onActivateObserver&&this.onActivateObservable.remove(this._onActivateObserver),e&&(this._onActivateObserver=this.onActivateObservable.add(e))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onSizeChanged",{set:function(e){this._onSizeChangedObserver&&this.onSizeChangedObservable.remove(this._onSizeChangedObserver),this._onSizeChangedObserver=this.onSizeChangedObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onApply",{set:function(e){this._onApplyObserver&&this.onApplyObservable.remove(this._onApplyObserver),this._onApplyObserver=this.onApplyObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"inputTexture",{get:function(){return this._textures.data[this._currentRenderTextureInd]},set:function(e){this._forcedOutputTexture=e},enumerable:!0,configurable:!0}),e.prototype.getCamera=function(){return this._camera},Object.defineProperty(e.prototype,"texelSize",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.texelSize:(this._forcedOutputTexture&&this._texelSize.copyFromFloats(1/this._forcedOutputTexture.width,1/this._forcedOutputTexture.height),this._texelSize)},enumerable:!0,configurable:!0}),e.prototype.getEngine=function(){return this._engine},e.prototype.getEffect=function(){return this._effect},e.prototype.shareOutputWith=function(e){return this._disposeTextures(),this._shareOutputWithPostProcess=e,this},e.prototype.useOwnOutput=function(){0==this._textures.length&&(this._textures=new Qi.SmartArray(2)),this._shareOutputWithPostProcess=null},e.prototype.updateEffect=function(e,t,i,r,n,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._effect=this._engine.createEffect({vertex:this._vertexUrl,fragment:this._fragmentUrl},["position"],t||this._parameters,i||this._samplers,null!==e?e:"",void 0,n,o,r||this._indexParameters)},e.prototype.isReusable=function(){return this._reusable},e.prototype.markTextureDirty=function(){this.width=-1},e.prototype.activate=function(e,t,i){var r=this;void 0===t&&(t=null);var n=(e=e||this._camera).getScene(),o=n.getEngine(),s=o.getCaps().maxTextureSize,a=(t?t.width:this._engine.getRenderWidth(!0))*this._options|0,l=(t?t.height:this._engine.getRenderHeight(!0))*this._options|0,c=e.parent;!c||c.leftCamera!=e&&c.rightCamera!=e||(a/=2);var h,u=this._options.width||a,d=this._options.height||l;if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(this.adaptScaleToCurrentViewport){var f=o.currentViewport;f&&(u*=f.width,d*=f.height)}if((this.renderTargetSamplingMode===Qi.Texture.TRILINEAR_SAMPLINGMODE||this.alwaysForcePOT)&&(this._options.width||(u=o.needPOTTextures?Qi.Tools.GetExponentOfTwo(u,s,this.scaleMode):u),this._options.height||(d=o.needPOTTextures?Qi.Tools.GetExponentOfTwo(d,s,this.scaleMode):d)),this.width!==u||this.height!==d){if(0<this._textures.length){for(var p=0;p<this._textures.length;p++)this._engine._releaseTexture(this._textures.data[p]);this._textures.reset()}this.width=u,this.height=d;var _={width:this.width,height:this.height},m={generateMipMaps:!1,generateDepthBuffer:i||0===e._postProcesses.indexOf(this),generateStencilBuffer:(i||0===e._postProcesses.indexOf(this))&&this._engine.isStencilEnable,samplingMode:this.renderTargetSamplingMode,type:this._textureType};this._textures.push(this._engine.createRenderTargetTexture(_,m)),this._reusable&&this._textures.push(this._engine.createRenderTargetTexture(_,m)),this._texelSize.copyFromFloats(1/this.width,1/this.height),this.onSizeChangedObservable.notifyObservers(this)}this._textures.forEach((function(e){e.samples!==r.samples&&r._engine.updateRenderTargetTextureSampleCount(e,r.samples)}))}return this._shareOutputWithPostProcess?h=this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture?(h=this._forcedOutputTexture,this.width=this._forcedOutputTexture.width,this.height=this._forcedOutputTexture.height):h=this.inputTexture,this.enablePixelPerfectMode?(this._scaleRatio.copyFromFloats(a/u,l/d),this._engine.bindFramebuffer(h,0,a,l,this.forceFullscreenViewport)):(this._scaleRatio.copyFromFloats(1,1),this._engine.bindFramebuffer(h,0,void 0,void 0,this.forceFullscreenViewport)),this.onActivateObservable.notifyObservers(e),this.autoClear&&this.alphaMode===Qi.Engine.ALPHA_DISABLE&&this._engine.clear(this.clearColor?this.clearColor:n.clearColor,n._allowPostProcessClearColor,!0,!0),this._reusable&&(this._currentRenderTextureInd=(this._currentRenderTextureInd+1)%2),h},Object.defineProperty(e.prototype,"isSupported",{get:function(){return this._effect.isSupported},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"aspectRatio",{get:function(){return this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.aspectRatio:this._forcedOutputTexture?this._forcedOutputTexture.width/this._forcedOutputTexture.height:this.width/this.height},enumerable:!0,configurable:!0}),e.prototype.isReady=function(){return this._effect&&this._effect.isReady()},e.prototype.apply=function(){return this._effect&&this._effect.isReady()?(this._engine.enableEffect(this._effect),this._engine.setState(!1),this._engine.setDepthBuffer(!1),this._engine.setDepthWrite(!1),this._engine.setAlphaMode(this.alphaMode),this.alphaConstants&&this.getEngine().setAlphaConstants(this.alphaConstants.r,this.alphaConstants.g,this.alphaConstants.b,this.alphaConstants.a),e=this._shareOutputWithPostProcess?this._shareOutputWithPostProcess.inputTexture:this._forcedOutputTexture?this._forcedOutputTexture:this.inputTexture,this._effect._bindTexture("textureSampler",e),this._effect.setVector2("scale",this._scaleRatio),this.onApplyObservable.notifyObservers(this._effect),this._effect):null;var e},e.prototype._disposeTextures=function(){if(!this._shareOutputWithPostProcess&&!this._forcedOutputTexture){if(0<this._textures.length)for(var e=0;e<this._textures.length;e++)this._engine._releaseTexture(this._textures.data[e]);this._textures.dispose()}},e.prototype.dispose=function(e){if(e=e||this._camera,this._disposeTextures(),this._scene){var t=this._scene.postProcesses.indexOf(this);-1!==t&&this._scene.postProcesses.splice(t,1)}else{var i=this._engine.postProcesses.indexOf(this);-1!==i&&this._engine.postProcesses.splice(i,1)}if(e){if(e.detachPostProcess(this),0===e._postProcesses.indexOf(this)&&0<e._postProcesses.length){var r=this._camera._getFirstPostProcess();r&&r.markTextureDirty()}this.onActivateObservable.clear(),this.onAfterRenderObservable.clear(),this.onApplyObservable.clear(),this.onBeforeRenderObservable.clear(),this.onSizeChangedObservable.clear()}},e})(),Qi.PostProcess=Zi,qi=$a||($a={}),Ji=(function(l){function e(e,t,i,r,n,o,s,a){return void 0===i&&(i=null),void 0===s&&(s=qi.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1),l.call(this,e,"pass",null,null,t,i,r,n,o,void 0,s,void 0,null,a)||this}return T(e,l),e})(qi.PostProcess),qi.PassPostProcess=Ji;var $i,er,tr,ir,rr,nr,or,sr,ar,lr,cr,hr,ur,dr,fr,pr,_r,mr,gr,vr,yr,br,Tr,Er,xr,Pr,Ar,Sr,Mr,Rr,Cr,Or,Dr,Ir,wr,Lr,Fr,Br,Nr,Vr,Ur,zr,Gr,kr,Wr,Hr,Xr,jr,Yr,Kr,Qr,Zr,qr,Jr,$r,en,tn,rn,nn,on,sn,an,ln,cn,hn,un,dn,fn,pn,_n,mn,gn,vn,yn,bn,Tn,En,xn,Pn,An,Sn,Mn,Rn,Cn,On,Dn,In,wn,Ln,Fn,Bn,Nn,Vn,Un,zn,Gn,kn,Wn,Hn,Xn,jn,Yn,Kn,Qn,Zn,qn,Jn,$n,eo,to,io,ro,no,oo,so,ao,lo,co,ho,uo,fo,po,_o,mo,go,vo,yo,bo,To,Eo,xo,Po,Ao,So,Mo,Ro,Co,Oo,Do,Io,wo,Lo,Fo,Bo,No,Vo,Uo,zo,Go,ko,Wo,Ho,Xo,jo,Yo,Ko,Qo,Zo,qo,Jo,$o,es,ts,is,rs,ns,os,ss,as,ls,cs,hs,us,ds,fs,ps,_s,ms,gs,vs,ys,bs,Ts,Es,xs,Ps,As,Ss,Ms,Rs,Cs,Os,Ds,Is,ws,Ls,Fs,Bs,Ns,Vs,Us,zs,Gs,ks,Ws,Hs,Xs,js,Ys,Ks,Qs,Zs,qs,Js,$s,ea,ta,ia,ra,na,oa,sa,aa;ae=this&&this.__assign||function(){return(ae=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};$i=$a||($a={}),er=(function(){function s(e,t,i){this._bias=5e-5,this._normalBias=0,this._blurBoxOffset=1,this._blurScale=2,this._blurKernel=1,this._useKernelBlur=!1,this._filter=s.FILTER_NONE,this._filteringQuality=s.QUALITY_HIGH,this._contactHardeningLightSizeUVRatio=.1,this._darkness=0,this._transparencyShadow=!1,this.frustumEdgeFalloff=0,this.forceBackFacesOnly=!1,this._lightDirection=$i.Vector3.Zero(),this._viewMatrix=$i.Matrix.Zero(),this._projectionMatrix=$i.Matrix.Zero(),this._transformMatrix=$i.Matrix.Zero(),this._cachedPosition=new $i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._cachedDirection=new $i.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),this._currentFaceIndex=0,this._currentFaceIndexCache=0,this._defaultTextureMatrix=$i.Matrix.Identity(),this._mapSize=e,this._light=t,this._scene=t.getScene();var r=(t._shadowGenerator=this)._scene._getComponent($i.SceneComponentConstants.NAME_SHADOWGENERATOR);r||(r=new $i.ShadowGeneratorSceneComponent(this._scene),this._scene._addComponent(r));var n=this._scene.getEngine().getCaps();i?n.textureFloatRender&&n.textureFloatLinearFiltering?this._textureType=$i.Engine.TEXTURETYPE_FLOAT:n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?this._textureType=$i.Engine.TEXTURETYPE_HALF_FLOAT:this._textureType=$i.Engine.TEXTURETYPE_UNSIGNED_INT:n.textureHalfFloatRender&&n.textureHalfFloatLinearFiltering?this._textureType=$i.Engine.TEXTURETYPE_HALF_FLOAT:n.textureFloatRender&&n.textureFloatLinearFiltering?this._textureType=$i.Engine.TEXTURETYPE_FLOAT:this._textureType=$i.Engine.TEXTURETYPE_UNSIGNED_INT,this._initializeGenerator(),this._applyFilterValues()}return Object.defineProperty(s.prototype,"bias",{get:function(){return this._bias},set:function(e){this._bias=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"normalBias",{get:function(){return this._normalBias},set:function(e){this._normalBias=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"blurBoxOffset",{get:function(){return this._blurBoxOffset},set:function(e){this._blurBoxOffset!==e&&(this._blurBoxOffset=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"blurScale",{get:function(){return this._blurScale},set:function(e){this._blurScale!==e&&(this._blurScale=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"blurKernel",{get:function(){return this._blurKernel},set:function(e){this._blurKernel!==e&&(this._blurKernel=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useKernelBlur",{get:function(){return this._useKernelBlur},set:function(e){this._useKernelBlur!==e&&(this._useKernelBlur=e,this._disposeBlurPostProcesses())},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"depthScale",{get:function(){return void 0!==this._depthScale?this._depthScale:this._light.getDepthScale()},set:function(e){this._depthScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"filter",{get:function(){return this._filter},set:function(e){if(this._light.needCube()){if(e===s.FILTER_BLUREXPONENTIALSHADOWMAP)return void(this.useExponentialShadowMap=!0);if(e===s.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)return void(this.useCloseExponentialShadowMap=!0);if(e===s.FILTER_PCF||e===s.FILTER_PCSS)return void(this.usePoissonSampling=!0)}e!==s.FILTER_PCF&&e!==s.FILTER_PCSS||1!==this._scene.getEngine().webGLVersion?this._filter!==e&&(this._filter=e,this._disposeBlurPostProcesses(),this._applyFilterValues(),this._light._markMeshesAsLightDirty()):this.usePoissonSampling=!0},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"usePoissonSampling",{get:function(){return this.filter===s.FILTER_POISSONSAMPLING},set:function(e){(e||this.filter===s.FILTER_POISSONSAMPLING)&&(this.filter=e?s.FILTER_POISSONSAMPLING:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useVarianceShadowMap",{get:function(){return $i.Tools.Warn("VSM are now replaced by ESM. Please use useExponentialShadowMap instead."),this.useExponentialShadowMap},set:function(e){$i.Tools.Warn("VSM are now replaced by ESM. Please use useExponentialShadowMap instead."),this.useExponentialShadowMap=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useBlurVarianceShadowMap",{get:function(){return $i.Tools.Warn("VSM are now replaced by ESM. Please use useBlurExponentialShadowMap instead."),this.useBlurExponentialShadowMap},set:function(e){$i.Tools.Warn("VSM are now replaced by ESM. Please use useBlurExponentialShadowMap instead."),this.useBlurExponentialShadowMap=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useExponentialShadowMap",{get:function(){return this.filter===s.FILTER_EXPONENTIALSHADOWMAP},set:function(e){(e||this.filter===s.FILTER_EXPONENTIALSHADOWMAP)&&(this.filter=e?s.FILTER_EXPONENTIALSHADOWMAP:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useBlurExponentialShadowMap",{get:function(){return this.filter===s.FILTER_BLUREXPONENTIALSHADOWMAP},set:function(e){(e||this.filter===s.FILTER_BLUREXPONENTIALSHADOWMAP)&&(this.filter=e?s.FILTER_BLUREXPONENTIALSHADOWMAP:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useCloseExponentialShadowMap",{get:function(){return this.filter===s.FILTER_CLOSEEXPONENTIALSHADOWMAP},set:function(e){(e||this.filter===s.FILTER_CLOSEEXPONENTIALSHADOWMAP)&&(this.filter=e?s.FILTER_CLOSEEXPONENTIALSHADOWMAP:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useBlurCloseExponentialShadowMap",{get:function(){return this.filter===s.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP},set:function(e){(e||this.filter===s.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP)&&(this.filter=e?s.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"usePercentageCloserFiltering",{get:function(){return this.filter===s.FILTER_PCF},set:function(e){(e||this.filter===s.FILTER_PCF)&&(this.filter=e?s.FILTER_PCF:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"filteringQuality",{get:function(){return this._filteringQuality},set:function(e){this._filteringQuality=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"useContactHardeningShadow",{get:function(){return this.filter===s.FILTER_PCSS},set:function(e){(e||this.filter===s.FILTER_PCSS)&&(this.filter=e?s.FILTER_PCSS:s.FILTER_NONE)},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"contactHardeningLightSizeUVRatio",{get:function(){return this._contactHardeningLightSizeUVRatio},set:function(e){this._contactHardeningLightSizeUVRatio=e},enumerable:!0,configurable:!0}),s.prototype.getDarkness=function(){return this._darkness},s.prototype.setDarkness=function(e){return this._darkness=1<=e?1:e<=0?0:e,this},s.prototype.setTransparencyShadow=function(e){return this._transparencyShadow=e,this},s.prototype.getShadowMap=function(){return this._shadowMap},s.prototype.getShadowMapForRendering=function(){return this._shadowMap2?this._shadowMap2:this._shadowMap},s.prototype.addShadowCaster=function(e,t){var i;return void 0===t&&(t=!0),this._shadowMap&&(this._shadowMap.renderList||(this._shadowMap.renderList=[]),this._shadowMap.renderList.push(e),t&&(i=this._shadowMap.renderList).push.apply(i,e.getChildMeshes())),this},s.prototype.removeShadowCaster=function(e,t){if(void 0===t&&(t=!0),!this._shadowMap||!this._shadowMap.renderList)return this;var i=this._shadowMap.renderList.indexOf(e);if(-1!==i&&this._shadowMap.renderList.splice(i,1),t)for(var r=0,n=e.getChildren();r<n.length;r++){var o=n[r];this.removeShadowCaster(o)}return this},s.prototype.getLight=function(){return this._light},s.prototype._initializeGenerator=function(){this._light._markMeshesAsLightDirty(),this._initializeShadowMap()},s.prototype._initializeShadowMap=function(){var t=this,i=this._scene.getEngine();1<i.webGLVersion?(this._shadowMap=new $i.RenderTargetTexture(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube(),void 0,!1,!1),this._shadowMap.createDepthStencilTexture($i.Engine.LESS,!0)):this._shadowMap=new $i.RenderTargetTexture(this._light.name+"_shadowMap",this._mapSize,this._scene,!1,!0,this._textureType,this._light.needCube()),this._shadowMap.wrapU=$i.Texture.CLAMP_ADDRESSMODE,this._shadowMap.wrapV=$i.Texture.CLAMP_ADDRESSMODE,this._shadowMap.anisotropicFilteringLevel=1,this._shadowMap.updateSamplingMode($i.Texture.BILINEAR_SAMPLINGMODE),this._shadowMap.renderParticles=!1,this._shadowMap.ignoreCameraViewport=!0,this._shadowMap.onBeforeRenderObservable.add((function(e){t._currentFaceIndex=e,t._filter===s.FILTER_PCF&&i.setColorWrite(!1)})),this._shadowMap.customRenderFunction=this._renderForShadowMap.bind(this),this._shadowMap.onAfterUnbindObservable.add((function(){if(t._filter===s.FILTER_PCF&&i.setColorWrite(!0),t.useBlurExponentialShadowMap||t.useBlurCloseExponentialShadowMap){var e=t.getShadowMapForRendering();e&&t._scene.postProcessManager.directRender(t._blurPostProcesses,e.getInternalTexture(),!0)}}));var r=new $i.Color4(0,0,0,0),n=new $i.Color4(1,1,1,1);this._shadowMap.onClearObservable.add((function(e){t._filter===s.FILTER_PCF?e.clear(n,!1,!0,!1):t.useExponentialShadowMap||t.useBlurExponentialShadowMap?e.clear(r,!0,!0,!1):e.clear(n,!0,!0,!1)}))},s.prototype._initializeBlurRTTAndPostProcesses=function(){var t=this,e=this._scene.getEngine(),i=this._mapSize/this.blurScale;this.useKernelBlur&&1===this.blurScale||(this._shadowMap2=new $i.RenderTargetTexture(this._light.name+"_shadowMap2",i,this._scene,!1,!0,this._textureType),this._shadowMap2.wrapU=$i.Texture.CLAMP_ADDRESSMODE,this._shadowMap2.wrapV=$i.Texture.CLAMP_ADDRESSMODE,this._shadowMap2.updateSamplingMode($i.Texture.BILINEAR_SAMPLINGMODE)),this.useKernelBlur?(this._kernelBlurXPostprocess=new $i.BlurPostProcess(this._light.name+"KernelBlurX",new $i.Vector2(1,0),this.blurKernel,1,null,$i.Texture.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.width=i,this._kernelBlurXPostprocess.height=i,this._kernelBlurXPostprocess.onApplyObservable.add((function(e){e.setTexture("textureSampler",t._shadowMap)})),this._kernelBlurYPostprocess=new $i.BlurPostProcess(this._light.name+"KernelBlurY",new $i.Vector2(0,1),this.blurKernel,1,null,$i.Texture.BILINEAR_SAMPLINGMODE,e,!1,this._textureType),this._kernelBlurXPostprocess.autoClear=!1,this._kernelBlurYPostprocess.autoClear=!1,this._textureType===$i.Engine.TEXTURETYPE_UNSIGNED_INT&&(this._kernelBlurXPostprocess.packedFloat=!0,this._kernelBlurYPostprocess.packedFloat=!0),this._blurPostProcesses=[this._kernelBlurXPostprocess,this._kernelBlurYPostprocess]):(this._boxBlurPostprocess=new $i.PostProcess(this._light.name+"DepthBoxBlur","depthBoxBlur",["screenSize","boxOffset"],[],1,null,$i.Texture.BILINEAR_SAMPLINGMODE,e,!1,"#define OFFSET "+this._blurBoxOffset,this._textureType),this._boxBlurPostprocess.onApplyObservable.add((function(e){e.setFloat2("screenSize",i,i),e.setTexture("textureSampler",t._shadowMap)})),this._boxBlurPostprocess.autoClear=!1,this._blurPostProcesses=[this._boxBlurPostprocess])},s.prototype._renderForShadowMap=function(e,t,i,r){var n,o=this._scene.getEngine();if(r.length){for(o.setColorWrite(!1),n=0;n<r.length;n++)this._renderSubMeshForShadowMap(r.data[n]);o.setColorWrite(!0)}for(n=0;n<e.length;n++)this._renderSubMeshForShadowMap(e.data[n]);for(n=0;n<t.length;n++)this._renderSubMeshForShadowMap(t.data[n]);if(this._transparencyShadow)for(n=0;n<i.length;n++)this._renderSubMeshForShadowMap(i.data[n])},s.prototype._renderSubMeshForShadowMap=function(e){var i=this,t=e.getRenderingMesh(),r=this._scene,n=r.getEngine(),o=e.getMaterial();if(o){n.setState(o.backFaceCulling);var s=t._getInstancesRenderList(e._id);if(!s.mustReturn){var a=n.getCaps().instancedArrays&&null!==s.visibleInstances[e._id]&&void 0!==s.visibleInstances[e._id];if(this.isReady(e,a)){if(n.enableEffect(this._effect),t._bind(e,this._effect,$i.Material.TriangleFillMode),this._effect.setFloat3("biasAndScale",this.bias,this.normalBias,this.depthScale),this._effect.setMatrix("viewProjection",this.getTransformMatrix()),this.getLight().getTypeID()===$i.Light.LIGHTTYPEID_DIRECTIONALLIGHT?this._effect.setVector3("lightData",this._cachedDirection):this._effect.setVector3("lightData",this._cachedPosition),r.activeCamera&&this._effect.setFloat2("depthValues",this.getLight().getDepthMinZ(r.activeCamera),this.getLight().getDepthMinZ(r.activeCamera)+this.getLight().getDepthMaxZ(r.activeCamera)),o&&o.needAlphaTesting()){var l=o.getAlphaTestTexture();l&&(this._effect.setTexture("diffuseSampler",l),this._effect.setMatrix("diffuseMatrix",l.getTextureMatrix()||this._defaultTextureMatrix))}t.useBones&&t.computeBonesUsingShaders&&this._effect.setMatrices("mBones",t.skeleton.getTransformMatrices(t)),$i.MaterialHelper.BindMorphTargetParameters(t,this._effect),this.forceBackFacesOnly&&n.setState(!0,0,!1,!0),t._processRendering(e,this._effect,$i.Material.TriangleFillMode,s,a,(function(e,t){return i._effect.setMatrix("world",t)})),this.forceBackFacesOnly&&n.setState(!0,0,!1,!1)}else this._shadowMap&&this._shadowMap.resetRefreshCounter()}}},s.prototype._applyFilterValues=function(){this._shadowMap&&(this.filter===s.FILTER_NONE||this.filter===s.FILTER_PCSS?this._shadowMap.updateSamplingMode($i.Texture.NEAREST_SAMPLINGMODE):this._shadowMap.updateSamplingMode($i.Texture.BILINEAR_SAMPLINGMODE))},s.prototype.forceCompilation=function(e,t){var i=this,r=ae({useInstances:!1},t),n=this.getShadowMap();if(n){var o=n.renderList;if(o){for(var s=new Array,a=0,l=o;a<l.length;a++){var c=l[a];s.push.apply(s,c.subMeshes)}if(0!==s.length){var h=0,u=function(){if(i._scene&&i._scene.getEngine()){for(;i.isReady(s[h],r.useInstances);)if(++h>=s.length)return void(e&&e(i));setTimeout(u,16)}};u()}else e&&e(this)}else e&&e(this)}else e&&e(this)},s.prototype.forceCompilationAsync=function(t){var i=this;return new Promise(function(e){i.forceCompilation((function(){e()}),t)})},s.prototype.isReady=function(e,t){var i=[];this._textureType!==$i.Engine.TEXTURETYPE_UNSIGNED_INT&&i.push("#define FLOAT"),this.useExponentialShadowMap||this.useBlurExponentialShadowMap?i.push("#define ESM"):(this.usePercentageCloserFiltering||this.useContactHardeningShadow)&&i.push("#define DEPTHTEXTURE");var r=[$i.VertexBuffer.PositionKind],n=e.getMesh(),o=e.getMaterial();if(this.normalBias&&n.isVerticesDataPresent($i.VertexBuffer.NormalKind)&&(r.push($i.VertexBuffer.NormalKind),i.push("#define NORMAL"),n.nonUniformScaling&&i.push("#define NONUNIFORMSCALING"),this.getLight().getTypeID()===$i.Light.LIGHTTYPEID_DIRECTIONALLIGHT&&i.push("#define DIRECTIONINLIGHTDATA")),o&&o.needAlphaTesting()){var s=o.getAlphaTestTexture();s&&(i.push("#define ALPHATEST"),n.isVerticesDataPresent($i.VertexBuffer.UVKind)&&(r.push($i.VertexBuffer.UVKind),i.push("#define UV1")),n.isVerticesDataPresent($i.VertexBuffer.UV2Kind)&&1===s.coordinatesIndex&&(r.push($i.VertexBuffer.UV2Kind),i.push("#define UV2")))}n.useBones&&n.computeBonesUsingShaders?(r.push($i.VertexBuffer.MatricesIndicesKind),r.push($i.VertexBuffer.MatricesWeightsKind),4<n.numBoneInfluencers&&(r.push($i.VertexBuffer.MatricesIndicesExtraKind),r.push($i.VertexBuffer.MatricesWeightsExtraKind)),i.push("#define NUM_BONE_INFLUENCERS "+n.numBoneInfluencers),i.push("#define BonesPerMesh "+(n.skeleton.bones.length+1))):i.push("#define NUM_BONE_INFLUENCERS 0");var a=n.morphTargetManager,l=0;a&&0<a.numInfluencers&&(i.push("#define MORPHTARGETS"),l=a.numInfluencers,i.push("#define NUM_MORPH_INFLUENCERS "+l),$i.MaterialHelper.PrepareAttributesForMorphTargets(r,n,{NUM_MORPH_INFLUENCERS:l})),t&&(i.push("#define INSTANCES"),r.push("world0"),r.push("world1"),r.push("world2"),r.push("world3"));var c=i.join("\n");return this._cachedDefines!==c&&(this._cachedDefines=c,this._effect=this._scene.getEngine().createEffect("shadowMap",r,["world","mBones","viewProjection","diffuseMatrix","lightData","depthValues","biasAndScale","morphTargetInfluences"],["diffuseSampler"],c,void 0,void 0,void 0,{maxSimultaneousMorphTargets:l})),!!this._effect.isReady()&&((this.useBlurExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(this._blurPostProcesses&&this._blurPostProcesses.length||this._initializeBlurRTTAndPostProcesses()),!(this._kernelBlurXPostprocess&&!this._kernelBlurXPostprocess.isReady())&&(!(this._kernelBlurYPostprocess&&!this._kernelBlurYPostprocess.isReady())&&!(this._boxBlurPostprocess&&!this._boxBlurPostprocess.isReady())))},s.prototype.prepareDefines=function(e,t){var i=this._scene,r=this._light;i.shadowsEnabled&&r.shadowEnabled&&(e["SHADOW"+t]=!0,this.useContactHardeningShadow&&(e["SHADOWPCSS"+t]=!0,this._filteringQuality===s.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===s.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)),this.usePercentageCloserFiltering?(e["SHADOWPCF"+t]=!0,this._filteringQuality===s.QUALITY_LOW?e["SHADOWLOWQUALITY"+t]=!0:this._filteringQuality===s.QUALITY_MEDIUM&&(e["SHADOWMEDIUMQUALITY"+t]=!0)):this.usePoissonSampling?e["SHADOWPOISSON"+t]=!0:this.useExponentialShadowMap||this.useBlurExponentialShadowMap?e["SHADOWESM"+t]=!0:(this.useCloseExponentialShadowMap||this.useBlurCloseExponentialShadowMap)&&(e["SHADOWCLOSEESM"+t]=!0),r.needCube()&&(e["SHADOWCUBE"+t]=!0))},s.prototype.bindShadowLight=function(e,t){var i=this._light,r=this._scene;if(r.shadowsEnabled&&i.shadowEnabled){var n=r.activeCamera;if(n){var o=this.getShadowMap();o&&(i.needCube()||t.setMatrix("lightMatrix"+e,this.getTransformMatrix()),this._filter===s.FILTER_PCF?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),o.getSize().width,1/o.getSize().width,this.frustumEdgeFalloff,e)):this._filter===s.FILTER_PCSS?(t.setDepthStencilTexture("shadowSampler"+e,this.getShadowMapForRendering()),t.setTexture("depthSampler"+e,this.getShadowMapForRendering()),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),1/o.getSize().width,this._contactHardeningLightSizeUVRatio*o.getSize().width,this.frustumEdgeFalloff,e)):(t.setTexture("shadowSampler"+e,this.getShadowMapForRendering()),i._uniformBuffer.updateFloat4("shadowsInfo",this.getDarkness(),this.blurScale/o.getSize().width,this.depthScale,this.frustumEdgeFalloff,e)),i._uniformBuffer.updateFloat2("depthValues",this.getLight().getDepthMinZ(n),this.getLight().getDepthMinZ(n)+this.getLight().getDepthMaxZ(n),e))}}},s.prototype.getTransformMatrix=function(){var e=this._scene;if(this._currentRenderID===e.getRenderId()&&this._currentFaceIndexCache===this._currentFaceIndex)return this._transformMatrix;this._currentRenderID=e.getRenderId(),this._currentFaceIndexCache=this._currentFaceIndex;var t=this._light.position;if(this._light.computeTransformedInformation()&&(t=this._light.transformedPosition),$i.Vector3.NormalizeToRef(this._light.getShadowDirection(this._currentFaceIndex),this._lightDirection),1===Math.abs($i.Vector3.Dot(this._lightDirection,$i.Vector3.Up()))&&(this._lightDirection.z=1e-13),this._light.needProjectionMatrixCompute()||!this._cachedPosition||!this._cachedDirection||!t.equals(this._cachedPosition)||!this._lightDirection.equals(this._cachedDirection)){this._cachedPosition.copyFrom(t),this._cachedDirection.copyFrom(this._lightDirection),$i.Matrix.LookAtLHToRef(t,t.add(this._lightDirection),$i.Vector3.Up(),this._viewMatrix);var i=this.getShadowMap();if(i){var r=i.renderList;r&&this._light.setShadowProjectionMatrix(this._projectionMatrix,this._viewMatrix,r)}this._viewMatrix.multiplyToRef(this._projectionMatrix,this._transformMatrix)}return this._transformMatrix},s.prototype.recreateShadowMap=function(){var e=this._shadowMap;if(e){var t=e.renderList;this._disposeRTTandPostProcesses(),this._initializeGenerator(),this.filter=this.filter,this._applyFilterValues(),this._shadowMap.renderList=t}},s.prototype._disposeBlurPostProcesses=function(){this._shadowMap2&&(this._shadowMap2.dispose(),this._shadowMap2=null),this._boxBlurPostprocess&&(this._boxBlurPostprocess.dispose(),this._boxBlurPostprocess=null),this._kernelBlurXPostprocess&&(this._kernelBlurXPostprocess.dispose(),this._kernelBlurXPostprocess=null),this._kernelBlurYPostprocess&&(this._kernelBlurYPostprocess.dispose(),this._kernelBlurYPostprocess=null),this._blurPostProcesses=[]},s.prototype._disposeRTTandPostProcesses=function(){this._shadowMap&&(this._shadowMap.dispose(),this._shadowMap=null),this._disposeBlurPostProcesses()},s.prototype.dispose=function(){this._disposeRTTandPostProcesses(),this._light&&(this._light._shadowGenerator=null,this._light._markMeshesAsLightDirty())},s.prototype.serialize=function(){var e={},t=this.getShadowMap();if(!t)return e;if(e.lightId=this._light.id,e.mapSize=t.getRenderSize(),e.useExponentialShadowMap=this.useExponentialShadowMap,e.useBlurExponentialShadowMap=this.useBlurExponentialShadowMap,e.useCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.useBlurCloseExponentialShadowMap=this.useBlurExponentialShadowMap,e.usePoissonSampling=this.usePoissonSampling,e.forceBackFacesOnly=this.forceBackFacesOnly,e.depthScale=this.depthScale,e.darkness=this.getDarkness(),e.blurBoxOffset=this.blurBoxOffset,e.blurKernel=this.blurKernel,e.blurScale=this.blurScale,e.useKernelBlur=this.useKernelBlur,e.transparencyShadow=this._transparencyShadow,e.frustumEdgeFalloff=this.frustumEdgeFalloff,e.bias=this.bias,e.normalBias=this.normalBias,e.usePercentageCloserFiltering=this.usePercentageCloserFiltering,e.useContactHardeningShadow=this.useContactHardeningShadow,e.filteringQuality=this.filteringQuality,e.contactHardeningLightSizeUVRatio=this.contactHardeningLightSizeUVRatio,e.renderList=[],t.renderList)for(var i=0;i<t.renderList.length;i++){var r=t.renderList[i];e.renderList.push(r.id)}return e},s.Parse=function(e,t){for(var i=t.getLightByID(e.lightId),r=new s(e.mapSize,i),n=r.getShadowMap(),o=0;o<e.renderList.length;o++){t.getMeshesByID(e.renderList[o]).forEach((function(e){n&&(n.renderList||(n.renderList=[]),n.renderList.push(e))}))}return e.usePoissonSampling?r.usePoissonSampling=!0:e.useExponentialShadowMap?r.useExponentialShadowMap=!0:e.useBlurExponentialShadowMap?r.useBlurExponentialShadowMap=!0:e.useCloseExponentialShadowMap?r.useCloseExponentialShadowMap=!0:e.useBlurCloseExponentialShadowMap?r.useBlurCloseExponentialShadowMap=!0:e.usePercentageCloserFiltering?r.usePercentageCloserFiltering=!0:e.useContactHardeningShadow&&(r.useContactHardeningShadow=!0),e.filteringQuality&&(r.filteringQuality=e.filteringQuality),e.contactHardeningLightSizeUVRatio?r.contactHardeningLightSizeUVRatio=e.contactHardeningLightSizeUVRatio:e.useVarianceShadowMap?r.useExponentialShadowMap=!0:e.useBlurVarianceShadowMap&&(r.useBlurExponentialShadowMap=!0),e.depthScale&&(r.depthScale=e.depthScale),e.blurScale&&(r.blurScale=e.blurScale),e.blurBoxOffset&&(r.blurBoxOffset=e.blurBoxOffset),e.useKernelBlur&&(r.useKernelBlur=e.useKernelBlur),e.blurKernel&&(r.blurKernel=e.blurKernel),void 0!==e.bias&&(r.bias=e.bias),void 0!==e.normalBias&&(r.normalBias=e.normalBias),void 0!==e.frustumEdgeFalloff&&(r.frustumEdgeFalloff=e.frustumEdgeFalloff),e.darkness&&r.setDarkness(e.darkness),e.transparencyShadow&&r.setTransparencyShadow(!0),r.forceBackFacesOnly=e.forceBackFacesOnly,r},s.FILTER_NONE=0,s.FILTER_EXPONENTIALSHADOWMAP=1,s.FILTER_POISSONSAMPLING=2,s.FILTER_BLUREXPONENTIALSHADOWMAP=3,s.FILTER_CLOSEEXPONENTIALSHADOWMAP=4,s.FILTER_BLURCLOSEEXPONENTIALSHADOWMAP=5,s.FILTER_PCF=6,s.FILTER_PCSS=7,s.QUALITY_HIGH=0,s.QUALITY_MEDIUM=1,s.QUALITY_LOW=2,s})(),$i.ShadowGenerator=er,(function(a){a.AbstractScene.AddParser(a.SceneComponentConstants.NAME_SHADOWGENERATOR,(function(e,t,i,r){if(void 0!==e.shadowGenerators&&null!==e.shadowGenerators)for(var n=0,o=e.shadowGenerators.length;n<o;n++){var s=e.shadowGenerators[n];a.ShadowGenerator.Parse(s,t)}}));var e=(function(){function e(e){this.name=a.SceneComponentConstants.NAME_SHADOWGENERATOR,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(a.SceneComponentConstants.STEP_GATHERRENDERTARGETS_SHADOWGENERATOR,this,this._gatherRenderTargets)},e.prototype.rebuild=function(){},e.prototype.serialize=function(e){e.shadowGenerators=[];for(var t=0,i=this.scene.lights;t<i.length;t++){var r=i[t].getShadowGenerator();r&&e.shadowGenerators.push(r.serialize())}},e.prototype.addFromContainer=function(e){},e.prototype.removeFromContainer=function(e){},e.prototype.dispose=function(){},e.prototype._gatherRenderTargets=function(e){var t=this.scene;if(this.scene.shadowsEnabled)for(var i=0;i<t.lights.length;i++){var r=t.lights[i],n=r.getShadowGenerator();if(r.isEnabled()&&r.shadowEnabled&&n){var o=n.getShadowMap();-1!==t.textures.indexOf(o)&&e.push(o)}}},e})();a.ShadowGeneratorSceneComponent=e})($a||($a={})),tr=$a||($a={}),ir=(function(){function e(e,t,i){void 0===t&&(t=""),void 0===i&&(i="black");var r=this;this._renderingCanvas=e,this._loadingText=t,this._loadingDivBackgroundColor=i,this._resizeLoadingUI=function(){var e=r._renderingCanvas.getBoundingClientRect(),t=window.getComputedStyle(r._renderingCanvas).position;r._loadingDiv&&(r._loadingDiv.style.position="fixed"===t?"fixed":"absolute",r._loadingDiv.style.left=e.left+"px",r._loadingDiv.style.top=e.top+"px",r._loadingDiv.style.width=e.width+"px",r._loadingDiv.style.height=e.height+"px")}}return e.prototype.displayLoadingUI=function(){if(!this._loadingDiv){this._loadingDiv=document.createElement("div"),this._loadingDiv.id="babylonjsLoadingDiv",this._loadingDiv.style.opacity="0",this._loadingDiv.style.transition="opacity 1.5s ease",this._loadingDiv.style.pointerEvents="none",this._loadingTextDiv=document.createElement("div"),this._loadingTextDiv.style.position="absolute",this._loadingTextDiv.style.left="0",this._loadingTextDiv.style.top="50%",this._loadingTextDiv.style.marginTop="80px",this._loadingTextDiv.style.width="100%",this._loadingTextDiv.style.height="20px",this._loadingTextDiv.style.fontFamily="Arial",this._loadingTextDiv.style.fontSize="14px",this._loadingTextDiv.style.color="white",this._loadingTextDiv.style.textAlign="center",this._loadingTextDiv.innerHTML="Loading",this._loadingDiv.appendChild(this._loadingTextDiv),this._loadingTextDiv.innerHTML=this._loadingText;var e=document.createElement("style");e.type="text/css";e.innerHTML="@-webkit-keyframes spin1 { 0% { -webkit-transform: rotate(0deg);}\n 100% { -webkit-transform: rotate(360deg);}\n } @keyframes spin1 { 0% { transform: rotate(0deg);}\n 100% { transform: rotate(360deg);}\n }",document.getElementsByTagName("head")[0].appendChild(e);var t=new Image;t.src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAHgAAAB4CAYAAAA5ZDbSAAAAAXNSR0IArs4c6QAAAARnQU1BAACxjwv8YQUAAAAJcEhZcwAADsMAAA7DAcdvqGQAAAAZdEVYdFNvZnR3YXJlAHBhaW50Lm5ldCA0LjAuMTZEaa/1AAAYq0lEQVR4Xu2dCZRcVZnHScAJUZSwjSOIbAJmEAZwQCCMoAInYRGIg8AwegQx7AFzUBBmzAFlE4EAwxz2GRk2w7AnAURZBiEOZgyEQDAQAjmEJqTpNd3V1V3Vmd+/6utKV7/1vnpVXd2p/zn3vOV+27vfu/fd/W3QQAPrBZqbm7fJZrN79vf3T+/r67uf4wO9vb37WXQDIwWtra0Tenp6voQTv5XP56/BkfcR3iLk1g6B7hEeI+zP5V+ZiAbqBZ2dnZ8lV+6Gg87CobfhpOc4byf0FjwYE9DneBkWcXrM2tmzNzTxDdQKJPyETCazI46YgiMuI9zJuXJltuChFIHsP/PSfIfTjU19A2mira1tcxy3ey6XO5vEnkV4kes11XBmENDVj97XOT2O03FmWgMuoNLzGRJva8IUnPkzjjcT/kLoKCZzfQB7XiX8M2G8md7AUJgzJ+Z6e88gZ1xGuj3HsY17PcVkrG9gp7CUF/F8PUvxqdZDrFq1ahNVfKjwTCYxZuDE2wjKlc2WViMePM+HPNsFPOdf22OPblD5OZQHvphnV65cjTMzxaQY3eA5V9OO/hmnm1lSjE7woFsQbiXki4++foHnXkW4mLC1JUl947333tsMY3emqfB9jtPJlXN5U0+bOXPmWCPxgOccSy4+AfqPio+9/oFnbyatbqVE28GSZfjQ1NT0KQzaHMcdyPfyaNoE12HcvdxT29K3Fkv8A2vWrPmcifAFZNtD91yRY+SBZ+9UsMtEgD+jTpeenp6JXI6xpKkuUDqRcA6Kr0Wpens+InQTnIpV6Fdi+BQT64ulS5eOIzefD62na7CeoGcnLCM8ykt5OWlzcPv772/BS/w3nP+K+xU11+DvQe5dcrQlTfWAwbNMb8XA8AyGX80xtLlA6TAJuteMbVhhia1v5VMcr+LWMeoZ4xiYw7q6urbhHbgG+paCkIRQehHu4pO3O5fVydEomF5Ulx548JfVD2wqfKE2I3R3ob/f2GoC1DWhdz7HG3i5j2pvb9+Z24m6HvVZQtYsZFWcowlzePEP4jJdR/OQhxTVpAs9NMXxmZxuZKo8IG4s+v8R2tUFphSBTBWzH+OAFwn/gS3TuN55xYoVqfc6dXd3fwHZ1xFaTX0iyGbwjJqXXAammxP00EXx6UMGEx7ram7+vKnzBZ/87Xiwp40tEdDTgYwlHG/CmadSjO7L+XiialOZAej7POFG2VK0Khngl6Pn8/LL0YEtlFh4n8oDAqvaAYH8tzH2iNDm1IIFn8Ax50G7xtgCAU07CfAG4RHOz+vLZL7e0dGxlYlKHaj8BHo25xgrsfV5wrYH4KmouxV+ZZDnCUdwmXxMGgFvFUVWD+jQuOot6rI0tb4gcfaG9v+MrcAn+wj38gL8C7cObmlp2ZRjOkWYD6ypuAf6zjFHLSJ0c/6YQ813DM/yZXgehreiVgP8cvSfsOeExYsXuzs6n8v9j8mqBRZQmdjXVPuira1NHSpn8UDf4Xu0vd2uCtDzacJOlDDf5ng94X8JTWarB8R1EK7ju7udiYgEz/v3pLFKm4oHUHhh3iZdfshpaEYpA4pvKLLXBujLYKRq71XLhUHg27z12rW9B6L/QhLrWWxRH7nzeDK8awi/5HRTEx0K6MZQ694LHk0DqrgfADkreIYz1q5c+UlTEQzesIuMryrggYQWjNL3RGO7p2tuFMeqjaOidgzyCz1yJMTJ6L6d66WEVCcHIO/dQkI75Chs2g97Hoc3jRz9Lge1ED5l4r0gckqRPB0gTw34t1B+h3IqxZkmrn2SULUa7ezZszdE5xfR9130Xsm5ilrnHrmkQOcKvrkncxqrIiY6wlewbw7BOUfDo/b84zzvj9C7J7eCS0NrUiRKCPjUE7ScMBdlF/B2HqBi0ERXBcuXL99YnQz9fX2ah3Up4UnsWGEmDRuUhoTn+Z5PfvbZZ2N/fuCZRJgnfhNVBu73EZoIKt7l0L2UBsYeDZg016nb5EUCWuXQewinUtTuyq2aTStF14a8SD+VDQVj6hDYxjuXf4Hjl83sSMCmTp8j4FtoMuRQ5dAZcii3kk/0s2bBhxIcBxjxUlib1hWInEDO/6qKV+y4geO5HAMntEE/pq+nZyo0ywsG1SmwL4Orf+0yqGCfmvR73LAn9lAeBjQTEhkA+1h49a08iRflcq4H5iuXFU9cz4lqihC/LXS/NZa6Bc+pz5gql5ub6VXD2tZWTSPeyS7XgeLhXrMnEhj6MSHSwaIhFGZH8oA/JzzFeexvJbRN2HW03moT6cEChx6w4QY2rurn85JWrxsiCy0FwjcIqos8w7GZNPulkawDEbFHlaBtjzODEDrVztuKXMmADPWA3RaljyJeNdKq98ilAez8iJdyGqfO31V4NoV/EvyaCqR54V2EshE5Lqcb+TrkstkTLD4WKB4PNNZQ8P05HAelMXNSPWChC8JsYvwthJo0jSoF6fIqjjqe08Aat+LIkd+AVjn09zxbZFqK3tjXAUbXUaWDjTUSyN4J45YZX2Igo4cEOVfFson2ALIxSjR0jog5YNgpfNHM90BxIjDyWIB8Z2NfB01HISJ20wPaw4w1FlavXq1v8aPGXhFw9JNRFTDItifU/RwwpfmKxYsDK180kU4x0lhAXvOSJUs+bezlIDL2N4xi4GpjK4MGCuzUA+SPxzn3m4iKgKyV2DCV08DeMWg0B+zHHOt2DpjS3Mz1BfFOM25C5ZH4LxldJBB0g7GVARkaXgv8VsKqZtIMPpN9RUnJgRzU5Wfp22vifcG3+2vQvmdsdQXsX2pm+oKX+GYjjQXkPWqsXshpRhcJ0RpbGShSHiSuheP37ZYHsGusVHOrU1lMxkO9od4eE+8LlSzQqfetpnPAooBN/2Um+gISp89MkF8K4G3RrMJYoOhbYGxlQEGhSOGogfoLwipExGtUZVVBYIVAluaAaUpuWA+YujlPF22Ra/iBLYEOsV6tV4w0FiitfmLsXiBMU0NiAVrfsp77Zd8MHPgbDoHtva6uLs1jiv1piAKy5tCG+4KJ9wVO/p6RDzvy+b5rzSwP9Okh/WKPERiCWzfk4K8bUSTiOljAyCdx5DZG4gE8W5Dov+NYUfsV/j50fUC4dmXIQDh0qQ6PVgJsOcLM8oA410Ggvo6Ojr81di+g2TKuQOiyJOKWxlpCJpM5zUjKAL3awTsamQfEbYhjtDGKa5tPsyn/wAuiURftlBO56h6aunEwCMxxvV1d+2Fr7Jce2vAu5LUtLeoGi/19gtbToCaR97BoD6BvUs+WkXqgbw6OuhC6wH5l4rRGaCFOvYnjYbyxnpcsCvDVhYOxo6+zszNwSNHVTtJEmSiwzlMAQmNPwIPW42Dds2hfEK/5WJo0Fth+5VNxFHSlkoTzFRh/N3wnq0OGWxXtdoO8enFwaI4jsyidYgNZTxhrMEjEJ4w+En65ESWRXZ7Q4K/COqDAPlhka87WedB8KawmngTIHREOJs5pMiRp+p/GGgxL1FiA9hxjK6G1tVVdhJGAV15+cPXq1f7dahVC20Wg4miCp0uTe3Xh4Hwu93rY1B7SR/t7xQbP5R1FGgpy8IlKe+MJhZ9Aa7u5jPm+pGLX2BMDOZ+hDXgQiXIJ5xoXHZg96anEEFcvOTi0SMUXS4w0FijSTzTWYEA3hkTSEtDI2qw6RoytDLA6jctCvzKqJ8oPFOO7kAhnYe9cZGiWiZ/N9ezguWaSL4h3TUfvKJIfoN0I4sjigYSdZyxlcDVMgEczEY41ER6oZFBOh2Yqegf2zYoziFC3DuZZrjSTPLDtMlxaNPmPP/54W2OPxksrVozP5fLPGr8vEOpbxJCr3jQSJyDvGRNRhv7iHh8vE5LMpKznHBz4zSTOaXwe+mXGGh9tbWvVQf+iyfCAON/ZlTj4v43ECfB94Le4CuMrWVpTtw7O9fZOM5M8oD7xVSOLBdLuNWN1g7bgJUF8+4qpBjf7Te9M6hD4tBDc0289Wh2MHbuaSR7gsHOMLBaQ9W/G6o5MJrNDPu9dcYdQ33Yc95I6OFV5hnp2cGCliDingX5KU+9MShd0dmqta/k8J4zwnV2JsuuNxAnI83VwNpO52kiSoC4djA255cuXBzYPycGzjTQWkPdNY00OfRcQVLafRnd39ySLLsG1i20AyPZ3cDb7AyNJgnp1cOhUHUhcFiL045v9jTUa8Gjlm29fsQQhb3DzJLUEhC+oiK7EISPOwapoEh+7JQJti5YfGXs0YNC62ouC1h9lsrlToClsjc/RM7uSe0kd3EmlzTO/Kqk8Q106mM/Yw2aOB9jnOg6sWTHxJ9FraSJMy6nGz7RbZUDYmN7e3BnQ5Gisez7u3J9c0JwA6Pb0aCFvNObgwKk6NoU59uJwaJ8y1viAT4vCtEFXYO8SFQGtCZpllyXQtNqL+4lmZ/BN/5qJKQFZozEHe9JtAGSaw4wsFnie4JmUQcjleh8yZq0Fnmq3y0D02IzPMgnonYqYIfA4pC+TcXrgIahLB+PEb5s5HrjaR0b7kbHGB0pK7TDO1/T39x1lUZGAPlUH0xTbz+KSoC4dDDx2DQCHzTCaWOB5zjbW+KCSpW0IS0BIJmy6zWCk7WDuxZ4r5oO6dHB7e/sBZo4H2OfUsYOv9jHW+ECJdkAtA/c6MpmMd+XaEKj7km9M4F5TEfBzSKovDLKG1cHobw+b6EDa3WOksYBPAhevBUJMxl8GJTRhFyMLBKSJFn5ls9nvmogS0DfaHOzb3h8AcUuNNBLQNiWa0gRv4MwMMyBwCqxAfCIH82JdYSJKQN+ocjA5NHD2I/e1aj/23iPyhbG6A+bAgXsZoUEII/UAkkQORu71JqIE7o22HBw4VaelpWU74mPPDc/39d1trO5Qb4vJ8QXxbwat06WofcTInMCzeToAtN4VXUn/l1AXDkan9tDSfmL6C81BZooHxDkN9CMveLFZFFAWWZtDwVta3G0sJcAbe3bmYEiniShBXabcL+wflQDD5mD0yKlvk0b/Tk33AG5F7idG+/ibRe54oEl1nLG6A+ZYe1jyAIuG/u2LB3MazxwAfL5vJFGJinxQUwcju6c/n3+FNPm5JhJyy2k/sQTp5nm+2HBJCGi1X1WpwzuBoQXAN+IcjDz8mdePKi/WhH1uxd7GcCjIVBcWpUYDfZ0VbclEJSr2akMBhVrdX6j+Jx3DpSh7vKB8CIiqKwcrcXGqdr05k3RKbU9ryTQVkUB3aHMrEshw7kGCXiv8xxG0h6Uzent6Fpn6MhA17A6GT/3yTxNO1coJbgWur3JFf1fXNuTes5AZe18xXobFHJKv04JZc3O7CtIcgGL9KW03u3QCfL4D4b292dhrpoYgsYOhEz4kaOuHqXKqiagYiN9QnUlyKgX84JUYsQFP9GKzMFRSe8XJb9upE9Dn62CK/KQT75wdTLz+NXgPNdrDuYzeUd0ByN4Wp07n+EdCRZuTY1/ymZQDwIjQye9pA32xdw6IiUgHc639mN8kzCLRjkxzQRzitUpkZ8LZBP1CILUd55EVvdgsCrzJl5i8mgCja+Zgjst4Pq3DUnMmtSWqyNIuQruRU3+CbO08n+pvBAZAjf1IU5kcGJc0YRMBfVV3MPd2RN4+YbvYukI/3sSpe+LUmbw0ryG/6ts1oSLeYrMw6C0xeaFAGc+Wq3hbfeRk582b55lrzf3UHJwWkD0Wp+6BQ3+BfXEXw6UCdHX4TVB0BoJi9Y1Cp59XbUWN8HW7lRjLli3zbINE+1hNiCRI1cGakIhT99ani/A6z1z1nDoUqNQfbO40kyqDfrCBwMg3E5rsCy+8sFlHR8dEnFzRTq/I8hQ9NFFOtGhXVOxgFeUqfknUK7Ctpjl1ANKJ/vmUkvrdwRZmWjpA4J9MTyja2toKY8TQa/ufxP/Whdd5c5cQJHIwfBsTvkKiaqd6/fRyOHKqavdL0H+V2sxmWvrQCAeKItfmQlNyDG/8SVwnetMHyxmA7lm0K2I7GFrlVBW/V6FPP9GqeU4V0Kt2+O2yhctUN6AJBEWD9ngMnessJxh5AfCoQe+8q+xQOYLuWbQrQh2MXP1XYh8S9DKC2sI1z6kCatW3/RCZ6Vj9fNPMqx2wQVNJQlcNEl/mGG5pv48bi7HxMVSOoHsW7QqPg5GlvnJtk6/B9+HMqYUfaXE6rampqWy4dVhgi8FfLprnBXEex+i/wCSkNiSNDSpUxxt7Ccj2nQQYAwUHc9yE3HEotuifDklnfFYMdGNC/lWCxotDf4PvB/jHZTs71c+f2n+ryqCPPcb5/pKdGrTvbH2MUjH4ByOLBDpON9YSFi5cuI1FOwFbbyTox5T6y+iwFL8CqvWvwVtolWgSv/N4sXbl5ZP3r8hRLT50d56KgYJDCYXVhYOhtqqReKDdZuGJtSQSOk8f67x581SspvH3lpoBe9Vefbg/lzveaXmnAf6tEDMNGRp3LnV3ch29o10lQIf+bOKZc+XnmMGARF2EK4vUwQiSw33n7ZlqDWwcaK9Ob29vd26vwj+OT8m3kKFxdd9tlILSJ1Wo8Y8RZT/YiKOY4le5P3SGZJAc7telg7FroL16Jc/n/a1cBBCxsSblwT8LOfofcCh4AQ4x1uoCXZtgVKnYDXLMUECnPSQD29VBcrhfVw7GHrVXb6WylGg0SvUZcrr+YPYuwWVfaE9ltmpA2Q6EQq2UY+yigzf2oqCH4v4MIysD94fdwdig9uqDnB4T5/d+gwHPGNVFcOopyJiPLOfmGTwa0Ek8qS8RKDKORLFWH95utwbDd94SRqqN/Cv4PDXbTFfXfUZWBvRUPJCRBJiIqfnnccy0Dz74wHkWoypY2D4ZGU8gK+kKjQKQ8RcTW1uQI2fmc7nH7LIMFEW+sw6xdyN4CgvNByNIDjp+ZyRVhzlV7dVLaZc7t1cRoW0w9of/No6ptbuRdZupqC3QPZY33HchMkbJiRPssgyaHkN82XaJXPtOJuN+JRuixQI6Cu1VXiZtJehcFGpeNPyXI6cqPWTIvsxU1R7o912akevre4OHfTHot3fEfRbD3y8+Qu0djO5Ce5UXNGl7dTt4z0RGqnOuhgLZgmcPk2FHrrd3jgwkAVQ58e1ioxjcHeMLPWQcq+5gZKm9+hJHjXo5z4xQBQsxxyDjEfir+nNq5GfQo/nYh6f9e4NUgGEFx3DEzvw1nPrOhSJ+kh6GUBUHw6//Kmls96dJ2qv6FxNF9z8g405kVLVXDfkaiFAd4JIkttYUGFpyDOf91Ch/YVEe8DA/gORpuywDfLNMjBOQt4qEupbTPTX4YeJig+/qrnoxkfMeIdH2UHGBfP0H6kFepElc1rY5lBQYXZbzuO7BWYH7b3V3d/+TX1FEG/JSExEJdOi7qsnrx3DuNM8Zdg2NqnN/BjK0EXlVhxORr56wP6Lv/DT+X1FzYLynaOWe2s1TjCQW4An9t6Jk4hBVdH6YpB9YNXoS+SRk/JaQZHd5J2CnesLuyGaze3KZ2hTemoNcpO+uB3pAQuzvC7SeJSfc0258Wo97aX9PT+TmMEMB73jsO0wJzXnVx4llL7pe5kWaFtSqGHHgu6rpPr5jsdx+hyI59G+hA4C25GDO1V69mbf/77h0+lZpzZX44B+Ye1X1cWKz92pKrYlcjtzc6gfN+ufhApd/ErcwTvuTRNI0m4c4Tg77u6gfbCHdTuQcrRFaRKiFU7Xl1O/RqX9RObevRxR43gmEBYUn9wEJIMeF/jk0yVKTta2tE0jg43kx1OatWifEYKDrHYKGDnfkMrU1xHUPaoh7k8i+030EvoV3c6i4aTCoc/9+9NVkFgh6BmZFaig08he3oxYkwBEkQGCzg7gfG6kzaDvuSyLfgIyqt1cF6SAspoS4iJf3c9xaf3JrGEgUzZcOGgvO4agzjTQUkI9V5z4851MuLhBvUUp1gR7tjXEHL+shXFZnduNIBomi6T73FVLLByQePu4N3CxMbVxyzfeQUTYZrdpA3yvoPVf/1jdTGggC6aXx0ieLSecFcWoj72vkhU4IcswU7gVORksb6FHnufbouJ4Xbv+gf1g0EADav9uSeO9YenpA3IfURFVZ0gqEms1rRg0qCzM4TuYy1T061jt0dXXpX0xJ96FMDXIqQXtJ3tSfze6OaY0KU1ogfTUgUJMK0lBIL06dS/F/LJeRe0k2kAAk7BgSWN2GVW/aCOjRuPCbBHVGBG6J3ECKIN3VlfjroguqA+RrMsFvCNqisf5mRox2qPlB4s8vuiMdIE/fVjVvLlRnhKlqYLig7QIpOiva40PAqR2E22neJFrN10AVgWMOIDgPuMOjmRFa+HVaR0fHliaugXoEOe80nBWrZg2dZkZoYffuaW5u1kCVkadmbT70AGdqJodWOhxHqP2eFg1UDvsLatnSFq41M+KKnp6eXbhsdB2OdGiCeX8+/2ecqgnmk/VXNYtqYLSAnNposzpjgw3+H/belpVa8J7TAAAAAElFTkSuQmCC",t.style.position="absolute",t.style.left="50%",t.style.top="50%",t.style.marginLeft="-60px",t.style.marginTop="-60px",t.style.animation="spin1 2s infinite ease-in-out",t.style.webkitAnimation="spin1 2s infinite ease-in-out",t.style.transformOrigin="50% 50%",t.style.webkitTransformOrigin="50% 50%",this._loadingDiv.appendChild(t),this._resizeLoadingUI(),window.addEventListener("resize",this._resizeLoadingUI),this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor,document.body.appendChild(this._loadingDiv),this._loadingDiv.style.opacity="1"}},e.prototype.hideLoadingUI=function(){var e=this;if(this._loadingDiv){this._loadingDiv.style.opacity="0",this._loadingDiv.addEventListener("transitionend",(function(){e._loadingDiv&&(document.body.removeChild(e._loadingDiv),window.removeEventListener("resize",e._resizeLoadingUI),e._loadingDiv=null)}))}},Object.defineProperty(e.prototype,"loadingUIText",{get:function(){return this._loadingText},set:function(e){this._loadingText=e,this._loadingTextDiv&&(this._loadingTextDiv.innerHTML=this._loadingText)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"loadingUIBackgroundColor",{get:function(){return this._loadingDivBackgroundColor},set:function(e){this._loadingDivBackgroundColor=e,this._loadingDiv&&(this._loadingDiv.style.backgroundColor=this._loadingDivBackgroundColor)},enumerable:!0,configurable:!0}),e})(),tr.DefaultLoadingScreen=ir,(function(P){var A=(function(){function t(e,t,i){this.lengthComputable=e,this.loaded=t,this.total=i}return t.FromProgressEvent=function(e){return new t(e.lengthComputable,e.loaded,e.total)},t})();P.SceneLoaderProgressEvent=A;var e=(function(){function x(){}return Object.defineProperty(x,"ForceFullSceneLoadingForIncremental",{get:function(){return x._ForceFullSceneLoadingForIncremental},set:function(e){x._ForceFullSceneLoadingForIncremental=e},enumerable:!0,configurable:!0}),Object.defineProperty(x,"ShowLoadingScreen",{get:function(){return x._ShowLoadingScreen},set:function(e){x._ShowLoadingScreen=e},enumerable:!0,configurable:!0}),Object.defineProperty(x,"loggingLevel",{get:function(){return x._loggingLevel},set:function(e){x._loggingLevel=e},enumerable:!0,configurable:!0}),Object.defineProperty(x,"CleanBoneMatrixWeights",{get:function(){return x._CleanBoneMatrixWeights},set:function(e){x._CleanBoneMatrixWeights=e},enumerable:!0,configurable:!0}),x._getDefaultPlugin=function(){return x._registeredPlugins[".babylon"]},x._getPluginForExtension=function(e){var t=x._registeredPlugins[e];return t||(P.Tools.Warn("Unable to find a plugin to load "+e+" files. Trying to use .babylon default plugin. To load from a specific filetype (eg. gltf) see: http://doc.babylonjs.com/how_to/load_from_any_file_type"),x._getDefaultPlugin())},x._getPluginForDirectLoad=function(e){for(var t in x._registeredPlugins){var i=x._registeredPlugins[t].plugin;if(i.canDirectLoad&&i.canDirectLoad(e))return x._registeredPlugins[t]}return x._getDefaultPlugin()},x._getPluginForFilename=function(e){var t=e.indexOf("?");-1!==t&&(e=e.substring(0,t));var i=e.lastIndexOf("."),r=e.substring(i,e.length).toLowerCase();return x._getPluginForExtension(r)},x._getDirectLoad=function(e){return"data:"===e.substr(0,5)?e.substr(5):null},x._loadData=function(e,i,r,t,n,o,s){var a,l=x._getDirectLoad(e.name),c=s?x._getPluginForExtension(s):l?x._getPluginForDirectLoad(e.name):x._getPluginForFilename(e.name);a=c.plugin.createPlugin?c.plugin.createPlugin():c.plugin;var h,u=c.isBinary;x.OnPluginActivatedObservable.notifyObservers(a);var d=function(e,t){i.isDisposed?n("Scene has been disposed"):(i.database=h,r(a,e,t))},f=null,p=!1,_=a.onDisposeObservable;_&&_.add((function(){p=!0,f&&(f.abort(),f=null),o()}));var m=function(){p||(f=P.Tools.LoadFile(e.url,d,t?function(e){t(A.FromProgressEvent(e))}:void 0,h,u,(function(e,t){n("Failed to load scene."+(t?" "+t.message:""),t)})))};if(l)return d(l),a;if(-1===e.rootUrl.indexOf("file:")){var g=i.getEngine(),v=g.enableOfflineSupport;if(v){for(var y=!1,b=0,T=i.disableOfflineSupportExceptionRules;b<T.length;b++){if(T[b].test(e.url)){y=!0;break}}v=!y}v?h=new P.Database(e.url,m,g.disableManifestCheck):m()}else{var E=P.FilesInput.FilesToLoad[e.name.toLowerCase()];E?f=P.Tools.ReadFile(E,d,t,u):n("Unable to find file named "+e.name)}return a},x._getFileInfo=function(e,t){var i,r;if(t){if("/"===t.substr(0,1))return P.Tools.Error("Wrong sceneFilename parameter"),null;i=e+t,r=t}else i=e,r=P.Tools.GetFilename(e),e=P.Tools.GetFolderPath(e);return{url:i,rootUrl:e,name:r}},x.GetPluginForExtension=function(e){return x._getPluginForExtension(e).plugin},x.IsPluginForExtensionAvailable=function(e){return!!x._registeredPlugins[e]},x.RegisterPlugin=function(t){if("string"==typeof t.extensions){var e=t.extensions;x._registeredPlugins[e.toLowerCase()]={plugin:t,isBinary:!1}}else{var i=t.extensions;Object.keys(i).forEach((function(e){x._registeredPlugins[e.toLowerCase()]={plugin:t,isBinary:i[e].isBinary}}))}},x.ImportMesh=function(a,e,t,l,n,i,r,o){if(void 0===t&&(t=""),void 0===l&&(l=P.Engine.LastCreatedScene),void 0===n&&(n=null),void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),!l)return P.Tools.Error("No scene available to import mesh to"),null;var c=x._getFileInfo(e,t);if(!c)return null;var s={};l._addPendingData(s);var h=function(){l._removePendingData(s)},u=function(e,t){var i="Unable to import meshes from "+c.url+": "+e;r?r(l,i,t):P.Tools.Error(i),h()},d=i?function(e){try{i(e)}catch(e){u("Error in onProgress callback",e)}}:void 0,f=function(e,t,i,r){if(l.importedMeshesFiles.push(c.url),n)try{n(e,t,i,r)}catch(e){u("Error in onSuccess callback",e)}l._removePendingData(s)};return x._loadData(c,l,(function(t,e,i){if(t.rewriteRootURL&&(c.rootUrl=t.rewriteRootURL(c.rootUrl,i)),t.importMesh){var r=t,n=new Array,o=new Array,s=new Array;if(!r.importMesh(a,l,e,c.rootUrl,n,o,s,u))return;l.loadingPluginName=t.name,f(n,o,s,[])}else{t.importMeshAsync(a,l,e,c.rootUrl,d,c.name).then((function(e){l.loadingPluginName=t.name,f(e.meshes,e.particleSystems,e.skeletons,e.animationGroups)})).catch((function(e){u(e.message,e)}))}}),d,u,h,o)},x.ImportMeshAsync=function(e,t,i,o,s,a){return void 0===i&&(i=""),void 0===o&&(o=P.Engine.LastCreatedScene),void 0===s&&(s=null),void 0===a&&(a=null),new Promise(function(n,r){x.ImportMesh(e,t,i,o,(function(e,t,i,r){n({meshes:e,particleSystems:t,skeletons:i,animationGroups:r})}),s,(function(e,t,i){r(i||new Error(t))}),a)})},x.Load=function(e,t,i,r,n,o,s){return void 0===r&&(r=null),void 0===n&&(n=null),void 0===o&&(o=null),void 0===s&&(s=null),x.Append(e,t,new P.Scene(i),r,n,o,s)},x.LoadAsync=function(e,i,n,o,s){return void 0===o&&(o=null),void 0===s&&(s=null),new Promise(function(t,r){x.Load(e,i,n,(function(e){t(e)}),o,(function(e,t,i){r(i||new Error(t))}),s)})},x.Append=function(e,t,r,i,n,o,s){if(void 0===t&&(t=""),void 0===r&&(r=P.Engine.LastCreatedScene),void 0===i&&(i=null),void 0===n&&(n=null),void 0===o&&(o=null),void 0===s&&(s=null),!r)return P.Tools.Error("No scene available to append to"),null;var a=x._getFileInfo(e,t);if(!a)return null;x.ShowLoadingScreen&&r.getEngine().displayLoadingUI();var l={};r._addPendingData(l);var c=function(){r._removePendingData(l),r.getEngine().hideLoadingUI()},h=function(e,t){var i="Unable to load from "+a.url+(e?": "+e:"");o?o(r,i,t):P.Tools.Error(i),c()},u=n?function(e){try{n(e)}catch(e){h("Error in onProgress callback",e)}}:void 0,d=function(){if(i)try{i(r)}catch(e){h("Error in onSuccess callback",e)}r._removePendingData(l)};return x._loadData(a,r,(function(e,t,i){if(e.load){if(!e.load(r,t,a.rootUrl,h))return;r.loadingPluginName=e.name,d()}else{e.loadAsync(r,t,a.rootUrl,u,a.name).then((function(){r.loadingPluginName=e.name,d()})).catch((function(e){h(e.message,e)}))}x.ShowLoadingScreen&&r.executeWhenReady((function(){r.getEngine().hideLoadingUI()}))}),u,h,c,s)},x.AppendAsync=function(e,i,n,o,s){return void 0===i&&(i=""),void 0===n&&(n=P.Engine.LastCreatedScene),void 0===o&&(o=null),void 0===s&&(s=null),new Promise(function(t,r){x.Append(e,i,n,(function(e){t(e)}),o,(function(e,t,i){r(i||new Error(t))}),s)})},x.LoadAssetContainer=function(e,t,n,i,r,o,s){if(void 0===t&&(t=""),void 0===n&&(n=P.Engine.LastCreatedScene),void 0===i&&(i=null),void 0===r&&(r=null),void 0===o&&(o=null),void 0===s&&(s=null),!n)return P.Tools.Error("No scene available to load asset container to"),null;var a=x._getFileInfo(e,t);if(!a)return null;var l={};n._addPendingData(l);var c=function(){n._removePendingData(l)},h=function(e,t){var i="Unable to load assets from "+a.url+(e?": "+e:"");o?o(n,i,t):P.Tools.Error(i),c()},u=r?function(e){try{r(e)}catch(e){h("Error in onProgress callback",e)}}:void 0,d=function(e){if(i)try{i(e)}catch(e){h("Error in onSuccess callback",e)}n._removePendingData(l)};return x._loadData(a,n,(function(t,e,i){if(t.loadAssetContainer){var r=t.loadAssetContainer(n,e,a.rootUrl,h);if(!r)return;n.loadingPluginName=t.name,d(r)}else if(t.loadAssetContainerAsync){t.loadAssetContainerAsync(n,e,a.rootUrl,u,a.name).then((function(e){n.loadingPluginName=t.name,d(e)})).catch((function(e){h(e.message,e)}))}else h("LoadAssetContainer is not supported by this plugin. Plugin did not provide a loadAssetContainer or loadAssetContainerAsync method.");x.ShowLoadingScreen&&n.executeWhenReady((function(){n.getEngine().hideLoadingUI()}))}),u,h,c,s)},x.LoadAssetContainerAsync=function(e,i,n,o,s){return void 0===i&&(i=""),void 0===n&&(n=P.Engine.LastCreatedScene),void 0===o&&(o=null),void 0===s&&(s=null),new Promise(function(t,r){x.LoadAssetContainer(e,i,n,(function(e){t(e)}),o,(function(e,t,i){r(i||new Error(t))}),s)})},x._ForceFullSceneLoadingForIncremental=!1,x._ShowLoadingScreen=!0,x._CleanBoneMatrixWeights=!1,x.NO_LOGGING=0,x.MINIMAL_LOGGING=1,x.SUMMARY_LOGGING=2,x.DETAILED_LOGGING=3,x._loggingLevel=x.NO_LOGGING,x.OnPluginActivatedObservable=new P.Observable,x._registeredPlugins={},x})();P.SceneLoader=e})($a||($a={})),rr=$a||($a={}),nr=function(e,t,i,r){for(var n=0,o=t.materials.length;n<o;n++){var s=t.materials[n];if(s.id===e)return rr.Material.Parse(s,i,r)}return null},or=function(e,t,i){for(var r in t)if(e.name===t[r])return i.push(e.id),!0;return!(!e.parentId||-1===i.indexOf(e.parentId))&&(i.push(e.id),!0)},sr=function(e,t){return e+" of "+(t?t.file+" from "+t.name+" version: "+t.version+", exporter version: "+t.exporter_version:"unknown")},ar=function(e,t,i,r,n){void 0===n&&(n=!1);var o=new rr.AssetContainer(e),s="importScene has failed JSON parse";try{var a=JSON.parse(t);s="";var l,c,h=rr.SceneLoader.loggingLevel===rr.SceneLoader.DETAILED_LOGGING;if(void 0!==a.lights&&null!==a.lights)for(l=0,c=a.lights.length;l<c;l++){var u=a.lights[l],d=rr.Light.Parse(u,e);d&&(o.lights.push(d),s+=0===l?"\n\tLights:":"",s+="\n\t\t"+d.toString(h))}if(void 0!==a.animations&&null!==a.animations)for(l=0,c=a.animations.length;l<c;l++){var f=a.animations[l],p=rr.Animation.Parse(f);e.animations.push(p),o.animations.push(p),s+=0===l?"\n\tAnimations:":"",s+="\n\t\t"+p.toString(h)}if(void 0!==a.materials&&null!==a.materials)for(l=0,c=a.materials.length;l<c;l++){var _=a.materials[l],m=rr.Material.Parse(_,e,i);o.materials.push(m),s+=0===l?"\n\tMaterials:":"",s+="\n\t\t"+m.toString(h)}if(void 0!==a.multiMaterials&&null!==a.multiMaterials)for(l=0,c=a.multiMaterials.length;l<c;l++){var g=a.multiMaterials[l],v=rr.Material.ParseMultiMaterial(g,e);o.multiMaterials.push(v),s+=0===l?"\n\tMultiMaterials:":"",s+="\n\t\t"+v.toString(h)}if(void 0!==a.morphTargetManagers&&null!==a.morphTargetManagers)for(var y=0,b=a.morphTargetManagers;y<b.length;y++){var T=b[y];o.morphTargetManagers.push(rr.MorphTargetManager.Parse(T,e))}if(void 0!==a.skeletons&&null!==a.skeletons)for(l=0,c=a.skeletons.length;l<c;l++){var E=a.skeletons[l],x=rr.Skeleton.Parse(E,e);o.skeletons.push(x),s+=0===l?"\n\tSkeletons:":"",s+="\n\t\t"+x.toString(h)}var P=a.geometries;if(null!=P){var A=new Array,S=P.boxes;if(null!=S)for(l=0,c=S.length;l<c;l++){var M=S[l];A.push(rr.BoxGeometry.Parse(M,e))}var R=P.spheres;if(null!=R)for(l=0,c=R.length;l<c;l++){var C=R[l];A.push(rr.SphereGeometry.Parse(C,e))}var O=P.cylinders;if(null!=O)for(l=0,c=O.length;l<c;l++){var D=O[l];A.push(rr.CylinderGeometry.Parse(D,e))}var I=P.toruses;if(null!=I)for(l=0,c=I.length;l<c;l++){var w=I[l];A.push(rr.TorusGeometry.Parse(w,e))}var L=P.grounds;if(null!=L)for(l=0,c=L.length;l<c;l++){var F=L[l];A.push(rr.GroundGeometry.Parse(F,e))}var B=P.planes;if(null!=B)for(l=0,c=B.length;l<c;l++){var N=B[l];A.push(rr.PlaneGeometry.Parse(N,e))}var V=P.torusKnots;if(null!=V)for(l=0,c=V.length;l<c;l++){var U=V[l];A.push(rr.TorusKnotGeometry.Parse(U,e))}var z=P.vertexData;if(null!=z)for(l=0,c=z.length;l<c;l++){var G=z[l];A.push(rr.Geometry.Parse(G,e,i))}A.forEach((function(e){e&&o.geometries.push(e)}))}if(void 0!==a.transformNodes&&null!==a.transformNodes)for(l=0,c=a.transformNodes.length;l<c;l++){var k=a.transformNodes[l],W=rr.TransformNode.Parse(k,e,i);o.transformNodes.push(W)}if(void 0!==a.meshes&&null!==a.meshes)for(l=0,c=a.meshes.length;l<c;l++){var H=a.meshes[l],X=rr.Mesh.Parse(H,e,i);o.meshes.push(X),s+=0===l?"\n\tMeshes:":"",s+="\n\t\t"+X.toString(h)}if(void 0!==a.cameras&&null!==a.cameras)for(l=0,c=a.cameras.length;l<c;l++){var j=a.cameras[l],Y=rr.Camera.Parse(j,e);o.cameras.push(Y),s+=0===l?"\n\tCameras:":"",s+="\n\t\t"+Y.toString(h)}if(void 0!==a.animationGroups&&null!==a.animationGroups)for(l=0,c=a.animationGroups.length;l<c;l++){var K=a.animationGroups[l],Q=rr.AnimationGroup.Parse(K,e);o.animationGroups.push(Q),s+=0===l?"\n\tAnimationGroups:":"",s+="\n\t\t"+Q.toString(h)}for(l=0,c=e.cameras.length;l<c;l++){(Y=e.cameras[l])._waitingParentId&&(Y.parent=e.getLastEntryByID(Y._waitingParentId),Y._waitingParentId=null)}for(l=0,c=e.lights.length;l<c;l++){var Z=e.lights[l];Z&&Z._waitingParentId&&(Z.parent=e.getLastEntryByID(Z._waitingParentId),Z._waitingParentId=null)}for(l=0,c=e.transformNodes.length;l<c;l++){var q=e.transformNodes[l];q._waitingParentId&&(q.parent=e.getLastEntryByID(q._waitingParentId),q._waitingParentId=null)}for(l=0,c=e.meshes.length;l<c;l++){(X=e.meshes[l])._waitingParentId&&(X.parent=e.getLastEntryByID(X._waitingParentId),X._waitingParentId=null)}for(l=0,c=e.meshes.length;l<c;l++){var J=e.meshes[l];J._waitingFreezeWorldMatrix?(J.freezeWorldMatrix(),J._waitingFreezeWorldMatrix=null):J.computeWorldMatrix(!0)}for(l=0,c=e.lights.length;l<c;l++){var $=e.lights[l];if(0<$._excludedMeshesIds.length){for(var ee=0;ee<$._excludedMeshesIds.length;ee++){var te=e.getMeshByID($._excludedMeshesIds[ee]);te&&$.excludedMeshes.push(te)}$._excludedMeshesIds=[]}if(0<$._includedOnlyMeshesIds.length){for(var ie=0;ie<$._includedOnlyMeshesIds.length;ie++){var re=e.getMeshByID($._includedOnlyMeshesIds[ie]);re&&$.includedOnlyMeshes.push(re)}$._includedOnlyMeshesIds=[]}}for(rr.AbstractScene.Parse(a,e,o,i),l=0,c=e.meshes.length;l<c;l++){(X=e.meshes[l])._waitingActions&&(rr.ActionManager.Parse(X._waitingActions,X,e),X._waitingActions=null)}void 0!==a.actions&&null!==a.actions&&rr.ActionManager.Parse(a.actions,null,e),n||o.removeAllFromScene()}catch(e){var ne=sr("loadAssets",a?a.producer:"Unknown")+s;if(!r)throw rr.Tools.Log(ne),e;r(ne,e)}finally{null!==s&&rr.SceneLoader.loggingLevel!==rr.SceneLoader.NO_LOGGING&&rr.Tools.Log(sr("loadAssets",a?a.producer:"Unknown")+(rr.SceneLoader.loggingLevel!==rr.SceneLoader.MINIMAL_LOGGING?s:""))}return o},rr.SceneLoader.RegisterPlugin({name:"babylon.js",extensions:".babylon",canDirectLoad:function(e){return-1!==e.indexOf("babylon")},importMesh:function(e,i,t,r,n,o,s,a){var l="importMesh has failed JSON parse";try{var c=JSON.parse(t);l="";var h=rr.SceneLoader.loggingLevel===rr.SceneLoader.DETAILED_LOGGING;e?Array.isArray(e)||(e=[e]):e=null;var u=new Array;if(void 0!==c.meshes&&null!==c.meshes){var d,f,p,_=[],m=[];for(d=0,f=c.meshes.length;d<f;d++){var g=c.meshes[d];if(null===e||or(g,e,u)){if(null!==e&&delete e[e.indexOf(g.name)],void 0!==g.geometryId&&null!==g.geometryId&&void 0!==c.geometries&&null!==c.geometries){var v=!1;["boxes","spheres","cylinders","toruses","grounds","planes","torusKnots","vertexData"].forEach((function(t){!0!==v&&c.geometries[t]&&Array.isArray(c.geometries[t])&&c.geometries[t].forEach((function(e){if(e.id===g.geometryId){switch(t){case"boxes":rr.BoxGeometry.Parse(e,i);break;case"spheres":rr.SphereGeometry.Parse(e,i);break;case"cylinders":rr.CylinderGeometry.Parse(e,i);break;case"toruses":rr.TorusGeometry.Parse(e,i);break;case"grounds":rr.GroundGeometry.Parse(e,i);break;case"planes":rr.PlaneGeometry.Parse(e,i);break;case"torusKnots":rr.TorusKnotGeometry.Parse(e,i);break;case"vertexData":rr.Geometry.Parse(e,i,r)}v=!0}}))})),!1===v&&rr.Tools.Warn("Geometry not found for mesh "+g.id)}if(g.materialId){var y=-1!==m.indexOf(g.materialId);if(!1===y&&void 0!==c.multiMaterials&&null!==c.multiMaterials)for(var b=0,T=c.multiMaterials.length;b<T;b++){var E=c.multiMaterials[b];if(E.id===g.materialId){for(var x=0,P=E.materials.length;x<P;x++){var A,S=E.materials[x];m.push(S),(A=nr(S,c,i,r))&&(l+="\n\tMaterial "+A.toString(h))}m.push(E.id);var M=rr.Material.ParseMultiMaterial(E,i);M&&(y=!0,l+="\n\tMulti-Material "+M.toString(h));break}}!1===y&&(m.push(g.materialId),(A=nr(g.materialId,c,i,r))?l+="\n\tMaterial "+A.toString(h):rr.Tools.Warn("Material not found for mesh "+g.id))}if(-1<g.skeletonId&&void 0!==c.skeletons&&null!==c.skeletons&&!1==-1<_.indexOf(g.skeletonId))for(var R=0,C=c.skeletons.length;R<C;R++){var O=c.skeletons[R];if(O.id===g.skeletonId){var D=rr.Skeleton.Parse(O,i);s.push(D),_.push(O.id),l+="\n\tSkeleton "+D.toString(h)}}if(void 0!==c.morphTargetManagers&&null!==c.morphTargetManagers)for(var I=0,w=c.morphTargetManagers;I<w.length;I++){var L=w[I];rr.MorphTargetManager.Parse(L,i)}var F=rr.Mesh.Parse(g,i,r);n.push(F),l+="\n\tMesh "+F.toString(h)}}for(d=0,f=i.meshes.length;d<f;d++)(p=i.meshes[d])._waitingParentId&&(p.parent=i.getLastEntryByID(p._waitingParentId),p._waitingParentId=null);for(d=0,f=i.meshes.length;d<f;d++)(p=i.meshes[d])._waitingFreezeWorldMatrix?(p.freezeWorldMatrix(),p._waitingFreezeWorldMatrix=null):p.computeWorldMatrix(!0)}if(void 0!==c.particleSystems&&null!==c.particleSystems){var B=rr.AbstractScene.GetIndividualParser(rr.SceneComponentConstants.NAME_PARTICLESYSTEM);if(B)for(d=0,f=c.particleSystems.length;d<f;d++){var N=c.particleSystems[d];-1!==u.indexOf(N.emitterId)&&o.push(B(N,i,r))}}return!0}catch(e){var V=sr("importMesh",c?c.producer:"Unknown")+l;if(!a)throw rr.Tools.Log(V),e;a(V,e)}finally{null!==l&&rr.SceneLoader.loggingLevel!==rr.SceneLoader.NO_LOGGING&&rr.Tools.Log(sr("importMesh",c?c.producer:"Unknown")+(rr.SceneLoader.loggingLevel!==rr.SceneLoader.MINIMAL_LOGGING?l:""))}return!1},load:function(e,t,i,r){var n="importScene has failed JSON parse";try{var o=JSON.parse(t);if(n="",void 0!==o.useDelayedTextureLoading&&null!==o.useDelayedTextureLoading&&(e.useDelayedTextureLoading=o.useDelayedTextureLoading&&!rr.SceneLoader.ForceFullSceneLoadingForIncremental),void 0!==o.autoClear&&null!==o.autoClear&&(e.autoClear=o.autoClear),void 0!==o.clearColor&&null!==o.clearColor&&(e.clearColor=rr.Color4.FromArray(o.clearColor)),void 0!==o.ambientColor&&null!==o.ambientColor&&(e.ambientColor=rr.Color3.FromArray(o.ambientColor)),void 0!==o.gravity&&null!==o.gravity&&(e.gravity=rr.Vector3.FromArray(o.gravity)),o.fogMode&&0!==o.fogMode)switch(e.fogMode=o.fogMode,e.fogColor=rr.Color3.FromArray(o.fogColor),e.fogStart=o.fogStart,e.fogEnd=o.fogEnd,e.fogDensity=o.fogDensity,n+="\tFog mode for scene: ",e.fogMode){case 1:n+="exp\n";break;case 2:n+="exp2\n";break;case 3:n+="linear\n"}if(o.physicsEnabled){var s;"cannon"===o.physicsEngine?s=new rr.CannonJSPlugin:"oimo"===o.physicsEngine&&(s=new rr.OimoJSPlugin),n="\tPhysics engine "+(o.physicsEngine?o.physicsEngine:"oimo")+" enabled\n";var a=o.physicsGravity?rr.Vector3.FromArray(o.physicsGravity):null;e.enablePhysics(a,s)}if(void 0!==o.metadata&&null!==o.metadata&&(e.metadata=o.metadata),void 0!==o.collisionsEnabled&&null!==o.collisionsEnabled&&(e.collisionsEnabled=o.collisionsEnabled),e.workerCollisions=!!o.workerCollisions,!ar(e,t,i,r,!0))return!1;if(o.autoAnimate&&e.beginAnimation(e,o.autoAnimateFrom,o.autoAnimateTo,o.autoAnimateLoop,o.autoAnimateSpeed||1),void 0!==o.activeCameraID&&null!==o.activeCameraID&&e.setActiveCameraByID(o.activeCameraID),void 0!==o.environmentTexture&&null!==o.environmentTexture){if(o.environmentTextureType&&"BABYLON.HDRCubeTexture"===o.environmentTextureType){var l=o.environmentTextureSize?o.environmentTextureSize:128,c=new rr.HDRCubeTexture(i+o.environmentTexture,e,l);o.environmentTextureRotationY&&(c.rotationY=o.environmentTextureRotationY),e.environmentTexture=c}else{var h=rr.CubeTexture.CreateFromPrefilteredData(i+o.environmentTexture,e);o.environmentTextureRotationY&&(h.rotationY=o.environmentTextureRotationY),e.environmentTexture=h}if(!0===o.createDefaultSkybox){var u=void 0!==e.activeCamera&&null!==e.activeCamera?(e.activeCamera.maxZ-e.activeCamera.minZ)/2:1e3,d=o.skyboxBlurLevel||0;e.createDefaultSkybox(void 0,!0,u,d)}}return!0}catch(e){var f=sr("importScene",o?o.producer:"Unknown")+n;if(!r)throw rr.Tools.Log(f),e;r(f,e)}finally{null!==n&&rr.SceneLoader.loggingLevel!==rr.SceneLoader.NO_LOGGING&&rr.Tools.Log(sr("importScene",o?o.producer:"Unknown")+(rr.SceneLoader.loggingLevel!==rr.SceneLoader.MINIMAL_LOGGING?n:""))}return!1},loadAssetContainer:function(e,t,i,r){return ar(e,t,i,r)}}),lr=$a||($a={}),cr=(function(){function n(e,t,i,r,n,o,s,a,l){this.onProcessFileCallback=function(){return!0},this._engine=e,this._currentScene=t,this._sceneLoadedCallback=i,this._progressCallback=r,this._additionalRenderLoopLogicCallback=n,this._textureLoadingCallback=o,this._startingProcessingFilesCallback=s,this._onReloadCallback=a,this._errorCallback=l}return n.prototype.monitorElementForDragNDrop=function(e){var t=this;e&&(this._elementToMonitor=e,this._dragEnterHandler=function(e){t.drag(e)},this._dragOverHandler=function(e){t.drag(e)},this._dropHandler=function(e){t.drop(e)},this._elementToMonitor.addEventListener("dragenter",this._dragEnterHandler,!1),this._elementToMonitor.addEventListener("dragover",this._dragOverHandler,!1),this._elementToMonitor.addEventListener("drop",this._dropHandler,!1))},n.prototype.dispose=function(){this._elementToMonitor&&(this._elementToMonitor.removeEventListener("dragenter",this._dragEnterHandler),this._elementToMonitor.removeEventListener("dragover",this._dragOverHandler),this._elementToMonitor.removeEventListener("drop",this._dropHandler))},n.prototype.renderFunction=function(){if(this._additionalRenderLoopLogicCallback&&this._additionalRenderLoopLogicCallback(),this._currentScene){if(this._textureLoadingCallback){var e=this._currentScene.getWaitingItemsCount();0<e&&this._textureLoadingCallback(e)}this._currentScene.render()}},n.prototype.drag=function(e){e.stopPropagation(),e.preventDefault()},n.prototype.drop=function(e){e.stopPropagation(),e.preventDefault(),this.loadFiles(e)},n.prototype._traverseFolder=function(e,n,o,s){var a=this,t=e.createReader(),l=e.fullPath.replace(/^\//,"").replace(/(.+?)\/?$/,"$1/");t.readEntries((function(e){o.count+=e.length;for(var t=0,i=e;t<i.length;t++){var r=i[t];r.isFile?r.file((function(e){e.correctName=l+e.name,n.push(e),0==--o.count&&s()})):r.isDirectory&&a._traverseFolder(r,n,o,s)}--o.count&&s()}))},n.prototype._processFiles=function(e){for(var t=0;t<e.length;t++){var i=e[t].correctName.toLowerCase(),r=i.split(".").pop();this.onProcessFileCallback(e[t],i,r)&&("babylon"!==r&&"stl"!==r&&"obj"!==r&&"gltf"!==r&&"glb"!==r||-1!==i.indexOf(".binary.babylon")||-1!==i.indexOf(".incremental.babylon")||(this._sceneFileToLoad=e[t]),n.FilesToLoad[i]=e[t])}},n.prototype.loadFiles=function(e){var t=this;if(e&&e.dataTransfer&&e.dataTransfer.files&&(this._filesToLoad=e.dataTransfer.files),e&&e.target&&e.target.files&&(this._filesToLoad=e.target.files),this._filesToLoad&&0!==this._filesToLoad.length&&(this._startingProcessingFilesCallback&&this._startingProcessingFilesCallback(this._filesToLoad),this._filesToLoad&&0<this._filesToLoad.length)){for(var i=new Array,r=[],n=e.dataTransfer?e.dataTransfer.items:null,o=0;o<this._filesToLoad.length;o++){var s=this._filesToLoad[o],a=s.name.toLowerCase(),l=void 0;if(s.correctName=a,n){var c=n[o];c.getAsEntry?l=c.getAsEntry():c.webkitGetAsEntry&&(l=c.webkitGetAsEntry())}l&&l.isDirectory?r.push(l):i.push(s)}if(0===r.length)this._processFiles(i),this._processReload();else for(var h={count:r.length},u=0,d=r;u<d.length;u++){var f=d[u];this._traverseFolder(f,i,h,(function(){t._processFiles(i),0===h.count&&t._processReload()}))}}},n.prototype._processReload=function(){this._onReloadCallback?this._onReloadCallback(this._sceneFileToLoad):this.reload()},n.prototype.reload=function(){var t=this;this._sceneFileToLoad?(this._currentScene&&(0<lr.Tools.errorsCount&&lr.Tools.ClearLogCache(),this._engine.stopRenderLoop()),lr.SceneLoader.LoadAsync("file:",this._sceneFileToLoad.name,this._engine,(function(e){t._progressCallback&&t._progressCallback(e)})).then((function(e){t._currentScene&&t._currentScene.dispose(),t._currentScene=e,t._sceneLoadedCallback&&t._sceneLoadedCallback(t._sceneFileToLoad,t._currentScene),t._currentScene.executeWhenReady((function(){t._engine.runRenderLoop((function(){t.renderFunction()}))}))})).catch((function(e){t._errorCallback&&t._errorCallback(t._sceneFileToLoad,t._currentScene,e.message)}))):lr.Tools.Error("Please provide a valid .babylon file.")},n.FilesToLoad={},n})(),lr.FilesInput=cr,hr=$a||($a={}),ur=(function(){function n(){}return n.EnableFor=function(t){t._tags=t._tags||{},t.hasTags=function(){return n.HasTags(t)},t.addTags=function(e){return n.AddTagsTo(t,e)},t.removeTags=function(e){return n.RemoveTagsFrom(t,e)},t.matchesTagsQuery=function(e){return n.MatchesQuery(t,e)}},n.DisableFor=function(e){delete e._tags,delete e.hasTags,delete e.addTags,delete e.removeTags,delete e.matchesTagsQuery},n.HasTags=function(e){return!!e._tags&&!hr.Tools.IsEmpty(e._tags)},n.GetTags=function(e,t){if(void 0===t&&(t=!0),!e._tags)return null;if(t){var i=[];for(var r in e._tags)e._tags.hasOwnProperty(r)&&!0===e._tags[r]&&i.push(r);return i.join(" ")}return e._tags},n.AddTagsTo=function(r,e){e&&("string"==typeof e&&e.split(" ").forEach((function(e,t,i){n._AddTagTo(r,e)})))},n._AddTagTo=function(e,t){""!==(t=t.trim())&&"true"!==t&&"false"!==t&&(t.match(/[\s]/)||t.match(/^([!]|([|]|[&]){2})/)||(n.EnableFor(e),e._tags[t]=!0))},n.RemoveTagsFrom=function(e,t){if(n.HasTags(e)){var i=t.split(" ");for(var r in i)n._RemoveTagFrom(e,i[r])}},n._RemoveTagFrom=function(e,t){delete e._tags[t]},n.MatchesQuery=function(t,e){return void 0===e||(""===e?n.HasTags(t):hr.AndOrNotEvaluator.Eval(e,(function(e){return n.HasTags(t)&&t._tags[e]})))},n})(),hr.Tags=ur,dr=$a||($a={}),fr=(function(){function c(){}return c.Eval=function(e,t){return"true"===(e=e.match(/\([^\(\)]*\)/g)?e.replace(/\([^\(\)]*\)/g,(function(e){return e=e.slice(1,e.length-1),c._HandleParenthesisContent(e,t)})):c._HandleParenthesisContent(e,t))||"false"!==e&&c.Eval(e,t)},c._HandleParenthesisContent=function(e,t){var i;t=t||function(e){return"true"===e};var r=e.split("||");for(var n in r)if(r.hasOwnProperty(n)){var o=c._SimplifyNegation(r[n].trim()),s=o.split("&&");if(1<s.length)for(var a=0;a<s.length;++a){var l=c._SimplifyNegation(s[a].trim());if(!(i="true"!==l&&"false"!==l?"!"===l[0]?!t(l.substring(1)):t(l):"true"===l)){o="false";break}}if(i||"true"===o){i=!0;break}i="true"!==o&&"false"!==o?"!"===o[0]?!t(o.substring(1)):t(o):"true"===o}return i?"true":"false"},c._SimplifyNegation=function(e){return"!true"===(e=(e=e.replace(/^[\s!]+/,(function(e){return(e=e.replace(/[\s]/g,(function(){return""}))).length%2?"!":""}))).trim())?e="false":"!false"===e&&(e="true"),e},c})(),dr.AndOrNotEvaluator=fr,pr=$a||($a={}),_r=(function(){function c(e,t,i){void 0===i&&(i=!1);var r=this;this.idbFactory=window.indexedDB||window.mozIndexedDB||window.webkitIndexedDB||window.msIndexedDB,this.callbackManifestChecked=t,this.currentSceneUrl=c._ReturnFullUrlLocation(e),this.db=null,this._enableSceneOffline=!1,this._enableTexturesOffline=!1,this.manifestVersionFound=0,this.mustUpdateRessources=!1,this.hasReachedQuota=!1,c.IDBStorageEnabled?i?(this._enableSceneOffline=!0,this._enableTexturesOffline=!0,this.manifestVersionFound=1,pr.Tools.SetImmediate((function(){r.callbackManifestChecked(!0)}))):this._checkManifestFile():this.callbackManifestChecked(!0)}return Object.defineProperty(c.prototype,"enableSceneOffline",{get:function(){return this._enableSceneOffline},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"enableTexturesOffline",{get:function(){return this._enableTexturesOffline},enumerable:!0,configurable:!0}),c.prototype._checkManifestFile=function(){var i=this,r=function(){i._enableSceneOffline=!1,i._enableTexturesOffline=!1,i.callbackManifestChecked(!1)},n=!1,e=this.currentSceneUrl+".manifest",o=new XMLHttpRequest;navigator.onLine&&(n=!0,e=e+(null==e.match(/\?/)?"?":"&")+Date.now()),o.open("GET",e,!0),o.addEventListener("load",(function(){if(200===o.status||pr.Tools.ValidateXHRData(o,1))try{var e=JSON.parse(o.response);i._enableSceneOffline=e.enableSceneOffline,i._enableTexturesOffline=e.enableTexturesOffline,e.version&&!isNaN(parseInt(e.version))&&(i.manifestVersionFound=e.version),i.callbackManifestChecked&&i.callbackManifestChecked(!0)}catch(e){r()}else r()}),!1),o.addEventListener("error",(function(e){if(n){n=!1;var t=i.currentSceneUrl+".manifest";o.open("GET",t,!0),o.send()}else r()}),!1);try{o.send()}catch(e){pr.Tools.Error("Error on XHR send request."),this.callbackManifestChecked(!1)}},c.prototype.openAsync=function(t,e){var i=this,r=function(){i.isSupported=!1,e&&e()};if(this.idbFactory&&(this._enableSceneOffline||this._enableTexturesOffline))if(this.db)t&&t();else{this.hasReachedQuota=!1,this.isSupported=!0;var n=this.idbFactory.open("babylonjs",1);n.onerror=function(e){r()},n.onblocked=function(e){pr.Tools.Error("IDB request blocked. Please reload the page."),r()},n.onsuccess=function(e){i.db=n.result,t()},n.onupgradeneeded=function(e){if(i.db=e.target.result,i.db)try{i.db.createObjectStore("scenes",{keyPath:"sceneUrl"}),i.db.createObjectStore("versions",{keyPath:"sceneUrl"}),i.db.createObjectStore("textures",{keyPath:"textureUrl"})}catch(e){pr.Tools.Error("Error while creating object stores. Exception: "+e.message),r()}}}else this.isSupported=!1,e&&e()},c.prototype.loadImageFromDB=function(e,t){var i=this,r=c._ReturnFullUrlLocation(e),n=function(){i.hasReachedQuota||null===i.db?t.src=e:i._saveImageIntoDBAsync(r,t)};this.mustUpdateRessources?n():this._loadImageFromDBAsync(r,t,n)},c.prototype._loadImageFromDBAsync=function(r,n,o){if(this.isSupported&&null!==this.db){var s,e=this.db.transaction(["textures"]);e.onabort=function(e){n.src=r},e.oncomplete=function(e){var t;if(s){var i=window.URL||window.webkitURL;t=i.createObjectURL(s.data),n.onerror=function(){pr.Tools.Error("Error loading image from blob URL: "+t+" switching back to web url: "+r),n.src=r},n.src=t}else o()};var t=e.objectStore("textures").get(r);t.onsuccess=function(e){s=e.target.result},t.onerror=function(e){pr.Tools.Error("Error loading texture "+r+" from DB."),n.src=r}}else pr.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),n.src=r},c.prototype._saveImageIntoDBAsync=function(r,n){var o=this;if(this.isSupported){var s=function(){var t;if(a){var i=window.URL||window.webkitURL;try{t=i.createObjectURL(a)}catch(e){t=i.createObjectURL(a)}}t&&(n.src=t)};if(c.IsUASupportingBlobStorage){var a,l=new XMLHttpRequest;l.open("GET",r,!0),l.responseType="blob",l.addEventListener("load",(function(){if(200===l.status&&o.db){a=l.response;var e=o.db.transaction(["textures"],"readwrite");e.onabort=function(e){try{var t=(e.srcElement||e.target).error;t&&"QuotaExceededError"===t.name&&(o.hasReachedQuota=!0)}catch(e){}s()},e.oncomplete=function(e){s()};var t={textureUrl:r,data:a};try{var i=e.objectStore("textures").put(t);i.onsuccess=function(e){},i.onerror=function(e){s()}}catch(e){25===e.code&&(c.IsUASupportingBlobStorage=!1),n.src=r}}else n.src=r}),!1),l.addEventListener("error",(function(e){pr.Tools.Error("Error in XHR request in BABYLON.Database."),n.src=r}),!1),l.send()}else n.src=r}else pr.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),n.src=r},c.prototype._checkVersionFromDB=function(e,t){var i=this;this._loadVersionFromDBAsync(e,t,(function(){i._saveVersionIntoDBAsync(e,t)}))},c.prototype._loadVersionFromDBAsync=function(t,i,r){var n,o=this;if(this.isSupported&&this.db)try{var e=this.db.transaction(["versions"]);e.oncomplete=function(e){n?o.manifestVersionFound!==n.data?(o.mustUpdateRessources=!0,r()):i(n.data):(o.mustUpdateRessources=!0,r())},e.onabort=function(e){i(-1)};var s=e.objectStore("versions").get(t);s.onsuccess=function(e){n=e.target.result},s.onerror=function(e){pr.Tools.Error("Error loading version for scene "+t+" from DB."),i(-1)}}catch(e){pr.Tools.Error("Error while accessing 'versions' object store (READ OP). Exception: "+e.message),i(-1)}else pr.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),i(-1)},c.prototype._saveVersionIntoDBAsync=function(e,i){var r=this;if(this.isSupported&&!this.hasReachedQuota&&this.db)try{var t=this.db.transaction(["versions"],"readwrite");t.onabort=function(e){try{var t=e.srcElement.error;t&&"QuotaExceededError"===t.name&&(r.hasReachedQuota=!0)}catch(e){}i(-1)},t.oncomplete=function(e){i(r.manifestVersionFound)};var n={sceneUrl:e,data:this.manifestVersionFound},o=t.objectStore("versions").put(n);o.onsuccess=function(e){},o.onerror=function(e){pr.Tools.Error("Error in DB add version request in BABYLON.Database.")}}catch(e){pr.Tools.Error("Error while accessing 'versions' object store (WRITE OP). Exception: "+e.message),i(-1)}else i(-1)},c.prototype.loadFileFromDB=function(e,t,i,r,n){var o=this,s=c._ReturnFullUrlLocation(e),a=function(){o._saveFileIntoDBAsync(s,t,i,n,r)};this._checkVersionFromDB(s,(function(e){-1!==e?o.mustUpdateRessources?o._saveFileIntoDBAsync(s,t,i,n,r):o._loadFileFromDBAsync(s,t,a,n):r&&r()}))},c.prototype._loadFileFromDBAsync=function(t,i,r,e){if(this.isSupported&&this.db){var n,o;n=-1!==t.indexOf(".babylon")?"scenes":"textures";var s=this.db.transaction([n]);s.oncomplete=function(e){o?i(o.data):r()},s.onabort=function(e){r()};var a=s.objectStore(n).get(t);a.onsuccess=function(e){o=e.target.result},a.onerror=function(e){pr.Tools.Error("Error loading file "+t+" from DB."),r()}}else pr.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),i()},c.prototype._saveFileIntoDBAsync=function(r,n,e,o,s){var a=this;if(this.isSupported){var l;l=-1!==r.indexOf(".babylon")?"scenes":"textures";var c,h=new XMLHttpRequest;h.open("GET",r+"?"+Date.now(),!0),o&&(h.responseType="arraybuffer"),e&&(h.onprogress=e),h.addEventListener("load",(function(){if(200===h.status||h.status<400&&pr.Tools.ValidateXHRData(h,o?6:1))if(c=o?h.response:h.responseText,!a.hasReachedQuota&&a.db){var e,t=a.db.transaction([l],"readwrite");t.onabort=function(e){try{var t=e.srcElement.error;t&&"QuotaExceededError"===t.name&&(a.hasReachedQuota=!0)}catch(e){}n(c)},t.oncomplete=function(e){n(c)},e="scenes"===l?{sceneUrl:r,data:c,version:a.manifestVersionFound}:{textureUrl:r,data:c};try{var i=t.objectStore(l).put(e);i.onsuccess=function(e){},i.onerror=function(e){pr.Tools.Error("Error in DB add file request in BABYLON.Database.")}}catch(e){n(c)}}else n(c);else 400<=h.status&&s?s(h):n()}),!1),h.addEventListener("error",(function(e){pr.Tools.Error("error on XHR request."),n()}),!1),h.send()}else pr.Tools.Error("Error: IndexedDB not supported by your browser or BabylonJS Database is not open."),n()},c.IsUASupportingBlobStorage=!0,c.IDBStorageEnabled=!0,c._ParseURL=function(e){var t=(document.createElement("a").href=e).substring(0,e.lastIndexOf("#")),i=e.substring(t.lastIndexOf("/")+1,e.length);return e.substring(0,e.indexOf(i,0))},c._ReturnFullUrlLocation=function(e){return-1===e.indexOf("http:/")&&-1===e.indexOf("https:/")?c._ParseURL(window.location.href)+e:e},c})(),pr.Database=_r,mr=$a||($a={}),gr=(function(){function i(){this._isEnabled=!0,this.leftColor=mr.Color3.White(),this.rightColor=mr.Color3.Black(),this.bias=0,this.power=1}return Object.defineProperty(i.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,mr.Engine.MarkAllMaterialsAsDirty(mr.Material.FresnelDirtyFlag|mr.Material.MiscDirtyFlag))},enumerable:!0,configurable:!0}),i.prototype.clone=function(){var e=new i;return mr.Tools.DeepCopy(this,e),e},i.prototype.serialize=function(){var e={};return e.isEnabled=this.isEnabled,e.leftColor=this.leftColor.asArray(),e.rightColor=this.rightColor.asArray(),e.bias=this.bias,e.power=this.power,e},i.Parse=function(e){var t=new i;return t.isEnabled=e.isEnabled,t.leftColor=mr.Color3.FromArray(e.leftColor),t.rightColor=mr.Color3.FromArray(e.rightColor),t.bias=e.bias,t.power=e.power||1,t},i})(),mr.FresnelParameters=gr,vr=$a||($a={}),yr=(function(n){function s(e,t){var i=n.call(this,e,t,!0)||this;return t.multiMaterials.push(i),i.subMaterials=new Array,i.storeEffectOnSubMeshes=!0,i}return T(s,n),Object.defineProperty(s.prototype,"subMaterials",{get:function(){return this._subMaterials},set:function(e){this._subMaterials=e,this._hookArray(e)},enumerable:!0,configurable:!0}),s.prototype._hookArray=function(r){var n=this,o=r.push;r.push=function(){for(var e=[],t=0;t<arguments.length;t++)e[t]=arguments[t];var i=o.apply(r,e);return n._markAllSubMeshesAsTexturesDirty(),i};var s=r.splice;r.splice=function(e,t){var i=s.apply(r,[e,t]);return n._markAllSubMeshesAsTexturesDirty(),i}},s.prototype.getSubMaterial=function(e){return e<0||e>=this.subMaterials.length?this.getScene().defaultMaterial:this.subMaterials[e]},s.prototype.getActiveTextures=function(){var e;return(e=n.prototype.getActiveTextures.call(this)).concat.apply(e,this.subMaterials.map((function(e){return e?e.getActiveTextures():[]})))},s.prototype.getClassName=function(){return"MultiMaterial"},s.prototype.isReadyForSubMesh=function(e,t,i){for(var r=0;r<this.subMaterials.length;r++){var n=this.subMaterials[r];if(n){if(n.storeEffectOnSubMeshes){if(!n.isReadyForSubMesh(e,t,i))return!1;continue}if(!n.isReady(e))return!1}}return!0},s.prototype.clone=function(e,t){for(var i=new s(e,this.getScene()),r=0;r<this.subMaterials.length;r++){var n=null,o=this.subMaterials[r];n=t&&o?o.clone(e+"-"+o.name):this.subMaterials[r],i.subMaterials.push(n)}return i},s.prototype.serialize=function(){var e={};e.name=this.name,e.id=this.id,vr.Tags&&(e.tags=vr.Tags.GetTags(this)),e.materials=[];for(var t=0;t<this.subMaterials.length;t++){var i=this.subMaterials[t];i?e.materials.push(i.id):e.materials.push(null)}return e},s.prototype.dispose=function(e,t){var i=this.getScene();if(i){var r=i.multiMaterials.indexOf(this);0<=r&&i.multiMaterials.splice(r,1),n.prototype.dispose.call(this,e,t)}},s})(vr.Material),vr.MultiMaterial=yr,br=$a||($a={}),Tr=(function(){function e(){this.touchAngularSensibility=2e5,this.touchMoveSensibility=250,this._offsetX=null,this._offsetY=null,this._pointerPressed=new Array}return e.prototype.attachControl=function(e,n){var o=this,s=null;void 0===this._pointerInput&&(this._onLostFocus=function(e){o._offsetX=null,o._offsetY=null},this._pointerInput=function(e,t){var i=e.event;if("mouse"!==i.pointerType)if(e.type===br.PointerEventTypes.POINTERDOWN){if(n||i.preventDefault(),o._pointerPressed.push(i.pointerId),1!==o._pointerPressed.length)return;s={x:i.clientX,y:i.clientY}}else if(e.type===br.PointerEventTypes.POINTERUP){if(n||i.preventDefault(),-1===(r=o._pointerPressed.indexOf(i.pointerId)))return;if(o._pointerPressed.splice(r,1),0!=r)return;s=null,o._offsetX=null,o._offsetY=null}else if(e.type===br.PointerEventTypes.POINTERMOVE){if(n||i.preventDefault(),!s)return;var r;if(0!=(r=o._pointerPressed.indexOf(i.pointerId)))return;o._offsetX=i.clientX-s.x,o._offsetY=-(i.clientY-s.y)}}),this._observer=this.camera.getScene().onPointerObservable.add(this._pointerInput,br.PointerEventTypes.POINTERDOWN|br.PointerEventTypes.POINTERUP|br.PointerEventTypes.POINTERMOVE),this._onLostFocus&&e.addEventListener("blur",this._onLostFocus)},e.prototype.detachControl=function(e){this._pointerInput&&e&&(this._observer&&(this.camera.getScene().onPointerObservable.remove(this._observer),this._observer=null),this._onLostFocus&&(e.removeEventListener("blur",this._onLostFocus),this._onLostFocus=null),this._pointerPressed=[],this._offsetX=null,this._offsetY=null)},e.prototype.checkInputs=function(){if(this._offsetX&&this._offsetY){var e=this.camera;if(e.cameraRotation.y+=this._offsetX/this.touchAngularSensibility,1<this._pointerPressed.length)e.cameraRotation.x+=-this._offsetY/this.touchAngularSensibility;else{var t=e._computeLocalCameraSpeed(),i=new br.Vector3(0,0,t*this._offsetY/this.touchMoveSensibility);br.Matrix.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,e._cameraRotationMatrix),e.cameraDirection.addInPlace(br.Vector3.TransformCoordinates(i,e._cameraRotationMatrix))}}},e.prototype.getClassName=function(){return"FreeCameraTouchInput"},e.prototype.getSimpleName=function(){return"touch"},b([br.serialize()],e.prototype,"touchAngularSensibility",void 0),b([br.serialize()],e.prototype,"touchMoveSensibility",void 0),e})(),br.FreeCameraTouchInput=Tr,br.CameraInputTypes.FreeCameraTouchInput=Tr,(function(i){i.Node.AddNodeConstructor("TouchCamera",(function(e,t){return function(){return new r(e,i.Vector3.Zero(),t)}}));var r=(function(n){function e(e,t,i){var r=n.call(this,e,t,i)||this;return r.inputs.addTouch(),r._setupInputs(),r}return T(e,n),Object.defineProperty(e.prototype,"touchAngularSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchAngularSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchAngularSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"touchMoveSensibility",{get:function(){var e=this.inputs.attached.touch;return e?e.touchMoveSensibility:0},set:function(e){var t=this.inputs.attached.touch;t&&(t.touchMoveSensibility=e)},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"TouchCamera"},e.prototype._setupInputs=function(){var e=this.inputs.attached.mouse;e&&(e.touchEnabled=!1)},e})(i.FreeCamera);i.TouchCamera=r})($a||($a={})),Er=$a||($a={}),xr=(function(h){function i(e,t,i,r,n,o,s){void 0===n&&(n=null),void 0===o&&(o=!0),void 0===s&&(s=!1);var a=h.call(this,null,r,!o)||this;a.isCube=s,a.isEnabled=!0,a.autoClear=!0,a.onGeneratedObservable=new Er.Observable,a._textures={},a._currentRefreshId=-1,a._refreshRate=1,a._vertexBuffers={},a._uniforms=new Array,a._samplers=new Array,a._floats={},a._ints={},a._floatsArrays={},a._colors3={},a._colors4={},a._vectors2={},a._vectors3={},a._matrices={},a._fallbackTextureUsed=!1,a._cachedDefines="",a._contentUpdateId=-1;var l=(r=a.getScene())._getComponent(Er.SceneComponentConstants.NAME_PROCEDURALTEXTURE);l||(l=new Er.ProceduralTextureSceneComponent(r),r._addComponent(l)),r.proceduralTextures.push(a),a._engine=r.getEngine(),a.name=e,a.isRenderTarget=!0,a._size=t,a._generateMipMaps=o,a.setFragment(i),a._fallbackTexture=n,s?(a._texture=a._engine.createRenderTargetCubeTexture(t,{generateMipMaps:o,generateDepthBuffer:!1,generateStencilBuffer:!1}),a.setFloat("face",0)):a._texture=a._engine.createRenderTargetTexture(t,{generateMipMaps:o,generateDepthBuffer:!1,generateStencilBuffer:!1});var c=[];return c.push(1,1),c.push(-1,1),c.push(-1,-1),c.push(1,-1),a._vertexBuffers[Er.VertexBuffer.PositionKind]=new Er.VertexBuffer(a._engine,c,Er.VertexBuffer.PositionKind,!1,!1,2),a._createIndexBuffer(),a}return T(i,h),i.prototype.getContent=function(){return this._contentData&&this._currentRefreshId==this._contentUpdateId||(this._contentData=this.readPixels(0,0,this._contentData),this._contentUpdateId=this._currentRefreshId),this._contentData},i.prototype._createIndexBuffer=function(){var e=this._engine,t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},i.prototype._rebuild=function(){var e=this._vertexBuffers[Er.VertexBuffer.PositionKind];e&&e._rebuild(),this._createIndexBuffer(),this.refreshRate===Er.RenderTargetTexture.REFRESHRATE_RENDER_ONCE&&(this.refreshRate=Er.RenderTargetTexture.REFRESHRATE_RENDER_ONCE)},i.prototype.reset=function(){void 0!==this._effect&&this._engine._releaseEffect(this._effect)},i.prototype._getDefines=function(){return""},i.prototype.isReady=function(){var e,t=this,i=this._engine;if(!this._fragment)return!1;if(this._fallbackTextureUsed)return!0;var r=this._getDefines();return!(!this._effect||r!==this._cachedDefines||!this._effect.isReady())||(e=void 0!==this._fragment.fragmentElement?{vertex:"procedural",fragmentElement:this._fragment.fragmentElement}:{vertex:"procedural",fragment:this._fragment},this._cachedDefines=r,this._effect=i.createEffect(e,[Er.VertexBuffer.PositionKind],this._uniforms,this._samplers,r,void 0,void 0,(function(){t.releaseInternalTexture(),t._fallbackTexture&&(t._texture=t._fallbackTexture._texture,t._texture&&t._texture.incrementReferences()),t._fallbackTextureUsed=!0})),this._effect.isReady())},i.prototype.resetRefreshCounter=function(){this._currentRefreshId=-1},i.prototype.setFragment=function(e){this._fragment=e},Object.defineProperty(i.prototype,"refreshRate",{get:function(){return this._refreshRate},set:function(e){this._refreshRate=e,this.resetRefreshCounter()},enumerable:!0,configurable:!0}),i.prototype._shouldRender=function(){return this.isEnabled&&this.isReady()&&this._texture?!this._fallbackTextureUsed&&(-1===this._currentRefreshId?(this._currentRefreshId=1,!0):this.refreshRate===this._currentRefreshId?(this._currentRefreshId=1,!0):(this._currentRefreshId++,!1)):(this._texture&&(this._texture.isReady=!1),!1)},i.prototype.getRenderSize=function(){return this._size},i.prototype.resize=function(e,t){this._fallbackTextureUsed||(this.releaseInternalTexture(),this._texture=this._engine.createRenderTargetTexture(e,t),this._size=e,this._generateMipMaps=t)},i.prototype._checkUniform=function(e){-1===this._uniforms.indexOf(e)&&this._uniforms.push(e)},i.prototype.setTexture=function(e,t){return-1===this._samplers.indexOf(e)&&this._samplers.push(e),this._textures[e]=t,this},i.prototype.setFloat=function(e,t){return this._checkUniform(e),this._floats[e]=t,this},i.prototype.setInt=function(e,t){return this._checkUniform(e),this._ints[e]=t,this},i.prototype.setFloats=function(e,t){return this._checkUniform(e),this._floatsArrays[e]=t,this},i.prototype.setColor3=function(e,t){return this._checkUniform(e),this._colors3[e]=t,this},i.prototype.setColor4=function(e,t){return this._checkUniform(e),this._colors4[e]=t,this},i.prototype.setVector2=function(e,t){return this._checkUniform(e),this._vectors2[e]=t,this},i.prototype.setVector3=function(e,t){return this._checkUniform(e),this._vectors3[e]=t,this},i.prototype.setMatrix=function(e,t){return this._checkUniform(e),this._matrices[e]=t,this},i.prototype.render=function(e){var t=this.getScene();if(t){var i=this._engine;for(var r in i.enableEffect(this._effect),i.setState(!1),this._textures)this._effect.setTexture(r,this._textures[r]);for(r in this._ints)this._effect.setInt(r,this._ints[r]);for(r in this._floats)this._effect.setFloat(r,this._floats[r]);for(r in this._floatsArrays)this._effect.setArray(r,this._floatsArrays[r]);for(r in this._colors3)this._effect.setColor3(r,this._colors3[r]);for(r in this._colors4){var n=this._colors4[r];this._effect.setFloat4(r,n.r,n.g,n.b,n.a)}for(r in this._vectors2)this._effect.setVector2(r,this._vectors2[r]);for(r in this._vectors3)this._effect.setVector3(r,this._vectors3[r]);for(r in this._matrices)this._effect.setMatrix(r,this._matrices[r]);if(this._texture){if(this.isCube)for(var o=0;o<6;o++)i.bindFramebuffer(this._texture,o,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect),this._effect.setFloat("face",o),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(Er.Material.TriangleFillMode,0,6),5===o&&i.generateMipMapsForCubemap(this._texture);else i.bindFramebuffer(this._texture,0,void 0,void 0,!0),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect),this.autoClear&&i.clear(t.clearColor,!0,!1,!1),i.drawElementsType(Er.Material.TriangleFillMode,0,6);i.unBindFramebuffer(this._texture,this.isCube),this.onGenerated&&this.onGenerated(),this.onGeneratedObservable.notifyObservers(this)}}},i.prototype.clone=function(){var e=this.getSize(),t=new i(this.name,e.width,this._fragment,this.getScene(),this._fallbackTexture,this._generateMipMaps);return t.hasAlpha=this.hasAlpha,t.level=this.level,t.coordinatesMode=this.coordinatesMode,t},i.prototype.dispose=function(){var e=this.getScene();if(e){var t=e.proceduralTextures.indexOf(this);0<=t&&e.proceduralTextures.splice(t,1);var i=this._vertexBuffers[Er.VertexBuffer.PositionKind];i&&(i.dispose(),this._vertexBuffers[Er.VertexBuffer.PositionKind]=null),this._indexBuffer&&this._engine._releaseBuffer(this._indexBuffer)&&(this._indexBuffer=null),h.prototype.dispose.call(this)}},b([Er.serialize()],i.prototype,"isEnabled",void 0),b([Er.serialize()],i.prototype,"autoClear",void 0),b([Er.serialize()],i.prototype,"_generateMipMaps",void 0),b([Er.serialize()],i.prototype,"_size",void 0),b([Er.serialize()],i.prototype,"refreshRate",null),i})(Er.Texture),Er.ProceduralTexture=xr,Pr=$a||($a={}),Ar=(function(){function e(e){this.name=Pr.SceneComponentConstants.NAME_PROCEDURALTEXTURE,this.scene=e,this.scene.proceduralTextures=new Array,e.layers=new Array}return e.prototype.register=function(){this.scene._beforeClearStage.registerStep(Pr.SceneComponentConstants.STEP_BEFORECLEAR_PROCEDURALTEXTURE,this,this._beforeClear)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._beforeClear=function(){if(this.scene.proceduralTexturesEnabled){Pr.Tools.StartPerformanceCounter("Procedural textures",0<this.scene.proceduralTextures.length);for(var e=0;e<this.scene.proceduralTextures.length;e++){var t=this.scene.proceduralTextures[e];t._shouldRender()&&t.render()}Pr.Tools.EndPerformanceCounter("Procedural textures",0<this.scene.proceduralTextures.length)}},e})(),Pr.ProceduralTextureSceneComponent=Ar,Sr=$a||($a={}),Mr=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,i,null,r,n,o)||this;return s._animate=!0,s._time=0,s._texturePath=t,s._loadJson(t),s.refreshRate=1,s}return T(e,a),e.prototype._loadJson=function(e){var t=this,i=function(){Sr.Tools.Log("No config file found in "+e+" trying to use ShadersStore or DOM element");try{t.setFragment(t._texturePath)}catch(e){Sr.Tools.Error("No json or ShaderStore or DOM element found for CustomProceduralTexture")}},r=e+"/config.json",n=new XMLHttpRequest;n.open("GET",r,!0),n.addEventListener("load",(function(){if(200===n.status||Sr.Tools.ValidateXHRData(n,1))try{t._config=JSON.parse(n.response),t.updateShaderUniforms(),t.updateTextures(),t.setFragment(t._texturePath+"/custom"),t._animate=t._config.animate,t.refreshRate=t._config.refreshrate}catch(e){i()}else i()}),!1),n.addEventListener("error",(function(){i()}),!1);try{n.send()}catch(e){Sr.Tools.Error("CustomProceduralTexture: Error on XHR send request.")}},e.prototype.isReady=function(){if(!a.prototype.isReady.call(this))return!1;for(var e in this._textures){if(!this._textures[e].isReady())return!1}return!0},e.prototype.render=function(e){var t=this.getScene();this._animate&&t&&(this._time+=.03*t.getAnimationRatio(),this.updateShaderUniforms()),a.prototype.render.call(this,e)},e.prototype.updateTextures=function(){for(var e=0;e<this._config.sampler2Ds.length;e++)this.setTexture(this._config.sampler2Ds[e].sample2Dname,new Sr.Texture(this._texturePath+"/"+this._config.sampler2Ds[e].textureRelativeUrl,this.getScene()))},e.prototype.updateShaderUniforms=function(){if(this._config)for(var e=0;e<this._config.uniforms.length;e++){var t=this._config.uniforms[e];switch(t.type){case"float":this.setFloat(t.name,t.value);break;case"color3":this.setColor3(t.name,new Sr.Color3(t.r,t.g,t.b));break;case"color4":this.setColor4(t.name,new Sr.Color4(t.r,t.g,t.b,t.a));break;case"vector2":this.setVector2(t.name,new Sr.Vector2(t.x,t.y));break;case"vector3":this.setVector3(t.name,new Sr.Vector3(t.x,t.y,t.z))}}this.setFloat("time",this._time)},Object.defineProperty(e.prototype,"animate",{get:function(){return this._animate},set:function(e){this._animate=e},enumerable:!0,configurable:!0}),e})(Sr.ProceduralTexture),Sr.CustomProceduralTexture=Mr,Rr=$a||($a={}),Cr=(function(){function e(){this.gamepadAngularSensibility=200,this.gamepadMoveSensibility=40,this._cameraTransform=Rr.Matrix.Identity(),this._deltaTransform=Rr.Vector3.Zero(),this._vector3=Rr.Vector3.Zero(),this._vector2=Rr.Vector2.Zero()}return e.prototype.attachControl=function(e,t){var i=this,r=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=r.onGamepadConnectedObservable.add((function(e){e.type!==Rr.Gamepad.POSE_ENABLED&&(i.gamepad&&e.type!==Rr.Gamepad.XBOX||(i.gamepad=e))})),this._onGamepadDisconnectedObserver=r.onGamepadDisconnectedObservable.add((function(e){i.gamepad===e&&(i.gamepad=null)})),this.gamepad=r.getGamepadByType(Rr.Gamepad.XBOX)},e.prototype.detachControl=function(e){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},e.prototype.checkInputs=function(){if(this.gamepad&&this.gamepad.leftStick){var e=this.camera,t=this.gamepad.leftStick,i=t.x/this.gamepadMoveSensibility,r=t.y/this.gamepadMoveSensibility;t.x=.005<Math.abs(i)?0+i:0,t.y=.005<Math.abs(r)?0+r:0;var n=this.gamepad.rightStick;if(n){var o=n.x/this.gamepadAngularSensibility,s=n.y/this.gamepadAngularSensibility;n.x=.001<Math.abs(o)?0+o:0,n.y=.001<Math.abs(s)?0+s:0}else n={x:0,y:0};e.rotationQuaternion?e.rotationQuaternion.toRotationMatrix(this._cameraTransform):Rr.Matrix.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,0,this._cameraTransform);var a=50*e._computeLocalCameraSpeed();this._vector3.copyFromFloats(t.x*a,0,-t.y*a),Rr.Vector3.TransformCoordinatesToRef(this._vector3,this._cameraTransform,this._deltaTransform),e.cameraDirection.addInPlace(this._deltaTransform),this._vector2.copyFromFloats(n.y,n.x),e.cameraRotation.addInPlace(this._vector2)}},e.prototype.getClassName=function(){return"FreeCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},b([Rr.serialize()],e.prototype,"gamepadAngularSensibility",void 0),b([Rr.serialize()],e.prototype,"gamepadMoveSensibility",void 0),e})(),Rr.FreeCameraGamepadInput=Cr,Rr.CameraInputTypes.FreeCameraGamepadInput=Cr,Or=$a||($a={}),Dr=(function(){function e(){this.gamepadRotationSensibility=80,this.gamepadMoveSensibility=40}return e.prototype.attachControl=function(e,t){var i=this,r=this.camera.getScene().gamepadManager;this._onGamepadConnectedObserver=r.onGamepadConnectedObservable.add((function(e){e.type!==Or.Gamepad.POSE_ENABLED&&(i.gamepad&&e.type!==Or.Gamepad.XBOX||(i.gamepad=e))})),this._onGamepadDisconnectedObserver=r.onGamepadDisconnectedObservable.add((function(e){i.gamepad===e&&(i.gamepad=null)})),this.gamepad=r.getGamepadByType(Or.Gamepad.XBOX)},e.prototype.detachControl=function(e){this.camera.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.camera.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),this.gamepad=null},e.prototype.checkInputs=function(){if(this.gamepad){var e=this.camera,t=this.gamepad.rightStick;if(t){if(0!=t.x){var i=t.x/this.gamepadRotationSensibility;0!=i&&.005<Math.abs(i)&&(e.inertialAlphaOffset+=i)}if(0!=t.y){var r=t.y/this.gamepadRotationSensibility;0!=r&&.005<Math.abs(r)&&(e.inertialBetaOffset+=r)}}var n=this.gamepad.leftStick;if(n&&0!=n.y){var o=n.y/this.gamepadMoveSensibility;0!=o&&.005<Math.abs(o)&&(this.camera.inertialRadiusOffset-=o)}}},e.prototype.getClassName=function(){return"ArcRotateCameraGamepadInput"},e.prototype.getSimpleName=function(){return"gamepad"},b([Or.serialize()],e.prototype,"gamepadRotationSensibility",void 0),b([Or.serialize()],e.prototype,"gamepadMoveSensibility",void 0),e})(),Or.ArcRotateCameraGamepadInput=Dr,Or.CameraInputTypes.ArcRotateCameraGamepadInput=Dr,Ir=$a||($a={}),wr=(function(){function e(e){var n=this;this._scene=e,this._babylonGamepads=[],this._oneGamepadConnected=!1,this._isMonitoring=!1,this.onGamepadDisconnectedObservable=new Ir.Observable,Ir.Tools.IsWindowObjectExist()?(this._gamepadEventSupported="GamepadEvent"in window,this._gamepadSupport=navigator.getGamepads||navigator.webkitGetGamepads||navigator.msGetGamepads||navigator.webkitGamepads):this._gamepadEventSupported=!1,this.onGamepadConnectedObservable=new Ir.Observable(function(e){for(var t in n._babylonGamepads){var i=n._babylonGamepads[t];i&&i._isConnected&&n.onGamepadConnectedObservable.notifyObserver(e,i)}}),this._onGamepadConnectedEvent=function(e){var t,i=e.gamepad;i.index in n._babylonGamepads&&n._babylonGamepads[i.index].isConnected||(n._babylonGamepads[i.index]?((t=n._babylonGamepads[i.index]).browserGamepad=i,t._isConnected=!0):t=n._addNewGamepad(i),n.onGamepadConnectedObservable.notifyObservers(t),n._startMonitoringGamepads())},this._onGamepadDisconnectedEvent=function(e){var t=e.gamepad;for(var i in n._babylonGamepads)if(n._babylonGamepads[i].index===t.index){var r=n._babylonGamepads[i];r._isConnected=!1,n.onGamepadDisconnectedObservable.notifyObservers(r);break}},this._gamepadSupport&&(this._updateGamepadObjects(),this._babylonGamepads.length&&this._startMonitoringGamepads(),this._gamepadEventSupported?(window.addEventListener("gamepadconnected",this._onGamepadConnectedEvent,!1),window.addEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent,!1)):this._startMonitoringGamepads())}return Object.defineProperty(e.prototype,"gamepads",{get:function(){return this._babylonGamepads},enumerable:!0,configurable:!0}),e.prototype.getGamepadByType=function(e){void 0===e&&(e=Ir.Gamepad.XBOX);for(var t=0,i=this._babylonGamepads;t<i.length;t++){var r=i[t];if(r&&r.type===e)return r}return null},e.prototype.dispose=function(){this._gamepadEventSupported&&(this._onGamepadConnectedEvent&&window.removeEventListener("gamepadconnected",this._onGamepadConnectedEvent),this._onGamepadDisconnectedEvent&&window.removeEventListener("gamepaddisconnected",this._onGamepadDisconnectedEvent),this._onGamepadConnectedEvent=null,this._onGamepadDisconnectedEvent=null),this._babylonGamepads.forEach((function(e){e.dispose()})),this.onGamepadConnectedObservable.clear(),this.onGamepadDisconnectedObservable.clear(),this._oneGamepadConnected=!1,this._stopMonitoringGamepads(),this._babylonGamepads=[]},e.prototype._addNewGamepad=function(e){var t;this._oneGamepadConnected||(this._oneGamepadConnected=!0);var i=-1!==e.id.search("Xbox One");return t=i||-1!==e.id.search("Xbox 360")||-1!==e.id.search("xinput")?new Ir.Xbox360Pad(e.id,e.index,e,i):e.pose?Ir.PoseEnabledControllerHelper.InitiateController(e):new Ir.GenericPad(e.id,e.index,e),this._babylonGamepads[t.index]=t},e.prototype._startMonitoringGamepads=function(){this._isMonitoring||(this._isMonitoring=!0,this._scene||this._checkGamepadsStatus())},e.prototype._stopMonitoringGamepads=function(){this._isMonitoring=!1},e.prototype._checkGamepadsStatus=function(){var e=this;for(var t in this._updateGamepadObjects(),this._babylonGamepads){var i=this._babylonGamepads[t];i&&i.isConnected&&i.update()}this._isMonitoring&&!this._scene&&Ir.Tools.QueueNewFrame((function(){e._checkGamepadsStatus()}))},e.prototype._updateGamepadObjects=function(){for(var e=navigator.getGamepads?navigator.getGamepads():navigator.webkitGetGamepads?navigator.webkitGetGamepads():[],t=0;t<e.length;t++){var i=e[t];if(i)if(this._babylonGamepads[i.index])this._babylonGamepads[t].browserGamepad=i,this._babylonGamepads[t].isConnected||(this._babylonGamepads[t]._isConnected=!0,this.onGamepadConnectedObservable.notifyObservers(this._babylonGamepads[t]));else{var r=this._addNewGamepad(i);this.onGamepadConnectedObservable.notifyObservers(r)}}},e})(),Ir.GamepadManager=wr,(function(o){var e=function(e,t){this.x=e,this.y=t};o.StickValues=e;var s=(function(){function a(e,t,i,r,n,o,s){void 0===r&&(r=0),void 0===n&&(n=1),void 0===o&&(o=2),void 0===s&&(s=3),this.id=e,this.index=t,this.browserGamepad=i,this._leftStick={x:0,y:0},this._rightStick={x:0,y:0},this._isConnected=!0,this._invertLeftStickY=!1,this.type=a.GAMEPAD,this._leftStickAxisX=r,this._leftStickAxisY=n,this._rightStickAxisX=o,this._rightStickAxisY=s,2<=this.browserGamepad.axes.length&&(this._leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]}),4<=this.browserGamepad.axes.length&&(this._rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})}return Object.defineProperty(a.prototype,"isConnected",{get:function(){return this._isConnected},enumerable:!0,configurable:!0}),a.prototype.onleftstickchanged=function(e){this._onleftstickchanged=e},a.prototype.onrightstickchanged=function(e){this._onrightstickchanged=e},Object.defineProperty(a.prototype,"leftStick",{get:function(){return this._leftStick},set:function(e){!this._onleftstickchanged||this._leftStick.x===e.x&&this._leftStick.y===e.y||this._onleftstickchanged(e),this._leftStick=e},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"rightStick",{get:function(){return this._rightStick},set:function(e){!this._onrightstickchanged||this._rightStick.x===e.x&&this._rightStick.y===e.y||this._onrightstickchanged(e),this._rightStick=e},enumerable:!0,configurable:!0}),a.prototype.update=function(){this._leftStick&&(this.leftStick={x:this.browserGamepad.axes[this._leftStickAxisX],y:this.browserGamepad.axes[this._leftStickAxisY]},this._invertLeftStickY&&(this.leftStick.y*=-1)),this._rightStick&&(this.rightStick={x:this.browserGamepad.axes[this._rightStickAxisX],y:this.browserGamepad.axes[this._rightStickAxisY]})},a.prototype.dispose=function(){},a.GAMEPAD=0,a.GENERIC=1,a.XBOX=2,a.POSE_ENABLED=3,a})(),t=(function(n){function e(e,t,i){var r=n.call(this,e,t,i)||this;return r.onButtonDownObservable=new o.Observable,r.onButtonUpObservable=new o.Observable,r.type=s.GENERIC,r._buttons=new Array(i.buttons.length),r}return T(e,n),e.prototype.onbuttondown=function(e){this._onbuttondown=e},e.prototype.onbuttonup=function(e){this._onbuttonup=e},e.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},e.prototype.update=function(){n.prototype.update.call(this);for(var e=0;e<this._buttons.length;e++)this._buttons[e]=this._setButtonValue(this.browserGamepad.buttons[e].value,this._buttons[e],e)},e.prototype.dispose=function(){n.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear()},e})(o.Gamepad=s);o.GenericPad=t})($a||($a={})),(function(s){var t,e,i,r;(e=t=s.Xbox360Button||(s.Xbox360Button={}))[e.A=0]="A",e[e.B=1]="B",e[e.X=2]="X",e[e.Y=3]="Y",e[e.Start=4]="Start",e[e.Back=5]="Back",e[e.LB=6]="LB",e[e.RB=7]="RB",e[e.LeftStick=8]="LeftStick",e[e.RightStick=9]="RightStick",(r=i=s.Xbox360Dpad||(s.Xbox360Dpad={}))[r.Up=0]="Up",r[r.Down=1]="Down",r[r.Left=2]="Left",r[r.Right=3]="Right";var n=(function(o){function e(e,t,i,r){void 0===r&&(r=!1);var n=o.call(this,e,t,i,0,1,2,3)||this;return n._leftTrigger=0,n._rightTrigger=0,n.onButtonDownObservable=new s.Observable,n.onButtonUpObservable=new s.Observable,n.onPadDownObservable=new s.Observable,n.onPadUpObservable=new s.Observable,n._buttonA=0,n._buttonB=0,n._buttonX=0,n._buttonY=0,n._buttonBack=0,n._buttonStart=0,n._buttonLB=0,n._buttonRB=0,n._buttonLeftStick=0,n._buttonRightStick=0,n._dPadUp=0,n._dPadDown=0,n._dPadLeft=0,n._dPadRight=0,n._isXboxOnePad=!1,n.type=s.Gamepad.XBOX,n._isXboxOnePad=r,n}return T(e,o),e.prototype.onlefttriggerchanged=function(e){this._onlefttriggerchanged=e},e.prototype.onrighttriggerchanged=function(e){this._onrighttriggerchanged=e},Object.defineProperty(e.prototype,"leftTrigger",{get:function(){return this._leftTrigger},set:function(e){this._onlefttriggerchanged&&this._leftTrigger!==e&&this._onlefttriggerchanged(e),this._leftTrigger=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightTrigger",{get:function(){return this._rightTrigger},set:function(e){this._onrighttriggerchanged&&this._rightTrigger!==e&&this._onrighttriggerchanged(e),this._rightTrigger=e},enumerable:!0,configurable:!0}),e.prototype.onbuttondown=function(e){this._onbuttondown=e},e.prototype.onbuttonup=function(e){this._onbuttonup=e},e.prototype.ondpaddown=function(e){this._ondpaddown=e},e.prototype.ondpadup=function(e){this._ondpadup=e},e.prototype._setButtonValue=function(e,t,i){return e!==t&&(1===e&&(this._onbuttondown&&this._onbuttondown(i),this.onButtonDownObservable.notifyObservers(i)),0===e&&(this._onbuttonup&&this._onbuttonup(i),this.onButtonUpObservable.notifyObservers(i))),e},e.prototype._setDPadValue=function(e,t,i){return e!==t&&(1===e&&(this._ondpaddown&&this._ondpaddown(i),this.onPadDownObservable.notifyObservers(i)),0===e&&(this._ondpadup&&this._ondpadup(i),this.onPadUpObservable.notifyObservers(i))),e},Object.defineProperty(e.prototype,"buttonA",{get:function(){return this._buttonA},set:function(e){this._buttonA=this._setButtonValue(e,this._buttonA,t.A)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonB",{get:function(){return this._buttonB},set:function(e){this._buttonB=this._setButtonValue(e,this._buttonB,t.B)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonX",{get:function(){return this._buttonX},set:function(e){this._buttonX=this._setButtonValue(e,this._buttonX,t.X)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonY",{get:function(){return this._buttonY},set:function(e){this._buttonY=this._setButtonValue(e,this._buttonY,t.Y)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonStart",{get:function(){return this._buttonStart},set:function(e){this._buttonStart=this._setButtonValue(e,this._buttonStart,t.Start)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonBack",{get:function(){return this._buttonBack},set:function(e){this._buttonBack=this._setButtonValue(e,this._buttonBack,t.Back)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonLB",{get:function(){return this._buttonLB},set:function(e){this._buttonLB=this._setButtonValue(e,this._buttonLB,t.LB)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonRB",{get:function(){return this._buttonRB},set:function(e){this._buttonRB=this._setButtonValue(e,this._buttonRB,t.RB)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonLeftStick",{get:function(){return this._buttonLeftStick},set:function(e){this._buttonLeftStick=this._setButtonValue(e,this._buttonLeftStick,t.LeftStick)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"buttonRightStick",{get:function(){return this._buttonRightStick},set:function(e){this._buttonRightStick=this._setButtonValue(e,this._buttonRightStick,t.RightStick)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPadUp",{get:function(){return this._dPadUp},set:function(e){this._dPadUp=this._setDPadValue(e,this._dPadUp,i.Up)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPadDown",{get:function(){return this._dPadDown},set:function(e){this._dPadDown=this._setDPadValue(e,this._dPadDown,i.Down)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPadLeft",{get:function(){return this._dPadLeft},set:function(e){this._dPadLeft=this._setDPadValue(e,this._dPadLeft,i.Left)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"dPadRight",{get:function(){return this._dPadRight},set:function(e){this._dPadRight=this._setDPadValue(e,this._dPadRight,i.Right)},enumerable:!0,configurable:!0}),e.prototype.update=function(){o.prototype.update.call(this),this._isXboxOnePad?(this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.axes[2],this.rightTrigger=this.browserGamepad.axes[5],this.buttonBack=this.browserGamepad.buttons[9].value,this.buttonStart=this.browserGamepad.buttons[8].value,this.buttonLeftStick=this.browserGamepad.buttons[6].value,this.buttonRightStick=this.browserGamepad.buttons[7].value,this.dPadUp=this.browserGamepad.buttons[11].value,this.dPadDown=this.browserGamepad.buttons[12].value,this.dPadLeft=this.browserGamepad.buttons[13].value,this.dPadRight=this.browserGamepad.buttons[14].value):(this.buttonA=this.browserGamepad.buttons[0].value,this.buttonB=this.browserGamepad.buttons[1].value,this.buttonX=this.browserGamepad.buttons[2].value,this.buttonY=this.browserGamepad.buttons[3].value,this.buttonLB=this.browserGamepad.buttons[4].value,this.buttonRB=this.browserGamepad.buttons[5].value,this.leftTrigger=this.browserGamepad.buttons[6].value,this.rightTrigger=this.browserGamepad.buttons[7].value,this.buttonBack=this.browserGamepad.buttons[8].value,this.buttonStart=this.browserGamepad.buttons[9].value,this.buttonLeftStick=this.browserGamepad.buttons[10].value,this.buttonRightStick=this.browserGamepad.buttons[11].value,this.dPadUp=this.browserGamepad.buttons[12].value,this.dPadDown=this.browserGamepad.buttons[13].value,this.dPadLeft=this.browserGamepad.buttons[14].value,this.dPadRight=this.browserGamepad.buttons[15].value)},e.prototype.dispose=function(){o.prototype.dispose.call(this),this.onButtonDownObservable.clear(),this.onButtonUpObservable.clear(),this.onPadDownObservable.clear(),this.onPadUpObservable.clear()},e})(s.Gamepad);s.Xbox360Pad=n})($a||($a={})),(function(s){var r,e;(e=r=s.PoseEnabledControllerType||(s.PoseEnabledControllerType={}))[e.VIVE=0]="VIVE",e[e.OCULUS=1]="OCULUS",e[e.WINDOWS=2]="WINDOWS",e[e.GEAR_VR=3]="GEAR_VR",e[e.DAYDREAM=4]="DAYDREAM",e[e.GENERIC=5]="GENERIC";var t=(function(){function e(){}return e.InitiateController=function(e){return-1!==e.id.indexOf("Oculus Touch")?new s.OculusTouchController(e):0===e.id.indexOf(s.WindowsMotionController.GAMEPAD_ID_PREFIX)?new s.WindowsMotionController(e):-1!==e.id.toLowerCase().indexOf("openvr")?new s.ViveController(e):0===e.id.indexOf(s.GearVRController.GAMEPAD_ID_PREFIX)||-1!==e.id.indexOf("Oculus Go")?new s.GearVRController(e):0===e.id.indexOf(s.DaydreamController.GAMEPAD_ID_PREFIX)?new s.DaydreamController(e):new s.GenericController(e)},e})();s.PoseEnabledControllerHelper=t;var i=(function(i){function e(e){var t=i.call(this,e.id,e.index,e)||this;return t._deviceRoomPosition=s.Vector3.Zero(),t._deviceRoomRotationQuaternion=new s.Quaternion,t.devicePosition=s.Vector3.Zero(),t.deviceRotationQuaternion=new s.Quaternion,t.deviceScaleFactor=1,t._trackPosition=!0,t._maxRotationDistFromHeadset=Math.PI/5,t._draggedRoomRotation=0,t._leftHandSystemQuaternion=new s.Quaternion,t._deviceToWorld=s.Matrix.Identity(),t._pointingPoseNode=null,t._workingMatrix=s.Matrix.Identity(),t._meshAttachedObservable=new s.Observable,t.type=s.Gamepad.POSE_ENABLED,t.controllerType=r.GENERIC,t.position=s.Vector3.Zero(),t.rotationQuaternion=new s.Quaternion,t._calculatedPosition=s.Vector3.Zero(),t._calculatedRotation=new s.Quaternion,s.Quaternion.RotationYawPitchRollToRef(Math.PI,0,0,t._leftHandSystemQuaternion),t}return T(e,i),e.prototype._disableTrackPosition=function(e){this._trackPosition&&(this._calculatedPosition.copyFrom(e),this._trackPosition=!1)},e.prototype.update=function(){i.prototype.update.call(this),this._updatePoseAndMesh()},e.prototype._updatePoseAndMesh=function(){var e=this.browserGamepad.pose;if((this.updateFromDevice(e),!this._trackPosition&&s.Engine.LastCreatedScene&&s.Engine.LastCreatedScene.activeCamera&&s.Engine.LastCreatedScene.activeCamera.devicePosition)&&((t=s.Engine.LastCreatedScene.activeCamera)._computeDevicePosition(),this._deviceToWorld.setTranslation(t.devicePosition),t.deviceRotationQuaternion)){var t;(t=t)._deviceRoomRotationQuaternion.toEulerAnglesToRef(s.Tmp.Vector3[0]);var i=Math.atan2(Math.sin(s.Tmp.Vector3[0].y-this._draggedRoomRotation),Math.cos(s.Tmp.Vector3[0].y-this._draggedRoomRotation));if(Math.abs(i)>this._maxRotationDistFromHeadset){var r=i-(i<0?-this._maxRotationDistFromHeadset:this._maxRotationDistFromHeadset);this._draggedRoomRotation+=r;var n=Math.sin(-r),o=Math.cos(-r);this._calculatedPosition.x=this._calculatedPosition.x*o-this._calculatedPosition.z*n,this._calculatedPosition.z=this._calculatedPosition.x*n+this._calculatedPosition.z*o}}s.Vector3.TransformCoordinatesToRef(this._calculatedPosition,this._deviceToWorld,this.devicePosition),this._deviceToWorld.getRotationMatrixToRef(this._workingMatrix),s.Quaternion.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this.deviceRotationQuaternion.multiplyInPlace(this._calculatedRotation),this._mesh&&(this._mesh.position.copyFrom(this.devicePosition),this._mesh.rotationQuaternion&&this._mesh.rotationQuaternion.copyFrom(this.deviceRotationQuaternion))},e.prototype.updateFromDevice=function(e){if(e){(this.rawPose=e).position&&(this._deviceRoomPosition.copyFromFloats(e.position[0],e.position[1],-e.position[2]),this._mesh&&this._mesh.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1),this._trackPosition&&this._deviceRoomPosition.scaleToRef(this.deviceScaleFactor,this._calculatedPosition),this._calculatedPosition.addInPlace(this.position));var t=this.rawPose;e.orientation&&t.orientation&&(this._deviceRoomRotationQuaternion.copyFromFloats(t.orientation[0],t.orientation[1],-t.orientation[2],-t.orientation[3]),this._mesh&&(this._mesh.getScene().useRightHandedSystem?(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1):this._deviceRoomRotationQuaternion.multiplyToRef(this._leftHandSystemQuaternion,this._deviceRoomRotationQuaternion)),this._deviceRoomRotationQuaternion.multiplyToRef(this.rotationQuaternion,this._calculatedRotation))}},e.prototype.attachToMesh=function(e){if(this._mesh&&(this._mesh.parent=null),this._mesh=e,this._poseControlledCamera&&(this._mesh.parent=this._poseControlledCamera),this._mesh.rotationQuaternion||(this._mesh.rotationQuaternion=new s.Quaternion),this._updatePoseAndMesh(),this._pointingPoseNode){for(var t=[],i=this._pointingPoseNode;i.parent;)t.push(i.parent),i=i.parent;t.reverse().forEach((function(e){e.computeWorldMatrix(!0)}))}this._meshAttachedObservable.notifyObservers(e)},e.prototype.attachToPoseControlledCamera=function(e){this._poseControlledCamera=e,this._mesh&&(this._mesh.parent=this._poseControlledCamera)},e.prototype.dispose=function(){this._mesh&&this._mesh.dispose(),this._mesh=null,i.prototype.dispose.call(this)},Object.defineProperty(e.prototype,"mesh",{get:function(){return this._mesh},enumerable:!0,configurable:!0}),e.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this.mesh)return new s.Ray(s.Vector3.Zero(),new s.Vector3(0,0,1),e);var t=this._pointingPoseNode?this._pointingPoseNode.getWorldMatrix():this.mesh.getWorldMatrix(),i=t.getTranslation(),r=new s.Vector3(0,0,-1),n=s.Vector3.TransformNormal(r,t),o=s.Vector3.Normalize(n);return new s.Ray(i,o,e)},e.POINTING_POSE="POINTING_POSE",e})(s.Gamepad);s.PoseEnabledController=i})($a||($a={})),Lr=$a||($a={}),Fr=(function(i){function e(e){var t=i.call(this,e)||this;return t.onTriggerStateChangedObservable=new Lr.Observable,t.onMainButtonStateChangedObservable=new Lr.Observable,t.onSecondaryButtonStateChangedObservable=new Lr.Observable,t.onPadStateChangedObservable=new Lr.Observable,t.onPadValuesChangedObservable=new Lr.Observable,t.pad={x:0,y:0},t._changes={pressChanged:!1,touchChanged:!1,valueChanged:!1,changed:!1},t._buttons=new Array(e.buttons.length),t.hand=e.hand,t}return T(e,i),e.prototype.onButtonStateChange=function(e){this._onButtonStateChange=e},Object.defineProperty(e.prototype,"defaultModel",{get:function(){return this._defaultModel},enumerable:!0,configurable:!0}),e.prototype.update=function(){i.prototype.update.call(this);for(var e=0;e<this._buttons.length;e++)this._setButtonValue(this.browserGamepad.buttons[e],this._buttons[e],e);this.leftStick.x===this.pad.x&&this.leftStick.y===this.pad.y||(this.pad.x=this.leftStick.x,this.pad.y=this.leftStick.y,this.onPadValuesChangedObservable.notifyObservers(this.pad))},e.prototype._setButtonValue=function(e,t,i){e||(e={pressed:!1,touched:!1,value:0}),t?(this._checkChanges(e,t),this._changes.changed&&(this._onButtonStateChange&&this._onButtonStateChange(this.index,i,e),this._handleButtonChange(i,e,this._changes)),this._buttons[i].pressed=e.pressed,this._buttons[i].touched=e.touched,this._buttons[i].value=e.value<1e-8?0:e.value):this._buttons[i]={pressed:e.pressed,touched:e.touched,value:e.value}},e.prototype._checkChanges=function(e,t){return this._changes.pressChanged=e.pressed!==t.pressed,this._changes.touchChanged=e.touched!==t.touched,this._changes.valueChanged=e.value!==t.value,this._changes.changed=this._changes.pressChanged||this._changes.touchChanged||this._changes.valueChanged,this._changes},e.prototype.dispose=function(){i.prototype.dispose.call(this),this.onTriggerStateChangedObservable.clear(),this.onMainButtonStateChangedObservable.clear(),this.onSecondaryButtonStateChangedObservable.clear(),this.onPadStateChangedObservable.clear(),this.onPadValuesChangedObservable.clear()},e})(Lr.PoseEnabledController),Lr.WebVRController=Fr,Br=$a||($a={}),Nr=(function(i){function n(e){var t=i.call(this,e)||this;return t.onSecondaryTriggerStateChangedObservable=new Br.Observable,t.onThumbRestChangedObservable=new Br.Observable,t.controllerType=Br.PoseEnabledControllerType.OCULUS,t}return T(n,i),n.prototype.initControllerMesh=function(e,t){var i,r=this;i="left"===this.hand?n.MODEL_LEFT_FILENAME:n.MODEL_RIGHT_FILENAME,Br.SceneLoader.ImportMesh("",n.MODEL_BASE_URL,i,e,(function(e){r._defaultModel=e[1],r.attachToMesh(r._defaultModel),t&&t(r._defaultModel)}))},Object.defineProperty(n.prototype,"onAButtonStateChangedObservable",{get:function(){if("right"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No A button on left hand")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onBButtonStateChangedObservable",{get:function(){if("right"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No B button on left hand")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onXButtonStateChangedObservable",{get:function(){if("left"===this.hand)return this.onMainButtonStateChangedObservable;throw new Error("No X button on right hand")},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"onYButtonStateChangedObservable",{get:function(){if("left"===this.hand)return this.onSecondaryButtonStateChangedObservable;throw new Error("No Y button on right hand")},enumerable:!0,configurable:!0}),n.prototype._handleButtonChange=function(e,t,i){var r=t,n="right"===this.hand?-1:1;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(r);case 1:return this._defaultModel&&(this._defaultModel.getChildren()[3].rotation.x=.2*-r.value,this._defaultModel.getChildren()[3].position.y=.005*-r.value,this._defaultModel.getChildren()[3].position.z=.005*-r.value),void this.onTriggerStateChangedObservable.notifyObservers(r);case 2:return this._defaultModel&&(this._defaultModel.getChildren()[4].position.x=n*r.value*.0035),void this.onSecondaryTriggerStateChangedObservable.notifyObservers(r);case 3:return this._defaultModel&&(r.pressed?this._defaultModel.getChildren()[1].position.y=-.001:this._defaultModel.getChildren()[1].position.y=0),void this.onMainButtonStateChangedObservable.notifyObservers(r);case 4:return this._defaultModel&&(r.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(r);case 5:return void this.onThumbRestChangedObservable.notifyObservers(r)}},n.MODEL_BASE_URL="https://controllers.babylonjs.com/oculus/",n.MODEL_LEFT_FILENAME="left.babylon",n.MODEL_RIGHT_FILENAME="right.babylon",n})(Br.WebVRController),Br.OculusTouchController=Nr,Vr=$a||($a={}),Ur=(function(i){function r(e){var t=i.call(this,e)||this;return t.controllerType=Vr.PoseEnabledControllerType.VIVE,t._invertLeftStickY=!0,t}return T(r,i),r.prototype.initControllerMesh=function(e,t){var i=this;Vr.SceneLoader.ImportMesh("",r.MODEL_BASE_URL,r.MODEL_FILENAME,e,(function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},Object.defineProperty(r.prototype,"onLeftButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"onRightButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"onMenuButtonStateChangedObservable",{get:function(){return this.onSecondaryButtonStateChangedObservable},enumerable:!0,configurable:!0}),r.prototype._handleButtonChange=function(e,t,i){var r=t;switch(e){case 0:return void this.onPadStateChangedObservable.notifyObservers(r);case 1:return this._defaultModel&&(this._defaultModel.getChildren()[6].rotation.x=.15*-r.value),void this.onTriggerStateChangedObservable.notifyObservers(r);case 2:return void this.onMainButtonStateChangedObservable.notifyObservers(r);case 3:return this._defaultModel&&(r.pressed?this._defaultModel.getChildren()[2].position.y=-.001:this._defaultModel.getChildren()[2].position.y=0),void this.onSecondaryButtonStateChangedObservable.notifyObservers(r)}},r.MODEL_BASE_URL="https://controllers.babylonjs.com/vive/",r.MODEL_FILENAME="wand.babylon",r})(Vr.WebVRController),Vr.ViveController=Ur,zr=$a||($a={}),Gr=(function(t){function r(e){return t.call(this,e)||this}return T(r,t),r.prototype.initControllerMesh=function(e,t){var i=this;zr.SceneLoader.ImportMesh("",r.MODEL_BASE_URL,r.MODEL_FILENAME,e,(function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},r.prototype._handleButtonChange=function(e,t,i){console.log("Button id: "+e+"state: "),console.dir(t)},r.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",r.MODEL_FILENAME="generic.babylon",r})(zr.WebVRController),zr.GenericController=Gr,kr=$a||($a={}),Wr=function(){this.buttonMeshes={},this.axisMeshes={}},Hr=(function(s){function l(e){var t=s.call(this,e)||this;return t._mapping={buttons:["thumbstick","trigger","grip","menu","trackpad"],buttonMeshNames:{trigger:"SELECT",menu:"MENU",grip:"GRASP",thumbstick:"THUMBSTICK_PRESS",trackpad:"TOUCHPAD_PRESS"},buttonObservableNames:{trigger:"onTriggerStateChangedObservable",menu:"onSecondaryButtonStateChangedObservable",grip:"onMainButtonStateChangedObservable",thumbstick:"onPadStateChangedObservable",trackpad:"onTrackpadChangedObservable"},axisMeshNames:["THUMBSTICK_X","THUMBSTICK_Y","TOUCHPAD_TOUCH_X","TOUCHPAD_TOUCH_Y"],pointingPoseMeshName:kr.PoseEnabledController.POINTING_POSE},t.onTrackpadChangedObservable=new kr.Observable,t.onTrackpadValuesChangedObservable=new kr.Observable,t.trackpad={x:0,y:0},t.controllerType=kr.PoseEnabledControllerType.WINDOWS,t._loadedMeshInfo=null,t}return T(l,s),Object.defineProperty(l.prototype,"onTriggerButtonStateChangedObservable",{get:function(){return this.onTriggerStateChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onMenuButtonStateChangedObservable",{get:function(){return this.onSecondaryButtonStateChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onGripButtonStateChangedObservable",{get:function(){return this.onMainButtonStateChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onThumbstickButtonStateChangedObservable",{get:function(){return this.onPadStateChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onTouchpadButtonStateChangedObservable",{get:function(){return this.onTrackpadChangedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(l.prototype,"onTouchpadValuesChangedObservable",{get:function(){return this.onTrackpadValuesChangedObservable},enumerable:!0,configurable:!0}),l.prototype._updateTrackpad=function(){!this.browserGamepad.axes||this.browserGamepad.axes[2]==this.trackpad.x&&this.browserGamepad.axes[3]==this.trackpad.y||(this.trackpad.x=this.browserGamepad.axes[2],this.trackpad.y=this.browserGamepad.axes[3],this.onTrackpadValuesChangedObservable.notifyObservers(this.trackpad))},l.prototype.update=function(){if(s.prototype.update.call(this),this.browserGamepad.axes&&(this._updateTrackpad(),this._loadedMeshInfo))for(var e=0;e<this._mapping.axisMeshNames.length;e++)this._lerpAxisTransform(e,this.browserGamepad.axes[e])},l.prototype._handleButtonChange=function(e,t,i){var r=this._mapping.buttons[e];if(r){this._updateTrackpad();var n=this[this._mapping.buttonObservableNames[r]];n&&n.notifyObservers(t),this._lerpButtonTransform(r,t.value)}},l.prototype._lerpButtonTransform=function(e,t){if(this._loadedMeshInfo){var i=this._loadedMeshInfo.buttonMeshes[e];i.unpressed.rotationQuaternion&&i.pressed.rotationQuaternion&&i.value.rotationQuaternion&&(kr.Quaternion.SlerpToRef(i.unpressed.rotationQuaternion,i.pressed.rotationQuaternion,t,i.value.rotationQuaternion),kr.Vector3.LerpToRef(i.unpressed.position,i.pressed.position,t,i.value.position))}},l.prototype._lerpAxisTransform=function(e,t){if(this._loadedMeshInfo){var i=this._loadedMeshInfo.axisMeshes[e];if(i&&i.min.rotationQuaternion&&i.max.rotationQuaternion&&i.value.rotationQuaternion){var r=.5*t+.5;kr.Quaternion.SlerpToRef(i.min.rotationQuaternion,i.max.rotationQuaternion,r,i.value.rotationQuaternion),kr.Vector3.LerpToRef(i.min.position,i.max.position,r,i.value.position)}}},l.prototype.initControllerMesh=function(t,i,r){var n,o,s=this;if(void 0===r&&(r=!1),kr.SceneLoader.IsPluginForExtensionAvailable(".glb")){var e="default";if(this.id&&!r){var a=this.id.match(l.GAMEPAD_ID_PATTERN);e=a&&a[0]||e}o="left"===this.hand?l.MODEL_LEFT_FILENAME:l.MODEL_RIGHT_FILENAME,n=l.MODEL_BASE_URL+e+"/"}else kr.Tools.Warn("You need to reference GLTF loader to load Windows Motion Controllers model. Falling back to generic models"),n=kr.GenericController.MODEL_BASE_URL,o=kr.GenericController.MODEL_FILENAME;kr.SceneLoader.ImportMesh("",n,o,t,(function(e){s._loadedMeshInfo=s.processModel(t,e),s._loadedMeshInfo&&(s._defaultModel=s._loadedMeshInfo.rootNode,s.attachToMesh(s._defaultModel),i&&i(s._defaultModel))}),null,(function(e,t){kr.Tools.Log(t),kr.Tools.Warn("Failed to retrieve controller model from the remote server: "+n+o),r||s.initControllerMesh(e,i,!0)}))},l.prototype.processModel=function(e,t){for(var i=null,r=new kr.Mesh(this.id+" "+this.hand,e),n=null,o=0;o<t.length;o++){var s=t[o];if(!s.parent){s.isPickable=!1,n=s;break}}return n?(n.setParent(r),i=this.createMeshInfo(r)):kr.Tools.Warn("Could not find root node in model file."),i},l.prototype.createMeshInfo=function(e){var t,i=new Wr;for(i.rootNode=e,i.buttonMeshes={},i.axisMeshes={},t=0;t<this._mapping.buttons.length;t++){var r=this._mapping.buttonMeshNames[this._mapping.buttons[t]];if(r){var n=c(e,r);if(n){var o={index:t,value:h(n,"VALUE"),pressed:h(n,"PRESSED"),unpressed:h(n,"UNPRESSED")};o.value&&o.pressed&&o.unpressed?i.buttonMeshes[this._mapping.buttons[t]]=o:kr.Tools.Warn("Missing button submesh under mesh with name: "+r+"(VALUE: "+!!o.value+", PRESSED: "+!!o.pressed+", UNPRESSED:"+!!o.unpressed+")")}else kr.Tools.Warn("Missing button mesh with name: "+r)}else kr.Tools.Log("Skipping unknown button at index: "+t+" with mapped name: "+this._mapping.buttons[t])}for(t=0;t<this._mapping.axisMeshNames.length;t++){var s=this._mapping.axisMeshNames[t];if(s){var a=c(e,s);if(a){var l={index:t,value:h(a,"VALUE"),min:h(a,"MIN"),max:h(a,"MAX")};l.value&&l.min&&l.max?i.axisMeshes[t]=l:kr.Tools.Warn("Missing axis submesh under mesh with name: "+s+"(VALUE: "+!!l.value+", MIN: "+!!l.min+", MAX:"+!!l.max+")")}else kr.Tools.Warn("Missing axis mesh with name: "+s)}else kr.Tools.Log("Skipping unknown axis at index: "+t)}return i.pointingPoseNode=c(e,this._mapping.pointingPoseMeshName),i.pointingPoseNode?this._pointingPoseNode=i.pointingPoseNode:kr.Tools.Warn("Missing pointing pose mesh with name: "+this._mapping.pointingPoseMeshName),i;function c(e,t){return e.getChildMeshes(!1,(function(e){return e.name===t}))[0]}function h(e,t){return e.getChildMeshes(!0,(function(e){return e.name==t}))[0]}},l.prototype.getForwardRay=function(e){if(void 0===e&&(e=100),!this._loadedMeshInfo||!this._loadedMeshInfo.pointingPoseNode)return s.prototype.getForwardRay.call(this,e);var t=this._loadedMeshInfo.pointingPoseNode.getWorldMatrix(),i=t.getTranslation(),r=new kr.Vector3(0,0,-1),n=kr.Vector3.TransformNormal(r,t),o=kr.Vector3.Normalize(n);return new kr.Ray(i,o,e)},l.prototype.dispose=function(){s.prototype.dispose.call(this),this.onTrackpadChangedObservable.clear()},l.MODEL_BASE_URL="https://controllers.babylonjs.com/microsoft/",l.MODEL_LEFT_FILENAME="left.glb",l.MODEL_RIGHT_FILENAME="right.glb",l.GAMEPAD_ID_PREFIX="Spatial Controller (Spatial Interaction Source) ",l.GAMEPAD_ID_PATTERN=/([0-9a-zA-Z]+-[0-9a-zA-Z]+)$/,l})(kr.WebVRController),kr.WindowsMotionController=Hr,Xr=$a||($a={}),jr=(function(i){function e(e){var t=i.call(this,e)||this;return t._buttonIndexToObservableNameMap=["onTrackpadChangedObservable","onTriggerStateChangedObservable"],t.controllerType=Xr.PoseEnabledControllerType.GEAR_VR,t._calculatedPosition=new Xr.Vector3("left"==t.hand?-.15:.15,-.5,.25),t._disableTrackPosition(t._calculatedPosition),t}return T(e,i),e.prototype.initControllerMesh=function(i,r){var n=this;Xr.SceneLoader.ImportMesh("",e.MODEL_BASE_URL,e.MODEL_FILENAME,i,(function(e){var t=new Xr.Mesh("",i);e[1].parent=t,e[1].position.z=-.15,n._defaultModel=t,n.attachToMesh(n._defaultModel),r&&r(n._defaultModel)}))},e.prototype._handleButtonChange=function(e,t,i){if(e<this._buttonIndexToObservableNameMap.length){var r=this[this._buttonIndexToObservableNameMap[e]];r&&r.notifyObservers(t)}},e.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",e.MODEL_FILENAME="generic.babylon",e.GAMEPAD_ID_PREFIX="Gear VR",e})(Xr.WebVRController),Xr.GearVRController=jr,Yr=$a||($a={}),Kr=(function(i){function r(e){var t=i.call(this,e)||this;return t.controllerType=Yr.PoseEnabledControllerType.DAYDREAM,t}return T(r,i),r.prototype.initControllerMesh=function(e,t){var i=this;Yr.SceneLoader.ImportMesh("",r.MODEL_BASE_URL,r.MODEL_FILENAME,e,(function(e){i._defaultModel=e[1],i.attachToMesh(i._defaultModel),t&&t(i._defaultModel)}))},r.prototype._handleButtonChange=function(e,t,i){if(0===e){var r=this.onTriggerStateChangedObservable;r&&r.notifyObservers(t)}else Yr.Tools.Warn("Unrecognized Daydream button index: "+e)},r.MODEL_BASE_URL="https://controllers.babylonjs.com/generic/",r.MODEL_FILENAME="generic.babylon",r.GAMEPAD_ID_PREFIX="Daydream",r})(Yr.WebVRController),Yr.DaydreamController=Kr,(function(t){Object.defineProperty(t.Scene.prototype,"gamepadManager",{get:function(){if(!this._gamepadManager){this._gamepadManager=new t.GamepadManager(this);var e=this._getComponent(t.SceneComponentConstants.NAME_GAMEPAD);e||(e=new i(this),this._addComponent(e))}return this._gamepadManager},enumerable:!0,configurable:!0}),t.FreeCameraInputsManager.prototype.addGamepad=function(){return this.add(new t.FreeCameraGamepadInput),this},t.ArcRotateCameraInputsManager.prototype.addGamepad=function(){return this.add(new t.ArcRotateCameraGamepadInput),this};var i=(function(){function e(e){this.name=t.SceneComponentConstants.NAME_GAMEPAD,this.scene=e}return e.prototype.register=function(){this.scene._beforeCameraUpdateStage.registerStep(t.SceneComponentConstants.STEP_BEFORECAMERAUPDATE_GAMEPAD,this,this._beforeCameraUpdate)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){var e=this.scene._gamepadManager;e&&(e.dispose(),this.scene._gamepadManager=null)},e.prototype._beforeCameraUpdate=function(){var e=this.scene._gamepadManager;e&&e._isMonitoring&&e._checkGamepadsStatus()},e})();t.GamepadSystemSceneComponent=i})($a||($a={})),(function(f){f.Node.AddNodeConstructor("FollowCamera",(function(e,t){return function(){return new i(e,f.Vector3.Zero(),t)}})),f.Node.AddNodeConstructor("ArcFollowCamera",(function(e,t){return function(){return new r(e,0,0,1,null,t)}}));var i=(function(o){function e(e,t,i,r){void 0===r&&(r=null);var n=o.call(this,e,t,i)||this;return n.radius=12,n.rotationOffset=0,n.heightOffset=4,n.cameraAcceleration=.05,n.maxCameraSpeed=20,n.lockedTarget=r,n}return T(e,o),e.prototype._follow=function(e){if(e){var t;if(e.rotationQuaternion){var i=new f.Matrix;e.rotationQuaternion.toRotationMatrix(i),t=Math.atan2(i.m[8],i.m[10])}else t=e.rotation.y;var r=f.Tools.ToRadians(this.rotationOffset)+t,n=e.getAbsolutePosition(),o=n.x+Math.sin(r)*this.radius,s=n.z+Math.cos(r)*this.radius,a=o-this.position.x,l=n.y+this.heightOffset-this.position.y,c=s-this.position.z,h=a*this.cameraAcceleration*2,u=l*this.cameraAcceleration,d=c*this.cameraAcceleration*2;(h>this.maxCameraSpeed||h<-this.maxCameraSpeed)&&(h=h<1?-this.maxCameraSpeed:this.maxCameraSpeed),(u>this.maxCameraSpeed||u<-this.maxCameraSpeed)&&(u=u<1?-this.maxCameraSpeed:this.maxCameraSpeed),(d>this.maxCameraSpeed||d<-this.maxCameraSpeed)&&(d=d<1?-this.maxCameraSpeed:this.maxCameraSpeed),this.position=new f.Vector3(this.position.x+h,this.position.y+u,this.position.z+d),this.setTarget(n)}},e.prototype._checkInputs=function(){o.prototype._checkInputs.call(this),this.lockedTarget&&this._follow(this.lockedTarget)},e.prototype.getClassName=function(){return"FollowCamera"},b([f.serialize()],e.prototype,"radius",void 0),b([f.serialize()],e.prototype,"rotationOffset",void 0),b([f.serialize()],e.prototype,"heightOffset",void 0),b([f.serialize()],e.prototype,"cameraAcceleration",void 0),b([f.serialize()],e.prototype,"maxCameraSpeed",void 0),b([f.serializeAsMeshReference("lockedTargetId")],e.prototype,"lockedTarget",void 0),e})(f.TargetCamera);f.FollowCamera=i;var r=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,f.Vector3.Zero(),o)||this;return s.alpha=t,s.beta=i,s.radius=r,s.target=n,s._cartesianCoordinates=f.Vector3.Zero(),s._follow(),s}return T(e,a),e.prototype._follow=function(){if(this.target){this._cartesianCoordinates.x=this.radius*Math.cos(this.alpha)*Math.cos(this.beta),this._cartesianCoordinates.y=this.radius*Math.sin(this.beta),this._cartesianCoordinates.z=this.radius*Math.sin(this.alpha)*Math.cos(this.beta);var e=this.target.getAbsolutePosition();this.position=e.add(this._cartesianCoordinates),this.setTarget(e)}},e.prototype._checkInputs=function(){a.prototype._checkInputs.call(this),this._follow()},e.prototype.getClassName=function(){return"ArcFollowCamera"},e})(f.TargetCamera);f.ArcFollowCamera=r})($a||($a={})),Qr=$a||($a={}),Zr=(function(n){function e(e,t,i){var r=n.call(this,e,t,i)||this;return r.inputs.addGamepad(),r}return T(e,n),Object.defineProperty(e.prototype,"gamepadAngularSensibility",{get:function(){var e=this.inputs.attached.gamepad;return e?e.gamepadAngularSensibility:0},set:function(e){var t=this.inputs.attached.gamepad;t&&(t.gamepadAngularSensibility=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gamepadMoveSensibility",{get:function(){var e=this.inputs.attached.gamepad;return e?e.gamepadMoveSensibility:0},set:function(e){var t=this.inputs.attached.gamepad;t&&(t.gamepadMoveSensibility=e)},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"UniversalCamera"},e})(Qr.TouchCamera),Qr.UniversalCamera=Zr,(function(i){i.Node.AddNodeConstructor("GamepadCamera",(function(e,t){return function(){return new r(e,i.Vector3.Zero(),t)}}));var r=(function(r){function e(e,t,i){return r.call(this,e,t,i)||this}return T(e,r),e.prototype.getClassName=function(){return"GamepadCamera"},e})(i.UniversalCamera);i.GamepadCamera=r})($a||($a={})),qr=$a||($a={}),Jr=(function(){function e(){this._renderPipelines={}}return e.prototype.addPipeline=function(e){this._renderPipelines[e._name]=e},e.prototype.attachCamerasToRenderPipeline=function(e,t,i){void 0===i&&(i=!1);var r=this._renderPipelines[e];r&&r._attachCameras(t,i)},e.prototype.detachCamerasFromRenderPipeline=function(e,t){var i=this._renderPipelines[e];i&&i._detachCameras(t)},e.prototype.enableEffectInPipeline=function(e,t,i){var r=this._renderPipelines[e];r&&r._enableEffect(t,i)},e.prototype.disableEffectInPipeline=function(e,t,i){var r=this._renderPipelines[e];r&&r._disableEffect(t,i)},e.prototype.update=function(){for(var e in this._renderPipelines)if(this._renderPipelines.hasOwnProperty(e)){var t=this._renderPipelines[e];t.isSupported?t._update():(t.dispose(),delete this._renderPipelines[e])}},e.prototype._rebuild=function(){for(var e in this._renderPipelines){if(this._renderPipelines.hasOwnProperty(e))this._renderPipelines[e]._rebuild()}},e.prototype.dispose=function(){for(var e in this._renderPipelines){if(this._renderPipelines.hasOwnProperty(e))this._renderPipelines[e].dispose()}},e})(),qr.PostProcessRenderPipelineManager=Jr,(function(t){Object.defineProperty(t.Scene.prototype,"postProcessRenderPipelineManager",{get:function(){if(!this._postProcessRenderPipelineManager){var e=this._getComponent(t.SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER);e||(e=new i(this),this._addComponent(e)),this._postProcessRenderPipelineManager=new t.PostProcessRenderPipelineManager}return this._postProcessRenderPipelineManager},enumerable:!0,configurable:!0});var i=(function(){function e(e){this.name=t.SceneComponentConstants.NAME_POSTPROCESSRENDERPIPELINEMANAGER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(t.SceneComponentConstants.STEP_GATHERRENDERTARGETS_POSTPROCESSRENDERPIPELINEMANAGER,this,this._gatherRenderTargets)},e.prototype.rebuild=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager._rebuild()},e.prototype.dispose=function(){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.dispose()},e.prototype._gatherRenderTargets=function(e){this.scene._postProcessRenderPipelineManager&&this.scene._postProcessRenderPipelineManager.update()},e})();t.PostProcessRenderPipelineManagerSceneComponent=i})($a||($a={})),$r=$a||($a={}),en=(function(){function e(e,t,i,r){this._name=t,this._singleInstance=r||!0,this._getPostProcesses=i,this._cameras={},this._indicesForCamera={},this._postProcesses={}}return Object.defineProperty(e.prototype,"isSupported",{get:function(){for(var e in this._postProcesses)if(this._postProcesses.hasOwnProperty(e))for(var t=this._postProcesses[e],i=0;i<t.length;i++)if(!t[i].isSupported)return!1;return!0},enumerable:!0,configurable:!0}),e.prototype._update=function(){},e.prototype._attachCameras=function(e){var t,i=this,r=$r.Tools.MakeArray(e||this._cameras);if(r)for(var n=0;n<r.length;n++){var o=r[n],s=o.name;if(t=this._singleInstance?0:s,!this._postProcesses[t]){var a=this._getPostProcesses();a&&(this._postProcesses[t]=Array.isArray(a)?a:[a])}this._indicesForCamera[s]||(this._indicesForCamera[s]=[]),this._postProcesses[t].forEach((function(e){var t=o.attachPostProcess(e);i._indicesForCamera[s].push(t)})),this._cameras[s]||(this._cameras[s]=o)}},e.prototype._detachCameras=function(e){var t=$r.Tools.MakeArray(e||this._cameras);if(t)for(var i=0;i<t.length;i++){var r=t[i],n=r.name;this._postProcesses[this._singleInstance?0:n].forEach((function(e){r.detachPostProcess(e)})),this._cameras[n]&&(this._cameras[n]=null)}},e.prototype._enable=function(e){var t=this,i=$r.Tools.MakeArray(e||this._cameras);if(i)for(var r=0;r<i.length;r++)for(var n=i[r],o=n.name,s=0;s<this._indicesForCamera[o].length;s++)void 0!==n._postProcesses[this._indicesForCamera[o][s]]&&null!==n._postProcesses[this._indicesForCamera[o][s]]||this._postProcesses[this._singleInstance?0:o].forEach((function(e){i[r].attachPostProcess(e,t._indicesForCamera[o][s])}))},e.prototype._disable=function(e){var t=$r.Tools.MakeArray(e||this._cameras);if(t)for(var i=0;i<t.length;i++){var r=t[i],n=r.name;this._postProcesses[this._singleInstance?0:n].forEach((function(e){r.detachPostProcess(e)}))}},e.prototype.getPostProcesses=function(e){return this._singleInstance?this._postProcesses[0]:e?this._postProcesses[e.name]:null},e})(),$r.PostProcessRenderEffect=en,tn=$a||($a={}),rn=(function(){function e(e,t){this.engine=e,this._name=t,this._renderEffects={},this._renderEffectsForIsolatedPass=new Array,this._cameras=[]}return e.prototype.getClassName=function(){return"PostProcessRenderPipeline"},Object.defineProperty(e.prototype,"isSupported",{get:function(){for(var e in this._renderEffects)if(this._renderEffects.hasOwnProperty(e)&&!this._renderEffects[e].isSupported)return!1;return!0},enumerable:!0,configurable:!0}),e.prototype.addEffect=function(e){this._renderEffects[e._name]=e},e.prototype._rebuild=function(){},e.prototype._enableEffect=function(e,t){var i=this._renderEffects[e];i&&i._enable(tn.Tools.MakeArray(t||this._cameras))},e.prototype._disableEffect=function(e,t){var i=this._renderEffects[e];i&&i._disable(tn.Tools.MakeArray(t||this._cameras))},e.prototype._attachCameras=function(e,t){var i=tn.Tools.MakeArray(e||this._cameras);if(i){var r,n=[];for(r=0;r<i.length;r++){var o=i[r],s=o.name;-1===this._cameras.indexOf(o)?this._cameras[s]=o:t&&n.push(r)}for(r=0;r<n.length;r++)e.splice(n[r],1);for(var a in this._renderEffects)this._renderEffects.hasOwnProperty(a)&&this._renderEffects[a]._attachCameras(i)}},e.prototype._detachCameras=function(e){var t=tn.Tools.MakeArray(e||this._cameras);if(t){for(var i in this._renderEffects)this._renderEffects.hasOwnProperty(i)&&this._renderEffects[i]._detachCameras(t);for(var r=0;r<t.length;r++)this._cameras.splice(this._cameras.indexOf(t[r]),1)}},e.prototype._update=function(){for(var e in this._renderEffects)this._renderEffects.hasOwnProperty(e)&&this._renderEffects[e]._update();for(var t=0;t<this._cameras.length;t++){var i=this._cameras[t].name;this._renderEffectsForIsolatedPass[i]&&this._renderEffectsForIsolatedPass[i]._update()}},e.prototype._reset=function(){this._renderEffects={},this._renderEffectsForIsolatedPass=new Array},e.prototype._enableMSAAOnFirstPostProcess=function(e){var t=Object.keys(this._renderEffects);if(2<=this.engine.webGLVersion&&0<t.length){var i=this._renderEffects[t[0]].getPostProcesses();if(i)return i[0].samples=e,!0}return!1},e.prototype.dispose=function(){},b([tn.serialize()],e.prototype,"_name",void 0),e})(),tn.PostProcessRenderPipeline=rn,nn=$a||($a={}),on=(function(){function e(e,t,i){void 0===t&&(t=nn.Engine.TEXTURETYPE_FLOAT),void 0===i&&(i=null);var c=this;this.useOnlyInActiveCamera=!1;var r=(this._scene=e)._getComponent(nn.SceneComponentConstants.NAME_DEPTHRENDERER);r||(r=new nn.DepthRendererSceneComponent(e),e._addComponent(r)),this._camera=i;var o=e.getEngine();this._depthMap=new nn.RenderTargetTexture("depthMap",{width:o.getRenderWidth(),height:o.getRenderHeight()},this._scene,!1,!0,t),this._depthMap.wrapU=nn.Texture.CLAMP_ADDRESSMODE,this._depthMap.wrapV=nn.Texture.CLAMP_ADDRESSMODE,this._depthMap.refreshRate=1,this._depthMap.renderParticles=!1,this._depthMap.renderList=null,this._depthMap.activeCamera=this._camera,this._depthMap.ignoreCameraViewport=!0,this._depthMap.useCameraPostProcesses=!1,this._depthMap.onClearObservable.add((function(e){e.clear(new nn.Color4(1,1,1,1),!0,!0,!0)}));var s=function(e){var t=e.getRenderingMesh(),i=c._scene,r=i.getEngine(),n=e.getMaterial();if(n){r.setState(n.backFaceCulling,0,!1,i.useRightHandedSystem);var o=t._getInstancesRenderList(e._id);if(!o.mustReturn){var s=r.getCaps().instancedArrays&&null!==o.visibleInstances[e._id],a=c._camera||i.activeCamera;if(c.isReady(e,s)&&a){if(r.enableEffect(c._effect),t._bind(e,c._effect,nn.Material.TriangleFillMode),c._effect.setMatrix("viewProjection",i.getTransformMatrix()),c._effect.setFloat2("depthValues",a.minZ,a.minZ+a.maxZ),n&&n.needAlphaTesting()){var l=n.getAlphaTestTexture();l&&(c._effect.setTexture("diffuseSampler",l),c._effect.setMatrix("diffuseMatrix",l.getTextureMatrix()))}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&c._effect.setMatrices("mBones",t.skeleton.getTransformMatrices(t)),t._processRendering(e,c._effect,nn.Material.TriangleFillMode,o,s,(function(e,t){return c._effect.setMatrix("world",t)}))}}}};this._depthMap.customRenderFunction=function(e,t,i,r){var n;if(r.length){for(o.setColorWrite(!1),n=0;n<r.length;n++)s(r.data[n]);o.setColorWrite(!0)}for(n=0;n<e.length;n++)s(e.data[n]);for(n=0;n<t.length;n++)s(t.data[n])}}return e.prototype.isReady=function(e,t){var i=e.getMaterial();if(i.disableDepthWrite)return!1;var r=[],n=[nn.VertexBuffer.PositionKind],o=e.getMesh();i&&i.needAlphaTesting()&&i.getAlphaTestTexture()&&(r.push("#define ALPHATEST"),o.isVerticesDataPresent(nn.VertexBuffer.UVKind)&&(n.push(nn.VertexBuffer.UVKind),r.push("#define UV1")),o.isVerticesDataPresent(nn.VertexBuffer.UV2Kind)&&(n.push(nn.VertexBuffer.UV2Kind),r.push("#define UV2"))),o.useBones&&o.computeBonesUsingShaders?(n.push(nn.VertexBuffer.MatricesIndicesKind),n.push(nn.VertexBuffer.MatricesWeightsKind),4<o.numBoneInfluencers&&(n.push(nn.VertexBuffer.MatricesIndicesExtraKind),n.push(nn.VertexBuffer.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),r.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):r.push("#define NUM_BONE_INFLUENCERS 0"),t&&(r.push("#define INSTANCES"),n.push("world0"),n.push("world1"),n.push("world2"),n.push("world3"));var s=r.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._effect=this._scene.getEngine().createEffect("depth",n,["world","mBones","viewProjection","diffuseMatrix","depthValues"],["diffuseSampler"],s)),this._effect.isReady()},e.prototype.getDepthMap=function(){return this._depthMap},e.prototype.dispose=function(){this._depthMap.dispose()},e})(),nn.DepthRenderer=on,(function(i){i.Scene.prototype.enableDepthRenderer=function(e){if(!(e=e||this.activeCamera))throw"No camera available to enable depth renderer";if(this._depthRenderer||(this._depthRenderer={}),!this._depthRenderer[e.id]){var t=0;if(this.getEngine().getCaps().textureHalfFloatRender)t=i.Engine.TEXTURETYPE_HALF_FLOAT;else{if(!this.getEngine().getCaps().textureFloatRender)throw"Depth renderer does not support int texture type";t=i.Engine.TEXTURETYPE_FLOAT}this._depthRenderer[e.id]=new i.DepthRenderer(this,t,e)}return this._depthRenderer[e.id]},i.Scene.prototype.disableDepthRenderer=function(e){(e=e||this.activeCamera)&&this._depthRenderer&&this._depthRenderer[e.id]&&(this._depthRenderer[e.id].dispose(),delete this._depthRenderer[e.id])};var e=(function(){function e(e){this.name=i.SceneComponentConstants.NAME_DEPTHRENDERER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(i.SceneComponentConstants.STEP_GATHERRENDERTARGETS_DEPTHRENDERER,this,this._gatherRenderTargets),this.scene._gatherActiveCameraRenderTargetsStage.registerStep(i.SceneComponentConstants.STEP_GATHERACTIVECAMERARENDERTARGETS_DEPTHRENDERER,this,this._gatherActiveCameraRenderTargets)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){for(var e in this.scene._depthRenderer)this.scene._depthRenderer[e].dispose()},e.prototype._gatherRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.useOnlyInActiveCamera||e.push(i.getDepthMap())}},e.prototype._gatherActiveCameraRenderTargets=function(e){if(this.scene._depthRenderer)for(var t in this.scene._depthRenderer){var i=this.scene._depthRenderer[t];i.useOnlyInActiveCamera&&this.scene.activeCamera.id===t&&e.push(i.getDepthMap())}},e})();i.DepthRendererSceneComponent=e})($a||($a={})),sn=$a||($a={}),an=(function(){function e(e,t){void 0===t&&(t=1),this._enablePosition=!1,this._scene=e,this._ratio=t;var i=e._getComponent(sn.SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER);i||(i=new sn.GeometryBufferRendererSceneComponent(e),e._addComponent(i)),this._createRenderTargets()}return Object.defineProperty(e.prototype,"renderList",{set:function(e){this._multiRenderTarget.renderList=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"isSupported",{get:function(){return this._multiRenderTarget.isSupported},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"enablePosition",{get:function(){return this._enablePosition},set:function(e){this._enablePosition=e,this.dispose(),this._createRenderTargets()},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scene",{get:function(){return this._scene},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"ratio",{get:function(){return this._ratio},enumerable:!0,configurable:!0}),e.prototype.isReady=function(e,t){var i=e.getMaterial();if(i&&i.disableDepthWrite)return!1;var r=[],n=[sn.VertexBuffer.PositionKind,sn.VertexBuffer.NormalKind],o=e.getMesh();i&&i.needAlphaTesting()&&(r.push("#define ALPHATEST"),o.isVerticesDataPresent(sn.VertexBuffer.UVKind)&&(n.push(sn.VertexBuffer.UVKind),r.push("#define UV1")),o.isVerticesDataPresent(sn.VertexBuffer.UV2Kind)&&(n.push(sn.VertexBuffer.UV2Kind),r.push("#define UV2"))),this._enablePosition&&r.push("#define POSITION"),o.useBones&&o.computeBonesUsingShaders?(n.push(sn.VertexBuffer.MatricesIndicesKind),n.push(sn.VertexBuffer.MatricesWeightsKind),4<o.numBoneInfluencers&&(n.push(sn.VertexBuffer.MatricesIndicesExtraKind),n.push(sn.VertexBuffer.MatricesWeightsExtraKind)),r.push("#define NUM_BONE_INFLUENCERS "+o.numBoneInfluencers),r.push("#define BonesPerMesh "+(o.skeleton?o.skeleton.bones.length+1:0))):r.push("#define NUM_BONE_INFLUENCERS 0"),t&&(r.push("#define INSTANCES"),n.push("world0"),n.push("world1"),n.push("world2"),n.push("world3"));var s=r.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._effect=this._scene.getEngine().createEffect("geometry",n,["world","mBones","viewProjection","diffuseMatrix","view"],["diffuseSampler"],s,void 0,void 0,void 0,{buffersCount:this._enablePosition?3:2})),this._effect.isReady()},e.prototype.getGBuffer=function(){return this._multiRenderTarget},Object.defineProperty(e.prototype,"samples",{get:function(){return this._multiRenderTarget.samples},set:function(e){this._multiRenderTarget.samples=e},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.getGBuffer().dispose()},e.prototype._createRenderTargets=function(){var l=this,o=this._scene.getEngine(),e=this._enablePosition?3:2;if(this._multiRenderTarget=new sn.MultiRenderTarget("gBuffer",{width:o.getRenderWidth()*this._ratio,height:o.getRenderHeight()*this._ratio},e,this._scene,{generateMipMaps:!1,generateDepthTexture:!0,defaultType:sn.Engine.TEXTURETYPE_FLOAT}),this.isSupported){this._multiRenderTarget.wrapU=sn.Texture.CLAMP_ADDRESSMODE,this._multiRenderTarget.wrapV=sn.Texture.CLAMP_ADDRESSMODE,this._multiRenderTarget.refreshRate=1,this._multiRenderTarget.renderParticles=!1,this._multiRenderTarget.renderList=null,this._multiRenderTarget.onClearObservable.add((function(e){e.clear(new sn.Color4(0,0,0,1),!0,!0,!0)}));var s=function(e){var t=e.getRenderingMesh(),i=l._scene,r=i.getEngine(),n=e.getMaterial();if(n){r.setState(n.backFaceCulling,0,!1,i.useRightHandedSystem);var o=t._getInstancesRenderList(e._id);if(!o.mustReturn){var s=r.getCaps().instancedArrays&&null!==o.visibleInstances[e._id];if(l.isReady(e,s)){if(r.enableEffect(l._effect),t._bind(e,l._effect,sn.Material.TriangleFillMode),l._effect.setMatrix("viewProjection",i.getTransformMatrix()),l._effect.setMatrix("view",i.getViewMatrix()),n&&n.needAlphaTesting()){var a=n.getAlphaTestTexture();a&&(l._effect.setTexture("diffuseSampler",a),l._effect.setMatrix("diffuseMatrix",a.getTextureMatrix()))}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&l._effect.setMatrices("mBones",t.skeleton.getTransformMatrices(t)),t._processRendering(e,l._effect,sn.Material.TriangleFillMode,o,s,(function(e,t){return l._effect.setMatrix("world",t)}))}}}};this._multiRenderTarget.customRenderFunction=function(e,t,i,r){var n;if(r.length){for(o.setColorWrite(!1),n=0;n<r.length;n++)s(r.data[n]);o.setColorWrite(!0)}for(n=0;n<e.length;n++)s(e.data[n]);for(n=0;n<t.length;n++)s(t.data[n])}}},e})(),sn.GeometryBufferRenderer=an,(function(t){Object.defineProperty(t.Scene.prototype,"geometryBufferRenderer",{get:function(){this._geometryBufferRenderer},set:function(e){e&&e.isSupported&&(this._geometryBufferRenderer=e)},enumerable:!0,configurable:!0}),t.Scene.prototype.enableGeometryBufferRenderer=function(e){return void 0===e&&(e=1),this._geometryBufferRenderer||(this._geometryBufferRenderer=new t.GeometryBufferRenderer(this,e),this._geometryBufferRenderer.isSupported||(this._geometryBufferRenderer=null)),this._geometryBufferRenderer},t.Scene.prototype.disableGeometryBufferRenderer=function(){this._geometryBufferRenderer&&(this._geometryBufferRenderer.dispose(),this._geometryBufferRenderer=null)};var e=(function(){function e(e){this.name=t.SceneComponentConstants.NAME_GEOMETRYBUFFERRENDERER,this.scene=e}return e.prototype.register=function(){this.scene._gatherRenderTargetsStage.registerStep(t.SceneComponentConstants.STEP_GATHERRENDERTARGETS_GEOMETRYBUFFERRENDERER,this,this._gatherRenderTargets)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._gatherRenderTargets=function(e){this.scene._geometryBufferRenderer&&e.push(this.scene._geometryBufferRenderer.getGBuffer())},e})();t.GeometryBufferRendererSceneComponent=e})($a||($a={})),ln=$a||($a={}),cn=(function(a){function e(e,t,i,r){var n=a.call(this,t.getEngine(),e)||this;n.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",n.SSAORenderEffect="SSAORenderEffect",n.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",n.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",n.SSAOCombineRenderEffect="SSAOCombineRenderEffect",n.totalStrength=1,n.radius=1e-4,n.area=.0075,n.fallOff=1e-6,n.base=.5,n._firstUpdate=!0,n._scene=t,n._createRandomTexture(),n._depthTexture=t.enableDepthRenderer().getDepthMap();var o=i.ssaoRatio||i,s=i.combineRatio||i;return n._originalColorPostProcess=new ln.PassPostProcess("SSAOOriginalSceneColor",s,null,ln.Texture.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),n._createSSAOPostProcess(o),n._createBlurPostProcess(o),n._createSSAOCombinePostProcess(s),n.addEffect(new ln.PostProcessRenderEffect(t.getEngine(),n.SSAOOriginalSceneColorEffect,function(){return n._originalColorPostProcess},!0)),n.addEffect(new ln.PostProcessRenderEffect(t.getEngine(),n.SSAORenderEffect,function(){return n._ssaoPostProcess},!0)),n.addEffect(new ln.PostProcessRenderEffect(t.getEngine(),n.SSAOBlurHRenderEffect,function(){return n._blurHPostProcess},!0)),n.addEffect(new ln.PostProcessRenderEffect(t.getEngine(),n.SSAOBlurVRenderEffect,function(){return n._blurVPostProcess},!0)),n.addEffect(new ln.PostProcessRenderEffect(t.getEngine(),n.SSAOCombineRenderEffect,function(){return n._ssaoCombinePostProcess},!0)),t.postProcessRenderPipelineManager.addPipeline(n),r&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,r),n}return T(e,a),e.prototype.dispose=function(e){void 0===e&&(e=!1);for(var t=0;t<this._scene.cameras.length;t++){var i=this._scene.cameras[t];this._originalColorPostProcess.dispose(i),this._ssaoPostProcess.dispose(i),this._blurHPostProcess.dispose(i),this._blurVPostProcess.dispose(i),this._ssaoCombinePostProcess.dispose(i)}this._randomTexture.dispose(),e&&this._scene.disableDepthRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),a.prototype.dispose.call(this)},e.prototype._createBlurPostProcess=function(e){var t=this;this._blurHPostProcess=new ln.BlurPostProcess("BlurH",new ln.Vector2(1,0),16,e,null,ln.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,ln.Engine.TEXTURETYPE_UNSIGNED_INT),this._blurVPostProcess=new ln.BlurPostProcess("BlurV",new ln.Vector2(0,1),16,e,null,ln.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,ln.Engine.TEXTURETYPE_UNSIGNED_INT),this._blurHPostProcess.onActivateObservable.add((function(){var e=t._blurHPostProcess.width/t._scene.getEngine().getRenderWidth();t._blurHPostProcess.kernel=16*e})),this._blurVPostProcess.onActivateObservable.add((function(){var e=t._blurVPostProcess.height/t._scene.getEngine().getRenderHeight();t._blurVPostProcess.kernel=16*e}))},e.prototype._rebuild=function(){this._firstUpdate=!0,a.prototype._rebuild.call(this)},e.prototype._createSSAOPostProcess=function(e){var t=this,i=[.5381,.1856,-.4319,.1379,.2486,.443,.3371,.5679,-.0057,-.6999,-.0451,-.0019,.0689,-.1598,-.8547,.056,.0069,-.1843,-.0146,.1402,.0762,.01,-.1924,-.0344,-.3577,-.5301,-.4358,-.3169,.1063,.0158,.0103,-.5869,.0046,-.0897,-.494,.3287,.7119,-.0154,-.0918,-.0533,.0596,-.5411,.0352,-.0631,.546,-.4776,.2847,-.0271];this._ssaoPostProcess=new ln.PostProcess("ssao","ssao",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","area","fallOff","base","range","viewport"],["randomSampler"],e,null,ln.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define SAMPLES 16\n#define SSAO"),this._ssaoPostProcess.onApply=function(e){t._firstUpdate&&(e.setArray3("sampleSphere",i),e.setFloat("samplesFactor",1/16),e.setFloat("randTextureTiles",4)),e.setFloat("totalStrength",t.totalStrength),e.setFloat("radius",t.radius),e.setFloat("area",t.area),e.setFloat("fallOff",t.fallOff),e.setFloat("base",t.base),e.setTexture("textureSampler",t._depthTexture),e.setTexture("randomSampler",t._randomTexture)}},e.prototype._createSSAOCombinePostProcess=function(e){var t=this;this._ssaoCombinePostProcess=new ln.PostProcess("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,ln.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._ssaoCombinePostProcess.onApply=function(e){e.setVector4("viewport",ln.Tmp.Vector4[0].copyFromFloats(0,0,1,1)),e.setTextureFromPostProcess("originalColor",t._originalColorPostProcess)}},e.prototype._createRandomTexture=function(){this._randomTexture=new ln.DynamicTexture("SSAORandomTexture",512,this._scene,!1,ln.Texture.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=ln.Texture.WRAP_ADDRESSMODE,this._randomTexture.wrapV=ln.Texture.WRAP_ADDRESSMODE;for(var e=this._randomTexture.getContext(),t=function(e,t){return Math.random()*(t-e)+e},i=ln.Vector3.Zero(),r=0;r<512;r++)for(var n=0;n<512;n++)i.x=Math.floor(255*t(-1,1)),i.y=Math.floor(255*t(-1,1)),i.z=Math.floor(255*t(-1,1)),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(r,n,1,1);this._randomTexture.update(!1)},b([ln.serialize()],e.prototype,"totalStrength",void 0),b([ln.serialize()],e.prototype,"radius",void 0),b([ln.serialize()],e.prototype,"area",void 0),b([ln.serialize()],e.prototype,"fallOff",void 0),b([ln.serialize()],e.prototype,"base",void 0),e})(ln.PostProcessRenderPipeline),ln.SSAORenderingPipeline=cn,hn=$a||($a={}),un=(function(l){function r(e,t,i,r){var n=l.call(this,t.getEngine(),e)||this;if(n.SSAOOriginalSceneColorEffect="SSAOOriginalSceneColorEffect",n.SSAORenderEffect="SSAORenderEffect",n.SSAOBlurHRenderEffect="SSAOBlurHRenderEffect",n.SSAOBlurVRenderEffect="SSAOBlurVRenderEffect",n.SSAOCombineRenderEffect="SSAOCombineRenderEffect",n.totalStrength=1,n.maxZ=100,n.minZAspect=.2,n._samples=8,n._textureSamples=1,n._expensiveBlur=!0,n.radius=2,n.base=0,n._firstUpdate=!0,n._bits=new Uint32Array(1),n._scene=t,n._ratio=i,!n.isSupported)return hn.Tools.Error("SSAO 2 needs WebGL 2 support."),n;var o=n._ratio.ssaoRatio||i,s=n._ratio.blurRatio||i,a=t.enableGeometryBufferRenderer();return n._createRandomTexture(),n._depthTexture=a.getGBuffer().textures[0],n._normalTexture=a.getGBuffer().textures[1],n._originalColorPostProcess=new hn.PassPostProcess("SSAOOriginalSceneColor",1,null,hn.Texture.BILINEAR_SAMPLINGMODE,t.getEngine(),!1),n._originalColorPostProcess.samples=n.textureSamples,n._createSSAOPostProcess(1),n._createBlurPostProcess(o,s),n._createSSAOCombinePostProcess(s),n.addEffect(new hn.PostProcessRenderEffect(t.getEngine(),n.SSAOOriginalSceneColorEffect,function(){return n._originalColorPostProcess},!0)),n.addEffect(new hn.PostProcessRenderEffect(t.getEngine(),n.SSAORenderEffect,function(){return n._ssaoPostProcess},!0)),n.addEffect(new hn.PostProcessRenderEffect(t.getEngine(),n.SSAOBlurHRenderEffect,function(){return n._blurHPostProcess},!0)),n.addEffect(new hn.PostProcessRenderEffect(t.getEngine(),n.SSAOBlurVRenderEffect,function(){return n._blurVPostProcess},!0)),n.addEffect(new hn.PostProcessRenderEffect(t.getEngine(),n.SSAOCombineRenderEffect,function(){return n._ssaoCombinePostProcess},!0)),t.postProcessRenderPipelineManager.addPipeline(n),r&&t.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,r),n}return T(r,l),Object.defineProperty(r.prototype,"samples",{get:function(){return this._samples},set:function(e){this._ssaoPostProcess.updateEffect("#define SAMPLES "+e+"\n#define SSAO"),this._samples=e,this._sampleSphere=this._generateHemisphere(),this._firstUpdate=!0},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"textureSamples",{get:function(){return this._textureSamples},set:function(e){this._textureSamples=e,this._originalColorPostProcess.samples=e,this._blurHPostProcess.samples=e,this._blurVPostProcess.samples=e,this._ssaoPostProcess.samples=e,this._ssaoCombinePostProcess.samples=e},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"expensiveBlur",{get:function(){return this._expensiveBlur},set:function(e){this._blurHPostProcess.updateEffect("#define BILATERAL_BLUR\n#define BILATERAL_BLUR_H\n#define SAMPLES 16\n#define EXPENSIVE "+(e?"1":"0")+"\n",null,["textureSampler","depthSampler"]),this._blurVPostProcess.updateEffect("#define BILATERAL_BLUR\n#define SAMPLES 16\n#define EXPENSIVE "+(e?"1":"0")+"\n",null,["textureSampler","depthSampler"]),this._expensiveBlur=e,this._firstUpdate=!0},enumerable:!0,configurable:!0}),Object.defineProperty(r,"IsSupported",{get:function(){var e=hn.Engine.LastCreatedEngine;return!!e&&e.getCaps().drawBuffersExtension},enumerable:!0,configurable:!0}),r.prototype.dispose=function(e){void 0===e&&(e=!1);for(var t=0;t<this._scene.cameras.length;t++){var i=this._scene.cameras[t];this._originalColorPostProcess.dispose(i),this._ssaoPostProcess.dispose(i),this._blurHPostProcess.dispose(i),this._blurVPostProcess.dispose(i),this._ssaoCombinePostProcess.dispose(i)}this._randomTexture.dispose(),e&&this._scene.disableGeometryBufferRenderer(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),l.prototype.dispose.call(this)},r.prototype._createBlurPostProcess=function(e,t){var i=this;this._samplerOffsets=[];for(var r=this.expensiveBlur,n=-8;n<8;n++)this._samplerOffsets.push(2*n+.5);this._blurHPostProcess=new hn.PostProcess("BlurH","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthSampler"],e,null,hn.Texture.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_H\n#define SAMPLES 16\n#define EXPENSIVE "+(r?"1":"0")+"\n"),this._blurHPostProcess.onApply=function(e){i._scene.activeCamera&&(e.setFloat("outSize",0<i._ssaoCombinePostProcess.width?i._ssaoCombinePostProcess.width:i._originalColorPostProcess.width),e.setFloat("near",i._scene.activeCamera.minZ),e.setFloat("far",i._scene.activeCamera.maxZ),e.setFloat("radius",i.radius),e.setTexture("depthSampler",i._depthTexture),i._firstUpdate&&e.setArray("samplerOffsets",i._samplerOffsets))},this._blurVPostProcess=new hn.PostProcess("BlurV","ssao2",["outSize","samplerOffsets","near","far","radius"],["depthSampler"],t,null,hn.Texture.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define BILATERAL_BLUR\n#define BILATERAL_BLUR_V\n#define SAMPLES 16\n#define EXPENSIVE "+(r?"1":"0")+"\n"),this._blurVPostProcess.onApply=function(e){i._scene.activeCamera&&(e.setFloat("outSize",0<i._ssaoCombinePostProcess.height?i._ssaoCombinePostProcess.height:i._originalColorPostProcess.height),e.setFloat("near",i._scene.activeCamera.minZ),e.setFloat("far",i._scene.activeCamera.maxZ),e.setFloat("radius",i.radius),e.setTexture("depthSampler",i._depthTexture),i._firstUpdate&&(e.setArray("samplerOffsets",i._samplerOffsets),i._firstUpdate=!1))},this._blurHPostProcess.samples=this.textureSamples,this._blurVPostProcess.samples=this.textureSamples},r.prototype._rebuild=function(){this._firstUpdate=!0,l.prototype._rebuild.call(this)},r.prototype._radicalInverse_VdC=function(e){return this._bits[0]=e,this._bits[0]=(this._bits[0]<<16|this._bits[0]>>16)>>>0,this._bits[0]=(1431655765&this._bits[0])<<1|(2863311530&this._bits[0])>>>1>>>0,this._bits[0]=(858993459&this._bits[0])<<2|(3435973836&this._bits[0])>>>2>>>0,this._bits[0]=(252645135&this._bits[0])<<4|(4042322160&this._bits[0])>>>4>>>0,this._bits[0]=(16711935&this._bits[0])<<8|(4278255360&this._bits[0])>>>8>>>0,2.3283064365386963e-10*this._bits[0]},r.prototype._hammersley=function(e,t){return[e/t,this._radicalInverse_VdC(e)]},r.prototype._hemisphereSample_uniform=function(e,t){var i=2*t*Math.PI,r=1-(.85*e+.15),n=Math.sqrt(1-r*r);return new hn.Vector3(Math.cos(i)*n,Math.sin(i)*n,r)},r.prototype._generateHemisphere=function(){for(var e,t=this.samples,i=[],r=0;r<t;){if(t<16)e=this._hemisphereSample_uniform(Math.random(),Math.random());else{var n=this._hammersley(r,t);e=this._hemisphereSample_uniform(n[0],n[1])}i.push(e.x,e.y,e.z),r++}return i},r.prototype._createSSAOPostProcess=function(e){var t=this,i=this.samples;this._sampleSphere=this._generateHemisphere(),this._ssaoPostProcess=new hn.PostProcess("ssao2","ssao2",["sampleSphere","samplesFactor","randTextureTiles","totalStrength","radius","base","range","projection","near","far","texelSize","xViewport","yViewport","maxZ","minZAspect"],["randomSampler","normalSampler"],e,null,hn.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,"#define SAMPLES "+i+"\n#define SSAO"),this._ssaoPostProcess.onApply=function(e){t._firstUpdate&&(e.setArray3("sampleSphere",t._sampleSphere),e.setFloat("randTextureTiles",32)),t._scene.activeCamera&&(e.setFloat("samplesFactor",1/t.samples),e.setFloat("totalStrength",t.totalStrength),e.setFloat2("texelSize",1/t._ssaoPostProcess.width,1/t._ssaoPostProcess.height),e.setFloat("radius",t.radius),e.setFloat("maxZ",t.maxZ),e.setFloat("minZAspect",t.minZAspect),e.setFloat("base",t.base),e.setFloat("near",t._scene.activeCamera.minZ),e.setFloat("far",t._scene.activeCamera.maxZ),e.setFloat("xViewport",Math.tan(t._scene.activeCamera.fov/2)*t._scene.getEngine().getAspectRatio(t._scene.activeCamera,!0)),e.setFloat("yViewport",Math.tan(t._scene.activeCamera.fov/2)),e.setMatrix("projection",t._scene.getProjectionMatrix()),e.setTexture("textureSampler",t._depthTexture),e.setTexture("normalSampler",t._normalTexture),e.setTexture("randomSampler",t._randomTexture))},this._ssaoPostProcess.samples=this.textureSamples},r.prototype._createSSAOCombinePostProcess=function(e){var i=this;this._ssaoCombinePostProcess=new hn.PostProcess("ssaoCombine","ssaoCombine",[],["originalColor","viewport"],e,null,hn.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._ssaoCombinePostProcess.onApply=function(e){var t=i._scene.activeCamera.viewport;e.setVector4("viewport",hn.Tmp.Vector4[0].copyFromFloats(t.x,t.y,t.width,t.height)),e.setTextureFromPostProcess("originalColor",i._originalColorPostProcess)},this._ssaoCombinePostProcess.samples=this.textureSamples},r.prototype._createRandomTexture=function(){this._randomTexture=new hn.DynamicTexture("SSAORandomTexture",128,this._scene,!1,hn.Texture.TRILINEAR_SAMPLINGMODE),this._randomTexture.wrapU=hn.Texture.WRAP_ADDRESSMODE,this._randomTexture.wrapV=hn.Texture.WRAP_ADDRESSMODE;for(var e=this._randomTexture.getContext(),t=function(e,t){return Math.random()*(t-e)+e},i=hn.Vector3.Zero(),r=0;r<128;r++)for(var n=0;n<128;n++)i.x=t(0,1),i.y=t(0,1),i.z=0,i.normalize(),i.scaleInPlace(255),i.x=Math.floor(i.x),i.y=Math.floor(i.y),e.fillStyle="rgb("+i.x+", "+i.y+", "+i.z+")",e.fillRect(r,n,1,1);this._randomTexture.update(!1)},r.prototype.serialize=function(){var e=hn.SerializationHelper.Serialize(this);return e.customType="SSAO2RenderingPipeline",e},r.Parse=function(e,t,i){return hn.SerializationHelper.Parse((function(){return new r(e._name,t,e._ratio)}),e,t,i)},b([hn.serialize()],r.prototype,"totalStrength",void 0),b([hn.serialize()],r.prototype,"maxZ",void 0),b([hn.serialize()],r.prototype,"minZAspect",void 0),b([hn.serialize("samples")],r.prototype,"_samples",void 0),b([hn.serialize("textureSamples")],r.prototype,"_textureSamples",void 0),b([hn.serialize()],r.prototype,"_ratio",void 0),b([hn.serialize("expensiveBlur")],r.prototype,"_expensiveBlur",void 0),b([hn.serialize()],r.prototype,"radius",void 0),b([hn.serialize()],r.prototype,"base",void 0),r})(hn.PostProcessRenderPipeline),hn.SSAO2RenderingPipeline=un,dn=$a||($a={}),fn=(function(s){function e(e,t,i,r,n){void 0===r&&(r=1);var o=s.call(this,i.getEngine(),e)||this;return o.LensChromaticAberrationEffect="LensChromaticAberrationEffect",o.HighlightsEnhancingEffect="HighlightsEnhancingEffect",o.LensDepthOfFieldEffect="LensDepthOfFieldEffect",o._scene=i,o._depthTexture=i.enableDepthRenderer().getDepthMap(),t.grain_texture?o._grainTexture=t.grain_texture:o._createGrainTexture(),o._edgeBlur=t.edge_blur?t.edge_blur:0,o._grainAmount=t.grain_amount?t.grain_amount:0,o._chromaticAberration=t.chromatic_aberration?t.chromatic_aberration:0,o._distortion=t.distortion?t.distortion:0,o._highlightsGain=void 0!==t.dof_gain?t.dof_gain:-1,o._highlightsThreshold=t.dof_threshold?t.dof_threshold:1,o._dofDistance=void 0!==t.dof_focus_distance?t.dof_focus_distance:-1,o._dofAperture=t.dof_aperture?t.dof_aperture:1,o._dofDarken=t.dof_darken?t.dof_darken:0,o._dofPentagon=void 0===t.dof_pentagon||t.dof_pentagon,o._blurNoise=void 0===t.blur_noise||t.blur_noise,o._createChromaticAberrationPostProcess(r),o._createHighlightsPostProcess(r),o._createDepthOfFieldPostProcess(r/4),o.addEffect(new dn.PostProcessRenderEffect(i.getEngine(),o.LensChromaticAberrationEffect,function(){return o._chromaticAberrationPostProcess},!0)),o.addEffect(new dn.PostProcessRenderEffect(i.getEngine(),o.HighlightsEnhancingEffect,function(){return o._highlightsPostProcess},!0)),o.addEffect(new dn.PostProcessRenderEffect(i.getEngine(),o.LensDepthOfFieldEffect,function(){return o._depthOfFieldPostProcess},!0)),-1===o._highlightsGain&&o._disableEffect(o.HighlightsEnhancingEffect,null),i.postProcessRenderPipelineManager.addPipeline(o),n&&i.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(e,n),o}return T(e,s),e.prototype.setEdgeBlur=function(e){this._edgeBlur=e},e.prototype.disableEdgeBlur=function(){this._edgeBlur=0},e.prototype.setGrainAmount=function(e){this._grainAmount=e},e.prototype.disableGrain=function(){this._grainAmount=0},e.prototype.setChromaticAberration=function(e){this._chromaticAberration=e},e.prototype.disableChromaticAberration=function(){this._chromaticAberration=0},e.prototype.setEdgeDistortion=function(e){this._distortion=e},e.prototype.disableEdgeDistortion=function(){this._distortion=0},e.prototype.setFocusDistance=function(e){this._dofDistance=e},e.prototype.disableDepthOfField=function(){this._dofDistance=-1},e.prototype.setAperture=function(e){this._dofAperture=e},e.prototype.setDarkenOutOfFocus=function(e){this._dofDarken=e},e.prototype.enablePentagonBokeh=function(){this._highlightsPostProcess.updateEffect("#define PENTAGON\n")},e.prototype.disablePentagonBokeh=function(){this._highlightsPostProcess.updateEffect()},e.prototype.enableNoiseBlur=function(){this._blurNoise=!0},e.prototype.disableNoiseBlur=function(){this._blurNoise=!1},e.prototype.setHighlightsGain=function(e){this._highlightsGain=e},e.prototype.setHighlightsThreshold=function(e){-1===this._highlightsGain&&(this._highlightsGain=1),this._highlightsThreshold=e},e.prototype.disableHighlights=function(){this._highlightsGain=-1},e.prototype.dispose=function(e){void 0===e&&(e=!1),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._scene.cameras),this._chromaticAberrationPostProcess=null,this._highlightsPostProcess=null,this._depthOfFieldPostProcess=null,this._grainTexture.dispose(),e&&this._scene.disableDepthRenderer()},e.prototype._createChromaticAberrationPostProcess=function(e){var t=this;this._chromaticAberrationPostProcess=new dn.PostProcess("LensChromaticAberration","chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],e,null,dn.Texture.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._chromaticAberrationPostProcess.onApply=function(e){e.setFloat("chromatic_aberration",t._chromaticAberration),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("radialIntensity",1),e.setFloat2("direction",17,17),e.setFloat2("centerPosition",.5,.5)}},e.prototype._createHighlightsPostProcess=function(e){var t=this;this._highlightsPostProcess=new dn.PostProcess("LensHighlights","lensHighlights",["gain","threshold","screen_width","screen_height"],[],e,null,dn.Texture.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,this._dofPentagon?"#define PENTAGON\n":""),this._highlightsPostProcess.onApply=function(e){e.setFloat("gain",t._highlightsGain),e.setFloat("threshold",t._highlightsThreshold),e.setTextureFromPostProcess("textureSampler",t._chromaticAberrationPostProcess),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight())}},e.prototype._createDepthOfFieldPostProcess=function(e){var t=this;this._depthOfFieldPostProcess=new dn.PostProcess("LensDepthOfField","depthOfField",["grain_amount","blur_noise","screen_width","screen_height","distortion","dof_enabled","screen_distance","aperture","darken","edge_blur","highlights","near","far"],["depthSampler","grainSampler","highlightsSampler"],e,null,dn.Texture.TRILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1),this._depthOfFieldPostProcess.onApply=function(e){e.setTexture("depthSampler",t._depthTexture),e.setTexture("grainSampler",t._grainTexture),e.setTextureFromPostProcess("textureSampler",t._highlightsPostProcess),e.setTextureFromPostProcess("highlightsSampler",t._depthOfFieldPostProcess),e.setFloat("grain_amount",t._grainAmount),e.setBool("blur_noise",t._blurNoise),e.setFloat("screen_width",t._scene.getEngine().getRenderWidth()),e.setFloat("screen_height",t._scene.getEngine().getRenderHeight()),e.setFloat("distortion",t._distortion),e.setBool("dof_enabled",-1!==t._dofDistance),e.setFloat("screen_distance",1/(.1-1/t._dofDistance)),e.setFloat("aperture",t._dofAperture),e.setFloat("darken",t._dofDarken),e.setFloat("edge_blur",t._edgeBlur),e.setBool("highlights",-1!==t._highlightsGain),t._scene.activeCamera&&(e.setFloat("near",t._scene.activeCamera.minZ),e.setFloat("far",t._scene.activeCamera.maxZ))}},e.prototype._createGrainTexture=function(){this._grainTexture=new dn.DynamicTexture("LensNoiseTexture",512,this._scene,!1,dn.Texture.BILINEAR_SAMPLINGMODE),this._grainTexture.wrapU=dn.Texture.WRAP_ADDRESSMODE,this._grainTexture.wrapV=dn.Texture.WRAP_ADDRESSMODE;for(var e,t,i,r=this._grainTexture.getContext(),n=0;n<512;n++)for(var o=0;o<512;o++)e=Math.floor(255*(t=.42,i=.58,Math.random()*(i-t)+t)),r.fillStyle="rgb("+e+", "+e+", "+e+")",r.fillRect(n,o,1,1);this._grainTexture.update(!1)},e})(dn.PostProcessRenderPipeline),dn.LensRenderingPipeline=fn,pn=$a||($a={}),_n=(function(s){function c(e,t,i,r,n){void 0===r&&(r=null);var o=s.call(this,t.getEngine(),e)||this;return o.downSampleX4PostProcess=null,o.brightPassPostProcess=null,o.blurHPostProcesses=[],o.blurVPostProcesses=[],o.textureAdderPostProcess=null,o.volumetricLightPostProcess=null,o.volumetricLightSmoothXPostProcess=null,o.volumetricLightSmoothYPostProcess=null,o.volumetricLightMergePostProces=null,o.volumetricLightFinalPostProcess=null,o.luminancePostProcess=null,o.luminanceDownSamplePostProcesses=[],o.hdrPostProcess=null,o.textureAdderFinalPostProcess=null,o.lensFlareFinalPostProcess=null,o.hdrFinalPostProcess=null,o.lensFlarePostProcess=null,o.lensFlareComposePostProcess=null,o.motionBlurPostProcess=null,o.depthOfFieldPostProcess=null,o.fxaaPostProcess=null,o.brightThreshold=1,o.blurWidth=512,o.horizontalBlur=!1,o.exposure=1,o.lensTexture=null,o.volumetricLightCoefficient=.2,o.volumetricLightPower=4,o.volumetricLightBlurScale=64,o.sourceLight=null,o.hdrMinimumLuminance=1,o.hdrDecreaseRate=.5,o.hdrIncreaseRate=.5,o.lensColorTexture=null,o.lensFlareStrength=20,o.lensFlareGhostDispersal=1.4,o.lensFlareHaloWidth=.7,o.lensFlareDistortionStrength=16,o.lensStarTexture=null,o.lensFlareDirtTexture=null,o.depthOfFieldDistance=10,o.depthOfFieldBlurWidth=64,o.motionStrength=1,o.animations=[],o._currentDepthOfFieldSource=null,o._hdrCurrentLuminance=1,o._bloomEnabled=!1,o._depthOfFieldEnabled=!1,o._vlsEnabled=!1,o._lensFlareEnabled=!1,o._hdrEnabled=!1,o._motionBlurEnabled=!1,o._fxaaEnabled=!1,o._motionBlurSamples=64,o._volumetricLightStepsCount=50,o._samples=1,o._cameras=n||[],o._scene=t,o._basePostProcess=r,o._ratio=i,o._floatTextureType=t.getEngine().getCaps().textureFloatRender?pn.Engine.TEXTURETYPE_FLOAT:pn.Engine.TEXTURETYPE_HALF_FLOAT,t.postProcessRenderPipelineManager.addPipeline(o),o._buildPipeline(),o}return T(c,s),Object.defineProperty(c.prototype,"BloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"DepthOfFieldEnabled",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"LensFlareEnabled",{get:function(){return this._lensFlareEnabled},set:function(e){this._lensFlareEnabled!==e&&(this._lensFlareEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"HDREnabled",{get:function(){return this._hdrEnabled},set:function(e){this._hdrEnabled!==e&&(this._hdrEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"VLSEnabled",{get:function(){return this._vlsEnabled},set:function(e){if(this._vlsEnabled!==e){if(e)if(!this._scene.enableGeometryBufferRenderer())return void pn.Tools.Warn("Geometry renderer is not supported, cannot create volumetric lights in Standard Rendering Pipeline");this._vlsEnabled=e,this._buildPipeline()}},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"MotionBlurEnabled",{get:function(){return this._motionBlurEnabled},set:function(e){this._motionBlurEnabled!==e&&(this._motionBlurEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"volumetricLightStepsCount",{get:function(){return this._volumetricLightStepsCount},set:function(e){this.volumetricLightPostProcess&&this.volumetricLightPostProcess.updateEffect("#define VLS\n#define NB_STEPS "+e.toFixed(1)),this._volumetricLightStepsCount=e},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"motionBlurSamples",{get:function(){return this._motionBlurSamples},set:function(e){this.motionBlurPostProcess&&this.motionBlurPostProcess.updateEffect("#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+e.toFixed(1)),this._motionBlurSamples=e},enumerable:!0,configurable:!0}),Object.defineProperty(c.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!0,configurable:!0}),c.prototype._buildPipeline=function(){var t=this,e=this._ratio,i=this._scene;this._disposePostProcesses(),this._reset(),this._basePostProcess?this.originalPostProcess=this._basePostProcess:(this.originalPostProcess=new pn.PostProcess("HDRPass","standard",[],[],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",this._floatTextureType),this.originalPostProcess.onApply=function(e){t._currentDepthOfFieldSource=t.originalPostProcess}),(this._bloomEnabled||this._vlsEnabled||this._lensFlareEnabled||this._depthOfFieldEnabled||this._motionBlurEnabled)&&this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDRPassPostProcess",function(){return t.originalPostProcess},!0)),this._currentDepthOfFieldSource=this.originalPostProcess,this._bloomEnabled&&(this._createDownSampleX4PostProcess(i,e/2),this._createBrightPassPostProcess(i,e/2),this._createBlurPostProcesses(i,e/4,1),this._createTextureAdderPostProcess(i,e),this.textureAdderFinalPostProcess=new pn.PostProcess("HDRDepthOfFieldSource","standard",[],[],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDRBaseDepthOfFieldSource",function(){return t.textureAdderFinalPostProcess},!0))),this._vlsEnabled&&(this._createVolumetricLightPostProcess(i,e),this.volumetricLightFinalPostProcess=new pn.PostProcess("HDRVLSFinal","standard",[],[],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDRVLSFinal",function(){return t.volumetricLightFinalPostProcess},!0))),this._lensFlareEnabled&&(this._createLensFlarePostProcess(i,e),this.lensFlareFinalPostProcess=new pn.PostProcess("HDRPostLensFlareDepthOfFieldSource","standard",[],[],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDRPostLensFlareDepthOfFieldSource",function(){return t.lensFlareFinalPostProcess},!0))),this._hdrEnabled&&(this._createLuminancePostProcesses(i,this._floatTextureType),this._createHdrPostProcess(i,e),this.hdrFinalPostProcess=new pn.PostProcess("HDRPostHDReDepthOfFieldSource","standard",[],[],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define PASS_POST_PROCESS",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDRPostHDReDepthOfFieldSource",function(){return t.hdrFinalPostProcess},!0))),this._depthOfFieldEnabled&&(this._createBlurPostProcesses(i,e/2,3,"depthOfFieldBlurWidth"),this._createDepthOfFieldPostProcess(i,e)),this._motionBlurEnabled&&this._createMotionBlurPostProcess(i,e),this._fxaaEnabled&&(this.fxaaPostProcess=new pn.FxaaPostProcess("fxaa",1,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDRFxaa",function(){return t.fxaaPostProcess},!0))),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),!this._enableMSAAOnFirstPostProcess(this._samples)&&1<this._samples&&pn.Tools.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")},c.prototype._createDownSampleX4PostProcess=function(e,t){var s=this,a=new Array(32);this.downSampleX4PostProcess=new pn.PostProcess("HDRDownSampleX4","standard",["dsOffsets"],[],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DOWN_SAMPLE_X4",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.downSampleX4PostProcess.onApply=function(e){for(var t=0,i=s.downSampleX4PostProcess.width,r=s.downSampleX4PostProcess.height,n=-2;n<2;n++)for(var o=-2;o<2;o++)a[t]=(n+.5)*(1/i),a[t+1]=(o+.5)*(1/r),t+=2;e.setArray2("dsOffsets",a)},this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRDownSampleX4",function(){return s.downSampleX4PostProcess},!0))},c.prototype._createBrightPassPostProcess=function(e,t){var r=this,n=new Array(8);this.brightPassPostProcess=new pn.PostProcess("HDRBrightPass","standard",["dsOffsets","brightThreshold"],[],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define BRIGHT_PASS",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.brightPassPostProcess.onApply=function(e){var t=1/r.brightPassPostProcess.width,i=1/r.brightPassPostProcess.height;n[0]=-.5*t,n[1]=.5*i,n[2]=.5*t,n[3]=.5*i,n[4]=-.5*t,n[5]=-.5*i,n[6]=.5*t,n[7]=-.5*i,e.setArray2("dsOffsets",n),e.setFloat("brightThreshold",r.brightThreshold)},this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRBrightPass",function(){return r.brightPassPostProcess},!0))},c.prototype._createBlurPostProcesses=function(e,t,i,r){var n=this;void 0===r&&(r="blurWidth");var o=e.getEngine(),s=new pn.BlurPostProcess("HDRBlurH_"+i,new pn.Vector2(1,0),this[r],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,pn.Engine.TEXTURETYPE_UNSIGNED_INT),a=new pn.BlurPostProcess("HDRBlurV_"+i,new pn.Vector2(0,1),this[r],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,pn.Engine.TEXTURETYPE_UNSIGNED_INT);s.onActivateObservable.add((function(){var e=s.width/o.getRenderWidth();s.kernel=n[r]*e})),a.onActivateObservable.add((function(){var e=a.height/o.getRenderHeight();a.kernel=n.horizontalBlur?64*e:n[r]*e})),this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRBlurH"+i,function(){return s},!0)),this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRBlurV"+i,function(){return a},!0)),this.blurHPostProcesses.push(s),this.blurVPostProcesses.push(a)},c.prototype._createTextureAdderPostProcess=function(e,t){var i=this;this.textureAdderPostProcess=new pn.PostProcess("HDRTextureAdder","standard",["exposure"],["otherSampler","lensSampler"],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define TEXTURE_ADDER",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.textureAdderPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._vlsEnabled?i._currentDepthOfFieldSource:i.originalPostProcess),e.setTexture("lensSampler",i.lensTexture),e.setFloat("exposure",i.exposure),i._currentDepthOfFieldSource=i.textureAdderFinalPostProcess},this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRTextureAdder",function(){return i.textureAdderPostProcess},!0))},c.prototype._createVolumetricLightPostProcess=function(e,t){var i=this,r=e.enableGeometryBufferRenderer();r.enablePosition=!0;var n=r.getGBuffer();this.volumetricLightPostProcess=new pn.PostProcess("HDRVLS","standard",["shadowViewProjection","cameraPosition","sunDirection","sunColor","scatteringCoefficient","scatteringPower","depthValues"],["shadowMapSampler","positionSampler"],t/8,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLS\n#define NB_STEPS "+this._volumetricLightStepsCount.toFixed(1));var o=pn.Vector2.Zero();this.volumetricLightPostProcess.onApply=function(e){if(i.sourceLight&&i.sourceLight.getShadowGenerator()&&i._scene.activeCamera){var t=i.sourceLight.getShadowGenerator();e.setTexture("shadowMapSampler",t.getShadowMap()),e.setTexture("positionSampler",n.textures[2]),e.setColor3("sunColor",i.sourceLight.diffuse),e.setVector3("sunDirection",i.sourceLight.getShadowDirection()),e.setVector3("cameraPosition",i._scene.activeCamera.globalPosition),e.setMatrix("shadowViewProjection",t.getTransformMatrix()),e.setFloat("scatteringCoefficient",i.volumetricLightCoefficient),e.setFloat("scatteringPower",i.volumetricLightPower),o.x=i.sourceLight.getDepthMinZ(i._scene.activeCamera),o.y=i.sourceLight.getDepthMaxZ(i._scene.activeCamera),e.setVector2("depthValues",o)}},this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRVLS",function(){return i.volumetricLightPostProcess},!0)),this._createBlurPostProcesses(e,t/4,0,"volumetricLightBlurScale"),this.volumetricLightMergePostProces=new pn.PostProcess("HDRVLSMerge","standard",[],["originalSampler"],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define VLSMERGE"),this.volumetricLightMergePostProces.onApply=function(e){e.setTextureFromPostProcess("originalSampler",i._bloomEnabled?i.textureAdderFinalPostProcess:i.originalPostProcess),i._currentDepthOfFieldSource=i.volumetricLightFinalPostProcess},this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRVLSMerge",function(){return i.volumetricLightMergePostProces},!0))},c.prototype._createLuminancePostProcesses=function(r,e){var a=this,t=Math.pow(3,c.LuminanceSteps);this.luminancePostProcess=new pn.PostProcess("HDRLuminance","standard",["lumOffsets"],[],{width:t,height:t},null,pn.Texture.BILINEAR_SAMPLINGMODE,r.getEngine(),!1,"#define LUMINANCE",e);var n=[];this.luminancePostProcess.onApply=function(e){var t=1/a.luminancePostProcess.width,i=1/a.luminancePostProcess.height;n[0]=-.5*t,n[1]=.5*i,n[2]=.5*t,n[3]=.5*i,n[4]=-.5*t,n[5]=-.5*i,n[6]=.5*t,n[7]=-.5*i,e.setArray2("lumOffsets",n)},this.addEffect(new pn.PostProcessRenderEffect(r.getEngine(),"HDRLuminance",function(){return a.luminancePostProcess},!0));for(var i=c.LuminanceSteps-1;0<=i;i--){t=Math.pow(3,i);var o="#define LUMINANCE_DOWN_SAMPLE\n";0===i&&(o+="#define FINAL_DOWN_SAMPLER");var s=new pn.PostProcess("HDRLuminanceDownSample"+i,"standard",["dsOffsets","halfDestPixelSize"],[],{width:t,height:t},null,pn.Texture.BILINEAR_SAMPLINGMODE,r.getEngine(),!1,o,e);this.luminanceDownSamplePostProcesses.push(s)}var l=this.luminancePostProcess;this.luminanceDownSamplePostProcesses.forEach((function(n,o){var s=new Array(18);n.onApply=function(e){if(l){for(var t=0,i=-1;i<2;i++)for(var r=-1;r<2;r++)s[t]=i/l.width,s[t+1]=r/l.height,t+=2;e.setArray2("dsOffsets",s),e.setFloat("halfDestPixelSize",.5/l.width),l=o===a.luminanceDownSamplePostProcesses.length-1?a.luminancePostProcess:n}},o===a.luminanceDownSamplePostProcesses.length-1&&(n.onAfterRender=function(e){var t=r.getEngine().readPixels(0,0,1,1),i=new pn.Vector4(1/16581375,1/65025,1/255,1);a._hdrCurrentLuminance=(t[0]*i.x+t[1]*i.y+t[2]*i.z+t[3]*i.w)/100}),a.addEffect(new pn.PostProcessRenderEffect(r.getEngine(),"HDRLuminanceDownSample"+o,function(){return n},!0))}))},c.prototype._createHdrPostProcess=function(i,e){var r=this;this.hdrPostProcess=new pn.PostProcess("HDR","standard",["averageLuminance"],["textureAdderSampler"],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,i.getEngine(),!1,"#define HDR",pn.Engine.TEXTURETYPE_UNSIGNED_INT);var n=1,o=0,s=0;this.hdrPostProcess.onApply=function(e){if(e.setTextureFromPostProcess("textureAdderSampler",r._currentDepthOfFieldSource),o+=i.getEngine().getDeltaTime(),n<0)n=r._hdrCurrentLuminance;else{var t=(s-o)/1e3;r._hdrCurrentLuminance<n+r.hdrDecreaseRate*t?n+=r.hdrDecreaseRate*t:r._hdrCurrentLuminance>n-r.hdrIncreaseRate*t?n-=r.hdrIncreaseRate*t:n=r._hdrCurrentLuminance}n=pn.Scalar.Clamp(n,r.hdrMinimumLuminance,1e20),e.setFloat("averageLuminance",n),s=o,r._currentDepthOfFieldSource=r.hdrFinalPostProcess},this.addEffect(new pn.PostProcessRenderEffect(i.getEngine(),"HDR",function(){return r.hdrPostProcess},!0))},c.prototype._createLensFlarePostProcess=function(e,t){var s=this;this.lensFlarePostProcess=new pn.PostProcess("HDRLensFlare","standard",["strength","ghostDispersal","haloWidth","resolution","distortionStrength"],["lensColorSampler"],t/2,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRLensFlare",function(){return s.lensFlarePostProcess},!0)),this._createBlurPostProcesses(e,t/4,2),this.lensFlareComposePostProcess=new pn.PostProcess("HDRLensFlareCompose","standard",["lensStarMatrix"],["otherSampler","lensDirtSampler","lensStarSampler"],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define LENS_FLARE_COMPOSE",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRLensFlareCompose",function(){return s.lensFlareComposePostProcess},!0));var i=new pn.Vector2(0,0);this.lensFlarePostProcess.onApply=function(e){e.setTextureFromPostProcess("textureSampler",s._bloomEnabled?s.blurHPostProcesses[0]:s.originalPostProcess),e.setTexture("lensColorSampler",s.lensColorTexture),e.setFloat("strength",s.lensFlareStrength),e.setFloat("ghostDispersal",s.lensFlareGhostDispersal),e.setFloat("haloWidth",s.lensFlareHaloWidth),i.x=s.lensFlarePostProcess.width,i.y=s.lensFlarePostProcess.height,e.setVector2("resolution",i),e.setFloat("distortionStrength",s.lensFlareDistortionStrength)};var a=pn.Matrix.FromValues(2,0,-1,0,0,2,-1,0,0,0,1,0,0,0,0,1),l=pn.Matrix.FromValues(.5,0,.5,0,0,.5,.5,0,0,0,1,0,0,0,0,1);this.lensFlareComposePostProcess.onApply=function(e){if(s._scene.activeCamera){e.setTextureFromPostProcess("otherSampler",s._currentDepthOfFieldSource),e.setTexture("lensDirtSampler",s.lensFlareDirtTexture),e.setTexture("lensStarSampler",s.lensStarTexture);var t=s._scene.activeCamera.getViewMatrix().getRow(0),i=s._scene.activeCamera.getViewMatrix().getRow(2),r=pn.Vector3.Dot(t.toVector3(),new pn.Vector3(1,0,0))+pn.Vector3.Dot(i.toVector3(),new pn.Vector3(0,0,1));r*=4;var n=pn.Matrix.FromValues(.5*Math.cos(r),-Math.sin(r),0,0,Math.sin(r),.5*Math.cos(r),0,0,0,0,1,0,0,0,0,1),o=l.multiply(n).multiply(a);e.setMatrix("lensStarMatrix",o),s._currentDepthOfFieldSource=s.lensFlareFinalPostProcess}}},c.prototype._createDepthOfFieldPostProcess=function(e,t){var i=this;this.depthOfFieldPostProcess=new pn.PostProcess("HDRDepthOfField","standard",["distance"],["otherSampler","depthSampler"],t,null,pn.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,"#define DEPTH_OF_FIELD",pn.Engine.TEXTURETYPE_UNSIGNED_INT),this.depthOfFieldPostProcess.onApply=function(e){e.setTextureFromPostProcess("otherSampler",i._currentDepthOfFieldSource),e.setTexture("depthSampler",i._getDepthTexture()),e.setFloat("distance",i.depthOfFieldDistance)},this.addEffect(new pn.PostProcessRenderEffect(e.getEngine(),"HDRDepthOfField",function(){return i.depthOfFieldPostProcess},!0))},c.prototype._createMotionBlurPostProcess=function(t,e){var i=this;this.motionBlurPostProcess=new pn.PostProcess("HDRMotionBlur","standard",["inverseViewProjection","prevViewProjection","screenSize","motionScale","motionStrength"],["depthSampler"],e,null,pn.Texture.BILINEAR_SAMPLINGMODE,t.getEngine(),!1,"#define MOTION_BLUR\n#define MAX_MOTION_SAMPLES "+this.motionBlurSamples.toFixed(1),pn.Engine.TEXTURETYPE_UNSIGNED_INT);var r=0,n=pn.Matrix.Identity(),o=pn.Matrix.Identity(),s=pn.Matrix.Identity(),a=pn.Vector2.Zero();this.motionBlurPostProcess.onApply=function(e){(s=t.getProjectionMatrix().multiply(t.getViewMatrix())).invertToRef(o),e.setMatrix("inverseViewProjection",o),e.setMatrix("prevViewProjection",n),n=s,a.x=i.motionBlurPostProcess.width,a.y=i.motionBlurPostProcess.height,e.setVector2("screenSize",a),r=t.getEngine().getFps()/60,e.setFloat("motionScale",r),e.setFloat("motionStrength",i.motionStrength),e.setTexture("depthSampler",i._getDepthTexture())},this.addEffect(new pn.PostProcessRenderEffect(t.getEngine(),"HDRMotionBlur",function(){return i.motionBlurPostProcess},!0))},c.prototype._getDepthTexture=function(){return this._scene.getEngine().getCaps().drawBuffersExtension?this._scene.enableGeometryBufferRenderer().getGBuffer().textures[0]:this._scene.enableDepthRenderer().getDepthMap()},c.prototype._disposePostProcesses=function(){for(var e=0;e<this._cameras.length;e++){var t=this._cameras[e];this.originalPostProcess&&this.originalPostProcess.dispose(t),this.downSampleX4PostProcess&&this.downSampleX4PostProcess.dispose(t),this.brightPassPostProcess&&this.brightPassPostProcess.dispose(t),this.textureAdderPostProcess&&this.textureAdderPostProcess.dispose(t),this.textureAdderFinalPostProcess&&this.textureAdderFinalPostProcess.dispose(t),this.volumetricLightPostProcess&&this.volumetricLightPostProcess.dispose(t),this.volumetricLightSmoothXPostProcess&&this.volumetricLightSmoothXPostProcess.dispose(t),this.volumetricLightSmoothYPostProcess&&this.volumetricLightSmoothYPostProcess.dispose(t),this.volumetricLightMergePostProces&&this.volumetricLightMergePostProces.dispose(t),this.volumetricLightFinalPostProcess&&this.volumetricLightFinalPostProcess.dispose(t),this.lensFlarePostProcess&&this.lensFlarePostProcess.dispose(t),this.lensFlareComposePostProcess&&this.lensFlareComposePostProcess.dispose(t);for(var i=0;i<this.luminanceDownSamplePostProcesses.length;i++)this.luminanceDownSamplePostProcesses[i].dispose(t);this.luminancePostProcess&&this.luminancePostProcess.dispose(t),this.hdrPostProcess&&this.hdrPostProcess.dispose(t),this.hdrFinalPostProcess&&this.hdrFinalPostProcess.dispose(t),this.depthOfFieldPostProcess&&this.depthOfFieldPostProcess.dispose(t),this.motionBlurPostProcess&&this.motionBlurPostProcess.dispose(t),this.fxaaPostProcess&&this.fxaaPostProcess.dispose(t);for(i=0;i<this.blurHPostProcesses.length;i++)this.blurHPostProcesses[i].dispose(t);for(i=0;i<this.blurVPostProcesses.length;i++)this.blurVPostProcesses[i].dispose(t)}this.originalPostProcess=null,this.downSampleX4PostProcess=null,this.brightPassPostProcess=null,this.textureAdderPostProcess=null,this.textureAdderFinalPostProcess=null,this.volumetricLightPostProcess=null,this.volumetricLightSmoothXPostProcess=null,this.volumetricLightSmoothYPostProcess=null,this.volumetricLightMergePostProces=null,this.volumetricLightFinalPostProcess=null,this.lensFlarePostProcess=null,this.lensFlareComposePostProcess=null,this.luminancePostProcess=null,this.hdrPostProcess=null,this.hdrFinalPostProcess=null,this.depthOfFieldPostProcess=null,this.motionBlurPostProcess=null,this.fxaaPostProcess=null,this.luminanceDownSamplePostProcesses=[],this.blurHPostProcesses=[],this.blurVPostProcesses=[]},c.prototype.dispose=function(){this._disposePostProcesses(),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),s.prototype.dispose.call(this)},c.prototype.serialize=function(){var e=pn.SerializationHelper.Serialize(this);return this.sourceLight&&(e.sourceLightId=this.sourceLight.id),e.customType="StandardRenderingPipeline",e},c.Parse=function(e,t,i){var r=pn.SerializationHelper.Parse((function(){return new c(e._name,t,e._ratio)}),e,t,i);return e.sourceLightId&&(r.sourceLight=t.getLightByID(e.sourceLightId)),r},c.LuminanceSteps=6,b([pn.serialize()],c.prototype,"brightThreshold",void 0),b([pn.serialize()],c.prototype,"blurWidth",void 0),b([pn.serialize()],c.prototype,"horizontalBlur",void 0),b([pn.serialize()],c.prototype,"exposure",void 0),b([pn.serializeAsTexture("lensTexture")],c.prototype,"lensTexture",void 0),b([pn.serialize()],c.prototype,"volumetricLightCoefficient",void 0),b([pn.serialize()],c.prototype,"volumetricLightPower",void 0),b([pn.serialize()],c.prototype,"volumetricLightBlurScale",void 0),b([pn.serialize()],c.prototype,"hdrMinimumLuminance",void 0),b([pn.serialize()],c.prototype,"hdrDecreaseRate",void 0),b([pn.serialize()],c.prototype,"hdrIncreaseRate",void 0),b([pn.serializeAsTexture("lensColorTexture")],c.prototype,"lensColorTexture",void 0),b([pn.serialize()],c.prototype,"lensFlareStrength",void 0),b([pn.serialize()],c.prototype,"lensFlareGhostDispersal",void 0),b([pn.serialize()],c.prototype,"lensFlareHaloWidth",void 0),b([pn.serialize()],c.prototype,"lensFlareDistortionStrength",void 0),b([pn.serializeAsTexture("lensStarTexture")],c.prototype,"lensStarTexture",void 0),b([pn.serializeAsTexture("lensFlareDirtTexture")],c.prototype,"lensFlareDirtTexture",void 0),b([pn.serialize()],c.prototype,"depthOfFieldDistance",void 0),b([pn.serialize()],c.prototype,"depthOfFieldBlurWidth",void 0),b([pn.serialize()],c.prototype,"motionStrength",void 0),b([pn.serialize()],c.prototype,"_ratio",void 0),b([pn.serialize()],c.prototype,"BloomEnabled",null),b([pn.serialize()],c.prototype,"DepthOfFieldEnabled",null),b([pn.serialize()],c.prototype,"LensFlareEnabled",null),b([pn.serialize()],c.prototype,"HDREnabled",null),b([pn.serialize()],c.prototype,"VLSEnabled",null),b([pn.serialize()],c.prototype,"MotionBlurEnabled",null),b([pn.serialize()],c.prototype,"fxaaEnabled",null),b([pn.serialize()],c.prototype,"volumetricLightStepsCount",null),b([pn.serialize()],c.prototype,"motionBlurSamples",null),b([pn.serialize()],c.prototype,"samples",null),c})(pn.PostProcessRenderPipeline),pn.StandardRenderingPipeline=_n,mn=$a||($a={}),gn=(function(c){function e(e,t,i,r,n,o,s){void 0===i&&(i=null),void 0===s&&(s=mn.Engine.TEXTURETYPE_UNSIGNED_INT);var a=c.call(this,e,"fxaa",["texelSize"],null,t,i,r||mn.Texture.BILINEAR_SAMPLINGMODE,n,o,null,s,"fxaa",void 0,!0)||this,l=a._getDefines();return a.updateEffect(l),a.onApplyObservable.add((function(e){var t=a.texelSize;e.setFloat2("texelSize",t.x,t.y)})),a}return T(e,c),e.prototype._getDefines=function(){var e=this.getEngine();if(!e)return null;var t=e.getGlInfo();return t&&t.renderer&&-1<t.renderer.toLowerCase().indexOf("mali")?"#define MALI 1\n":null},e})(mn.PostProcess),mn.FxaaPostProcess=gn,vn=$a||($a={}),yn=(function(u){function e(e,t,i,r,n,o,s,a,l,c){void 0===l&&(l=vn.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=!1);var h=u.call(this,e,"chromaticAberration",["chromatic_aberration","screen_width","screen_height","direction","radialIntensity","centerPosition"],[],r,n,o,s,a,null,l,void 0,null,c)||this;return h.aberrationAmount=30,h.radialIntensity=0,h.direction=new vn.Vector2(.707,.707),h.centerPosition=new vn.Vector2(.5,.5),h.onApplyObservable.add((function(e){e.setFloat("chromatic_aberration",h.aberrationAmount),e.setFloat("screen_width",t),e.setFloat("screen_height",i),e.setFloat("radialIntensity",h.radialIntensity),e.setFloat2("direction",h.direction.x,h.direction.y),e.setFloat2("centerPosition",h.centerPosition.x,h.centerPosition.y)})),h}return T(e,u),e})(vn.PostProcess),vn.ChromaticAberrationPostProcess=yn,bn=$a||($a={}),Tn=(function(c){function e(e,t,i,r,n,o,s,a){void 0===s&&(s=bn.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1);var l=c.call(this,e,"grain",["intensity","animatedSeed"],[],t,i,r,n,o,null,s,void 0,null,a)||this;return l.intensity=30,l.animated=!1,l.onApplyObservable.add((function(e){e.setFloat("intensity",l.intensity),e.setFloat("animatedSeed",l.animated?Math.random()+1:1)})),l}return T(e,c),e})(bn.PostProcess),bn.GrainPostProcess=Tn,En=$a||($a={}),xn=(function(c){function e(e,t,i,r,n,o,s,a){void 0===s&&(s=En.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1);var l=c.call(this,e,"sharpen",["sharpnessAmounts","screenSize"],null,t,i,r,n,o,null,s,void 0,null,a)||this;return l.colorAmount=1,l.edgeAmount=.3,l.onApply=function(e){e.setFloat2("screenSize",l.width,l.height),e.setFloat2("sharpnessAmounts",l.edgeAmount,l.colorAmount)},l}return T(e,c),e})(En.PostProcess),En.SharpenPostProcess=xn,Pn=$a||($a={}),An=(function(E){function e(e,t,i,r,n,o,s,a,l,c,h){void 0===o&&(o=Pn.Texture.BILINEAR_SAMPLINGMODE),void 0===l&&(l=Pn.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===c&&(c=""),void 0===h&&(h=!1);var u=E.call(this,e,"kernelBlur",["delta","direction","cameraMinMaxZ"],["circleOfConfusionSampler"],r,n,o,s,a,null,l,"kernelBlur",{varyingCount:0,depCount:0},!0)||this;return u.direction=t,u.blockCompilation=h,u._packedFloat=!1,u._staticDefines="",u._staticDefines=c,u.onApplyObservable.add((function(e){u._outputTexture?e.setFloat2("delta",1/u._outputTexture.width*u.direction.x,1/u._outputTexture.height*u.direction.y):e.setFloat2("delta",1/u.width*u.direction.x,1/u.height*u.direction.y)})),u.kernel=i,u}return T(e,E),Object.defineProperty(e.prototype,"kernel",{get:function(){return this._idealKernel},set:function(e){this._idealKernel!==e&&(e=Math.max(e,1),this._idealKernel=e,this._kernel=this._nearestBestKernel(e),this.blockCompilation||this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"packedFloat",{get:function(){return this._packedFloat},set:function(e){this._packedFloat!==e&&(this._packedFloat=e,this.blockCompilation||this._updateParameters())},enumerable:!0,configurable:!0}),e.prototype.updateEffect=function(e,t,i,r,n,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),this._updateParameters(n,o)},e.prototype._updateParameters=function(e,t){for(var i=this._kernel,r=(i-1)/2,n=[],o=[],s=0,a=0;a<i;a++){var l=a/(i-1),c=this._gaussianWeight(2*l-1);n[a]=a-r,s+=o[a]=c}for(a=0;a<o.length;a++)o[a]/=s;var h=[],u=[],d=[];for(a=0;a<=r;a+=2){var f=Math.min(a+1,Math.floor(r));if(a===f)d.push({o:n[a],w:o[a]});else{var p=f===r,_=o[a]+o[f]*(p?.5:1),m=n[a]+1/(1+o[a]/o[f]);0===m?(d.push({o:n[a],w:o[a]}),d.push({o:n[a+1],w:o[a+1]})):(d.push({o:m,w:_}),d.push({o:-m,w:_}))}}for(a=0;a<d.length;a++)u[a]=d[a].o,h[a]=d[a].w;n=u,o=h;var g=this.getEngine().getCaps().maxVaryingVectors,v=Math.max(g,0)-1,y=Math.min(n.length,v),b="";b+=this._staticDefines,-1!=this._staticDefines.indexOf("DOF")&&(b+="#define CENTER_WEIGHT "+this._glslFloat(o[y-1])+"\r\n",y--);for(a=0;a<y;a++)b+="#define KERNEL_OFFSET"+a+" "+this._glslFloat(n[a])+"\r\n",b+="#define KERNEL_WEIGHT"+a+" "+this._glslFloat(o[a])+"\r\n";var T=0;for(a=v;a<n.length;a++)b+="#define KERNEL_DEP_OFFSET"+T+" "+this._glslFloat(n[a])+"\r\n",b+="#define KERNEL_DEP_WEIGHT"+T+" "+this._glslFloat(o[a])+"\r\n",T++;this.packedFloat&&(b+="#define PACKEDFLOAT 1"),this.blockCompilation=!1,E.prototype.updateEffect.call(this,b,null,null,{varyingCount:y,depCount:T},e,t)},e.prototype._nearestBestKernel=function(e){for(var t=Math.round(e),i=0,r=[t,t-1,t+1,t-2,t+2];i<r.length;i++){var n=r[i];if(n%2!=0&&Math.floor(n/2)%2==0&&0<n)return Math.max(n,3)}return Math.max(t,3)},e.prototype._gaussianWeight=function(e){var t=-e*e/(1/3*2*(1/3));return 1/(Math.sqrt(2*Math.PI)*(1/3))*Math.exp(t)},e.prototype._glslFloat=function(e,t){return void 0===t&&(t=8),e.toFixed(t).replace(/0+$/,"")},e})(Pn.PostProcess),Pn.BlurPostProcess=An,Sn=$a||($a={}),Mn=(function(p){function e(e,t,i,r,n,o,s,a,l,c,h,u,d){void 0===a&&(a=null),void 0===l&&(l=Sn.Texture.BILINEAR_SAMPLINGMODE),void 0===u&&(u=Sn.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===d&&(d=!1);var f=p.call(this,e,i,r,n,o,l=Sn.Texture.BILINEAR_SAMPLINGMODE,c,h,u=Sn.Engine.TEXTURETYPE_UNSIGNED_INT,"#define DOF 1\r\n",d)||this;return f.direction=i,f.onApplyObservable.add((function(e){null!=a&&e.setTextureFromPostProcess("textureSampler",a),e.setTextureFromPostProcessOutput("circleOfConfusionSampler",s),t.activeCamera&&e.setFloat2("cameraMinMaxZ",t.activeCamera.minZ,t.activeCamera.maxZ)})),f}return T(e,p),e})(Sn.BlurPostProcess),Sn.DepthOfFieldBlurPostProcess=Mn,(function(f){var e=function(){};f.DepthOfFieldMergePostProcessOptions=e;var t=(function(d){function e(e,t,r,n,i,o,s,a,l,c,h){void 0===c&&(c=f.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=!1);var u=d.call(this,e,"depthOfFieldMerge",[],["circleOfConfusionSampler","blurStep0","blurStep1","blurStep2"],i,o,s,a,l,null,c,void 0,null,!0)||this;return u.blurSteps=n,u.onApplyObservable.add((function(i){i.setTextureFromPostProcess("textureSampler",t),i.setTextureFromPostProcessOutput("circleOfConfusionSampler",r),n.forEach((function(e,t){i.setTextureFromPostProcessOutput("blurStep"+(n.length-t-1),e)}))})),h||u.updateEffect(),u}return T(e,d),e.prototype.updateEffect=function(e,t,i,r,n,o){void 0===e&&(e=null),void 0===t&&(t=null),void 0===i&&(i=null),e||(e="",e+="#define BLUR_LEVEL "+(this.blurSteps.length-1)+"\n"),d.prototype.updateEffect.call(this,e,t,i,r,n,o)},e})(f.PostProcess);f.DepthOfFieldMergePostProcess=t})($a||($a={})),Rn=$a||($a={}),Cn=(function(h){function e(e,t,i,r,n,o,s,a,l){void 0===a&&(a=Rn.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===l&&(l=!1);var c=h.call(this,e,"circleOfConfusion",["cameraMinMaxZ","focusDistance","cocPrecalculation"],["depthSampler"],i,r,n,o,s,null,a,void 0,null,l)||this;return c.lensSize=50,c.fStop=1.4,c.focusDistance=2e3,c.focalLength=50,c._depthTexture=null,c._depthTexture=t,c.onApplyObservable.add((function(e){if(c._depthTexture){e.setTexture("depthSampler",c._depthTexture);var t=c.lensSize/c.fStop*c.focalLength/(c.focusDistance-c.focalLength);e.setFloat("focusDistance",c.focusDistance),e.setFloat("cocPrecalculation",t),e.setFloat2("cameraMinMaxZ",c._depthTexture.activeCamera.minZ,c._depthTexture.activeCamera.maxZ)}else Rn.Tools.Warn("No depth texture set on CircleOfConfusionPostProcess")})),c}return T(e,h),Object.defineProperty(e.prototype,"depthTexture",{set:function(e){this._depthTexture=e},enumerable:!0,configurable:!0}),e})(Rn.PostProcess),Rn.CircleOfConfusionPostProcess=Cn,(function(p){var _,e;(e=_=p.DepthOfFieldEffectBlurLevel||(p.DepthOfFieldEffectBlurLevel={}))[e.Low=0]="Low",e[e.Medium=1]="Medium",e[e.High=2]="High";var t=(function(f){function e(e,t,i,r,n){void 0===i&&(i=_.Low),void 0===r&&(r=0),void 0===n&&(n=!1);var o=f.call(this,e.getEngine(),"depth of field",(function(){return o._effects}),!0)||this;o._effects=[],o._circleOfConfusion=new p.CircleOfConfusionPostProcess("circleOfConfusion",t,1,null,p.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,n),o._depthOfFieldBlurY=[],o._depthOfFieldBlurX=[];var s=1,a=15;switch(i){case _.High:s=3,a=51;break;case _.Medium:s=2,a=31;break;default:a=15,s=1}for(var l=a/Math.pow(2,s-1),c=1,h=0;h<s;h++){var u=new p.DepthOfFieldBlurPostProcess("verticle blur",e,new p.Vector2(0,1),l,c,null,o._circleOfConfusion,0==h?o._circleOfConfusion:null,p.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,n);u.autoClear=!1,c=.75/Math.pow(2,h);var d=new p.DepthOfFieldBlurPostProcess("horizontal blur",e,new p.Vector2(1,0),l,c,null,o._circleOfConfusion,null,p.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,n);d.autoClear=!1,o._depthOfFieldBlurY.push(u),o._depthOfFieldBlurX.push(d)}o._effects=[o._circleOfConfusion];for(h=0;h<o._depthOfFieldBlurX.length;h++)o._effects.push(o._depthOfFieldBlurY[h]),o._effects.push(o._depthOfFieldBlurX[h]);return o._dofMerge=new p.DepthOfFieldMergePostProcess("dofMerge",o._circleOfConfusion,o._circleOfConfusion,o._depthOfFieldBlurX,c,null,p.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,r,n),o._dofMerge.autoClear=!1,o._effects.push(o._dofMerge),o}return T(e,f),Object.defineProperty(e.prototype,"focalLength",{get:function(){return this._circleOfConfusion.focalLength},set:function(e){this._circleOfConfusion.focalLength=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fStop",{get:function(){return this._circleOfConfusion.fStop},set:function(e){this._circleOfConfusion.fStop=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"focusDistance",{get:function(){return this._circleOfConfusion.focusDistance},set:function(e){this._circleOfConfusion.focusDistance=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"lensSize",{get:function(){return this._circleOfConfusion.lensSize},set:function(e){this._circleOfConfusion.lensSize=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"depthTexture",{set:function(e){this._circleOfConfusion.depthTexture=e},enumerable:!0,configurable:!0}),e.prototype.disposeEffects=function(e){for(var t=0;t<this._effects.length;t++)this._effects[t].dispose(e)},e.prototype._updateEffects=function(){for(var e=0;e<this._effects.length;e++)this._effects[e].updateEffect()},e.prototype._isReady=function(){for(var e=0;e<this._effects.length;e++)if(!this._effects[e].isReady())return!1;return!0},e})(p.PostProcessRenderEffect);p.DepthOfFieldEffect=t})($a||($a={})),On=$a||($a={}),Dn=(function(d){function e(e,t,i,r,n,o,s,a,l,c,h){void 0===c&&(c=On.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===h&&(h=!1);var u=d.call(this,e,"bloomMerge",["bloomWeight"],["circleOfConfusionSampler","blurStep0","blurStep1","blurStep2","bloomBlur"],n,o,s,a,l,null,c,void 0,null,!0)||this;return u.weight=r,u.onApplyObservable.add((function(e){e.setTextureFromPostProcess("textureSampler",t),e.setTextureFromPostProcessOutput("bloomBlur",i),e.setFloat("bloomWeight",u.weight)})),h||u.updateEffect(),u}return T(e,d),e})(On.PostProcess),On.BloomMergePostProcess=Dn,In=$a||($a={}),wn=(function(c){function e(e,t,i,r,n,o,s,a){void 0===s&&(s=In.Engine.TEXTURETYPE_UNSIGNED_INT),void 0===a&&(a=!1);var l=c.call(this,e,"extractHighlights",["threshold","exposure"],null,t,i,r,n,o,null,s,void 0,null,a)||this;return l.threshold=.9,l._exposure=1,l._inputPostProcess=null,l.onApplyObservable.add((function(e){l._inputPostProcess&&e.setTextureFromPostProcess("textureSampler",l._inputPostProcess),e.setFloat("threshold",Math.pow(l.threshold,In.ToGammaSpace)),e.setFloat("exposure",l._exposure)})),l}return T(e,c),e})(In.PostProcess),In.ExtractHighlightsPostProcess=wn,Ln=$a||($a={}),Fn=(function(a){function e(e,t,i,r,n,o){void 0===n&&(n=0),void 0===o&&(o=!1);var s=a.call(this,e.getEngine(),"bloom",(function(){return s._effects}),!0)||this;return s.bloomScale=t,s._effects=[],s._downscale=new Ln.ExtractHighlightsPostProcess("highlights",1,null,Ln.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,o),s._blurX=new Ln.BlurPostProcess("horizontal blur",new Ln.Vector2(1,0),10,t,null,Ln.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,void 0,o),s._blurX.alwaysForcePOT=!0,s._blurX.autoClear=!1,s._blurY=new Ln.BlurPostProcess("vertical blur",new Ln.Vector2(0,1),10,t,null,Ln.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,void 0,o),s._blurY.alwaysForcePOT=!0,s._blurY.autoClear=!1,s.kernel=r,s._effects=[s._downscale,s._blurX,s._blurY],s._merge=new Ln.BloomMergePostProcess("bloomMerge",s._downscale,s._blurY,i,t,null,Ln.Texture.BILINEAR_SAMPLINGMODE,e.getEngine(),!1,n,o),s._merge.autoClear=!1,s._effects.push(s._merge),s}return T(e,a),Object.defineProperty(e.prototype,"threshold",{get:function(){return this._downscale.threshold},set:function(e){this._downscale.threshold=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"weight",{get:function(){return this._merge.weight},set:function(e){this._merge.weight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"kernel",{get:function(){return this._blurX.kernel/this.bloomScale},set:function(e){this._blurX.kernel=e*this.bloomScale,this._blurY.kernel=e*this.bloomScale},enumerable:!0,configurable:!0}),e.prototype.disposeEffects=function(e){for(var t=0;t<this._effects.length;t++)this._effects[t].dispose(e)},e.prototype._updateEffects=function(){for(var e=0;e<this._effects.length;e++)this._effects[e].updateEffect()},e.prototype._isReady=function(){for(var e=0;e<this._effects.length;e++)if(!this._effects[e].isReady())return!1;return!0},e})(Ln.PostProcessRenderEffect),Ln.BloomEffect=Fn,Bn=$a||($a={}),Nn=(function(l){function r(e,t,i,r,n){void 0===e&&(e=""),void 0===t&&(t=!0),void 0===i&&(i=Bn.Engine.LastCreatedScene),void 0===n&&(n=!0);var o=l.call(this,i.getEngine(),e)||this;o._camerasToBeAttached=[],o.SharpenPostProcessId="SharpenPostProcessEffect",o.ImageProcessingPostProcessId="ImageProcessingPostProcessEffect",o.FxaaPostProcessId="FxaaPostProcessEffect",o.ChromaticAberrationPostProcessId="ChromaticAberrationPostProcessEffect",o.GrainPostProcessId="GrainPostProcessEffect",o._glowLayer=null,o.animations=[],o._imageProcessingConfigurationObserver=null,o._sharpenEnabled=!1,o._bloomEnabled=!1,o._depthOfFieldEnabled=!1,o._depthOfFieldBlurLevel=Bn.DepthOfFieldEffectBlurLevel.Low,o._fxaaEnabled=!1,o._imageProcessingEnabled=!0,o._bloomScale=.5,o._chromaticAberrationEnabled=!1,o._grainEnabled=!1,o._buildAllowed=!0,o._resizeObserver=null,o._hardwareScaleLevel=1,o._bloomKernel=64,o._bloomWeight=.15,o._bloomThreshold=.9,o._samples=1,o._hasCleared=!1,o._prevPostProcess=null,o._prevPrevPostProcess=null,o._depthOfFieldSceneObserver=null,o._cameras=r||i.cameras,o._cameras=o._cameras.slice(),o._camerasToBeAttached=o._cameras.slice(),o._buildAllowed=n,o._scene=i;var s=o._scene.getEngine().getCaps();o._hdr=t&&(s.textureHalfFloatRender||s.textureFloatRender),o._hdr?s.textureHalfFloatRender?o._defaultPipelineTextureType=Bn.Engine.TEXTURETYPE_HALF_FLOAT:s.textureFloatRender&&(o._defaultPipelineTextureType=Bn.Engine.TEXTURETYPE_FLOAT):o._defaultPipelineTextureType=Bn.Engine.TEXTURETYPE_UNSIGNED_INT,i.postProcessRenderPipelineManager.addPipeline(o);var a=o._scene.getEngine();return o.sharpen=new Bn.SharpenPostProcess("sharpen",1,null,Bn.Texture.BILINEAR_SAMPLINGMODE,a,!1,o._defaultPipelineTextureType,!0),o._sharpenEffect=new Bn.PostProcessRenderEffect(a,o.SharpenPostProcessId,function(){return o.sharpen},!0),o.depthOfField=new Bn.DepthOfFieldEffect(o._scene,null,o._depthOfFieldBlurLevel,o._defaultPipelineTextureType,!0),o.bloom=new Bn.BloomEffect(o._scene,o._bloomScale,o._bloomWeight,o.bloomKernel,o._defaultPipelineTextureType,!0),o.chromaticAberration=new Bn.ChromaticAberrationPostProcess("ChromaticAberration",a.getRenderWidth(),a.getRenderHeight(),1,null,Bn.Texture.BILINEAR_SAMPLINGMODE,a,!1,o._defaultPipelineTextureType,!0),o._chromaticAberrationEffect=new Bn.PostProcessRenderEffect(a,o.ChromaticAberrationPostProcessId,function(){return o.chromaticAberration},!0),o.grain=new Bn.GrainPostProcess("Grain",1,null,Bn.Texture.BILINEAR_SAMPLINGMODE,a,!1,o._defaultPipelineTextureType,!0),o._grainEffect=new Bn.PostProcessRenderEffect(a,o.GrainPostProcessId,function(){return o.grain},!0),o._resizeObserver=a.onResizeObservable.add((function(){o._hardwareScaleLevel=a.getHardwareScalingLevel(),o.bloomKernel=o.bloomKernel})),o._imageProcessingConfigurationObserver=o._scene.imageProcessingConfiguration.onUpdateParameters.add((function(){o.bloom._downscale._exposure=o._scene.imageProcessingConfiguration.exposure})),o._buildPipeline(),o}return T(r,l),Object.defineProperty(r.prototype,"sharpenEnabled",{get:function(){return this._sharpenEnabled},set:function(e){this._sharpenEnabled!==e&&(this._sharpenEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"bloomKernel",{get:function(){return this._bloomKernel},set:function(e){this._bloomKernel=e,this.bloom.kernel=e/this._hardwareScaleLevel},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"bloomWeight",{get:function(){return this._bloomWeight},set:function(e){this._bloomWeight!==e&&(this.bloom.weight=e,this._bloomWeight=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"bloomThreshold",{get:function(){return this._bloomThreshold},set:function(e){this._bloomThreshold!==e&&(this.bloom.threshold=e,this._bloomThreshold=e)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"bloomScale",{get:function(){return this._bloomScale},set:function(e){this._bloomScale!==e&&(this._bloomScale=e,this._rebuildBloom(),this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"bloomEnabled",{get:function(){return this._bloomEnabled},set:function(e){this._bloomEnabled!==e&&(this._bloomEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),r.prototype._rebuildBloom=function(){var e=this.bloom;this.bloom=new Bn.BloomEffect(this._scene,this.bloomScale,this._bloomWeight,this.bloomKernel,this._defaultPipelineTextureType,!1),this.bloom.threshold=e.threshold;for(var t=0;t<this._cameras.length;t++)e.disposeEffects(this._cameras[t])},Object.defineProperty(r.prototype,"depthOfFieldEnabled",{get:function(){return this._depthOfFieldEnabled},set:function(e){this._depthOfFieldEnabled!==e&&(this._depthOfFieldEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"depthOfFieldBlurLevel",{get:function(){return this._depthOfFieldBlurLevel},set:function(e){if(this._depthOfFieldBlurLevel!==e){this._depthOfFieldBlurLevel=e;var t=this.depthOfField;this.depthOfField=new Bn.DepthOfFieldEffect(this._scene,null,this._depthOfFieldBlurLevel,this._defaultPipelineTextureType,!1),this.depthOfField.focalLength=t.focalLength,this.depthOfField.focusDistance=t.focusDistance,this.depthOfField.fStop=t.fStop,this.depthOfField.lensSize=t.lensSize;for(var i=0;i<this._cameras.length;i++)t.disposeEffects(this._cameras[i]);this._buildPipeline()}},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"fxaaEnabled",{get:function(){return this._fxaaEnabled},set:function(e){this._fxaaEnabled!==e&&(this._fxaaEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"samples",{get:function(){return this._samples},set:function(e){this._samples!==e&&(this._samples=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"imageProcessingEnabled",{get:function(){return this._imageProcessingEnabled},set:function(e){this._imageProcessingEnabled!==e&&(this._imageProcessingEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"glowLayerEnabled",{get:function(){return null==this._glowLayer},set:function(e){e&&!this._glowLayer?this._glowLayer=new Bn.GlowLayer("",this._scene):!e&&this._glowLayer&&(this._glowLayer.dispose(),this._glowLayer=null)},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"chromaticAberrationEnabled",{get:function(){return this._chromaticAberrationEnabled},set:function(e){this._chromaticAberrationEnabled!==e&&(this._chromaticAberrationEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"grainEnabled",{get:function(){return this._grainEnabled},set:function(e){this._grainEnabled!==e&&(this._grainEnabled=e,this._buildPipeline())},enumerable:!0,configurable:!0}),r.prototype.prepare=function(){var e=this._buildAllowed;this._buildAllowed=!0,this._buildPipeline(),this._buildAllowed=e},r.prototype._setAutoClearAndTextureSharing=function(e,t){void 0===t&&(t=!1),this._hasCleared?e.autoClear=!1:(e.autoClear=!0,this._scene.autoClear=!1,this._hasCleared=!0),t||(this._prevPrevPostProcess?e.shareOutputWith(this._prevPrevPostProcess):e.useOwnOutput(),this._prevPostProcess&&(this._prevPrevPostProcess=this._prevPostProcess),this._prevPostProcess=e)},r.prototype._buildPipeline=function(){var t=this;if(this._buildAllowed){this._scene.autoClear=!0;var e=this._scene.getEngine();if(this._disposePostProcesses(),null!==this._cameras&&(this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._cameras=this._camerasToBeAttached.slice()),this._reset(),this._prevPostProcess=null,this._prevPrevPostProcess=null,this._hasCleared=!1,this.depthOfFieldEnabled){if(1<this._cameras.length){for(var i=0,r=this._cameras;i<r.length;i++){var n=r[i];(o=this._scene.enableDepthRenderer(n)).useOnlyInActiveCamera=!0}this._depthOfFieldSceneObserver=this._scene.onAfterRenderTargetsRenderObservable.add((function(e){-1<t._cameras.indexOf(e.activeCamera)&&(t.depthOfField.depthTexture=e.enableDepthRenderer(e.activeCamera).getDepthMap())}))}else{this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);var o=this._scene.enableDepthRenderer(this._cameras[0]);this.depthOfField.depthTexture=o.getDepthMap()}this.depthOfField._isReady()||this.depthOfField._updateEffects(),this.addEffect(this.depthOfField),this._setAutoClearAndTextureSharing(this.depthOfField._effects[0],!0)}else this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver);this.bloomEnabled&&(this.bloom._isReady()||this.bloom._updateEffects(),this.addEffect(this.bloom),this._setAutoClearAndTextureSharing(this.bloom._effects[0],!0)),this._imageProcessingEnabled&&(this.imageProcessing=new Bn.ImageProcessingPostProcess("imageProcessing",1,null,Bn.Texture.BILINEAR_SAMPLINGMODE,e,!1,this._defaultPipelineTextureType),this._hdr?(this.addEffect(new Bn.PostProcessRenderEffect(e,this.ImageProcessingPostProcessId,function(){return t.imageProcessing},!0)),this._setAutoClearAndTextureSharing(this.imageProcessing)):this._scene.imageProcessingConfiguration.applyByPostProcess=!1),this.sharpenEnabled&&(this.sharpen.isReady()||this.sharpen.updateEffect(),this.addEffect(this._sharpenEffect),this._setAutoClearAndTextureSharing(this.sharpen)),this.grainEnabled&&(this.grain.isReady()||this.grain.updateEffect(),this.addEffect(this._grainEffect),this._setAutoClearAndTextureSharing(this.grain)),this.chromaticAberrationEnabled&&(this.chromaticAberration.isReady()||this.chromaticAberration.updateEffect(),this.addEffect(this._chromaticAberrationEffect),this._setAutoClearAndTextureSharing(this.chromaticAberration)),this.fxaaEnabled&&(this.fxaa=new Bn.FxaaPostProcess("fxaa",1,null,Bn.Texture.BILINEAR_SAMPLINGMODE,e,!1,this._defaultPipelineTextureType),this.addEffect(new Bn.PostProcessRenderEffect(e,this.FxaaPostProcessId,function(){return t.fxaa},!0)),this._setAutoClearAndTextureSharing(this.fxaa,!0)),null!==this._cameras&&this._scene.postProcessRenderPipelineManager.attachCamerasToRenderPipeline(this._name,this._cameras),!this._enableMSAAOnFirstPostProcess(this.samples)&&1<this.samples&&Bn.Tools.Warn("MSAA failed to enable, MSAA is only supported in browsers that support webGL >= 2.0")}},r.prototype._disposePostProcesses=function(e){void 0===e&&(e=!1);for(var t=0;t<this._cameras.length;t++){var i=this._cameras[t];this.imageProcessing&&this.imageProcessing.dispose(i),this.fxaa&&this.fxaa.dispose(i),e&&(this.sharpen&&this.sharpen.dispose(i),this.depthOfField&&(this._scene.onAfterRenderTargetsRenderObservable.remove(this._depthOfFieldSceneObserver),this.depthOfField.disposeEffects(i)),this.bloom&&this.bloom.disposeEffects(i),this.chromaticAberration&&this.chromaticAberration.dispose(i),this.grain&&this.grain.dispose(i),this._glowLayer&&this._glowLayer.dispose())}this.imageProcessing=null,this.fxaa=null,e&&(this.sharpen=null,this._sharpenEffect=null,this.depthOfField=null,this.bloom=null,this.chromaticAberration=null,this._chromaticAberrationEffect=null,this.grain=null,this._grainEffect=null,this._glowLayer=null)},r.prototype.addCamera=function(e){this._camerasToBeAttached.push(e),this._buildPipeline()},r.prototype.removeCamera=function(e){var t=this._camerasToBeAttached.indexOf(e);this._camerasToBeAttached.splice(t,1),this._buildPipeline()},r.prototype.dispose=function(){this._disposePostProcesses(!0),this._scene.postProcessRenderPipelineManager.detachCamerasFromRenderPipeline(this._name,this._cameras),this._scene.autoClear=!0,this._resizeObserver&&(this._scene.getEngine().onResizeObservable.remove(this._resizeObserver),this._resizeObserver=null),this._scene.imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingConfigurationObserver),l.prototype.dispose.call(this)},r.prototype.serialize=function(){var e=Bn.SerializationHelper.Serialize(this);return e.customType="DefaultRenderingPipeline",e},r.Parse=function(e,t,i){return Bn.SerializationHelper.Parse((function(){return new r(e._name,e._name._hdr,t)}),e,t,i)},b([Bn.serialize()],r.prototype,"sharpenEnabled",null),b([Bn.serialize()],r.prototype,"bloomKernel",null),b([Bn.serialize()],r.prototype,"_bloomWeight",void 0),b([Bn.serialize()],r.prototype,"_bloomThreshold",void 0),b([Bn.serialize()],r.prototype,"_hdr",void 0),b([Bn.serialize()],r.prototype,"bloomWeight",null),b([Bn.serialize()],r.prototype,"bloomThreshold",null),b([Bn.serialize()],r.prototype,"bloomScale",null),b([Bn.serialize()],r.prototype,"bloomEnabled",null),b([Bn.serialize()],r.prototype,"depthOfFieldEnabled",null),b([Bn.serialize()],r.prototype,"depthOfFieldBlurLevel",null),b([Bn.serialize()],r.prototype,"fxaaEnabled",null),b([Bn.serialize()],r.prototype,"samples",null),b([Bn.serialize()],r.prototype,"imageProcessingEnabled",null),b([Bn.serialize()],r.prototype,"glowLayerEnabled",null),b([Bn.serialize()],r.prototype,"chromaticAberrationEnabled",null),b([Bn.serialize()],r.prototype,"grainEnabled",null),r})(Bn.PostProcessRenderPipeline),Bn.DefaultRenderingPipeline=Nn,(function(c){var e=(function(t){function e(){var e=t.call(this)||this;return e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.rebuild(),e}return T(e,t),e})(c.MaterialDefines);c.ImageProcessingConfigurationDefines=e;var t=(function(){function i(){this.colorCurves=new c.ColorCurves,this._colorCurvesEnabled=!1,this._colorGradingEnabled=!1,this._colorGradingWithGreenDepth=!0,this._colorGradingBGR=!0,this._exposure=1,this._toneMappingEnabled=!1,this._toneMappingType=i.TONEMAPPING_STANDARD,this._contrast=1,this.vignetteStretch=0,this.vignetteCentreX=0,this.vignetteCentreY=0,this.vignetteWeight=1.5,this.vignetteColor=new c.Color4(0,0,0,0),this.vignetteCameraFov=.5,this._vignetteBlendMode=i.VIGNETTEMODE_MULTIPLY,this._vignetteEnabled=!1,this._applyByPostProcess=!1,this._isEnabled=!0,this.onUpdateParameters=new c.Observable}return Object.defineProperty(i.prototype,"colorCurvesEnabled",{get:function(){return this._colorCurvesEnabled},set:function(e){this._colorCurvesEnabled!==e&&(this._colorCurvesEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"colorGradingTexture",{get:function(){return this._colorGradingTexture},set:function(e){this._colorGradingTexture!==e&&(this._colorGradingTexture=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"colorGradingEnabled",{get:function(){return this._colorGradingEnabled},set:function(e){this._colorGradingEnabled!==e&&(this._colorGradingEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"colorGradingWithGreenDepth",{get:function(){return this._colorGradingWithGreenDepth},set:function(e){this._colorGradingWithGreenDepth!==e&&(this._colorGradingWithGreenDepth=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"colorGradingBGR",{get:function(){return this._colorGradingBGR},set:function(e){this._colorGradingBGR!==e&&(this._colorGradingBGR=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"exposure",{get:function(){return this._exposure},set:function(e){this._exposure!==e&&(this._exposure=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"toneMappingEnabled",{get:function(){return this._toneMappingEnabled},set:function(e){this._toneMappingEnabled!==e&&(this._toneMappingEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"toneMappingType",{get:function(){return this._toneMappingType},set:function(e){this._toneMappingType!==e&&(this._toneMappingType=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"contrast",{get:function(){return this._contrast},set:function(e){this._contrast!==e&&(this._contrast=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"vignetteBlendMode",{get:function(){return this._vignetteBlendMode},set:function(e){this._vignetteBlendMode!==e&&(this._vignetteBlendMode=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"vignetteEnabled",{get:function(){return this._vignetteEnabled},set:function(e){this._vignetteEnabled!==e&&(this._vignetteEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"applyByPostProcess",{get:function(){return this._applyByPostProcess},set:function(e){this._applyByPostProcess!==e&&(this._applyByPostProcess=e,this._updateParameters())},enumerable:!0,configurable:!0}),Object.defineProperty(i.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled!==e&&(this._isEnabled=e,this._updateParameters())},enumerable:!0,configurable:!0}),i.prototype._updateParameters=function(){this.onUpdateParameters.notifyObservers(this)},i.prototype.getClassName=function(){return"ImageProcessingConfiguration"},i.PrepareUniforms=function(e,t){t.EXPOSURE&&e.push("exposureLinear"),t.CONTRAST&&e.push("contrast"),t.COLORGRADING&&e.push("colorTransformSettings"),t.VIGNETTE&&(e.push("vInverseScreenSize"),e.push("vignetteSettings1"),e.push("vignetteSettings2")),t.COLORCURVES&&c.ColorCurves.PrepareUniforms(e)},i.PrepareSamplers=function(e,t){t.COLORGRADING&&e.push("txColorTransform")},i.prototype.prepareDefines=function(e,t){if(void 0===t&&(t=!1),t!==this.applyByPostProcess||!this._isEnabled)return e.VIGNETTE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.EXPOSURE=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.IMAGEPROCESSING=!1,void(e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess&&this._isEnabled);switch(e.VIGNETTE=this.vignetteEnabled,e.VIGNETTEBLENDMODEMULTIPLY=this.vignetteBlendMode===i._VIGNETTEMODE_MULTIPLY,e.VIGNETTEBLENDMODEOPAQUE=!e.VIGNETTEBLENDMODEMULTIPLY,e.TONEMAPPING=this.toneMappingEnabled,this._toneMappingType){case i.TONEMAPPING_ACES:e.TONEMAPPING_ACES=!0}e.CONTRAST=1!==this.contrast,e.EXPOSURE=1!==this.exposure,e.COLORCURVES=this.colorCurvesEnabled&&!!this.colorCurves,e.COLORGRADING=this.colorGradingEnabled&&!!this.colorGradingTexture,e.COLORGRADING?e.COLORGRADING3D=this.colorGradingTexture.is3D:e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=this.colorGradingWithGreenDepth,e.SAMPLER3DBGRMAP=this.colorGradingBGR,e.IMAGEPROCESSINGPOSTPROCESS=this.applyByPostProcess,e.IMAGEPROCESSING=e.VIGNETTE||e.TONEMAPPING||e.CONTRAST||e.EXPOSURE||e.COLORCURVES||e.COLORGRADING},i.prototype.isReady=function(){return!this.colorGradingEnabled||!this.colorGradingTexture||this.colorGradingTexture.isReady()},i.prototype.bind=function(e,t){if(void 0===t&&(t=1),this._colorCurvesEnabled&&this.colorCurves&&c.ColorCurves.Bind(this.colorCurves,e),this._vignetteEnabled){var i=1/e.getEngine().getRenderWidth(),r=1/e.getEngine().getRenderHeight();e.setFloat2("vInverseScreenSize",i,r);var n=Math.tan(.5*this.vignetteCameraFov),o=n*t,s=Math.sqrt(o*n);o=c.Tools.Mix(o,s,this.vignetteStretch),n=c.Tools.Mix(n,s,this.vignetteStretch),e.setFloat4("vignetteSettings1",o,n,-o*this.vignetteCentreX,-n*this.vignetteCentreY);var a=-2*this.vignetteWeight;e.setFloat4("vignetteSettings2",this.vignetteColor.r,this.vignetteColor.g,this.vignetteColor.b,a)}if(e.setFloat("exposureLinear",this.exposure),e.setFloat("contrast",this.contrast),this.colorGradingTexture){e.setTexture("txColorTransform",this.colorGradingTexture);var l=this.colorGradingTexture.getSize().height;e.setFloat4("colorTransformSettings",(l-1)/l,.5/l,l,this.colorGradingTexture.level)}},i.prototype.clone=function(){return c.SerializationHelper.Clone((function(){return new i}),this)},i.prototype.serialize=function(){return c.SerializationHelper.Serialize(this)},i.Parse=function(e){return c.SerializationHelper.Parse((function(){return new i}),e,null,null)},Object.defineProperty(i,"VIGNETTEMODE_MULTIPLY",{get:function(){return this._VIGNETTEMODE_MULTIPLY},enumerable:!0,configurable:!0}),Object.defineProperty(i,"VIGNETTEMODE_OPAQUE",{get:function(){return this._VIGNETTEMODE_OPAQUE},enumerable:!0,configurable:!0}),i.TONEMAPPING_STANDARD=0,i.TONEMAPPING_ACES=1,i._VIGNETTEMODE_MULTIPLY=0,i._VIGNETTEMODE_OPAQUE=1,b([c.serializeAsColorCurves()],i.prototype,"colorCurves",void 0),b([c.serialize()],i.prototype,"_colorCurvesEnabled",void 0),b([c.serializeAsTexture("colorGradingTexture")],i.prototype,"_colorGradingTexture",void 0),b([c.serialize()],i.prototype,"_colorGradingEnabled",void 0),b([c.serialize()],i.prototype,"_colorGradingWithGreenDepth",void 0),b([c.serialize()],i.prototype,"_colorGradingBGR",void 0),b([c.serialize()],i.prototype,"_exposure",void 0),b([c.serialize()],i.prototype,"_toneMappingEnabled",void 0),b([c.serialize()],i.prototype,"_toneMappingType",void 0),b([c.serialize()],i.prototype,"_contrast",void 0),b([c.serialize()],i.prototype,"vignetteStretch",void 0),b([c.serialize()],i.prototype,"vignetteCentreX",void 0),b([c.serialize()],i.prototype,"vignetteCentreY",void 0),b([c.serialize()],i.prototype,"vignetteWeight",void 0),b([c.serializeAsColor4()],i.prototype,"vignetteColor",void 0),b([c.serialize()],i.prototype,"vignetteCameraFov",void 0),b([c.serialize()],i.prototype,"_vignetteBlendMode",void 0),b([c.serialize()],i.prototype,"_vignetteEnabled",void 0),b([c.serialize()],i.prototype,"_applyByPostProcess",void 0),b([c.serialize()],i.prototype,"_isEnabled",void 0),i})();c.ImageProcessingConfiguration=t})($a||($a={})),Vn=$a||($a={}),Un=(function(r){function y(e,t){var i=r.call(this,t)||this;return e&&(i._engine=t.getEngine(),i._textureMatrix=Vn.Matrix.Identity(),i.name=e,i.url=e,i.hasAlpha=!1,i.isCube=!1,i.is3D=1<i._engine.webGLVersion,i.wrapU=Vn.Texture.CLAMP_ADDRESSMODE,i.wrapV=Vn.Texture.CLAMP_ADDRESSMODE,i.wrapR=Vn.Texture.CLAMP_ADDRESSMODE,i.anisotropicFilteringLevel=1,i._texture=i._getFromCache(e,!0),i._texture||(t.useDelayedTextureLoading?i.delayLoadState=Vn.Engine.DELAYLOADSTATE_NOTLOADED:i.loadTexture())),i}return T(y,r),y.prototype.getTextureMatrix=function(){return this._textureMatrix},y.prototype.load3dlTexture=function(){var g,v=this._engine;g=1===v.webGLVersion?v.createRawTexture(null,1,1,Vn.Engine.TEXTUREFORMAT_RGBA,!1,!1,Vn.Texture.BILINEAR_SAMPLINGMODE):v.createRawTexture3D(null,1,1,1,Vn.Engine.TEXTUREFORMAT_RGBA,!1,!1,Vn.Texture.BILINEAR_SAMPLINGMODE),this._texture=g;var e=function(e){if("string"==typeof e){for(var t,i=null,r=null,n=e.split("\n"),o=0,s=0,a=0,l=0,c=0,h=0;h<n.length;h++)if(t=n[h],y._noneEmptyLineRegex.test(t)&&0!==t.indexOf("#")){var u=t.split(" ");if(0!==o){if(0!=o){var d=Math.max(parseInt(u[0]),0),f=Math.max(parseInt(u[1]),0),p=Math.max(parseInt(u[2]),0);c=Math.max(d,c),c=Math.max(f,c),c=Math.max(p,c);var _=4*(s+l*o+a*o*o);r&&(r[_+0]=d,r[_+1]=f,r[_+2]=p),++a%o==0&&++l%o==(a=0)&&(s++,l=0)}}else o=u.length,i=new Uint8Array(o*o*o*4),r=new Float32Array(o*o*o*4)}if(r&&i)for(h=0;h<r.length;h++)if(0<h&&(h+1)%4==0)i[h]=255;else{var m=r[h];i[h]=m/c*255}g.is3D?(g.updateSize(o,o,o),v.updateRawTexture3D(g,i,Vn.Engine.TEXTUREFORMAT_RGBA,!1)):(g.updateSize(o*o,o),v.updateRawTexture(g,i,Vn.Engine.TEXTUREFORMAT_RGBA,!1))}},t=this.getScene();return t?t._loadFile(this.url,e):this._engine._loadFile(this.url,e),this._texture},y.prototype.loadTexture=function(){this.url&&this.url.toLocaleLowerCase().indexOf(".3dl")==this.url.length-4&&this.load3dlTexture()},y.prototype.clone=function(){var e=new y(this.url,this.getScene());return e.level=this.level,e},y.prototype.delayLoad=function(){this.delayLoadState===Vn.Engine.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=Vn.Engine.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,!0),this._texture||this.loadTexture())},y.Parse=function(e,t,i){var r=null;return e.name&&!e.isRenderTarget&&((r=new y(e.name,t)).name=e.name,r.level=e.level),r},y.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.level=this.level,e.customType="BABYLON.ColorGradingTexture",e},y._noneEmptyLineRegex=/\S+/,y})(Vn.BaseTexture),Vn.ColorGradingTexture=Un,zn=$a||($a={}),Gn=(function(){function d(){this._dirty=!0,this._tempColor=new zn.Color4(0,0,0,0),this._globalCurve=new zn.Color4(0,0,0,0),this._highlightsCurve=new zn.Color4(0,0,0,0),this._midtonesCurve=new zn.Color4(0,0,0,0),this._shadowsCurve=new zn.Color4(0,0,0,0),this._positiveCurve=new zn.Color4(0,0,0,0),this._negativeCurve=new zn.Color4(0,0,0,0),this._globalHue=30,this._globalDensity=0,this._globalSaturation=0,this._globalExposure=0,this._highlightsHue=30,this._highlightsDensity=0,this._highlightsSaturation=0,this._highlightsExposure=0,this._midtonesHue=30,this._midtonesDensity=0,this._midtonesSaturation=0,this._midtonesExposure=0,this._shadowsHue=30,this._shadowsDensity=0,this._shadowsSaturation=0,this._shadowsExposure=0}return Object.defineProperty(d.prototype,"globalHue",{get:function(){return this._globalHue},set:function(e){this._globalHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"globalDensity",{get:function(){return this._globalDensity},set:function(e){this._globalDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"globalSaturation",{get:function(){return this._globalSaturation},set:function(e){this._globalSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"globalExposure",{get:function(){return this._globalExposure},set:function(e){this._globalExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"highlightsHue",{get:function(){return this._highlightsHue},set:function(e){this._highlightsHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"highlightsDensity",{get:function(){return this._highlightsDensity},set:function(e){this._highlightsDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"highlightsSaturation",{get:function(){return this._highlightsSaturation},set:function(e){this._highlightsSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"highlightsExposure",{get:function(){return this._highlightsExposure},set:function(e){this._highlightsExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"midtonesHue",{get:function(){return this._midtonesHue},set:function(e){this._midtonesHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"midtonesDensity",{get:function(){return this._midtonesDensity},set:function(e){this._midtonesDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"midtonesSaturation",{get:function(){return this._midtonesSaturation},set:function(e){this._midtonesSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"midtonesExposure",{get:function(){return this._midtonesExposure},set:function(e){this._midtonesExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"shadowsHue",{get:function(){return this._shadowsHue},set:function(e){this._shadowsHue=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"shadowsDensity",{get:function(){return this._shadowsDensity},set:function(e){this._shadowsDensity=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"shadowsSaturation",{get:function(){return this._shadowsSaturation},set:function(e){this._shadowsSaturation=e,this._dirty=!0},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"shadowsExposure",{get:function(){return this._shadowsExposure},set:function(e){this._shadowsExposure=e,this._dirty=!0},enumerable:!0,configurable:!0}),d.prototype.getClassName=function(){return"ColorCurves"},d.Bind=function(e,t,i,r,n){void 0===i&&(i="vCameraColorCurvePositive"),void 0===r&&(r="vCameraColorCurveNeutral"),void 0===n&&(n="vCameraColorCurveNegative"),e._dirty&&(e._dirty=!1,e.getColorGradingDataToRef(e._globalHue,e._globalDensity,e._globalSaturation,e._globalExposure,e._globalCurve),e.getColorGradingDataToRef(e._highlightsHue,e._highlightsDensity,e._highlightsSaturation,e._highlightsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._highlightsCurve),e.getColorGradingDataToRef(e._midtonesHue,e._midtonesDensity,e._midtonesSaturation,e._midtonesExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._midtonesCurve),e.getColorGradingDataToRef(e._shadowsHue,e._shadowsDensity,e._shadowsSaturation,e._shadowsExposure,e._tempColor),e._tempColor.multiplyToRef(e._globalCurve,e._shadowsCurve),e._highlightsCurve.subtractToRef(e._midtonesCurve,e._positiveCurve),e._midtonesCurve.subtractToRef(e._shadowsCurve,e._negativeCurve)),t&&(t.setFloat4(i,e._positiveCurve.r,e._positiveCurve.g,e._positiveCurve.b,e._positiveCurve.a),t.setFloat4(r,e._midtonesCurve.r,e._midtonesCurve.g,e._midtonesCurve.b,e._midtonesCurve.a),t.setFloat4(n,e._negativeCurve.r,e._negativeCurve.g,e._negativeCurve.b,e._negativeCurve.a))},d.PrepareUniforms=function(e){e.push("vCameraColorCurveNeutral","vCameraColorCurvePositive","vCameraColorCurveNegative")},d.prototype.getColorGradingDataToRef=function(e,t,i,r,n){null!=e&&(e=d.clamp(e,0,360),t=d.clamp(t,-100,100),i=d.clamp(i,-100,100),r=d.clamp(r,-100,100),t=d.applyColorGradingSliderNonlinear(t),t*=.5,r=d.applyColorGradingSliderNonlinear(r),t<0&&(t*=-1,e=(e+180)%360),d.fromHSBToRef(e,t,50+.25*r,n),n.scaleToRef(2,n),n.a=1+.01*i)},d.applyColorGradingSliderNonlinear=function(e){e/=100;var t=Math.abs(e);return t=Math.pow(t,2),e<0&&(t*=-1),t*=100},d.fromHSBToRef=function(e,t,i,r){var n=d.clamp(e,0,360),o=d.clamp(t/100,0,1),s=d.clamp(i/100,0,1);if(0===o)r.r=s,r.g=s,r.b=s;else{n/=60;var a=Math.floor(n),l=n-a,c=s*(1-o),h=s*(1-o*l),u=s*(1-o*(1-l));switch(a){case 0:r.r=s,r.g=u,r.b=c;break;case 1:r.r=h,r.g=s,r.b=c;break;case 2:r.r=c,r.g=s,r.b=u;break;case 3:r.r=c,r.g=h,r.b=s;break;case 4:r.r=u,r.g=c,r.b=s;break;default:r.r=s,r.g=c,r.b=h}}r.a=1},d.clamp=function(e,t,i){return Math.min(Math.max(e,t),i)},d.prototype.clone=function(){return zn.SerializationHelper.Clone((function(){return new d}),this)},d.prototype.serialize=function(){return zn.SerializationHelper.Serialize(this)},d.Parse=function(e){return zn.SerializationHelper.Parse((function(){return new d}),e,null,null)},b([zn.serialize()],d.prototype,"_globalHue",void 0),b([zn.serialize()],d.prototype,"_globalDensity",void 0),b([zn.serialize()],d.prototype,"_globalSaturation",void 0),b([zn.serialize()],d.prototype,"_globalExposure",void 0),b([zn.serialize()],d.prototype,"_highlightsHue",void 0),b([zn.serialize()],d.prototype,"_highlightsDensity",void 0),b([zn.serialize()],d.prototype,"_highlightsSaturation",void 0),b([zn.serialize()],d.prototype,"_highlightsExposure",void 0),b([zn.serialize()],d.prototype,"_midtonesHue",void 0),b([zn.serialize()],d.prototype,"_midtonesDensity",void 0),b([zn.serialize()],d.prototype,"_midtonesSaturation",void 0),b([zn.serialize()],d.prototype,"_midtonesExposure",void 0),d})(),zn.ColorCurves=Gn,kn=$a||($a={}),Wn=(function(u){function e(e,t,i,r,n,o,s,a,l,c){var h=u.call(this,e,"refraction",["baseColor","depth","colorLevel"],["refractionSampler"],o,s,a,l,c)||this;return h.color=i,h.depth=r,h.colorLevel=n,h._ownRefractionTexture=!0,h.onActivateObservable.add((function(e){h._refTexture=h._refTexture||new kn.Texture(t,e.getScene())})),h.onApplyObservable.add((function(e){e.setColor3("baseColor",h.color),e.setFloat("depth",h.depth),e.setFloat("colorLevel",h.colorLevel),e.setTexture("refractionSampler",h._refTexture)})),h}return T(e,u),Object.defineProperty(e.prototype,"refractionTexture",{get:function(){return this._refTexture},set:function(e){this._refTexture&&this._ownRefractionTexture&&this._refTexture.dispose(),this._refTexture=e,this._ownRefractionTexture=!1},enumerable:!0,configurable:!0}),e.prototype.dispose=function(e){this._refTexture&&this._ownRefractionTexture&&(this._refTexture.dispose(),this._refTexture=null),u.prototype.dispose.call(this,e)},e})(kn.PostProcess),kn.RefractionPostProcess=Wn,Hn=$a||($a={}),Xn=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,"blackAndWhite",["degree"],null,t,i,r,n,o)||this;return s.degree=1,s.onApplyObservable.add((function(e){e.setFloat("degree",s.degree)})),s}return T(e,a),e})(Hn.PostProcess),Hn.BlackAndWhitePostProcess=Xn,jn=$a||($a={}),Yn=(function(c){function e(e,t,i,r,n,o,s,a){void 0===a&&(a=jn.Engine.TEXTURETYPE_UNSIGNED_INT);var l=c.call(this,e,"convolution",["kernel","screenSize"],null,i,r,n,o,s,null,a)||this;return l.kernel=t,l.onApply=function(e){e.setFloat2("screenSize",l.width,l.height),e.setArray("kernel",l.kernel)},l}return T(e,c),e.EdgeDetect0Kernel=[1,0,-1,0,0,0,-1,0,1],e.EdgeDetect1Kernel=[0,1,0,1,-4,1,0,1,0],e.EdgeDetect2Kernel=[-1,-1,-1,-1,8,-1,-1,-1,-1],e.SharpenKernel=[0,-1,0,-1,5,-1,0,-1,0],e.EmbossKernel=[-2,-1,0,-1,1,1,0,1,2],e.GaussianKernel=[0,1,0,1,1,1,0,1,0],e})(jn.PostProcess),jn.ConvolutionPostProcess=Yn,Kn=$a||($a={}),Qn=(function(l){function e(e,t,i,r,n,o,s){var a=l.call(this,e,"filter",["kernelMatrix"],null,i,r,n,o,s)||this;return a.kernelMatrix=t,a.onApply=function(e){e.setMatrix("kernelMatrix",a.kernelMatrix)},a}return T(e,l),e})(Kn.PostProcess),Kn.FilterPostProcess=Qn,Zn=$a||($a={}),qn=(function(h){function u(e,t,i,r,n,o,s,a,l){void 0===n&&(n=100),void 0===o&&(o=Zn.Texture.BILINEAR_SAMPLINGMODE);var c=h.call(this,e,"volumetricLightScattering",["decay","exposure","weight","meshPositionOnScreen","density"],["lightScatteringSampler"],t.postProcessRatio||t,i,o,s,a,"#define NUM_SAMPLES "+n)||this;return c._screenCoordinates=Zn.Vector2.Zero(),c.customMeshPosition=Zn.Vector3.Zero(),c.useCustomMeshPosition=!1,c.invert=!0,c.excludedMeshes=new Array,c.exposure=.3,c.decay=.96815,c.weight=.58767,c.density=.926,s=(l=null===i?l:i.getScene()).getEngine(),c._viewPort=new Zn.Viewport(0,0,1,1).toGlobal(s.getRenderWidth(),s.getRenderHeight()),c.mesh=null!==r?r:u.CreateDefaultMesh("VolumetricLightScatteringMesh",l),c._createPass(l,t.passRatio||t),c.onActivate=function(e){c.isSupported||c.dispose(e),c.onActivate=null},c.onApplyObservable.add((function(e){c._updateMeshScreenCoordinates(l),e.setTexture("lightScatteringSampler",c._volumetricLightScatteringRTT),e.setFloat("exposure",c.exposure),e.setFloat("decay",c.decay),e.setFloat("weight",c.weight),e.setFloat("density",c.density),e.setVector2("meshPositionOnScreen",c._screenCoordinates)})),c}return T(u,h),Object.defineProperty(u.prototype,"useDiffuseColor",{get:function(){return Zn.Tools.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead"),!1},set:function(e){Zn.Tools.Warn("VolumetricLightScatteringPostProcess.useDiffuseColor is no longer used, use the mesh material directly instead")},enumerable:!0,configurable:!0}),u.prototype.getClassName=function(){return"VolumetricLightScatteringPostProcess"},u.prototype._isReady=function(e,t){var i=e.getMesh();if(i===this.mesh&&i.material)return i.material.isReady(i);var r=[],n=[Zn.VertexBuffer.PositionKind],o=e.getMaterial();o&&(o.needAlphaTesting()&&r.push("#define ALPHATEST"),i.isVerticesDataPresent(Zn.VertexBuffer.UVKind)&&(n.push(Zn.VertexBuffer.UVKind),r.push("#define UV1")),i.isVerticesDataPresent(Zn.VertexBuffer.UV2Kind)&&(n.push(Zn.VertexBuffer.UV2Kind),r.push("#define UV2"))),i.useBones&&i.computeBonesUsingShaders?(n.push(Zn.VertexBuffer.MatricesIndicesKind),n.push(Zn.VertexBuffer.MatricesWeightsKind),r.push("#define NUM_BONE_INFLUENCERS "+i.numBoneInfluencers),r.push("#define BonesPerMesh "+(i.skeleton?i.skeleton.bones.length+1:0))):r.push("#define NUM_BONE_INFLUENCERS 0"),t&&(r.push("#define INSTANCES"),n.push("world0"),n.push("world1"),n.push("world2"),n.push("world3"));var s=r.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._volumetricLightScatteringPass=i.getScene().getEngine().createEffect({vertexElement:"depth",fragmentElement:"volumetricLightScatteringPass"},n,["world","mBones","viewProjection","diffuseMatrix"],["diffuseSampler"],s)),this._volumetricLightScatteringPass.isReady()},u.prototype.setCustomMeshPosition=function(e){this.customMeshPosition=e},u.prototype.getCustomMeshPosition=function(){return this.customMeshPosition},u.prototype.dispose=function(e){var t=e.getScene().customRenderTargets.indexOf(this._volumetricLightScatteringRTT);-1!==t&&e.getScene().customRenderTargets.splice(t,1),this._volumetricLightScatteringRTT.dispose(),h.prototype.dispose.call(this,e)},u.prototype.getPass=function(){return this._volumetricLightScatteringRTT},u.prototype._meshExcluded=function(e){return 0<this.excludedMeshes.length&&-1!==this.excludedMeshes.indexOf(e)},u.prototype._createPass=function(c,e){var h=this,t=c.getEngine();this._volumetricLightScatteringRTT=new Zn.RenderTargetTexture("volumetricLightScatteringMap",{width:t.getRenderWidth()*e,height:t.getRenderHeight()*e},c,!1,!0,Zn.Engine.TEXTURETYPE_UNSIGNED_INT),this._volumetricLightScatteringRTT.wrapU=Zn.Texture.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.wrapV=Zn.Texture.CLAMP_ADDRESSMODE,this._volumetricLightScatteringRTT.renderList=null,this._volumetricLightScatteringRTT.renderParticles=!1,this._volumetricLightScatteringRTT.ignoreCameraViewport=!0;var i=this.getCamera();i?i.customRenderTargets.push(this._volumetricLightScatteringRTT):c.customRenderTargets.push(this._volumetricLightScatteringRTT);var r,u=function(e){var t=e.getRenderingMesh();if(!h._meshExcluded(t)){var i=e.getMaterial();if(i){var r=t.getScene(),n=r.getEngine();n.setState(i.backFaceCulling);var o=t._getInstancesRenderList(e._id);if(!o.mustReturn){var s=n.getCaps().instancedArrays&&null!==o.visibleInstances[e._id];if(h._isReady(e,s)){var a=h._volumetricLightScatteringPass;if(t===h.mesh&&(a=e.effect?e.effect:i.getEffect()),n.enableEffect(a),t._bind(e,a,Zn.Material.TriangleFillMode),t===h.mesh)i.bind(t.getWorldMatrix(),t);else{if(h._volumetricLightScatteringPass.setMatrix("viewProjection",r.getTransformMatrix()),i&&i.needAlphaTesting()){var l=i.getAlphaTestTexture();h._volumetricLightScatteringPass.setTexture("diffuseSampler",l),l&&h._volumetricLightScatteringPass.setMatrix("diffuseMatrix",l.getTextureMatrix())}t.useBones&&t.computeBonesUsingShaders&&t.skeleton&&h._volumetricLightScatteringPass.setMatrices("mBones",t.skeleton.getTransformMatrices(t))}t._processRendering(e,h._volumetricLightScatteringPass,Zn.Material.TriangleFillMode,o,s,(function(e,t){return a.setMatrix("world",t)}))}}}}},n=new Zn.Color4(0,0,0,1);this._volumetricLightScatteringRTT.onBeforeRenderObservable.add((function(){r=c.clearColor,c.clearColor=n})),this._volumetricLightScatteringRTT.onAfterRenderObservable.add((function(){c.clearColor=r})),this._volumetricLightScatteringRTT.customRenderFunction=function(e,t,i,r){var n,o=c.getEngine();if(r.length){for(o.setColorWrite(!1),n=0;n<r.length;n++)u(r.data[n]);o.setColorWrite(!0)}for(n=0;n<e.length;n++)u(e.data[n]);for(n=0;n<t.length;n++)u(t.data[n]);if(i.length){for(n=0;n<i.length;n++){var s=i.data[n],a=s.getBoundingInfo();a&&c.activeCamera&&(s._alphaIndex=s.getMesh().alphaIndex,s._distanceToCamera=a.boundingSphere.centerWorld.subtract(c.activeCamera.position).length())}var l=i.data.slice(0,i.length);for(l.sort((function(e,t){return e._alphaIndex>t._alphaIndex?1:e._alphaIndex<t._alphaIndex?-1:e._distanceToCamera<t._distanceToCamera?1:e._distanceToCamera>t._distanceToCamera?-1:0})),o.setAlphaMode(Zn.Engine.ALPHA_COMBINE),n=0;n<l.length;n++)u(l[n]);o.setAlphaMode(Zn.Engine.ALPHA_DISABLE)}}},u.prototype._updateMeshScreenCoordinates=function(e){var t,i=e.getTransformMatrix();t=this.useCustomMeshPosition?this.customMeshPosition:this.attachedNode?this.attachedNode.position:this.mesh.parent?this.mesh.getAbsolutePosition():this.mesh.position;var r=Zn.Vector3.Project(t,Zn.Matrix.Identity(),i,this._viewPort);this._screenCoordinates.x=r.x/this._viewPort.width,this._screenCoordinates.y=r.y/this._viewPort.height,this.invert&&(this._screenCoordinates.y=1-this._screenCoordinates.y)},u.CreateDefaultMesh=function(e,t){var i=Zn.Mesh.CreatePlane(e,1,t);i.billboardMode=Zn.AbstractMesh.BILLBOARDMODE_ALL;var r=new Zn.StandardMaterial(e+"Material",t);return r.emissiveColor=new Zn.Color3(1,1,1),i.material=r,i},b([Zn.serializeAsVector3()],u.prototype,"customMeshPosition",void 0),b([Zn.serialize()],u.prototype,"useCustomMeshPosition",void 0),b([Zn.serialize()],u.prototype,"invert",void 0),b([Zn.serializeAsMeshReference()],u.prototype,"mesh",void 0),b([Zn.serialize()],u.prototype,"excludedMeshes",void 0),b([Zn.serialize()],u.prototype,"exposure",void 0),b([Zn.serialize()],u.prototype,"decay",void 0),b([Zn.serialize()],u.prototype,"weight",void 0),b([Zn.serialize()],u.prototype,"density",void 0),u})(Zn.PostProcess),Zn.VolumetricLightScatteringPostProcess=qn,Jn=$a||($a={}),$n=(function(l){function e(e,t,i,r,n,o,s){var a=l.call(this,e,"colorCorrection",null,["colorTable"],i,r,n,o,s)||this;return a._colorTableTexture=new Jn.Texture(t,r.getScene(),!0,!1,Jn.Texture.TRILINEAR_SAMPLINGMODE),a._colorTableTexture.anisotropicFilteringLevel=1,a._colorTableTexture.wrapU=Jn.Texture.CLAMP_ADDRESSMODE,a._colorTableTexture.wrapV=Jn.Texture.CLAMP_ADDRESSMODE,a.onApply=function(e){e.setTexture("colorTable",a._colorTableTexture)},a}return T(e,l),e})(Jn.PostProcess),Jn.ColorCorrectionPostProcess=$n,(function(h){var u,e;(e=u=h.TonemappingOperator||(h.TonemappingOperator={}))[e.Hable=0]="Hable",e[e.Reinhard=1]="Reinhard",e[e.HejiDawson=2]="HejiDawson",e[e.Photographic=3]="Photographic";var t=(function(c){function e(e,t,i,r,n,o,s){void 0===n&&(n=h.Texture.BILINEAR_SAMPLINGMODE),void 0===s&&(s=h.Engine.TEXTURETYPE_UNSIGNED_INT);var a=c.call(this,e,"tonemap",["_ExposureAdjustment"],null,1,r,n,o,!0,null,s)||this;a._operator=t,a.exposureAdjustment=i;var l="#define ";return a._operator===u.Hable?l+="HABLE_TONEMAPPING":a._operator===u.Reinhard?l+="REINHARD_TONEMAPPING":a._operator===u.HejiDawson?l+="OPTIMIZED_HEJIDAWSON_TONEMAPPING":a._operator===u.Photographic&&(l+="PHOTOGRAPHIC_TONEMAPPING"),a.updateEffect(l),a.onApply=function(e){e.setFloat("_ExposureAdjustment",a.exposureAdjustment)},a}return T(e,c),e})(h.PostProcess);h.TonemapPostProcess=t})($a||($a={})),eo=$a||($a={}),to=(function(s){function e(e,t,i,r,n,o){return s.call(this,e,"displayPass",["passSampler"],["passSampler"],t,i,r,n,o)||this}return T(e,s),e})(eo.PostProcess),eo.DisplayPassPostProcess=to,io=$a||($a={}),ro=(function(a){function e(e,t,i,r,n,o,s){return void 0===s&&(s=io.Engine.TEXTURETYPE_UNSIGNED_INT),a.call(this,e,"highlights",null,null,t,i,r,n,o,null,s)||this}return T(e,a),e})(io.PostProcess),io.HighlightsPostProcess=ro,no=$a||($a={}),oo=(function(c){function e(e,t,i,r,n,o,s,a){void 0===i&&(i=null),void 0===s&&(s=no.Engine.TEXTURETYPE_UNSIGNED_INT);var l=c.call(this,e,"imageProcessing",[],[],t,i,r,n,o,null,s,"postprocess",null,!0)||this;return l._fromLinearSpace=!0,l._defines={IMAGEPROCESSING:!1,VIGNETTE:!1,VIGNETTEBLENDMODEMULTIPLY:!1,VIGNETTEBLENDMODEOPAQUE:!1,TONEMAPPING:!1,TONEMAPPING_ACES:!1,CONTRAST:!1,COLORCURVES:!1,COLORGRADING:!1,COLORGRADING3D:!1,FROMLINEARSPACE:!1,SAMPLER3DGREENDEPTH:!1,SAMPLER3DBGRMAP:!1,IMAGEPROCESSINGPOSTPROCESS:!1,EXPOSURE:!1},a?(a.applyByPostProcess=!0,l._attachImageProcessingConfiguration(a,!0),l.fromLinearSpace=!1):(l._attachImageProcessingConfiguration(null,!0),l.imageProcessingConfiguration.applyByPostProcess=!0),l.onApply=function(e){l.imageProcessingConfiguration.bind(e,l.aspectRatio)},l}return T(e,c),Object.defineProperty(e.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e)},enumerable:!0,configurable:!0}),e.prototype._attachImageProcessingConfiguration=function(e,t){var i=this;if(void 0===t&&(t=!1),e!==this._imageProcessingConfiguration){if(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),e)this._imageProcessingConfiguration=e;else{var r=null,n=this.getEngine(),o=this.getCamera();if(o)r=o.getScene();else if(n&&n.scenes){var s=n.scenes;r=s[s.length-1]}else r=no.Engine.LastCreatedScene;this._imageProcessingConfiguration=r.imageProcessingConfiguration}this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(e){i._updateParameters()}))),t||this._updateParameters()}},Object.defineProperty(e.prototype,"colorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"colorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingTexture",{get:function(){return this.imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"colorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"exposure",{get:function(){return this.imageProcessingConfiguration.exposure},set:function(e){this.imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"toneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"contrast",{get:function(){return this.imageProcessingConfiguration.contrast},set:function(e){this.imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteStretch",{get:function(){return this.imageProcessingConfiguration.vignetteStretch},set:function(e){this.imageProcessingConfiguration.vignetteStretch=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteCentreX",{get:function(){return this.imageProcessingConfiguration.vignetteCentreX},set:function(e){this.imageProcessingConfiguration.vignetteCentreX=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteCentreY",{get:function(){return this.imageProcessingConfiguration.vignetteCentreY},set:function(e){this.imageProcessingConfiguration.vignetteCentreY=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteWeight",{get:function(){return this.imageProcessingConfiguration.vignetteWeight},set:function(e){this.imageProcessingConfiguration.vignetteWeight=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteColor",{get:function(){return this.imageProcessingConfiguration.vignetteColor},set:function(e){this.imageProcessingConfiguration.vignetteColor=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteCameraFov",{get:function(){return this.imageProcessingConfiguration.vignetteCameraFov},set:function(e){this.imageProcessingConfiguration.vignetteCameraFov=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteBlendMode",{get:function(){return this.imageProcessingConfiguration.vignetteBlendMode},set:function(e){this.imageProcessingConfiguration.vignetteBlendMode=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vignetteEnabled",{get:function(){return this.imageProcessingConfiguration.vignetteEnabled},set:function(e){this.imageProcessingConfiguration.vignetteEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fromLinearSpace",{get:function(){return this._fromLinearSpace},set:function(e){this._fromLinearSpace!==e&&(this._fromLinearSpace=e,this._updateParameters())},enumerable:!0,configurable:!0}),e.prototype.getClassName=function(){return"ImageProcessingPostProcess"},e.prototype._updateParameters=function(){this._defines.FROMLINEARSPACE=this._fromLinearSpace,this.imageProcessingConfiguration.prepareDefines(this._defines,!0);var e="";for(var t in this._defines)this._defines[t]&&(e+="#define "+t+";\r\n");var i=["textureSampler"],r=["scale"];no.ImageProcessingConfiguration&&(no.ImageProcessingConfiguration.PrepareSamplers(i,this._defines),no.ImageProcessingConfiguration.PrepareUniforms(r,this._defines)),this.updateEffect(e,r,i)},e.prototype.dispose=function(e){c.prototype.dispose.call(this,e),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration&&(this.imageProcessingConfiguration.applyByPostProcess=!1)},b([no.serialize()],e.prototype,"_fromLinearSpace",void 0),e})(no.PostProcess),no.ImageProcessingPostProcess=oo,so=$a||($a={}),ao=(function(l){function d(e,t,i,r,n,o,s){void 0===i&&(i=null),void 0===r&&(r=null),void 0===n&&(n=null),void 0===o&&(o=null),void 0===s&&(s=null);var a=l.call(this,e,t.getScene())||this;return a.name=e,a.children=new Array,a.animations=new Array,a._index=null,a._absoluteTransform=new so.Matrix,a._invertedAbsoluteTransform=new so.Matrix,a._scalingDeterminant=1,a._worldTransform=new so.Matrix,a._needToDecompose=!0,a._needToCompose=!1,a._skeleton=t,a._localMatrix=r?r.clone():so.Matrix.Identity(),a._restPose=n||a._localMatrix.clone(),a._baseMatrix=o||a._localMatrix.clone(),a._index=s,t.bones.push(a),a.setParent(i,!1),(o||r)&&a._updateDifferenceMatrix(),a}return T(d,l),Object.defineProperty(d.prototype,"_matrix",{get:function(){return this._compose(),this._localMatrix},set:function(e){this._localMatrix.copyFrom(e),this._needToDecompose=!0},enumerable:!0,configurable:!0}),d.prototype.getSkeleton=function(){return this._skeleton},d.prototype.getParent=function(){return this._parent},d.prototype.setParent=function(e,t){if(void 0===t&&(t=!0),this._parent!==e){if(this._parent){var i=this._parent.children.indexOf(this);-1!==i&&this._parent.children.splice(i,1)}this._parent=e,this._parent&&this._parent.children.push(this),t&&this._updateDifferenceMatrix(),this.markAsDirty()}},d.prototype.getLocalMatrix=function(){return this._compose(),this._localMatrix},d.prototype.getBaseMatrix=function(){return this._baseMatrix},d.prototype.getRestPose=function(){return this._restPose},d.prototype.getWorldMatrix=function(){return this._worldTransform},d.prototype.returnToRest=function(){this.updateMatrix(this._restPose.clone())},d.prototype.getInvertedAbsoluteTransform=function(){return this._invertedAbsoluteTransform},d.prototype.getAbsoluteTransform=function(){return this._absoluteTransform},Object.defineProperty(d.prototype,"position",{get:function(){return this._decompose(),this._localPosition},set:function(e){this._decompose(),this._localPosition.copyFrom(e),this._markAsDirtyAndCompose()},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"rotation",{get:function(){return this.getRotation()},set:function(e){this.setRotation(e)},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"rotationQuaternion",{get:function(){return this._decompose(),this._localRotation},set:function(e){this.setRotationQuaternion(e)},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"scaling",{get:function(){return this.getScale()},set:function(e){this.setScale(e)},enumerable:!0,configurable:!0}),Object.defineProperty(d.prototype,"animationPropertiesOverride",{get:function(){return this._skeleton.animationPropertiesOverride},enumerable:!0,configurable:!0}),d.prototype._decompose=function(){this._needToDecompose&&(this._needToDecompose=!1,this._localScaling||(this._localScaling=so.Vector3.Zero(),this._localRotation=so.Quaternion.Zero(),this._localPosition=so.Vector3.Zero()),this._localMatrix.decompose(this._localScaling,this._localRotation,this._localPosition))},d.prototype._compose=function(){this._needToCompose&&(this._needToCompose=!1,so.Matrix.ComposeToRef(this._localScaling,this._localRotation,this._localPosition,this._localMatrix))},d.prototype.updateMatrix=function(e,t,i){void 0===t&&(t=!0),void 0===i&&(i=!0),this._baseMatrix.copyFrom(e),t&&this._updateDifferenceMatrix(),i?(this._localMatrix.copyFrom(e),this._markAsDirtyAndDecompose()):this.markAsDirty()},d.prototype._updateDifferenceMatrix=function(e,t){if(void 0===t&&(t=!0),e||(e=this._baseMatrix),this._parent?e.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform):this._absoluteTransform.copyFrom(e),this._absoluteTransform.invertToRef(this._invertedAbsoluteTransform),t)for(var i=0;i<this.children.length;i++)this.children[i]._updateDifferenceMatrix();this._scalingDeterminant=this._absoluteTransform.determinant()<0?-1:1},d.prototype.markAsDirty=function(){this._currentRenderId++,this._childRenderId++,this._skeleton._markAsDirty()},d.prototype._markAsDirtyAndCompose=function(){this.markAsDirty(),this._needToCompose=!0},d.prototype._markAsDirtyAndDecompose=function(){this.markAsDirty(),this._needToDecompose=!0},d.prototype.copyAnimationRange=function(e,t,i,r,n){void 0===r&&(r=!1),void 0===n&&(n=null),0===this.animations.length&&(this.animations.push(new so.Animation(this.name,"_matrix",e.animations[0].framePerSecond,so.Animation.ANIMATIONTYPE_MATRIX,0)),this.animations[0].setKeys([]));var o=e.animations[0].getRange(t);if(!o)return!1;for(var s,a,l,c=o.from,h=o.to,u=e.animations[0].getKeys(),d=e.length,f=e.getParent(),p=this.getParent(),_=r&&f&&d&&this.length&&d!==this.length,m=_&&p&&f?p.length/f.length:1,g=r&&!p&&n&&(1!==n.x||1!==n.y||1!==n.z),v=this.animations[0].getKeys(),y=0,b=u.length;y<b;y++)(s=u[y]).frame>=c&&s.frame<=h&&(r?(l=s.value.clone(),_?(a=l.getTranslation(),l.setTranslation(a.scaleInPlace(m))):g&&n?(a=l.getTranslation(),l.setTranslation(a.multiplyInPlace(n))):l=s.value):l=s.value,v.push({frame:s.frame+i,value:l}));return this.animations[0].createRange(t,c+i,h+i),!0},d.prototype.translate=function(e,t,i){void 0===t&&(t=so.Space.LOCAL);var r=this.getLocalMatrix();if(t==so.Space.LOCAL)r.m[12]+=e.x,r.m[13]+=e.y,r.m[14]+=e.z;else{var n=null;i&&(n=i.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var o=d._tmpMats[0],s=d._tmpVecs[0];this._parent&&(i&&n?(o.copyFrom(this._parent.getAbsoluteTransform()),o.multiplyToRef(n,o)):o.copyFrom(this._parent.getAbsoluteTransform())),o.m[12]=0,o.m[13]=0,o.m[14]=0,o.invert(),so.Vector3.TransformCoordinatesToRef(e,o,s),r.m[12]+=s.x,r.m[13]+=s.y,r.m[14]+=s.z}this._markAsDirtyAndDecompose()},d.prototype.setPosition=function(e,t,i){void 0===t&&(t=so.Space.LOCAL);var r=this.getLocalMatrix();if(t==so.Space.LOCAL)r.m[12]=e.x,r.m[13]=e.y,r.m[14]=e.z;else{var n=null;i&&(n=i.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var o=d._tmpMats[0],s=d._tmpVecs[0];this._parent&&(i&&n?(o.copyFrom(this._parent.getAbsoluteTransform()),o.multiplyToRef(n,o)):o.copyFrom(this._parent.getAbsoluteTransform())),o.invert(),so.Vector3.TransformCoordinatesToRef(e,o,s),r.m[12]=s.x,r.m[13]=s.y,r.m[14]=s.z}this._markAsDirtyAndDecompose()},d.prototype.setAbsolutePosition=function(e,t){this.setPosition(e,so.Space.WORLD,t)},d.prototype.scale=function(e,t,i,r){void 0===r&&(r=!1);var n=this.getLocalMatrix(),o=d._tmpMats[0];so.Matrix.ScalingToRef(e,t,i,o),o.multiplyToRef(n,n),o.invert();for(var s=0,a=this.children;s<a.length;s++){var l=(u=a[s]).getLocalMatrix();l.multiplyToRef(o,l),l.m[12]*=e,l.m[13]*=t,l.m[14]*=i,u._markAsDirtyAndDecompose()}if(this._markAsDirtyAndDecompose(),r)for(var c=0,h=this.children;c<h.length;c++){var u;(u=h[c]).scale(e,t,i,r)}},d.prototype.setScale=function(e){this._decompose(),this._localScaling.copyFrom(e),this._markAsDirtyAndCompose()},d.prototype.getScale=function(){return this._decompose(),this._localScaling},d.prototype.getScaleToRef=function(e){this._decompose(),e.copyFrom(this._localScaling)},d.prototype.setYawPitchRoll=function(e,t,i,r,n){if(void 0===r&&(r=so.Space.LOCAL),r===so.Space.LOCAL){var o=d._tmpQuat;return so.Quaternion.RotationYawPitchRollToRef(e,t,i,o),void this.setRotationQuaternion(o,r,n)}var s=d._tmpMats[0];if(this._getNegativeRotationToRef(s,n)){var a=d._tmpMats[1];so.Matrix.RotationYawPitchRollToRef(e,t,i,a),s.multiplyToRef(a,a),this._rotateWithMatrix(a,r,n)}},d.prototype.rotate=function(e,t,i,r){void 0===i&&(i=so.Space.LOCAL);var n=d._tmpMats[0];n.m[12]=0,n.m[13]=0,n.m[14]=0,so.Matrix.RotationAxisToRef(e,t,n),this._rotateWithMatrix(n,i,r)},d.prototype.setAxisAngle=function(e,t,i,r){if(void 0===i&&(i=so.Space.LOCAL),i===so.Space.LOCAL){var n=d._tmpQuat;return so.Quaternion.RotationAxisToRef(e,t,n),void this.setRotationQuaternion(n,i,r)}var o=d._tmpMats[0];if(this._getNegativeRotationToRef(o,r)){var s=d._tmpMats[1];so.Matrix.RotationAxisToRef(e,t,s),o.multiplyToRef(s,s),this._rotateWithMatrix(s,i,r)}},d.prototype.setRotation=function(e,t,i){void 0===t&&(t=so.Space.LOCAL),this.setYawPitchRoll(e.y,e.x,e.z,t,i)},d.prototype.setRotationQuaternion=function(e,t,i){if(void 0===t&&(t=so.Space.LOCAL),t===so.Space.LOCAL)return this._decompose(),this._localRotation.copyFrom(e),void this._markAsDirtyAndCompose();var r=d._tmpMats[0];if(this._getNegativeRotationToRef(r,i)){var n=d._tmpMats[1];so.Matrix.FromQuaternionToRef(e,n),r.multiplyToRef(n,n),this._rotateWithMatrix(n,t,i)}},d.prototype.setRotationMatrix=function(e,t,i){if(void 0===t&&(t=so.Space.LOCAL),t===so.Space.LOCAL){var r=d._tmpQuat;return so.Quaternion.FromRotationMatrixToRef(e,r),void this.setRotationQuaternion(r,t,i)}var n=d._tmpMats[0];if(this._getNegativeRotationToRef(n,i)){var o=d._tmpMats[1];o.copyFrom(e),n.multiplyToRef(e,o),this._rotateWithMatrix(o,t,i)}},d.prototype._rotateWithMatrix=function(e,t,i){void 0===t&&(t=so.Space.LOCAL);var r=this.getLocalMatrix(),n=r.m[12],o=r.m[13],s=r.m[14],a=this.getParent(),l=d._tmpMats[3],c=d._tmpMats[4];a&&t==so.Space.WORLD?(i?(l.copyFrom(i.getWorldMatrix()),a.getAbsoluteTransform().multiplyToRef(l,l)):l.copyFrom(a.getAbsoluteTransform()),c.copyFrom(l),c.invert(),r.multiplyToRef(l,r),r.multiplyToRef(e,r),r.multiplyToRef(c,r)):t==so.Space.WORLD&&i?(l.copyFrom(i.getWorldMatrix()),c.copyFrom(l),c.invert(),r.multiplyToRef(l,r),r.multiplyToRef(e,r),r.multiplyToRef(c,r)):r.multiplyToRef(e,r),r.m[12]=n,r.m[13]=o,r.m[14]=s,this.computeAbsoluteTransforms(),this._markAsDirtyAndDecompose()},d.prototype._getNegativeRotationToRef=function(e,t){var i=d._tmpMats[2];return e.copyFrom(this.getAbsoluteTransform()),t&&(e.multiplyToRef(t.getWorldMatrix(),e),so.Matrix.ScalingToRef(t.scaling.x,t.scaling.y,t.scaling.z,i)),e.invert(),!isNaN(e.m[0])&&(i.m[0]*=this._scalingDeterminant,e.multiplyToRef(i,e),!0)},d.prototype.getPosition=function(e,t){void 0===e&&(e=so.Space.LOCAL),void 0===t&&(t=null);var i=so.Vector3.Zero();return this.getPositionToRef(e,t,i),i},d.prototype.getPositionToRef=function(e,t,i){if(void 0===e&&(e=so.Space.LOCAL),e==so.Space.LOCAL){var r=this.getLocalMatrix();i.x=r.m[12],i.y=r.m[13],i.z=r.m[14]}else{var n=null;t&&(n=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var o=d._tmpMats[0];t&&n?(o.copyFrom(this.getAbsoluteTransform()),o.multiplyToRef(n,o)):o=this.getAbsoluteTransform(),i.x=o.m[12],i.y=o.m[13],i.z=o.m[14]}},d.prototype.getAbsolutePosition=function(e){void 0===e&&(e=null);var t=so.Vector3.Zero();return this.getPositionToRef(so.Space.WORLD,e,t),t},d.prototype.getAbsolutePositionToRef=function(e,t){this.getPositionToRef(so.Space.WORLD,e,t)},d.prototype.computeAbsoluteTransforms=function(){if(this._compose(),this._parent)this._localMatrix.multiplyToRef(this._parent._absoluteTransform,this._absoluteTransform);else{this._absoluteTransform.copyFrom(this._localMatrix);var e=this._skeleton.getPoseMatrix();e&&this._absoluteTransform.multiplyToRef(e,this._absoluteTransform)}for(var t=this.children,i=t.length,r=0;r<i;r++)t[r].computeAbsoluteTransforms()},d.prototype.getDirection=function(e,t){void 0===t&&(t=null);var i=so.Vector3.Zero();return this.getDirectionToRef(e,t,i),i},d.prototype.getDirectionToRef=function(e,t,i){void 0===t&&(t=null);var r=null;t&&(r=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var n=d._tmpMats[0];n.copyFrom(this.getAbsoluteTransform()),t&&r&&n.multiplyToRef(r,n),so.Vector3.TransformNormalToRef(e,n,i),i.normalize()},d.prototype.getRotation=function(e,t){void 0===e&&(e=so.Space.LOCAL),void 0===t&&(t=null);var i=so.Vector3.Zero();return this.getRotationToRef(e,t,i),i},d.prototype.getRotationToRef=function(e,t,i){void 0===e&&(e=so.Space.LOCAL),void 0===t&&(t=null);var r=d._tmpQuat;this.getRotationQuaternionToRef(e,t,r),r.toEulerAnglesToRef(i)},d.prototype.getRotationQuaternion=function(e,t){void 0===e&&(e=so.Space.LOCAL),void 0===t&&(t=null);var i=so.Quaternion.Identity();return this.getRotationQuaternionToRef(e,t,i),i},d.prototype.getRotationQuaternionToRef=function(e,t,i){if(void 0===e&&(e=so.Space.LOCAL),void 0===t&&(t=null),e==so.Space.LOCAL)this._decompose(),i.copyFrom(this._localRotation);else{var r=d._tmpMats[0],n=this.getAbsoluteTransform();t?n.multiplyToRef(t.getWorldMatrix(),r):r.copyFrom(n),r.m[0]*=this._scalingDeterminant,r.m[1]*=this._scalingDeterminant,r.m[2]*=this._scalingDeterminant,r.decompose(void 0,i,void 0)}},d.prototype.getRotationMatrix=function(e,t){void 0===e&&(e=so.Space.LOCAL);var i=so.Matrix.Identity();return this.getRotationMatrixToRef(e,t,i),i},d.prototype.getRotationMatrixToRef=function(e,t,i){if(void 0===e&&(e=so.Space.LOCAL),e==so.Space.LOCAL)this.getLocalMatrix().getRotationMatrixToRef(i);else{var r=d._tmpMats[0],n=this.getAbsoluteTransform();t?n.multiplyToRef(t.getWorldMatrix(),r):r.copyFrom(n),r.m[0]*=this._scalingDeterminant,r.m[1]*=this._scalingDeterminant,r.m[2]*=this._scalingDeterminant,r.getRotationMatrixToRef(i)}},d.prototype.getAbsolutePositionFromLocal=function(e,t){void 0===t&&(t=null);var i=so.Vector3.Zero();return this.getAbsolutePositionFromLocalToRef(e,t,i),i},d.prototype.getAbsolutePositionFromLocalToRef=function(e,t,i){void 0===t&&(t=null);var r=null;t&&(r=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var n=d._tmpMats[0];t&&r?(n.copyFrom(this.getAbsoluteTransform()),n.multiplyToRef(r,n)):n=this.getAbsoluteTransform(),so.Vector3.TransformCoordinatesToRef(e,n,i)},d.prototype.getLocalPositionFromAbsolute=function(e,t){void 0===t&&(t=null);var i=so.Vector3.Zero();return this.getLocalPositionFromAbsoluteToRef(e,t,i),i},d.prototype.getLocalPositionFromAbsoluteToRef=function(e,t,i){void 0===t&&(t=null);var r=null;t&&(r=t.getWorldMatrix()),this._skeleton.computeAbsoluteTransforms();var n=d._tmpMats[0];n.copyFrom(this.getAbsoluteTransform()),t&&r&&n.multiplyToRef(r,n),n.invert(),so.Vector3.TransformCoordinatesToRef(e,n,i)},d._tmpVecs=[so.Vector3.Zero(),so.Vector3.Zero()],d._tmpQuat=so.Quaternion.Identity(),d._tmpMats=[so.Matrix.Identity(),so.Matrix.Identity(),so.Matrix.Identity(),so.Matrix.Identity(),so.Matrix.Identity()],d})(so.Node),so.Bone=ao,lo=$a||($a={}),co=(function(){function b(e,t,i){if(this.targetPosition=lo.Vector3.Zero(),this.poleTargetPosition=lo.Vector3.Zero(),this.poleTargetLocalOffset=lo.Vector3.Zero(),this.poleAngle=0,this.slerpAmount=1,this._bone1Quat=lo.Quaternion.Identity(),this._bone1Mat=lo.Matrix.Identity(),this._bone2Ang=Math.PI,this._maxAngle=Math.PI,this._rightHandedSystem=!1,this._bendAxis=lo.Vector3.Right(),this._slerping=!1,this._adjustRoll=0,this._bone2=t,this._bone1=t.getParent(),this._bone1){this.mesh=e;var r=t.getPosition();if(0<t.getAbsoluteTransform().determinant()&&(this._rightHandedSystem=!0,this._bendAxis.x=0,this._bendAxis.y=0,this._bendAxis.z=-1,r.x>r.y&&r.x>r.z&&(this._adjustRoll=.5*Math.PI,this._bendAxis.z=1)),this._bone1.length){var n=this._bone1.getScale(),o=this._bone2.getScale();this._bone1Length=this._bone1.length*n.y*this.mesh.scaling.y,this._bone2Length=this._bone2.length*o.y*this.mesh.scaling.y}else if(this._bone1.children[0]){e.computeWorldMatrix(!0);var s=this._bone2.children[0].getAbsolutePosition(e),a=this._bone2.getAbsolutePosition(e),l=this._bone1.getAbsolutePosition(e);this._bone1Length=lo.Vector3.Distance(s,a),this._bone2Length=lo.Vector3.Distance(a,l)}this._bone1.getRotationMatrixToRef(lo.Space.WORLD,e,this._bone1Mat),this.maxAngle=Math.PI,i&&(i.targetMesh&&(this.targetMesh=i.targetMesh,this.targetMesh.computeWorldMatrix(!0)),i.poleTargetMesh?(this.poleTargetMesh=i.poleTargetMesh,this.poleTargetMesh.computeWorldMatrix(!0)):i.poleTargetBone?this.poleTargetBone=i.poleTargetBone:this._bone1.getParent()&&(this.poleTargetBone=this._bone1.getParent()),i.poleTargetLocalOffset&&this.poleTargetLocalOffset.copyFrom(i.poleTargetLocalOffset),i.poleAngle&&(this.poleAngle=i.poleAngle),i.bendAxis&&this._bendAxis.copyFrom(i.bendAxis),i.maxAngle&&(this.maxAngle=i.maxAngle),i.slerpAmount&&(this.slerpAmount=i.slerpAmount))}}return Object.defineProperty(b.prototype,"maxAngle",{get:function(){return this._maxAngle},set:function(e){this._setMaxAngle(e)},enumerable:!0,configurable:!0}),b.prototype._setMaxAngle=function(e){e<0&&(e=0),(e>Math.PI||null==e)&&(e=Math.PI),this._maxAngle=e;var t=this._bone1Length,i=this._bone2Length;this._maxReach=Math.sqrt(t*t+i*i-2*t*i*Math.cos(e))},b.prototype.update=function(){var e=this._bone1;if(e){var t=this.targetPosition,i=this.poleTargetPosition,r=b._tmpMats[0],n=b._tmpMats[1];this.targetMesh&&t.copyFrom(this.targetMesh.getAbsolutePosition()),this.poleTargetBone?this.poleTargetBone.getAbsolutePositionFromLocalToRef(this.poleTargetLocalOffset,this.mesh,i):this.poleTargetMesh&&lo.Vector3.TransformCoordinatesToRef(this.poleTargetLocalOffset,this.poleTargetMesh.getWorldMatrix(),i);var o=b._tmpVecs[0],s=b._tmpVecs[1],a=b._tmpVecs[2],l=b._tmpVecs[3],c=b._tmpVecs[4],h=b._tmpQuat;e.getAbsolutePositionToRef(this.mesh,o),i.subtractToRef(o,c),0==c.x&&0==c.y&&0==c.z?c.y=1:c.normalize(),t.subtractToRef(o,l),l.normalize(),lo.Vector3.CrossToRef(l,c,s),s.normalize(),lo.Vector3.CrossToRef(l,s,a),a.normalize(),lo.Matrix.FromXYZAxesToRef(a,l,s,r);var u=this._bone1Length,d=this._bone2Length,f=lo.Vector3.Distance(o,t);0<this._maxReach&&(f=Math.min(this._maxReach,f));var p=(d*d+f*f-u*u)/(2*d*f),_=(f*f+u*u-d*d)/(2*f*u);1<p&&(p=1),1<_&&(_=1),p<-1&&(p=-1),_<-1&&(_=-1);var m=Math.acos(p),g=Math.acos(_),v=-m-g;if(this._rightHandedSystem)lo.Matrix.RotationYawPitchRollToRef(0,0,this._adjustRoll,n),n.multiplyToRef(r,r),lo.Matrix.RotationAxisToRef(this._bendAxis,g,n),n.multiplyToRef(r,r);else{var y=b._tmpVecs[5];y.copyFrom(this._bendAxis),y.x*=-1,lo.Matrix.RotationAxisToRef(y,-g,n),n.multiplyToRef(r,r)}this.poleAngle&&(lo.Matrix.RotationAxisToRef(l,this.poleAngle,n),r.multiplyToRef(n,r)),this._bone1&&(this.slerpAmount<1?(this._slerping||lo.Quaternion.FromRotationMatrixToRef(this._bone1Mat,this._bone1Quat),lo.Quaternion.FromRotationMatrixToRef(r,h),lo.Quaternion.SlerpToRef(this._bone1Quat,h,this.slerpAmount,this._bone1Quat),v=this._bone2Ang*(1-this.slerpAmount)+v*this.slerpAmount,this._bone1.setRotationQuaternion(this._bone1Quat,lo.Space.WORLD,this.mesh),this._slerping=!0):(this._bone1.setRotationMatrix(r,lo.Space.WORLD,this.mesh),this._bone1Mat.copyFrom(r),this._slerping=!1)),this._bone2.setAxisAngle(this._bendAxis,v,lo.Space.LOCAL),this._bone2Ang=v}},b._tmpVecs=[lo.Vector3.Zero(),lo.Vector3.Zero(),lo.Vector3.Zero(),lo.Vector3.Zero(),lo.Vector3.Zero(),lo.Vector3.Zero()],b._tmpQuat=lo.Quaternion.Identity(),b._tmpMats=[lo.Matrix.Identity(),lo.Matrix.Identity()],b})(),lo.BoneIKController=co,ho=$a||($a={}),uo=(function(){function C(e,t,i,r){if(this.upAxis=ho.Vector3.Up(),this.upAxisSpace=ho.Space.LOCAL,this.adjustYaw=0,this.adjustPitch=0,this.adjustRoll=0,this.slerpAmount=1,this._boneQuat=ho.Quaternion.Identity(),this._slerping=!1,this._firstFrameSkipped=!1,this._fowardAxis=ho.Vector3.Forward(),this.mesh=e,this.bone=t,this.target=i,r&&(r.adjustYaw&&(this.adjustYaw=r.adjustYaw),r.adjustPitch&&(this.adjustPitch=r.adjustPitch),r.adjustRoll&&(this.adjustRoll=r.adjustRoll),null!=r.maxYaw?this.maxYaw=r.maxYaw:this.maxYaw=Math.PI,null!=r.minYaw?this.minYaw=r.minYaw:this.minYaw=-Math.PI,null!=r.maxPitch?this.maxPitch=r.maxPitch:this.maxPitch=Math.PI,null!=r.minPitch?this.minPitch=r.minPitch:this.minPitch=-Math.PI,null!=r.slerpAmount&&(this.slerpAmount=r.slerpAmount),null!=r.upAxis&&(this.upAxis=r.upAxis),null!=r.upAxisSpace&&(this.upAxisSpace=r.upAxisSpace),null!=r.yawAxis||null!=r.pitchAxis)){var n=ho.Axis.Y,o=ho.Axis.X;null!=r.yawAxis&&(n=r.yawAxis.clone()).normalize(),null!=r.pitchAxis&&(o=r.pitchAxis.clone()).normalize();var s=ho.Vector3.Cross(o,n);this._transformYawPitch=ho.Matrix.Identity(),ho.Matrix.FromXYZAxesToRef(o,n,s,this._transformYawPitch),this._transformYawPitchInv=this._transformYawPitch.clone(),this._transformYawPitch.invert()}t.getParent()||this.upAxisSpace!=ho.Space.BONE||(this.upAxisSpace=ho.Space.LOCAL)}return Object.defineProperty(C.prototype,"minYaw",{get:function(){return this._minYaw},set:function(e){this._minYaw=e,this._minYawSin=Math.sin(e),this._minYawCos=Math.cos(e),null!=this._maxYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"maxYaw",{get:function(){return this._maxYaw},set:function(e){this._maxYaw=e,this._maxYawSin=Math.sin(e),this._maxYawCos=Math.cos(e),null!=this._minYaw&&(this._midYawConstraint=.5*this._getAngleDiff(this._minYaw,this._maxYaw)+this._minYaw,this._yawRange=this._maxYaw-this._minYaw)},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"minPitch",{get:function(){return this._minPitch},set:function(e){this._minPitch=e,this._minPitchTan=Math.tan(e)},enumerable:!0,configurable:!0}),Object.defineProperty(C.prototype,"maxPitch",{get:function(){return this._maxPitch},set:function(e){this._maxPitch=e,this._maxPitchTan=Math.tan(e)},enumerable:!0,configurable:!0}),C.prototype.update=function(){if(this.slerpAmount<1&&!this._firstFrameSkipped)this._firstFrameSkipped=!0;else{var e=this.bone,t=C._tmpVecs[0];e.getAbsolutePositionToRef(this.mesh,t);var i=this.target,r=C._tmpMats[0],n=C._tmpMats[1],o=this.mesh,s=e.getParent(),a=C._tmpVecs[1];a.copyFrom(this.upAxis),this.upAxisSpace==ho.Space.BONE&&s?(this._transformYawPitch&&ho.Vector3.TransformCoordinatesToRef(a,this._transformYawPitchInv,a),s.getDirectionToRef(a,this.mesh,a)):this.upAxisSpace==ho.Space.LOCAL&&(o.getDirectionToRef(a,a),1==o.scaling.x&&1==o.scaling.y&&1==o.scaling.z||a.normalize());var l=!1,c=!1;if(this._maxYaw==Math.PI&&this._minYaw==-Math.PI||(l=!0),this._maxPitch==Math.PI&&this._minPitch==-Math.PI||(c=!0),l||c){var h=C._tmpMats[2],u=C._tmpMats[3];if(this.upAxisSpace==ho.Space.BONE&&1==a.y&&s)s.getRotationMatrixToRef(ho.Space.WORLD,this.mesh,h);else if(this.upAxisSpace!=ho.Space.LOCAL||1!=a.y||s){(f=C._tmpVecs[2]).copyFrom(this._fowardAxis),this._transformYawPitch&&ho.Vector3.TransformCoordinatesToRef(f,this._transformYawPitchInv,f),s?s.getDirectionToRef(f,this.mesh,f):o.getDirectionToRef(f,f);var d=ho.Vector3.Cross(a,f);d.normalize();var f=ho.Vector3.Cross(d,a);ho.Matrix.FromXYZAxesToRef(d,a,f,h)}else h.copyFrom(o.getWorldMatrix());h.invertToRef(u);var p=null;if(c){var _=C._tmpVecs[3];i.subtractToRef(t,_),ho.Vector3.TransformCoordinatesToRef(_,u,_),p=Math.sqrt(_.x*_.x+_.z*_.z);var m=Math.atan2(_.y,p),g=m;m>this._maxPitch?(_.y=this._maxPitchTan*p,g=this._maxPitch):m<this._minPitch&&(_.y=this._minPitchTan*p,g=this._minPitch),m!=g&&(ho.Vector3.TransformCoordinatesToRef(_,h,_),_.addInPlace(t),i=_)}if(l){_=C._tmpVecs[4];i.subtractToRef(t,_),ho.Vector3.TransformCoordinatesToRef(_,u,_);var v=Math.atan2(_.x,_.z),y=v;if((v>this._maxYaw||v<this._minYaw)&&(null==p&&(p=Math.sqrt(_.x*_.x+_.z*_.z)),this._yawRange>Math.PI?this._isAngleBetween(v,this._maxYaw,this._midYawConstraint)?(_.z=this._maxYawCos*p,_.x=this._maxYawSin*p,y=this._maxYaw):this._isAngleBetween(v,this._midYawConstraint,this._minYaw)&&(_.z=this._minYawCos*p,_.x=this._minYawSin*p,y=this._minYaw):v>this._maxYaw?(_.z=this._maxYawCos*p,_.x=this._maxYawSin*p,y=this._maxYaw):v<this._minYaw&&(_.z=this._minYawCos*p,_.x=this._minYawSin*p,y=this._minYaw)),this._slerping&&this._yawRange>Math.PI){var b=C._tmpVecs[8];b.copyFrom(ho.Axis.Z),this._transformYawPitch&&ho.Vector3.TransformCoordinatesToRef(b,this._transformYawPitchInv,b);var T=C._tmpMats[4];this._boneQuat.toRotationMatrix(T),this.mesh.getWorldMatrix().multiplyToRef(T,T),ho.Vector3.TransformCoordinatesToRef(b,T,b),ho.Vector3.TransformCoordinatesToRef(b,u,b);var E=Math.atan2(b.x,b.z),x=this._getAngleBetween(E,v);if(this._getAngleBetween(E,this._midYawConstraint)<x){null==p&&(p=Math.sqrt(_.x*_.x+_.z*_.z));var P=this._getAngleBetween(E,this._maxYaw);y=this._getAngleBetween(E,this._minYaw)<P?E+.75*Math.PI:E-.75*Math.PI,_.z=Math.cos(y)*p,_.x=Math.sin(y)*p}}v!=y&&(ho.Vector3.TransformCoordinatesToRef(_,h,_),_.addInPlace(t),i=_)}}var A=C._tmpVecs[5],S=C._tmpVecs[6],M=C._tmpVecs[7],R=C._tmpQuat;i.subtractToRef(t,A),A.normalize(),ho.Vector3.CrossToRef(a,A,S),S.normalize(),ho.Vector3.CrossToRef(A,S,M),M.normalize(),ho.Matrix.FromXYZAxesToRef(S,M,A,r),0===S.x&&0===S.y&&0===S.z||0===M.x&&0===M.y&&0===M.z||0===A.x&&0===A.y&&0===A.z||((this.adjustYaw||this.adjustPitch||this.adjustRoll)&&(ho.Matrix.RotationYawPitchRollToRef(this.adjustYaw,this.adjustPitch,this.adjustRoll,n),n.multiplyToRef(r,r)),this.slerpAmount<1?(this._slerping||this.bone.getRotationQuaternionToRef(ho.Space.WORLD,this.mesh,this._boneQuat),this._transformYawPitch&&this._transformYawPitch.multiplyToRef(r,r),ho.Quaternion.FromRotationMatrixToRef(r,R),ho.Quaternion.SlerpToRef(this._boneQuat,R,this.slerpAmount,this._boneQuat),this.bone.setRotationQuaternion(this._boneQuat,ho.Space.WORLD,this.mesh),this._slerping=!0):(this._transformYawPitch&&this._transformYawPitch.multiplyToRef(r,r),this.bone.setRotationMatrix(r,ho.Space.WORLD,this.mesh),this._slerping=!1))}},C.prototype._getAngleDiff=function(e,t){var i=t-e;return(i%=2*Math.PI)>Math.PI?i-=2*Math.PI:i<-Math.PI&&(i+=2*Math.PI),i},C.prototype._getAngleBetween=function(e,t){var i=0;return(i=(e=(e%=2*Math.PI)<0?e+2*Math.PI:e)<(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)?t-e:e-t)>Math.PI&&(i=2*Math.PI-i),i},C.prototype._isAngleBetween=function(e,t,i){if(e=(e%=2*Math.PI)<0?e+2*Math.PI:e,(t=(t%=2*Math.PI)<0?t+2*Math.PI:t)<(i=(i%=2*Math.PI)<0?i+2*Math.PI:i)){if(t<e&&e<i)return!0}else if(i<e&&e<t)return!0;return!1},C._tmpVecs=[ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero(),ho.Vector3.Zero()],C._tmpQuat=ho.Quaternion.Identity(),C._tmpMats=[ho.Matrix.Identity(),ho.Matrix.Identity(),ho.Matrix.Identity(),ho.Matrix.Identity(),ho.Matrix.Identity()],C})(),ho.BoneLookController=uo,fo=$a||($a={}),po=(function(){function u(e,t,i){this.name=e,this.id=t,this.bones=new Array,this.needInitialSkinMatrix=!1,this._isDirty=!0,this._meshesWithPoseMatrix=new Array,this._identity=fo.Matrix.Identity(),this._ranges={},this._lastAbsoluteTransformsUpdateId=-1,this.doNotSerialize=!1,this._animationPropertiesOverride=null,this.onBeforeComputeObservable=new fo.Observable,this.bones=[],this._scene=i||fo.Engine.LastCreatedScene,i.skeletons.push(this),this._isDirty=!0}return Object.defineProperty(u.prototype,"animationPropertiesOverride",{get:function(){return this._animationPropertiesOverride?this._animationPropertiesOverride:this._scene.animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),u.prototype.getTransformMatrices=function(e){return this.needInitialSkinMatrix&&e._bonesTransformMatrices?e._bonesTransformMatrices:(this._transformMatrices||this.prepare(),this._transformMatrices)},u.prototype.getScene=function(){return this._scene},u.prototype.toString=function(e){var t="Name: "+this.name+", nBones: "+this.bones.length;if(t+=", nAnimationRanges: "+(this._ranges?Object.keys(this._ranges).length:"none"),e){t+=", Ranges: {";var i=!0;for(var r in this._ranges)i&&(t+=", ",i=!1),t+=r;t+="}"}return t},u.prototype.getBoneIndexByName=function(e){for(var t=0,i=this.bones.length;t<i;t++)if(this.bones[t].name===e)return t;return-1},u.prototype.createAnimationRange=function(e,t,i){if(!this._ranges[e]){this._ranges[e]=new fo.AnimationRange(e,t,i);for(var r=0,n=this.bones.length;r<n;r++)this.bones[r].animations[0]&&this.bones[r].animations[0].createRange(e,t,i)}},u.prototype.deleteAnimationRange=function(e,t){void 0===t&&(t=!0);for(var i=0,r=this.bones.length;i<r;i++)this.bones[i].animations[0]&&this.bones[i].animations[0].deleteRange(e,t);this._ranges[e]=null},u.prototype.getAnimationRange=function(e){return this._ranges[e]},u.prototype.getAnimationRanges=function(){var e,t=[],i=0;for(e in this._ranges)t[i]=this._ranges[e],i++;return t},u.prototype.copyAnimationRange=function(e,t,i){if(void 0===i&&(i=!1),this._ranges[t]||!e.getAnimationRange(t))return!1;var r,n,o=!0,s=this._getHighestAnimationFrame()+1,a={},l=e.bones;for(n=0,r=l.length;n<r;n++)a[l[n].name]=l[n];this.bones.length!==l.length&&(fo.Tools.Warn("copyAnimationRange: this rig has "+this.bones.length+" bones, while source as "+l.length),o=!1);var c=i&&this.dimensionsAtRest&&e.dimensionsAtRest?this.dimensionsAtRest.divide(e.dimensionsAtRest):null;for(n=0,r=this.bones.length;n<r;n++){var h=this.bones[n].name,u=a[h];u?o=o&&this.bones[n].copyAnimationRange(u,t,s,i,c):(fo.Tools.Warn("copyAnimationRange: not same rig, missing source bone "+h),o=!1)}var d=e.getAnimationRange(t);return d&&(this._ranges[t]=new fo.AnimationRange(t,d.from+s,d.to+s)),o},u.prototype.returnToRest=function(){for(var e=0;e<this.bones.length;e++)this.bones[e].returnToRest()},u.prototype._getHighestAnimationFrame=function(){for(var e=0,t=0,i=this.bones.length;t<i;t++)if(this.bones[t].animations[0]){var r=this.bones[t].animations[0].getHighestFrame();e<r&&(e=r)}return e},u.prototype.beginAnimation=function(e,t,i,r){var n=this.getAnimationRange(e);return n?this._scene.beginAnimation(this,n.from,n.to,t,i,r):null},u.prototype._markAsDirty=function(){this._isDirty=!0},u.prototype._registerMeshWithPoseMatrix=function(e){this._meshesWithPoseMatrix.push(e)},u.prototype._unregisterMeshWithPoseMatrix=function(e){var t=this._meshesWithPoseMatrix.indexOf(e);-1<t&&this._meshesWithPoseMatrix.splice(t,1)},u.prototype._computeTransformMatrices=function(e,t){this.onBeforeComputeObservable.notifyObservers(this);for(var i=0;i<this.bones.length;i++){var r=this.bones[i],n=r.getParent();if(n?r.getLocalMatrix().multiplyToRef(n.getWorldMatrix(),r.getWorldMatrix()):t?r.getLocalMatrix().multiplyToRef(t,r.getWorldMatrix()):r.getWorldMatrix().copyFrom(r.getLocalMatrix()),-1!==r._index){var o=null===r._index?i:r._index;r.getInvertedAbsoluteTransform().multiplyToArray(r.getWorldMatrix(),e,16*o)}}this._identity.copyToArray(e,16*this.bones.length)},u.prototype.prepare=function(){if(this._isDirty){if(this.needInitialSkinMatrix)for(var e=0;e<this._meshesWithPoseMatrix.length;e++){var t=this._meshesWithPoseMatrix[e],i=t.getPoseMatrix();if(t._bonesTransformMatrices&&t._bonesTransformMatrices.length===16*(this.bones.length+1)||(t._bonesTransformMatrices=new Float32Array(16*(this.bones.length+1))),this._synchronizedWithMesh!==t){this._synchronizedWithMesh=t;for(var r=0;r<this.bones.length;r++){var n=this.bones[r];if(!n.getParent())n.getBaseMatrix().multiplyToRef(i,fo.Tmp.Matrix[1]),n._updateDifferenceMatrix(fo.Tmp.Matrix[1])}}this._computeTransformMatrices(t._bonesTransformMatrices,i)}else this._transformMatrices&&this._transformMatrices.length===16*(this.bones.length+1)||(this._transformMatrices=new Float32Array(16*(this.bones.length+1))),this._computeTransformMatrices(this._transformMatrices,null);this._isDirty=!1,this._scene._activeBones.addCount(this.bones.length,!1)}},u.prototype.getAnimatables=function(){if(!this._animatables||this._animatables.length!==this.bones.length){this._animatables=[];for(var e=0;e<this.bones.length;e++)this._animatables.push(this.bones[e])}return this._animatables},u.prototype.clone=function(e,t){var i=new u(e,t||e,this._scene);i.needInitialSkinMatrix=this.needInitialSkinMatrix;for(var r=0;r<this.bones.length;r++){var n=this.bones[r],o=null,s=n.getParent();if(s){var a=this.bones.indexOf(s);o=i.bones[a]}var l=new fo.Bone(n.name,i,o,n.getBaseMatrix().clone(),n.getRestPose().clone());fo.Tools.DeepCopy(n.animations,l.animations)}if(this._ranges)for(var c in i._ranges={},this._ranges){var h=this._ranges[c];h&&(i._ranges[c]=h.clone())}return this._isDirty=!0,i},u.prototype.enableBlending=function(t){void 0===t&&(t=.01),this.bones.forEach((function(e){e.animations.forEach((function(e){e.enableBlending=!0,e.blendingSpeed=t}))}))},u.prototype.dispose=function(){this._meshesWithPoseMatrix=[],this.getScene().stopAnimation(this),this.getScene().removeSkeleton(this)},u.prototype.serialize=function(){var e={};e.name=this.name,e.id=this.id,this.dimensionsAtRest&&(e.dimensionsAtRest=this.dimensionsAtRest.asArray()),e.bones=[],e.needInitialSkinMatrix=this.needInitialSkinMatrix;for(var t=0;t<this.bones.length;t++){var i=this.bones[t],r=i.getParent(),n={parentBoneIndex:r?this.bones.indexOf(r):-1,name:i.name,matrix:i.getBaseMatrix().toArray(),rest:i.getRestPose().toArray()};for(var o in e.bones.push(n),i.length&&(n.length=i.length),i.metadata&&(n.metadata=i.metadata),i.animations&&0<i.animations.length&&(n.animation=i.animations[0].serialize()),e.ranges=[],this._ranges){var s=this._ranges[o];if(s){var a={};a.name=o,a.from=s.from,a.to=s.to,e.ranges.push(a)}}}return e},u.Parse=function(e,t){var i,r=new u(e.name,e.id,t);for(e.dimensionsAtRest&&(r.dimensionsAtRest=fo.Vector3.FromArray(e.dimensionsAtRest)),r.needInitialSkinMatrix=e.needInitialSkinMatrix,i=0;i<e.bones.length;i++){var n=e.bones[i],o=null;-1<n.parentBoneIndex&&(o=r.bones[n.parentBoneIndex]);var s=n.rest?fo.Matrix.FromArray(n.rest):null,a=new fo.Bone(n.name,r,o,fo.Matrix.FromArray(n.matrix),s);void 0!==n.id&&null!==n.id&&(a.id=n.id),n.length&&(a.length=n.length),n.metadata&&(a.metadata=n.metadata),n.animation&&a.animations.push(fo.Animation.Parse(n.animation))}if(e.ranges)for(i=0;i<e.ranges.length;i++){var l=e.ranges[i];r.createAnimationRange(l.name,l.from,l.to)}return r},u.prototype.computeAbsoluteTransforms=function(e){void 0===e&&(e=!1);var t=this._scene.getRenderId();(this._lastAbsoluteTransformsUpdateId!=t||e)&&(this.bones[0].computeAbsoluteTransforms(),this._lastAbsoluteTransformsUpdateId=t)},u.prototype.getPoseMatrix=function(){var e=null;return 0<this._meshesWithPoseMatrix.length&&(e=this._meshesWithPoseMatrix[0].getPoseMatrix()),e},u.prototype.sortBones=function(){for(var e=new Array,t=new Array(this.bones.length),i=0;i<this.bones.length;i++)this._sortBones(i,e,t);this.bones=e},u.prototype._sortBones=function(e,t,i){if(!i[e]){i[e]=!0;var r=this.bones[e];void 0===r._index&&(r._index=e);var n=r.getParent();n&&this._sortBones(this.bones.indexOf(n),t,i),t.push(r)}},u})(),fo.Skeleton=po,_o=$a||($a={}),mo=(function(){function e(){}return e.Ldexp=function(e,t){return 1023<t?e*Math.pow(2,1023)*Math.pow(2,t-1023):t<-1074?e*Math.pow(2,-1074)*Math.pow(2,t+1074):e*Math.pow(2,t)},e.Rgbe2float=function(e,t,i,r,n,o){0<n?(n=this.Ldexp(1,n-136),e[o+0]=t*n,e[o+1]=i*n,e[o+2]=r*n):(e[o+0]=0,e[o+1]=0,e[o+2]=0)},e.readStringLine=function(e,t){for(var i="",r="",n=t;n<e.length-t&&"\n"!=(r=String.fromCharCode(e[n]));n++)i+=r;return i},e.RGBE_ReadHeader=function(e){var t,i,r=this.readStringLine(e,0);if("#"!=r[0]||"?"!=r[1])throw"Bad HDR Format.";for(var n=!1,o=!1,s=0;s+=r.length+1,"FORMAT=32-bit_rle_rgbe"==(r=this.readStringLine(e,s))?o=!0:0==r.length&&(n=!0),!n;);if(!o)throw"HDR Bad header format, unsupported FORMAT";s+=r.length+1,r=this.readStringLine(e,s);var a=/^\-Y (.*) \+X (.*)$/g.exec(r);if(!a||a.length<3)throw"HDR Bad header format, no size";if(i=parseInt(a[2]),t=parseInt(a[1]),i<8||32767<i)throw"HDR Bad header format, unsupported size";return{height:t,width:i,dataPosition:s+=r.length+1}},e.GetCubeMapTextureData=function(e,t){var i=new Uint8Array(e),r=this.RGBE_ReadHeader(i),n=this.RGBE_ReadPixels_RLE(i,r);return _o.PanoramaToCubeMapTools.ConvertPanoramaToCubemap(n,r.width,r.height,t)},e.RGBE_ReadPixels=function(e,t){return this.RGBE_ReadPixels_RLE(e,t)},e.RGBE_ReadPixels_RLE=function(e,t){for(var i,r,n,o,s,a=t.height,l=t.width,c=t.dataPosition,h=0,u=0,d=0,f=new ArrayBuffer(4*l),p=new Uint8Array(f),_=new ArrayBuffer(t.width*t.height*4*3),m=new Float32Array(_);0<a;){if(i=e[c++],r=e[c++],n=e[c++],o=e[c++],2!=i||2!=r||128&n)throw"HDR Bad header format, not RLE";if((n<<8|o)!=l)throw"HDR Bad header format, wrong scan line width";for(d=h=0;d<4;d++)for(u=(d+1)*l;h<u;)if(i=e[c++],r=e[c++],128<i){if(0==(s=i-128)||u-h<s)throw"HDR Bad Format, bad scanline data (run)";for(;0<s--;)p[h++]=r}else{if(0==(s=i)||u-h<s)throw"HDR Bad Format, bad scanline data (non-run)";if(p[h++]=r,0<--s)for(var g=0;g<s;g++)p[h++]=e[c++]}for(d=0;d<l;d++)i=p[d],r=p[d+l],n=p[d+2*l],o=p[d+3*l],this.Rgbe2float(m,i,r,n,o,(t.height-a)*l*3+3*d);a--}return m},e})(),_o.HDRTools=mo,go=$a||($a={}),vo=(function(h){function m(e,t,i,r,n,o,s,a,l){void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=!1),void 0===a&&(a=null),void 0===l&&(l=null);var c=h.call(this,t)||this;return c._generateHarmonics=!0,c._onLoad=null,c._onError=null,c.coordinatesMode=go.Texture.CUBIC_MODE,c._isBlocking=!0,c._rotationY=0,c.boundingBoxPosition=go.Vector3.Zero(),e&&(c.name=e,c.url=e,c.hasAlpha=!1,c.isCube=!0,c._textureMatrix=go.Matrix.Identity(),c._onLoad=a,c._onError=l,c.gammaSpace=o,c._noMipmap=r,c._size=i,c._texture=c._getFromCache(e,c._noMipmap),c._texture||(t.useDelayedTextureLoading?c.delayLoadState=go.Engine.DELAYLOADSTATE_NOTLOADED:c.loadTexture())),c}return T(m,h),Object.defineProperty(m.prototype,"isBlocking",{get:function(){return this._isBlocking},set:function(e){this._isBlocking=e},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"rotationY",{get:function(){return this._rotationY},set:function(e){this._rotationY=e,this.setReflectionTextureMatrix(go.Matrix.RotationY(this._rotationY))},enumerable:!0,configurable:!0}),Object.defineProperty(m.prototype,"boundingBoxSize",{get:function(){return this._boundingBoxSize},set:function(e){if(!this._boundingBoxSize||!this._boundingBoxSize.equals(e)){this._boundingBoxSize=e;var t=this.getScene();t&&t.markAllMaterialsAsDirty(go.Material.TextureDirtyFlag)}},enumerable:!0,configurable:!0}),m.prototype.loadTexture=function(){var _=this,e=this.getScene();e&&(this._texture=e.getEngine().createRawCubeTextureFromUrl(this.url,e,this._size,go.Engine.TEXTUREFORMAT_RGB,e.getEngine().getCaps().textureFloat?go.Engine.TEXTURETYPE_FLOAT:go.Engine.TEXTURETYPE_UNSIGNED_INT,this._noMipmap,(function(e){_.lodGenerationOffset=0,_.lodGenerationScale=.8;var t=_.getScene();if(!t)return null;var i=go.HDRTools.GetCubeMapTextureData(e,_._size);if(_._generateHarmonics){var r=go.CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial(i);_.sphericalPolynomial=r}for(var n=[],o=null,s=0;s<6;s++){if(!t.getEngine().getCaps().textureFloat){var a=new ArrayBuffer(_._size*_._size*3);o=new Uint8Array(a)}var l=i[m._facesMapping[s]];if(_.gammaSpace||o)for(var c=0;c<_._size*_._size;c++)if(_.gammaSpace&&(l[3*c+0]=Math.pow(l[3*c+0],go.ToGammaSpace),l[3*c+1]=Math.pow(l[3*c+1],go.ToGammaSpace),l[3*c+2]=Math.pow(l[3*c+2],go.ToGammaSpace)),o){var h=Math.max(255*l[3*c+0],0),u=Math.max(255*l[3*c+1],0),d=Math.max(255*l[3*c+2],0),f=Math.max(Math.max(h,u),d);if(255<f){var p=255/f;h*=p,u*=p,d*=p}o[3*c+0]=h,o[3*c+1]=u,o[3*c+2]=d}o?n.push(o):n.push(l)}return n}),null,this._onLoad,this._onError))},m.prototype.clone=function(){var e=this.getScene();if(!e)return this;var t=new m(this.url,e,this._size,this._noMipmap,this._generateHarmonics,this.gammaSpace);return t.level=this.level,t.wrapU=this.wrapU,t.wrapV=this.wrapV,t.coordinatesIndex=this.coordinatesIndex,t.coordinatesMode=this.coordinatesMode,t},m.prototype.delayLoad=function(){this.delayLoadState===go.Engine.DELAYLOADSTATE_NOTLOADED&&(this.delayLoadState=go.Engine.DELAYLOADSTATE_LOADED,this._texture=this._getFromCache(this.url,this._noMipmap),this._texture||this.loadTexture())},m.prototype.getReflectionTextureMatrix=function(){return this._textureMatrix},m.prototype.setReflectionTextureMatrix=function(e){this._textureMatrix=e},m.Parse=function(e,t,i){var r=null;return e.name&&!e.isRenderTarget&&((r=new m(i+e.name,t,e.size,e.noMipmap,e.generateHarmonics,e.useInGammaSpace)).name=e.name,r.hasAlpha=e.hasAlpha,r.level=e.level,r.coordinatesMode=e.coordinatesMode,r.isBlocking=e.isBlocking),r&&(e.boundingBoxPosition&&(r.boundingBoxPosition=go.Vector3.FromArray(e.boundingBoxPosition)),e.boundingBoxSize&&(r.boundingBoxSize=go.Vector3.FromArray(e.boundingBoxSize)),e.rotationY&&(r.rotationY=e.rotationY)),r},m.prototype.serialize=function(){if(!this.name)return null;var e={};return e.name=this.name,e.hasAlpha=this.hasAlpha,e.isCube=!0,e.level=this.level,e.size=this._size,e.coordinatesMode=this.coordinatesMode,e.useInGammaSpace=this.gammaSpace,e.generateHarmonics=this._generateHarmonics,e.customType="BABYLON.HDRCubeTexture",e.noMipmap=this._noMipmap,e.isBlocking=this._isBlocking,e.rotationY=this._rotationY,e},m._facesMapping=["right","left","up","down","front","back"],m})(go.BaseTexture),go.HDRCubeTexture=vo,yo=$a||($a={}),bo=(function(){function e(){}return e.ConvertPanoramaToCubemap=function(e,t,i,r){if(!e)throw"ConvertPanoramaToCubemap: input cannot be null";if(e.length!=t*i*3)throw"ConvertPanoramaToCubemap: input size is wrong";return{front:this.CreateCubemapTexture(r,this.FACE_FRONT,e,t,i),back:this.CreateCubemapTexture(r,this.FACE_BACK,e,t,i),left:this.CreateCubemapTexture(r,this.FACE_LEFT,e,t,i),right:this.CreateCubemapTexture(r,this.FACE_RIGHT,e,t,i),up:this.CreateCubemapTexture(r,this.FACE_UP,e,t,i),down:this.CreateCubemapTexture(r,this.FACE_DOWN,e,t,i),size:r,type:yo.Engine.TEXTURETYPE_FLOAT,format:yo.Engine.TEXTUREFORMAT_RGB,gammaSpace:!1}},e.CreateCubemapTexture=function(e,t,i,r,n){for(var o=new ArrayBuffer(e*e*4*3),s=new Float32Array(o),a=t[1].subtract(t[0]).scale(1/e),l=t[3].subtract(t[2]).scale(1/e),c=1/e,h=0,u=0;u<e;u++){for(var d=t[0],f=t[2],p=0;p<e;p++){var _=f.subtract(d).scale(h).add(d);_.normalize();var m=this.CalcProjectionSpherical(_,i,r,n);s[u*e*3+3*p+0]=m.r,s[u*e*3+3*p+1]=m.g,s[u*e*3+3*p+2]=m.b,d=d.add(a),f=f.add(l)}h+=c}return s},e.CalcProjectionSpherical=function(e,t,i,r){for(var n=Math.atan2(e.z,e.x),o=Math.acos(e.y);n<-Math.PI;)n+=2*Math.PI;for(;n>Math.PI;)n-=2*Math.PI;var s=n/Math.PI,a=o/Math.PI;s=.5*s+.5;var l=Math.round(s*i);l<0?l=0:i<=l&&(l=i-1);var c=Math.round(a*r);c<0?c=0:r<=c&&(c=r-1);var h=r-c-1;return{r:t[h*i*3+3*l+0],g:t[h*i*3+3*l+1],b:t[h*i*3+3*l+2]}},e.FACE_FRONT=[new yo.Vector3(-1,-1,-1),new yo.Vector3(1,-1,-1),new yo.Vector3(-1,1,-1),new yo.Vector3(1,1,-1)],e.FACE_BACK=[new yo.Vector3(1,-1,1),new yo.Vector3(-1,-1,1),new yo.Vector3(1,1,1),new yo.Vector3(-1,1,1)],e.FACE_RIGHT=[new yo.Vector3(1,-1,-1),new yo.Vector3(1,-1,1),new yo.Vector3(1,1,-1),new yo.Vector3(1,1,1)],e.FACE_LEFT=[new yo.Vector3(-1,-1,1),new yo.Vector3(-1,-1,-1),new yo.Vector3(-1,1,1),new yo.Vector3(-1,1,-1)],e.FACE_DOWN=[new yo.Vector3(-1,1,-1),new yo.Vector3(1,1,-1),new yo.Vector3(-1,1,1),new yo.Vector3(1,1,1)],e.FACE_UP=[new yo.Vector3(-1,-1,1),new yo.Vector3(1,-1,1),new yo.Vector3(-1,-1,-1),new yo.Vector3(1,-1,-1)],e})(),yo.PanoramaToCubeMapTools=bo,(function(g){var n=(function(r){function e(e,t){var i=r.call(this,e.x,e.y)||this;return i.index=t,i}return T(e,r),e})(g.Vector2),o=(function(){function e(){this.elements=new Array}return e.prototype.add=function(e){var i=this,r=new Array;return e.forEach((function(e){if(0===r.length||!e.equalsWithEpsilon(r[0])){var t=new n(e,i.elements.length);r.push(t),i.elements.push(t)}})),r},e.prototype.computeBounds=function(){var t=new g.Vector2(this.elements[0].x,this.elements[0].y),i=new g.Vector2(this.elements[0].x,this.elements[0].y);return this.elements.forEach((function(e){e.x<t.x?t.x=e.x:e.x>i.x&&(i.x=e.x),e.y<t.y?t.y=e.y:e.y>i.y&&(i.y=e.y)})),{min:t,max:i,width:i.x-t.x,height:i.y-t.y}},e})(),e=(function(){function e(){}return e.Rectangle=function(e,t,i,r){return[new g.Vector2(e,t),new g.Vector2(i,t),new g.Vector2(i,r),new g.Vector2(e,r)]},e.Circle=function(e,t,i,r){void 0===t&&(t=0),void 0===i&&(i=0),void 0===r&&(r=32);for(var n=new Array,o=0,s=2*Math.PI/r,a=0;a<r;a++)n.push(new g.Vector2(t+Math.cos(o)*e,i+Math.sin(o)*e)),o-=s;return n},e.Parse=function(e){var t,i=e.split(/[^-+eE\.\d]+/).map(parseFloat).filter((function(e){return!isNaN(e)})),r=[];for(t=0;t<(2147483646&i.length);t+=2)r.push(new g.Vector2(i[t],i[t+1]));return r},e.StartingAt=function(e,t){return g.Path2.StartingAt(e,t)},e})();g.Polygon=e;var t=(function(){function e(e,t,i){var r;this._points=new o,this._outlinepoints=new o,this._holes=new Array,this._epoints=new Array,this._eholes=new Array,this._name=e,this._scene=i,r=t instanceof g.Path2?t.getPoints():t,this._addToepoint(r),this._points.add(r),this._outlinepoints.add(r),void 0===m&&g.Tools.Warn("Earcut was not found, the polygon will not be built.")}return e.prototype._addToepoint=function(e){for(var t=0,i=e;t<i.length;t++){var r=i[t];this._epoints.push(r.x,r.y)}},e.prototype.addHole=function(e){this._points.add(e);var t=new o;return t.add(e),this._holes.push(t),this._eholes.push(this._epoints.length/2),this._addToepoint(e),this},e.prototype.build=function(e,t){var i=this;void 0===e&&(e=!1),void 0===t&&(t=0);var r=new g.Mesh(this._name,this._scene),n=new Array,o=new Array,s=new Array,a=this._points.computeBounds();this._points.elements.forEach((function(e){n.push(0,1,0),o.push(e.x,0,e.y),s.push((e.x-a.min.x)/a.width,(e.y-a.min.y)/a.height)}));for(var l=new Array,c=m(this._epoints,this._eholes,2),h=0;h<c.length;h++)l.push(c[h]);if(0<t){var u=o.length/3;this._points.elements.forEach((function(e){n.push(0,-1,0),o.push(e.x,-t,e.y),s.push(1-(e.x-a.min.x)/a.width,1-(e.y-a.min.y)/a.height)}));var d=l.length;for(h=0;h<d;h+=3){var f=l[h+0],p=l[h+1],_=l[h+2];l.push(_+u),l.push(p+u),l.push(f+u)}this.addSide(o,n,s,l,a,this._outlinepoints,t,!1),this._holes.forEach((function(e){i.addSide(o,n,s,l,a,e,t,!0)}))}return r.setVerticesData(g.VertexBuffer.PositionKind,o,e),r.setVerticesData(g.VertexBuffer.NormalKind,n,e),r.setVerticesData(g.VertexBuffer.UVKind,s,e),r.setIndices(l),r},e.prototype.addSide=function(e,t,i,r,n,o,s,a){for(var l=e.length/3,c=0,h=0;h<o.elements.length;h++){var u,d=o.elements[h];u=h+1>o.elements.length-1?o.elements[0]:o.elements[h+1],e.push(d.x,0,d.y),e.push(d.x,-s,d.y),e.push(u.x,0,u.y),e.push(u.x,-s,u.y);var f=new g.Vector3(d.x,0,d.y),p=new g.Vector3(u.x,0,u.y).subtract(f),_=new g.Vector3(0,1,0),m=g.Vector3.Cross(p,_);m=m.normalize(),i.push(c/n.width,0),i.push(c/n.width,1),c+=p.length(),i.push(c/n.width,0),i.push(c/n.width,1),a?(t.push(m.x,m.y,m.z),t.push(m.x,m.y,m.z),t.push(m.x,m.y,m.z),t.push(m.x,m.y,m.z),r.push(l),r.push(l+2),r.push(l+1),r.push(l+1),r.push(l+2),r.push(l+3)):(t.push(-m.x,-m.y,-m.z),t.push(-m.x,-m.y,-m.z),t.push(-m.x,-m.y,-m.z),t.push(-m.x,-m.y,-m.z),r.push(l),r.push(l+1),r.push(l+2),r.push(l+1),r.push(l+3),r.push(l+2)),l+=4}},e})();g.PolygonMeshBuilder=t})($a||($a={})),To=$a||($a={}),Eo=0,xo=(function(){function i(e,t,i){this.pos=e,this.normal=t,this.uv=i}return i.prototype.clone=function(){return new i(this.pos.clone(),this.normal.clone(),this.uv.clone())},i.prototype.flip=function(){this.normal=this.normal.scale(-1)},i.prototype.interpolate=function(e,t){return new i(To.Vector3.Lerp(this.pos,e.pos,t),To.Vector3.Lerp(this.normal,e.normal,t),To.Vector2.Lerp(this.uv,e.uv,t))},i})(),Po=(function(){function y(e,t){this.normal=e,this.w=t}return y.FromPoints=function(e,t,i){var r=i.subtract(e),n=t.subtract(e);if(0===r.lengthSquared()||0===n.lengthSquared())return null;var o=To.Vector3.Normalize(To.Vector3.Cross(r,n));return new y(o,To.Vector3.Dot(o,e))},y.prototype.clone=function(){return new y(this.normal.clone(),this.w)},y.prototype.flip=function(){this.normal.scaleInPlace(-1),this.w=-this.w},y.prototype.splitPolygon=function(e,t,i,r,n){var o,s,a=0,l=[];for(o=0;o<e.vertices.length;o++){var c=(s=To.Vector3.Dot(this.normal,e.vertices[o].pos)-this.w)<-y.EPSILON?2:y.EPSILON<s?1:0;a|=c,l.push(c)}switch(a){case 0:(0<To.Vector3.Dot(this.normal,e.plane.normal)?t:i).push(e);break;case 1:r.push(e);break;case 2:n.push(e);break;case 3:var h,u=[],d=[];for(o=0;o<e.vertices.length;o++){var f=(o+1)%e.vertices.length,p=l[o],_=l[f],m=e.vertices[o],g=e.vertices[f];if(2!==p&&u.push(m),1!==p&&d.push(2!==p?m.clone():m),3==(p|_)){s=(this.w-To.Vector3.Dot(this.normal,m.pos))/To.Vector3.Dot(this.normal,g.pos.subtract(m.pos));var v=m.interpolate(g,s);u.push(v),d.push(v.clone())}}3<=u.length&&(h=new Ao(u,e.shared)).plane&&r.push(h),3<=d.length&&(h=new Ao(d,e.shared)).plane&&n.push(h)}},y.EPSILON=1e-5,y})(),Ao=(function(){function e(e,t){this.vertices=e,this.shared=t,this.plane=Po.FromPoints(e[0].pos,e[1].pos,e[2].pos)}return e.prototype.clone=function(){return new e(this.vertices.map((function(e){return e.clone()})),this.shared)},e.prototype.flip=function(){this.vertices.reverse().map((function(e){e.flip()})),this.plane.flip()},e})(),So=(function(){function n(e){this.plane=null,this.front=null,this.back=null,this.polygons=new Array,e&&this.build(e)}return n.prototype.clone=function(){var e=new n;return e.plane=this.plane&&this.plane.clone(),e.front=this.front&&this.front.clone(),e.back=this.back&&this.back.clone(),e.polygons=this.polygons.map((function(e){return e.clone()})),e},n.prototype.invert=function(){for(var e=0;e<this.polygons.length;e++)this.polygons[e].flip();this.plane&&this.plane.flip(),this.front&&this.front.invert(),this.back&&this.back.invert();var t=this.front;this.front=this.back,this.back=t},n.prototype.clipPolygons=function(e){if(!this.plane)return e.slice();for(var t=new Array,i=new Array,r=0;r<e.length;r++)this.plane.splitPolygon(e[r],t,i,t,i);return this.front&&(t=this.front.clipPolygons(t)),i=this.back?this.back.clipPolygons(i):[],t.concat(i)},n.prototype.clipTo=function(e){this.polygons=e.clipPolygons(this.polygons),this.front&&this.front.clipTo(e),this.back&&this.back.clipTo(e)},n.prototype.allPolygons=function(){var e=this.polygons.slice();return this.front&&(e=e.concat(this.front.allPolygons())),this.back&&(e=e.concat(this.back.allPolygons())),e},n.prototype.build=function(e){if(e.length){this.plane||(this.plane=e[0].plane.clone());for(var t=new Array,i=new Array,r=0;r<e.length;r++)this.plane.splitPolygon(e[r],this.polygons,this.polygons,t,i);t.length&&(this.front||(this.front=new n),this.front.build(t)),i.length&&(this.back||(this.back=new n),this.back.build(i))}},n})(),Mo=(function(){function S(){this.polygons=new Array}return S.FromMesh=function(e){var t,i,r,n,o,s,a,l,c,h,u=new Array,d=null;if(!(e instanceof To.Mesh))throw"BABYLON.CSG: Wrong Mesh type, must be BABYLON.Mesh";e.computeWorldMatrix(!0),a=e.getWorldMatrix(),l=e.position.clone(),c=e.rotation.clone(),e.rotationQuaternion&&(d=e.rotationQuaternion.clone()),h=e.scaling.clone();for(var f=e.getIndices(),p=e.getVerticesData(To.VertexBuffer.PositionKind),_=e.getVerticesData(To.VertexBuffer.NormalKind),m=e.getVerticesData(To.VertexBuffer.UVKind),g=e.subMeshes,v=0,y=g.length;v<y;v++)for(var b=g[v].indexStart,T=g[v].indexCount+g[v].indexStart;b<T;b+=3){s=[];for(var E=0;E<3;E++){var x=new To.Vector3(_[3*f[b+E]],_[3*f[b+E]+1],_[3*f[b+E]+2]);r=new To.Vector2(m[2*f[b+E]],m[2*f[b+E]+1]);var P=new To.Vector3(p[3*f[b+E]],p[3*f[b+E]+1],p[3*f[b+E]+2]);n=To.Vector3.TransformCoordinates(P,a),i=To.Vector3.TransformNormal(x,a),t=new xo(n,i,r),s.push(t)}(o=new Ao(s,{subMeshId:v,meshId:Eo,materialIndex:g[v].materialIndex})).plane&&u.push(o)}var A=S.FromPolygons(u);return A.matrix=a,A.position=l,A.rotation=c,A.scaling=h,A.rotationQuaternion=d,Eo++,A},S.FromPolygons=function(e){var t=new S;return t.polygons=e,t},S.prototype.clone=function(){var e=new S;return e.polygons=this.polygons.map((function(e){return e.clone()})),e.copyTransformAttributes(this),e},S.prototype.union=function(e){var t=new So(this.clone().polygons),i=new So(e.clone().polygons);return t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),S.FromPolygons(t.allPolygons()).copyTransformAttributes(this)},S.prototype.unionInPlace=function(e){var t=new So(this.polygons),i=new So(e.polygons);t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),this.polygons=t.allPolygons()},S.prototype.subtract=function(e){var t=new So(this.clone().polygons),i=new So(e.clone().polygons);return t.invert(),t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),t.invert(),S.FromPolygons(t.allPolygons()).copyTransformAttributes(this)},S.prototype.subtractInPlace=function(e){var t=new So(this.polygons),i=new So(e.polygons);t.invert(),t.clipTo(i),i.clipTo(t),i.invert(),i.clipTo(t),i.invert(),t.build(i.allPolygons()),t.invert(),this.polygons=t.allPolygons()},S.prototype.intersect=function(e){var t=new So(this.clone().polygons),i=new So(e.clone().polygons);return t.invert(),i.clipTo(t),i.invert(),t.clipTo(i),i.clipTo(t),t.build(i.allPolygons()),t.invert(),S.FromPolygons(t.allPolygons()).copyTransformAttributes(this)},S.prototype.intersectInPlace=function(e){var t=new So(this.polygons),i=new So(e.polygons);t.invert(),i.clipTo(t),i.invert(),t.clipTo(i),i.clipTo(t),t.build(i.allPolygons()),t.invert(),this.polygons=t.allPolygons()},S.prototype.inverse=function(){var e=this.clone();return e.inverseInPlace(),e},S.prototype.inverseInPlace=function(){this.polygons.map((function(e){e.flip()}))},S.prototype.copyTransformAttributes=function(e){return this.matrix=e.matrix,this.position=e.position,this.rotation=e.rotation,this.scaling=e.scaling,this.rotationQuaternion=e.rotationQuaternion,this},S.prototype.buildMeshGeometry=function(e,t,i){var r=this.matrix.clone();r.invert();var n,o,s,a=new To.Mesh(e,t),l=[],c=[],h=[],u=[],d=To.Vector3.Zero(),f=To.Vector3.Zero(),p=To.Vector2.Zero(),_=this.polygons,m=[0,0,0],g={},v=0,y={};i&&_.sort((function(e,t){return e.shared.meshId===t.shared.meshId?e.shared.subMeshId-t.shared.subMeshId:e.shared.meshId-t.shared.meshId}));for(var b=0,T=_.length;b<T;b++){y[(n=_[b]).shared.meshId]||(y[n.shared.meshId]={}),y[n.shared.meshId][n.shared.subMeshId]||(y[n.shared.meshId][n.shared.subMeshId]={indexStart:1/0,indexEnd:-1/0,materialIndex:n.shared.materialIndex}),s=y[n.shared.meshId][n.shared.subMeshId];for(var E=2,x=n.vertices.length;E<x;E++){m[0]=0,m[1]=E-1,m[2]=E;for(var P=0;P<3;P++){d.copyFrom(n.vertices[m[P]].pos),f.copyFrom(n.vertices[m[P]].normal),p.copyFrom(n.vertices[m[P]].uv);var A=To.Vector3.TransformCoordinates(d,r),S=To.Vector3.TransformNormal(f,r);void 0!==(o=g[A.x+","+A.y+","+A.z])&&h[3*o]===S.x&&h[3*o+1]===S.y&&h[3*o+2]===S.z&&u[2*o]===p.x&&u[2*o+1]===p.y||(l.push(A.x,A.y,A.z),u.push(p.x,p.y),h.push(f.x,f.y,f.z),o=g[A.x+","+A.y+","+A.z]=l.length/3-1),c.push(o),s.indexStart=Math.min(v,s.indexStart),s.indexEnd=Math.max(v,s.indexEnd),v++}}}if(a.setVerticesData(To.VertexBuffer.PositionKind,l),a.setVerticesData(To.VertexBuffer.NormalKind,h),a.setVerticesData(To.VertexBuffer.UVKind,u),a.setIndices(c,null),i){var M,R=0;for(var C in a.subMeshes=new Array,y){for(var O in M=-1,y[C])s=y[C][O],To.SubMesh.CreateFromIndices(s.materialIndex+R,s.indexStart,s.indexEnd-s.indexStart+1,a),M=Math.max(s.materialIndex,M);R+=++M}}return a},S.prototype.toMesh=function(e,t,i,r){var n=this.buildMeshGeometry(e,i,r);return n.material=t,n.position.copyFrom(this.position),n.rotation.copyFrom(this.rotation),this.rotationQuaternion&&(n.rotationQuaternion=this.rotationQuaternion.clone()),n.scaling.copyFrom(this.scaling),n.computeWorldMatrix(!0),n},S})(),To.CSG=Mo,Ro=$a||($a={}),Co=(function(){function o(e,t,i,r,n){this.size=e,this.position=t,this.alphaMode=Ro.Engine.ALPHA_ONEONE,this.color=i||new Ro.Color3(1,1,1),this.texture=r?new Ro.Texture(r,n.getScene(),!0):null,(this._system=n).lensFlares.push(this)}return o.AddFlare=function(e,t,i,r,n){return new o(e,t,i,r,n)},o.prototype.dispose=function(){this.texture&&this.texture.dispose();var e=this._system.lensFlares.indexOf(this);this._system.lensFlares.splice(e,1)},o})(),Ro.LensFlare=Co,(function(l){l.AbstractScene.AddParser(l.SceneComponentConstants.NAME_LENSFLARESYSTEM,(function(e,t,i,r){if(void 0!==e.lensFlareSystems&&null!==e.lensFlareSystems){i.lensFlareSystems||(i.lensFlareSystems=new Array);for(var n=0,o=e.lensFlareSystems.length;n<o;n++){var s=e.lensFlareSystems[n],a=l.LensFlareSystem.Parse(s,t,r);i.lensFlareSystems.push(a)}}})),l.AbstractScene.prototype.getLensFlareSystemByName=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].name===e)return this.lensFlareSystems[t];return null},l.AbstractScene.prototype.getLensFlareSystemByID=function(e){for(var t=0;t<this.lensFlareSystems.length;t++)if(this.lensFlareSystems[t].id===e)return this.lensFlareSystems[t];return null},l.AbstractScene.prototype.removeLensFlareSystem=function(e){var t=this.lensFlareSystems.indexOf(e);return-1!==t&&this.lensFlareSystems.splice(t,1),t},l.AbstractScene.prototype.addLensFlareSystem=function(e){this.lensFlareSystems.push(e)};var e=(function(){function e(e){this.name=l.SceneComponentConstants.NAME_LENSFLARESYSTEM,(this.scene=e).lensFlareSystems=new Array}return e.prototype.register=function(){this.scene._afterCameraDrawStage.registerStep(l.SceneComponentConstants.STEP_AFTERCAMERADRAW_LENSFLARESYSTEM,this,this._draw)},e.prototype.rebuild=function(){},e.prototype.addFromContainer=function(e){var t=this;e.lensFlareSystems&&e.lensFlareSystems.forEach((function(e){t.scene.addLensFlareSystem(e)}))},e.prototype.removeFromContainer=function(e){var t=this;e.lensFlareSystems&&e.lensFlareSystems.forEach((function(e){t.scene.removeLensFlareSystem(e)}))},e.prototype.serialize=function(e){e.lensFlareSystems=[];for(var t=0,i=this.scene.lensFlareSystems;t<i.length;t++){var r=i[t];e.lensFlareSystems.push(r.serialize())}},e.prototype.dispose=function(){for(var e=this.scene.lensFlareSystems;e.length;)e[0].dispose()},e.prototype._draw=function(e){if(this.scene.lensFlaresEnabled){var t=this.scene.lensFlareSystems;l.Tools.StartPerformanceCounter("Lens flares",0<t.length);for(var i=0,r=t;i<r.length;i++){var n=r[i];0!=(e.layerMask&n.layerMask)&&n.render()}l.Tools.EndPerformanceCounter("Lens flares",0<t.length)}},e})();l.LensFlareSystemSceneComponent=e})($a||($a={})),Oo=$a||($a={}),Do=(function(){function l(e,t,i){this.name=e,this.lensFlares=new Array,this.borderLimit=300,this.viewportBorder=0,this.layerMask=268435455,this._vertexBuffers={},this._isEnabled=!0,this._scene=i||Oo.Engine.LastCreatedScene;var r=this._scene._getComponent(Oo.SceneComponentConstants.NAME_LENSFLARESYSTEM);r||(r=new Oo.LensFlareSystemSceneComponent(this._scene),i._addComponent(r)),this._emitter=t,this.id=e,i.lensFlareSystems.push(this),this.meshesSelectionPredicate=function(e){return i.activeCamera&&e.material&&e.isVisible&&e.isEnabled()&&e.isBlocker&&0!=(e.layerMask&i.activeCamera.layerMask)};var n=i.getEngine(),o=[];o.push(1,1),o.push(-1,1),o.push(-1,-1),o.push(1,-1),this._vertexBuffers[Oo.VertexBuffer.PositionKind]=new Oo.VertexBuffer(n,o,Oo.VertexBuffer.PositionKind,!1,!1,2);var s=[];s.push(0),s.push(1),s.push(2),s.push(0),s.push(2),s.push(3),this._indexBuffer=n.createIndexBuffer(s),this._effect=n.createEffect("lensFlare",[Oo.VertexBuffer.PositionKind],["color","viewportMatrix"],["textureSampler"],"")}return Object.defineProperty(l.prototype,"isEnabled",{get:function(){return this._isEnabled},set:function(e){this._isEnabled=e},enumerable:!0,configurable:!0}),l.prototype.getScene=function(){return this._scene},l.prototype.getEmitter=function(){return this._emitter},l.prototype.setEmitter=function(e){this._emitter=e},l.prototype.getEmitterPosition=function(){return this._emitter.getAbsolutePosition?this._emitter.getAbsolutePosition():this._emitter.position},l.prototype.computeEffectivePosition=function(e){var t=this.getEmitterPosition();return t=Oo.Vector3.Project(t,Oo.Matrix.Identity(),this._scene.getTransformMatrix(),e),this._positionX=t.x,this._positionY=t.y,t=Oo.Vector3.TransformCoordinates(this.getEmitterPosition(),this._scene.getViewMatrix()),0<this.viewportBorder&&(e.x-=this.viewportBorder,e.y-=this.viewportBorder,e.width+=2*this.viewportBorder,e.height+=2*this.viewportBorder,t.x+=this.viewportBorder,t.y+=this.viewportBorder,this._positionX+=this.viewportBorder,this._positionY+=this.viewportBorder),0<t.z&&(this._positionX>e.x&&this._positionX<e.x+e.width&&this._positionY>e.y&&(this._positionY,e.y,e.height),!0)},l.prototype._isVisible=function(){if(!this._isEnabled||!this._scene.activeCamera)return!1;var e=this.getEmitterPosition().subtract(this._scene.activeCamera.globalPosition),t=e.length();e.normalize();var i=new Oo.Ray(this._scene.activeCamera.globalPosition,e),r=this._scene.pickWithRay(i,this.meshesSelectionPredicate,!0);return!r||!r.hit||r.distance>t},l.prototype.render=function(){if(!this._effect.isReady()||!this._scene.activeCamera)return!1;var e,t,i=this._scene.getEngine(),r=this._scene.activeCamera.viewport.toGlobal(i.getRenderWidth(!0),i.getRenderHeight(!0));if(!this.computeEffectivePosition(r))return!1;if(!this._isVisible())return!1;e=this._positionX<this.borderLimit+r.x?this.borderLimit+r.x-this._positionX:this._positionX>r.x+r.width-this.borderLimit?this._positionX-r.x-r.width+this.borderLimit:0;var n=(t=this._positionY<this.borderLimit+r.y?this.borderLimit+r.y-this._positionY:this._positionY>r.y+r.height-this.borderLimit?this._positionY-r.y-r.height+this.borderLimit:0)<e?e:t;(n-=this.viewportBorder)>this.borderLimit&&(n=this.borderLimit);var o=1-Oo.Scalar.Clamp(n/this.borderLimit,0,1);if(o<0)return!1;1<o&&(o=1),0<this.viewportBorder&&(r.x+=this.viewportBorder,r.y+=this.viewportBorder,r.width-=2*this.viewportBorder,r.height-=2*this.viewportBorder,this._positionX-=this.viewportBorder,this._positionY-=this.viewportBorder);var s=r.x+r.width/2,a=r.y+r.height/2,l=s-this._positionX,c=a-this._positionY;i.enableEffect(this._effect),i.setState(!1),i.setDepthBuffer(!1),i.bindBuffers(this._vertexBuffers,this._indexBuffer,this._effect);for(var h=0;h<this.lensFlares.length;h++){var u=this.lensFlares[h];i.setAlphaMode(u.alphaMode);var d=s-l*u.position,f=a-c*u.position,p=u.size,_=u.size*i.getAspectRatio(this._scene.activeCamera,!0),m=d/(r.width+2*r.x)*2-1,g=1-f/(r.height+2*r.y)*2,v=Oo.Matrix.FromValues(p/2,0,0,0,0,_/2,0,0,0,0,1,0,m,g,0,1);this._effect.setMatrix("viewportMatrix",v),this._effect.setTexture("textureSampler",u.texture),this._effect.setFloat4("color",u.color.r*o,u.color.g*o,u.color.b*o,1),i.drawElementsType(Oo.Material.TriangleFillMode,0,6)}return i.setDepthBuffer(!0),i.setAlphaMode(Oo.Engine.ALPHA_DISABLE),!0},l.prototype.dispose=function(){var e=this._vertexBuffers[Oo.VertexBuffer.PositionKind];for(e&&(e.dispose(),this._vertexBuffers[Oo.VertexBuffer.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null);this.lensFlares.length;)this.lensFlares[0].dispose();var t=this._scene.lensFlareSystems.indexOf(this);this._scene.lensFlareSystems.splice(t,1)},l.Parse=function(e,t,i){var r=t.getLastEntryByID(e.emitterId),n=e.name||"lensFlareSystem#"+e.emitterId,o=new l(n,r,t);o.id=e.id||n,o.borderLimit=e.borderLimit;for(var s=0;s<e.flares.length;s++){var a=e.flares[s];Oo.LensFlare.AddFlare(a.size,a.position,Oo.Color3.FromArray(a.color),a.textureName?i+a.textureName:"",o)}return o},l.prototype.serialize=function(){var e={};e.id=this.id,e.name=this.name,e.emitterId=this.getEmitter().id,e.borderLimit=this.borderLimit,e.flares=[];for(var t=0;t<this.lensFlares.length;t++){var i=this.lensFlares[t];e.flares.push({size:i.size,position:i.position,color:i.color.asArray(),textureName:Oo.Tools.GetFilename(i.texture?i.texture.name:"")})}return e},l})(),Oo.LensFlareSystem=Do,(function(e){var i=(function(){function e(e,t){this.type=e,(this.jointData=t).nativeParams=t.nativeParams||{}}return Object.defineProperty(e.prototype,"physicsJoint",{get:function(){return this._physicsJoint},set:function(e){this._physicsJoint,this._physicsJoint=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicsPlugin",{set:function(e){this._physicsPlugin=e},enumerable:!0,configurable:!0}),e.prototype.executeNativeFunction=function(e){e(this._physicsPlugin.world,this._physicsJoint)},e.DistanceJoint=0,e.HingeJoint=1,e.BallAndSocketJoint=2,e.WheelJoint=3,e.SliderJoint=4,e.PrismaticJoint=5,e.UniversalJoint=6,e.Hinge2Joint=e.WheelJoint,e.PointToPointJoint=8,e.SpringJoint=9,e.LockJoint=10,e})(),t=(function(t){function e(e){return t.call(this,i.DistanceJoint,e)||this}return T(e,t),e.prototype.updateDistance=function(e,t){this._physicsPlugin.updateDistanceJoint(this,e,t)},e})(e.PhysicsJoint=i);e.DistanceJoint=t;var r=(function(i){function e(e,t){return i.call(this,e,t)||this}return T(e,i),e.prototype.setMotor=function(e,t){this._physicsPlugin.setMotor(this,e||0,t)},e.prototype.setLimit=function(e,t){this._physicsPlugin.setLimit(this,e,t)},e})(i),n=(function(t){function e(e){return t.call(this,i.HingeJoint,e)||this}return T(e,t),e.prototype.setMotor=function(e,t){this._physicsPlugin.setMotor(this,e||0,t)},e.prototype.setLimit=function(e,t){this._physicsPlugin.setLimit(this,e,t)},e})(e.MotorEnabledJoint=r);e.HingeJoint=n;var o=(function(t){function e(e){return t.call(this,i.Hinge2Joint,e)||this}return T(e,t),e.prototype.setMotor=function(e,t,i){void 0===i&&(i=0),this._physicsPlugin.setMotor(this,e||0,t,i)},e.prototype.setLimit=function(e,t,i){void 0===i&&(i=0),this._physicsPlugin.setLimit(this,e,t,i)},e})(r);e.Hinge2Joint=o})($a||($a={})),Io=$a||($a={}),wo=(function(){function h(e,t,i,r){void 0===i&&(i={mass:0});var n=this;this.object=e,this.type=t,this._options=i,this._scene=r,this._bodyUpdateRequired=!1,this._onBeforePhysicsStepCallbacks=new Array,this._onAfterPhysicsStepCallbacks=new Array,this._onPhysicsCollideCallbacks=[],this._deltaPosition=Io.Vector3.Zero(),this._isDisposed=!1,this._tmpQuat=new Io.Quaternion,this._tmpQuat2=new Io.Quaternion,this.beforeStep=function(){n._physicsEngine&&(n.object.translate(n._deltaPosition,-1),n._deltaRotationConjugated&&n.object.rotationQuaternion&&n.object.rotationQuaternion.multiplyToRef(n._deltaRotationConjugated,n.object.rotationQuaternion),n.object.computeWorldMatrix(!1),n.object.parent&&n.object.rotationQuaternion?(n.getParentsRotation(),n._tmpQuat.multiplyToRef(n.object.rotationQuaternion,n._tmpQuat)):n._tmpQuat.copyFrom(n.object.rotationQuaternion||new Io.Quaternion),n._options.disableBidirectionalTransformation||n.object.rotationQuaternion&&n._physicsEngine.getPhysicsPlugin().setPhysicsBodyTransformation(n,n.object.getAbsolutePivotPoint(),n._tmpQuat),n._onBeforePhysicsStepCallbacks.forEach((function(e){e(n)})))},this.afterStep=function(){n._physicsEngine&&(n._onAfterPhysicsStepCallbacks.forEach((function(e){e(n)})),n._physicsEngine.getPhysicsPlugin().setTransformationFromPhysicsBody(n),n.object.parent&&n.object.rotationQuaternion&&(n.getParentsRotation(),n._tmpQuat.conjugateInPlace(),n._tmpQuat.multiplyToRef(n.object.rotationQuaternion,n.object.rotationQuaternion)),n.object.setAbsolutePosition(n.object.position),n._deltaRotation&&n.object.rotationQuaternion&&n.object.rotationQuaternion.multiplyToRef(n._deltaRotation,n.object.rotationQuaternion),n.object.translate(n._deltaPosition,1))},this.onCollideEvent=null,this.onCollide=function(e){if((n._onPhysicsCollideCallbacks.length||n.onCollideEvent)&&n._physicsEngine){var t=n._physicsEngine.getImpostorWithPhysicsBody(e.body);t&&(n.onCollideEvent&&n.onCollideEvent(n,t),n._onPhysicsCollideCallbacks.filter((function(e){return-1!==e.otherImpostors.indexOf(t)})).forEach((function(e){e.callback(n,t)})))}},this.object?(!this._scene&&e.getScene&&(this._scene=e.getScene()),this._scene&&(this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine?(this.object.rotationQuaternion||(this.object.rotation?this.object.rotationQuaternion=Io.Quaternion.RotationYawPitchRoll(this.object.rotation.y,this.object.rotation.x,this.object.rotation.z):this.object.rotationQuaternion=new Io.Quaternion),this._options.mass=void 0===i.mass?0:i.mass,this._options.friction=void 0===i.friction?.2:i.friction,this._options.restitution=void 0===i.restitution?.2:i.restitution,this._joints=[],!this.object.parent||this._options.ignoreParent?this._init():this.object.parent.physicsImpostor&&Io.Tools.Warn("You must affect impostors to children before affecting impostor to parent.")):Io.Tools.Error("Physics not enabled. Please use scene.enablePhysics(...) before creating impostors."))):Io.Tools.Error("No object was provided. A physics object is obligatory")}return Object.defineProperty(h.prototype,"isDisposed",{get:function(){return this._isDisposed},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"mass",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyMass(this):0},set:function(e){this.setMass(e)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"friction",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyFriction(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyFriction(this,e)},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"restitution",{get:function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getBodyRestitution(this):0},set:function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyRestitution(this,e)},enumerable:!0,configurable:!0}),h.prototype._init=function(){this._physicsEngine&&(this._physicsEngine.removeImpostor(this),this.physicsBody=null,this._parent=this._parent||this._getPhysicsParent(),this._isDisposed||this.parent&&!this._options.ignoreParent||this._physicsEngine.addImpostor(this))},h.prototype._getPhysicsParent=function(){return this.object.parent instanceof Io.AbstractMesh?this.object.parent.physicsImpostor:null},h.prototype.isBodyInitRequired=function(){return this._bodyUpdateRequired||!this._physicsBody&&!this._parent},h.prototype.setScalingUpdated=function(e){this.forceUpdate()},h.prototype.forceUpdate=function(){this._init(),this.parent&&!this._options.ignoreParent&&this.parent.forceUpdate()},Object.defineProperty(h.prototype,"physicsBody",{get:function(){return this._parent&&!this._options.ignoreParent?this._parent.physicsBody:this._physicsBody},set:function(e){this._physicsBody&&this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().removePhysicsBody(this),this._physicsBody=e,this.resetUpdateFlags()},enumerable:!0,configurable:!0}),Object.defineProperty(h.prototype,"parent",{get:function(){return!this._options.ignoreParent&&this._parent?this._parent:null},set:function(e){this._parent=e},enumerable:!0,configurable:!0}),h.prototype.resetUpdateFlags=function(){this._bodyUpdateRequired=!1},h.prototype.getObjectExtendSize=function(){if(this.object.getBoundingInfo){var e=this.object.rotationQuaternion;this.object.rotationQuaternion=h.IDENTITY_QUATERNION,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0);var t=this.object.getBoundingInfo().boundingBox.extendSizeWorld.scale(2);return this.object.rotationQuaternion=e,this.object.computeWorldMatrix&&this.object.computeWorldMatrix(!0),t}return h.DEFAULT_OBJECT_SIZE},h.prototype.getObjectCenter=function(){return this.object.getBoundingInfo?this.object.getBoundingInfo().boundingBox.centerWorld:this.object.position},h.prototype.getParam=function(e){return this._options[e]},h.prototype.setParam=function(e,t){this._options[e]=t,this._bodyUpdateRequired=!0},h.prototype.setMass=function(e){this.getParam("mass")!==e&&this.setParam("mass",e),this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setBodyMass(this,e)},h.prototype.getLinearVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getLinearVelocity(this):Io.Vector3.Zero()},h.prototype.setLinearVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setLinearVelocity(this,e)},h.prototype.getAngularVelocity=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getAngularVelocity(this):Io.Vector3.Zero()},h.prototype.setAngularVelocity=function(e){this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().setAngularVelocity(this,e)},h.prototype.executeNativeFunction=function(e){this._physicsEngine&&e(this._physicsEngine.getPhysicsPlugin().world,this.physicsBody)},h.prototype.registerBeforePhysicsStep=function(e){this._onBeforePhysicsStepCallbacks.push(e)},h.prototype.unregisterBeforePhysicsStep=function(e){var t=this._onBeforePhysicsStepCallbacks.indexOf(e);-1<t?this._onBeforePhysicsStepCallbacks.splice(t,1):Io.Tools.Warn("Function to remove was not found")},h.prototype.registerAfterPhysicsStep=function(e){this._onAfterPhysicsStepCallbacks.push(e)},h.prototype.unregisterAfterPhysicsStep=function(e){var t=this._onAfterPhysicsStepCallbacks.indexOf(e);-1<t?this._onAfterPhysicsStepCallbacks.splice(t,1):Io.Tools.Warn("Function to remove was not found")},h.prototype.registerOnPhysicsCollide=function(e,t){var i=e instanceof Array?e:[e];this._onPhysicsCollideCallbacks.push({callback:t,otherImpostors:i})},h.prototype.unregisterOnPhysicsCollide=function(e,r){var n=e instanceof Array?e:[e],o=-1;this._onPhysicsCollideCallbacks.some((function(e,t){if(e.callback===r&&e.otherImpostors.length===n.length){var i=e.otherImpostors.every((function(e){return-1<n.indexOf(e)}));return i&&(o=t),i}return!1}))?this._onPhysicsCollideCallbacks.splice(o,1):Io.Tools.Warn("Function to remove was not found")},h.prototype.getParentsRotation=function(){var e=this.object.parent;for(this._tmpQuat.copyFromFloats(0,0,0,1);e;)e.rotationQuaternion?this._tmpQuat2.copyFrom(e.rotationQuaternion):Io.Quaternion.RotationYawPitchRollToRef(e.rotation.y,e.rotation.x,e.rotation.z,this._tmpQuat2),this._tmpQuat.multiplyToRef(this._tmpQuat2,this._tmpQuat),e=e.parent;return this._tmpQuat},h.prototype.applyForce=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyForce(this,e,t),this},h.prototype.applyImpulse=function(e,t){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().applyImpulse(this,e,t),this},h.prototype.createJoint=function(e,t,i){var r=new Io.PhysicsJoint(t,i);return this.addJoint(e,r),this},h.prototype.addJoint=function(e,t){return this._joints.push({otherImpostor:e,joint:t}),this._physicsEngine&&this._physicsEngine.addJoint(this,e,t),this},h.prototype.sleep=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().sleepBody(this),this},h.prototype.wakeUp=function(){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().wakeUpBody(this),this},h.prototype.clone=function(e){return e?new h(e,this.type,this._options,this._scene):null},h.prototype.dispose=function(){var t=this;this._physicsEngine&&(this._joints.forEach((function(e){t._physicsEngine&&t._physicsEngine.removeJoint(t,e.otherImpostor,e.joint)})),this._physicsEngine.removeImpostor(this),this.parent&&this.parent.forceUpdate(),this._isDisposed=!0)},h.prototype.setDeltaPosition=function(e){this._deltaPosition.copyFrom(e)},h.prototype.setDeltaRotation=function(e){this._deltaRotation||(this._deltaRotation=new Io.Quaternion),this._deltaRotation.copyFrom(e),this._deltaRotationConjugated=this._deltaRotation.conjugate()},h.prototype.getBoxSizeToRef=function(e){return this._physicsEngine&&this._physicsEngine.getPhysicsPlugin().getBoxSizeToRef(this,e),this},h.prototype.getRadius=function(){return this._physicsEngine?this._physicsEngine.getPhysicsPlugin().getRadius(this):0},h.prototype.syncBoneWithImpostor=function(e,t,i,r,n){var o=h._tmpVecs[0],s=this.object;if(s.rotationQuaternion)if(n){var a=h._tmpQuat;s.rotationQuaternion.multiplyToRef(n,a),e.setRotationQuaternion(a,Io.Space.WORLD,t)}else e.setRotationQuaternion(s.rotationQuaternion,Io.Space.WORLD,t);o.x=0,o.y=0,o.z=0,i&&(o.x=i.x,o.y=i.y,o.z=i.z,e.getDirectionToRef(o,t,o),null==r&&(r=i.length()),o.x*=r,o.y*=r,o.z*=r),e.getParent()?(o.addInPlace(s.getAbsolutePosition()),e.setAbsolutePosition(o,t)):(t.setAbsolutePosition(s.getAbsolutePosition()),t.position.x-=o.x,t.position.y-=o.y,t.position.z-=o.z)},h.prototype.syncImpostorWithBone=function(e,t,i,r,n,o){var s=this.object;if(s.rotationQuaternion)if(n){var a=h._tmpQuat;e.getRotationQuaternionToRef(Io.Space.WORLD,t,a),a.multiplyToRef(n,s.rotationQuaternion)}else e.getRotationQuaternionToRef(Io.Space.WORLD,t,s.rotationQuaternion);var l=h._tmpVecs[0],c=h._tmpVecs[1];o||((o=h._tmpVecs[2]).x=0,o.y=1,o.z=0),e.getDirectionToRef(o,t,c),e.getAbsolutePositionToRef(t,l),null==r&&i&&(r=i.length()),null!=r&&(l.x+=c.x*r,l.y+=c.y*r,l.z+=c.z*r),s.setAbsolutePosition(l)},h.DEFAULT_OBJECT_SIZE=new Io.Vector3(1,1,1),h.IDENTITY_QUATERNION=Io.Quaternion.Identity(),h._tmpVecs=[Io.Vector3.Zero(),Io.Vector3.Zero(),Io.Vector3.Zero()],h._tmpQuat=Io.Quaternion.Identity(),h.NoImpostor=0,h.SphereImpostor=1,h.BoxImpostor=2,h.PlaneImpostor=3,h.MeshImpostor=4,h.CylinderImpostor=7,h.ParticleImpostor=8,h.HeightmapImpostor=9,h})(),Io.PhysicsImpostor=wo,Lo=$a||($a={}),Fo=(function(){function e(e,t){if(void 0===t&&(t=new Lo.CannonJSPlugin),this._physicsPlugin=t,this._impostors=[],this._joints=[],!this._physicsPlugin.isSupported())throw new Error("Physics Engine "+this._physicsPlugin.name+" cannot be found. Please make sure it is included.");e=e||new Lo.Vector3(0,-9.807,0),this.setGravity(e),this.setTimeStep()}return e.prototype.setGravity=function(e){this.gravity=e,this._physicsPlugin.setGravity(this.gravity)},e.prototype.setTimeStep=function(e){void 0===e&&(e=1/60),this._physicsPlugin.setTimeStep(e)},e.prototype.getTimeStep=function(){return this._physicsPlugin.getTimeStep()},e.prototype.dispose=function(){this._impostors.forEach((function(e){e.dispose()})),this._physicsPlugin.dispose()},e.prototype.getPhysicsPluginName=function(){return this._physicsPlugin.name},e.prototype.addImpostor=function(e){e.uniqueId=this._impostors.push(e),e.parent||this._physicsPlugin.generatePhysicsBody(e)},e.prototype.removeImpostor=function(e){var t=this._impostors.indexOf(e);if(-1<t){var i=this._impostors.splice(t,1);i.length&&(i[0].physicsBody=null)}},e.prototype.addJoint=function(e,t,i){var r={mainImpostor:e,connectedImpostor:t,joint:i};i.physicsPlugin=this._physicsPlugin,this._joints.push(r),this._physicsPlugin.generateJoint(r)},e.prototype.removeJoint=function(t,i,r){var e=this._joints.filter((function(e){return e.connectedImpostor===i&&e.joint===r&&e.mainImpostor===t}));e.length&&this._physicsPlugin.removeJoint(e[0])},e.prototype._step=function(e){var t=this;this._impostors.forEach((function(e){e.isBodyInitRequired()&&t._physicsPlugin.generatePhysicsBody(e)})),.1<e?e=.1:e<=0&&(e=1/60),this._physicsPlugin.executeStep(e,this._impostors)},e.prototype.getPhysicsPlugin=function(){return this._physicsPlugin},e.prototype.getImpostors=function(){return this._impostors},e.prototype.getImpostorForPhysicsObject=function(e){for(var t=0;t<this._impostors.length;++t)if(this._impostors[t].object===e)return this._impostors[t];return null},e.prototype.getImpostorWithPhysicsBody=function(e){for(var t=0;t<this._impostors.length;++t)if(this._impostors[t].physicsBody===e)return this._impostors[t];return null},e.Epsilon=.001,e})(),Lo.PhysicsEngine=Fo,(function(f){var e=(function(){function e(e){this._scene=e,this._physicsEngine=this._scene.getPhysicsEngine(),this._physicsEngine||f.Tools.Warn("Physics engine not enabled. Please enable the physics before you can use the methods.")}return e.prototype.applyRadialExplosionImpulse=function(i,r,n,o){if(void 0===o&&(o=h.Constant),!this._physicsEngine)return f.Tools.Warn("Physics engine not enabled. Please enable the physics before you call this method."),null;var e=this._physicsEngine.getImpostors();if(0===e.length)return null;var s=new t(this._scene);return e.forEach((function(e){var t=s.getImpostorForceAndContactPoint(e,i,r,n,o);t&&e.applyImpulse(t.force,t.contactPoint)})),s.dispose(!1),s},e.prototype.applyRadialExplosionForce=function(i,r,n,o){if(void 0===o&&(o=h.Constant),!this._physicsEngine)return f.Tools.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;var e=this._physicsEngine.getImpostors();if(0===e.length)return null;var s=new t(this._scene);return e.forEach((function(e){var t=s.getImpostorForceAndContactPoint(e,i,r,n,o);t&&e.applyForce(t.force,t.contactPoint)})),s.dispose(!1),s},e.prototype.gravitationalField=function(e,t,i,r){if(void 0===r&&(r=h.Constant),!this._physicsEngine)return f.Tools.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(0===this._physicsEngine.getImpostors().length)return null;var n=new o(this,this._scene,e,t,i,r);return n.dispose(!1),n},e.prototype.updraft=function(e,t,i,r,n){if(void 0===n&&(n=a.Center),!this._physicsEngine)return f.Tools.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(0===this._physicsEngine.getImpostors().length)return null;var o=new s(this._scene,e,t,i,r,n);return o.dispose(!1),o},e.prototype.vortex=function(e,t,i,r){if(!this._physicsEngine)return f.Tools.Warn("Physics engine not enabled. Please enable the physics before you call the PhysicsHelper."),null;if(0===this._physicsEngine.getImpostors().length)return null;var n=new l(this._scene,e,t,i,r);return n.dispose(!1),n},e})();f.PhysicsHelper=e;var t=(function(){function e(e){this._sphereOptions={segments:32,diameter:1},this._rays=[],this._dataFetched=!1,this._scene=e}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere,rays:this._rays}},e.prototype.getImpostorForceAndContactPoint=function(e,t,i,r,n){if(0===e.mass)return null;if(!this._intersectsWithSphere(e,t,i))return null;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return null;var o=e.getObjectCenter().subtract(t),s=new f.Ray(t,o,i);this._rays.push(s);var a=s.intersectsMesh(e.object).pickedPoint;if(!a)return null;var l=f.Vector3.Distance(t,a);if(i<l)return null;var c=n===h.Constant?r:r*(1-l/i);return{force:o.multiplyByFloats(c,c,c),contactPoint:a}},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0)},e.prototype._prepareSphere=function(){this._sphere||(this._sphere=f.MeshBuilder.CreateSphere("radialExplosionEventSphere",this._sphereOptions,this._scene),this._sphere.isVisible=!1)},e.prototype._intersectsWithSphere=function(e,t,i){var r=e.object;return this._prepareSphere(),this._sphere.position=t,this._sphere.scaling=new f.Vector3(2*i,2*i,2*i),this._sphere._updateBoundingInfo(),this._sphere.computeWorldMatrix(!0),this._sphere.intersectsMesh(r,!0)},e})();f.PhysicsRadialExplosionEvent=t;var o=(function(){function e(e,t,i,r,n,o){void 0===o&&(o=h.Constant),this._dataFetched=!1,this._physicsHelper=e,this._scene=t,this._origin=i,this._radius=r,this._strength=n,this._falloff=o,this._tickCallback=this._tick.bind(this)}return e.prototype.getData=function(){return this._dataFetched=!0,{sphere:this._sphere}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._sphere.dispose():setTimeout((function(){t._dataFetched||t._sphere.dispose()}),0)},e.prototype._tick=function(){if(this._sphere)this._physicsHelper.applyRadialExplosionForce(this._origin,this._radius,-1*this._strength,this._falloff);else{var e=this._physicsHelper.applyRadialExplosionForce(this._origin,this._radius,-1*this._strength,this._falloff);e&&(this._sphere=e.getData().sphere.clone("radialExplosionEventSphereClone"))}},e})();f.PhysicsGravitationalFieldEvent=o;var s=(function(){function e(e,t,i,r,n,o){this._scene=e,this._origin=t,this._radius=i,this._strength=r,this._height=n,this._updraftMode=o,this._originTop=f.Vector3.Zero(),this._originDirection=f.Vector3.Zero(),this._cylinderPosition=f.Vector3.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._origin.addToRef(new f.Vector3(0,this._height/2,0),this._cylinderPosition),this._origin.addToRef(new f.Vector3(0,this._height,0),this._originTop),this._updraftMode===a.Perpendicular&&(this._originDirection=this._origin.subtract(this._originTop).normalize()),this._tickCallback=this._tick.bind(this)}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._cylinder.dispose():setTimeout((function(){t._dataFetched||t._cylinder.dispose()}),0)},e.prototype.getImpostorForceAndContactPoint=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;var t=e.getObjectCenter();if(this._updraftMode===a.Perpendicular)var i=this._originDirection;else i=t.subtract(this._originTop);var r=-1*this._strength;return{force:i.multiplyByFloats(r,r,r),contactPoint:t}},e.prototype._tick=function(){var i=this;this._physicsEngine.getImpostors().forEach((function(e){var t=i.getImpostorForceAndContactPoint(e);t&&e.applyForce(t.force,t.contactPoint)}))},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=f.MeshBuilder.CreateCylinder("updraftEventCylinder",{height:this._height,diameter:2*this._radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._prepareCylinder(),this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e})();f.PhysicsUpdraftEvent=s;var h,i,a,r,l=(function(){function e(e,t,i,r,n){this._scene=e,this._origin=t,this._radius=i,this._strength=r,this._height=n,this._originTop=f.Vector3.Zero(),this._centripetalForceThreshold=.7,this._updraftMultiplier=.02,this._cylinderPosition=f.Vector3.Zero(),this._dataFetched=!1,this._physicsEngine=this._scene.getPhysicsEngine(),this._origin.addToRef(new f.Vector3(0,this._height/2,0),this._cylinderPosition),this._origin.addToRef(new f.Vector3(0,this._height,0),this._originTop),this._tickCallback=this._tick.bind(this)}return e.prototype.getData=function(){return this._dataFetched=!0,{cylinder:this._cylinder}},e.prototype.enable=function(){this._tickCallback.call(this),this._scene.registerBeforeRender(this._tickCallback)},e.prototype.disable=function(){this._scene.unregisterBeforeRender(this._tickCallback)},e.prototype.dispose=function(e){var t=this;void 0===e&&(e=!0),e?this._cylinder.dispose():setTimeout((function(){t._dataFetched||t._cylinder.dispose()}),0)},e.prototype.getImpostorForceAndContactPoint=function(e){if(0===e.mass)return null;if(!this._intersectsWithCylinder(e))return null;if("Mesh"!==e.object.getClassName()&&"InstancedMesh"!==e.object.getClassName())return null;var t=e.getObjectCenter(),i=new f.Vector3(this._origin.x,t.y,this._origin.z),r=t.subtract(i),n=new f.Ray(i,r,this._radius).intersectsMesh(e.object),o=n.pickedPoint;if(!o)return null;var s=n.distance/this._radius,a=f.Vector3.Cross(i,t).normalize(),l=o.normalize();if(s>this._centripetalForceThreshold&&(l=l.negate()),s>this._centripetalForceThreshold)var c=l.x*this._strength/8,h=l.y*this._updraftMultiplier,u=l.z*this._strength/8;else c=(a.x+l.x)/2,h=this._originTop.y*this._updraftMultiplier,u=(a.z+l.z)/2;var d=new f.Vector3(c,h,u);return{force:d=d.multiplyByFloats(this._strength,this._strength,this._strength),contactPoint:t}},e.prototype._tick=function(){var i=this;this._physicsEngine.getImpostors().forEach((function(e){var t=i.getImpostorForceAndContactPoint(e);t&&e.applyForce(t.force,t.contactPoint)}))},e.prototype._prepareCylinder=function(){this._cylinder||(this._cylinder=f.MeshBuilder.CreateCylinder("vortexEventCylinder",{height:this._height,diameter:2*this._radius},this._scene),this._cylinder.isVisible=!1)},e.prototype._intersectsWithCylinder=function(e){var t=e.object;return this._prepareCylinder(),this._cylinder.position=this._cylinderPosition,this._cylinder.intersectsMesh(t,!0)},e})();f.PhysicsVortexEvent=l,(i=h=f.PhysicsRadialImpulseFalloff||(f.PhysicsRadialImpulseFalloff={}))[i.Constant=0]="Constant",i[i.Linear=1]="Linear",(r=a=f.PhysicsUpdraftMode||(f.PhysicsUpdraftMode={}))[r.Center=0]="Center",r[r.Perpendicular=1]="Perpendicular"})($a||($a={})),Bo=$a||($a={}),No=(function(){function e(e,t){void 0===e&&(e=!0),void 0===t&&(t=10),this._useDeltaForWorldStep=e,this.name="CannonJSPlugin",this._physicsMaterials=new Array,this._fixedTimeStep=1/60,this.BJSCANNON=i,this._minus90X=new Bo.Quaternion(-.7071067811865475,0,0,.7071067811865475),this._plus90X=new Bo.Quaternion(.7071067811865475,0,0,.7071067811865475),this._tmpPosition=Bo.Vector3.Zero(),this._tmpDeltaPosition=Bo.Vector3.Zero(),this._tmpUnityRotation=new Bo.Quaternion,this.isSupported()?(this._extendNamespace(),this.world=new this.BJSCANNON.World,this.world.broadphase=new this.BJSCANNON.NaiveBroadphase,this.world.solver.iterations=t):Bo.Tools.Error("CannonJS is not available. Please make sure you included the js file.")}return e.prototype.setGravity=function(e){this.world.gravity.copy(e)},e.prototype.setTimeStep=function(e){this._fixedTimeStep=e},e.prototype.getTimeStep=function(){return this._fixedTimeStep},e.prototype.executeStep=function(e,t){this.world.step(this._fixedTimeStep,this._useDeltaForWorldStep?e:0,3)},e.prototype.applyImpulse=function(e,t,i){var r=new this.BJSCANNON.Vec3(i.x,i.y,i.z),n=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyImpulse(n,r)},e.prototype.applyForce=function(e,t,i){var r=new this.BJSCANNON.Vec3(i.x,i.y,i.z),n=new this.BJSCANNON.Vec3(t.x,t.y,t.z);e.physicsBody.applyForce(n,r)},e.prototype.generatePhysicsBody=function(t){if(t.parent)t.physicsBody&&(this.removePhysicsBody(t),t.forceUpdate());else{if(t.isBodyInitRequired()){var e=this._createShape(t),i=t.physicsBody;i&&this.removePhysicsBody(t);var r=this._addMaterial("mat-"+t.uniqueId,t.getParam("friction"),t.getParam("restitution")),n={mass:t.getParam("mass"),material:r},o=t.getParam("nativeOptions");for(var s in o)o.hasOwnProperty(s)&&(n[s]=o[s]);t.physicsBody=new this.BJSCANNON.Body(n),t.physicsBody.addEventListener("collide",t.onCollide),this.world.addEventListener("preStep",t.beforeStep),this.world.addEventListener("postStep",t.afterStep),t.physicsBody.addShape(e),this.world.add(t.physicsBody),i&&["force","torque","velocity","angularVelocity"].forEach((function(e){t.physicsBody[e].copy(i[e])})),this._processChildMeshes(t)}this._updatePhysicsBodyTransformation(t)}},e.prototype._processChildMeshes=function(o){var s=this,e=o.object.getChildMeshes?o.object.getChildMeshes(!0):[],a=o.object.rotationQuaternion;if(e.length){var l=function(e,t){if(a&&t.rotationQuaternion){var i=t.getPhysicsImpostor();if(i)if(i.parent!==o){var r=t.getAbsolutePosition().subtract(o.object.getAbsolutePosition()),n=t.rotationQuaternion.multiply(Bo.Quaternion.Inverse(a));i.physicsBody&&(s.removePhysicsBody(i),i.physicsBody=null),i.parent=o,i.resetUpdateFlags(),o.physicsBody.addShape(s._createShape(i),new s.BJSCANNON.Vec3(r.x,r.y,r.z),new s.BJSCANNON.Quaternion(n.x,n.y,n.z,n.w)),o.physicsBody.mass+=i.getParam("mass")}a.multiplyInPlace(t.rotationQuaternion),t.getChildMeshes(!0).filter((function(e){return!!e.physicsImpostor})).forEach(l.bind(s,t.getAbsolutePosition()))}};e.filter((function(e){return!!e.physicsImpostor})).forEach(l.bind(this,o.object.getAbsolutePosition()))}},e.prototype.removePhysicsBody=function(e){e.physicsBody.removeEventListener("collide",e.onCollide),this.world.removeEventListener("preStep",e.beforeStep),this.world.removeEventListener("postStep",e.afterStep),this.world.remove(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var r,n=e.joint.jointData,o={pivotA:n.mainPivot?(new this.BJSCANNON.Vec3).copy(n.mainPivot):null,pivotB:n.connectedPivot?(new this.BJSCANNON.Vec3).copy(n.connectedPivot):null,axisA:n.mainAxis?(new this.BJSCANNON.Vec3).copy(n.mainAxis):null,axisB:n.connectedAxis?(new this.BJSCANNON.Vec3).copy(n.connectedAxis):null,maxForce:n.nativeParams.maxForce,collideConnected:!!n.collision};switch(e.joint.type){case Bo.PhysicsJoint.HingeJoint:case Bo.PhysicsJoint.Hinge2Joint:r=new this.BJSCANNON.HingeConstraint(t,i,o);break;case Bo.PhysicsJoint.DistanceJoint:r=new this.BJSCANNON.DistanceConstraint(t,i,n.maxDistance||2);break;case Bo.PhysicsJoint.SpringJoint:var s=n;r=new this.BJSCANNON.Spring(t,i,{restLength:s.length,stiffness:s.stiffness,damping:s.damping,localAnchorA:o.pivotA,localAnchorB:o.pivotB});break;case Bo.PhysicsJoint.LockJoint:r=new this.BJSCANNON.LockConstraint(t,i,o);break;case Bo.PhysicsJoint.PointToPointJoint:case Bo.PhysicsJoint.BallAndSocketJoint:default:r=new this.BJSCANNON.PointToPointConstraint(t,o.pivotA,i,o.pivotA,o.maxForce)}r.collideConnected=!!n.collision,e.joint.physicsJoint=r,e.joint.type!==Bo.PhysicsJoint.SpringJoint?this.world.addConstraint(r):(e.joint.jointData.forceApplicationCallback=e.joint.jointData.forceApplicationCallback||function(){r.applyForce()},e.mainImpostor.registerAfterPhysicsStep(e.joint.jointData.forceApplicationCallback))}},e.prototype.removeJoint=function(e){e.joint.type!==Bo.PhysicsJoint.SpringJoint?this.world.removeConstraint(e.joint.physicsJoint):e.mainImpostor.unregisterAfterPhysicsStep(e.joint.jointData.forceApplicationCallback)},e.prototype._addMaterial=function(e,t,i){var r,n;for(r=0;r<this._physicsMaterials.length;r++)if((n=this._physicsMaterials[r]).friction===t&&n.restitution===i)return n;var o=new this.BJSCANNON.Material(e);return o.friction=t,o.restitution=i,this._physicsMaterials.push(o),o},e.prototype._checkWithEpsilon=function(e){return e<Bo.PhysicsEngine.Epsilon?Bo.PhysicsEngine.Epsilon:e},e.prototype._createShape=function(e){var t,i=e.object,r=e.getObjectExtendSize();switch(e.type){case Bo.PhysicsImpostor.SphereImpostor:var n=r.x,o=r.y,s=r.z;t=new this.BJSCANNON.Sphere(Math.max(this._checkWithEpsilon(n),this._checkWithEpsilon(o),this._checkWithEpsilon(s))/2);break;case Bo.PhysicsImpostor.CylinderImpostor:t=new this.BJSCANNON.Cylinder(this._checkWithEpsilon(r.x)/2,this._checkWithEpsilon(r.x)/2,this._checkWithEpsilon(r.y),16);break;case Bo.PhysicsImpostor.BoxImpostor:var a=r.scale(.5);t=new this.BJSCANNON.Box(new this.BJSCANNON.Vec3(this._checkWithEpsilon(a.x),this._checkWithEpsilon(a.y),this._checkWithEpsilon(a.z)));break;case Bo.PhysicsImpostor.PlaneImpostor:Bo.Tools.Warn("Attention, PlaneImposter might not behave as you expect. Consider using BoxImposter instead"),t=new this.BJSCANNON.Plane;break;case Bo.PhysicsImpostor.MeshImpostor:var l=i.getVerticesData?i.getVerticesData(Bo.VertexBuffer.PositionKind):[],c=i.getIndices?i.getIndices():[];if(!l)return;var h=i.position.clone(),u=i.rotation&&i.rotation.clone(),d=i.rotationQuaternion&&i.rotationQuaternion.clone();i.position.copyFromFloats(0,0,0),i.rotation&&i.rotation.copyFromFloats(0,0,0),i.rotationQuaternion&&i.rotationQuaternion.copyFrom(e.getParentsRotation()),i.rotationQuaternion&&i.parent&&i.rotationQuaternion.conjugateInPlace();var f,p=i.computeWorldMatrix(!0),_=new Array;for(f=0;f<l.length;f+=3)Bo.Vector3.TransformCoordinates(Bo.Vector3.FromArray(l,f),p).toArray(_,f);Bo.Tools.Warn("MeshImpostor only collides against spheres."),t=new this.BJSCANNON.Trimesh(_,c),i.position.copyFrom(h),u&&i.rotation&&i.rotation.copyFrom(u),d&&i.rotationQuaternion&&i.rotationQuaternion.copyFrom(d);break;case Bo.PhysicsImpostor.HeightmapImpostor:var m=i.position.clone(),g=i.rotation&&i.rotation.clone(),v=i.rotationQuaternion&&i.rotationQuaternion.clone();i.position.copyFromFloats(0,0,0),i.rotation&&i.rotation.copyFromFloats(0,0,0),i.rotationQuaternion&&i.rotationQuaternion.copyFrom(e.getParentsRotation()),i.rotationQuaternion&&i.parent&&i.rotationQuaternion.conjugateInPlace(),i.rotationQuaternion&&i.rotationQuaternion.multiplyInPlace(this._minus90X),t=this._createHeightmap(i),i.position.copyFrom(m),g&&i.rotation&&i.rotation.copyFrom(g),v&&i.rotationQuaternion&&i.rotationQuaternion.copyFrom(v),i.computeWorldMatrix(!0);break;case Bo.PhysicsImpostor.ParticleImpostor:t=new this.BJSCANNON.Particle}return t},e.prototype._createHeightmap=function(e,t){var i,r=e.getVerticesData(Bo.VertexBuffer.PositionKind),n=e.computeWorldMatrix(!0),o=new Array;for(i=0;i<r.length;i+=3)Bo.Vector3.TransformCoordinates(Bo.Vector3.FromArray(r,i),n).toArray(o,i);r=o;for(var s=new Array,a=t||~~(Math.sqrt(r.length/3)-1),l=e.getBoundingInfo(),c=Math.min(l.boundingBox.extendSizeWorld.x,l.boundingBox.extendSizeWorld.y),h=l.boundingBox.extendSizeWorld.z,u=2*c/a,d=0;d<r.length;d+=3){var f=Math.round(r[d+0]/u+a/2),p=Math.round(-1*(r[d+1]/u-a/2)),_=-r[d+2]+h;s[f]||(s[f]=[]),s[f][p]||(s[f][p]=_),s[f][p]=Math.max(_,s[f][p])}for(f=0;f<=a;++f){if(!s[f]){for(var m=1;!s[(f+m)%a];)m++;s[f]=s[(f+m)%a].slice()}for(p=0;p<=a;++p)if(!s[f][p]){var g;for(m=1;void 0===g;)g=s[f][(p+m++)%a];s[f][p]=g}}var v=new this.BJSCANNON.Heightfield(s,{elementSize:u});return v.minY=h,v},e.prototype._updatePhysicsBodyTransformation=function(e){var t=e.object;if(t.computeWorldMatrix&&t.computeWorldMatrix(!0),t.getBoundingInfo()){var i=e.getObjectCenter();this._tmpDeltaPosition.copyFrom(t.getAbsolutePivotPoint().subtract(i)),this._tmpDeltaPosition.divideInPlace(e.object.scaling),this._tmpPosition.copyFrom(i);var r=t.rotationQuaternion;if(r){if(e.type!==Bo.PhysicsImpostor.PlaneImpostor&&e.type!==Bo.PhysicsImpostor.HeightmapImpostor&&e.type!==Bo.PhysicsImpostor.CylinderImpostor||(r=r.multiply(this._minus90X),e.setDeltaRotation(this._plus90X)),e.type===Bo.PhysicsImpostor.HeightmapImpostor){var n=t,o=n.getBoundingInfo(),s=n.rotationQuaternion;n.rotationQuaternion=this._tmpUnityRotation,n.computeWorldMatrix(!0);var a=i.clone(),l=n.getPivotMatrix()||Bo.Matrix.Translation(0,0,0),c=Bo.Matrix.Translation(o.boundingBox.extendSizeWorld.x,0,-o.boundingBox.extendSizeWorld.z);n.setPreTransformMatrix(c),n.computeWorldMatrix(!0);var h=o.boundingBox.centerWorld.subtract(i).subtract(n.position).negate();this._tmpPosition.copyFromFloats(h.x,h.y-o.boundingBox.extendSizeWorld.y,h.z),this._tmpDeltaPosition.copyFrom(o.boundingBox.centerWorld.subtract(a)),this._tmpDeltaPosition.y+=o.boundingBox.extendSizeWorld.y,n.rotationQuaternion=s,n.setPreTransformMatrix(l),n.computeWorldMatrix(!0)}else e.type===Bo.PhysicsImpostor.MeshImpostor&&this._tmpDeltaPosition.copyFromFloats(0,0,0);e.setDeltaPosition(this._tmpDeltaPosition),e.physicsBody.position.copy(this._tmpPosition),e.physicsBody.quaternion.copy(r)}}},e.prototype.setTransformationFromPhysicsBody=function(e){e.object.position.copyFrom(e.physicsBody.position),e.object.rotationQuaternion&&e.object.rotationQuaternion.copyFrom(e.physicsBody.quaternion)},e.prototype.setPhysicsBodyTransformation=function(e,t,i){e.physicsBody.position.copy(t),e.physicsBody.quaternion.copy(i)},e.prototype.isSupported=function(){return void 0!==this.BJSCANNON},e.prototype.setLinearVelocity=function(e,t){e.physicsBody.velocity.copy(t)},e.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.copy(t)},e.prototype.getLinearVelocity=function(e){var t=e.physicsBody.velocity;return t?new Bo.Vector3(t.x,t.y,t.z):null},e.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new Bo.Vector3(t.x,t.y,t.z):null},e.prototype.setBodyMass=function(e,t){e.physicsBody.mass=t,e.physicsBody.updateMassProperties()},e.prototype.getBodyMass=function(e){return e.physicsBody.mass},e.prototype.getBodyFriction=function(e){return e.physicsBody.material.friction},e.prototype.setBodyFriction=function(e,t){e.physicsBody.material.friction=t},e.prototype.getBodyRestitution=function(e){return e.physicsBody.material.restitution},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.material.restitution=t},e.prototype.sleepBody=function(e){e.physicsBody.sleep()},e.prototype.wakeUpBody=function(e){e.physicsBody.wakeUp()},e.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.distance=t},e.prototype.setMotor=function(e,t,i,r){r||(e.physicsJoint.enableMotor(),e.physicsJoint.setMotorSpeed(t),i&&this.setLimit(e,i))},e.prototype.setLimit=function(e,t,i){e.physicsJoint.motorEquation.maxForce=t,e.physicsJoint.motorEquation.minForce=void 0===i?-t:i},e.prototype.syncMeshWithImpostor=function(e,t){var i=t.physicsBody;e.position.x=i.position.x,e.position.y=i.position.y,e.position.z=i.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=i.quaternion.x,e.rotationQuaternion.y=i.quaternion.y,e.rotationQuaternion.z=i.quaternion.z,e.rotationQuaternion.w=i.quaternion.w)},e.prototype.getRadius=function(e){return e.physicsBody.shapes[0].boundingSphereRadius},e.prototype.getBoxSizeToRef=function(e,t){var i=e.physicsBody.shapes[0];t.x=2*i.halfExtents.x,t.y=2*i.halfExtents.y,t.z=2*i.halfExtents.z},e.prototype.dispose=function(){},e.prototype._extendNamespace=function(){var u=new this.BJSCANNON.Vec3,d=this.BJSCANNON;this.BJSCANNON.World.prototype.step=function(e,t,i){if(i=i||10,0===(t=t||0))this.internalStep(e),this.time+=e;else{var r=Math.floor((this.time+t)/e)-Math.floor(this.time/e);r=Math.min(r,i)||1;for(var n=performance.now(),o=0;o!==r&&(this.internalStep(e),!(performance.now()-n>1e3*e));o++);this.time+=t;for(var s=this.time%e/e,a=u,l=this.bodies,c=0;c!==l.length;c++){var h=l[c];h.type!==d.Body.STATIC&&h.sleepState!==d.Body.SLEEPING?(h.position.vsub(h.previousPosition,a),a.scale(s,a),h.position.vadd(a,h.interpolatedPosition)):(h.interpolatedPosition.copy(h.position),h.interpolatedQuaternion.copy(h.quaternion))}}}},e})(),Bo.CannonJSPlugin=No,Vo=$a||($a={}),Uo=(function(){function e(e){this.name="OimoJSPlugin",this._tmpImpostorsArray=[],this._tmpPositionVector=Vo.Vector3.Zero(),this.BJSOIMO=t,this.world=new this.BJSOIMO.World({iterations:e}),this.world.clear()}return e.prototype.setGravity=function(e){this.world.gravity.copy(e)},e.prototype.setTimeStep=function(e){this.world.timeStep=e},e.prototype.getTimeStep=function(){return this.world.timeStep},e.prototype.executeStep=function(e,t){var i=this;t.forEach((function(e){e.beforeStep()})),this.world.step(),t.forEach((function(e){e.afterStep(),i._tmpImpostorsArray[e.uniqueId]=e}));for(var r=this.world.contacts;null!==r;)if(!r.touching||r.body1.sleeping||r.body2.sleeping){var n=this._tmpImpostorsArray[+r.body1.name],o=this._tmpImpostorsArray[+r.body2.name];n&&o&&(n.onCollide({body:o.physicsBody}),o.onCollide({body:n.physicsBody})),r=r.next}else r=r.next},e.prototype.applyImpulse=function(e,t,i){var r=e.physicsBody.mass;e.physicsBody.applyImpulse(i.scale(this.world.invScale),t.scale(this.world.invScale*r))},e.prototype.applyForce=function(e,t,i){Vo.Tools.Warn("Oimo doesn't support applying force. Using impule instead."),this.applyImpulse(e,t,i)},e.prototype.generatePhysicsBody=function(p){var _=this;if(p.parent)p.physicsBody&&(this.removePhysicsBody(p),p.forceUpdate());else{if(p.isBodyInitRequired()){var m={name:p.uniqueId,config:[p.getParam("mass")||1,p.getParam("friction"),p.getParam("restitution")],size:[],type:[],pos:[],posShape:[],rot:[],rotShape:[],move:0!==p.getParam("mass"),density:p.getParam("mass"),friction:p.getParam("friction"),restitution:p.getParam("restitution"),world:this.world},t=[p];(e=p.object).getChildMeshes&&e.getChildMeshes().forEach((function(e){e.physicsImpostor&&t.push(e.physicsImpostor)}));var g=function(e){return Math.max(e,Vo.PhysicsEngine.Epsilon)},v=new Vo.Quaternion;t.forEach((function(e){if(e.object.rotationQuaternion){var t=e.object.rotationQuaternion;v=t.clone();var i=t.toEulerAngles(),r=e.getObjectExtendSize(),n=57.29577951308232;if(e===p){var o=p.getObjectCenter();p.object.getAbsolutePivotPoint().subtractToRef(o,_._tmpPositionVector),_._tmpPositionVector.divideInPlace(p.object.scaling),m.pos.push(o.x),m.pos.push(o.y),m.pos.push(o.z),m.posShape.push(0,0,0),m.rot.push(0),m.rot.push(0),m.rot.push(0),m.rotShape.push(0,0,0)}else{var s=e.object.getAbsolutePosition().subtract(p.object.getAbsolutePosition());m.posShape.push(s.x),m.posShape.push(s.y),m.posShape.push(s.z),m.pos.push(0,0,0),m.rot.push(0),m.rot.push(0),m.rot.push(0),m.rotShape.push(i.x*n),m.rotShape.push(i.y*n),m.rotShape.push(i.z*n)}switch(e.type){case Vo.PhysicsImpostor.ParticleImpostor:Vo.Tools.Warn("No Particle support in OIMO.js. using SphereImpostor instead");case Vo.PhysicsImpostor.SphereImpostor:var a=r.x,l=r.y,c=r.z,h=Math.max(g(a),g(l),g(c))/2;m.type.push("sphere"),m.size.push(h),m.size.push(h),m.size.push(h);break;case Vo.PhysicsImpostor.CylinderImpostor:var u=g(r.x)/2,d=g(r.y);m.type.push("cylinder"),m.size.push(u),m.size.push(d),m.size.push(d);break;case Vo.PhysicsImpostor.PlaneImpostor:case Vo.PhysicsImpostor.BoxImpostor:default:u=g(r.x),d=g(r.y);var f=g(r.z);m.type.push("box"),m.size.push(u),m.size.push(d),m.size.push(f)}e.object.rotationQuaternion=t}})),p.physicsBody=this.world.add(m),p.physicsBody.resetQuaternion(v),p.physicsBody.updatePosition(0)}else this._tmpPositionVector.copyFromFloats(0,0,0);var e;p.setDeltaPosition(this._tmpPositionVector)}},e.prototype.removePhysicsBody=function(e){this.world.removeRigidBody(e.physicsBody)},e.prototype.generateJoint=function(e){var t=e.mainImpostor.physicsBody,i=e.connectedImpostor.physicsBody;if(t&&i){var r,n=e.joint.jointData,o=n.nativeParams||{},s={body1:t,body2:i,axe1:o.axe1||(n.mainAxis?n.mainAxis.asArray():null),axe2:o.axe2||(n.connectedAxis?n.connectedAxis.asArray():null),pos1:o.pos1||(n.mainPivot?n.mainPivot.asArray():null),pos2:o.pos2||(n.connectedPivot?n.connectedPivot.asArray():null),min:o.min,max:o.max,collision:o.collision||n.collision,spring:o.spring,world:this.world};switch(e.joint.type){case Vo.PhysicsJoint.BallAndSocketJoint:r="jointBall";break;case Vo.PhysicsJoint.SpringJoint:Vo.Tools.Warn("OIMO.js doesn't support Spring Constraint. Simulating using DistanceJoint instead");var a=n;s.min=a.length||s.min,s.max=Math.max(s.min,s.max);case Vo.PhysicsJoint.DistanceJoint:r="jointDistance",s.max=n.maxDistance;break;case Vo.PhysicsJoint.PrismaticJoint:r="jointPrisme";break;case Vo.PhysicsJoint.SliderJoint:r="jointSlide";break;case Vo.PhysicsJoint.WheelJoint:r="jointWheel";break;case Vo.PhysicsJoint.HingeJoint:default:r="jointHinge"}s.type=r,e.joint.physicsJoint=this.world.add(s)}},e.prototype.removeJoint=function(e){try{this.world.removeJoint(e.joint.physicsJoint)}catch(e){Vo.Tools.Warn(e)}},e.prototype.isSupported=function(){return void 0!==this.BJSOIMO},e.prototype.setTransformationFromPhysicsBody=function(e){e.physicsBody.sleeping||(e.object.position.copyFrom(e.physicsBody.getPosition()),e.object.rotationQuaternion&&e.object.rotationQuaternion.copyFrom(e.physicsBody.getQuaternion()))},e.prototype.setPhysicsBodyTransformation=function(e,t,i){var r=e.physicsBody;r.position.copy(t),r.orientation.copy(i),r.syncShapes(),r.awake()},e.prototype.setLinearVelocity=function(e,t){e.physicsBody.linearVelocity.copy(t)},e.prototype.setAngularVelocity=function(e,t){e.physicsBody.angularVelocity.copy(t)},e.prototype.getLinearVelocity=function(e){var t=e.physicsBody.linearVelocity;return t?new Vo.Vector3(t.x,t.y,t.z):null},e.prototype.getAngularVelocity=function(e){var t=e.physicsBody.angularVelocity;return t?new Vo.Vector3(t.x,t.y,t.z):null},e.prototype.setBodyMass=function(e,t){var i=0===t;e.physicsBody.shapes.density=i?1:t,e.physicsBody.setupMass(i?2:1)},e.prototype.getBodyMass=function(e){return e.physicsBody.shapes.density},e.prototype.getBodyFriction=function(e){return e.physicsBody.shapes.friction},e.prototype.setBodyFriction=function(e,t){e.physicsBody.shapes.friction=t},e.prototype.getBodyRestitution=function(e){return e.physicsBody.shapes.restitution},e.prototype.setBodyRestitution=function(e,t){e.physicsBody.shapes.restitution=t},e.prototype.sleepBody=function(e){e.physicsBody.sleep()},e.prototype.wakeUpBody=function(e){e.physicsBody.awake()},e.prototype.updateDistanceJoint=function(e,t,i){e.physicsJoint.limitMotor.upperLimit=t,void 0!==i&&(e.physicsJoint.limitMotor.lowerLimit=i)},e.prototype.setMotor=function(e,t,i,r){var n=r?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;n&&n.setMotor(t,i)},e.prototype.setLimit=function(e,t,i,r){var n=r?e.physicsJoint.rotationalLimitMotor2:e.physicsJoint.rotationalLimitMotor1||e.physicsJoint.rotationalLimitMotor||e.physicsJoint.limitMotor;n&&n.setLimit(t,void 0===i?-t:i)},e.prototype.syncMeshWithImpostor=function(e,t){var i=t.physicsBody;e.position.x=i.position.x,e.position.y=i.position.y,e.position.z=i.position.z,e.rotationQuaternion&&(e.rotationQuaternion.x=i.orientation.x,e.rotationQuaternion.y=i.orientation.y,e.rotationQuaternion.z=i.orientation.z,e.rotationQuaternion.w=i.orientation.s)},e.prototype.getRadius=function(e){return e.physicsBody.shapes.radius},e.prototype.getBoxSizeToRef=function(e,t){var i=e.physicsBody.shapes;t.x=2*i.halfWidth,t.y=2*i.halfHeight,t.z=2*i.halfDepth},e.prototype.dispose=function(){this.world.clear()},e})(),Vo.OimoJSPlugin=Uo,(function(n){n.Scene.prototype.getPhysicsEngine=function(){return this._physicsEngine},n.Scene.prototype.enablePhysics=function(e,t){if(void 0===e&&(e=null),this._physicsEngine)return!0;var i=this._getComponent(n.SceneComponentConstants.NAME_PHYSICSENGINE);i||(i=new r(this),this._addComponent(i));try{return this._physicsEngine=new n.PhysicsEngine(e,t),!0}catch(e){return n.Tools.Error(e.message),!1}},n.Scene.prototype.disablePhysicsEngine=function(){this._physicsEngine&&(this._physicsEngine.dispose(),this._physicsEngine=null)},n.Scene.prototype.isPhysicsEnabled=function(){return void 0!==this._physicsEngine},n.Scene.prototype.deleteCompoundImpostor=function(e){var t=e.parts[0].mesh;t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)},n.Scene.prototype._advancePhysicsEngineStep=function(e){this._physicsEngine&&(this.onBeforePhysicsObservable.notifyObservers(this),this._physicsEngine._step(e/1e3),this.onAfterPhysicsObservable.notifyObservers(this))},Object.defineProperty(n.AbstractMesh.prototype,"physicsImpostor",{get:function(){return this._physicsImpostor},set:function(e){var t=this;this._physicsImpostor!==e&&(this._disposePhysicsObserver&&this.onDisposeObservable.remove(this._disposePhysicsObserver),(this._physicsImpostor=e)&&(this._disposePhysicsObserver=this.onDisposeObservable.add((function(){t.physicsImpostor&&(t.physicsImpostor.dispose(),t.physicsImpostor=null)}))))},enumerable:!0,configurable:!0}),n.AbstractMesh.prototype.getPhysicsImpostor=function(){return this.physicsImpostor},n.AbstractMesh.prototype.applyImpulse=function(e,t){return this.physicsImpostor&&this.physicsImpostor.applyImpulse(e,t),this},n.AbstractMesh.prototype.setPhysicsLinkWith=function(e,t,i,r){return this.physicsImpostor&&e.physicsImpostor&&this.physicsImpostor.createJoint(e.physicsImpostor,n.PhysicsJoint.HingeJoint,{mainPivot:t,connectedPivot:i,nativeParams:r}),this};var r=(function(){function e(e){var t=this;this.name=n.SceneComponentConstants.NAME_PHYSICSENGINE,this.scene=e,this.scene.onBeforePhysicsObservable=new n.Observable,this.scene.onAfterPhysicsObservable=new n.Observable,this.scene.getDeterministicFrameTime=function(){return t.scene._physicsEngine?1e3*t.scene._physicsEngine.getTimeStep():1e3/60}}return e.prototype.register=function(){},e.prototype.rebuild=function(){},e.prototype.dispose=function(){this.scene.onBeforePhysicsObservable.clear(),this.scene.onAfterPhysicsObservable.clear(),this.scene._physicsEngine&&this.scene.disablePhysicsEngine()},e})();n.PhysicsEngineSceneComponent=r})($a||($a={})),(function(B){function e(e){return e.charCodeAt(0)+(e.charCodeAt(1)<<8)+(e.charCodeAt(2)<<16)+(e.charCodeAt(3)<<24)}var N=e("DXT1"),V=e("DXT3"),U=e("DXT5"),z=e("DX10"),t=(function(){function F(){}return F.GetDDSInfo=function(e){var t=new Int32Array(e,0,31),i=new Int32Array(e,0,35),r=1;131072&t[2]&&(r=Math.max(1,t[7]));var n=t[21],o=n===z?i[32]:0,s=B.Engine.TEXTURETYPE_UNSIGNED_INT;switch(n){case 113:s=B.Engine.TEXTURETYPE_HALF_FLOAT;break;case 116:s=B.Engine.TEXTURETYPE_FLOAT;break;case z:if(10===o){s=B.Engine.TEXTURETYPE_HALF_FLOAT;break}}return{width:t[4],height:t[3],mipmapCount:r,isFourCC:4==(4&t[20]),isRGB:64==(64&t[20]),isLuminance:131072==(131072&t[20]),isCube:512==(512&t[28]),isCompressed:n===N||n===V||n===U,dxgiFormat:o,textureType:s}},F._ToHalfFloat=function(e){F._FloatView||(F._FloatView=new Float32Array(1),F._Int32View=new Int32Array(F._FloatView.buffer)),F._FloatView[0]=e;var t=F._Int32View[0],i=t>>16&32768,r=t>>12&2047,n=t>>23&255;return n<103?i:142<n?(i|=31744,i|=(255==n?0:1)&&8388607&t):n<113?i|=((r|=2048)>>114-n)+(r>>113-n&1):(i|=n-112<<10|r>>1,i+=1&r)},F._FromHalfFloat=function(e){var t=(32768&e)>>15,i=(31744&e)>>10,r=1023&e;return 0===i?(t?-1:1)*Math.pow(2,-14)*(r/Math.pow(2,10)):31==i?r?NaN:1/0*(t?-1:1):(t?-1:1)*Math.pow(2,i-15)*(1+r/Math.pow(2,10))},F._GetHalfFloatAsFloatRGBAArrayBuffer=function(e,t,i,r,n,o){for(var s=new Float32Array(r),a=new Uint16Array(n,i),l=0,c=0;c<t;c++)for(var h=0;h<e;h++){var u=4*(h+c*e);s[l]=F._FromHalfFloat(a[u]),s[l+1]=F._FromHalfFloat(a[u+1]),s[l+2]=F._FromHalfFloat(a[u+2]),s[l+3]=F.StoreLODInAlphaChannel?o:F._FromHalfFloat(a[u+3]),l+=4}return s},F._GetHalfFloatRGBAArrayBuffer=function(e,t,i,r,n,o){if(F.StoreLODInAlphaChannel){for(var s=new Uint16Array(r),a=new Uint16Array(n,i),l=0,c=0;c<t;c++)for(var h=0;h<e;h++){var u=4*(h+c*e);s[l]=a[u],s[l+1]=a[u+1],s[l+2]=a[u+2],s[l+3]=F._ToHalfFloat(o),l+=4}return s}return new Uint16Array(n,i,r)},F._GetFloatRGBAArrayBuffer=function(e,t,i,r,n,o){if(F.StoreLODInAlphaChannel){for(var s=new Float32Array(r),a=new Float32Array(n,i),l=0,c=0;c<t;c++)for(var h=0;h<e;h++){var u=4*(h+c*e);s[l]=a[u],s[l+1]=a[u+1],s[l+2]=a[u+2],s[l+3]=o,l+=4}return s}return new Float32Array(n,i,r)},F._GetFloatAsUIntRGBAArrayBuffer=function(e,t,i,r,n,o){for(var s=new Uint8Array(r),a=new Float32Array(n,i),l=0,c=0;c<t;c++)for(var h=0;h<e;h++){var u=4*(h+c*e);s[l]=255*B.Scalar.Clamp(a[u]),s[l+1]=255*B.Scalar.Clamp(a[u+1]),s[l+2]=255*B.Scalar.Clamp(a[u+2]),s[l+3]=F.StoreLODInAlphaChannel?o:255*B.Scalar.Clamp(a[u+3]),l+=4}return s},F._GetHalfFloatAsUIntRGBAArrayBuffer=function(e,t,i,r,n,o){for(var s=new Uint8Array(r),a=new Uint16Array(n,i),l=0,c=0;c<t;c++)for(var h=0;h<e;h++){var u=4*(h+c*e);s[l]=255*B.Scalar.Clamp(F._FromHalfFloat(a[u])),s[l+1]=255*B.Scalar.Clamp(F._FromHalfFloat(a[u+1])),s[l+2]=255*B.Scalar.Clamp(F._FromHalfFloat(a[u+2])),s[l+3]=F.StoreLODInAlphaChannel?o:255*B.Scalar.Clamp(F._FromHalfFloat(a[u+3])),l+=4}return s},F._GetRGBAArrayBuffer=function(e,t,i,r,n,o,s,a,l){for(var c=new Uint8Array(r),h=new Uint8Array(n,i),u=0,d=0;d<t;d++)for(var f=0;f<e;f++){var p=4*(f+d*e);c[u]=h[p+o],c[u+1]=h[p+s],c[u+2]=h[p+a],c[u+3]=h[p+l],u+=4}return c},F._ExtractLongWordOrder=function(e){return 0===e||255===e||-16777216===e?0:1+F._ExtractLongWordOrder(e>>8)},F._GetRGBArrayBuffer=function(e,t,i,r,n,o,s,a){for(var l=new Uint8Array(r),c=new Uint8Array(n,i),h=0,u=0;u<t;u++)for(var d=0;d<e;d++){var f=3*(d+u*e);l[h]=c[f+o],l[h+1]=c[f+s],l[h+2]=c[f+a],h+=3}return l},F._GetLuminanceArrayBuffer=function(e,t,i,r,n){for(var o=new Uint8Array(r),s=new Uint8Array(n,i),a=0,l=0;l<t;l++)for(var c=0;c<e;c++){var h=c+l*e;o[a]=s[h],a++}return o},F.UploadDDSLevels=function(e,t,i,r,n,o,s,a){void 0===s&&(s=-1);var l=null;r.sphericalPolynomial&&(l=new Array);var c,h,u,d,f,p,_,m=e.getCaps().s3tc,g=new Int32Array(i,0,31),v=0,y=0,b=1;if(542327876===g[0])if(r.isFourCC||r.isRGB||r.isLuminance)if(!r.isCompressed||m){var T=g[22];d=g[1]+4;var E,x=!1;if(r.isFourCC)switch(c=g[21]){case N:b=8,y=m.COMPRESSED_RGBA_S3TC_DXT1_EXT;break;case V:b=16,y=m.COMPRESSED_RGBA_S3TC_DXT3_EXT;break;case U:b=16,y=m.COMPRESSED_RGBA_S3TC_DXT5_EXT;break;case 113:case 116:x=!0;break;case z:d+=20;var P=!1;switch(r.dxgiFormat){case 10:P=x=!0;break;case 88:r.isRGB=!0,T=32,P=!(r.isFourCC=!1)}if(P)break;default:return void console.error("Unsupported FourCC code:",(E=c,String.fromCharCode(255&E,E>>8&255,E>>16&255,E>>24&255)))}var A=F._ExtractLongWordOrder(g[23]),S=F._ExtractLongWordOrder(g[24]),M=F._ExtractLongWordOrder(g[25]),R=F._ExtractLongWordOrder(g[26]);x&&(y=e._getRGBABufferInternalSizedFormat(r.textureType)),p=1,131072&g[2]&&!1!==n&&(p=Math.max(1,g[7]));for(var C=0;C<o;C++){for(h=g[4],u=g[3],_=0;_<p;++_){if(-1===s||s===_){var O=-1===s?_:0;if(!r.isCompressed&&r.isFourCC){t.format=B.Engine.TEXTUREFORMAT_RGBA,v=h*u*4;var D=null;e._badOS||e._badDesktopOS||!e.getCaps().textureHalfFloat&&!e.getCaps().textureFloat?(128===T?(D=F._GetFloatAsUIntRGBAArrayBuffer(h,u,d,v,i,O),l&&0==O&&l.push(F._GetFloatRGBAArrayBuffer(h,u,d,v,i,O))):64===T&&(D=F._GetHalfFloatAsUIntRGBAArrayBuffer(h,u,d,v,i,O),l&&0==O&&l.push(F._GetHalfFloatAsFloatRGBAArrayBuffer(h,u,d,v,i,O))),t.type=B.Engine.TEXTURETYPE_UNSIGNED_INT):128===T?(t.type=B.Engine.TEXTURETYPE_FLOAT,D=F._GetFloatRGBAArrayBuffer(h,u,d,v,i,O),l&&0==O&&l.push(D)):64!==T||e.getCaps().textureHalfFloat?(t.type=B.Engine.TEXTURETYPE_HALF_FLOAT,D=F._GetHalfFloatRGBAArrayBuffer(h,u,d,v,i,O),l&&0==O&&l.push(F._GetHalfFloatAsFloatRGBAArrayBuffer(h,u,d,v,i,O))):(t.type=B.Engine.TEXTURETYPE_FLOAT,D=F._GetHalfFloatAsFloatRGBAArrayBuffer(h,u,d,v,i,O),l&&0==O&&l.push(D)),D&&e._uploadDataToTextureDirectly(t,D,C,O)}else if(r.isRGB)t.type=B.Engine.TEXTURETYPE_UNSIGNED_INT,24===T?(t.format=B.Engine.TEXTUREFORMAT_RGB,f=F._GetRGBArrayBuffer(h,u,d,v=h*u*3,i,A,S,M)):(t.format=B.Engine.TEXTUREFORMAT_RGBA,f=F._GetRGBAArrayBuffer(h,u,d,v=h*u*4,i,A,S,M,R)),e._uploadDataToTextureDirectly(t,f,C,O);else if(r.isLuminance){var I=e._getUnpackAlignement(),w=h,L=Math.floor((h+I-1)/I)*I;f=F._GetLuminanceArrayBuffer(h,u,d,v=L*(u-1)+w,i),t.format=B.Engine.TEXTUREFORMAT_LUMINANCE,t.type=B.Engine.TEXTURETYPE_UNSIGNED_INT,e._uploadDataToTextureDirectly(t,f,C,O)}else v=Math.max(4,h)/4*Math.max(4,u)/4*b,f=new Uint8Array(i,d,v),t.type=B.Engine.TEXTURETYPE_UNSIGNED_INT,e._uploadCompressedDataToTextureDirectly(t,y,h,u,f,C,O)}d+=T?h*u*(T/8):v,h*=.5,u*=.5,h=Math.max(1,h),u=Math.max(1,u)}if(void 0!==a)break}l&&0<l.length?r.sphericalPolynomial=B.CubeMapToSphericalPolynomialTools.ConvertCubeMapToSphericalPolynomial({size:g[4],right:l[0],left:l[1],up:l[2],down:l[3],front:l[4],back:l[5],format:B.Engine.TEXTUREFORMAT_RGBA,type:B.Engine.TEXTURETYPE_FLOAT,gammaSpace:!1}):r.sphericalPolynomial=void 0}else B.Tools.Error("Compressed textures are not supported on this platform.");else B.Tools.Error("Unsupported format, must contain a FourCC, RGB or LUMINANCE code");else B.Tools.Error("Invalid magic number in DDS header")},F.StoreLODInAlphaChannel=!1,F})();B.DDSTools=t})($a||($a={})),zo=$a||($a={}),Go=(function(){function e(){this.supportCascades=!0}return e.prototype.canLoad=function(e,t,i,r,n){return 0===e.indexOf(".dds")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,r,n){var o,s=t.getEngine(),a=!1;if(Array.isArray(e))for(var l=0;l<e.length;l++){var c=e[l];o=zo.DDSTools.GetDDSInfo(c),t.width=o.width,t.height=o.height,a=(o.isRGB||o.isLuminance||1<o.mipmapCount)&&t.generateMipMaps,s._unpackFlipY(o.isCompressed),zo.DDSTools.UploadDDSLevels(s,t,c,o,a,6,-1,l),o.isFourCC||1!==o.mipmapCount||s.generateMipMapsForCubemap(t)}else{var h=e;o=zo.DDSTools.GetDDSInfo(h),t.width=o.width,t.height=o.height,i&&(o.sphericalPolynomial=new zo.SphericalPolynomial),a=(o.isRGB||o.isLuminance||1<o.mipmapCount)&&t.generateMipMaps,s._unpackFlipY(o.isCompressed),zo.DDSTools.UploadDDSLevels(s,t,h,o,a,6),o.isFourCC||1!==o.mipmapCount||s.generateMipMapsForCubemap(t)}s._setCubeMapTextureParams(a),t.isReady=!0,r&&r({isDDS:!0,width:t.width,info:o,data:e,texture:t})},e.prototype.loadData=function(e,t,i){var r=zo.DDSTools.GetDDSInfo(e),n=(r.isRGB||r.isLuminance||1<r.mipmapCount)&&t.generateMipMaps&&r.width>>r.mipmapCount-1==1;i(r.width,r.height,n,r.isFourCC,(function(){zo.DDSTools.UploadDDSLevels(t.getEngine(),t,e,r,n,1)}))},e})(),zo.Engine._TextureLoaders.push(new Go),ko=$a||($a={}),Wo=(function(){function x(){}return x.GetTGAHeader=function(e){var t=0;return{id_length:e[t++],colormap_type:e[t++],image_type:e[t++],colormap_index:e[t++]|e[t++]<<8,colormap_length:e[t++]|e[t++]<<8,colormap_size:e[t++],origin:[e[t++]|e[t++]<<8,e[t++]|e[t++]<<8],width:e[t++]|e[t++]<<8,height:e[t++]|e[t++]<<8,pixel_size:e[t++],flags:e[t++]}},x.UploadContent=function(e,t){if(t.length<19)ko.Tools.Error("Unable to load TGA file - Not enough data to contain header");else{var i=18,r=x.GetTGAHeader(t);if(r.id_length+i>t.length)ko.Tools.Error("Unable to load TGA file - Not enough data");else{i+=r.id_length;var n,o=!1,s=!1,a=!1;switch(r.image_type){case x._TYPE_RLE_INDEXED:o=!0;case x._TYPE_INDEXED:s=!0;break;case x._TYPE_RLE_RGB:o=!0;case x._TYPE_RGB:break;case x._TYPE_RLE_GREY:o=!0;case x._TYPE_GREY:a=!0}var l,c,h,u,d,f,p,_=r.pixel_size>>3,m=r.width*r.height*_;if(s&&(l=t.subarray(i,i+=r.colormap_length*(r.colormap_size>>3))),o){var g,v,y;n=new Uint8Array(m);for(var b=0,T=new Uint8Array(_);i<m&&b<m;)if(v=1+(127&(g=t[i++])),128&g){for(y=0;y<_;++y)T[y]=t[i++];for(y=0;y<v;++y)n.set(T,b+y*_);b+=_*v}else{for(v*=_,y=0;y<v;++y)n[b+y]=t[i++];b+=v}}else n=t.subarray(i,i+=s?r.width*r.height:m);switch((r.flags&x._ORIGIN_MASK)>>x._ORIGIN_SHIFT){default:case x._ORIGIN_UL:c=0,u=1,p=r.width,h=0,d=1,f=r.height;break;case x._ORIGIN_BL:c=0,u=1,p=r.width,h=r.height-1,f=d=-1;break;case x._ORIGIN_UR:c=r.width-1,p=u=-1,h=0,d=1,f=r.height;break;case x._ORIGIN_BR:c=r.width-1,p=u=-1,h=r.height-1,f=d=-1}var E=x["_getImageData"+(a?"Grey":"")+r.pixel_size+"bits"](r,l,n,h,d,f,c,u,p);e.getEngine()._uploadDataToTextureDirectly(e,E)}}},x._getImageData8bits=function(e,t,i,r,n,o,s,a,l){var c,h,u,d=i,f=t,p=e.width,_=e.height,m=0,g=new Uint8Array(p*_*4);for(u=r;u!==o;u+=n)for(h=s;h!==l;h+=a,m++)c=d[m],g[4*(h+p*u)+3]=255,g[4*(h+p*u)+2]=f[3*c+0],g[4*(h+p*u)+1]=f[3*c+1],g[4*(h+p*u)+0]=f[3*c+2];return g},x._getImageData16bits=function(e,t,i,r,n,o,s,a,l){var c,h,u,d=i,f=e.width,p=e.height,_=0,m=new Uint8Array(f*p*4);for(u=r;u!==o;u+=n)for(h=s;h!==l;h+=a,_+=2){var g=255*((31744&(c=d[_+0]+(d[_+1]<<8)))>>10)/31|0,v=255*((992&c)>>5)/31|0,y=255*(31&c)/31|0;m[4*(h+f*u)+0]=g,m[4*(h+f*u)+1]=v,m[4*(h+f*u)+2]=y,m[4*(h+f*u)+3]=32768&c?0:255}return m},x._getImageData24bits=function(e,t,i,r,n,o,s,a,l){var c,h,u=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(h=r;h!==o;h+=n)for(c=s;c!==l;c+=a,p+=3)_[4*(c+d*h)+3]=255,_[4*(c+d*h)+2]=u[p+0],_[4*(c+d*h)+1]=u[p+1],_[4*(c+d*h)+0]=u[p+2];return _},x._getImageData32bits=function(e,t,i,r,n,o,s,a,l){var c,h,u=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(h=r;h!==o;h+=n)for(c=s;c!==l;c+=a,p+=4)_[4*(c+d*h)+2]=u[p+0],_[4*(c+d*h)+1]=u[p+1],_[4*(c+d*h)+0]=u[p+2],_[4*(c+d*h)+3]=u[p+3];return _},x._getImageDataGrey8bits=function(e,t,i,r,n,o,s,a,l){var c,h,u,d=i,f=e.width,p=e.height,_=0,m=new Uint8Array(f*p*4);for(u=r;u!==o;u+=n)for(h=s;h!==l;h+=a,_++)c=d[_],m[4*(h+f*u)+0]=c,m[4*(h+f*u)+1]=c,m[4*(h+f*u)+2]=c,m[4*(h+f*u)+3]=255;return m},x._getImageDataGrey16bits=function(e,t,i,r,n,o,s,a,l){var c,h,u=i,d=e.width,f=e.height,p=0,_=new Uint8Array(d*f*4);for(h=r;h!==o;h+=n)for(c=s;c!==l;c+=a,p+=2)_[4*(c+d*h)+0]=u[p+0],_[4*(c+d*h)+1]=u[p+0],_[4*(c+d*h)+2]=u[p+0],_[4*(c+d*h)+3]=u[p+1];return _},x._TYPE_INDEXED=1,x._TYPE_RGB=2,x._TYPE_GREY=3,x._TYPE_RLE_INDEXED=9,x._TYPE_RLE_RGB=10,x._TYPE_RLE_GREY=11,x._ORIGIN_MASK=48,x._ORIGIN_SHIFT=4,x._ORIGIN_BL=0,x._ORIGIN_BR=1,x._ORIGIN_UL=2,x._ORIGIN_UR=3,x})(),ko.TGATools=Wo,Ho=$a||($a={}),Xo=(function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,r,n){return 0===e.indexOf(".tga")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,r,n){throw".env not supported in Cube."},e.prototype.loadData=function(e,t,i){var r=new Uint8Array(e),n=Ho.TGATools.GetTGAHeader(r);i(n.width,n.height,t.generateMipMaps,!1,(function(){Ho.TGATools.UploadContent(t,r)}))},e})(),Ho.Engine._TextureLoaders.push(new Xo),jo=$a||($a={}),Yo=(function(){function h(e,t,i,r){this.arrayBuffer=e;var n=new Uint8Array(this.arrayBuffer,0,12);if(171===n[0]&&75===n[1]&&84===n[2]&&88===n[3]&&32===n[4]&&49===n[5]&&49===n[6]&&187===n[7]&&13===n[8]&&10===n[9]&&26===n[10]&&10===n[11]){var o=new Int32Array(this.arrayBuffer,12,13),s=16909060===o[0];this.glType=s?this.switchEndianness(o[1]):o[1],this.glTypeSize=s?this.switchEndianness(o[2]):o[2],this.glFormat=s?this.switchEndianness(o[3]):o[3],this.glInternalFormat=s?this.switchEndianness(o[4]):o[4],this.glBaseInternalFormat=s?this.switchEndianness(o[5]):o[5],this.pixelWidth=s?this.switchEndianness(o[6]):o[6],this.pixelHeight=s?this.switchEndianness(o[7]):o[7],this.pixelDepth=s?this.switchEndianness(o[8]):o[8],this.numberOfArrayElements=s?this.switchEndianness(o[9]):o[9],this.numberOfFaces=s?this.switchEndianness(o[10]):o[10],this.numberOfMipmapLevels=s?this.switchEndianness(o[11]):o[11],this.bytesOfKeyValueData=s?this.switchEndianness(o[12]):o[12],0===this.glType?(this.numberOfMipmapLevels=Math.max(1,this.numberOfMipmapLevels),0!==this.pixelHeight&&0===this.pixelDepth?0===this.numberOfArrayElements?this.numberOfFaces===t?this.loadType=h.COMPRESSED_2D:jo.Tools.Error("number of faces expected"+t+", but found "+this.numberOfFaces):jo.Tools.Error("texture arrays not currently supported"):jo.Tools.Error("only 2D textures currently supported")):jo.Tools.Error("only compressed formats currently supported")}else jo.Tools.Error("texture missing KTX identifier")}return h.prototype.switchEndianness=function(e){return(255&e)<<24|(65280&e)<<8|e>>8&65280|e>>24&255},h.prototype.uploadLevels=function(e,t){switch(this.loadType){case h.COMPRESSED_2D:this._upload2DCompressedLevels(e,t)}},h.prototype._upload2DCompressedLevels=function(e,t){for(var i=h.HEADER_LEN+this.bytesOfKeyValueData,r=this.pixelWidth,n=this.pixelHeight,o=t?this.numberOfMipmapLevels:1,s=0;s<o;s++){var a=new Int32Array(this.arrayBuffer,i,1)[0];i+=4;for(var l=0;l<this.numberOfFaces;l++){var c=new Uint8Array(this.arrayBuffer,i,a);e.getEngine()._uploadCompressedDataToTextureDirectly(e,this.glInternalFormat,r,n,c,l,s),i+=a,i+=3-(a+3)%4}r=Math.max(1,.5*r),n=Math.max(1,.5*n)}},h.HEADER_LEN=64,h.COMPRESSED_2D=0,h.COMPRESSED_3D=1,h.TEX_2D=2,h.TEX_3D=3,h})(),jo.KhronosTextureContainer=Yo,Ko=$a||($a={}),Qo=(function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,r,n){return!(!t||r||i||n)},e.prototype.transformUrl=function(e,t){var i=e.lastIndexOf(".");return(-1<i?e.substring(0,i):e)+t},e.prototype.getFallbackTextureUrl=function(e,t){var i=new RegExp(t+"$");return e.replace(i,"")},e.prototype.loadCubeData=function(e,t,i,r,n){if(!Array.isArray(e)){var o=t.getEngine(),s=new Ko.KhronosTextureContainer(e,6),a=1<s.numberOfMipmapLevels&&t.generateMipMaps;o._unpackFlipY(!0),s.uploadLevels(t,t.generateMipMaps),t.width=s.pixelWidth,t.height=s.pixelHeight,o._setCubeMapTextureParams(a),t.isReady=!0}},e.prototype.loadData=function(e,t,i){var r=new Ko.KhronosTextureContainer(e,1);i(r.pixelWidth,r.pixelHeight,!1,!0,(function(){r.uploadLevels(t,t.generateMipMaps)}))},e})(),Ko.Engine._TextureLoaders.unshift(new Qo),Zo=$a||($a={}),qo=(function(){function T(){}return T.GetEnvInfo=function(e){for(var t=new DataView(e),i=0,r=0;r<T._MagicBytes.length;r++)if(t.getUint8(i++)!==T._MagicBytes[r])return Zo.Tools.Error("Not a babylon environment map"),null;for(var n="",o=0;o=t.getUint8(i++);)n+=String.fromCharCode(o);var s=JSON.parse(n);return s.specular&&(s.specular.specularDataPosition=i,s.specular.lodGenerationScale=s.specular.lodGenerationScale||.8),s},T.CreateEnvTextureAsync=function(_){var m=this,e=_.getInternalTexture();if(!e)return Promise.reject("The cube texture is invalid.");if(!_._prefiltered)return Promise.reject("The cube texture is invalid (not prefiltered).");var l=e.getEngine();if(l&&l.premultipliedAlpha)return Promise.reject("Env texture can only be created when the engine is created with the premultipliedAlpha option set to false.");if(_.textureType===Zo.Engine.TEXTURETYPE_UNSIGNED_INT)return Promise.reject("The cube texture should allow HDR (Full Float or Half Float).");var c=l.getRenderingCanvas();if(!c)return Promise.reject("Env texture can only be created when the engine is associated to a canvas.");var i=Zo.Engine.TEXTURETYPE_FLOAT;if(!l.getCaps().textureFloatRender&&(i=Zo.Engine.TEXTURETYPE_HALF_FLOAT,!l.getCaps().textureHalfFloatRender))return Promise.reject("Env texture can only be created when the browser supports half float or full float rendering.");var g=e.width,v=new Zo.Scene(l),y={},r=[],b=Zo.Scalar.Log2(e.width);b=Math.round(b);for(var t=function(s){for(var a=Math.pow(2,b-s),e=function(n){var e=_.readPixels(n,s),o=l.createRawTexture(e,a,a,Zo.Engine.TEXTUREFORMAT_RGBA,!1,!1,Zo.Texture.NEAREST_SAMPLINGMODE,null,i),t=new Promise(function(i,e){var r=new Zo.PostProcess("rgbdEncode","rgbdEncode",null,null,1,null,Zo.Texture.NEAREST_SAMPLINGMODE,l,!1,void 0,Zo.Engine.TEXTURETYPE_UNSIGNED_INT,void 0,null,!1);r.getEffect().executeWhenCompiled((function(){r.onApply=function(e){e._bindTexture("textureSampler",o)};var e=l.getRenderWidth(),t=l.getRenderHeight();l.setSize(a,a),v.postProcessManager.directRender([r],null),Zo.Tools.ToBlob(c,(function(e){var t=new FileReader;t.onload=function(e){var t=e.target.result;y[6*s+n]=t,i()},t.readAsArrayBuffer(e)})),l.setSize(e,t)}))});r.push(t)},t=0;t<6;t++)e(t)},n=0;n<=b;n++)t(n);return Promise.all(r).then((function(){v.dispose();for(var e={version:1,width:g,irradiance:m._CreateEnvTextureIrradiance(_),specular:{mipmaps:[],lodGenerationScale:_.lodGenerationScale}},t=0,i=0;i<=b;i++)for(var r=0;r<6;r++){var n=y[6*i+r].byteLength;e.specular.mipmaps.push({length:n,position:t}),t+=n}for(var o=JSON.stringify(e),s=new ArrayBuffer(o.length+1),a=new Uint8Array(s),l=(i=0,o.length);i<l;i++)a[i]=o.charCodeAt(i);a[o.length]=0;var c=T._MagicBytes.length+t+s.byteLength,h=new ArrayBuffer(c),u=new Uint8Array(h),d=new DataView(h),f=0;for(i=0;i<T._MagicBytes.length;i++)d.setUint8(f++,T._MagicBytes[i]);u.set(new Uint8Array(s),f),f+=s.byteLength;for(i=0;i<=b;i++)for(r=0;r<6;r++){var p=y[6*i+r];u.set(new Uint8Array(p),f),f+=p.byteLength}return h}))},T._CreateEnvTextureIrradiance=function(e){var t=e.sphericalPolynomial;return null==t?null:{x:[t.x.x,t.x.y,t.x.z],y:[t.y.x,t.y.y,t.y.z],z:[t.z.x,t.z.y,t.z.z],xx:[t.xx.x,t.xx.y,t.xx.z],yy:[t.yy.x,t.yy.y,t.yy.z],zz:[t.zz.x,t.zz.y,t.zz.z],yz:[t.yz.x,t.yz.y,t.yz.z],zx:[t.zx.x,t.zx.y,t.zx.z],xy:[t.xy.x,t.xy.y,t.xy.z]}},T.UploadEnvLevelsAsync=function(e,t,i){if(1!==i.version)throw new Error('Unsupported babylon environment map version "'+i.version+'"');var r=i.specular;if(!r)return Promise.resolve();var n=Zo.Scalar.Log2(i.width);if(n=Math.round(n)+1,r.mipmaps.length!==6*n)throw new Error('Unsupported specular mipmaps number "'+r.mipmaps.length+'"');e._lodGenerationScale=r.lodGenerationScale;for(var o=new Array(n),s=0;s<n;s++){o[s]=new Array(6);for(var a=0;a<6;a++){var l=r.mipmaps[6*s+a];o[s][a]=new Uint8Array(t,r.specularDataPosition+l.position,l.length)}}return T.UploadLevelsAsync(e,o)},T.UploadLevelsAsync=function(l,r){if(!Zo.Tools.IsExponentOfTwo(l.width))throw new Error("Texture size must be a power of two");var e=Math.round(Zo.Scalar.Log2(l.width))+1,c=l.getEngine(),h=!1,u=!1,d=null,f=null,p=null,t=c.getCaps();if(l.format=Zo.Engine.TEXTUREFORMAT_RGBA,l.type=Zo.Engine.TEXTURETYPE_UNSIGNED_INT,l.generateMipMaps=!0,c.updateTextureSamplingMode(Zo.Texture.TRILINEAR_SAMPLINGMODE,l),t.textureLOD?c.webGLVersion<2?h=!1:t.textureHalfFloatRender&&t.textureHalfFloatLinearFiltering?(h=!0,l.type=Zo.Engine.TEXTURETYPE_HALF_FLOAT):t.textureFloatRender&&t.textureFloatLinearFiltering&&(h=!0,l.type=Zo.Engine.TEXTURETYPE_FLOAT):(u=!(h=!1),p={}),h)d=new Zo.PostProcess("rgbdDecode","rgbdDecode",null,null,1,null,Zo.Texture.TRILINEAR_SAMPLINGMODE,c,!1,void 0,l.type,void 0,null,!1),l._isRGBD=!1,l.invertY=!1,f=c.createRenderTargetCubeTexture(l.width,{generateDepthBuffer:!1,generateMipMaps:!0,generateStencilBuffer:!1,samplingMode:Zo.Texture.TRILINEAR_SAMPLINGMODE,type:l.type,format:Zo.Engine.TEXTUREFORMAT_RGBA});else if(l._isRGBD=!0,l.invertY=!0,u)for(var i=l._lodGenerationScale,n=l._lodGenerationOffset,o=0;o<3;o++){var s=(e-1)*i+n,a=n+(s-n)*(1-o/2),_=Math.round(Math.min(Math.max(a,0),s)),m=new Zo.InternalTexture(c,Zo.InternalTexture.DATASOURCE_TEMP);m.isCube=!0,m.invertY=!0,m.generateMipMaps=!1,c.updateTextureSamplingMode(Zo.Texture.LINEAR_LINEAR,m);var g=new Zo.BaseTexture(null);switch(g.isCube=!0,g._texture=m,p[_]=g,o){case 0:l._lodTextureLow=g;break;case 1:l._lodTextureMid=g;break;case 2:l._lodTextureHigh=g}}var v=[],y=function(a){for(var e=function(n){var e=r[a][n],t=new Blob([e],{type:"image/png"}),o=URL.createObjectURL(t),s=new Image;s.src=o;var i=new Promise(function(i,r){s.onload=function(){if(h){var t=c.createTexture(null,!0,!0,null,Zo.Texture.NEAREST_SAMPLINGMODE,null,(function(e){r(e)}),s);d.getEffect().executeWhenCompiled((function(){d.onApply=function(e){e._bindTexture("textureSampler",t),e.setFloat2("scale",1,1)},c.scenes[0].postProcessManager.directRender([d],f,!0,n,a),c.restoreDefaultFramebuffer(),t.dispose(),window.URL.revokeObjectURL(o),i()}))}else{if(c._uploadImageToTexture(l,s,n,a),u){var e=p[a];e&&c._uploadImageToTexture(e._texture,s,n,0)}i()}},s.onerror=function(e){r(e)}});v.push(i)},t=0;t<6;t++)e(t)};for(o=0;o<r.length;o++)y(o);if(r.length<e){var b=void 0,T=Math.pow(2,e-1-r.length),E=T*T*4;switch(l.type){case Zo.Engine.TEXTURETYPE_UNSIGNED_INT:b=new Uint8Array(E);break;case Zo.Engine.TEXTURETYPE_HALF_FLOAT:b=new Uint16Array(E);break;case Zo.Engine.TEXTURETYPE_FLOAT:b=new Float32Array(E)}for(o=r.length;o<e;o++)for(var x=0;x<6;x++)c._uploadArrayBufferViewToTexture(l,b,x,o)}return Promise.all(v).then((function(){f&&(c._releaseFramebufferObjects(f),f._swapAndDie(l)),d&&d.dispose(),u&&(l._lodTextureHigh&&l._lodTextureHigh._texture&&(l._lodTextureHigh._texture.isReady=!0),l._lodTextureMid&&l._lodTextureMid._texture&&(l._lodTextureMid._texture.isReady=!0),l._lodTextureLow&&l._lodTextureLow._texture&&(l._lodTextureLow._texture.isReady=!0))}))},T.UploadEnvSpherical=function(e,t){1!==t.version&&Zo.Tools.Warn('Unsupported babylon environment map version "'+t.version+'"');var i=t.irradiance;if(i){var r=new Zo.SphericalPolynomial;Zo.Vector3.FromArrayToRef(i.x,0,r.x),Zo.Vector3.FromArrayToRef(i.y,0,r.y),Zo.Vector3.FromArrayToRef(i.z,0,r.z),Zo.Vector3.FromArrayToRef(i.xx,0,r.xx),Zo.Vector3.FromArrayToRef(i.yy,0,r.yy),Zo.Vector3.FromArrayToRef(i.zz,0,r.zz),Zo.Vector3.FromArrayToRef(i.yz,0,r.yz),Zo.Vector3.FromArrayToRef(i.zx,0,r.zx),Zo.Vector3.FromArrayToRef(i.xy,0,r.xy),e._sphericalPolynomial=r}},T._MagicBytes=[134,22,135,150,246,214,150,54],T})(),Zo.EnvironmentTextureTools=qo,Jo=$a||($a={}),$o=(function(){function e(){this.supportCascades=!1}return e.prototype.canLoad=function(e,t,i,r,n){return 0===e.indexOf(".env")},e.prototype.transformUrl=function(e,t){return e},e.prototype.getFallbackTextureUrl=function(e,t){return null},e.prototype.loadCubeData=function(e,t,i,r,n){if(!Array.isArray(e)){e=e;var o=Jo.EnvironmentTextureTools.GetEnvInfo(e);o?(t.width=o.width,t.height=o.width,Jo.EnvironmentTextureTools.UploadEnvSpherical(t,o),Jo.EnvironmentTextureTools.UploadEnvLevelsAsync(t,e,o).then((function(){t.isReady=!0,r&&r()}))):n&&n("Can not parse the environment file",null)}},e.prototype.loadData=function(e,t,i){throw".env not supported in 2d."},e})(),Jo.Engine._TextureLoaders.push(new $o),es=$a||($a={}),ts=(function(){function e(s){var a=this;this.originalScene=s,this._pointerCaptures={},this._lastPointerEvents={},this.shouldRender=!0,this.onlyCheckPointerDownEvents=!0,this.processAllEvents=!1,this.onPointerOutObservable=new es.Observable,this.utilityLayerScene=new es.Scene(s.getEngine()),this.utilityLayerScene.useRightHandedSystem=s.useRightHandedSystem,this.utilityLayerScene._allowPostProcessClearColor=!1,s.getEngine().scenes.pop(),this.utilityLayerScene.detachControl(),this._originalPointerObserver=s.onPrePointerObservable.add((function(e,t){if(a.processAllEvents||e.type===es.PointerEventTypes.POINTERMOVE||e.type===es.PointerEventTypes.POINTERUP||e.type===es.PointerEventTypes.POINTERDOWN){var i=e.event;if(s.isPointerCaptured(i.pointerId))a._pointerCaptures[i.pointerId]=!1;else{var r=e.ray?a.utilityLayerScene.pickWithRay(e.ray):a.utilityLayerScene.pick(s.pointerX,s.pointerY);if(!e.ray&&r&&(e.ray=r.ray),a.utilityLayerScene.onPrePointerObservable.notifyObservers(e),a.onlyCheckPointerDownEvents&&e.type!=es.PointerEventTypes.POINTERDOWN)return e.skipOnPointerObservable||a.utilityLayerScene.onPointerObservable.notifyObservers(new es.PointerInfo(e.type,e.event,r)),void(e.type===es.PointerEventTypes.POINTERUP&&a._pointerCaptures[i.pointerId]&&(a._pointerCaptures[i.pointerId]=!1));if(a.utilityLayerScene.autoClearDepthAndStencil)r&&r.hit&&(e.skipOnPointerObservable||a.utilityLayerScene.onPointerObservable.notifyObservers(new es.PointerInfo(e.type,e.event,r)),e.skipOnPointerObservable=!0);else{var n=e.ray?s.pickWithRay(e.ray):s.pick(s.pointerX,s.pointerY),o=e.event;n&&r&&(0===r.distance&&n.pickedMesh?a.mainSceneTrackerPredicate&&a.mainSceneTrackerPredicate(n.pickedMesh)?(a._notifyObservers(e,n,o),e.skipOnPointerObservable=!0):e.type===es.PointerEventTypes.POINTERDOWN?a._pointerCaptures[o.pointerId]=!0:a._lastPointerEvents[o.pointerId]&&(a.onPointerOutObservable.notifyObservers(o.pointerId),delete a._lastPointerEvents[o.pointerId]):!a._pointerCaptures[o.pointerId]&&(r.distance<n.distance||0===n.distance)?(a._notifyObservers(e,r,o),e.skipOnPointerObservable||(e.skipOnPointerObservable=0<r.distance)):!a._pointerCaptures[o.pointerId]&&r.distance>n.distance&&(a.mainSceneTrackerPredicate&&a.mainSceneTrackerPredicate(n.pickedMesh)?(a._notifyObservers(e,n,o),e.skipOnPointerObservable=!0):a._lastPointerEvents[o.pointerId]&&(a.onPointerOutObservable.notifyObservers(o.pointerId),delete a._lastPointerEvents[o.pointerId])),e.type===es.PointerEventTypes.POINTERUP&&a._pointerCaptures[o.pointerId]&&(a._pointerCaptures[o.pointerId]=!1))}}}})),this.utilityLayerScene.autoClear=!1,this._afterRenderObserver=this.originalScene.onAfterRenderObservable.add((function(){a.shouldRender&&a.render()})),this._sceneDisposeObserver=this.originalScene.onDisposeObservable.add((function(){a.dispose()})),this._updateCamera()}return Object.defineProperty(e,"DefaultUtilityLayer",{get:function(){return null==e._DefaultUtilityLayer&&(e._DefaultUtilityLayer=new e(es.Engine.LastCreatedScene)).originalScene.onDisposeObservable.addOnce((function(){e._DefaultUtilityLayer=null})),e._DefaultUtilityLayer},enumerable:!0,configurable:!0}),Object.defineProperty(e,"DefaultKeepDepthUtilityLayer",{get:function(){return null==e._DefaultKeepDepthUtilityLayer&&((e._DefaultKeepDepthUtilityLayer=new e(es.Engine.LastCreatedScene)).utilityLayerScene.autoClearDepthAndStencil=!1,e._DefaultKeepDepthUtilityLayer.originalScene.onDisposeObservable.addOnce((function(){e._DefaultKeepDepthUtilityLayer=null}))),e._DefaultKeepDepthUtilityLayer},enumerable:!0,configurable:!0}),e.prototype._notifyObservers=function(e,t,i){e.skipOnPointerObservable||(this.utilityLayerScene.onPointerObservable.notifyObservers(new es.PointerInfo(e.type,e.event,t)),this._lastPointerEvents[i.pointerId]=!0)},e.prototype.render=function(){if(this._updateCamera(),this.utilityLayerScene.activeCamera){var e=this.utilityLayerScene.activeCamera.getScene(),t=this.utilityLayerScene.activeCamera;t._scene=this.utilityLayerScene,t.leftCamera&&(t.leftCamera._scene=this.utilityLayerScene),t.rightCamera&&(t.rightCamera._scene=this.utilityLayerScene),this.utilityLayerScene.render(!1),t._scene=e,t.leftCamera&&(t.leftCamera._scene=e),t.rightCamera&&(t.rightCamera._scene=e)}},e.prototype.dispose=function(){this.onPointerOutObservable.clear(),this._afterRenderObserver&&this.originalScene.onAfterRenderObservable.remove(this._afterRenderObserver),this._sceneDisposeObserver&&this.originalScene.onDisposeObservable.remove(this._sceneDisposeObserver),this._originalPointerObserver&&this.originalScene.onPrePointerObservable.remove(this._originalPointerObserver),this.utilityLayerScene.dispose()},e.prototype._updateCamera=function(){this.utilityLayerScene.activeCamera=this.originalScene.activeCamera},e._DefaultUtilityLayer=null,e._DefaultKeepDepthUtilityLayer=null,e})(),es.UtilityLayerRenderer=ts,is=$a||($a={}),rs=(function(){function o(e){this.maxDragAngle=0,this._useAlternatePickedPointAboveMaxDragAngle=!1,this.currentDraggingPointerID=-1,this.dragging=!1,this.dragDeltaRatio=.2,this.updateDragPlane=!0,this._debugMode=!1,this._moving=!1,this.onDragObservable=new is.Observable,this.onDragStartObservable=new is.Observable,this.onDragEndObservable=new is.Observable,this.moveAttached=!0,this.enabled=!0,this.detachCameraControls=!0,this.useObjectOrienationForDragging=!0,this._tmpVector=new is.Vector3(0,0,0),this._alternatePickedPoint=new is.Vector3(0,0,0),this._worldDragAxis=new is.Vector3(0,0,0),this._targetPosition=new is.Vector3(0,0,0),this._attachedElement=null,this._startDragRay=new is.Ray(new is.Vector3,new is.Vector3),this._lastPointerRay={},this._dragDelta=new is.Vector3,this._pointA=new is.Vector3(0,0,0),this._pointB=new is.Vector3(0,0,0),this._pointC=new is.Vector3(0,0,0),this._lineA=new is.Vector3(0,0,0),this._lineB=new is.Vector3(0,0,0),this._localAxis=new is.Vector3(0,0,0),this._lookAt=new is.Vector3(0,0,0),this._options=e||{};var t=0;if(this._options.dragAxis&&t++,this._options.dragPlaneNormal&&t++,1<t)throw"Multiple drag modes specified in dragBehavior options. Only one expected"}return Object.defineProperty(o.prototype,"name",{get:function(){return"PointerDrag"},enumerable:!0,configurable:!0}),o.prototype.init=function(){},o.prototype.attach=function(e){var n=this;this._scene=e.getScene(),this._attachedNode=e,o._planeScene||(this._debugMode?o._planeScene=this._scene:((o._planeScene=new is.Scene(this._scene.getEngine())).detachControl(),this._scene.getEngine().scenes.pop(),this._scene.onDisposeObservable.addOnce((function(){o._planeScene.dispose(),o._planeScene=null})))),this._dragPlane=is.Mesh.CreatePlane("pointerDragPlane",this._debugMode?1:1e4,o._planeScene,!1,is.Mesh.DOUBLESIDE),this.lastDragPosition=new is.Vector3(0,0,0);this._pointerObserver=this._scene.onPointerObservable.add((function(e,t){var i;if(n.enabled)if(e.type==is.PointerEventTypes.POINTERDOWN)!n.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.pickedPoint&&e.pickInfo.ray&&(i=e.pickInfo.pickedMesh,n._attachedNode==i||i.isDescendantOf(n._attachedNode))&&n._startDrag(e.event.pointerId,e.pickInfo.ray,e.pickInfo.pickedPoint);else if(e.type==is.PointerEventTypes.POINTERUP)n.currentDraggingPointerID==e.event.pointerId&&n.releaseDrag();else if(e.type==is.PointerEventTypes.POINTERMOVE){var r=e.event.pointerId;n.currentDraggingPointerID===o._AnyMouseID&&r!==o._AnyMouseID&&"mouse"==e.event.pointerType&&(n._lastPointerRay[n.currentDraggingPointerID]&&(n._lastPointerRay[r]=n._lastPointerRay[n.currentDraggingPointerID],delete n._lastPointerRay[n.currentDraggingPointerID]),n.currentDraggingPointerID=r),n._lastPointerRay[r]||(n._lastPointerRay[r]=new is.Ray(new is.Vector3,new is.Vector3)),e.pickInfo&&e.pickInfo.ray&&(n._lastPointerRay[r].origin.copyFrom(e.pickInfo.ray.origin),n._lastPointerRay[r].direction.copyFrom(e.pickInfo.ray.direction),n.currentDraggingPointerID==r&&n.dragging&&n._moveDrag(e.pickInfo.ray))}})),this._beforeRenderObserver=this._scene.onBeforeRenderObservable.add((function(){n._moving&&n.moveAttached&&(is.BoundingBoxGizmo._RemoveAndStorePivotPoint(n._attachedNode),n._targetPosition.subtractToRef(n._attachedNode.absolutePosition,n._tmpVector),n._tmpVector.scaleInPlace(n.dragDeltaRatio),n._attachedNode.getAbsolutePosition().addToRef(n._tmpVector,n._tmpVector),n._attachedNode.setAbsolutePosition(n._tmpVector),is.BoundingBoxGizmo._RestorePivotPoint(n._attachedNode))}))},o.prototype.releaseDrag=function(){this.dragging=!1,this.onDragEndObservable.notifyObservers({dragPlanePoint:this.lastDragPosition,pointerId:this.currentDraggingPointerID}),this.currentDraggingPointerID=-1,this._moving=!1,this.detachCameraControls&&this._attachedElement&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&this._scene.activeCamera.attachControl(this._attachedElement,!0)},o.prototype.startDrag=function(e,t,i){void 0===e&&(e=o._AnyMouseID),this._startDrag(e,t,i);var r=this._lastPointerRay[e];e===o._AnyMouseID&&(r=this._lastPointerRay[Object.keys(this._lastPointerRay)[0]]),r&&this._moveDrag(r)},o.prototype._startDrag=function(e,t,i){if(this._scene.activeCamera&&!this.dragging&&this._attachedNode){is.BoundingBoxGizmo._RemoveAndStorePivotPoint(this._attachedNode),t?(this._startDragRay.direction.copyFrom(t.direction),this._startDragRay.origin.copyFrom(t.origin)):(this._startDragRay.origin.copyFrom(this._scene.activeCamera.position),this._attachedNode.getWorldMatrix().getTranslationToRef(this._tmpVector),this._tmpVector.subtractToRef(this._scene.activeCamera.position,this._startDragRay.direction)),this._updateDragPlanePosition(this._startDragRay,i||this._tmpVector);var r=this._pickWithRayOnDragPlane(this._startDragRay);r&&(this.dragging=!0,this.currentDraggingPointerID=e,this.lastDragPosition.copyFrom(r),this.onDragStartObservable.notifyObservers({dragPlanePoint:r,pointerId:this.currentDraggingPointerID}),this._targetPosition.copyFrom(this._attachedNode.absolutePosition),this.detachCameraControls&&this._scene.activeCamera&&!this._scene.activeCamera.leftCamera&&(this._scene.activeCamera.inputs.attachedElement?(this._attachedElement=this._scene.activeCamera.inputs.attachedElement,this._scene.activeCamera.detachControl(this._scene.activeCamera.inputs.attachedElement)):this._attachedElement=null)),is.BoundingBoxGizmo._RestorePivotPoint(this._attachedNode)}},o.prototype._moveDrag=function(e){this._moving=!0;var t=this._pickWithRayOnDragPlane(e);if(t){this.updateDragPlane&&this._updateDragPlanePosition(e,t);var i=0;this._options.dragAxis?(is.Vector3.TransformCoordinatesToRef(this._options.dragAxis,this._attachedNode.getWorldMatrix().getRotationMatrix(),this._worldDragAxis),t.subtractToRef(this.lastDragPosition,this._tmpVector),i=is.Vector3.Dot(this._tmpVector,this._worldDragAxis),this._worldDragAxis.scaleToRef(i,this._dragDelta)):(i=this._dragDelta.length(),t.subtractToRef(this.lastDragPosition,this._dragDelta)),this._targetPosition.addInPlace(this._dragDelta),this.onDragObservable.notifyObservers({dragDistance:i,delta:this._dragDelta,dragPlanePoint:t,dragPlaneNormal:this._dragPlane.forward,pointerId:this.currentDraggingPointerID}),this.lastDragPosition.copyFrom(t)}},o.prototype._pickWithRayOnDragPlane=function(e){var t=this;if(!e)return null;var i=Math.acos(is.Vector3.Dot(this._dragPlane.forward,e.direction));if(i>Math.PI/2&&(i=Math.PI-i),0<this.maxDragAngle&&i>this.maxDragAngle){if(this._useAlternatePickedPointAboveMaxDragAngle){this._tmpVector.copyFrom(e.direction),this._attachedNode.absolutePosition.subtractToRef(e.origin,this._alternatePickedPoint),this._alternatePickedPoint.normalize(),this._alternatePickedPoint.scaleInPlace(-2*is.Vector3.Dot(this._alternatePickedPoint,this._tmpVector)),this._tmpVector.addInPlace(this._alternatePickedPoint);var r=is.Vector3.Dot(this._dragPlane.forward,this._tmpVector);return this._dragPlane.forward.scaleToRef(-r,this._alternatePickedPoint),this._alternatePickedPoint.addInPlace(this._tmpVector),this._alternatePickedPoint.addInPlace(this._attachedNode.absolutePosition),this._alternatePickedPoint}return null}var n=o._planeScene.pickWithRay(e,(function(e){return e==t._dragPlane}));return n&&n.hit&&n.pickedMesh&&n.pickedPoint?n.pickedPoint:null},o.prototype._updateDragPlanePosition=function(e,t){this._pointA.copyFrom(t),this._options.dragAxis?(this.useObjectOrienationForDragging?is.Vector3.TransformCoordinatesToRef(this._options.dragAxis,this._attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragAxis),this._pointA.addToRef(this._localAxis,this._pointB),e.origin.subtractToRef(this._pointA,this._pointC),this._pointA.addToRef(this._pointC.normalize(),this._pointC),this._pointB.subtractToRef(this._pointA,this._lineA),this._pointC.subtractToRef(this._pointA,this._lineB),is.Vector3.CrossToRef(this._lineA,this._lineB,this._lookAt),is.Vector3.CrossToRef(this._lineA,this._lookAt,this._lookAt),this._lookAt.normalize(),this._dragPlane.position.copyFrom(this._pointA),this._pointA.subtractToRef(this._lookAt,this._lookAt),this._dragPlane.lookAt(this._lookAt)):this._options.dragPlaneNormal?(this.useObjectOrienationForDragging?is.Vector3.TransformCoordinatesToRef(this._options.dragPlaneNormal,this._attachedNode.getWorldMatrix().getRotationMatrix(),this._localAxis):this._localAxis.copyFrom(this._options.dragPlaneNormal),this._dragPlane.position.copyFrom(this._pointA),this._pointA.subtractToRef(this._localAxis,this._lookAt),this._dragPlane.lookAt(this._lookAt)):(this._dragPlane.position.copyFrom(this._pointA),this._dragPlane.lookAt(e.origin)),this._dragPlane.computeWorldMatrix(!0)},o.prototype.detach=function(){this._pointerObserver&&this._scene.onPointerObservable.remove(this._pointerObserver),this._beforeRenderObserver&&this._scene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},o._AnyMouseID=-2,o})(),is.PointerDragBehavior=rs,ns=$a||($a={}),os=(function(){function e(){this._startDistance=0,this._initialScale=new ns.Vector3(0,0,0),this._targetScale=new ns.Vector3(0,0,0),this._sceneRenderObserver=null,this._dragBehaviorA=new ns.PointerDragBehavior({}),this._dragBehaviorA.moveAttached=!1,this._dragBehaviorB=new ns.PointerDragBehavior({}),this._dragBehaviorB.moveAttached=!1}return Object.defineProperty(e.prototype,"name",{get:function(){return"MultiPointerScale"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype._getCurrentDistance=function(){return this._dragBehaviorA.lastDragPosition.subtract(this._dragBehaviorB.lastDragPosition).length()},e.prototype.attach=function(t){var i=this;this._ownerNode=t,this._dragBehaviorA.onDragStartObservable.add((function(e){i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging&&(i._dragBehaviorA.currentDraggingPointerID==i._dragBehaviorB.currentDraggingPointerID?i._dragBehaviorA.releaseDrag():(i._initialScale.copyFrom(t.scaling),i._startDistance=i._getCurrentDistance()))})),this._dragBehaviorB.onDragStartObservable.add((function(e){i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging&&(i._dragBehaviorA.currentDraggingPointerID==i._dragBehaviorB.currentDraggingPointerID?i._dragBehaviorB.releaseDrag():(i._initialScale.copyFrom(t.scaling),i._startDistance=i._getCurrentDistance()))})),[this._dragBehaviorA,this._dragBehaviorB].forEach((function(e){e.onDragObservable.add((function(){if(i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging){var e=i._getCurrentDistance()/i._startDistance;i._initialScale.scaleToRef(e,i._targetScale)}}))})),t.addBehavior(this._dragBehaviorA),t.addBehavior(this._dragBehaviorB),this._sceneRenderObserver=t.getScene().onBeforeRenderObservable.add((function(){if(i._dragBehaviorA.dragging&&i._dragBehaviorB.dragging){var e=i._targetScale.subtract(t.scaling).scaleInPlace(.1);.01<e.length()&&t.scaling.addInPlace(e)}}))},e.prototype.detach=function(){var t=this;this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),[this._dragBehaviorA,this._dragBehaviorB].forEach((function(e){e.onDragStartObservable.clear(),e.onDragObservable.clear(),t._ownerNode.removeBehavior(e)}))},e})(),ns.MultiPointerScaleBehavior=os,ss=$a||($a={}),as=(function(){function i(){this._sceneRenderObserver=null,this._targetPosition=new ss.Vector3(0,0,0),this._moving=!1,this._startingOrientation=new ss.Quaternion,this.zDragFactor=3,this.dragging=!1,this.dragDeltaRatio=.2,this.currentDraggingPointerID=-1,this.detachCameraControls=!0,this.onDragStartObservable=new ss.Observable,this.onDragEndObservable=new ss.Observable}return Object.defineProperty(i.prototype,"name",{get:function(){return"SixDofDrag"},enumerable:!0,configurable:!0}),i.prototype.init=function(){},i.prototype.attach=function(e){var a=this;this._ownerNode=e,this._scene=this._ownerNode.getScene(),i._virtualScene||((i._virtualScene=new ss.Scene(this._scene.getEngine())).detachControl(),this._scene.getEngine().scenes.pop());var l=null,c=new ss.Vector3(0,0,0);this._virtualOriginMesh=new ss.AbstractMesh("",i._virtualScene),this._virtualOriginMesh.rotationQuaternion=new ss.Quaternion,this._virtualDragMesh=new ss.AbstractMesh("",i._virtualScene),this._virtualDragMesh.rotationQuaternion=new ss.Quaternion;var h=null;this._pointerObserver=this._scene.onPointerObservable.add((function(e,t){if(e.type==ss.PointerEventTypes.POINTERDOWN){if(!a.dragging&&e.pickInfo&&e.pickInfo.hit&&e.pickInfo.pickedMesh&&e.pickInfo.ray&&(s=e.pickInfo.pickedMesh,a._ownerNode==s||s.isDescendantOf(a._ownerNode))){a._scene.activeCamera&&a._scene.activeCamera.cameraRigMode==ss.Camera.RIG_MODE_NONE&&e.pickInfo.ray.origin.copyFrom(a._scene.activeCamera.position),l=a._ownerNode,ss.BoundingBoxGizmo._RemoveAndStorePivotPoint(l),c.copyFrom(e.pickInfo.ray.origin),a._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),a._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.subtract(e.pickInfo.ray.direction)),a._virtualOriginMesh.removeChild(a._virtualDragMesh),l.computeWorldMatrix(),a._virtualDragMesh.position.copyFrom(l.absolutePosition),l.rotationQuaternion||(l.rotationQuaternion=ss.Quaternion.RotationYawPitchRoll(l.rotation.y,l.rotation.x,l.rotation.z));var i=l.parent;l.setParent(null),a._virtualDragMesh.rotationQuaternion.copyFrom(l.rotationQuaternion),l.setParent(i),a._virtualOriginMesh.addChild(a._virtualDragMesh),a._targetPosition.copyFrom(a._virtualDragMesh.absolutePosition),a.dragging=!0,a.currentDraggingPointerID=e.event.pointerId,a.detachCameraControls&&a._scene.activeCamera&&!a._scene.activeCamera.leftCamera&&(a._scene.activeCamera.inputs.attachedElement?(h=a._scene.activeCamera.inputs.attachedElement,a._scene.activeCamera.detachControl(a._scene.activeCamera.inputs.attachedElement)):h=null),ss.BoundingBoxGizmo._RestorePivotPoint(l),a.onDragStartObservable.notifyObservers({})}}else if(e.type==ss.PointerEventTypes.POINTERUP)a.currentDraggingPointerID==e.event.pointerId&&(a.dragging=!1,a._moving=!1,a.currentDraggingPointerID=-1,l=null,a._virtualOriginMesh.removeChild(a._virtualDragMesh),a.detachCameraControls&&h&&a._scene.activeCamera&&!a._scene.activeCamera.leftCamera&&a._scene.activeCamera.attachControl(h,!0),a.onDragEndObservable.notifyObservers({}));else if(e.type==ss.PointerEventTypes.POINTERMOVE&&a.currentDraggingPointerID==e.event.pointerId&&a.dragging&&e.pickInfo&&e.pickInfo.ray&&l){var r=a.zDragFactor;a._scene.activeCamera&&a._scene.activeCamera.cameraRigMode==ss.Camera.RIG_MODE_NONE&&(e.pickInfo.ray.origin.copyFrom(a._scene.activeCamera.position),r=0);var n=e.pickInfo.ray.origin.subtract(c);c.copyFrom(e.pickInfo.ray.origin);var o=-ss.Vector3.Dot(n,e.pickInfo.ray.direction);a._virtualOriginMesh.addChild(a._virtualDragMesh),a._virtualDragMesh.position.z-=a._virtualDragMesh.position.z<1?o*a.zDragFactor:o*r*a._virtualDragMesh.position.z,a._virtualDragMesh.position.z<0&&(a._virtualDragMesh.position.z=0),a._virtualOriginMesh.position.copyFrom(e.pickInfo.ray.origin),a._virtualOriginMesh.lookAt(e.pickInfo.ray.origin.subtract(e.pickInfo.ray.direction)),a._virtualOriginMesh.removeChild(a._virtualDragMesh),a._targetPosition.copyFrom(a._virtualDragMesh.absolutePosition),l.parent&&ss.Vector3.TransformCoordinatesToRef(a._targetPosition,ss.Matrix.Invert(l.parent.getWorldMatrix()),a._targetPosition),a._moving||a._startingOrientation.copyFrom(a._virtualDragMesh.rotationQuaternion),a._moving=!0}var s}));var t=new ss.Quaternion;this._sceneRenderObserver=e.getScene().onBeforeRenderObservable.add((function(){if(a.dragging&&a._moving&&l){ss.BoundingBoxGizmo._RemoveAndStorePivotPoint(l),l.position.addInPlace(a._targetPosition.subtract(l.position).scale(a.dragDeltaRatio)),t.copyFrom(a._startingOrientation),t.x=-t.x,t.y=-t.y,t.z=-t.z,a._virtualDragMesh.rotationQuaternion.multiplyToRef(t,t),ss.Quaternion.RotationYawPitchRollToRef(t.toEulerAngles("xyz").y,0,0,t),t.multiplyToRef(a._startingOrientation,t);var e=l.parent;l.setParent(null),ss.Quaternion.SlerpToRef(l.rotationQuaternion,t,a.dragDeltaRatio,l.rotationQuaternion),l.setParent(e),ss.BoundingBoxGizmo._RestorePivotPoint(l)}}))},i.prototype.detach=function(){this._scene&&this._scene.onPointerObservable.remove(this._pointerObserver),this._ownerNode&&this._ownerNode.getScene().onBeforeRenderObservable.remove(this._sceneRenderObserver),this._virtualOriginMesh&&this._virtualOriginMesh.dispose(),this._virtualDragMesh&&this._virtualDragMesh.dispose(),this.onDragEndObservable.clear(),this.onDragStartObservable.clear()},i})(),ss.SixDofDragBehavior=as,ls=$a||($a={}),cs=function(e,t,i,r){void 0===t&&(t=new ls.Vector3),void 0===i&&(i=0),void 0===r&&(r=!1),this.direction=e,this.rotatedDirection=t,this.diff=i,this.ignore=r},hs=(function(){function e(e){this.ui=e,this.name="AttachToBoxBehavior",this.distanceAwayFromFace=.15,this.distanceAwayFromBottomOfFace=.15,this._faceVectors=[new cs(ls.Vector3.Up()),new cs(ls.Vector3.Down()),new cs(ls.Vector3.Left()),new cs(ls.Vector3.Right()),new cs(ls.Vector3.Forward()),new cs(ls.Vector3.Forward().scaleInPlace(-1))],this._tmpMatrix=new ls.Matrix,this._tmpVector=new ls.Vector3,this._zeroVector=ls.Vector3.Zero(),this._lookAtTmpMatrix=new ls.Matrix}return e.prototype.init=function(){},e.prototype._closestFace=function(t){var i=this;return this._faceVectors.forEach((function(e){i._target.rotationQuaternion||(i._target.rotationQuaternion=ls.Quaternion.RotationYawPitchRoll(i._target.rotation.y,i._target.rotation.x,i._target.rotation.z)),i._target.rotationQuaternion.toRotationMatrix(i._tmpMatrix),ls.Vector3.TransformCoordinatesToRef(e.direction,i._tmpMatrix,e.rotatedDirection),e.diff=ls.Vector3.GetAngleBetweenVectors(e.rotatedDirection,t,ls.Vector3.Cross(e.rotatedDirection,t))})),this._faceVectors.reduce((function(e,t){return e.ignore?t:t.ignore?e:e.diff<t.diff?e:t}),this._faceVectors[0])},e.prototype._lookAtToRef=function(e,t,i){void 0===t&&(t=new ls.Vector3(0,1,0)),ls.Matrix.LookAtLHToRef(this._zeroVector,e,t,this._lookAtTmpMatrix),this._lookAtTmpMatrix.invert(),ls.Quaternion.FromRotationMatrixToRef(this._lookAtTmpMatrix,i)},e.prototype.attach=function(r){var n=this;this._target=r,this._scene=this._target.getScene(),this._onRenderObserver=this._scene.onBeforeRenderObservable.add((function(){if(n._scene.activeCamera){var e=n._scene.activeCamera.position;n._scene.activeCamera.devicePosition&&(e=n._scene.activeCamera.devicePosition);var t=n._closestFace(e.subtract(r.position));n._scene.activeCamera.leftCamera?n._scene.activeCamera.leftCamera.computeWorldMatrix().getRotationMatrixToRef(n._tmpMatrix):n._scene.activeCamera.computeWorldMatrix().getRotationMatrixToRef(n._tmpMatrix),ls.Vector3.TransformCoordinatesToRef(ls.Vector3.Up(),n._tmpMatrix,n._tmpVector),n._faceVectors.forEach((function(e){t.direction.x&&e.direction.x&&(e.ignore=!0),t.direction.y&&e.direction.y&&(e.ignore=!0),t.direction.z&&e.direction.z&&(e.ignore=!0)}));var i=n._closestFace(n._tmpVector);n._faceVectors.forEach((function(e){e.ignore=!1})),n.ui.position.copyFrom(r.position),t.direction.x&&(t.rotatedDirection.scaleToRef(r.scaling.x/2+n.distanceAwayFromFace,n._tmpVector),n.ui.position.addInPlace(n._tmpVector)),t.direction.y&&(t.rotatedDirection.scaleToRef(r.scaling.y/2+n.distanceAwayFromFace,n._tmpVector),n.ui.position.addInPlace(n._tmpVector)),t.direction.z&&(t.rotatedDirection.scaleToRef(r.scaling.z/2+n.distanceAwayFromFace,n._tmpVector),n.ui.position.addInPlace(n._tmpVector)),n.ui.rotationQuaternion||(n.ui.rotationQuaternion=ls.Quaternion.RotationYawPitchRoll(n.ui.rotation.y,n.ui.rotation.x,n.ui.rotation.z)),t.rotatedDirection.scaleToRef(-1,n._tmpVector),n._lookAtToRef(n._tmpVector,i.rotatedDirection,n.ui.rotationQuaternion),i.direction.x&&n.ui.up.scaleToRef(n.distanceAwayFromBottomOfFace-r.scaling.x/2,n._tmpVector),i.direction.y&&n.ui.up.scaleToRef(n.distanceAwayFromBottomOfFace-r.scaling.y/2,n._tmpVector),i.direction.z&&n.ui.up.scaleToRef(n.distanceAwayFromBottomOfFace-r.scaling.z/2,n._tmpVector),n.ui.position.addInPlace(n._tmpVector)}}))},e.prototype.detach=function(){this._scene.onBeforeRenderObservable.remove(this._onRenderObserver)},e})(),ls.AttachToBoxBehavior=hs,us=$a||($a={}),ds=(function(){function e(){var e=this;this.delay=0,this.fadeInTime=300,this._millisecondsPerFrame=1e3/60,this._hovered=!1,this._hoverValue=0,this._ownerNode=null,this._update=function(){if(e._ownerNode){if(e._hoverValue+=e._hovered?e._millisecondsPerFrame:-e._millisecondsPerFrame,e._setAllVisibility(e._ownerNode,(e._hoverValue-e.delay)/e.fadeInTime),1<e._ownerNode.visibility)return e._setAllVisibility(e._ownerNode,1),void(e._hoverValue=e.fadeInTime+e.delay);if(e._ownerNode.visibility<0&&(e._setAllVisibility(e._ownerNode,0),e._hoverValue<0))return void(e._hoverValue=0);setTimeout(e._update,e._millisecondsPerFrame)}}}return Object.defineProperty(e.prototype,"name",{get:function(){return"FadeInOut"},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){this._ownerNode=e,this._setAllVisibility(this._ownerNode,0)},e.prototype.detach=function(){this._ownerNode=null},e.prototype.fadeIn=function(e){this._hovered=e,this._update()},e.prototype._setAllVisibility=function(e,t){var i=this;e.visibility=t,e.getChildMeshes().forEach((function(e){i._setAllVisibility(e,t)}))},e})(),us.FadeInOutBehavior=ds,fs=$a||($a={}),ps=(function(){function e(e){void 0===e&&(e=fs.UtilityLayerRenderer.DefaultUtilityLayer);var t=this;this.gizmoLayer=e,this.scaleRatio=1,this._tmpMatrix=new fs.Matrix,this._customMeshSet=!1,this.updateGizmoRotationToMatchAttachedMesh=!0,this.updateGizmoPositionToMatchAttachedMesh=!0,this._updateScale=!0,this._interactionsEnabled=!0,this._tempVector=new fs.Vector3,this._rootMesh=new fs.Mesh("gizmoRootNode",e.utilityLayerScene),this._beforeRenderObserver=this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.add((function(){t._update()})),this.attachedMesh=null}return Object.defineProperty(e.prototype,"attachedMesh",{get:function(){return this._attachedMesh},set:function(e){this._attachedMesh=e,this._rootMesh.setEnabled(!!e),this._attachedMeshChanged(e)},enumerable:!0,configurable:!0}),e.prototype.setCustomMesh=function(e){if(e.getScene()!=this.gizmoLayer.utilityLayerScene)throw"When setting a custom mesh on a gizmo, the custom meshes scene must be the same as the gizmos (eg. gizmo.gizmoLayer.utilityLayerScene)";this._rootMesh.getChildMeshes().forEach((function(e){e.dispose()})),e.parent=this._rootMesh,this._customMeshSet=!0},e.prototype._attachedMeshChanged=function(e){},e.prototype._update=function(){if(this.attachedMesh&&(this.updateGizmoRotationToMatchAttachedMesh?(this._rootMesh.rotationQuaternion||(this._rootMesh.rotationQuaternion=fs.Quaternion.RotationYawPitchRoll(this._rootMesh.rotation.y,this._rootMesh.rotation.x,this._rootMesh.rotation.z)),this._tempVector.copyFrom(this.attachedMesh.scaling),this.attachedMesh.scaling.x<0&&(this.attachedMesh.scaling.x*=-1),this.attachedMesh.scaling.y<0&&(this.attachedMesh.scaling.y*=-1),this.attachedMesh.scaling.z<0&&(this.attachedMesh.scaling.z*=-1),this.attachedMesh.computeWorldMatrix().getRotationMatrixToRef(this._tmpMatrix),this.attachedMesh.scaling.copyFrom(this._tempVector),this.attachedMesh.computeWorldMatrix(),fs.Quaternion.FromRotationMatrixToRef(this._tmpMatrix,this._rootMesh.rotationQuaternion)):this._rootMesh.rotationQuaternion&&this._rootMesh.rotationQuaternion.set(0,0,0,1),this.updateGizmoPositionToMatchAttachedMesh&&this._rootMesh.position.copyFrom(this.attachedMesh.absolutePosition),this._updateScale&&this.gizmoLayer.utilityLayerScene.activeCamera&&this.attachedMesh)){var e=this.gizmoLayer.utilityLayerScene.activeCamera.position;this.gizmoLayer.utilityLayerScene.activeCamera.devicePosition&&(e=this.gizmoLayer.utilityLayerScene.activeCamera.devicePosition),this._rootMesh.position.subtractToRef(e,this._tempVector);var t=this._tempVector.length()*this.scaleRatio;this._rootMesh.scaling.set(t,t,t)}},e.prototype.dispose=function(){this._rootMesh.dispose(),this._beforeRenderObserver&&this.gizmoLayer.utilityLayerScene.onBeforeRenderObservable.remove(this._beforeRenderObserver)},e})(),fs.Gizmo=ps,_s=$a||($a={}),ms=(function(p){function e(e,t,i){void 0===t&&(t=_s.Color3.Gray()),void 0===i&&(i=_s.UtilityLayerRenderer.DefaultUtilityLayer);var r=p.call(this,i)||this;r._pointerObserver=null,r.snapDistance=0,r.onSnapObservable=new _s.Observable;var n=new _s.StandardMaterial("",i.utilityLayerScene);n.disableLighting=!0,n.emissiveColor=t;var o=new _s.StandardMaterial("",i.utilityLayerScene);o.disableLighting=!0,o.emissiveColor=t.add(new _s.Color3(.3,.3,.3));var s=new _s.AbstractMesh("",i.utilityLayerScene),a=_s.MeshBuilder.CreateCylinder("yPosMesh",{diameterTop:0,height:1.5,diameterBottom:.75,tessellation:96},i.utilityLayerScene),l=_s.MeshBuilder.CreateLines("yPosMesh",{points:[new _s.Vector3(0,0,0),new _s.Vector3(0,1.1,0)]},i.utilityLayerScene);l.color=n.emissiveColor,s.addChild(a),s.addChild(l),a.scaling.scaleInPlace(.05),a.material=n,a.rotation.x=Math.PI/2,a.position.z+=.3,l.scaling.scaleInPlace(.26),l.rotation.x=Math.PI/2,l.material=n,s.lookAt(r._rootMesh.position.subtract(e)),s.scaling.scaleInPlace(1/3),r._rootMesh.addChild(s);var c=0,h=new _s.Vector3,u={snapDistance:0};r.dragBehavior=new _s.PointerDragBehavior({dragAxis:e}),r.dragBehavior.moveAttached=!1,r._rootMesh.addBehavior(r.dragBehavior);var d=new _s.Vector3,f=new _s.Matrix;return r.dragBehavior.onDragObservable.add((function(e){if(r.attachedMesh)if(r.attachedMesh.parent?(r.attachedMesh.parent.computeWorldMatrix().invertToRef(f),f.setTranslationFromFloats(0,0,0),_s.Vector3.TransformCoordinatesToRef(e.delta,f,d)):d.copyFrom(e.delta),0==r.snapDistance)r.attachedMesh.position.addInPlace(d);else if(c+=e.dragDistance,Math.abs(c)>r.snapDistance){var t=Math.floor(Math.abs(c)/r.snapDistance);c%=r.snapDistance,d.normalizeToRef(h),h.scaleInPlace(r.snapDistance*t),r.attachedMesh.position.addInPlace(h),u.snapDistance=r.snapDistance*t,r.onSnapObservable.notifyObservers(u)}})),r._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(e,t){if(!r._customMeshSet){var i=e.pickInfo&&-1!=r._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?o:n;r._rootMesh.getChildMeshes().forEach((function(e){e.material=i,e.color&&(e.color=i.emissiveColor)}))}})),r}return T(e,p),e.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},e.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),p.prototype.dispose.call(this)},e})(_s.Gizmo),_s.AxisDragGizmo=ms,gs=$a||($a={}),vs=(function(u){function e(r,e,t){void 0===e&&(e=gs.Color3.Gray()),void 0===t&&(t=gs.UtilityLayerRenderer.DefaultUtilityLayer);var n=u.call(this,t)||this;n._pointerObserver=null,n.snapDistance=0,n.onSnapObservable=new gs.Observable,n.uniformScaling=!1,n._coloredMaterial=new gs.StandardMaterial("",t.utilityLayerScene),n._coloredMaterial.disableLighting=!0,n._coloredMaterial.emissiveColor=e;var o=new gs.StandardMaterial("",t.utilityLayerScene);o.disableLighting=!0,o.emissiveColor=e.add(new gs.Color3(.3,.3,.3));var i=new gs.AbstractMesh("",t.utilityLayerScene),s=gs.MeshBuilder.CreateBox("yPosMesh",{size:.4},t.utilityLayerScene),a=gs.MeshBuilder.CreateLines("yPosMesh",{points:[new gs.Vector3(0,0,0),new gs.Vector3(0,1.1,0)]},t.utilityLayerScene);a.color=n._coloredMaterial.emissiveColor,i.addChild(s),i.addChild(a),s.scaling.scaleInPlace(.1),s.material=n._coloredMaterial,s.rotation.x=Math.PI/2,s.position.z+=.3,a.scaling.scaleInPlace(.26),a.rotation.x=Math.PI/2,a.material=n._coloredMaterial,i.lookAt(n._rootMesh.position.subtract(r)),n._rootMesh.addChild(i),i.scaling.scaleInPlace(1/3),n.dragBehavior=new gs.PointerDragBehavior({dragAxis:r}),n.dragBehavior.moveAttached=!1,n._rootMesh.addBehavior(n.dragBehavior);var l=0,c=new gs.Vector3,h={snapDistance:0};return n.dragBehavior.onDragObservable.add((function(e){if(n.attachedMesh){var t=!1,i=0;n.uniformScaling?(n.attachedMesh.scaling.normalizeToRef(c),c.y<0&&c.scaleInPlace(-1)):c.copyFrom(r),0==n.snapDistance?c.scaleToRef(e.dragDistance,c):(l+=e.dragDistance,Math.abs(l)>n.snapDistance?(i=Math.floor(l/n.snapDistance),l%=n.snapDistance,c.scaleToRef(n.snapDistance*i,c),t=!0):c.scaleInPlace(0)),n.attachedMesh.scaling.addInPlace(c),t&&(h.snapDistance=n.snapDistance*i,n.onSnapObservable.notifyObservers(h))}})),n._pointerObserver=t.utilityLayerScene.onPointerObservable.add((function(e,t){if(!n._customMeshSet){var i=e.pickInfo&&-1!=n._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?o:n._coloredMaterial;n._rootMesh.getChildMeshes().forEach((function(e){e.material=i,e.color&&(e.color=i.emissiveColor)}))}})),n}return T(e,u),e.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},e.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),u.prototype.dispose.call(this)},e.prototype.setCustomMesh=function(e,t){var i=this;void 0===t&&(t=!1),u.prototype.setCustomMesh.call(this,e),t&&(this._rootMesh.getChildMeshes().forEach((function(e){e.material=i._coloredMaterial,e.color&&(e.color=i._coloredMaterial.emissiveColor)})),this._customMeshSet=!1)},e})(gs.Gizmo),gs.AxisScaleGizmo=vs,ys=$a||($a={}),bs=(function(c){function e(h,e,u,t){void 0===e&&(e=ys.Color3.Gray()),void 0===u&&(u=ys.UtilityLayerRenderer.DefaultUtilityLayer),void 0===t&&(t=32);var d=c.call(this,u)||this;d._pointerObserver=null,d.snapDistance=0,d.onSnapObservable=new ys.Observable;var r=new ys.StandardMaterial("",u.utilityLayerScene);r.disableLighting=!0,r.emissiveColor=e;var n=new ys.StandardMaterial("",u.utilityLayerScene);n.disableLighting=!0,n.emissiveColor=e.add(new ys.Color3(.3,.3,.3));for(var i=new ys.AbstractMesh("",u.utilityLayerScene),o=new Array,s=0;s<t;s++){var a=2*Math.PI*(s/(t-1));o.push(new ys.Vector3(.8*Math.sin(a),0,.8*Math.cos(a)))}var l=ys.Mesh.CreateLines("",o,u.utilityLayerScene);l.color=r.emissiveColor,l.scaling.scaleInPlace(.26),l.material=r,l.rotation.x=Math.PI/2,i.addChild(l),i.lookAt(d._rootMesh.position.subtract(h)),d._rootMesh.addChild(i),i.scaling.scaleInPlace(1/3),d.dragBehavior=new ys.PointerDragBehavior({dragPlaneNormal:h}),d.dragBehavior.moveAttached=!1,d.dragBehavior.maxDragAngle=9*Math.PI/20,d.dragBehavior._useAlternatePickedPointAboveMaxDragAngle=!0,d._rootMesh.addBehavior(d.dragBehavior);var f=new ys.Vector3;d.dragBehavior.onDragStartObservable.add((function(e){d.attachedMesh&&f.copyFrom(e.dragPlanePoint)}));var p=new ys.Matrix,_=new ys.Vector3,m=new ys.Vector3,g={snapDistance:0},v=0,y=new ys.Matrix,b=new ys.Vector3,T=new ys.Quaternion;return d.dragBehavior.onDragObservable.add((function(e){if(d.attachedMesh){d.attachedMesh.rotationQuaternion||(d.attachedMesh.rotationQuaternion=ys.Quaternion.RotationYawPitchRoll(d.attachedMesh.rotation.y,d.attachedMesh.rotation.x,d.attachedMesh.rotation.z));var t=e.dragPlanePoint.subtract(d.attachedMesh.absolutePosition).normalize(),i=f.subtract(d.attachedMesh.absolutePosition).normalize(),r=ys.Vector3.Cross(t,i),n=ys.Vector3.Dot(t,i),o=Math.atan2(r.length(),n);if(_.copyFrom(h),m.copyFrom(h),d.updateGizmoRotationToMatchAttachedMesh&&(d.attachedMesh.rotationQuaternion.toRotationMatrix(p),m=ys.Vector3.TransformCoordinates(_,p)),u.utilityLayerScene.activeCamera){var s=u.utilityLayerScene.activeCamera.position.subtract(d.attachedMesh.position);0<ys.Vector3.Dot(s,m)&&(_.scaleInPlace(-1),m.scaleInPlace(-1))}0<ys.Vector3.Dot(m,r)&&(o=-o);var a=!1;if(0!=d.snapDistance)if(v+=o,Math.abs(v)>d.snapDistance){var l=Math.floor(v/d.snapDistance);v%=d.snapDistance,o=d.snapDistance*l,a=!0}else o=0;y.reset(),d.attachedMesh.parent&&(d.attachedMesh.parent.computeWorldMatrix().invertToRef(y),y.getRotationMatrixToRef(y),ys.Vector3.TransformCoordinatesToRef(_,y,_));var c=Math.sin(o/2);T.set(_.x*c,_.y*c,_.z*c,Math.cos(o/2)),0<y.determinant()&&(T.toEulerAnglesToRef(b),ys.Quaternion.RotationYawPitchRollToRef(b.y,-b.x,-b.z,T)),d.updateGizmoRotationToMatchAttachedMesh?d.attachedMesh.rotationQuaternion.multiplyToRef(T,d.attachedMesh.rotationQuaternion):T.multiplyToRef(d.attachedMesh.rotationQuaternion,d.attachedMesh.rotationQuaternion),f.copyFrom(e.dragPlanePoint),a&&(g.snapDistance=o,d.onSnapObservable.notifyObservers(g))}})),d._pointerObserver=u.utilityLayerScene.onPointerObservable.add((function(e,t){if(!d._customMeshSet){var i=e.pickInfo&&-1!=d._rootMesh.getChildMeshes().indexOf(e.pickInfo.pickedMesh)?n:r;d._rootMesh.getChildMeshes().forEach((function(e){e.material=i,e.color&&(e.color=i.emissiveColor)}))}})),d}return T(e,c),e.prototype._attachedMeshChanged=function(e){this.dragBehavior&&(this.dragBehavior.enabled=!!e)},e.prototype.dispose=function(){this.onSnapObservable.clear(),this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.dragBehavior.detach(),c.prototype.dispose.call(this)},e})(ys.Gizmo),ys.PlaneRotationGizmo=bs,Ts=$a||($a={}),Es=(function(i){function e(e){void 0===e&&(e=Ts.UtilityLayerRenderer.DefaultUtilityLayer);var t=i.call(this,e)||this;return t.onDragStartObservable=new Ts.Observable,t.onDragEndObservable=new Ts.Observable,t.xGizmo=new Ts.AxisDragGizmo(new Ts.Vector3(1,0,0),Ts.Color3.Red().scale(.5),e),t.yGizmo=new Ts.AxisDragGizmo(new Ts.Vector3(0,1,0),Ts.Color3.Green().scale(.5),e),t.zGizmo=new Ts.AxisDragGizmo(new Ts.Vector3(0,0,1),Ts.Color3.Blue().scale(.5),e),[t.xGizmo,t.yGizmo,t.zGizmo].forEach((function(e){e.dragBehavior.onDragStartObservable.add((function(){t.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){t.onDragEndObservable.notifyObservers({})}))})),t.attachedMesh=null,t}return T(e,i),Object.defineProperty(e.prototype,"attachedMesh",{set:function(e){this.xGizmo&&(this.xGizmo.attachedMesh=e,this.yGizmo.attachedMesh=e,this.zGizmo.attachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"snapDistance",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scaleRatio",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e)},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},e.prototype.setCustomMesh=function(e){Ts.Tools.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)")},e})(Ts.Gizmo),Ts.PositionGizmo=Es,xs=$a||($a={}),Ps=(function(r){function e(e,t){void 0===e&&(e=xs.UtilityLayerRenderer.DefaultUtilityLayer),void 0===t&&(t=32);var i=r.call(this,e)||this;return i.onDragStartObservable=new xs.Observable,i.onDragEndObservable=new xs.Observable,i.xGizmo=new xs.PlaneRotationGizmo(new xs.Vector3(1,0,0),xs.Color3.Red().scale(.5),e,t),i.yGizmo=new xs.PlaneRotationGizmo(new xs.Vector3(0,1,0),xs.Color3.Green().scale(.5),e,t),i.zGizmo=new xs.PlaneRotationGizmo(new xs.Vector3(0,0,1),xs.Color3.Blue().scale(.5),e,t),[i.xGizmo,i.yGizmo,i.zGizmo].forEach((function(e){e.dragBehavior.onDragStartObservable.add((function(){i.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){i.onDragEndObservable.notifyObservers({})}))})),i.attachedMesh=null,i}return T(e,r),Object.defineProperty(e.prototype,"attachedMesh",{set:function(e){this.xGizmo&&(this.xGizmo.attachedMesh=e,this.yGizmo.attachedMesh=e,this.zGizmo.attachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"snapDistance",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scaleRatio",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e)},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},e.prototype.setCustomMesh=function(e){xs.Tools.Error("Custom meshes are not supported on this gizmo, please set the custom meshes on the gizmos contained within this one (gizmo.xGizmo, gizmo.yGizmo, gizmo.zGizmo)")},e})(xs.Gizmo),xs.RotationGizmo=Ps,As=$a||($a={}),Ss=(function(n){function e(e){void 0===e&&(e=As.UtilityLayerRenderer.DefaultUtilityLayer);var t=n.call(this,e)||this;t.onDragStartObservable=new As.Observable,t.onDragEndObservable=new As.Observable,t.xGizmo=new As.AxisScaleGizmo(new As.Vector3(1,0,0),As.Color3.Red().scale(.5),e),t.yGizmo=new As.AxisScaleGizmo(new As.Vector3(0,1,0),As.Color3.Green().scale(.5),e),t.zGizmo=new As.AxisScaleGizmo(new As.Vector3(0,0,1),As.Color3.Blue().scale(.5),e),t.uniformScaleGizmo=new As.AxisScaleGizmo(new As.Vector3(0,1,0),As.Color3.Yellow().scale(.5),e),t.uniformScaleGizmo.updateGizmoRotationToMatchAttachedMesh=!1,t.uniformScaleGizmo.uniformScaling=!0;var i=As.Mesh.CreatePolyhedron("",{type:1},t.uniformScaleGizmo.gizmoLayer.utilityLayerScene);i.scaling.scaleInPlace(.02),i.visibility=0;var r=As.Mesh.CreatePolyhedron("",{type:1},t.uniformScaleGizmo.gizmoLayer.utilityLayerScene);return r.scaling.scaleInPlace(.007),i.addChild(r),t.uniformScaleGizmo.setCustomMesh(i,!0),[t.xGizmo,t.yGizmo,t.zGizmo,t.uniformScaleGizmo].forEach((function(e){e.dragBehavior.onDragStartObservable.add((function(){t.onDragStartObservable.notifyObservers({})})),e.dragBehavior.onDragEndObservable.add((function(){t.onDragEndObservable.notifyObservers({})}))})),t.attachedMesh=null,t}return T(e,n),Object.defineProperty(e.prototype,"attachedMesh",{set:function(e){this.xGizmo&&(this.xGizmo.attachedMesh=e,this.yGizmo.attachedMesh=e,this.zGizmo.attachedMesh=e,this.uniformScaleGizmo.attachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"updateGizmoRotationToMatchAttachedMesh",{get:function(){return this.xGizmo.updateGizmoRotationToMatchAttachedMesh},set:function(e){e||As.Tools.Warn("Setting updateGizmoRotationToMatchAttachedMesh = false on scaling gizmo is not supported."),this.xGizmo&&(this.xGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.yGizmo.updateGizmoRotationToMatchAttachedMesh=e,this.zGizmo.updateGizmoRotationToMatchAttachedMesh=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"snapDistance",{get:function(){return this.xGizmo.snapDistance},set:function(e){this.xGizmo&&(this.xGizmo.snapDistance=e,this.yGizmo.snapDistance=e,this.zGizmo.snapDistance=e,this.uniformScaleGizmo.snapDistance=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scaleRatio",{get:function(){return this.xGizmo.scaleRatio},set:function(e){this.xGizmo&&(this.xGizmo.scaleRatio=e,this.yGizmo.scaleRatio=e,this.zGizmo.scaleRatio=e,this.uniformScaleGizmo.scaleRatio=e)},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.xGizmo.dispose(),this.yGizmo.dispose(),this.zGizmo.dispose(),this.uniformScaleGizmo.dispose(),this.onDragStartObservable.clear(),this.onDragEndObservable.clear()},e})(As.Gizmo),As.ScaleGizmo=Ss,Ms=$a||($a={}),Rs=(function(m){function g(t,i){void 0===t&&(t=Ms.Color3.Gray()),void 0===i&&(i=Ms.UtilityLayerRenderer.DefaultKeepDepthUtilityLayer);var l=m.call(this,i)||this;l._boundingDimensions=new Ms.Vector3(1,1,1),l._renderObserver=null,l._pointerObserver=null,l._scaleDragSpeed=.2,l._tmpQuaternion=new Ms.Quaternion,l._tmpVector=new Ms.Vector3(0,0,0),l._tmpRotationMatrix=new Ms.Matrix,l.ignoreChildren=!1,l.includeChildPredicate=null,l.rotationSphereSize=.1,l.scaleBoxSize=.1,l.fixedDragMeshScreenSize=!1,l.fixedDragMeshScreenSizeDistanceFactor=10,l.onDragStartObservable=new Ms.Observable,l.onScaleBoxDragObservable=new Ms.Observable,l.onScaleBoxDragEndObservable=new Ms.Observable,l.onRotationSphereDragObservable=new Ms.Observable,l.onRotationSphereDragEndObservable=new Ms.Observable,l.scalePivot=null,l._existingMeshScale=new Ms.Vector3,l._updateScale=!1,l._anchorMesh=new Ms.AbstractMesh("anchor",i.utilityLayerScene);var n=new Ms.StandardMaterial("",i.utilityLayerScene);n.disableLighting=!0,n.emissiveColor=t;var r=new Ms.StandardMaterial("",i.utilityLayerScene);r.disableLighting=!0,r.emissiveColor=t.clone().add(new Ms.Color3(.3,.3,.3)),l._lineBoundingBox=new Ms.AbstractMesh("",i.utilityLayerScene),l._lineBoundingBox.rotationQuaternion=new Ms.Quaternion;var e=[];e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,0,0),new Ms.Vector3(l._boundingDimensions.x,0,0)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,0,0),new Ms.Vector3(0,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,0,0),new Ms.Vector3(0,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(l._boundingDimensions.x,0,0),new Ms.Vector3(l._boundingDimensions.x,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(l._boundingDimensions.x,0,0),new Ms.Vector3(l._boundingDimensions.x,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,l._boundingDimensions.y,0),new Ms.Vector3(l._boundingDimensions.x,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,l._boundingDimensions.y,0),new Ms.Vector3(0,l._boundingDimensions.y,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,0,l._boundingDimensions.z),new Ms.Vector3(l._boundingDimensions.x,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(0,0,l._boundingDimensions.z),new Ms.Vector3(0,l._boundingDimensions.y,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(l._boundingDimensions.x,l._boundingDimensions.y,l._boundingDimensions.z),new Ms.Vector3(0,l._boundingDimensions.y,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(l._boundingDimensions.x,l._boundingDimensions.y,l._boundingDimensions.z),new Ms.Vector3(l._boundingDimensions.x,0,l._boundingDimensions.z)]},i.utilityLayerScene)),e.push(Ms.MeshBuilder.CreateLines("lines",{points:[new Ms.Vector3(l._boundingDimensions.x,l._boundingDimensions.y,l._boundingDimensions.z),new Ms.Vector3(l._boundingDimensions.x,l._boundingDimensions.y,0)]},i.utilityLayerScene)),e.forEach((function(e){e.color=t,e.position.addInPlace(new Ms.Vector3(-l._boundingDimensions.x/2,-l._boundingDimensions.y/2,-l._boundingDimensions.z/2)),e.isPickable=!1,l._lineBoundingBox.addChild(e)})),l._rootMesh.addChild(l._lineBoundingBox),l._rotateSpheresParent=new Ms.AbstractMesh("",i.utilityLayerScene),l._rotateSpheresParent.rotationQuaternion=new Ms.Quaternion;for(var o=function(o){var t=Ms.MeshBuilder.CreateSphere("",{diameter:1},i.utilityLayerScene);t.rotationQuaternion=new Ms.Quaternion,t.material=n,(u=new Ms.PointerDragBehavior({})).moveAttached=!1,u.updateDragPlane=!1,t.addBehavior(u);var s=new Ms.Vector3(1,0,0),a=0;u.onDragStartObservable.add((function(e){s.copyFrom(t.forward),a=0})),u.onDragObservable.add((function(e){if(l.onRotationSphereDragObservable.notifyObservers({}),l.attachedMesh){g._RemoveAndStorePivotPoint(l.attachedMesh);var t=s,i=e.dragPlaneNormal.scale(Ms.Vector3.Dot(e.dragPlaneNormal,t)),r=t.subtract(i).normalizeToNew(),n=-Ms.Vector3.Dot(r,e.delta);n=n/l._boundingDimensions.length()*l._anchorMesh.scaling.length(),l.attachedMesh.rotationQuaternion||(l.attachedMesh.rotationQuaternion=Ms.Quaternion.RotationYawPitchRoll(l.attachedMesh.rotation.y,l.attachedMesh.rotation.x,l.attachedMesh.rotation.z)),l._anchorMesh.rotationQuaternion||(l._anchorMesh.rotationQuaternion=Ms.Quaternion.RotationYawPitchRoll(l._anchorMesh.rotation.y,l._anchorMesh.rotation.x,l._anchorMesh.rotation.z)),a+=n,Math.abs(a)<=2*Math.PI&&(8<=o?Ms.Quaternion.RotationYawPitchRollToRef(0,0,n,l._tmpQuaternion):4<=o?Ms.Quaternion.RotationYawPitchRollToRef(n,0,0,l._tmpQuaternion):Ms.Quaternion.RotationYawPitchRollToRef(0,n,0,l._tmpQuaternion),l._anchorMesh.addChild(l.attachedMesh),l._anchorMesh.rotationQuaternion.multiplyToRef(l._tmpQuaternion,l._anchorMesh.rotationQuaternion),l._anchorMesh.removeChild(l.attachedMesh)),l.updateBoundingBox(),g._RestorePivotPoint(l.attachedMesh)}})),u.onDragStartObservable.add((function(){l.onDragStartObservable.notifyObservers({}),l._selectNode(t)})),u.onDragEndObservable.add((function(){l.onRotationSphereDragEndObservable.notifyObservers({}),l._selectNode(null)})),c._rotateSpheresParent.addChild(t)},c=this,s=0;s<12;s++)o(s);l._rootMesh.addChild(l._rotateSpheresParent),l._scaleBoxesParent=new Ms.AbstractMesh("",i.utilityLayerScene),l._scaleBoxesParent.rotationQuaternion=new Ms.Quaternion;for(var a=0;a<2;a++)for(var h=0;h<2;h++)for(var u,d=function(){var r=Ms.MeshBuilder.CreateBox("",{size:1},i.utilityLayerScene);r.material=n;var e=new Ms.Vector3(0==a?-1:1,0==h?-1:1,0==p?-1:1);(u=new Ms.PointerDragBehavior({dragAxis:e})).moveAttached=!1,r.addBehavior(u),u.onDragObservable.add((function(e){if(l.onScaleBoxDragObservable.notifyObservers({}),l.attachedMesh){g._RemoveAndStorePivotPoint(l.attachedMesh);var t=e.dragDistance/l._boundingDimensions.length()*l._anchorMesh.scaling.length(),i=new Ms.Vector3(t,t,t);i.scaleInPlace(l._scaleDragSpeed),l.updateBoundingBox(),l.scalePivot?(l.attachedMesh.getWorldMatrix().getRotationMatrixToRef(l._tmpRotationMatrix),l._boundingDimensions.scaleToRef(.5,l._tmpVector),Ms.Vector3.TransformCoordinatesToRef(l._tmpVector,l._tmpRotationMatrix,l._tmpVector),l._anchorMesh.position.subtractInPlace(l._tmpVector),l._boundingDimensions.multiplyToRef(l.scalePivot,l._tmpVector),Ms.Vector3.TransformCoordinatesToRef(l._tmpVector,l._tmpRotationMatrix,l._tmpVector),l._anchorMesh.position.addInPlace(l._tmpVector)):(r.absolutePosition.subtractToRef(l._anchorMesh.position,l._tmpVector),l._anchorMesh.position.subtractInPlace(l._tmpVector)),l._anchorMesh.addChild(l.attachedMesh),l._anchorMesh.scaling.addInPlace(i),(l._anchorMesh.scaling.x<0||l._anchorMesh.scaling.y<0||l._anchorMesh.scaling.z<0)&&l._anchorMesh.scaling.subtractInPlace(i),l._anchorMesh.removeChild(l.attachedMesh),g._RestorePivotPoint(l.attachedMesh)}})),u.onDragStartObservable.add((function(){l.onDragStartObservable.notifyObservers({}),l._selectNode(r)})),u.onDragEndObservable.add((function(){l.onScaleBoxDragEndObservable.notifyObservers({}),l._selectNode(null)})),f._scaleBoxesParent.addChild(r)},f=this,p=0;p<2;p++)d();l._rootMesh.addChild(l._scaleBoxesParent);var _=new Array;return l._pointerObserver=i.utilityLayerScene.onPointerObservable.add((function(t,e){_[t.event.pointerId]?t.pickInfo&&t.pickInfo.pickedMesh!=_[t.event.pointerId]&&(_[t.event.pointerId].material=n,delete _[t.event.pointerId]):l._rotateSpheresParent.getChildMeshes().concat(l._scaleBoxesParent.getChildMeshes()).forEach((function(e){t.pickInfo&&t.pickInfo.pickedMesh==e&&((_[t.event.pointerId]=e).material=r)}))})),l._renderObserver=l.gizmoLayer.originalScene.onBeforeRenderObservable.add((function(){l.attachedMesh&&!l._existingMeshScale.equals(l.attachedMesh.scaling)&&l.updateBoundingBox()})),l.updateBoundingBox(),l}return T(g,m),g._RemoveAndStorePivotPoint=function(e){e&&0===g._PivotCached&&(e.getPivotPointToRef(g._OldPivotPoint),g._OldPivotPoint.equalsToFloats(0,0,0)||(e.setPivotMatrix(Ms.Matrix.IdentityReadOnly),g._OldPivotPoint.subtractToRef(e.getPivotPoint(),g._PivotTranslation),g._PivotTmpVector.copyFromFloats(1,1,1),g._PivotTmpVector.subtractInPlace(e.scaling),g._PivotTmpVector.multiplyInPlace(g._PivotTranslation),e.position.addInPlace(g._PivotTmpVector))),g._PivotCached++},g._RestorePivotPoint=function(e){e&&!g._OldPivotPoint.equalsToFloats(0,0,0)&&1===g._PivotCached&&(e.setPivotPoint(g._OldPivotPoint),g._PivotTmpVector.copyFromFloats(1,1,1),g._PivotTmpVector.subtractInPlace(e.scaling),g._PivotTmpVector.multiplyInPlace(g._PivotTranslation),e.position.subtractInPlace(g._PivotTmpVector)),this._PivotCached--},g.prototype._attachedMeshChanged=function(e){e&&(g._RemoveAndStorePivotPoint(e),this._anchorMesh.addChild(e),this._anchorMesh.removeChild(e),g._RestorePivotPoint(e),this.updateBoundingBox())},g.prototype._selectNode=function(i){this._rotateSpheresParent.getChildMeshes().concat(this._scaleBoxesParent.getChildMeshes()).forEach((function(e,t){e.isVisible=!i||e==i}))},g.prototype.updateBoundingBox=function(){if(this.attachedMesh){g._RemoveAndStorePivotPoint(this.attachedMesh),this._update(),this.attachedMesh.rotationQuaternion||(this.attachedMesh.rotationQuaternion=Ms.Quaternion.RotationYawPitchRoll(this.attachedMesh.rotation.y,this.attachedMesh.rotation.x,this.attachedMesh.rotation.z)),this._anchorMesh.rotationQuaternion||(this._anchorMesh.rotationQuaternion=Ms.Quaternion.RotationYawPitchRoll(this._anchorMesh.rotation.y,this._anchorMesh.rotation.x,this._anchorMesh.rotation.z)),this._anchorMesh.rotationQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpQuaternion.copyFrom(this.attachedMesh.rotationQuaternion),this._tmpVector.copyFrom(this.attachedMesh.position),this.attachedMesh.rotationQuaternion.set(0,0,0,1),this.attachedMesh.position.set(0,0,0);var e=this.attachedMesh.getHierarchyBoundingVectors(!this.ignoreChildren,this.includeChildPredicate);e.max.subtractToRef(e.min,this._boundingDimensions),this._lineBoundingBox.scaling.copyFrom(this._boundingDimensions),this._lineBoundingBox.position.set((e.max.x+e.min.x)/2,(e.max.y+e.min.y)/2,(e.max.z+e.min.z)/2),this._rotateSpheresParent.position.copyFrom(this._lineBoundingBox.position),this._scaleBoxesParent.position.copyFrom(this._lineBoundingBox.position),this._lineBoundingBox.computeWorldMatrix(),this._anchorMesh.position.copyFrom(this._lineBoundingBox.absolutePosition),this.attachedMesh.rotationQuaternion.copyFrom(this._tmpQuaternion),this.attachedMesh.position.copyFrom(this._tmpVector)}for(var t=this._rotateSpheresParent.getChildMeshes(),i=0;i<3;i++)for(var r=0;r<2;r++)for(var n=0;n<2;n++){var o=4*i+2*r+n;if(0==i&&(t[o].position.set(this._boundingDimensions.x/2,this._boundingDimensions.y*r,this._boundingDimensions.z*n),t[o].position.addInPlace(new Ms.Vector3(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),t[o].lookAt(Ms.Vector3.Cross(Ms.Vector3.Right(),t[o].position.normalizeToNew()).normalizeToNew().add(t[o].position))),1==i&&(t[o].position.set(this._boundingDimensions.x*r,this._boundingDimensions.y/2,this._boundingDimensions.z*n),t[o].position.addInPlace(new Ms.Vector3(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),t[o].lookAt(Ms.Vector3.Cross(Ms.Vector3.Up(),t[o].position.normalizeToNew()).normalizeToNew().add(t[o].position))),2==i&&(t[o].position.set(this._boundingDimensions.x*r,this._boundingDimensions.y*n,this._boundingDimensions.z/2),t[o].position.addInPlace(new Ms.Vector3(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),t[o].lookAt(Ms.Vector3.Cross(Ms.Vector3.Forward(),t[o].position.normalizeToNew()).normalizeToNew().add(t[o].position))),this.fixedDragMeshScreenSize){this._rootMesh.computeWorldMatrix(),this._rotateSpheresParent.computeWorldMatrix(),t[o].computeWorldMatrix(),t[o].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);var s=this.rotationSphereSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;t[o].scaling.set(s,s,s)}else t[o].scaling.set(this.rotationSphereSize,this.rotationSphereSize,this.rotationSphereSize)}var a=this._scaleBoxesParent.getChildMeshes();for(i=0;i<2;i++)for(r=0;r<2;r++)for(n=0;n<2;n++){if(a[o=4*i+2*r+n])if(a[o].position.set(this._boundingDimensions.x*i,this._boundingDimensions.y*r,this._boundingDimensions.z*n),a[o].position.addInPlace(new Ms.Vector3(-this._boundingDimensions.x/2,-this._boundingDimensions.y/2,-this._boundingDimensions.z/2)),this.fixedDragMeshScreenSize){this._rootMesh.computeWorldMatrix(),this._scaleBoxesParent.computeWorldMatrix(),a[o].computeWorldMatrix(),a[o].absolutePosition.subtractToRef(this.gizmoLayer.utilityLayerScene.activeCamera.position,this._tmpVector);s=this.scaleBoxSize*this._tmpVector.length()/this.fixedDragMeshScreenSizeDistanceFactor;a[o].scaling.set(s,s,s)}else a[o].scaling.set(this.scaleBoxSize,this.scaleBoxSize,this.scaleBoxSize)}this.attachedMesh&&(this._existingMeshScale.copyFrom(this.attachedMesh.scaling),g._RestorePivotPoint(this.attachedMesh))},g.prototype.setEnabledRotationAxis=function(i){this._rotateSpheresParent.getChildMeshes().forEach((function(e,t){t<4?e.setEnabled(-1!=i.indexOf("x")):t<8?e.setEnabled(-1!=i.indexOf("y")):e.setEnabled(-1!=i.indexOf("z"))}))},g.prototype.dispose=function(){this.gizmoLayer.utilityLayerScene.onPointerObservable.remove(this._pointerObserver),this.gizmoLayer.originalScene.onBeforeRenderObservable.remove(this._renderObserver),this._lineBoundingBox.dispose(),this._rotateSpheresParent.dispose(),this._scaleBoxesParent.dispose(),m.prototype.dispose.call(this)},g.MakeNotPickableAndWrapInBoundingBox=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach((function(e){t(e)}))};t(e),e.rotationQuaternion||(e.rotationQuaternion=Ms.Quaternion.RotationYawPitchRoll(e.rotation.y,e.rotation.x,e.rotation.z));var i=e.position.clone(),r=e.rotationQuaternion.clone();e.rotationQuaternion.set(0,0,0,1),e.position.set(0,0,0);var n=Ms.MeshBuilder.CreateBox("box",{size:1},e.getScene()),o=e.getHierarchyBoundingVectors();return o.max.subtractToRef(o.min,n.scaling),n.position.set((o.max.x+o.min.x)/2,(o.max.y+o.min.y)/2,(o.max.z+o.min.z)/2),e.addChild(n),e.rotationQuaternion.copyFrom(r),e.position.copyFrom(i),e.removeChild(n),n.addChild(e),n.visibility=0,n},g.prototype.setCustomMesh=function(e){Ms.Tools.Error("Custom meshes are not supported on this gizmo")},g._PivotCached=0,g._OldPivotPoint=new Ms.Vector3,g._PivotTranslation=new Ms.Vector3,g._PivotTmpVector=new Ms.Vector3,g})(Ms.Gizmo),Ms.BoundingBoxGizmo=Rs,Cs=$a||($a={}),Os=(function(){function e(e){var n=this;this.scene=e,this._gizmosEnabled={positionGizmo:!1,rotationGizmo:!1,scaleGizmo:!1,boundingBoxGizmo:!1},this._pointerObserver=null,this._attachedMesh=null,this._boundingBoxColor=Cs.Color3.FromHexString("#0984e3"),this.boundingBoxDragBehavior=new Cs.SixDofDragBehavior,this.attachableMeshes=null,this.usePointerToAttachGizmos=!0,this._defaultKeepDepthUtilityLayer=new Cs.UtilityLayerRenderer(e),this._defaultKeepDepthUtilityLayer.utilityLayerScene.autoClearDepthAndStencil=!1,this._defaultUtilityLayer=new Cs.UtilityLayerRenderer(e),this.gizmos={positionGizmo:null,rotationGizmo:null,scaleGizmo:null,boundingBoxGizmo:null},this._pointerObserver=e.onPointerObservable.add((function(e,t){if(n.usePointerToAttachGizmos&&e.type==Cs.PointerEventTypes.POINTERDOWN)if(e.pickInfo&&e.pickInfo.pickedMesh){var i=e.pickInfo.pickedMesh;if(null==n.attachableMeshes)for(;i&&null!=i.parent;)i=i.parent;else{var r=!1;n.attachableMeshes.forEach((function(e){i&&(i==e||i.isDescendantOf(e))&&(i=e,r=!0)})),r||(i=null)}i instanceof Cs.AbstractMesh?n._attachedMesh!=i&&n.attachToMesh(i):n.attachToMesh(null)}else n.attachToMesh(null)}))}return e.prototype.attachToMesh=function(e){for(var t in this._attachedMesh&&this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh=e,this.gizmos){var i=this.gizmos[t];i&&this._gizmosEnabled[t]&&(i.attachedMesh=e)}this.boundingBoxGizmoEnabled&&this._attachedMesh&&this._attachedMesh.addBehavior(this.boundingBoxDragBehavior)},Object.defineProperty(e.prototype,"positionGizmoEnabled",{get:function(){return this._gizmosEnabled.positionGizmo},set:function(e){e?(this.gizmos.positionGizmo||(this.gizmos.positionGizmo=new Cs.PositionGizmo(this._defaultUtilityLayer)),this.gizmos.positionGizmo.attachedMesh=this._attachedMesh):this.gizmos.positionGizmo&&(this.gizmos.positionGizmo.attachedMesh=null),this._gizmosEnabled.positionGizmo=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationGizmoEnabled",{get:function(){return this._gizmosEnabled.rotationGizmo},set:function(e){e?(this.gizmos.rotationGizmo||(this.gizmos.rotationGizmo=new Cs.RotationGizmo(this._defaultUtilityLayer)),this.gizmos.rotationGizmo.attachedMesh=this._attachedMesh):this.gizmos.rotationGizmo&&(this.gizmos.rotationGizmo.attachedMesh=null),this._gizmosEnabled.rotationGizmo=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"scaleGizmoEnabled",{get:function(){return this._gizmosEnabled.scaleGizmo},set:function(e){e?(this.gizmos.scaleGizmo=this.gizmos.scaleGizmo||new Cs.ScaleGizmo(this._defaultUtilityLayer),this.gizmos.scaleGizmo.attachedMesh=this._attachedMesh):this.gizmos.scaleGizmo&&(this.gizmos.scaleGizmo.attachedMesh=null),this._gizmosEnabled.scaleGizmo=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"boundingBoxGizmoEnabled",{get:function(){return this._gizmosEnabled.boundingBoxGizmo},set:function(e){e?(this.gizmos.boundingBoxGizmo=this.gizmos.boundingBoxGizmo||new Cs.BoundingBoxGizmo(this._boundingBoxColor,this._defaultKeepDepthUtilityLayer),this.gizmos.boundingBoxGizmo.attachedMesh=this._attachedMesh,this._attachedMesh&&(this._attachedMesh.removeBehavior(this.boundingBoxDragBehavior),this._attachedMesh.addBehavior(this.boundingBoxDragBehavior))):this.gizmos.boundingBoxGizmo&&(this.gizmos.boundingBoxGizmo.attachedMesh=null),this._gizmosEnabled.boundingBoxGizmo=e},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){for(var e in this.scene.onPointerObservable.remove(this._pointerObserver),this.gizmos){var t=this.gizmos[e];t&&t.dispose()}this._defaultKeepDepthUtilityLayer.dispose(),this._defaultUtilityLayer.dispose(),this.boundingBoxDragBehavior.detach()},e})(),Cs.GizmoManager=Os,Ds=$a||($a={}),Is=(function(){function n(e,t,i){void 0===t&&(t=0),void 0===i&&(i=null),this.name=e,this.animations=new Array,this._positions=null,this._normals=null,this._tangents=null,this.onInfluenceChanged=new Ds.Observable,this._onDataLayoutChanged=new Ds.Observable,this._animationPropertiesOverride=null,this._scene=i||Ds.Engine.LastCreatedScene,this.influence=t}return Object.defineProperty(n.prototype,"influence",{get:function(){return this._influence},set:function(e){if(this._influence!==e){var t=this._influence;this._influence=e,this.onInfluenceChanged.hasObservers&&this.onInfluenceChanged.notifyObservers(0===t||0===e)}},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"animationPropertiesOverride",{get:function(){return!this._animationPropertiesOverride&&this._scene?this._scene.animationPropertiesOverride:this._animationPropertiesOverride},set:function(e){this._animationPropertiesOverride=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasPositions",{get:function(){return!!this._positions},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasNormals",{get:function(){return!!this._normals},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasTangents",{get:function(){return!!this._tangents},enumerable:!0,configurable:!0}),n.prototype.setPositions=function(e){var t=this.hasPositions;this._positions=e,t!==this.hasPositions&&this._onDataLayoutChanged.notifyObservers(void 0)},n.prototype.getPositions=function(){return this._positions},n.prototype.setNormals=function(e){var t=this.hasNormals;this._normals=e,t!==this.hasNormals&&this._onDataLayoutChanged.notifyObservers(void 0)},n.prototype.getNormals=function(){return this._normals},n.prototype.setTangents=function(e){var t=this.hasTangents;this._tangents=e,t!==this.hasTangents&&this._onDataLayoutChanged.notifyObservers(void 0)},n.prototype.getTangents=function(){return this._tangents},n.prototype.serialize=function(){var e={};return e.name=this.name,e.influence=this.influence,e.positions=Array.prototype.slice.call(this.getPositions()),this.hasNormals&&(e.normals=Array.prototype.slice.call(this.getNormals())),this.hasTangents&&(e.tangents=Array.prototype.slice.call(this.getTangents())),Ds.Animation.AppendSerializedAnimations(this,e),e},n.Parse=function(e){var t=new n(e.name,e.influence);if(t.setPositions(e.positions),e.normals&&t.setNormals(e.normals),e.tangents&&t.setTangents(e.tangents),e.animations)for(var i=0;i<e.animations.length;i++){var r=e.animations[i];t.animations.push(Ds.Animation.Parse(r))}return t},n.FromMesh=function(e,t,i){t||(t=e.name);var r=new n(t,i,e.getScene());return r.setPositions(e.getVerticesData(Ds.VertexBuffer.PositionKind)),e.isVerticesDataPresent(Ds.VertexBuffer.NormalKind)&&r.setNormals(e.getVerticesData(Ds.VertexBuffer.NormalKind)),e.isVerticesDataPresent(Ds.VertexBuffer.TangentKind)&&r.setTangents(e.getVerticesData(Ds.VertexBuffer.TangentKind)),r},n})(),Ds.MorphTarget=Is,ws=$a||($a={}),Ls=(function(){function s(e){void 0===e&&(e=null),this._targets=new Array,this._targetInfluenceChangedObservers=new Array,this._targetDataLayoutChangedObservers=new Array,this._activeTargets=new ws.SmartArray(16),this._supportsNormals=!1,this._supportsTangents=!1,this._vertexCount=0,this._uniqueId=0,this._tempInfluences=new Array,e||(e=ws.Engine.LastCreatedScene),this._scene=e,this._scene&&(this._scene.morphTargetManagers.push(this),this._uniqueId=this._scene.getUniqueId())}return Object.defineProperty(s.prototype,"uniqueId",{get:function(){return this._uniqueId},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"vertexCount",{get:function(){return this._vertexCount},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"supportsNormals",{get:function(){return this._supportsNormals},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"supportsTangents",{get:function(){return this._supportsTangents},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"numTargets",{get:function(){return this._targets.length},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"numInfluencers",{get:function(){return this._activeTargets.length},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"influences",{get:function(){return this._influences},enumerable:!0,configurable:!0}),s.prototype.getActiveTarget=function(e){return this._activeTargets.data[e]},s.prototype.getTarget=function(e){return this._targets[e]},s.prototype.addTarget=function(e){var t=this;this._targets.push(e),this._targetInfluenceChangedObservers.push(e.onInfluenceChanged.add((function(e){t._syncActiveTargets(e)}))),this._targetDataLayoutChangedObservers.push(e._onDataLayoutChanged.add((function(){t._syncActiveTargets(!0)}))),this._syncActiveTargets(!0)},s.prototype.removeTarget=function(e){var t=this._targets.indexOf(e);0<=t&&(this._targets.splice(t,1),e.onInfluenceChanged.remove(this._targetInfluenceChangedObservers.splice(t,1)[0]),e._onDataLayoutChanged.remove(this._targetDataLayoutChangedObservers.splice(t,1)[0]),this._syncActiveTargets(!0))},s.prototype.serialize=function(){var e={};e.id=this.uniqueId,e.targets=[];for(var t=0,i=this._targets;t<i.length;t++){var r=i[t];e.targets.push(r.serialize())}return e},s.prototype._syncActiveTargets=function(e){var t=0;this._activeTargets.reset(),this._supportsNormals=!0,this._supportsTangents=!0;for(var i=this._vertexCount=0,r=this._targets;i<r.length;i++){var n=r[i];if(0!==n.influence){this._activeTargets.push(n),this._tempInfluences[t++]=n.influence,this._supportsNormals=this._supportsNormals&&n.hasNormals,this._supportsTangents=this._supportsTangents&&n.hasTangents;var o=n.getPositions();if(o){var s=o.length/3;if(0===this._vertexCount)this._vertexCount=s;else if(this._vertexCount!==s)return void ws.Tools.Error("Incompatible target. Targets must all have the same vertices count.")}}}this._influences&&this._influences.length===t||(this._influences=new Float32Array(t));for(var a=0;a<t;a++)this._influences[a]=this._tempInfluences[a];e&&this.synchronize()},s.prototype.synchronize=function(){if(this._scene)for(var e=0,t=this._scene.meshes;e<t.length;e++){var i=t[e];i.morphTargetManager===this&&i._syncGeometryWithMorphTargetManager()}},s.Parse=function(e,t){var i=new s(t);i._uniqueId=e.id;for(var r=0,n=e.targets;r<n.length;r++){var o=n[r];i.addTarget(ws.MorphTarget.Parse(o))}return i},s})(),ws.MorphTargetManager=Ls,Fs=$a||($a={}),Bs=(function(){function r(e,t,i){void 0===i&&(i=2),this.maxDepth=i,this.dynamicContent=new Array,this._maxBlockCapacity=t||64,this._selectionContent=new Fs.SmartArrayNoDuplicate(1024),this._creationFunc=e}return r.prototype.update=function(e,t,i){r._CreateBlocks(e,t,i,this._maxBlockCapacity,0,this.maxDepth,this,this._creationFunc)},r.prototype.addMesh=function(e){for(var t=0;t<this.blocks.length;t++){this.blocks[t].addEntry(e)}},r.prototype.select=function(e,t){this._selectionContent.reset();for(var i=0;i<this.blocks.length;i++){this.blocks[i].select(e,this._selectionContent,t)}return t?this._selectionContent.concat(this.dynamicContent):this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},r.prototype.intersects=function(e,t,i){this._selectionContent.reset();for(var r=0;r<this.blocks.length;r++){this.blocks[r].intersects(e,t,this._selectionContent,i)}return i?this._selectionContent.concat(this.dynamicContent):this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},r.prototype.intersectsRay=function(e){this._selectionContent.reset();for(var t=0;t<this.blocks.length;t++){this.blocks[t].intersectsRay(e,this._selectionContent)}return this._selectionContent.concatWithNoDuplicate(this.dynamicContent),this._selectionContent},r._CreateBlocks=function(e,t,i,r,n,o,s,a){s.blocks=new Array;for(var l=new Fs.Vector3((t.x-e.x)/2,(t.y-e.y)/2,(t.z-e.z)/2),c=0;c<2;c++)for(var h=0;h<2;h++)for(var u=0;u<2;u++){var d=e.add(l.multiplyByFloats(c,h,u)),f=e.add(l.multiplyByFloats(c+1,h+1,u+1)),p=new Fs.OctreeBlock(d,f,r,n+1,o,a);p.addEntries(i),s.blocks.push(p)}},r.CreationFuncForMeshes=function(e,t){var i=e.getBoundingInfo();!e.isBlocked&&i.boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},r.CreationFuncForSubMeshes=function(e,t){e.getBoundingInfo().boundingBox.intersectsMinMax(t.minPoint,t.maxPoint)&&t.entries.push(e)},r})(),Fs.Octree=Bs,Ns=$a||($a={}),Vs=(function(){function e(e,t,i,r,n,o){this.entries=new Array,this._boundingVectors=new Array,this._capacity=i,this._depth=r,this._maxDepth=n,this._creationFunc=o,this._minPoint=e,this._maxPoint=t,this._boundingVectors.push(e.clone()),this._boundingVectors.push(t.clone()),this._boundingVectors.push(e.clone()),this._boundingVectors[2].x=t.x,this._boundingVectors.push(e.clone()),this._boundingVectors[3].y=t.y,this._boundingVectors.push(e.clone()),this._boundingVectors[4].z=t.z,this._boundingVectors.push(t.clone()),this._boundingVectors[5].z=e.z,this._boundingVectors.push(t.clone()),this._boundingVectors[6].x=e.x,this._boundingVectors.push(t.clone()),this._boundingVectors[7].y=e.y}return Object.defineProperty(e.prototype,"capacity",{get:function(){return this._capacity},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"minPoint",{get:function(){return this._minPoint},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"maxPoint",{get:function(){return this._maxPoint},enumerable:!0,configurable:!0}),e.prototype.addEntry=function(e){if(this.blocks)for(var t=0;t<this.blocks.length;t++){this.blocks[t].addEntry(e)}else this._creationFunc(e,this),this.entries.length>this.capacity&&this._depth<this._maxDepth&&this.createInnerBlocks()},e.prototype.addEntries=function(e){for(var t=0;t<e.length;t++){var i=e[t];this.addEntry(i)}},e.prototype.select=function(e,t,i){if(Ns.BoundingBox.IsInFrustum(this._boundingVectors,e)){if(this.blocks){for(var r=0;r<this.blocks.length;r++){this.blocks[r].select(e,t,i)}return}i?t.concat(this.entries):t.concatWithNoDuplicate(this.entries)}},e.prototype.intersects=function(e,t,i,r){if(Ns.BoundingBox.IntersectsSphere(this._minPoint,this._maxPoint,e,t)){if(this.blocks){for(var n=0;n<this.blocks.length;n++){this.blocks[n].intersects(e,t,i,r)}return}r?i.concat(this.entries):i.concatWithNoDuplicate(this.entries)}},e.prototype.intersectsRay=function(e,t){if(e.intersectsBoxMinMax(this._minPoint,this._maxPoint)){if(this.blocks){for(var i=0;i<this.blocks.length;i++){this.blocks[i].intersectsRay(e,t)}return}t.concatWithNoDuplicate(this.entries)}},e.prototype.createInnerBlocks=function(){Ns.Octree._CreateBlocks(this._minPoint,this._maxPoint,this.entries,this._capacity,this._depth,this._maxDepth,this,this._creationFunc)},e})(),Ns.OctreeBlock=Vs,(function(o){o.Scene.prototype.createOrUpdateSelectionOctree=function(e,t){void 0===e&&(e=64),void 0===t&&(t=2);var i=this._getComponent(o.SceneComponentConstants.NAME_OCTREE);i||(i=new s(this),this._addComponent(i)),this._selectionOctree||(this._selectionOctree=new o.Octree(o.Octree.CreationFuncForMeshes,e,t));var r=this.getWorldExtends();return this._selectionOctree.update(r.min,r.max,this.meshes),this._selectionOctree},Object.defineProperty(o.Scene.prototype,"selectionOctree",{get:function(){return this._selectionOctree},enumerable:!0,configurable:!0}),o.AbstractMesh.prototype.createOrUpdateSubmeshesOctree=function(e,t){void 0===e&&(e=64),void 0===t&&(t=2);var i=this.getScene(),r=i._getComponent(o.SceneComponentConstants.NAME_OCTREE);r||(r=new s(i),i._addComponent(r)),this._submeshesOctree||(this._submeshesOctree=new o.Octree(o.Octree.CreationFuncForSubMeshes,e,t)),this.computeWorldMatrix(!0);var n=this.getBoundingInfo().boundingBox;return this._submeshesOctree.update(n.minimumWorld,n.maximumWorld,this.subMeshes),this._submeshesOctree};var s=(function(){function e(e){this.name=o.SceneComponentConstants.NAME_OCTREE,this.checksIsEnabled=!0,this._tempRay=new o.Ray(o.Vector3.Zero(),new o.Vector3(1,1,1)),this.scene=e,this.scene.getActiveMeshCandidates=this.getActiveMeshCandidates.bind(this),this.scene.getActiveSubMeshCandidates=this.getActiveSubMeshCandidates.bind(this),this.scene.getCollidingSubMeshCandidates=this.getCollidingSubMeshCandidates.bind(this),this.scene.getIntersectingSubMeshCandidates=this.getIntersectingSubMeshCandidates.bind(this)}return e.prototype.register=function(){var r=this;this.scene.onMeshRemovedObservable.add((function(e){var t=r.scene.selectionOctree;if(null!=t){var i=t.dynamicContent.indexOf(e);-1!==i&&t.dynamicContent.splice(i,1)}})),this.scene.onMeshImportedObservable.add((function(e){var t=r.scene.selectionOctree;null!=t&&t.addMesh(e)}))},e.prototype.getActiveMeshCandidates=function(){return this.scene._selectionOctree?this.scene._selectionOctree.select(this.scene.frustumPlanes):this.scene._getDefaultMeshCandidates()},e.prototype.getActiveSubMeshCandidates=function(e){return e._submeshesOctree&&e.useOctreeForRenderingSelection?e._submeshesOctree.select(this.scene.frustumPlanes):this.scene._getDefaultSubMeshCandidates(e)},e.prototype.getIntersectingSubMeshCandidates=function(e,t){return e._submeshesOctree&&e.useOctreeForPicking?(o.Ray.TransformToRef(t,e.getWorldMatrix(),this._tempRay),e._submeshesOctree.intersectsRay(this._tempRay)):this.scene._getDefaultSubMeshCandidates(e)},e.prototype.getCollidingSubMeshCandidates=function(e,t){if(e._submeshesOctree&&e.useOctreeForCollisions){var i=t._velocityWorldLength+Math.max(t._radius.x,t._radius.y,t._radius.z);return e._submeshesOctree.intersects(t._basePointWorld,i)}return this.scene._getDefaultSubMeshCandidates(e)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e})();o.OctreeSceneComponent=s})($a||($a={})),Us=$a||($a={}),zs=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,"anaglyph",null,["leftSampler"],t,i[1],r,n,o)||this;return s._passedProcess=i[0]._rigPostProcess,s.onApplyObservable.add((function(e){e.setTextureFromPostProcess("leftSampler",s._passedProcess)})),s}return T(e,a),e})(Us.PostProcess),Us.AnaglyphPostProcess=zs,(function(c){c.Node.AddNodeConstructor("AnaglyphArcRotateCamera",(function(e,t,i){return function(){return new r(e,0,0,1,c.Vector3.Zero(),i.interaxial_distance,t)}}));var r=(function(l){function e(e,t,i,r,n,o,s){var a=l.call(this,e,t,i,r,n,s)||this;return a.interaxialDistance=o,a.setCameraRigMode(c.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:o}),a}return T(e,l),e.prototype.getClassName=function(){return"AnaglyphArcRotateCamera"},e})(c.ArcRotateCamera);c.AnaglyphArcRotateCamera=r})($a||($a={})),(function(s){s.Node.AddNodeConstructor("AnaglyphFreeCamera",(function(e,t,i){return function(){return new r(e,s.Vector3.Zero(),i.interaxial_distance,t)}}));var r=(function(o){function e(e,t,i,r){var n=o.call(this,e,t,r)||this;return n.interaxialDistance=i,n.setCameraRigMode(s.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),n}return T(e,o),e.prototype.getClassName=function(){return"AnaglyphFreeCamera"},e})(s.FreeCamera);s.AnaglyphFreeCamera=r})($a||($a={})),(function(s){s.Node.AddNodeConstructor("AnaglyphGamepadCamera",(function(e,t,i){return function(){return new r(e,s.Vector3.Zero(),i.interaxial_distance,t)}}));var r=(function(o){function e(e,t,i,r){var n=o.call(this,e,t,r)||this;return n.interaxialDistance=i,n.setCameraRigMode(s.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),n}return T(e,o),e.prototype.getClassName=function(){return"AnaglyphGamepadCamera"},e})(s.GamepadCamera);s.AnaglyphGamepadCamera=r})($a||($a={})),(function(s){s.Node.AddNodeConstructor("AnaglyphUniversalCamera",(function(e,t,i){return function(){return new r(e,s.Vector3.Zero(),i.interaxial_distance,t)}}));var r=(function(o){function e(e,t,i,r){var n=o.call(this,e,t,r)||this;return n.interaxialDistance=i,n.setCameraRigMode(s.Camera.RIG_MODE_STEREOSCOPIC_ANAGLYPH,{interaxialDistance:i}),n}return T(e,o),e.prototype.getClassName=function(){return"AnaglyphUniversalCamera"},e})(s.UniversalCamera);s.AnaglyphUniversalCamera=r})($a||($a={})),Gs=$a||($a={}),ks=(function(a){function e(e,t,i,r,n,o){var s=a.call(this,e,"stereoscopicInterlace",["stepSize"],["camASampler"],1,t[1],r,n,o,i?"#define IS_STEREOSCOPIC_HORIZ 1":void 0)||this;return s._passedProcess=t[0]._rigPostProcess,s._stepSize=new Gs.Vector2(1/s.width,1/s.height),s.onSizeChangedObservable.add((function(){s._stepSize=new Gs.Vector2(1/s.width,1/s.height)})),s.onApplyObservable.add((function(e){e.setTextureFromPostProcess("camASampler",s._passedProcess),e.setFloat2("stepSize",s._stepSize.x,s._stepSize.y)})),s}return T(e,a),e})(Gs.PostProcess),Gs.StereoscopicInterlacePostProcess=ks,(function(h){h.Node.AddNodeConstructor("StereoscopicArcRotateCamera",(function(e,t,i){return function(){return new r(e,0,0,1,h.Vector3.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var r=(function(c){function e(e,t,i,r,n,o,s,a){var l=c.call(this,e,t,i,r,n,a)||this;return l.interaxialDistance=o,l.isStereoscopicSideBySide=s,l.setCameraRigMode(s?h.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:h.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:o}),l}return T(e,c),e.prototype.getClassName=function(){return"StereoscopicArcRotateCamera"},e})(h.ArcRotateCamera);h.StereoscopicArcRotateCamera=r})($a||($a={})),(function(a){a.Node.AddNodeConstructor("StereoscopicFreeCamera",(function(e,t,i){return function(){return new r(e,a.Vector3.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var r=(function(s){function e(e,t,i,r,n){var o=s.call(this,e,t,n)||this;return o.interaxialDistance=i,o.isStereoscopicSideBySide=r,o.setCameraRigMode(r?a.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:a.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),o}return T(e,s),e.prototype.getClassName=function(){return"StereoscopicFreeCamera"},e})(a.FreeCamera);a.StereoscopicFreeCamera=r})($a||($a={})),(function(a){a.Node.AddNodeConstructor("StereoscopicGamepadCamera",(function(e,t,i){return function(){return new r(e,a.Vector3.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var r=(function(s){function e(e,t,i,r,n){var o=s.call(this,e,t,n)||this;return o.interaxialDistance=i,o.isStereoscopicSideBySide=r,o.setCameraRigMode(r?a.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:a.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),o}return T(e,s),e.prototype.getClassName=function(){return"StereoscopicGamepadCamera"},e})(a.GamepadCamera);a.StereoscopicGamepadCamera=r})($a||($a={})),(function(a){a.Node.AddNodeConstructor("StereoscopicFreeCamera",(function(e,t,i){return function(){return new r(e,a.Vector3.Zero(),i.interaxial_distance,i.isStereoscopicSideBySide,t)}}));var r=(function(s){function e(e,t,i,r,n){var o=s.call(this,e,t,n)||this;return o.interaxialDistance=i,o.isStereoscopicSideBySide=r,o.setCameraRigMode(r?a.Camera.RIG_MODE_STEREOSCOPIC_SIDEBYSIDE_PARALLEL:a.Camera.RIG_MODE_STEREOSCOPIC_OVERUNDER,{interaxialDistance:i}),o}return T(e,s),e.prototype.getClassName=function(){return"StereoscopicUniversalCamera"},e})(a.UniversalCamera);a.StereoscopicUniversalCamera=r})($a||($a={})),Ws=$a||($a={}),Hs=(function(o){function e(e,t,i,r){var n=o.call(this,e,"vrDistortionCorrection",["LensCenter","Scale","ScaleIn","HmdWarpParam"],null,r.postProcessScaleFactor,t,Ws.Texture.BILINEAR_SAMPLINGMODE)||this;return n._isRightEye=i,n._distortionFactors=r.distortionK,n._postProcessScaleFactor=r.postProcessScaleFactor,n._lensCenterOffset=r.lensCenterOffset,n.adaptScaleToCurrentViewport=!0,n.onSizeChangedObservable.add((function(){n._scaleIn=new Ws.Vector2(2,2/n.aspectRatio),n._scaleFactor=new Ws.Vector2(1/n._postProcessScaleFactor*.5,1/n._postProcessScaleFactor*.5*n.aspectRatio),n._lensCenter=new Ws.Vector2(n._isRightEye?.5-.5*n._lensCenterOffset:.5+.5*n._lensCenterOffset,.5)})),n.onApplyObservable.add((function(e){e.setFloat2("LensCenter",n._lensCenter.x,n._lensCenter.y),e.setFloat2("Scale",n._scaleFactor.x,n._scaleFactor.y),e.setFloat2("ScaleIn",n._scaleIn.x,n._scaleIn.y),e.setFloat4("HmdWarpParam",n._distortionFactors[0],n._distortionFactors[1],n._distortionFactors[2],n._distortionFactors[3])})),n}return T(e,o),e})(Ws.PostProcess),Ws.VRDistortionCorrectionPostProcess=Hs,Xs=$a||($a={}),js=(function(){function e(){var t=this;this._screenOrientationAngle=0,this._screenQuaternion=new Xs.Quaternion,this._alpha=0,this._beta=0,this._gamma=0,this._orientationChanged=function(){t._screenOrientationAngle=void 0!==window.orientation?+window.orientation:window.screen.orientation&&window.screen.orientation.angle?window.screen.orientation.angle:0,t._screenOrientationAngle=-Xs.Tools.ToRadians(t._screenOrientationAngle/2),t._screenQuaternion.copyFromFloats(0,Math.sin(t._screenOrientationAngle),0,Math.cos(t._screenOrientationAngle))},this._deviceOrientation=function(e){t._alpha=null!==e.alpha?e.alpha:0,t._beta=null!==e.beta?e.beta:0,t._gamma=null!==e.gamma?e.gamma:0},this._constantTranform=new Xs.Quaternion(-Math.sqrt(.5),0,0,Math.sqrt(.5)),this._orientationChanged()}return Object.defineProperty(e.prototype,"camera",{get:function(){return this._camera},set:function(e){this._camera=e,null==this._camera||this._camera.rotationQuaternion||(this._camera.rotationQuaternion=new Xs.Quaternion)},enumerable:!0,configurable:!0}),e.prototype.attachControl=function(e,t){window.addEventListener("orientationchange",this._orientationChanged),window.addEventListener("deviceorientation",this._deviceOrientation),this._orientationChanged()},e.prototype.detachControl=function(e){window.removeEventListener("orientationchange",this._orientationChanged),window.removeEventListener("deviceorientation",this._deviceOrientation)},e.prototype.checkInputs=function(){this._alpha&&(Xs.Quaternion.RotationYawPitchRollToRef(Xs.Tools.ToRadians(this._alpha),Xs.Tools.ToRadians(this._beta),-Xs.Tools.ToRadians(this._gamma),this.camera.rotationQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._screenQuaternion),this._camera.rotationQuaternion.multiplyInPlace(this._constantTranform),this._camera.rotationQuaternion.z*=-1,this._camera.rotationQuaternion.w*=-1)},e.prototype.getClassName=function(){return"FreeCameraDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"deviceOrientation"},e})(),Xs.FreeCameraDeviceOrientationInput=js,Xs.CameraInputTypes.FreeCameraDeviceOrientationInput=js,Ys=$a||($a={}),Ks=(function(){function e(){this.alphaCorrection=1,this.betaCorrection=1,this.gammaCorrection=1,this._alpha=0,this._gamma=0,this._dirty=!1,this._deviceOrientationHandler=this._onOrientationEvent.bind(this)}return e.prototype.attachControl=function(e,t){this.camera.attachControl(e,t),window.addEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype._onOrientationEvent=function(e){null!==e.alpha&&(this._alpha=0|+e.alpha),null!==e.gamma&&(this._gamma=0|+e.gamma),this._dirty=!0},e.prototype.checkInputs=function(){this._dirty&&(this._dirty=!1,this._gamma<0&&(this._gamma=180+this._gamma),this.camera.alpha=-this._alpha/180*Math.PI%Math.PI*2,this.camera.beta=this._gamma/180*Math.PI)},e.prototype.detachControl=function(e){window.removeEventListener("deviceorientation",this._deviceOrientationHandler)},e.prototype.getClassName=function(){return"ArcRotateCameraVRDeviceOrientationInput"},e.prototype.getSimpleName=function(){return"VRDeviceOrientation"},e})(),Ys.ArcRotateCameraVRDeviceOrientationInput=Ks,Ys.CameraInputTypes.ArcRotateCameraVRDeviceOrientationInput=Ks,Qs=$a||($a={}),Zs=(function(){function t(){this.compensateDistortion=!0}return Object.defineProperty(t.prototype,"aspectRatio",{get:function(){return this.hResolution/(2*this.vResolution)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"aspectRatioFov",{get:function(){return 2*Math.atan(this.postProcessScaleFactor*this.vScreenSize/(2*this.eyeToScreenDistance))},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"leftHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return Qs.Matrix.Translation(e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightHMatrix",{get:function(){var e=4*(this.hScreenSize/4-this.lensSeparationDistance/2)/this.hScreenSize;return Qs.Matrix.Translation(-e,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"leftPreViewMatrix",{get:function(){return Qs.Matrix.Translation(.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),Object.defineProperty(t.prototype,"rightPreViewMatrix",{get:function(){return Qs.Matrix.Translation(-.5*this.interpupillaryDistance,0,0)},enumerable:!0,configurable:!0}),t.GetDefault=function(){var e=new t;return e.hResolution=1280,e.vResolution=800,e.hScreenSize=.149759993,e.vScreenSize=.0935999975,e.vScreenCenter=.0467999987,e.eyeToScreenDistance=.0410000011,e.lensSeparationDistance=.063500002,e.interpupillaryDistance=.064000003,e.distortionK=[1,.219999999,.239999995,0],e.chromaAbCorrection=[.995999992,-.00400000019,1.01400006,0],e.postProcessScaleFactor=1.714605507808412,e.lensCenterOffset=.151976421,e},t})(),Qs.VRCameraMetrics=Zs,(function(a){a.Node.AddNodeConstructor("WebVRFreeCamera",(function(e,t){return function(){return new i(e,a.Vector3.Zero(),t)}})),a.Node.AddNodeConstructor("WebVRGamepadCamera",(function(e,t){return function(){return new i(e,a.Vector3.Zero(),t)}}));var i=(function(s){function e(e,t,i,r){void 0===r&&(r={});var n=s.call(this,e,t,i)||this;n.webVROptions=r,n._vrDevice=null,n.rawPose=null,n._specsVersion="1.1",n._attached=!1,n._descendants=[],n._deviceRoomPosition=a.Vector3.Zero(),n._deviceRoomRotationQuaternion=a.Quaternion.Identity(),n._standingMatrix=null,n.devicePosition=a.Vector3.Zero(),n.deviceRotationQuaternion=a.Quaternion.Identity(),n.deviceScaleFactor=1,n._deviceToWorld=a.Matrix.Identity(),n._worldToDevice=a.Matrix.Identity(),n.controllers=[],n.onControllersAttachedObservable=new a.Observable,n.onControllerMeshLoadedObservable=new a.Observable,n.onPoseUpdatedFromDeviceObservable=new a.Observable,n._poseSet=!1,n.rigParenting=!0,n._defaultHeight=void 0,n._htmlElementAttached=null,n._detachIfAttached=function(){var e=n.getEngine().getVRDevice();e&&!e.isPresenting&&n._htmlElementAttached&&n.detachControl(n._htmlElementAttached)},n._workingVector=a.Vector3.Zero(),n._oneVector=a.Vector3.One(),n._workingMatrix=a.Matrix.Identity(),n._tmpMatrix=new a.Matrix,n._cache.position=a.Vector3.Zero(),r.defaultHeight&&(n._defaultHeight=r.defaultHeight,n.position.y=n._defaultHeight),n.minZ=.1,5===arguments.length&&(n.webVROptions=arguments[4]),null==n.webVROptions.trackPosition&&(n.webVROptions.trackPosition=!0),null==n.webVROptions.controllerMeshes&&(n.webVROptions.controllerMeshes=!0),null==n.webVROptions.defaultLightingOnControllers&&(n.webVROptions.defaultLightingOnControllers=!0),n.rotationQuaternion=new a.Quaternion,n.webVROptions&&n.webVROptions.positionScale&&(n.deviceScaleFactor=n.webVROptions.positionScale);var o=n.getEngine();return n._onVREnabled=function(e){e&&n.initControllers()},o.onVRRequestPresentComplete.add(n._onVREnabled),o.initWebVR().add((function(e){e.vrDisplay&&n._vrDevice!==e.vrDisplay&&(n._vrDevice=e.vrDisplay,n.setCameraRigMode(a.Camera.RIG_MODE_WEBVR,{parentCamera:n,vrDisplay:n._vrDevice,frameData:n._frameData,specs:n._specsVersion}),n._attached&&n.getEngine().enableVR())})),"undefined"!=typeof VRFrameData&&(n._frameData=new VRFrameData),i.onBeforeCameraRenderObservable.add((function(t){t.parent===n&&n.rigParenting&&(n._descendants=n.getDescendants(!0,(function(t){var e=n.controllers.some((function(e){return e._mesh===t})),i=-1!==n._rigCameras.indexOf(t);return!e&&!i})),n._descendants.forEach((function(e){e.parent=t})))})),i.onAfterCameraRenderObservable.add((function(e){e.parent===n&&n.rigParenting&&n._descendants.forEach((function(e){e.parent=n}))})),n}return T(e,s),e.prototype.deviceDistanceToRoomGround=function(){return this._standingMatrix?(this._standingMatrix.getTranslationToRef(this._workingVector),this._deviceRoomPosition.y+this._workingVector.y):this._defaultHeight||0},e.prototype.useStandingMatrix=function(t){var i=this;void 0===t&&(t=function(e){}),this.getEngine().initWebVRAsync().then((function(e){e.vrDisplay&&e.vrDisplay.stageParameters&&e.vrDisplay.stageParameters.sittingToStandingTransform&&i.webVROptions.trackPosition?(i._standingMatrix=new a.Matrix,a.Matrix.FromFloat32ArrayToRefScaled(e.vrDisplay.stageParameters.sittingToStandingTransform,0,1,i._standingMatrix),i.getScene().useRightHandedSystem||[2,6,8,9,14].forEach((function(e){i._standingMatrix&&(i._standingMatrix.m[e]*=-1)})),t(!0)):t(!1)}))},e.prototype.useStandingMatrixAsync=function(){var i=this;return new Promise(function(t,e){i.useStandingMatrix((function(e){t(e)}))})},e.prototype.dispose=function(){this._detachIfAttached(),this.getEngine().onVRRequestPresentComplete.removeCallback(this._onVREnabled),this._updateCacheWhenTrackingDisabledObserver&&this._scene.onBeforeRenderObservable.remove(this._updateCacheWhenTrackingDisabledObserver),s.prototype.dispose.call(this)},e.prototype.getControllerByName=function(e){for(var t=0,i=this.controllers;t<i.length;t++){var r=i[t];if(r.hand===e)return r}return null},Object.defineProperty(e.prototype,"leftController",{get:function(){return this._leftController||(this._leftController=this.getControllerByName("left")),this._leftController},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightController",{get:function(){return this._rightController||(this._rightController=this.getControllerByName("right")),this._rightController},enumerable:!0,configurable:!0}),e.prototype.getForwardRay=function(e){return void 0===e&&(e=100),this.leftCamera?s.prototype.getForwardRay.call(this,e,this.leftCamera.getWorldMatrix(),this.leftCamera.globalPosition):s.prototype.getForwardRay.call(this,e)},e.prototype._checkInputs=function(){this._vrDevice&&this._vrDevice.isPresenting&&(this._vrDevice.getFrameData(this._frameData),this.updateFromDevice(this._frameData.pose)),s.prototype._checkInputs.call(this)},e.prototype.updateFromDevice=function(e){e&&e.orientation&&(this.rawPose=e,this._deviceRoomRotationQuaternion.copyFromFloats(e.orientation[0],e.orientation[1],-e.orientation[2],-e.orientation[3]),this.getScene().useRightHandedSystem&&(this._deviceRoomRotationQuaternion.z*=-1,this._deviceRoomRotationQuaternion.w*=-1),this.webVROptions.trackPosition&&this.rawPose.position&&(this._deviceRoomPosition.copyFromFloats(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2]),this.getScene().useRightHandedSystem&&(this._deviceRoomPosition.z*=-1)),this._poseSet=!0)},e.prototype.attachControl=function(e,t){s.prototype.attachControl.call(this,e,t),this._attached=!0,this._htmlElementAttached=e,t=!a.Camera.ForceAttachControlToAlwaysPreventDefault&&t,this._vrDevice&&this.getEngine().enableVR(),window.addEventListener("vrdisplaypresentchange",this._detachIfAttached)},e.prototype.detachControl=function(e){this.getScene().gamepadManager.onGamepadConnectedObservable.remove(this._onGamepadConnectedObserver),this.getScene().gamepadManager.onGamepadDisconnectedObservable.remove(this._onGamepadDisconnectedObserver),s.prototype.detachControl.call(this,e),this._attached=!1,this.getEngine().disableVR(),window.removeEventListener("vrdisplaypresentchange",this._detachIfAttached)},e.prototype.getClassName=function(){return"WebVRFreeCamera"},e.prototype.resetToCurrentRotation=function(){this._vrDevice.resetPose()},e.prototype._updateRigCameras=function(){var e=this._rigCameras[0],t=this._rigCameras[1];e.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),t.rotationQuaternion.copyFrom(this._deviceRoomRotationQuaternion),e.position.copyFrom(this._deviceRoomPosition),t.position.copyFrom(this._deviceRoomPosition)},e.prototype._correctPositionIfNotTrackPosition=function(e,t){void 0===t&&(t=!1),this.rawPose&&this.rawPose.position&&!this.webVROptions.trackPosition&&(a.Matrix.TranslationToRef(this.rawPose.position[0],this.rawPose.position[1],-this.rawPose.position[2],this._tmpMatrix),t||this._tmpMatrix.invert(),this._tmpMatrix.multiplyToRef(e,e))},e.prototype._updateCache=function(e){var t=this;this.rotationQuaternion.equals(this._cache.rotationQuaternion)&&this.position.equals(this._cache.position)||(this.updateCacheCalled||(this.updateCacheCalled=!0,this.update()),this.rotationQuaternion.toRotationMatrix(this._workingMatrix),a.Vector3.TransformCoordinatesToRef(this._deviceRoomPosition,this._workingMatrix,this._workingVector),this.devicePosition.subtractToRef(this._workingVector,this._workingVector),a.Matrix.ComposeToRef(this._oneVector,this.rotationQuaternion,this._workingVector,this._deviceToWorld),this._deviceToWorld.getTranslationToRef(this._workingVector),this._workingVector.addInPlace(this.position),this._workingVector.subtractInPlace(this._cache.position),this._deviceToWorld.setTranslation(this._workingVector),this._deviceToWorld.invertToRef(this._worldToDevice),this.controllers.forEach((function(e){e._deviceToWorld.copyFrom(t._deviceToWorld),t._correctPositionIfNotTrackPosition(e._deviceToWorld),e.update()}))),e||s.prototype._updateCache.call(this),this.updateCacheCalled=!1},e.prototype._computeDevicePosition=function(){a.Vector3.TransformCoordinatesToRef(this._deviceRoomPosition,this._deviceToWorld,this.devicePosition)},e.prototype.update=function(){this._computeDevicePosition(),a.Matrix.FromQuaternionToRef(this._deviceRoomRotationQuaternion,this._workingMatrix),this._workingMatrix.multiplyToRef(this._deviceToWorld,this._workingMatrix),a.Quaternion.FromRotationMatrixToRef(this._workingMatrix,this.deviceRotationQuaternion),this._poseSet&&this.onPoseUpdatedFromDeviceObservable.notifyObservers(null),s.prototype.update.call(this)},e.prototype._getViewMatrix=function(){return a.Matrix.Identity()},e.prototype._getWebVRViewMatrix=function(){var t=this,e=this._cameraRigParams.parentCamera;e._updateCache();var i=this._cameraRigParams.left?this._cameraRigParams.frameData.leftViewMatrix:this._cameraRigParams.frameData.rightViewMatrix;return a.Matrix.FromArrayToRef(i,0,this._webvrViewMatrix),this.getScene().useRightHandedSystem||[2,6,8,9,14].forEach((function(e){t._webvrViewMatrix.m[e]*=-1})),this._webvrViewMatrix.getRotationMatrixToRef(this._cameraRotationMatrix),a.Vector3.TransformCoordinatesToRef(this._referencePoint,this._cameraRotationMatrix,this._transformedReferencePoint),this.position.addToRef(this._transformedReferencePoint,this._currentTarget),1!==e.deviceScaleFactor&&(this._webvrViewMatrix.invert(),e.deviceScaleFactor&&(this._webvrViewMatrix.m[12]*=e.deviceScaleFactor,this._webvrViewMatrix.m[13]*=e.deviceScaleFactor,this._webvrViewMatrix.m[14]*=e.deviceScaleFactor),this._webvrViewMatrix.invert()),e._correctPositionIfNotTrackPosition(this._webvrViewMatrix,!0),e._worldToDevice.multiplyToRef(this._webvrViewMatrix,this._webvrViewMatrix),this._workingMatrix=this._workingMatrix||a.Matrix.Identity(),this._webvrViewMatrix.invertToRef(this._workingMatrix),this._workingMatrix.multiplyToRef(e.getWorldMatrix(),this._workingMatrix),this._workingMatrix.getTranslationToRef(this._globalPosition),this._markSyncedWithParent(),this._webvrViewMatrix},e.prototype._getWebVRProjectionMatrix=function(){var t=this,e=this.parent;e._vrDevice.depthNear=e.minZ,e._vrDevice.depthFar=e.maxZ;var i=this._cameraRigParams.left?this._cameraRigParams.frameData.leftProjectionMatrix:this._cameraRigParams.frameData.rightProjectionMatrix;return a.Matrix.FromArrayToRef(i,0,this._projectionMatrix),this.getScene().useRightHandedSystem||[8,9,10,11].forEach((function(e){t._projectionMatrix.m[e]*=-1})),this._projectionMatrix},e.prototype.initControllers=function(){var n=this;this.controllers=[];var e=this.getScene().gamepadManager;this._onGamepadDisconnectedObserver=e.onGamepadDisconnectedObservable.add((function(e){if(e.type===a.Gamepad.POSE_ENABLED){var t=e;t.defaultModel&&t.defaultModel.setEnabled(!1),"right"===t.hand&&(n._rightController=null),"left"===t.hand&&(n._leftController=null);var i=n.controllers.indexOf(t);-1!==i&&n.controllers.splice(i,1)}})),this._onGamepadConnectedObserver=e.onGamepadConnectedObservable.add((function(e){if(e.type===a.Gamepad.POSE_ENABLED){var t=e;if(n.webVROptions.trackPosition||(t._disableTrackPosition(new a.Vector3("left"==t.hand?-.15:.15,-.5,.25)),n._updateCacheWhenTrackingDisabledObserver||(n._updateCacheWhenTrackingDisabledObserver=n._scene.onBeforeRenderObservable.add((function(){n._updateCache()})))),t.deviceScaleFactor=n.deviceScaleFactor,t._deviceToWorld.copyFrom(n._deviceToWorld),n._correctPositionIfNotTrackPosition(t._deviceToWorld),n.webVROptions.controllerMeshes&&(t.defaultModel?t.defaultModel.setEnabled(!0):t.initControllerMesh(n.getScene(),(function(e){if(e.scaling.scaleInPlace(n.deviceScaleFactor),n.onControllerMeshLoadedObservable.notifyObservers(t),n.webVROptions.defaultLightingOnControllers){n._lightOnControllers||(n._lightOnControllers=new a.HemisphericLight("vrControllersLight",new a.Vector3(0,1,0),n.getScene()));var r=function(e,t){var i=e.getChildren();i&&0!==i.length&&i.forEach((function(e){t.includedOnlyMeshes.push(e),r(e,t)}))};n._lightOnControllers.includedOnlyMeshes.push(e),r(e,n._lightOnControllers)}}))),t.attachToPoseControlledCamera(n),-1===n.controllers.indexOf(t)){n.controllers.push(t);for(var i=!1,r=0;r<n.controllers.length;r++)n.controllers[r].controllerType===a.PoseEnabledControllerType.VIVE&&(i?n.controllers[r].hand="right":(i=!0,n.controllers[r].hand="left"));2<=n.controllers.length&&n.onControllersAttachedObservable.notifyObservers(n.controllers)}}}))},e})(a.FreeCamera);a.WebVRFreeCamera=i})($a||($a={})),(function(o){o.Node.AddNodeConstructor("DeviceOrientationCamera",(function(e,t){return function(){return new i(e,o.Vector3.Zero(),t)}}));var i=(function(n){function e(e,t,i){var r=n.call(this,e,t,i)||this;return r._quaternionCache=new o.Quaternion,r.inputs.addDeviceOrientation(),r}return T(e,n),e.prototype.getClassName=function(){return"DeviceOrientationCamera"},e.prototype._checkInputs=function(){n.prototype._checkInputs.call(this),this._quaternionCache.copyFrom(this.rotationQuaternion),this._initialQuaternion&&this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion)},e.prototype.resetToCurrentRotation=function(t){var i=this;void 0===t&&(t=o.Axis.Y),this.rotationQuaternion&&(this._initialQuaternion||(this._initialQuaternion=new o.Quaternion),this._initialQuaternion.copyFrom(this._quaternionCache||this.rotationQuaternion),["x","y","z"].forEach((function(e){t[e]?i._initialQuaternion[e]*=-1:i._initialQuaternion[e]=0})),this._initialQuaternion.normalize(),this._initialQuaternion.multiplyToRef(this.rotationQuaternion,this.rotationQuaternion))},e})(o.FreeCamera);o.DeviceOrientationCamera=i})($a||($a={})),(function(a){a.Node.AddNodeConstructor("VRDeviceOrientationFreeCamera",(function(e,t){return function(){return new i(e,a.Vector3.Zero(),t)}}));var i=(function(s){function e(e,t,i,r,n){void 0===r&&(r=!0),void 0===n&&(n=a.VRCameraMetrics.GetDefault());var o=s.call(this,e,t,i)||this;return n.compensateDistortion=r,o.setCameraRigMode(a.Camera.RIG_MODE_VR,{vrCameraMetrics:n}),o}return T(e,s),e.prototype.getClassName=function(){return"VRDeviceOrientationFreeCamera"},e})(a.DeviceOrientationCamera);a.VRDeviceOrientationFreeCamera=i})($a||($a={})),(function(h){h.Node.AddNodeConstructor("VRDeviceOrientationFreeCamera",(function(e,t){return function(){return new i(e,0,0,1,h.Vector3.Zero(),t)}}));var i=(function(c){function e(e,t,i,r,n,o,s,a){void 0===s&&(s=!0),void 0===a&&(a=h.VRCameraMetrics.GetDefault());var l=c.call(this,e,t,i,r,n,o)||this;return a.compensateDistortion=s,l.setCameraRigMode(h.Camera.RIG_MODE_VR,{vrCameraMetrics:a}),l.inputs.addVRDeviceOrientation(),l}return T(e,c),e.prototype.getClassName=function(){return"VRDeviceOrientationArcRotateCamera"},e})(h.ArcRotateCamera);h.VRDeviceOrientationArcRotateCamera=i})($a||($a={})),(function(a){a.Node.AddNodeConstructor("VRDeviceOrientationGamepadCamera",(function(e,t){return function(){return new i(e,a.Vector3.Zero(),t)}}));var i=(function(s){function e(e,t,i,r,n){void 0===r&&(r=!0),void 0===n&&(n=a.VRCameraMetrics.GetDefault());var o=s.call(this,e,t,i,r,n)||this;return o.inputs.addGamepad(),o}return T(e,s),e.prototype.getClassName=function(){return"VRDeviceOrientationGamepadCamera"},e})(a.VRDeviceOrientationFreeCamera);a.VRDeviceOrientationGamepadCamera=i})($a||($a={})),qs=$a||($a={}),Js=(function(){function r(e,t){if(void 0===t&&(t=null),this.scene=e,this._pointerDownOnMeshAsked=!1,this._isActionableMesh=!1,this._teleportationRequestInitiated=!1,this._teleportationBackRequestInitiated=!1,this._rotationRightAsked=!1,this._rotationLeftAsked=!1,this._dpadPressed=!0,this._activePointer=!1,this._id=r._idCounter++,t)this._gazeTracker=t.clone("gazeTracker");else{this._gazeTracker=qs.Mesh.CreateTorus("gazeTracker",.0035,.0025,20,e,!1),this._gazeTracker.bakeCurrentTransformIntoVertices(),this._gazeTracker.isPickable=!1,this._gazeTracker.isVisible=!1;var i=new qs.StandardMaterial("targetMat",e);i.specularColor=qs.Color3.Black(),i.emissiveColor=new qs.Color3(.7,.7,.7),i.backFaceCulling=!1,this._gazeTracker.material=i}}return r.prototype._getForwardRay=function(e){return new qs.Ray(qs.Vector3.Zero(),new qs.Vector3(0,0,e))},r.prototype._selectionPointerDown=function(){this._pointerDownOnMeshAsked=!0,this._currentHit&&this.scene.simulatePointerDown(this._currentHit,{pointerId:this._id})},r.prototype._selectionPointerUp=function(){this._currentHit&&this.scene.simulatePointerUp(this._currentHit,{pointerId:this._id}),this._pointerDownOnMeshAsked=!1},r.prototype._activatePointer=function(){this._activePointer=!0},r.prototype._deactivatePointer=function(){this._activePointer=!1},r.prototype._updatePointerDistance=function(e){void 0===e&&(e=100)},r.prototype.dispose=function(){this._interactionsEnabled=!1,this._teleportationEnabled=!1,this._gazeTracker&&this._gazeTracker.dispose()},r._idCounter=0,r})(),$s=(function(a){function e(e,t,i){var r=a.call(this,t,i)||this;r.webVRController=e,r._laserPointer=qs.Mesh.CreateCylinder("laserPointer",1,.004,2e-4,20,1,t,!1);var n=new qs.StandardMaterial("laserPointerMat",t);if(n.emissiveColor=new qs.Color3(.7,.7,.7),n.alpha=.6,r._laserPointer.material=n,r._laserPointer.rotation.x=Math.PI/2,r._laserPointer.position.z=-.5,r._laserPointer.isVisible=!1,r._laserPointer.isPickable=!1,!e.mesh){var o=new qs.Mesh("preloadControllerMesh",t),s=new qs.Mesh(qs.PoseEnabledController.POINTING_POSE,t);s.rotation.x=-.7,o.addChild(s),e.attachToMesh(o)}return r._setLaserPointerParent(e.mesh),r._meshAttachedObserver=e._meshAttachedObservable.add((function(e){r._setLaserPointerParent(e)})),r}return T(e,a),e.prototype._getForwardRay=function(e){return this.webVRController.getForwardRay(e)},e.prototype._activatePointer=function(){a.prototype._activatePointer.call(this),this._laserPointer.isVisible=!0},e.prototype._deactivatePointer=function(){a.prototype._deactivatePointer.call(this),this._laserPointer.isVisible=!1},e.prototype._setLaserPointerColor=function(e){this._laserPointer.material.emissiveColor=e},e.prototype._setLaserPointerParent=function(e){var t=function(e){e.isPickable=!1,e.getChildMeshes().forEach((function(e){t(e)}))};t(e);var i=e.getChildMeshes();this.webVRController._pointingPoseNode=null;for(var r=0;r<i.length;r++)if(i[r].name&&0<=i[r].name.indexOf(qs.PoseEnabledController.POINTING_POSE)){e=i[r],this.webVRController._pointingPoseNode=e;break}this._laserPointer.parent=e},e.prototype._updatePointerDistance=function(e){void 0===e&&(e=100),this._laserPointer.scaling.y=e,this._laserPointer.position.z=-e/2},e.prototype.dispose=function(){a.prototype.dispose.call(this),this._laserPointer.dispose(),this._meshAttachedObserver&&this.webVRController._meshAttachedObservable.remove(this._meshAttachedObserver)},e})(Js),ea=(function(r){function e(e,t){var i=r.call(this,t)||this;return i.getCamera=e,i}return T(e,r),e.prototype._getForwardRay=function(e){var t=this.getCamera();return t?t.getForwardRay(e):new qs.Ray(qs.Vector3.Zero(),qs.Vector3.Forward())},e})(Js),ta=(function(){function e(e,t){void 0===t&&(t={});var r=this;if(this.webVROptions=t,this._webVRsupported=!1,this._webVRready=!1,this._webVRrequesting=!1,this._webVRpresenting=!1,this._fullscreenVRpresenting=!1,this.onEnteringVRObservable=new qs.Observable,this.onExitingVRObservable=new qs.Observable,this.onControllerMeshLoadedObservable=new qs.Observable,this._useCustomVRButton=!1,this._teleportationRequested=!1,this._teleportActive=!1,this._floorMeshesCollection=[],this._rotationAllowed=!0,this._teleportBackwardsVector=new qs.Vector3(0,-1,-1),this._isDefaultTeleportationTarget=!0,this._teleportationFillColor="#444444",this._teleportationBorderColor="#FFFFFF",this._rotationAngle=0,this._haloCenter=new qs.Vector3(0,0,0),this._padSensibilityUp=.65,this._padSensibilityDown=.35,this._leftController=null,this._rightController=null,this.onNewMeshSelected=new qs.Observable,this.onNewMeshPicked=new qs.Observable,this.onBeforeCameraTeleport=new qs.Observable,this.onAfterCameraTeleport=new qs.Observable,this.onSelectedMeshUnselected=new qs.Observable,this.teleportationEnabled=!0,this._teleportationInitialized=!1,this._interactionsEnabled=!1,this._interactionsRequested=!1,this._displayGaze=!0,this._displayLaserPointer=!0,this.updateGazeTrackerScale=!0,this._onResize=function(){r.moveButtonToBottomRight(),r._fullscreenVRpresenting&&r._webVRready&&r.exitVR()},this._onFullscreenChange=function(){void 0!==document.fullscreen?r._fullscreenVRpresenting=document.fullscreen:void 0!==document.mozFullScreen?r._fullscreenVRpresenting=document.mozFullScreen:void 0!==document.webkitIsFullScreen?r._fullscreenVRpresenting=document.webkitIsFullScreen:void 0!==document.msIsFullScreen?r._fullscreenVRpresenting=document.msIsFullScreen:void 0!==document.msFullscreenElement&&(r._fullscreenVRpresenting=document.msFullscreenElement),!r._fullscreenVRpresenting&&r._canvas&&(r.exitVR(),r._useCustomVRButton||(r._btnVR.style.top=r._canvas.offsetTop+r._canvas.offsetHeight-70+"px",r._btnVR.style.left=r._canvas.offsetLeft+r._canvas.offsetWidth-100+"px"))},this.beforeRender=function(){r._leftController&&r._leftController._activePointer&&r._castRayAndSelectObject(r._leftController),r._rightController&&r._rightController._activePointer&&r._castRayAndSelectObject(r._rightController),r._noControllerIsActive?r._castRayAndSelectObject(r._cameraGazer):r._cameraGazer._gazeTracker.isVisible=!1},this._onNewGamepadConnected=function(e){if(e.type!==qs.Gamepad.POSE_ENABLED)e.leftStick&&e.onleftstickchanged((function(e){r._teleportationInitialized&&r.teleportationEnabled&&(!r._leftController&&!r._rightController||r._leftController&&!r._leftController._activePointer&&r._rightController&&!r._rightController._activePointer)&&(r._checkTeleportWithRay(e,r._cameraGazer),r._checkTeleportBackwards(e,r._cameraGazer))})),e.rightStick&&e.onrightstickchanged((function(e){r._teleportationInitialized&&r._checkRotate(e,r._cameraGazer)})),e.type===qs.Gamepad.XBOX&&(e.onbuttondown((function(e){r._interactionsEnabled&&e===qs.Xbox360Button.A&&r._cameraGazer._selectionPointerDown()})),e.onbuttonup((function(e){r._interactionsEnabled&&e===qs.Xbox360Button.A&&r._cameraGazer._selectionPointerUp()})));else{var t=e,i=new $s(t,r._scene,r._cameraGazer._gazeTracker);"right"===t.hand||r._leftController&&r._leftController.webVRController!=t?r._rightController=i:r._leftController=i,r._tryEnableInteractionOnController(i)}},this._tryEnableInteractionOnController=function(e){r._interactionsRequested&&!e._interactionsEnabled&&r._enableInteractionOnController(e),r._teleportationRequested&&!e._teleportationEnabled&&r._enableTeleportationOnController(e)},this._onNewGamepadDisconnected=function(e){e instanceof qs.WebVRController&&("left"===e.hand&&null!=r._leftController&&(r._leftController.dispose(),r._leftController=null),"right"===e.hand&&null!=r._rightController&&(r._rightController.dispose(),r._rightController=null))},this._workingVector=qs.Vector3.Zero(),this._workingQuaternion=qs.Quaternion.Identity(),this._workingMatrix=qs.Matrix.Identity(),this._scene=e,this._canvas=e.getEngine().getRenderingCanvas(),void 0===t.createFallbackVRDeviceOrientationFreeCamera&&(t.createFallbackVRDeviceOrientationFreeCamera=!0),void 0===t.createDeviceOrientationCamera&&(t.createDeviceOrientationCamera=!0),void 0===t.laserToggle&&(t.laserToggle=!0),void 0===t.defaultHeight&&(t.defaultHeight=1.7),t.useCustomVRButton&&(this._useCustomVRButton=!0,t.customVRButton&&(this._btnVR=t.customVRButton)),t.rayLength&&(this._rayLength=t.rayLength),this._defaultHeight=t.defaultHeight,t.positionScale&&(this._rayLength*=t.positionScale,this._defaultHeight*=t.positionScale),this._hasEnteredVR=!1,this._scene.activeCamera?this._position=this._scene.activeCamera.position.clone():this._position=new qs.Vector3(0,this._defaultHeight,0),t.createDeviceOrientationCamera||!this._scene.activeCamera){if(this._deviceOrientationCamera=new qs.DeviceOrientationCamera("deviceOrientationVRHelper",this._position.clone(),e),this._scene.activeCamera&&(this._deviceOrientationCamera.minZ=this._scene.activeCamera.minZ,this._deviceOrientationCamera.maxZ=this._scene.activeCamera.maxZ,this._scene.activeCamera instanceof qs.TargetCamera&&this._scene.activeCamera.rotation)){var i=this._scene.activeCamera;i.rotationQuaternion?this._deviceOrientationCamera.rotationQuaternion.copyFrom(i.rotationQuaternion):this._deviceOrientationCamera.rotationQuaternion.copyFrom(qs.Quaternion.RotationYawPitchRoll(i.rotation.y,i.rotation.x,i.rotation.z)),this._deviceOrientationCamera.rotation=i.rotation.clone()}this._scene.activeCamera=this._deviceOrientationCamera,this._canvas&&this._scene.activeCamera.attachControl(this._canvas)}else this._existingCamera=this._scene.activeCamera;if(t.createFallbackVRDeviceOrientationFreeCamera&&(this._vrDeviceOrientationCamera=new qs.VRDeviceOrientationFreeCamera("VRDeviceOrientationVRHelper",this._position,this._scene)),this._webVRCamera=new qs.WebVRFreeCamera("WebVRHelper",this._position,this._scene,t),this._webVRCamera.useStandingMatrix(),this._cameraGazer=new ea(function(){return r.currentVRCamera},e),!this._useCustomVRButton){this._btnVR=document.createElement("BUTTON"),this._btnVR.className="babylonVRicon",this._btnVR.id="babylonVRiconbtn",this._btnVR.title="Click to switch to VR";".babylonVRicon.vrdisplaypresenting { display: none; }";var n=document.createElement("style");n.appendChild(document.createTextNode(".babylonVRicon { position: absolute; right: 20px; height: 50px; width: 80px; background-color: rgba(51,51,51,0.7); background-image: url(data:image/svg+xml;charset=UTF-8,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20width%3D%222048%22%20height%3D%221152%22%20viewBox%3D%220%200%202048%201152%22%20version%3D%221.1%22%3E%3Cpath%20transform%3D%22rotate%28180%201024%2C576.0000000000001%29%22%20d%3D%22m1109%2C896q17%2C0%2030%2C-12t13%2C-30t-12.5%2C-30.5t-30.5%2C-12.5l-170%2C0q-18%2C0%20-30.5%2C12.5t-12.5%2C30.5t13%2C30t30%2C12l170%2C0zm-85%2C256q59%2C0%20132.5%2C-1.5t154.5%2C-5.5t164.5%2C-11.5t163%2C-20t150%2C-30t124.5%2C-41.5q23%2C-11%2042%2C-24t38%2C-30q27%2C-25%2041%2C-61.5t14%2C-72.5l0%2C-257q0%2C-123%20-47%2C-232t-128%2C-190t-190%2C-128t-232%2C-47l-81%2C0q-37%2C0%20-68.5%2C14t-60.5%2C34.5t-55.5%2C45t-53%2C45t-53%2C34.5t-55.5%2C14t-55.5%2C-14t-53%2C-34.5t-53%2C-45t-55.5%2C-45t-60.5%2C-34.5t-68.5%2C-14l-81%2C0q-123%2C0%20-232%2C47t-190%2C128t-128%2C190t-47%2C232l0%2C257q0%2C68%2038%2C115t97%2C73q54%2C24%20124.5%2C41.5t150%2C30t163%2C20t164.5%2C11.5t154.5%2C5.5t132.5%2C1.5zm939%2C-298q0%2C39%20-24.5%2C67t-58.5%2C42q-54%2C23%20-122%2C39.5t-143.5%2C28t-155.5%2C19t-157%2C11t-148.5%2C5t-129.5%2C1.5q-59%2C0%20-130%2C-1.5t-148%2C-5t-157%2C-11t-155.5%2C-19t-143.5%2C-28t-122%2C-39.5q-34%2C-14%20-58.5%2C-42t-24.5%2C-67l0%2C-257q0%2C-106%2040.5%2C-199t110%2C-162.5t162.5%2C-109.5t199%2C-40l81%2C0q27%2C0%2052%2C14t50%2C34.5t51%2C44.5t55.5%2C44.5t63.5%2C34.5t74%2C14t74%2C-14t63.5%2C-34.5t55.5%2C-44.5t51%2C-44.5t50%2C-34.5t52%2C-14l14%2C0q37%2C0%2070%2C0.5t64.5%2C4.5t63.5%2C12t68%2C23q71%2C30%20128.5%2C78.5t98.5%2C110t63.5%2C133.5t22.5%2C149l0%2C257z%22%20fill%3D%22white%22%20/%3E%3C/svg%3E%0A); background-size: 80%; background-repeat:no-repeat; background-position: center; border: none; outline: none; transition: transform 0.125s ease-out } .babylonVRicon:hover { transform: scale(1.05) } .babylonVRicon:active {background-color: rgba(51,51,51,1) } .babylonVRicon:focus {background-color: rgba(51,51,51,1) }.babylonVRicon.vrdisplaypresenting { display: none; }")),document.getElementsByTagName("head")[0].appendChild(n),this.moveButtonToBottomRight()}this._btnVR&&this._btnVR.addEventListener("click",(function(){r.isInVRMode?r.exitVR():r.enterVR()})),window.addEventListener("resize",this._onResize),document.addEventListener("fullscreenchange",this._onFullscreenChange,!1),document.addEventListener("mozfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("webkitfullscreenchange",this._onFullscreenChange,!1),document.addEventListener("msfullscreenchange",this._onFullscreenChange,!1),document.onmsfullscreenchange=this._onFullscreenChange,t.createFallbackVRDeviceOrientationFreeCamera?this.displayVRButton():this._scene.getEngine().onVRDisplayChangedObservable.add((function(e){e.vrDisplay&&r.displayVRButton()})),this._onKeyDown=function(e){27===e.keyCode&&r.isInVRMode&&r.exitVR()},document.addEventListener("keydown",this._onKeyDown),this._scene.onPrePointerObservable.add((function(e,t){r.isInVRMode&&(r.exitVR(),r._fullscreenVRpresenting&&r._scene.getEngine().switchFullscreen(!0))}),qs.PointerEventTypes.POINTERDOUBLETAP,!1),this._onVRDisplayChanged=function(e){return r.onVRDisplayChanged(e)},this._onVrDisplayPresentChange=function(){return r.onVrDisplayPresentChange()},this._onVRRequestPresentStart=function(){r._webVRrequesting=!0,r.updateButtonVisibility()},this._onVRRequestPresentComplete=function(e){r._webVRrequesting=!1,r.updateButtonVisibility()},e.getEngine().onVRDisplayChangedObservable.add(this._onVRDisplayChanged),e.getEngine().onVRRequestPresentStart.add(this._onVRRequestPresentStart),e.getEngine().onVRRequestPresentComplete.add(this._onVRRequestPresentComplete),window.addEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),e.onDisposeObservable.add((function(){r.dispose()})),this._webVRCamera.onControllerMeshLoadedObservable.add((function(e){return r._onDefaultMeshLoaded(e)})),this._scene.gamepadManager.onGamepadConnectedObservable.add(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.add(this._onNewGamepadDisconnected),this.updateButtonVisibility(),this._circleEase=new qs.CircleEase,this._circleEase.setEasingMode(qs.EasingFunction.EASINGMODE_EASEINOUT),this.webVROptions.floorMeshes&&this.enableTeleportation({floorMeshes:this.webVROptions.floorMeshes})}return Object.defineProperty(e.prototype,"onEnteringVR",{get:function(){return this.onEnteringVRObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onExitingVR",{get:function(){return this.onExitingVRObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onControllerMeshLoaded",{get:function(){return this.onControllerMeshLoadedObservable},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"teleportationTarget",{get:function(){return this._teleportationTarget},set:function(e){e&&(e.name="teleportationTarget",this._isDefaultTeleportationTarget=!1,this._teleportationTarget=e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"gazeTrackerMesh",{get:function(){return this._cameraGazer._gazeTracker},set:function(e){e&&(this._cameraGazer._gazeTracker&&this._cameraGazer._gazeTracker.dispose(),this._leftController&&this._leftController._gazeTracker&&this._leftController._gazeTracker.dispose(),this._rightController&&this._rightController._gazeTracker&&this._rightController._gazeTracker.dispose(),this._cameraGazer._gazeTracker=e,this._cameraGazer._gazeTracker.bakeCurrentTransformIntoVertices(),this._cameraGazer._gazeTracker.isPickable=!1,this._cameraGazer._gazeTracker.isVisible=!1,this._cameraGazer._gazeTracker.name="gazeTracker",this._leftController&&(this._leftController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")),this._rightController&&(this._rightController._gazeTracker=this._cameraGazer._gazeTracker.clone("gazeTracker")))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"leftControllerGazeTrackerMesh",{get:function(){return this._leftController?this._leftController._gazeTracker:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rightControllerGazeTrackerMesh",{get:function(){return this._rightController?this._rightController._gazeTracker:null},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayGaze",{get:function(){return this._displayGaze},set:function(e){(this._displayGaze=e)||(this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"displayLaserPointer",{get:function(){return this._displayLaserPointer},set:function(e){(this._displayLaserPointer=e)?(this._rightController&&this._rightController._activatePointer(),this._leftController&&this._leftController._activatePointer()):(this._rightController&&(this._rightController._deactivatePointer(),this._rightController._gazeTracker.isVisible=!1),this._leftController&&(this._leftController._deactivatePointer(),this._leftController._gazeTracker.isVisible=!1))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"deviceOrientationCamera",{get:function(){return this._deviceOrientationCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"currentVRCamera",{get:function(){return this._webVRready?this._webVRCamera:this._scene.activeCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"webVRCamera",{get:function(){return this._webVRCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"vrDeviceOrientationCamera",{get:function(){return this._vrDeviceOrientationCamera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"_teleportationRequestInitiated",{get:function(){return this._cameraGazer._teleportationRequestInitiated||null!==this._leftController&&this._leftController._teleportationRequestInitiated||null!==this._rightController&&this._rightController._teleportationRequestInitiated},enumerable:!0,configurable:!0}),e.prototype._onDefaultMeshLoaded=function(e){this._leftController&&this._leftController.webVRController==e&&e.mesh&&this._leftController._setLaserPointerParent(e.mesh),this._rightController&&this._rightController.webVRController==e&&e.mesh&&this._rightController._setLaserPointerParent(e.mesh);try{this.onControllerMeshLoadedObservable.notifyObservers(e)}catch(e){qs.Tools.Warn("Error in your custom logic onControllerMeshLoaded: "+e)}},Object.defineProperty(e.prototype,"isInVRMode",{get:function(){return this._webVRpresenting||this._fullscreenVRpresenting},enumerable:!0,configurable:!0}),e.prototype.onVrDisplayPresentChange=function(){var e=this._scene.getEngine().getVRDevice();if(e){var t=this._webVRpresenting;this._webVRpresenting=e.isPresenting,t&&!this._webVRpresenting&&this.exitVR()}else qs.Tools.Warn("Detected VRDisplayPresentChange on an unknown VRDisplay. Did you can enterVR on the vrExperienceHelper?");this.updateButtonVisibility()},e.prototype.onVRDisplayChanged=function(e){this._webVRsupported=e.vrSupported,this._webVRready=!!e.vrDisplay,this._webVRpresenting=e.vrDisplay&&e.vrDisplay.isPresenting,this.updateButtonVisibility()},e.prototype.moveButtonToBottomRight=function(){this._canvas&&!this._useCustomVRButton&&(this._btnVR.style.top=this._canvas.offsetTop+this._canvas.offsetHeight-70+"px",this._btnVR.style.left=this._canvas.offsetLeft+this._canvas.offsetWidth-100+"px")},e.prototype.displayVRButton=function(){this._useCustomVRButton||this._btnVRDisplayed||(document.body.appendChild(this._btnVR),this._btnVRDisplayed=!0)},e.prototype.updateButtonVisibility=function(){this._btnVR&&!this._useCustomVRButton&&(this._btnVR.className="babylonVRicon",this.isInVRMode?this._btnVR.className+=" vrdisplaypresenting":(this._webVRready&&(this._btnVR.className+=" vrdisplayready"),this._webVRsupported&&(this._btnVR.className+=" vrdisplaysupported"),this._webVRrequesting&&(this._btnVR.className+=" vrdisplayrequesting")))},e.prototype.enterVR=function(){if(this.onEnteringVRObservable)try{this.onEnteringVRObservable.notifyObservers(this)}catch(e){qs.Tools.Warn("Error in your custom logic onEnteringVR: "+e)}this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone(),this._existingCamera=this._scene.activeCamera),this._webVRrequesting||(this._webVRready?this._webVRpresenting||(this._webVRCamera.position=this._position,this._scene.activeCamera=this._webVRCamera):this._vrDeviceOrientationCamera&&(this._vrDeviceOrientationCamera.position=this._position,this._scene.activeCamera&&(this._vrDeviceOrientationCamera.minZ=this._scene.activeCamera.minZ),this._scene.activeCamera=this._vrDeviceOrientationCamera,this._scene.getEngine().switchFullscreen(!0),this.updateButtonVisibility()),this._scene.activeCamera&&this._canvas&&this._scene.activeCamera.attachControl(this._canvas),this._interactionsEnabled&&this._scene.registerBeforeRender(this.beforeRender),this._hasEnteredVR=!0)},e.prototype.exitVR=function(){if(this._hasEnteredVR){if(this.onExitingVRObservable)try{this.onExitingVRObservable.notifyObservers(this)}catch(e){qs.Tools.Warn("Error in your custom logic onExitingVR: "+e)}this._webVRpresenting&&this._scene.getEngine().disableVR(),this._scene.activeCamera&&(this._position=this._scene.activeCamera.position.clone()),this._deviceOrientationCamera?(this._deviceOrientationCamera.position=this._position,this._scene.activeCamera=this._deviceOrientationCamera,this._canvas&&this._scene.activeCamera.attachControl(this._canvas)):this._existingCamera&&(this._existingCamera.position=this._position,this._scene.activeCamera=this._existingCamera),this.updateButtonVisibility(),this._interactionsEnabled&&(this._scene.unregisterBeforeRender(this.beforeRender),this._cameraGazer._gazeTracker.isVisible=!1,this._leftController&&(this._leftController._gazeTracker.isVisible=!1),this._rightController&&(this._rightController._gazeTracker.isVisible=!1)),this._scene.getEngine().resize(),this._hasEnteredVR=!1}},Object.defineProperty(e.prototype,"position",{get:function(){return this._position},set:function(e){this._position=e,this._scene.activeCamera&&(this._scene.activeCamera.position=e)},enumerable:!0,configurable:!0}),e.prototype.enableInteractions=function(){var t=this;this._interactionsEnabled||(this._interactionsRequested=!0,this._leftController&&this._enableInteractionOnController(this._leftController),this._rightController&&this._enableInteractionOnController(this._rightController),this.raySelectionPredicate=function(e){return e.isVisible&&(e.isPickable||e.name===t._floorMeshName)},this.meshSelectionPredicate=function(e){return!0},this._raySelectionPredicate=function(e){return!!(t._isTeleportationFloor(e)||-1===e.name.indexOf("gazeTracker")&&-1===e.name.indexOf("teleportationTarget")&&-1===e.name.indexOf("torusTeleportation"))&&t.raySelectionPredicate(e)},this._interactionsEnabled=!0)},Object.defineProperty(e.prototype,"_noControllerIsActive",{get:function(){return!(this._leftController&&this._leftController._activePointer||this._rightController&&this._rightController._activePointer)},enumerable:!0,configurable:!0}),e.prototype._isTeleportationFloor=function(e){for(var t=0;t<this._floorMeshesCollection.length;t++)if(this._floorMeshesCollection[t].id===e.id)return!0;return!(!this._floorMeshName||e.name!==this._floorMeshName)},e.prototype.addFloorMesh=function(e){this._floorMeshesCollection&&(-1<this._floorMeshesCollection.indexOf(e)||this._floorMeshesCollection.push(e))},e.prototype.removeFloorMesh=function(e){if(this._floorMeshesCollection){var t=this._floorMeshesCollection.indexOf(e);-1!==t&&this._floorMeshesCollection.splice(t,1)}},e.prototype.enableTeleportation=function(e){if(void 0===e&&(e={}),!this._teleportationInitialized){this._teleportationRequested=!0,this.enableInteractions(),e.floorMeshName&&(this._floorMeshName=e.floorMeshName),e.floorMeshes&&(this._floorMeshesCollection=e.floorMeshes),null!=this._leftController&&this._enableTeleportationOnController(this._leftController),null!=this._rightController&&this._enableTeleportationOnController(this._rightController);var t=new qs.ImageProcessingConfiguration;t.vignetteColor=new qs.Color4(0,0,0,0),t.vignetteEnabled=!0,this._postProcessMove=new qs.ImageProcessingPostProcess("postProcessMove",1,this._webVRCamera,void 0,void 0,void 0,void 0,t),this._webVRCamera.detachPostProcess(this._postProcessMove),this._teleportationInitialized=!0,this._isDefaultTeleportationTarget&&(this._createTeleportationCircles(),this._teleportationTarget.scaling.scaleInPlace(this._webVRCamera.deviceScaleFactor))}},e.prototype._enableInteractionOnController=function(i){var r=this;i.webVRController.mesh&&(i._interactionsEnabled=!0,i._activatePointer(),this.webVROptions.laserToggle&&i.webVRController.onMainButtonStateChangedObservable.add((function(e){r._displayLaserPointer&&1===e.value&&(i._activePointer?i._deactivatePointer():i._activatePointer(),r.displayGaze&&(i._gazeTracker.isVisible=i._activePointer))})),i.webVRController.onTriggerStateChangedObservable.add((function(e){var t=i;r._noControllerIsActive&&(t=r._cameraGazer),t._pointerDownOnMeshAsked?e.value<r._padSensibilityDown&&t._selectionPointerUp():e.value>r._padSensibilityUp&&t._selectionPointerDown()})))},e.prototype._checkTeleportWithRay=function(e,t){this._teleportationRequestInitiated&&!t._teleportationRequestInitiated||(t._teleportationRequestInitiated?Math.sqrt(e.y*e.y+e.x*e.x)<this._padSensibilityDown&&(this._teleportActive&&this.teleportCamera(this._haloCenter),t._teleportationRequestInitiated=!1):e.y<-this._padSensibilityUp&&t._dpadPressed&&(t._activatePointer(),t._teleportationRequestInitiated=!0))},e.prototype._checkRotate=function(e,t){t._teleportationRequestInitiated||(t._rotationLeftAsked?e.x>-this._padSensibilityDown&&(t._rotationLeftAsked=!1):e.x<-this._padSensibilityUp&&t._dpadPressed&&(t._rotationLeftAsked=!0,this._rotationAllowed&&this._rotateCamera(!1)),t._rotationRightAsked?e.x<this._padSensibilityDown&&(t._rotationRightAsked=!1):e.x>this._padSensibilityUp&&t._dpadPressed&&(t._rotationRightAsked=!0,this._rotationAllowed&&this._rotateCamera(!0)))},e.prototype._checkTeleportBackwards=function(e,t){if(!t._teleportationRequestInitiated)if(e.y>this._padSensibilityUp&&t._dpadPressed){if(!t._teleportationBackRequestInitiated){if(!this.currentVRCamera)return;var i=qs.Quaternion.FromRotationMatrix(this.currentVRCamera.getWorldMatrix().getRotationMatrix()),r=this.currentVRCamera.position;this.currentVRCamera.devicePosition&&this.currentVRCamera.deviceRotationQuaternion&&(i=this.currentVRCamera.deviceRotationQuaternion,r=this.currentVRCamera.devicePosition),i.toEulerAnglesToRef(this._workingVector),this._workingVector.z=0,this._workingVector.x=0,qs.Quaternion.RotationYawPitchRollToRef(this._workingVector.y,this._workingVector.x,this._workingVector.z,this._workingQuaternion),this._workingQuaternion.toRotationMatrix(this._workingMatrix),qs.Vector3.TransformCoordinatesToRef(this._teleportBackwardsVector,this._workingMatrix,this._workingVector);var n=new qs.Ray(r,this._workingVector),o=this._scene.pickWithRay(n,this._raySelectionPredicate);o&&o.pickedPoint&&o.pickedMesh&&this._isTeleportationFloor(o.pickedMesh)&&o.distance<5&&this.teleportCamera(o.pickedPoint),t._teleportationBackRequestInitiated=!0}}else t._teleportationBackRequestInitiated=!1},e.prototype._enableTeleportationOnController=function(t){var i=this;t.webVRController.mesh&&(t._interactionsEnabled||this._enableInteractionOnController(t),t._interactionsEnabled=!0,t._teleportationEnabled=!0,t.webVRController.controllerType===qs.PoseEnabledControllerType.VIVE&&(t._dpadPressed=!1,t.webVRController.onPadStateChangedObservable.add((function(e){t._dpadPressed=e.pressed,t._dpadPressed||(t._rotationLeftAsked=!1,t._rotationRightAsked=!1,t._teleportationBackRequestInitiated=!1)}))),t.webVRController.onPadValuesChangedObservable.add((function(e){i.teleportationEnabled&&(i._checkTeleportBackwards(e,t),i._checkTeleportWithRay(e,t)),i._checkRotate(e,t)})))},e.prototype._createTeleportationCircles=function(){this._teleportationTarget=qs.Mesh.CreateGround("teleportationTarget",2,2,2,this._scene),this._teleportationTarget.isPickable=!1;var e=new qs.DynamicTexture("DynamicTexture",512,this._scene,!0);e.hasAlpha=!0;var t=e.getContext();t.beginPath(),t.arc(256,256,200,0,2*Math.PI,!1),t.fillStyle=this._teleportationFillColor,t.fill(),t.lineWidth=10,t.strokeStyle=this._teleportationBorderColor,t.stroke(),t.closePath(),e.update();var i=new qs.StandardMaterial("TextPlaneMaterial",this._scene);i.diffuseTexture=e,this._teleportationTarget.material=i;var r=qs.Mesh.CreateTorus("torusTeleportation",.75,.1,25,this._scene,!1);r.isPickable=!1,r.parent=this._teleportationTarget;var n=new qs.Animation("animationInnerCircle","position.y",30,qs.Animation.ANIMATIONTYPE_FLOAT,qs.Animation.ANIMATIONLOOPMODE_CYCLE),o=[];o.push({frame:0,value:0}),o.push({frame:30,value:.4}),o.push({frame:60,value:0}),n.setKeys(o);var s=new qs.SineEase;s.setEasingMode(qs.EasingFunction.EASINGMODE_EASEINOUT),n.setEasingFunction(s),r.animations=[],r.animations.push(n),this._scene.beginAnimation(r,0,60,!0),this._hideTeleportationTarget()},e.prototype._displayTeleportationTarget=function(){this._teleportActive=!0,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!0,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!0))},e.prototype._hideTeleportationTarget=function(){this._teleportActive=!1,this._teleportationInitialized&&(this._teleportationTarget.isVisible=!1,this._isDefaultTeleportationTarget&&(this._teleportationTarget.getChildren()[0].isVisible=!1))},e.prototype._rotateCamera=function(e){var t=this;if(this.currentVRCamera instanceof qs.FreeCamera){e?this._rotationAngle++:this._rotationAngle--,this.currentVRCamera.animations=[];var i=qs.Quaternion.FromRotationMatrix(qs.Matrix.RotationY(Math.PI/4*this._rotationAngle)),r=new qs.Animation("animationRotation","rotationQuaternion",90,qs.Animation.ANIMATIONTYPE_QUATERNION,qs.Animation.ANIMATIONLOOPMODE_CONSTANT),n=[];n.push({frame:0,value:this.currentVRCamera.rotationQuaternion}),n.push({frame:6,value:i}),r.setKeys(n),r.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(r),this._postProcessMove.animations=[];var o=new qs.Animation("animationPP","vignetteWeight",90,qs.Animation.ANIMATIONTYPE_FLOAT,qs.Animation.ANIMATIONLOOPMODE_CONSTANT),s=[];s.push({frame:0,value:0}),s.push({frame:3,value:4}),s.push({frame:6,value:0}),o.setKeys(s),o.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(o);var a=new qs.Animation("animationPP2","vignetteStretch",90,qs.Animation.ANIMATIONTYPE_FLOAT,qs.Animation.ANIMATIONLOOPMODE_CONSTANT),l=[];l.push({frame:0,value:0}),l.push({frame:3,value:10}),l.push({frame:6,value:0}),a.setKeys(l),a.setEasingFunction(this._circleEase),this._postProcessMove.animations.push(a),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._postProcessMove.samples=4,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,6,!1,1,(function(){t._webVRCamera.detachPostProcess(t._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,6,!1,1)}},e.prototype._moveTeleportationSelectorTo=function(e,t,i){if(e.pickedPoint){t._teleportationRequestInitiated&&(this._displayTeleportationTarget(),this._haloCenter.copyFrom(e.pickedPoint),this._teleportationTarget.position.copyFrom(e.pickedPoint));var r=this._convertNormalToDirectionOfRay(e.getNormal(!0,!1),i);if(r){var n=qs.Vector3.Cross(qs.Axis.Y,r),o=qs.Vector3.Cross(r,n);qs.Vector3.RotationFromAxisToRef(o,r,n,this._teleportationTarget.rotation)}this._teleportationTarget.position.y+=.1}},e.prototype.teleportCamera=function(e){var t=this;if(this.currentVRCamera instanceof qs.FreeCamera){this.webVRCamera.leftCamera?(this._workingVector.copyFrom(this.webVRCamera.leftCamera.globalPosition),this._workingVector.subtractInPlace(this.webVRCamera.position),e.subtractToRef(this._workingVector,this._workingVector)):this._workingVector.copyFrom(e),this.isInVRMode?this._workingVector.y+=this.webVRCamera.deviceDistanceToRoomGround()*this._webVRCamera.deviceScaleFactor:this._workingVector.y+=this._defaultHeight,this.onBeforeCameraTeleport.notifyObservers(this._workingVector),this.currentVRCamera.animations=[];var i=new qs.Animation("animationCameraTeleportation","position",90,qs.Animation.ANIMATIONTYPE_VECTOR3,qs.Animation.ANIMATIONLOOPMODE_CONSTANT),r=[{frame:0,value:this.currentVRCamera.position},{frame:11,value:this._workingVector}];i.setKeys(r),i.setEasingFunction(this._circleEase),this.currentVRCamera.animations.push(i),this._postProcessMove.animations=[];var n=new qs.Animation("animationPP","vignetteWeight",90,qs.Animation.ANIMATIONTYPE_FLOAT,qs.Animation.ANIMATIONLOOPMODE_CONSTANT),o=[];o.push({frame:0,value:0}),o.push({frame:5,value:8}),o.push({frame:11,value:0}),n.setKeys(o),this._postProcessMove.animations.push(n);var s=new qs.Animation("animationPP2","vignetteStretch",90,qs.Animation.ANIMATIONTYPE_FLOAT,qs.Animation.ANIMATIONLOOPMODE_CONSTANT),a=[];a.push({frame:0,value:0}),a.push({frame:5,value:10}),a.push({frame:11,value:0}),s.setKeys(a),this._postProcessMove.animations.push(s),this._postProcessMove.imageProcessingConfiguration.vignetteWeight=0,this._postProcessMove.imageProcessingConfiguration.vignetteStretch=0,this._webVRCamera.attachPostProcess(this._postProcessMove),this._scene.beginAnimation(this._postProcessMove,0,11,!1,1,(function(){t._webVRCamera.detachPostProcess(t._postProcessMove)})),this._scene.beginAnimation(this.currentVRCamera,0,11,!1,1,(function(){t.onAfterCameraTeleport.notifyObservers(t._workingVector)})),this._hideTeleportationTarget()}},e.prototype._convertNormalToDirectionOfRay=function(e,t){e&&(Math.acos(qs.Vector3.Dot(e,t.direction))<Math.PI/2&&e.scaleInPlace(-1));return e},e.prototype._castRayAndSelectObject=function(e){if(this.currentVRCamera instanceof qs.FreeCamera){var t=e._getForwardRay(this._rayLength),i=this._scene.pickWithRay(t,this._raySelectionPredicate);if(i&&(e._laserPointer&&(i.originMesh=e._laserPointer.parent),this._scene.simulatePointerMove(i,{pointerId:e._id})),(e._currentHit=i)&&i.pickedPoint){if(this._displayGaze){var r=1;e._gazeTracker.isVisible=!0,e._isActionableMesh&&(r=3),this.updateGazeTrackerScale&&(e._gazeTracker.scaling.x=i.distance*r,e._gazeTracker.scaling.y=i.distance*r,e._gazeTracker.scaling.z=i.distance*r);var n=this._convertNormalToDirectionOfRay(i.getNormal(),t);if(n){var o=qs.Vector3.Cross(qs.Axis.Y,n),s=qs.Vector3.Cross(n,o);qs.Vector3.RotationFromAxisToRef(s,n,o,e._gazeTracker.rotation)}e._gazeTracker.position.copyFrom(i.pickedPoint),e._gazeTracker.position.x<0?e._gazeTracker.position.x+=.002:e._gazeTracker.position.x-=.002,e._gazeTracker.position.y<0?e._gazeTracker.position.y+=.002:e._gazeTracker.position.y-=.002,e._gazeTracker.position.z<0?e._gazeTracker.position.z+=.002:e._gazeTracker.position.z-=.002}e._updatePointerDistance(i.distance)}else e._updatePointerDistance(),e._gazeTracker.isVisible=!1;if(i&&i.pickedMesh){if(this._teleportationInitialized&&this._isTeleportationFloor(i.pickedMesh)&&i.pickedPoint)return e._currentMeshSelected&&!this._isTeleportationFloor(e._currentMeshSelected)&&this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,void(e._teleportationRequestInitiated&&this._moveTeleportationSelectorTo(i,e,t));if(i.pickedMesh!==e._currentMeshSelected)if(this.meshSelectionPredicate(i.pickedMesh)){this.onNewMeshPicked.notifyObservers(i),e._currentMeshSelected=i.pickedMesh,i.pickedMesh.isPickable&&i.pickedMesh.actionManager?(this.changeGazeColor(new qs.Color3(0,0,1)),this.changeLaserColor(new qs.Color3(.2,.2,1)),e._isActionableMesh=!0):(this.changeGazeColor(new qs.Color3(.7,.7,.7)),this.changeLaserColor(new qs.Color3(.7,.7,.7)),e._isActionableMesh=!1);try{this.onNewMeshSelected.notifyObservers(i.pickedMesh)}catch(e){qs.Tools.Warn("Error in your custom logic onNewMeshSelected: "+e)}}else this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,this.changeGazeColor(new qs.Color3(.7,.7,.7)),this.changeLaserColor(new qs.Color3(.7,.7,.7))}else this._notifySelectedMeshUnselected(e._currentMeshSelected),e._currentMeshSelected=null,this.changeGazeColor(new qs.Color3(.7,.7,.7)),this.changeLaserColor(new qs.Color3(.7,.7,.7))}},e.prototype._notifySelectedMeshUnselected=function(e){e&&this.onSelectedMeshUnselected.notifyObservers(e)},e.prototype.changeLaserColor=function(e){this._leftController&&this._leftController._setLaserPointerColor(e),this._rightController&&this._rightController._setLaserPointerColor(e)},e.prototype.changeGazeColor=function(e){this._cameraGazer._gazeTracker.material&&(this._cameraGazer._gazeTracker.material.emissiveColor=e,this._leftController&&(this._leftController._gazeTracker.material.emissiveColor=e),this._rightController&&(this._rightController._gazeTracker.material.emissiveColor=e))},e.prototype.dispose=function(){this.isInVRMode&&this.exitVR(),this._postProcessMove&&this._postProcessMove.dispose(),this._webVRCamera&&this._webVRCamera.dispose(),this._vrDeviceOrientationCamera&&this._vrDeviceOrientationCamera.dispose(),!this._useCustomVRButton&&this._btnVR.parentNode&&document.body.removeChild(this._btnVR),this._deviceOrientationCamera&&this._scene.activeCamera!=this._deviceOrientationCamera&&this._deviceOrientationCamera.dispose(),this._cameraGazer&&this._cameraGazer.dispose(),this._leftController&&this._leftController.dispose(),this._rightController&&this._rightController.dispose(),this._teleportationTarget&&this._teleportationTarget.dispose(),this._floorMeshesCollection=[],document.removeEventListener("keydown",this._onKeyDown),window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),window.removeEventListener("resize",this._onResize),document.removeEventListener("fullscreenchange",this._onFullscreenChange),document.removeEventListener("mozfullscreenchange",this._onFullscreenChange),document.removeEventListener("webkitfullscreenchange",this._onFullscreenChange),document.removeEventListener("msfullscreenchange",this._onFullscreenChange),document.onmsfullscreenchange=null,this._scene.getEngine().onVRDisplayChangedObservable.removeCallback(this._onVRDisplayChanged),this._scene.getEngine().onVRRequestPresentStart.removeCallback(this._onVRRequestPresentStart),this._scene.getEngine().onVRRequestPresentComplete.removeCallback(this._onVRRequestPresentComplete),window.removeEventListener("vrdisplaypresentchange",this._onVrDisplayPresentChange),this._scene.gamepadManager.onGamepadConnectedObservable.removeCallback(this._onNewGamepadConnected),this._scene.gamepadManager.onGamepadDisconnectedObservable.removeCallback(this._onNewGamepadDisconnected),this._scene.unregisterBeforeRender(this.beforeRender)},e.prototype.getClassName=function(){return"VRExperienceHelper"},e})(),qs.VRExperienceHelper=ta,(function(n){var o,e;(e=o=n.JoystickAxis||(n.JoystickAxis={}))[e.X=0]="X",e[e.Y=1]="Y",e[e.Z=2]="Z";var t=(function(){function r(e){var t=this;if(this._leftJoystick=!!e,r._globalJoystickIndex++,this._axisTargetedByLeftAndRight=o.X,this._axisTargetedByUpAndDown=o.Y,this.reverseLeftRight=!1,this.reverseUpDown=!1,this._touches=new n.StringDictionary,this.deltaPosition=n.Vector3.Zero(),this._joystickSensibility=25,this._inversedSensibility=1/(this._joystickSensibility/1e3),this._onResize=function(e){r.vjCanvasWidth=window.innerWidth,r.vjCanvasHeight=window.innerHeight,r.vjCanvas&&(r.vjCanvas.width=r.vjCanvasWidth,r.vjCanvas.height=r.vjCanvasHeight),r.halfWidth=r.vjCanvasWidth/2},!r.vjCanvas){window.addEventListener("resize",this._onResize,!1),r.vjCanvas=document.createElement("canvas"),r.vjCanvasWidth=window.innerWidth,r.vjCanvasHeight=window.innerHeight,r.vjCanvas.width=window.innerWidth,r.vjCanvas.height=window.innerHeight,r.vjCanvas.style.width="100%",r.vjCanvas.style.height="100%",r.vjCanvas.style.position="absolute",r.vjCanvas.style.backgroundColor="transparent",r.vjCanvas.style.top="0px",r.vjCanvas.style.left="0px",r.vjCanvas.style.zIndex="5",r.vjCanvas.style.msTouchAction="none",r.vjCanvas.setAttribute("touch-action","none");var i=r.vjCanvas.getContext("2d");if(!i)throw new Error("Unable to create canvas for virtual joystick");(r.vjCanvasContext=i).strokeStyle="#ffffff",r.vjCanvasContext.lineWidth=2,document.body.appendChild(r.vjCanvas)}r.halfWidth=r.vjCanvas.width/2,this.pressed=!1,this._joystickColor="cyan",this._joystickPointerID=-1,this._joystickPointerPos=new n.Vector2(0,0),this._joystickPreviousPointerPos=new n.Vector2(0,0),this._joystickPointerStartPos=new n.Vector2(0,0),this._deltaJoystickVector=new n.Vector2(0,0),this._onPointerDownHandlerRef=function(e){t._onPointerDown(e)},this._onPointerMoveHandlerRef=function(e){t._onPointerMove(e)},this._onPointerUpHandlerRef=function(e){t._onPointerUp(e)},r.vjCanvas.addEventListener("pointerdown",this._onPointerDownHandlerRef,!1),r.vjCanvas.addEventListener("pointermove",this._onPointerMoveHandlerRef,!1),r.vjCanvas.addEventListener("pointerup",this._onPointerUpHandlerRef,!1),r.vjCanvas.addEventListener("pointerout",this._onPointerUpHandlerRef,!1),r.vjCanvas.addEventListener("contextmenu",(function(e){e.preventDefault()}),!1),requestAnimationFrame((function(){t._drawVirtualJoystick()}))}return r.prototype.setJoystickSensibility=function(e){this._joystickSensibility=e,this._inversedSensibility=1/(this._joystickSensibility/1e3)},r.prototype._onPointerDown=function(e){e.preventDefault(),(!0===this._leftJoystick?e.clientX<r.halfWidth:e.clientX>r.halfWidth)&&this._joystickPointerID<0?(this._joystickPointerID=e.pointerId,this._joystickPointerStartPos.x=e.clientX,this._joystickPointerStartPos.y=e.clientY,this._joystickPointerPos=this._joystickPointerStartPos.clone(),this._joystickPreviousPointerPos=this._joystickPointerStartPos.clone(),this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this.pressed=!0,this._touches.add(e.pointerId.toString(),e)):r._globalJoystickIndex<2&&this._action&&(this._action(),this._touches.add(e.pointerId.toString(),{x:e.clientX,y:e.clientY,prevX:e.clientX,prevY:e.clientY}))},r.prototype._onPointerMove=function(e){if(this._joystickPointerID==e.pointerId){this._joystickPointerPos.x=e.clientX,this._joystickPointerPos.y=e.clientY,this._deltaJoystickVector=this._joystickPointerPos.clone(),this._deltaJoystickVector=this._deltaJoystickVector.subtract(this._joystickPointerStartPos);var t=(this.reverseLeftRight?-1:1)*this._deltaJoystickVector.x/this._inversedSensibility;switch(this._axisTargetedByLeftAndRight){case o.X:this.deltaPosition.x=Math.min(1,Math.max(-1,t));break;case o.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,t));break;case o.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,t))}var i=(this.reverseUpDown?1:-1)*this._deltaJoystickVector.y/this._inversedSensibility;switch(this._axisTargetedByUpAndDown){case o.X:this.deltaPosition.x=Math.min(1,Math.max(-1,i));break;case o.Y:this.deltaPosition.y=Math.min(1,Math.max(-1,i));break;case o.Z:this.deltaPosition.z=Math.min(1,Math.max(-1,i))}}else{var r=this._touches.get(e.pointerId.toString());r&&(r.x=e.clientX,r.y=e.clientY)}},r.prototype._onPointerUp=function(e){if(this._joystickPointerID==e.pointerId)r.vjCanvasContext.clearRect(this._joystickPointerStartPos.x-64,this._joystickPointerStartPos.y-64,128,128),r.vjCanvasContext.clearRect(this._joystickPreviousPointerPos.x-42,this._joystickPreviousPointerPos.y-42,84,84),this._joystickPointerID=-1,this.pressed=!1;else{var t=this._touches.get(e.pointerId.toString());t&&r.vjCanvasContext.clearRect(t.prevX-44,t.prevY-44,88,88)}this._deltaJoystickVector.x=0,this._deltaJoystickVector.y=0,this._touches.remove(e.pointerId.toString())},r.prototype.setJoystickColor=function(e){this._joystickColor=e},r.prototype.setActionOnTouch=function(e){this._action=e},r.prototype.setAxisForLeftRight=function(e){switch(e){case o.X:case o.Y:case o.Z:this._axisTargetedByLeftAndRight=e;break;default:this._axisTargetedByLeftAndRight=o.X}},r.prototype.setAxisForUpDown=function(e){switch(e){case o.X:case o.Y:case o.Z:this._axisTargetedByUpAndDown=e;break;default:this._axisTargetedByUpAndDown=o.Y}},r.prototype._drawVirtualJoystick=function(){var i=this;this.pressed&&this._touches.forEach((function(e,t){t.pointerId===i._joystickPointerID?(r.vjCanvasContext.clearRect(i._joystickPointerStartPos.x-64,i._joystickPointerStartPos.y-64,128,128),r.vjCanvasContext.clearRect(i._joystickPreviousPointerPos.x-42,i._joystickPreviousPointerPos.y-42,84,84),r.vjCanvasContext.beginPath(),r.vjCanvasContext.lineWidth=6,r.vjCanvasContext.strokeStyle=i._joystickColor,r.vjCanvasContext.arc(i._joystickPointerStartPos.x,i._joystickPointerStartPos.y,40,0,2*Math.PI,!0),r.vjCanvasContext.stroke(),r.vjCanvasContext.closePath(),r.vjCanvasContext.beginPath(),r.vjCanvasContext.strokeStyle=i._joystickColor,r.vjCanvasContext.lineWidth=2,r.vjCanvasContext.arc(i._joystickPointerStartPos.x,i._joystickPointerStartPos.y,60,0,2*Math.PI,!0),r.vjCanvasContext.stroke(),r.vjCanvasContext.closePath(),r.vjCanvasContext.beginPath(),r.vjCanvasContext.strokeStyle=i._joystickColor,r.vjCanvasContext.arc(i._joystickPointerPos.x,i._joystickPointerPos.y,40,0,2*Math.PI,!0),r.vjCanvasContext.stroke(),r.vjCanvasContext.closePath(),i._joystickPreviousPointerPos=i._joystickPointerPos.clone()):(r.vjCanvasContext.clearRect(t.prevX-44,t.prevY-44,88,88),r.vjCanvasContext.beginPath(),r.vjCanvasContext.fillStyle="white",r.vjCanvasContext.beginPath(),r.vjCanvasContext.strokeStyle="red",r.vjCanvasContext.lineWidth=6,r.vjCanvasContext.arc(t.x,t.y,40,0,2*Math.PI,!0),r.vjCanvasContext.stroke(),r.vjCanvasContext.closePath(),t.prevX=t.x,t.prevY=t.y)})),requestAnimationFrame((function(){i._drawVirtualJoystick()}))},r.prototype.releaseCanvas=function(){r.vjCanvas&&(r.vjCanvas.removeEventListener("pointerdown",this._onPointerDownHandlerRef),r.vjCanvas.removeEventListener("pointermove",this._onPointerMoveHandlerRef),r.vjCanvas.removeEventListener("pointerup",this._onPointerUpHandlerRef),r.vjCanvas.removeEventListener("pointerout",this._onPointerUpHandlerRef),window.removeEventListener("resize",this._onResize),document.body.removeChild(r.vjCanvas),r.vjCanvas=null)},r._globalJoystickIndex=0,r})();n.VirtualJoystick=t})($a||($a={})),(function(i){i.Node.AddNodeConstructor("VirtualJoysticksCamera",(function(e,t){return function(){return new r(e,i.Vector3.Zero(),t)}}));var r=(function(n){function e(e,t,i){var r=n.call(this,e,t,i)||this;return r.inputs.addVirtualJoystick(),r}return T(e,n),e.prototype.getClassName=function(){return"VirtualJoysticksCamera"},e})(i.FreeCamera);i.VirtualJoysticksCamera=r})($a||($a={})),ia=$a||($a={}),ra=(function(){function e(){}return e.prototype.getLeftJoystick=function(){return this._leftjoystick},e.prototype.getRightJoystick=function(){return this._rightjoystick},e.prototype.checkInputs=function(){if(this._leftjoystick){var e=this.camera,t=50*e._computeLocalCameraSpeed(),i=ia.Matrix.RotationYawPitchRoll(e.rotation.y,e.rotation.x,0),r=ia.Vector3.TransformCoordinates(new ia.Vector3(this._leftjoystick.deltaPosition.x*t,this._leftjoystick.deltaPosition.y*t,this._leftjoystick.deltaPosition.z*t),i);e.cameraDirection=e.cameraDirection.add(r),e.cameraRotation=e.cameraRotation.addVector3(this._rightjoystick.deltaPosition),this._leftjoystick.pressed||(this._leftjoystick.deltaPosition=this._leftjoystick.deltaPosition.scale(.9)),this._rightjoystick.pressed||(this._rightjoystick.deltaPosition=this._rightjoystick.deltaPosition.scale(.9))}},e.prototype.attachControl=function(e,t){this._leftjoystick=new ia.VirtualJoystick(!0),this._leftjoystick.setAxisForUpDown(ia.JoystickAxis.Z),this._leftjoystick.setAxisForLeftRight(ia.JoystickAxis.X),this._leftjoystick.setJoystickSensibility(.15),this._rightjoystick=new ia.VirtualJoystick(!1),this._rightjoystick.setAxisForUpDown(ia.JoystickAxis.X),this._rightjoystick.setAxisForLeftRight(ia.JoystickAxis.Y),this._rightjoystick.reverseUpDown=!0,this._rightjoystick.setJoystickSensibility(.05),this._rightjoystick.setJoystickColor("yellow")},e.prototype.detachControl=function(e){this._leftjoystick.releaseCanvas(),this._rightjoystick.releaseCanvas()},e.prototype.getClassName=function(){return"FreeCameraVirtualJoystickInput"},e.prototype.getSimpleName=function(){return"virtualJoystick"},e})(),ia.FreeCameraVirtualJoystickInput=ra,ia.CameraInputTypes.FreeCameraVirtualJoystickInput=ra,(function(b){var e=function(e,t,i){this.quality=e,this.distance=t,this.optimizeMesh=i};b.SimplificationSettings=e;var t,i,r=(function(){function e(){this.running=!1,this._simplificationArray=[]}return e.prototype.addTask=function(e){this._simplificationArray.push(e)},e.prototype.executeNext=function(){var e=this._simplificationArray.pop();e?(this.running=!0,this.runSimplification(e)):this.running=!1},e.prototype.runSimplification=function(r){var i=this;if(r.parallelProcessing)r.settings.forEach((function(t){i.getSimplifier(r).simplify(t,(function(e){r.mesh.addLODLevel(t.distance,e),e.isVisible=!0,t.quality===r.settings[r.settings.length-1].quality&&r.successCallback&&r.successCallback(),i.executeNext()}))}));else{var n=this.getSimplifier(r);b.AsyncLoop.Run(r.settings.length,(function(e){var t,i;t=r.settings[e.index],i=function(){e.executeNext()},n.simplify(t,(function(e){r.mesh.addLODLevel(t.distance,e),e.isVisible=!0,i()}))}),(function(){r.successCallback&&r.successCallback(),i.executeNext()}))}},e.prototype.getSimplifier=function(e){switch(e.simplificationType){case t.QUADRATIC:default:return new o(e.mesh)}},e})();b.SimplificationQueue=r,(i=t=b.SimplificationType||(b.SimplificationType={}))[i.QUADRATIC=0]="QUADRATIC";var f=function(e){this.vertices=e,this.error=new Array(4),this.deleted=!1,this.isDirty=!1,this.deletePending=!1,this.borderFactor=0},s=(function(){function e(e,t){this.position=e,this.id=t,this.isBorder=!0,this.q=new n,this.triangleCount=0,this.triangleStart=0,this.originalOffsets=[]}return e.prototype.updatePosition=function(e){this.position.copyFrom(e)},e})(),n=(function(){function n(e){this.data=new Array(10);for(var t=0;t<10;++t)e&&e[t]?this.data[t]=e[t]:this.data[t]=0}return n.prototype.det=function(e,t,i,r,n,o,s,a,l){return this.data[e]*this.data[n]*this.data[l]+this.data[i]*this.data[r]*this.data[a]+this.data[t]*this.data[o]*this.data[s]-this.data[i]*this.data[n]*this.data[s]-this.data[e]*this.data[o]*this.data[a]-this.data[t]*this.data[r]*this.data[l]},n.prototype.addInPlace=function(e){for(var t=0;t<10;++t)this.data[t]+=e.data[t]},n.prototype.addArrayInPlace=function(e){for(var t=0;t<10;++t)this.data[t]+=e[t]},n.prototype.add=function(e){for(var t=new n,i=0;i<10;++i)t.data[i]=this.data[i]+e.data[i];return t},n.FromData=function(e,t,i,r){return new n(n.DataFromNumbers(e,t,i,r))},n.DataFromNumbers=function(e,t,i,r){return[e*e,e*t,e*i,e*r,t*t,t*i,t*r,i*i,i*r,r*r]},n})(),l=function(e,t){this.vertexId=e,this.triangleId=t},o=(function(){function e(e){this._mesh=e,this.syncIterations=5e3,this.aggressiveness=7,this.decimationIterations=100,this.boundingBoxEpsilon=b.Epsilon}return e.prototype.simplify=function(t,e){var i=this;this.initDecimatedMesh(),b.AsyncLoop.Run(this._mesh.subMeshes.length,(function(e){i.initWithMesh(e.index,(function(){i.runDecimation(t,e.index,(function(){e.executeNext()}))}),t.optimizeMesh)}),(function(){setTimeout((function(){e(i._reconstructedMesh)}),0)}))},e.prototype.runDecimation=function(e,t,i){var v=this,r=~~(this.triangles.length*e.quality),y=0,n=this.triangles.length;b.AsyncLoop.Run(this.decimationIterations,(function(e){var t,i;n-y<=r?e.breakLoop():(t=e.index,i=function(){e.executeNext()},setTimeout((function(){t%5==0&&v.updateMesh(0===t);for(var e=0;e<v.triangles.length;++e)v.triangles[e].isDirty=!1;var g=1e-9*Math.pow(t+3,v.aggressiveness);b.AsyncLoop.SyncAsyncForLoop(v.triangles.length,v.syncIterations,(function(e){var t=~~((v.triangles.length/2+e)%v.triangles.length),i=v.triangles[t];if(i&&!(i.error[3]>g||i.deleted||i.isDirty))for(var r=0;r<3;++r)if(i.error[r]<g){var n=[],o=[],s=i.vertices[r],a=i.vertices[(r+1)%3];if(s.isBorder||a.isBorder)continue;var l=b.Vector3.Zero(),c=b.Vector3.Zero(),h=b.Vector2.Zero(),u=new b.Color4(0,0,0,1);v.calculateError(s,a,l,c,h,u);var d=new Array;if(v.isFlipped(s,a,l,n,i.borderFactor,d))continue;if(v.isFlipped(a,s,l,o,i.borderFactor,d))continue;if(n.indexOf(!0)<0||o.indexOf(!0)<0)continue;var f=new Array;if(d.forEach((function(e){-1===f.indexOf(e)&&(e.deletePending=!0,f.push(e))})),f.length%2!=0)continue;s.q=a.q.add(s.q),s.updatePosition(l);var p=v.references.length;y=v.updateTriangles(s,s,n,y),y=v.updateTriangles(s,a,o,y);var _=v.references.length-p;if(_<=s.triangleCount){if(_)for(var m=0;m<_;m++)v.references[s.triangleStart+m]=v.references[p+m]}else s.triangleStart=p;s.triangleCount=_;break}}),i,(function(){return n-y<=r}))}),0))}),(function(){setTimeout((function(){v.reconstructMesh(t),i()}),0)}))},e.prototype.initWithMesh=function(e,t,n){var c=this;this.vertices=[],this.triangles=[];var o=this._mesh.getVerticesData(b.VertexBuffer.PositionKind),h=this._mesh.getIndices(),u=this._mesh.subMeshes[e],d=[],i=u.verticesCount;b.AsyncLoop.SyncAsyncForLoop(i,this.syncIterations/4>>0,(function(e){if(o){var t=e+u.verticesStart,i=b.Vector3.FromArray(o,3*t),r=(function(e){if(n)for(var t=0;t<c.vertices.length;++t)if(c.vertices[t].position.equals(e))return c.vertices[t];return null})(i)||new s(i,c.vertices.length);r.originalOffsets.push(t),r.id===c.vertices.length&&c.vertices.push(r),d.push(r.id)}}),(function(){b.AsyncLoop.SyncAsyncForLoop(u.indexCount/3,c.syncIterations,(function(e){if(h){var t=3*(u.indexStart/3+e),i=h[t+0],r=h[t+1],n=h[t+2],o=c.vertices[d[i-u.verticesStart]],s=c.vertices[d[r-u.verticesStart]],a=c.vertices[d[n-u.verticesStart]],l=new f([o,s,a]);l.originalOffset=t,c.triangles.push(l)}}),(function(){c.init(t)}))}))},e.prototype.init=function(e){var r=this;b.AsyncLoop.SyncAsyncForLoop(this.triangles.length,this.syncIterations,(function(e){var t=r.triangles[e];t.normal=b.Vector3.Cross(t.vertices[1].position.subtract(t.vertices[0].position),t.vertices[2].position.subtract(t.vertices[0].position)).normalize();for(var i=0;i<3;i++)t.vertices[i].q.addArrayInPlace(n.DataFromNumbers(t.normal.x,t.normal.y,t.normal.z,-b.Vector3.Dot(t.normal,t.vertices[0].position)))}),(function(){b.AsyncLoop.SyncAsyncForLoop(r.triangles.length,r.syncIterations,(function(e){for(var t=r.triangles[e],i=0;i<3;++i)t.error[i]=r.calculateError(t.vertices[i],t.vertices[(i+1)%3]);t.error[3]=Math.min(t.error[0],t.error[1],t.error[2])}),(function(){e()}))}))},e.prototype.reconstructMesh=function(e){var t,r,i,n=[];for(t=0;t<this.vertices.length;++t)this.vertices[t].triangleCount=0;for(t=0;t<this.triangles.length;++t)if(!this.triangles[t].deleted){for(r=this.triangles[t],i=0;i<3;++i)r.vertices[i].triangleCount=1;n.push(r)}var o=this._reconstructedMesh.getVerticesData(b.VertexBuffer.PositionKind)||[],s=this._reconstructedMesh.getVerticesData(b.VertexBuffer.NormalKind)||[],a=this._reconstructedMesh.getVerticesData(b.VertexBuffer.UVKind)||[],l=this._reconstructedMesh.getVerticesData(b.VertexBuffer.ColorKind)||[],c=this._mesh.getVerticesData(b.VertexBuffer.NormalKind),h=this._mesh.getVerticesData(b.VertexBuffer.UVKind),u=this._mesh.getVerticesData(b.VertexBuffer.ColorKind),d=0;for(t=0;t<this.vertices.length;++t){var f=this.vertices[t];f.id=d,f.triangleCount&&f.originalOffsets.forEach((function(e){c&&(o.push(f.position.x),o.push(f.position.y),o.push(f.position.z),s.push(c[3*e]),s.push(c[3*e+1]),s.push(c[3*e+2]),h&&h.length?(a.push(h[2*e]),a.push(h[2*e+1])):u&&u.length&&(l.push(u[4*e]),l.push(u[4*e+1]),l.push(u[4*e+2]),l.push(u[4*e+3])),++d)}))}var p=this._reconstructedMesh.getTotalIndices(),_=this._reconstructedMesh.getTotalVertices(),m=this._reconstructedMesh.subMeshes;this._reconstructedMesh.subMeshes=[];var g=this._reconstructedMesh.getIndices(),v=this._mesh.getIndices();for(t=0;t<n.length;++t)r=n[t],[0,1,2].forEach((function(e){var t=v[r.originalOffset+e],i=r.vertices[e].originalOffsets.indexOf(t);i<0&&(i=0),g.push(r.vertices[e].id+i+_)}));this._reconstructedMesh.setIndices(g),this._reconstructedMesh.setVerticesData(b.VertexBuffer.PositionKind,o),this._reconstructedMesh.setVerticesData(b.VertexBuffer.NormalKind,s),0<a.length&&this._reconstructedMesh.setVerticesData(b.VertexBuffer.UVKind,a),0<l.length&&this._reconstructedMesh.setVerticesData(b.VertexBuffer.ColorKind,l);var y=this._mesh.subMeshes[e];0<e&&(this._reconstructedMesh.subMeshes=[],m.forEach((function(e){b.SubMesh.AddToMesh(e.materialIndex,e.verticesStart,e.verticesCount,e.indexStart,e.indexCount,e.getMesh())})),b.SubMesh.AddToMesh(y.materialIndex,_,d,p,3*n.length,this._reconstructedMesh))},e.prototype.initDecimatedMesh=function(){this._reconstructedMesh=new b.Mesh(this._mesh.name+"Decimated",this._mesh.getScene()),this._reconstructedMesh.material=this._mesh.material,this._reconstructedMesh.parent=this._mesh.parent,this._reconstructedMesh.isVisible=!1,this._reconstructedMesh.renderingGroupId=this._mesh.renderingGroupId},e.prototype.isFlipped=function(e,t,i,r,n,o){for(var s=0;s<e.triangleCount;++s){var a=this.triangles[this.references[e.triangleStart+s].triangleId];if(!a.deleted){var l=this.references[e.triangleStart+s].vertexId,c=a.vertices[(l+1)%3],h=a.vertices[(l+2)%3];if(c!==t&&h!==t){var u=c.position.subtract(i);u=u.normalize();var d=h.position.subtract(i);if(d=d.normalize(),.999<Math.abs(b.Vector3.Dot(u,d)))return!0;var f=b.Vector3.Cross(u,d).normalize();if(r[s]=!1,b.Vector3.Dot(f,a.normal)<.2)return!0}else r[s]=!0,o.push(a)}}return!1},e.prototype.updateTriangles=function(e,t,i,r){for(var n=r,o=0;o<t.triangleCount;++o){var s=this.references[t.triangleStart+o],a=this.triangles[s.triangleId];a.deleted||(i[o]&&a.deletePending?(a.deleted=!0,n++):(a.vertices[s.vertexId]=e,a.isDirty=!0,a.error[0]=this.calculateError(a.vertices[0],a.vertices[1])+a.borderFactor/2,a.error[1]=this.calculateError(a.vertices[1],a.vertices[2])+a.borderFactor/2,a.error[2]=this.calculateError(a.vertices[2],a.vertices[0])+a.borderFactor/2,a.error[3]=Math.min(a.error[0],a.error[1],a.error[2]),this.references.push(s)))}return n},e.prototype.identifyBorder=function(){for(var e=0;e<this.vertices.length;++e){var t,i=[],r=[],n=this.vertices[e];for(t=0;t<n.triangleCount;++t)for(var o=this.triangles[this.references[n.triangleStart+t].triangleId],s=0;s<3;s++){for(var a=0,l=o.vertices[s];a<i.length&&r[a]!==l.id;)++a;a===i.length?(i.push(1),r.push(l.id)):i[a]++}for(t=0;t<i.length;++t)1===i[t]?this.vertices[r[t]].isBorder=!0:this.vertices[r[t]].isBorder=!1}},e.prototype.updateMesh=function(e){var t,i,r,n;if(void 0===e&&(e=!1),!e){var o=[];for(t=0;t<this.triangles.length;++t)this.triangles[t].deleted||o.push(this.triangles[t]);this.triangles=o}for(t=0;t<this.vertices.length;++t)this.vertices[t].triangleCount=0,this.vertices[t].triangleStart=0;for(t=0;t<this.triangles.length;++t)for(i=this.triangles[t],r=0;r<3;++r)(n=i.vertices[r]).triangleCount++;var s=0;for(t=0;t<this.vertices.length;++t)this.vertices[t].triangleStart=s,s+=this.vertices[t].triangleCount,this.vertices[t].triangleCount=0;var a=new Array(3*this.triangles.length);for(t=0;t<this.triangles.length;++t)for(i=this.triangles[t],r=0;r<3;++r)a[(n=i.vertices[r]).triangleStart+n.triangleCount]=new l(r,t),n.triangleCount++;this.references=a,e&&this.identifyBorder()},e.prototype.vertexError=function(e,t){var i=t.x,r=t.y,n=t.z;return e.data[0]*i*i+2*e.data[1]*i*r+2*e.data[2]*i*n+2*e.data[3]*i+e.data[4]*r*r+2*e.data[5]*r*n+2*e.data[6]*r+e.data[7]*n*n+2*e.data[8]*n+e.data[9]},e.prototype.calculateError=function(e,t,i,r,n,o){var s=e.q.add(t.q),a=e.isBorder&&t.isBorder,l=0,c=s.det(0,1,2,1,4,5,2,5,7);if(0===c||a){var h=e.position.add(t.position).divide(new b.Vector3(2,2,2)),u=this.vertexError(s,e.position),d=this.vertexError(s,t.position),f=this.vertexError(s,h);(l=Math.min(u,d,f))===u?i&&i.copyFrom(e.position):l===d?i&&i.copyFrom(t.position):i&&i.copyFrom(h)}else i||(i=b.Vector3.Zero()),i.x=-1/c*s.det(1,2,3,4,5,6,5,7,8),i.y=1/c*s.det(0,2,3,1,5,6,2,7,8),i.z=-1/c*s.det(0,1,3,1,4,6,2,5,8),l=this.vertexError(s,i);return l},e})()})($a||($a={})),(function(n){Object.defineProperty(n.Scene.prototype,"simplificationQueue",{get:function(){if(!this._simplificationQueue){this._simplificationQueue=new n.SimplificationQueue;var e=this._getComponent(n.SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE);e||(e=new t(this),this._addComponent(e))}return this._simplificationQueue},set:function(e){this._simplificationQueue=e},enumerable:!0,configurable:!0}),n.Mesh.prototype.simplify=function(e,t,i,r){return void 0===t&&(t=!0),void 0===i&&(i=n.SimplificationType.QUADRATIC),this.getScene().simplificationQueue.addTask({settings:e,parallelProcessing:t,mesh:this,simplificationType:i,successCallback:r}),this};var t=(function(){function e(e){this.name=n.SceneComponentConstants.NAME_SIMPLIFICATIONQUEUE,this.scene=e}return e.prototype.register=function(){this.scene._beforeCameraUpdateStage.registerStep(n.SceneComponentConstants.STEP_BEFORECAMERAUPDATE_SIMPLIFICATIONQUEUE,this,this._beforeCameraUpdate)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype._beforeCameraUpdate=function(){this.scene._simplificationQueue&&!this.scene._simplificationQueue.running&&this.scene._simplificationQueue.executeNext()},e})();n.SimplicationQueueSceneComponent=t})($a||($a={})),na=function(e,t){this.distance=e,this.mesh=t},($a||($a={})).MeshLODLevel=na,(function(d){var e=(function(){function e(e){void 0===e&&(e=0),this.priority=e}return e.prototype.getDescription=function(){return""},e.prototype.apply=function(e,t){return!0},e})(),n=(function(n){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=1024),void 0===i&&(i=.5);var r=n.call(this,e)||this;return r.priority=e,r.maximumSize=t,r.step=i,r}return T(e,n),e.prototype.getDescription=function(){return"Reducing render target texture size to "+this.maximumSize},e.prototype.apply=function(e,t){for(var i=!0,r=0;r<e.textures.length;r++){var n=e.textures[r];if(n.canRescale&&!n.getContext){var o=n.getSize();Math.max(o.width,o.height)>this.maximumSize&&(n.scale(this.step),i=!1)}}return i},e})(d.SceneOptimization=e);d.TextureOptimization=n;var o=(function(n){function e(e,t,i){void 0===e&&(e=0),void 0===t&&(t=2),void 0===i&&(i=.25);var r=n.call(this,e)||this;return r.priority=e,r.maximumScale=t,r.step=i,r._currentScale=-1,r._directionOffset=1,r}return T(e,n),e.prototype.getDescription=function(){return"Setting hardware scaling level to "+this._currentScale},e.prototype.apply=function(e,t){return-1===this._currentScale&&(this._currentScale=e.getEngine().getHardwareScalingLevel(),this._currentScale>this.maximumScale&&(this._directionOffset=-1)),this._currentScale+=this._directionOffset*this.step,e.getEngine().setHardwareScalingLevel(this._currentScale),1===this._directionOffset?this._currentScale>=this.maximumScale:this._currentScale<=this.maximumScale},e})(e);d.HardwareScalingOptimization=o;var s=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.getDescription=function(){return"Turning shadows on/off"},t.prototype.apply=function(e,t){return e.shadowsEnabled=t.isInImprovementMode,!0},t})(e);d.ShadowsOptimization=s;var a=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.getDescription=function(){return"Turning post-processes on/off"},t.prototype.apply=function(e,t){return e.postProcessesEnabled=t.isInImprovementMode,!0},t})(e);d.PostProcessesOptimization=a;var l=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.getDescription=function(){return"Turning lens flares on/off"},t.prototype.apply=function(e,t){return e.lensFlaresEnabled=t.isInImprovementMode,!0},t})(e);d.LensFlaresOptimization=l;var c=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.getDescription=function(){return this.onGetDescription?this.onGetDescription():"Running user defined callback"},t.prototype.apply=function(e,t){return!this.onApply||this.onApply(e,t)},t})(e);d.CustomOptimization=c;var h=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.getDescription=function(){return"Turning particles on/off"},t.prototype.apply=function(e,t){return e.particlesEnabled=t.isInImprovementMode,!0},t})(e);d.ParticlesOptimization=h;var u=(function(e){function t(){return null!==e&&e.apply(this,arguments)||this}return T(t,e),t.prototype.getDescription=function(){return"Turning render targets off"},t.prototype.apply=function(e,t){return e.renderTargetsEnabled=t.isInImprovementMode,!0},t})(e);d.RenderTargetsOptimization=u;var f=(function(t){function u(){var e=null!==t&&t.apply(this,arguments)||this;return e._canBeMerged=function(e){if(!(e instanceof d.Mesh))return!1;var t=e;return!t.isDisposed()&&(!(!t.isVisible||!t.isEnabled())&&(!(0<t.instances.length)&&(!t.skeleton&&!t.hasLODLevels)))},e}return T(u,t),Object.defineProperty(u,"UpdateSelectionTree",{get:function(){return u._UpdateSelectionTree},set:function(e){u._UpdateSelectionTree=e},enumerable:!0,configurable:!0}),u.prototype.getDescription=function(){return"Merging similar meshes together"},u.prototype.apply=function(e,t,i){for(var r=e.meshes.slice(0),n=r.length,o=0;o<n;o++){var s=new Array,a=r[o];if(this._canBeMerged(a)){s.push(a);for(var l=o+1;l<n;l++){var c=r[l];this._canBeMerged(c)&&(c.material===a.material&&c.checkCollisions===a.checkCollisions&&(s.push(c),n--,r.splice(l,1),l--))}s.length<2||d.Mesh.MergeMeshes(s,void 0,!0)}}var h=e;return h.createOrUpdateSelectionOctree&&(null!=i?i&&h.createOrUpdateSelectionOctree():u.UpdateSelectionTree&&h.createOrUpdateSelectionOctree()),!0},u._UpdateSelectionTree=!1,u})(e);d.MergeMeshesOptimization=f;var p=(function(){function r(e,t){void 0===e&&(e=60),void 0===t&&(t=2e3),this.targetFrameRate=e,this.trackerDuration=t,this.optimizations=new Array}return r.prototype.addOptimization=function(e){return this.optimizations.push(e),this},r.prototype.addCustomOptimization=function(e,t,i){void 0===i&&(i=0);var r=new c(i);return r.onApply=e,r.onGetDescription=t,this.optimizations.push(r),this},r.LowDegradationAllowed=function(e){var t=new r(e),i=0;return t.addOptimization(new f(i)),t.addOptimization(new s(i)),t.addOptimization(new l(i)),i++,t.addOptimization(new a(i)),t.addOptimization(new h(i)),i++,t.addOptimization(new n(i,1024)),t},r.ModerateDegradationAllowed=function(e){var t=new r(e),i=0;return t.addOptimization(new f(i)),t.addOptimization(new s(i)),t.addOptimization(new l(i)),i++,t.addOptimization(new a(i)),t.addOptimization(new h(i)),i++,t.addOptimization(new n(i,512)),i++,t.addOptimization(new u(i)),i++,t.addOptimization(new o(i,2)),t},r.HighDegradationAllowed=function(e){var t=new r(e),i=0;return t.addOptimization(new f(i)),t.addOptimization(new s(i)),t.addOptimization(new l(i)),i++,t.addOptimization(new a(i)),t.addOptimization(new h(i)),i++,t.addOptimization(new n(i,256)),i++,t.addOptimization(new u(i)),i++,t.addOptimization(new o(i,4)),t},r})();d.SceneOptimizerOptions=p;var t=(function(){function o(e,t,i,r){void 0===i&&(i=!0),void 0===r&&(r=!1);var n=this;if(this._isRunning=!1,this._currentPriorityLevel=0,this._targetFrameRate=60,this._trackerDuration=2e3,this._currentFrameRate=0,this._improvementMode=!1,this.onSuccessObservable=new d.Observable,this.onNewOptimizationAppliedObservable=new d.Observable,this.onFailureObservable=new d.Observable,this._options=t||new p,this._options.targetFrameRate&&(this._targetFrameRate=this._options.targetFrameRate),this._options.trackerDuration&&(this._trackerDuration=this._options.trackerDuration),i)for(var o=0,s=0,a=this._options.optimizations;s<a.length;s++){a[s].priority=o++}this._improvementMode=r,this._scene=e||d.Engine.LastCreatedScene,this._sceneDisposeObserver=this._scene.onDisposeObservable.add((function(){n._sceneDisposeObserver=null,n.dispose()}))}return Object.defineProperty(o.prototype,"isInImprovementMode",{get:function(){return this._improvementMode},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"currentPriorityLevel",{get:function(){return this._currentPriorityLevel},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"currentFrameRate",{get:function(){return this._currentFrameRate},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"targetFrameRate",{get:function(){return this._targetFrameRate},set:function(e){this._targetFrameRate=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"trackerDuration",{get:function(){return this._trackerDuration},set:function(e){this._trackerDuration=e},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"optimizations",{get:function(){return this._options.optimizations},enumerable:!0,configurable:!0}),o.prototype.stop=function(){this._isRunning=!1},o.prototype.reset=function(){this._currentPriorityLevel=0},o.prototype.start=function(){var e=this;this._isRunning||(this._isRunning=!0,this._scene.executeWhenReady((function(){setTimeout((function(){e._checkCurrentState()}),e._trackerDuration)})))},o.prototype._checkCurrentState=function(){var e=this;if(this._isRunning){var t=this._scene,i=this._options;if(this._currentFrameRate=Math.round(t.getEngine().getFps()),this._improvementMode&&this._currentFrameRate<=this._targetFrameRate||!this._improvementMode&&this._currentFrameRate>=this._targetFrameRate)return this._isRunning=!1,void this.onSuccessObservable.notifyObservers(this);for(var r=!0,n=!0,o=0;o<i.optimizations.length;o++){var s=i.optimizations[o];s.priority===this._currentPriorityLevel&&(n=!1,r=r&&s.apply(t,this),this.onNewOptimizationAppliedObservable.notifyObservers(s))}if(n)return this._isRunning=!1,void this.onFailureObservable.notifyObservers(this);r&&this._currentPriorityLevel++,t.executeWhenReady((function(){setTimeout((function(){e._checkCurrentState()}),e._trackerDuration)}))}},o.prototype.dispose=function(){this.stop(),this.onSuccessObservable.clear(),this.onFailureObservable.clear(),this.onNewOptimizationAppliedObservable.clear(),this._sceneDisposeObserver&&this._scene.onDisposeObservable.remove(this._sceneDisposeObserver)},o.OptimizeAsync=function(e,t,i,r){var n=new o(e,t||p.ModerateDegradationAllowed(),!1);return i&&n.onSuccessObservable.add((function(){i()})),r&&n.onFailureObservable.add((function(){r()})),n.start(),n},o})();d.SceneOptimizer=t})($a||($a={})),(function(h){h.Scene.prototype.getOutlineRenderer=function(){return this._outlineRenderer||(this._outlineRenderer=new e(this)),this._outlineRenderer},Object.defineProperty(h.AbstractMesh.prototype,"renderOutline",{get:function(){return this._renderOutline},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOutline=e},enumerable:!0,configurable:!0}),Object.defineProperty(h.AbstractMesh.prototype,"renderOverlay",{get:function(){return this._renderOverlay},set:function(e){e&&this.getScene().getOutlineRenderer(),this._renderOverlay=e},enumerable:!0,configurable:!0});var e=(function(){function e(e){this.name=h.SceneComponentConstants.NAME_OUTLINERENDERER,this.zOffset=1,this.scene=e,this._engine=e.getEngine(),this.scene._addComponent(this)}return e.prototype.register=function(){this.scene._beforeRenderingMeshStage.registerStep(h.SceneComponentConstants.STEP_BEFORERENDERINGMESH_OUTLINE,this,this._beforeRenderingMesh),this.scene._afterRenderingMeshStage.registerStep(h.SceneComponentConstants.STEP_AFTERRENDERINGMESH_OUTLINE,this,this._afterRenderingMesh)},e.prototype.rebuild=function(){},e.prototype.dispose=function(){},e.prototype.render=function(e,t,i){var r=this;void 0===i&&(i=!1);var n=this.scene,o=n.getEngine(),s=o.getCaps().instancedArrays&&null!==t.visibleInstances[e._id]&&void 0!==t.visibleInstances[e._id];if(this.isReady(e,s)){var a=e.getRenderingMesh(),l=e.getMaterial();if(l&&n.activeCamera){if(o.enableEffect(this._effect),l.useLogarithmicDepth&&this._effect.setFloat("logarithmicDepthConstant",2/(Math.log(n.activeCamera.maxZ+1)/Math.LN2)),this._effect.setFloat("offset",i?0:a.outlineWidth),this._effect.setColor4("color",i?a.overlayColor:a.outlineColor,i?a.overlayAlpha:l.alpha),this._effect.setMatrix("viewProjection",n.getTransformMatrix()),a.useBones&&a.computeBonesUsingShaders&&a.skeleton&&this._effect.setMatrices("mBones",a.skeleton.getTransformMatrices(a)),a._bind(e,this._effect,h.Material.TriangleFillMode),l&&l.needAlphaTesting()){var c=l.getAlphaTestTexture();c&&(this._effect.setTexture("diffuseSampler",c),this._effect.setMatrix("diffuseMatrix",c.getTextureMatrix()))}o.setZOffset(-this.zOffset),a._processRendering(e,this._effect,h.Material.TriangleFillMode,t,s,(function(e,t){r._effect.setMatrix("world",t)})),o.setZOffset(0)}}},e.prototype.isReady=function(e,t){var i=[],r=[h.VertexBuffer.PositionKind,h.VertexBuffer.NormalKind],n=e.getMesh(),o=e.getMaterial();o&&(o.needAlphaTesting()&&(i.push("#define ALPHATEST"),n.isVerticesDataPresent(h.VertexBuffer.UVKind)&&(r.push(h.VertexBuffer.UVKind),i.push("#define UV1")),n.isVerticesDataPresent(h.VertexBuffer.UV2Kind)&&(r.push(h.VertexBuffer.UV2Kind),i.push("#define UV2"))),o.useLogarithmicDepth&&i.push("#define LOGARITHMICDEPTH")),n.useBones&&n.computeBonesUsingShaders?(r.push(h.VertexBuffer.MatricesIndicesKind),r.push(h.VertexBuffer.MatricesWeightsKind),4<n.numBoneInfluencers&&(r.push(h.VertexBuffer.MatricesIndicesExtraKind),r.push(h.VertexBuffer.MatricesWeightsExtraKind)),i.push("#define NUM_BONE_INFLUENCERS "+n.numBoneInfluencers),i.push("#define BonesPerMesh "+(n.skeleton?n.skeleton.bones.length+1:0))):i.push("#define NUM_BONE_INFLUENCERS 0"),t&&(i.push("#define INSTANCES"),r.push("world0"),r.push("world1"),r.push("world2"),r.push("world3"));var s=i.join("\n");return this._cachedDefines!==s&&(this._cachedDefines=s,this._effect=this.scene.getEngine().createEffect("outline",r,["world","mBones","viewProjection","diffuseMatrix","offset","color","logarithmicDepthConstant"],["diffuseSampler"],s)),this._effect.isReady()},e.prototype._beforeRenderingMesh=function(e,t,i){this._savedDepthWrite=this._engine.getDepthWrite(),e.renderOutline&&(this._engine.setDepthWrite(!1),this.render(t,i),this._engine.setDepthWrite(this._savedDepthWrite))},e.prototype._afterRenderingMesh=function(e,t,i){if(e.renderOutline&&this._savedDepthWrite&&(this._engine.setDepthWrite(!0),this._engine.setColorWrite(!1),this.render(t,i),this._engine.setColorWrite(!0)),e.renderOverlay){var r=this._engine.getAlphaMode();this._engine.setAlphaMode(h.Engine.ALPHA_COMBINE),this.render(t,i,!0),this._engine.setAlphaMode(r)}},e})();h.OutlineRenderer=e})($a||($a={})),(function(y){y.AbstractMesh.prototype.disableEdgesRendering=function(){return this._edgesRenderer&&(this._edgesRenderer.dispose(),this._edgesRenderer=null),this},y.AbstractMesh.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new i(this,e,t),this},Object.defineProperty(y.AbstractMesh.prototype,"edgesRenderer",{get:function(){return this._edgesRenderer},enumerable:!0,configurable:!0}),y.LinesMesh.prototype.enableEdgesRendering=function(e,t){return void 0===e&&(e=.95),void 0===t&&(t=!1),this.disableEdgesRendering(),this._edgesRenderer=new y.LineEdgesRenderer(this,e,t),this};var b=function(){this.edges=new Array,this.edgesConnectedCount=0},i=(function(){function e(e,t,i,r){void 0===t&&(t=.95),void 0===i&&(i=!1),void 0===r&&(r=!0);var n=this;this.edgesWidthScalerForOrthographic=1e3,this.edgesWidthScalerForPerspective=50,this._linesPositions=new Array,this._linesNormals=new Array,this._linesIndices=new Array,this._buffers={},this._checkVerticesInsteadOfIndices=!1,this.isEnabled=!0,this._source=e,this._checkVerticesInsteadOfIndices=i,this._epsilon=t,this._prepareRessources(),r&&this._generateEdgesLines(),this._meshRebuildObserver=this._source.onRebuildObservable.add((function(){n._rebuild()})),this._meshDisposeObserver=this._source.onDisposeObservable.add((function(){n.dispose()}))}return e.prototype._prepareRessources=function(){this._lineShader||(this._lineShader=new y.ShaderMaterial("lineShader",this._source.getScene(),"line",{attributes:["position","normal"],uniforms:["worldViewProjection","color","width","aspectRatio"]}),this._lineShader.disableDepthWrite=!0,this._lineShader.backFaceCulling=!1)},e.prototype._rebuild=function(){var e=this._buffers[y.VertexBuffer.PositionKind];e&&e._rebuild(),(e=this._buffers[y.VertexBuffer.NormalKind])&&e._rebuild();var t=this._source.getScene().getEngine();this._ib=t.createIndexBuffer(this._linesIndices)},e.prototype.dispose=function(){this._source.onRebuildObservable.remove(this._meshRebuildObserver),this._source.onDisposeObservable.remove(this._meshDisposeObserver);var e=this._buffers[y.VertexBuffer.PositionKind];e&&(e.dispose(),this._buffers[y.VertexBuffer.PositionKind]=null),(e=this._buffers[y.VertexBuffer.NormalKind])&&(e.dispose(),this._buffers[y.VertexBuffer.NormalKind]=null),this._source.getScene().getEngine()._releaseBuffer(this._ib),this._lineShader.dispose()},e.prototype._processEdgeForAdjacencies=function(e,t,i,r,n){return e===i&&t===r||e===r&&t===i?0:e===r&&t===n||e===n&&t===r?1:e===n&&t===i||e===i&&t===n?2:-1},e.prototype._processEdgeForAdjacenciesWithVertices=function(e,t,i,r,n){return e.equalsWithEpsilon(i)&&t.equalsWithEpsilon(r)||e.equalsWithEpsilon(r)&&t.equalsWithEpsilon(i)?0:e.equalsWithEpsilon(r)&&t.equalsWithEpsilon(n)||e.equalsWithEpsilon(n)&&t.equalsWithEpsilon(r)?1:e.equalsWithEpsilon(n)&&t.equalsWithEpsilon(i)||e.equalsWithEpsilon(i)&&t.equalsWithEpsilon(n)?2:-1},e.prototype._checkEdge=function(e,t,i,r,n){var o;void 0===t?o=!0:o=y.Vector3.Dot(i[e],i[t])<this._epsilon;if(o){var s=this._linesPositions.length/3;r.subtract(n).normalize(),this._linesPositions.push(r.x),this._linesPositions.push(r.y),this._linesPositions.push(r.z),this._linesPositions.push(r.x),this._linesPositions.push(r.y),this._linesPositions.push(r.z),this._linesPositions.push(n.x),this._linesPositions.push(n.y),this._linesPositions.push(n.z),this._linesPositions.push(n.x),this._linesPositions.push(n.y),this._linesPositions.push(n.z),this._linesNormals.push(n.x),this._linesNormals.push(n.y),this._linesNormals.push(n.z),this._linesNormals.push(-1),this._linesNormals.push(n.x),this._linesNormals.push(n.y),this._linesNormals.push(n.z),this._linesNormals.push(1),this._linesNormals.push(r.x),this._linesNormals.push(r.y),this._linesNormals.push(r.z),this._linesNormals.push(-1),this._linesNormals.push(r.x),this._linesNormals.push(r.y),this._linesNormals.push(r.z),this._linesNormals.push(1),this._linesIndices.push(s),this._linesIndices.push(s+1),this._linesIndices.push(s+2),this._linesIndices.push(s),this._linesIndices.push(s+2),this._linesIndices.push(s+3)}},e.prototype._generateEdgesLines=function(){var e=this._source.getVerticesData(y.VertexBuffer.PositionKind),t=this._source.getIndices();if(t&&e){var i,r,n=new Array,o=new Array;for(i=0;i<t.length;i+=3){r=new b;var s=t[i],a=t[i+1],l=t[i+2];r.p0=new y.Vector3(e[3*s],e[3*s+1],e[3*s+2]),r.p1=new y.Vector3(e[3*a],e[3*a+1],e[3*a+2]),r.p2=new y.Vector3(e[3*l],e[3*l+1],e[3*l+2]);var c=y.Vector3.Cross(r.p1.subtract(r.p0),r.p2.subtract(r.p1));c.normalize(),o.push(c),n.push(r)}for(i=0;i<n.length;i++){r=n[i];for(var h=i+1;h<n.length;h++){var u=n[h];if(3===r.edgesConnectedCount)break;if(3!==u.edgesConnectedCount)for(var d=t[3*h],f=t[3*h+1],p=t[3*h+2],_=0;_<3;_++){var m=0;if(void 0===r.edges[_]){switch(_){case 0:m=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(r.p0,r.p1,u.p0,u.p1,u.p2):this._processEdgeForAdjacencies(t[3*i],t[3*i+1],d,f,p);break;case 1:m=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(r.p1,r.p2,u.p0,u.p1,u.p2):this._processEdgeForAdjacencies(t[3*i+1],t[3*i+2],d,f,p);break;case 2:m=this._checkVerticesInsteadOfIndices?this._processEdgeForAdjacenciesWithVertices(r.p2,r.p0,u.p0,u.p1,u.p2):this._processEdgeForAdjacencies(t[3*i+2],t[3*i],d,f,p)}if(-1!==m&&(r.edges[_]=h,u.edges[m]=i,r.edgesConnectedCount++,u.edgesConnectedCount++,3===r.edgesConnectedCount))break}}}}for(i=0;i<n.length;i++){var g=n[i];this._checkEdge(i,g.edges[0],o,g.p0,g.p1),this._checkEdge(i,g.edges[1],o,g.p1,g.p2),this._checkEdge(i,g.edges[2],o,g.p2,g.p0)}var v=this._source.getScene().getEngine();this._buffers[y.VertexBuffer.PositionKind]=new y.VertexBuffer(v,this._linesPositions,y.VertexBuffer.PositionKind,!1),this._buffers[y.VertexBuffer.NormalKind]=new y.VertexBuffer(v,this._linesNormals,y.VertexBuffer.NormalKind,!1,!1,4),this._ib=v.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},e.prototype.isReady=function(){return this._lineShader.isReady()},e.prototype.render=function(){var e=this._source.getScene();if(this.isReady()&&e.activeCamera){var t=e.getEngine();this._lineShader._preBind(),1!==this._source.edgesColor.a?t.setAlphaMode(y.Engine.ALPHA_COMBINE):t.setAlphaMode(y.Engine.ALPHA_DISABLE),t.bindBuffers(this._buffers,this._ib,this._lineShader.getEffect()),e.resetCachedMaterial(),this._lineShader.setColor4("color",this._source.edgesColor),e.activeCamera.mode===y.Camera.ORTHOGRAPHIC_CAMERA?this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForOrthographic):this._lineShader.setFloat("width",this._source.edgesWidth/this.edgesWidthScalerForPerspective),this._lineShader.setFloat("aspectRatio",t.getAspectRatio(e.activeCamera)),this._lineShader.bind(this._source.getWorldMatrix()),t.drawElementsType(y.Material.TriangleFillMode,0,this._indicesCount),this._lineShader.unbind()}},e})();y.EdgesRenderer=i})($a||($a={})),oa=$a||($a={}),sa=function(){this.edges=new Array,this.edgesConnectedCount=0},aa=(function(n){function e(e,t,i){void 0===t&&(t=.95),void 0===i&&(i=!1);var r=n.call(this,e,t,i,!1)||this;return r._generateEdgesLines(),r}return T(e,n),e.prototype._checkEdge=function(e,t,i,r,n){var o=this._linesPositions.length/3;r.subtract(n).normalize(),this._linesPositions.push(r.x),this._linesPositions.push(r.y),this._linesPositions.push(r.z),this._linesPositions.push(r.x),this._linesPositions.push(r.y),this._linesPositions.push(r.z),this._linesPositions.push(n.x),this._linesPositions.push(n.y),this._linesPositions.push(n.z),this._linesPositions.push(n.x),this._linesPositions.push(n.y),this._linesPositions.push(n.z),this._linesNormals.push(n.x),this._linesNormals.push(n.y),this._linesNormals.push(n.z),this._linesNormals.push(-1),this._linesNormals.push(n.x),this._linesNormals.push(n.y),this._linesNormals.push(n.z),this._linesNormals.push(1),this._linesNormals.push(r.x),this._linesNormals.push(r.y),this._linesNormals.push(r.z),this._linesNormals.push(-1),this._linesNormals.push(r.x),this._linesNormals.push(r.y),this._linesNormals.push(r.z),this._linesNormals.push(1),this._linesIndices.push(o),this._linesIndices.push(o+1),this._linesIndices.push(o+2),this._linesIndices.push(o),this._linesIndices.push(o+2),this._linesIndices.push(o+3)},e.prototype._generateEdgesLines=function(){var e=this._source.getVerticesData(oa.VertexBuffer.PositionKind);if(this._source.getIndices()&&e){for(var t,i=new Array,r=new Array,n=0;n<e.length/3-1;n++){var o=new sa;o.p0=new oa.Vector3(e[3*n],e[3*n+1],e[3*n+2]),o.p1=new oa.Vector3(e[3*(n+1)],e[3*(n+1)+1],e[3*(n+1)+2]),i.push(o)}for(t=0;t<i.length;t++){var s=i[t];this._checkEdge(t,s.edges[0],r,s.p0,s.p1)}var a=this._source.getScene().getEngine();this._buffers[oa.VertexBuffer.PositionKind]=new oa.VertexBuffer(a,this._linesPositions,oa.VertexBuffer.PositionKind,!1),this._buffers[oa.VertexBuffer.NormalKind]=new oa.VertexBuffer(a,this._linesNormals,oa.VertexBuffer.NormalKind,!1,!1,4),this._ib=a.createIndexBuffer(this._linesIndices),this._indicesCount=this._linesIndices.length}},e})(oa.EdgesRenderer),oa.LineEdgesRenderer=aa,(function(s){s.AbstractScene.AddParser(s.SceneComponentConstants.NAME_EFFECTLAYER,(function(e,t,i,r){if(e.effectLayers){i.effectLayers||(i.effectLayers=new Array);for(var n=0;n<e.effectLayers.length;n++){var o=s.EffectLayer.Parse(e.effectLayers[n],t,r);i.effectLayers.push(o)}}})),s.AbstractScene.prototype.removeEffectLayer=function(e){var t=this.effectLayers.indexOf(e);return-1!==t&&this.effectLayers.splice(t,1),t},s.AbstractScene.prototype.addEffectLayer=function(e){this.effectLayers.push(e)};var e=(function(){function e(e){this.name=s.SceneComponentConstants.NAME_EFFECTLAYER,this._renderEffects=!1,this._needStencil=!1,this._previousStencilState=!1,this.scene=e,this._engine=e.getEngine(),e.effectLayers=new Array}return e.prototype.register=function(){this.scene._isReadyForMeshStage.registerStep(s.SceneComponentConstants.STEP_ISREADYFORMESH_EFFECTLAYER,this,this._isReadyForMesh),this.scene._cameraDrawRenderTargetStage.registerStep(s.SceneComponentConstants.STEP_CAMERADRAWRENDERTARGET_EFFECTLAYER,this,this._renderMainTexture),this.scene._beforeCameraDrawStage.registerStep(s.SceneComponentConstants.STEP_BEFORECAMERADRAW_EFFECTLAYER,this,this._setStencil),this.scene._afterRenderingGroupDrawStage.registerStep(s.SceneComponentConstants.STEP_AFTERRENDERINGGROUPDRAW_EFFECTLAYER_DRAW,this,this._drawRenderingGroup),this.scene._afterCameraDrawStage.registerStep(s.SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER,this,this._setStencilBack),this.scene._afterCameraDrawStage.registerStep(s.SceneComponentConstants.STEP_AFTERCAMERADRAW_EFFECTLAYER_DRAW,this,this._drawCamera)},e.prototype.rebuild=function(){for(var e=0,t=this.scene.effectLayers;e<t.length;e++){t[e]._rebuild()}},e.prototype.serialize=function(e){e.effectLayers=[];for(var t=0,i=this.scene.effectLayers;t<i.length;t++){var r=i[t];r.serialize&&e.effectLayers.push(r.serialize())}},e.prototype.addFromContainer=function(e){var t=this;e.effectLayers&&e.effectLayers.forEach((function(e){t.scene.addEffectLayer(e)}))},e.prototype.removeFromContainer=function(e){var t=this;e.effectLayers&&e.effectLayers.forEach((function(e){t.scene.removeEffectLayer(e)}))},e.prototype.dispose=function(){for(var e=this.scene.effectLayers;e.length;)e[0].dispose()},e.prototype._isReadyForMesh=function(e,t){for(var i=0,r=this.scene.effectLayers;i<r.length;i++){var n=r[i];if(n.hasMesh(e))for(var o=0,s=e.subMeshes;o<s.length;o++){var a=s[o];if(!n.isReady(a,t))return!1}}return!0},e.prototype._renderMainTexture=function(e){this._renderEffects=!1,this._needStencil=!1;var t=this.scene.effectLayers;if(t&&0<t.length){this._previousStencilState=this._engine.getStencilBuffer();for(var i=0,r=t;i<r.length;i++){var n=r[i];if(n.shouldRender()&&(!n.camera||n.camera.cameraRigMode===s.Camera.RIG_MODE_NONE&&e===n.camera||n.camera.cameraRigMode!==s.Camera.RIG_MODE_NONE&&-1<n.camera._rigCameras.indexOf(e))){this._renderEffects=!0,this._needStencil=this._needStencil||n.needStencil();var o=n._mainTexture;o._shouldRender()&&(this.scene.incrementRenderId(),o.render(!1,!1))}}this.scene.incrementRenderId()}},e.prototype._setStencil=function(e){this._needStencil&&this._engine.setStencilBuffer(!0)},e.prototype._setStencilBack=function(e){this._needStencil&&this._engine.setStencilBuffer(this._previousStencilState)},e.prototype._draw=function(e){if(this._renderEffects){this._engine.setDepthBuffer(!1);for(var t=this.scene.effectLayers,i=0;i<t.length;i++){var r=t[i];r.renderingGroupId===e&&r.shouldRender()&&r.render()}this._engine.setDepthBuffer(!0)}},e.prototype._drawCamera=function(e){this._renderEffects&&this._draw(-1)},e.prototype._drawRenderingGroup=function(e){!this.scene._isInIntermediateRendering()&&this._renderEffects&&this._draw(e)},e})();s.EffectLayerSceneComponent=e})($a||($a={}));var la,ca,ha,ua,da,fa,pa,_a,ma,ga,va,ya,ba,Ta,Ea,xa,Pa,Aa,Sa,Ma,Ra,Ca,Oa,Da,Ia,wa,La,Fa,Ba;ae=this&&this.__assign||function(){return(ae=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};la=$a||($a={}),ca=(function(){function e(e,t){this._vertexBuffers={},this._maxSize=0,this._mainTextureDesiredSize={width:0,height:0},this._shouldRender=!0,this._postProcesses=[],this._textures=[],this._emissiveTextureAndColor={texture:null,color:new la.Color4},this.neutralColor=new la.Color4,this.isEnabled=!0,this.onDisposeObservable=new la.Observable,this.onBeforeRenderMainTextureObservable=new la.Observable,this.onBeforeComposeObservable=new la.Observable,this.onAfterComposeObservable=new la.Observable,this.onSizeChangedObservable=new la.Observable,this.name=e,this._scene=t||la.Engine.LastCreatedScene;var i=this._scene._getComponent(la.SceneComponentConstants.NAME_EFFECTLAYER);i||(i=new la.EffectLayerSceneComponent(this._scene),this._scene._addComponent(i)),this._engine=this._scene.getEngine(),this._maxSize=this._engine.getCaps().maxTextureSize,this._scene.effectLayers.push(this),this._generateIndexBuffer(),this._genrateVertexBuffer()}return Object.defineProperty(e.prototype,"camera",{get:function(){return this._effectLayerOptions.camera},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderingGroupId",{get:function(){return this._effectLayerOptions.renderingGroupId},enumerable:!0,configurable:!0}),e.prototype._init=function(e){this._effectLayerOptions=ae({mainTextureRatio:.5,alphaBlendingMode:la.Engine.ALPHA_COMBINE,camera:null,renderingGroupId:-1},e),this._setMainTextureSize(),this._createMainTexture(),this._createTextureAndPostProcesses(),this._mergeEffect=this._createMergeEffect()},e.prototype._generateIndexBuffer=function(){var e=[];e.push(0),e.push(1),e.push(2),e.push(0),e.push(2),e.push(3),this._indexBuffer=this._engine.createIndexBuffer(e)},e.prototype._genrateVertexBuffer=function(){var e=[];e.push(1,1),e.push(-1,1),e.push(-1,-1),e.push(1,-1);var t=new la.VertexBuffer(this._engine,e,la.VertexBuffer.PositionKind,!1,!1,2);this._vertexBuffers[la.VertexBuffer.PositionKind]=t},e.prototype._setMainTextureSize=function(){this._effectLayerOptions.mainTextureFixedSize?(this._mainTextureDesiredSize.width=this._effectLayerOptions.mainTextureFixedSize,this._mainTextureDesiredSize.height=this._effectLayerOptions.mainTextureFixedSize):(this._mainTextureDesiredSize.width=this._engine.getRenderWidth()*this._effectLayerOptions.mainTextureRatio,this._mainTextureDesiredSize.height=this._engine.getRenderHeight()*this._effectLayerOptions.mainTextureRatio,this._mainTextureDesiredSize.width=this._engine.needPOTTextures?la.Tools.GetExponentOfTwo(this._mainTextureDesiredSize.width,this._maxSize):this._mainTextureDesiredSize.width,this._mainTextureDesiredSize.height=this._engine.needPOTTextures?la.Tools.GetExponentOfTwo(this._mainTextureDesiredSize.height,this._maxSize):this._mainTextureDesiredSize.height),this._mainTextureDesiredSize.width=Math.floor(this._mainTextureDesiredSize.width),this._mainTextureDesiredSize.height=Math.floor(this._mainTextureDesiredSize.height)},e.prototype._createMainTexture=function(){var s=this;this._mainTexture=new la.RenderTargetTexture("HighlightLayerMainRTT",{width:this._mainTextureDesiredSize.width,height:this._mainTextureDesiredSize.height},this._scene,!1,!0,la.Engine.TEXTURETYPE_UNSIGNED_INT),this._mainTexture.activeCamera=this._effectLayerOptions.camera,this._mainTexture.wrapU=la.Texture.CLAMP_ADDRESSMODE,this._mainTexture.wrapV=la.Texture.CLAMP_ADDRESSMODE,this._mainTexture.anisotropicFilteringLevel=1,this._mainTexture.updateSamplingMode(la.Texture.BILINEAR_SAMPLINGMODE),this._mainTexture.renderParticles=!1,this._mainTexture.renderList=null,this._mainTexture.ignoreCameraViewport=!0,this._mainTexture.customRenderFunction=function(e,t,i,r){var n;s.onBeforeRenderMainTextureObservable.notifyObservers(s);var o=s._scene.getEngine();if(r.length){for(o.setColorWrite(!1),n=0;n<r.length;n++)s._renderSubMesh(r.data[n]);o.setColorWrite(!0)}for(n=0;n<e.length;n++)s._renderSubMesh(e.data[n]);for(n=0;n<t.length;n++)s._renderSubMesh(t.data[n]);for(n=0;n<i.length;n++)s._renderSubMesh(i.data[n])},this._mainTexture.onClearObservable.add((function(e){e.clear(s.neutralColor,!0,!0,!0)}))},e.prototype._isReady=function(e,t,i){var r=e.getMaterial();if(!r)return!1;if(!r.isReady(e.getMesh(),t))return!1;var n=[],o=[la.VertexBuffer.PositionKind],s=e.getMesh(),a=!1,l=!1;if(r&&r.needAlphaTesting()){var c=r.getAlphaTestTexture();c&&(n.push("#define ALPHATEST"),s.isVerticesDataPresent(la.VertexBuffer.UV2Kind)&&1===c.coordinatesIndex?(n.push("#define DIFFUSEUV2"),l=!0):s.isVerticesDataPresent(la.VertexBuffer.UVKind)&&(n.push("#define DIFFUSEUV1"),a=!0))}i&&(n.push("#define EMISSIVE"),s.isVerticesDataPresent(la.VertexBuffer.UV2Kind)&&1===i.coordinatesIndex?(n.push("#define EMISSIVEUV2"),l=!0):s.isVerticesDataPresent(la.VertexBuffer.UVKind)&&(n.push("#define EMISSIVEUV1"),a=!0)),a&&(o.push(la.VertexBuffer.UVKind),n.push("#define UV1")),l&&(o.push(la.VertexBuffer.UV2Kind),n.push("#define UV2")),s.useBones&&s.computeBonesUsingShaders?(o.push(la.VertexBuffer.MatricesIndicesKind),o.push(la.VertexBuffer.MatricesWeightsKind),4<s.numBoneInfluencers&&(o.push(la.VertexBuffer.MatricesIndicesExtraKind),o.push(la.VertexBuffer.MatricesWeightsExtraKind)),n.push("#define NUM_BONE_INFLUENCERS "+s.numBoneInfluencers),n.push("#define BonesPerMesh "+(s.skeleton?s.skeleton.bones.length+1:0))):n.push("#define NUM_BONE_INFLUENCERS 0");var h=s.morphTargetManager,u=0;h&&0<h.numInfluencers&&(n.push("#define MORPHTARGETS"),u=h.numInfluencers,n.push("#define NUM_MORPH_INFLUENCERS "+u),la.MaterialHelper.PrepareAttributesForMorphTargets(o,s,{NUM_MORPH_INFLUENCERS:u})),t&&(n.push("#define INSTANCES"),o.push("world0"),o.push("world1"),o.push("world2"),o.push("world3"));var d=n.join("\n");return this._cachedDefines!==d&&(this._cachedDefines=d,this._effectLayerMapGenerationEffect=this._scene.getEngine().createEffect("glowMapGeneration",o,["world","mBones","viewProjection","diffuseMatrix","color","emissiveMatrix","morphTargetInfluences"],["diffuseSampler","emissiveSampler"],d,void 0,void 0,void 0,{maxSimultaneousMorphTargets:u})),this._effectLayerMapGenerationEffect.isReady()},e.prototype.render=function(){var e=this._mergeEffect;if(e.isReady()){for(var t=0;t<this._postProcesses.length;t++)if(!this._postProcesses[t].isReady())return;var i=this._scene.getEngine();this.onBeforeComposeObservable.notifyObservers(this),i.enableEffect(e),i.setState(!1),i.bindBuffers(this._vertexBuffers,this._indexBuffer,e);var r=i.getAlphaMode();i.setAlphaMode(this._effectLayerOptions.alphaBlendingMode),this._internalRender(e),i.setAlphaMode(r),this.onAfterComposeObservable.notifyObservers(this);var n=this._mainTexture.getSize();this._setMainTextureSize(),n.width===this._mainTextureDesiredSize.width&&n.height===this._mainTextureDesiredSize.height||(this.onSizeChangedObservable.notifyObservers(this),this._disposeTextureAndPostProcesses(),this._createMainTexture(),this._createTextureAndPostProcesses())}},e.prototype.hasMesh=function(e){return-1===this.renderingGroupId||e.renderingGroupId===this.renderingGroupId},e.prototype.shouldRender=function(){return this.isEnabled&&this._shouldRender},e.prototype._shouldRenderMesh=function(e){return!0},e.prototype._shouldRenderEmissiveTextureForMesh=function(e){return!0},e.prototype._renderSubMesh=function(e){var i=this;if(this.shouldRender()){var t=e.getMaterial(),r=e.getRenderingMesh(),n=this._scene,o=n.getEngine();if(t&&!t.needAlphaBlendingForMesh(r)){o.setState(t.backFaceCulling);var s=r._getInstancesRenderList(e._id);if(!s.mustReturn&&this._shouldRenderMesh(r)){var a=o.getCaps().instancedArrays&&null!==s.visibleInstances[e._id]&&void 0!==s.visibleInstances[e._id];if(this._setEmissiveTextureAndColor(r,e,t),this._isReady(e,a,this._emissiveTextureAndColor.texture)){if(o.enableEffect(this._effectLayerMapGenerationEffect),r._bind(e,this._effectLayerMapGenerationEffect,la.Material.TriangleFillMode),this._effectLayerMapGenerationEffect.setMatrix("viewProjection",n.getTransformMatrix()),this._effectLayerMapGenerationEffect.setFloat4("color",this._emissiveTextureAndColor.color.r,this._emissiveTextureAndColor.color.g,this._emissiveTextureAndColor.color.b,this._emissiveTextureAndColor.color.a),t&&t.needAlphaTesting()){var l=t.getAlphaTestTexture();if(l){this._effectLayerMapGenerationEffect.setTexture("diffuseSampler",l);var c=l.getTextureMatrix();c&&this._effectLayerMapGenerationEffect.setMatrix("diffuseMatrix",c)}}this._emissiveTextureAndColor.texture&&(this._effectLayerMapGenerationEffect.setTexture("emissiveSampler",this._emissiveTextureAndColor.texture),this._effectLayerMapGenerationEffect.setMatrix("emissiveMatrix",this._emissiveTextureAndColor.texture.getTextureMatrix())),r.useBones&&r.computeBonesUsingShaders&&r.skeleton&&this._effectLayerMapGenerationEffect.setMatrices("mBones",r.skeleton.getTransformMatrices(r)),la.MaterialHelper.BindMorphTargetParameters(r,this._effectLayerMapGenerationEffect),r._processRendering(e,this._effectLayerMapGenerationEffect,la.Material.TriangleFillMode,s,a,(function(e,t){return i._effectLayerMapGenerationEffect.setMatrix("world",t)}))}else this._mainTexture.resetRefreshCounter()}}}},e.prototype._rebuild=function(){var e=this._vertexBuffers[la.VertexBuffer.PositionKind];e&&e._rebuild(),this._generateIndexBuffer()},e.prototype._disposeTextureAndPostProcesses=function(){this._mainTexture.dispose();for(var e=0;e<this._postProcesses.length;e++)this._postProcesses[e]&&this._postProcesses[e].dispose();this._postProcesses=[];for(e=0;e<this._textures.length;e++)this._textures[e]&&this._textures[e].dispose();this._textures=[]},e.prototype.dispose=function(){var e=this._vertexBuffers[la.VertexBuffer.PositionKind];e&&(e.dispose(),this._vertexBuffers[la.VertexBuffer.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this._disposeTextureAndPostProcesses();var t=this._scene.effectLayers.indexOf(this,0);-1<t&&this._scene.effectLayers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onBeforeRenderMainTextureObservable.clear(),this.onBeforeComposeObservable.clear(),this.onAfterComposeObservable.clear(),this.onSizeChangedObservable.clear()},e.prototype.getClassName=function(){return"EffectLayer"},e.Parse=function(e,t,i){return la.Tools.Instantiate(e.customType).Parse(e,t,i)},b([la.serialize()],e.prototype,"name",void 0),b([la.serializeAsColor4()],e.prototype,"neutralColor",void 0),b([la.serialize()],e.prototype,"isEnabled",void 0),b([la.serializeAsCameraReference()],e.prototype,"camera",null),b([la.serialize()],e.prototype,"renderingGroupId",null),e})(),la.EffectLayer=ca,(function(h){h.AbstractScene.prototype.getHighlightLayerByName=function(e){for(var t=0;t<this.effectLayers.length;t++)if(this.effectLayers[t].name===e&&this.effectLayers[t].getEffectName()===i.EffectName)return this.effectLayers[t];return null};var n=(function(c){function e(e,t,i,r,n,o,s,a){void 0===o&&(o=h.Texture.BILINEAR_SAMPLINGMODE);var l=c.call(this,e,"glowBlurPostProcess",["screenSize","direction","blurWidth"],null,r,n,o,s,a)||this;return l.direction=t,l.kernel=i,l.onApplyObservable.add((function(e){e.setFloat2("screenSize",l.width,l.height),e.setVector2("direction",l.direction),e.setFloat("blurWidth",l.kernel)})),l}return T(e,c),e})(h.PostProcess),i=(function(s){function a(e,t,i){var r=s.call(this,e,t)||this;return r.name=e,r.innerGlow=!0,r.outerGlow=!0,r.onBeforeBlurObservable=new h.Observable,r.onAfterBlurObservable=new h.Observable,r._instanceGlowingMeshStencilReference=a.GlowingMeshStencilReference++,r._meshes={},r._excludedMeshes={},r.neutralColor=a.NeutralColor,r._engine.isStencilEnable||h.Tools.Warn("Rendering the Highlight Layer requires the stencil to be active on the canvas. var engine = new BABYLON.Engine(canvas, antialias, { stencil: true }"),r._options=ae({mainTextureRatio:.5,blurTextureSizeRatio:.5,blurHorizontalSize:1,blurVerticalSize:1,alphaBlendingMode:h.Engine.ALPHA_COMBINE,camera:null,renderingGroupId:-1},i),r._init({alphaBlendingMode:r._options.alphaBlendingMode,camera:r._options.camera,mainTextureFixedSize:r._options.mainTextureFixedSize,mainTextureRatio:r._options.mainTextureRatio,renderingGroupId:r._options.renderingGroupId}),r._shouldRender=!1,r}return T(a,s),Object.defineProperty(a.prototype,"blurHorizontalSize",{get:function(){return this._horizontalBlurPostprocess.kernel},set:function(e){this._horizontalBlurPostprocess.kernel=e},enumerable:!0,configurable:!0}),Object.defineProperty(a.prototype,"blurVerticalSize",{get:function(){return this._verticalBlurPostprocess.kernel},set:function(e){this._verticalBlurPostprocess.kernel=e},enumerable:!0,configurable:!0}),a.prototype.getEffectName=function(){return a.EffectName},a.prototype._createMergeEffect=function(){return this._engine.createEffect("glowMapMerge",[h.VertexBuffer.PositionKind],["offset"],["textureSampler"],this._options.isStroke?"#define STROKE \n":void 0)},a.prototype._createTextureAndPostProcesses=function(){var t=this,i=this._mainTextureDesiredSize.width*this._options.blurTextureSizeRatio,r=this._mainTextureDesiredSize.height*this._options.blurTextureSizeRatio;i=this._engine.needPOTTextures?h.Tools.GetExponentOfTwo(i,this._maxSize):i,r=this._engine.needPOTTextures?h.Tools.GetExponentOfTwo(r,this._maxSize):r;var e=0;e=this._engine.getCaps().textureHalfFloatRender?h.Engine.TEXTURETYPE_HALF_FLOAT:h.Engine.TEXTURETYPE_UNSIGNED_INT,this._blurTexture=new h.RenderTargetTexture("HighlightLayerBlurRTT",{width:i,height:r},this._scene,!1,!0,e),this._blurTexture.wrapU=h.Texture.CLAMP_ADDRESSMODE,this._blurTexture.wrapV=h.Texture.CLAMP_ADDRESSMODE,this._blurTexture.anisotropicFilteringLevel=16,this._blurTexture.updateSamplingMode(h.Texture.TRILINEAR_SAMPLINGMODE),this._blurTexture.renderParticles=!1,this._blurTexture.ignoreCameraViewport=!0,this._textures=[this._blurTexture],this._options.alphaBlendingMode===h.Engine.ALPHA_COMBINE?(this._downSamplePostprocess=new h.PassPostProcess("HighlightLayerPPP",this._options.blurTextureSizeRatio,null,h.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._downSamplePostprocess.onApplyObservable.add((function(e){e.setTexture("textureSampler",t._mainTexture)})),this._horizontalBlurPostprocess=new n("HighlightLayerHBP",new h.Vector2(1,0),this._options.blurHorizontalSize,1,null,h.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._horizontalBlurPostprocess.onApplyObservable.add((function(e){e.setFloat2("screenSize",i,r)})),this._verticalBlurPostprocess=new n("HighlightLayerVBP",new h.Vector2(0,1),this._options.blurVerticalSize,1,null,h.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine()),this._verticalBlurPostprocess.onApplyObservable.add((function(e){e.setFloat2("screenSize",i,r)})),this._postProcesses=[this._downSamplePostprocess,this._horizontalBlurPostprocess,this._verticalBlurPostprocess]):(this._horizontalBlurPostprocess=new h.BlurPostProcess("HighlightLayerHBP",new h.Vector2(1,0),this._options.blurHorizontalSize/2,{width:i,height:r},null,h.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,e),this._horizontalBlurPostprocess.width=i,this._horizontalBlurPostprocess.height=r,this._horizontalBlurPostprocess.onApplyObservable.add((function(e){e.setTexture("textureSampler",t._mainTexture)})),this._verticalBlurPostprocess=new h.BlurPostProcess("HighlightLayerVBP",new h.Vector2(0,1),this._options.blurVerticalSize/2,{width:i,height:r},null,h.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,e),this._postProcesses=[this._horizontalBlurPostprocess,this._verticalBlurPostprocess]),this._mainTexture.onAfterUnbindObservable.add((function(){t.onBeforeBlurObservable.notifyObservers(t);var e=t._blurTexture.getInternalTexture();e&&t._scene.postProcessManager.directRender(t._postProcesses,e,!0),t.onAfterBlurObservable.notifyObservers(t)})),this._postProcesses.map((function(e){e.autoClear=!1}))},a.prototype.needStencil=function(){return!0},a.prototype.isReady=function(e,t){var i=e.getMaterial(),r=e.getRenderingMesh();if(!i||!r||!this._meshes)return!1;var n=null,o=this._meshes[r.uniqueId];return o&&o.glowEmissiveOnly&&i&&(n=i.emissiveTexture),s.prototype._isReady.call(this,e,t,n)},a.prototype._internalRender=function(e){e.setTexture("textureSampler",this._blurTexture);var t=this._engine,i=t.getStencilBuffer(),r=t.getStencilFunction(),n=t.getStencilMask(),o=t.getStencilOperationPass(),s=t.getStencilOperationFail(),a=t.getStencilOperationDepthFail(),l=t.getStencilFunctionReference();t.setStencilOperationPass(h.Engine.REPLACE),t.setStencilOperationFail(h.Engine.KEEP),t.setStencilOperationDepthFail(h.Engine.KEEP),t.setStencilMask(0),t.setStencilBuffer(!0),t.setStencilFunctionReference(this._instanceGlowingMeshStencilReference),this.outerGlow&&(e.setFloat("offset",0),t.setStencilFunction(h.Engine.NOTEQUAL),t.drawElementsType(h.Material.TriangleFillMode,0,6)),this.innerGlow&&(e.setFloat("offset",1),t.setStencilFunction(h.Engine.EQUAL),t.drawElementsType(h.Material.TriangleFillMode,0,6)),t.setStencilFunction(r),t.setStencilMask(n),t.setStencilBuffer(i),t.setStencilOperationPass(o),t.setStencilOperationFail(s),t.setStencilOperationDepthFail(a),t.setStencilFunctionReference(l)},a.prototype.shouldRender=function(){return!!s.prototype.shouldRender.call(this)&&!!this._meshes},a.prototype._shouldRenderMesh=function(e){return(!this._excludedMeshes||!this._excludedMeshes[e.uniqueId])&&!!s.prototype.hasMesh.call(this,e)},a.prototype._setEmissiveTextureAndColor=function(e,t,i){var r=this._meshes[e.uniqueId];r?this._emissiveTextureAndColor.color.set(r.color.r,r.color.g,r.color.b,1):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a),r&&r.glowEmissiveOnly&&i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.color.set(1,1,1,1)):this._emissiveTextureAndColor.texture=null},a.prototype.addExcludedMesh=function(e){this._excludedMeshes&&(this._excludedMeshes[e.uniqueId]||(this._excludedMeshes[e.uniqueId]={mesh:e,beforeRender:e.onBeforeRenderObservable.add((function(e){e.getEngine().setStencilBuffer(!1)})),afterRender:e.onAfterRenderObservable.add((function(e){e.getEngine().setStencilBuffer(!0)}))}))},a.prototype.removeExcludedMesh=function(e){if(this._excludedMeshes){var t=this._excludedMeshes[e.uniqueId];t&&(t.beforeRender&&e.onBeforeRenderObservable.remove(t.beforeRender),t.afterRender&&e.onAfterRenderObservable.remove(t.afterRender)),this._excludedMeshes[e.uniqueId]=null}},a.prototype.hasMesh=function(e){return!!this._meshes&&(!!s.prototype.hasMesh.call(this,e)&&(void 0!==this._meshes[e.uniqueId]&&null!==this._meshes[e.uniqueId]))},a.prototype.addMesh=function(e,t,i){var r=this;if(void 0===i&&(i=!1),this._meshes){var n=this._meshes[e.uniqueId];n?n.color=t:(this._meshes[e.uniqueId]={mesh:e,color:t,observerHighlight:e.onBeforeRenderObservable.add((function(e){r._excludedMeshes&&r._excludedMeshes[e.uniqueId]?r._defaultStencilReference(e):e.getScene().getEngine().setStencilFunctionReference(r._instanceGlowingMeshStencilReference)})),observerDefault:e.onAfterRenderObservable.add(this._defaultStencilReference),glowEmissiveOnly:i},e.onDisposeObservable.add((function(){r._disposeMesh(e)}))),this._shouldRender=!0}},a.prototype.removeMesh=function(e){if(this._meshes){var t=this._meshes[e.uniqueId];for(var i in t&&(t.observerHighlight&&e.onBeforeRenderObservable.remove(t.observerHighlight),t.observerDefault&&e.onAfterRenderObservable.remove(t.observerDefault),delete this._meshes[e.uniqueId]),this._shouldRender=!1,this._meshes)if(this._meshes[i]){this._shouldRender=!0;break}}},a.prototype._defaultStencilReference=function(e){e.getScene().getEngine().setStencilFunctionReference(a.NormalMeshStencilReference)},a.prototype._disposeMesh=function(e){this.removeMesh(e),this.removeExcludedMesh(e)},a.prototype.dispose=function(){if(this._meshes){for(var e in this._meshes){(t=this._meshes[e])&&t.mesh&&(t.observerHighlight&&t.mesh.onBeforeRenderObservable.remove(t.observerHighlight),t.observerDefault&&t.mesh.onAfterRenderObservable.remove(t.observerDefault))}this._meshes=null}if(this._excludedMeshes){for(var e in this._excludedMeshes){var t;(t=this._excludedMeshes[e])&&(t.beforeRender&&t.mesh.onBeforeRenderObservable.remove(t.beforeRender),t.afterRender&&t.mesh.onAfterRenderObservable.remove(t.afterRender))}this._excludedMeshes=null}s.prototype.dispose.call(this)},a.prototype.getClassName=function(){return"HighlightLayer"},a.prototype.serialize=function(){var e=h.SerializationHelper.Serialize(this);if(e.customType="BABYLON.HighlightLayer",e.meshes=[],this._meshes)for(var t in this._meshes){var i=this._meshes[t];i&&e.meshes.push({glowEmissiveOnly:i.glowEmissiveOnly,color:i.color.asArray(),meshId:i.mesh.id})}if(e.excludedMeshes=[],this._excludedMeshes)for(var r in this._excludedMeshes){var n=this._excludedMeshes[r];n&&e.excludedMeshes.push(n.mesh.id)}return e},a.Parse=function(e,t,i){var r,n=h.SerializationHelper.Parse((function(){return new a(e.name,t,e.options)}),e,t,i);for(r=0;r<e.excludedMeshes.length;r++){(o=t.getMeshByID(e.excludedMeshes[r]))&&n.addExcludedMesh(o)}for(r=0;r<e.meshes.length;r++){var o,s=e.meshes[r];(o=t.getMeshByID(s.meshId))&&n.addMesh(o,h.Color3.FromArray(s.color),s.glowEmissiveOnly)}return n},a.EffectName="HighlightLayer",a.NeutralColor=new h.Color4(0,0,0,0),a.GlowingMeshStencilReference=2,a.NormalMeshStencilReference=1,b([h.serialize()],a.prototype,"innerGlow",void 0),b([h.serialize()],a.prototype,"outerGlow",void 0),b([h.serialize()],a.prototype,"blurHorizontalSize",null),b([h.serialize()],a.prototype,"blurVerticalSize",null),b([h.serialize("options")],a.prototype,"_options",void 0),a})(h.EffectLayer);h.HighlightLayer=i})($a||($a={})),(function(a){a.AbstractScene.prototype.getGlowLayerByName=function(e){for(var t=0;t<this.effectLayers.length;t++)if(this.effectLayers[t].name===e&&this.effectLayers[t].getEffectName()===i.EffectName)return this.effectLayers[t];return null};var i=(function(o){function s(e,t,i){var r=o.call(this,e,t)||this;return r._intensity=1,r._includedOnlyMeshes=[],r._excludedMeshes=[],r.neutralColor=new a.Color4(0,0,0,1),r._options=ae({mainTextureRatio:s.DefaultTextureRatio,blurKernelSize:32,mainTextureFixedSize:void 0,camera:null,mainTextureSamples:1,renderingGroupId:-1},i),r._init({alphaBlendingMode:a.Engine.ALPHA_ADD,camera:r._options.camera,mainTextureFixedSize:r._options.mainTextureFixedSize,mainTextureRatio:r._options.mainTextureRatio,renderingGroupId:r._options.renderingGroupId}),r}return T(s,o),Object.defineProperty(s.prototype,"blurKernelSize",{get:function(){return this._horizontalBlurPostprocess1.kernel},set:function(e){this._horizontalBlurPostprocess1.kernel=e,this._verticalBlurPostprocess1.kernel=e,this._horizontalBlurPostprocess2.kernel=e,this._verticalBlurPostprocess2.kernel=e},enumerable:!0,configurable:!0}),Object.defineProperty(s.prototype,"intensity",{get:function(){return this._intensity},set:function(e){this._intensity=e},enumerable:!0,configurable:!0}),s.prototype.getEffectName=function(){return s.EffectName},s.prototype._createMergeEffect=function(){return this._engine.createEffect("glowMapMerge",[a.VertexBuffer.PositionKind],["offset"],["textureSampler","textureSampler2"],"#define EMISSIVE \n")},s.prototype._createTextureAndPostProcesses=function(){var t=this,e=this._mainTextureDesiredSize.width,i=this._mainTextureDesiredSize.height;e=this._engine.needPOTTextures?a.Tools.GetExponentOfTwo(e,this._maxSize):e,i=this._engine.needPOTTextures?a.Tools.GetExponentOfTwo(i,this._maxSize):i;var r=0;r=this._engine.getCaps().textureHalfFloatRender?a.Engine.TEXTURETYPE_HALF_FLOAT:a.Engine.TEXTURETYPE_UNSIGNED_INT,this._blurTexture1=new a.RenderTargetTexture("GlowLayerBlurRTT",{width:e,height:i},this._scene,!1,!0,r),this._blurTexture1.wrapU=a.Texture.CLAMP_ADDRESSMODE,this._blurTexture1.wrapV=a.Texture.CLAMP_ADDRESSMODE,this._blurTexture1.updateSamplingMode(a.Texture.BILINEAR_SAMPLINGMODE),this._blurTexture1.renderParticles=!1,this._blurTexture1.ignoreCameraViewport=!0;var n=Math.floor(e/2),o=Math.floor(i/2);this._blurTexture2=new a.RenderTargetTexture("GlowLayerBlurRTT2",{width:n,height:o},this._scene,!1,!0,r),this._blurTexture2.wrapU=a.Texture.CLAMP_ADDRESSMODE,this._blurTexture2.wrapV=a.Texture.CLAMP_ADDRESSMODE,this._blurTexture2.updateSamplingMode(a.Texture.BILINEAR_SAMPLINGMODE),this._blurTexture2.renderParticles=!1,this._blurTexture2.ignoreCameraViewport=!0,this._textures=[this._blurTexture1,this._blurTexture2],this._horizontalBlurPostprocess1=new a.BlurPostProcess("GlowLayerHBP1",new a.Vector2(1,0),this._options.blurKernelSize/2,{width:e,height:i},null,a.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,r),this._horizontalBlurPostprocess1.width=e,this._horizontalBlurPostprocess1.height=i,this._horizontalBlurPostprocess1.onApplyObservable.add((function(e){e.setTexture("textureSampler",t._mainTexture)})),this._verticalBlurPostprocess1=new a.BlurPostProcess("GlowLayerVBP1",new a.Vector2(0,1),this._options.blurKernelSize/2,{width:e,height:i},null,a.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,r),this._horizontalBlurPostprocess2=new a.BlurPostProcess("GlowLayerHBP2",new a.Vector2(1,0),this._options.blurKernelSize/2,{width:n,height:o},null,a.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,r),this._horizontalBlurPostprocess2.width=n,this._horizontalBlurPostprocess2.height=o,this._horizontalBlurPostprocess2.onApplyObservable.add((function(e){e.setTexture("textureSampler",t._blurTexture1)})),this._verticalBlurPostprocess2=new a.BlurPostProcess("GlowLayerVBP2",new a.Vector2(0,1),this._options.blurKernelSize/2,{width:n,height:o},null,a.Texture.BILINEAR_SAMPLINGMODE,this._scene.getEngine(),!1,r),this._postProcesses=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1,this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._postProcesses1=[this._horizontalBlurPostprocess1,this._verticalBlurPostprocess1],this._postProcesses2=[this._horizontalBlurPostprocess2,this._verticalBlurPostprocess2],this._mainTexture.samples=this._options.mainTextureSamples,this._mainTexture.onAfterUnbindObservable.add((function(){var e=t._blurTexture1.getInternalTexture();e&&(t._scene.postProcessManager.directRender(t._postProcesses1,e,!0),(e=t._blurTexture2.getInternalTexture())&&t._scene.postProcessManager.directRender(t._postProcesses2,e,!0))})),this._postProcesses.map((function(e){e.autoClear=!1}))},s.prototype.isReady=function(e,t){var i=e.getMaterial(),r=e.getRenderingMesh();if(!i||!r)return!1;var n=i.emissiveTexture;return o.prototype._isReady.call(this,e,t,n)},s.prototype.needStencil=function(){return!1},s.prototype._internalRender=function(e){e.setTexture("textureSampler",this._blurTexture1),e.setTexture("textureSampler2",this._blurTexture2),e.setFloat("offset",this._intensity);var t=this._engine,i=t.getStencilBuffer();t.setStencilBuffer(!1),t.drawElementsType(a.Material.TriangleFillMode,0,6),t.setStencilBuffer(i)},s.prototype._setEmissiveTextureAndColor=function(e,t,i){var r=1;this.customEmissiveTextureSelector?this._emissiveTextureAndColor.texture=this.customEmissiveTextureSelector(e,t,i):i?(this._emissiveTextureAndColor.texture=i.emissiveTexture,this._emissiveTextureAndColor.texture&&(r=this._emissiveTextureAndColor.texture.level)):this._emissiveTextureAndColor.texture=null,this.customEmissiveColorSelector?this.customEmissiveColorSelector(e,t,i,this._emissiveTextureAndColor.color):i.emissiveColor?this._emissiveTextureAndColor.color.set(i.emissiveColor.r*r,i.emissiveColor.g*r,i.emissiveColor.b*r,1):this._emissiveTextureAndColor.color.set(this.neutralColor.r,this.neutralColor.g,this.neutralColor.b,this.neutralColor.a)},s.prototype._shouldRenderMesh=function(e){return this.hasMesh(e)},s.prototype.addExcludedMesh=function(e){-1===this._excludedMeshes.indexOf(e.uniqueId)&&this._excludedMeshes.push(e.uniqueId)},s.prototype.removeExcludedMesh=function(e){var t=this._excludedMeshes.indexOf(e.uniqueId);-1!==t&&this._excludedMeshes.splice(t,1)},s.prototype.addIncludedOnlyMesh=function(e){-1===this._includedOnlyMeshes.indexOf(e.uniqueId)&&this._includedOnlyMeshes.push(e.uniqueId)},s.prototype.removeIncludedOnlyMesh=function(e){var t=this._includedOnlyMeshes.indexOf(e.uniqueId);-1!==t&&this._includedOnlyMeshes.splice(t,1)},s.prototype.hasMesh=function(e){return!!o.prototype.hasMesh.call(this,e)&&(this._includedOnlyMeshes.length?-1!==this._includedOnlyMeshes.indexOf(e.uniqueId):!this._excludedMeshes.length||-1===this._excludedMeshes.indexOf(e.uniqueId))},s.prototype._disposeMesh=function(e){this.removeIncludedOnlyMesh(e),this.removeExcludedMesh(e)},s.prototype.getClassName=function(){return"GlowLayer"},s.prototype.serialize=function(){var e,t=a.SerializationHelper.Serialize(this);if(t.customType="BABYLON.GlowLayer",t.includedMeshes=[],this._includedOnlyMeshes.length)for(e=0;e<this._includedOnlyMeshes.length;e++){(i=this._scene.getMeshByUniqueID(this._includedOnlyMeshes[e]))&&t.includedMeshes.push(i.id)}if(t.excludedMeshes=[],this._excludedMeshes.length)for(e=0;e<this._excludedMeshes.length;e++){var i;(i=this._scene.getMeshByUniqueID(this._excludedMeshes[e]))&&t.excludedMeshes.push(i.id)}return t},s.Parse=function(e,t,i){var r,n=a.SerializationHelper.Parse((function(){return new s(e.name,t,e.options)}),e,t,i);for(r=0;r<e.excludedMeshes.length;r++){(o=t.getMeshByID(e.excludedMeshes[r]))&&n.addExcludedMesh(o)}for(r=0;r<e.includedMeshes.length;r++){var o;(o=t.getMeshByID(e.includedMeshes[r]))&&n.addIncludedOnlyMesh(o)}return n},s.EffectName="GlowLayer",s.DefaultBlurKernelSize=32,s.DefaultTextureRatio=.5,b([a.serialize()],s.prototype,"blurKernelSize",null),b([a.serialize()],s.prototype,"intensity",null),b([a.serialize("options")],s.prototype,"_options",void 0),s})(a.EffectLayer);a.GlowLayer=i})($a||($a={})),(function(a){var o,e;(e=o=a.AssetTaskState||(a.AssetTaskState={}))[e.INIT=0]="INIT",e[e.RUNNING=1]="RUNNING",e[e.DONE=2]="DONE",e[e.ERROR=3]="ERROR";var t=(function(){function e(e){this.name=e,this._isCompleted=!1,this._taskState=o.INIT}return Object.defineProperty(e.prototype,"isCompleted",{get:function(){return this._isCompleted},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"taskState",{get:function(){return this._taskState},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"errorObject",{get:function(){return this._errorObject},enumerable:!0,configurable:!0}),e.prototype._setErrorObject=function(e,t){this._errorObject||(this._errorObject={message:e,exception:t})},e.prototype.run=function(e,t,i){var r=this;this._taskState=o.RUNNING,this.runTask(e,(function(){r.onDoneCallback(t,i)}),(function(e,t){r.onErrorCallback(i,e,t)}))},e.prototype.runTask=function(e,t,i){throw new Error("runTask is not implemented")},e.prototype.reset=function(){this._taskState=o.INIT},e.prototype.onErrorCallback=function(e,t,i){this._taskState=o.ERROR,this._errorObject={message:t,exception:i},this.onError&&this.onError(this,t,i),e()},e.prototype.onDoneCallback=function(e,t){try{this._taskState=o.DONE,this._isCompleted=!0,this.onSuccess&&this.onSuccess(this),e()}catch(e){this.onErrorCallback(t,"Task is done, error executing success callback(s)",e)}},e})();a.AbstractAssetTask=t;var s=function(e,t,i){this.remainingCount=e,this.totalCount=t,this.task=i};a.AssetsProgressEvent=s;var l=(function(o){function e(e,t,i,r){var n=o.call(this,e)||this;return n.name=e,n.meshesNames=t,n.rootUrl=i,n.sceneFilename=r,n}return T(e,o),e.prototype.runTask=function(e,r,n){var o=this;a.SceneLoader.ImportMesh(this.meshesNames,this.rootUrl,this.sceneFilename,e,(function(e,t,i){o.loadedMeshes=e,o.loadedParticleSystems=t,o.loadedSkeletons=i,r()}),null,(function(e,t,i){n(t,i)}))},e})(t);a.MeshAssetTask=l;var r=(function(r){function e(e,t){var i=r.call(this,e)||this;return i.name=e,i.url=t,i}return T(e,r),e.prototype.runTask=function(e,t,i){var r=this;e._loadFile(this.url,(function(e){r.text=e,t()}),void 0,!1,!1,(function(e,t){e&&i(e.status+" "+e.statusText,t)}))},e})(t);a.TextFileAssetTask=r;var n=(function(r){function e(e,t){var i=r.call(this,e)||this;return i.name=e,i.url=t,i}return T(e,r),e.prototype.runTask=function(e,t,i){var r=this;e._loadFile(this.url,(function(e){r.data=e,t()}),void 0,!0,!0,(function(e,t){e&&i(e.status+" "+e.statusText,t)}))},e})(t);a.BinaryFileAssetTask=n;var c=(function(r){function e(e,t){var i=r.call(this,e)||this;return i.name=e,i.url=t,i}return T(e,r),e.prototype.runTask=function(e,t,i){var r=this,n=new Image;a.Tools.SetCorsBehavior(this.url,n),n.onload=function(){r.image=n,t()},n.onerror=function(e){i("Error loading image",e)},n.src=this.url},e})(t);a.ImageAssetTask=c;var h=(function(s){function e(e,t,i,r,n){void 0===n&&(n=a.Texture.TRILINEAR_SAMPLINGMODE);var o=s.call(this,e)||this;return o.name=e,o.url=t,o.noMipmap=i,o.invertY=r,o.samplingMode=n,o}return T(e,s),e.prototype.runTask=function(e,t,i){this.texture=new a.Texture(this.url,e,this.noMipmap,this.invertY,this.samplingMode,function(){t()},function(e,t){i(e,t)})},e})(t);a.TextureAssetTask=h;var u=(function(s){function e(e,t,i,r,n){var o=s.call(this,e)||this;return o.name=e,o.url=t,o.extensions=i,o.noMipmap=r,o.files=n,o}return T(e,s),e.prototype.runTask=function(e,t,i){this.texture=new a.CubeTexture(this.url,e,this.extensions,this.noMipmap,this.files,function(){t()},function(e,t){i(e,t)})},e})(t);a.CubeTextureAssetTask=u;var d=(function(l){function e(e,t,i,r,n,o,s){void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=!1);var a=l.call(this,e)||this;return a.name=e,a.url=t,a.size=i,a.noMipmap=r,a.generateHarmonics=n,a.gammaSpace=o,a.reserved=s,a}return T(e,l),e.prototype.run=function(e,t,i){this.texture=new a.HDRCubeTexture(this.url,e,this.size,this.noMipmap,this.generateHarmonics,this.gammaSpace,this.reserved,function(){t()},function(e,t){i(e,t)})},e})(t);a.HDRCubeTextureAssetTask=d;var i=(function(){function e(e){this._isLoading=!1,this._tasks=new Array,this._waitingTasksCount=0,this._totalTasksCount=0,this.onTaskSuccessObservable=new a.Observable,this.onTaskErrorObservable=new a.Observable,this.onTasksDoneObservable=new a.Observable,this.onProgressObservable=new a.Observable,this.useDefaultLoadingScreen=!0,this._scene=e}return e.prototype.addMeshTask=function(e,t,i,r){var n=new l(e,t,i,r);return this._tasks.push(n),n},e.prototype.addTextFileTask=function(e,t){var i=new r(e,t);return this._tasks.push(i),i},e.prototype.addBinaryFileTask=function(e,t){var i=new n(e,t);return this._tasks.push(i),i},e.prototype.addImageTask=function(e,t){var i=new c(e,t);return this._tasks.push(i),i},e.prototype.addTextureTask=function(e,t,i,r,n){void 0===n&&(n=a.Texture.TRILINEAR_SAMPLINGMODE);var o=new h(e,t,i,r,n);return this._tasks.push(o),o},e.prototype.addCubeTextureTask=function(e,t,i,r,n){var o=new u(e,t,i,r,n);return this._tasks.push(o),o},e.prototype.addHDRCubeTextureTask=function(e,t,i,r,n,o,s){void 0===r&&(r=!1),void 0===n&&(n=!0),void 0===o&&(o=!1),void 0===s&&(s=!1);var a=new d(e,t,i,r,n,o,s);return this._tasks.push(a),a},e.prototype.removeTask=function(e){var t=this._tasks.indexOf(e);-1<t&&this._tasks.splice(t,1)},e.prototype._decreaseWaitingTasksCount=function(e){this._waitingTasksCount--;try{this.onProgress&&this.onProgress(this._waitingTasksCount,this._totalTasksCount,e),this.onProgressObservable.notifyObservers(new s(this._waitingTasksCount,this._totalTasksCount,e))}catch(e){a.Tools.Error("Error running progress callbacks."),console.log(e)}if(0===this._waitingTasksCount){try{this.onFinish&&this.onFinish(this._tasks);for(var t=this._tasks.slice(),i=0,r=t;i<r.length;i++){if((e=r[i]).taskState===o.DONE){var n=this._tasks.indexOf(e);-1<n&&this._tasks.splice(n,1)}}this.onTasksDoneObservable.notifyObservers(this._tasks)}catch(e){a.Tools.Error("Error running tasks-done callbacks."),console.log(e)}this._isLoading=!1,this._scene.getEngine().hideLoadingUI()}},e.prototype._runTask=function(i){var r=this,t=function(e,t){i._setErrorObject(e,t),r.onTaskError&&r.onTaskError(i),r.onTaskErrorObservable.notifyObservers(i),r._decreaseWaitingTasksCount(i)};i.run(this._scene,(function(){try{r.onTaskSuccess&&r.onTaskSuccess(i),r.onTaskSuccessObservable.notifyObservers(i),r._decreaseWaitingTasksCount(i)}catch(e){t("Error executing task success callbacks",e)}}),t)},e.prototype.reset=function(){return this._isLoading=!1,this._tasks=new Array,this},e.prototype.load=function(){if(this._isLoading)return this;if(this._isLoading=!0,this._waitingTasksCount=this._tasks.length,this._totalTasksCount=this._tasks.length,0===this._waitingTasksCount)return this._isLoading=!1,this.onFinish&&this.onFinish(this._tasks),this.onTasksDoneObservable.notifyObservers(this._tasks),this;this.useDefaultLoadingScreen&&this._scene.getEngine().displayLoadingUI();for(var e=0;e<this._tasks.length;e++){var t=this._tasks[e];t.taskState===o.INIT&&this._runTask(t)}return this},e})();a.AssetsManager=i})($a||($a={})),ha=$a||($a={}),ua=[],da=function(e,t){if(!ua[e.id]&&!e.doNotSerialize){if(e instanceof ha.BoxGeometry)t.boxes.push(e.serialize());else if(e instanceof ha.SphereGeometry)t.spheres.push(e.serialize());else if(e instanceof ha.CylinderGeometry)t.cylinders.push(e.serialize());else if(e instanceof ha.TorusGeometry)t.toruses.push(e.serialize());else if(e instanceof ha.GroundGeometry)t.grounds.push(e.serialize());else if(e instanceof ha.Plane)t.planes.push(e.serialize());else if(e instanceof ha.TorusKnotGeometry)t.torusKnots.push(e.serialize());else{if(e instanceof ha._PrimitiveGeometry)throw new Error("Unknown primitive type");t.vertexData.push(e.serializeVerticeData())}ua[e.id]=!0}},fa=function(e,t){var i={},r=e._geometry;return r&&(e.getScene().getGeometryByID(r.id)||da(r,t.geometries)),e.serialize&&e.serialize(i),i},pa=(function(){function v(){}return v.ClearCache=function(){ua=[]},v.Serialize=function(e){var t,i,r,n={};if(v.ClearCache(),n.useDelayedTextureLoading=e.useDelayedTextureLoading,n.autoClear=e.autoClear,n.clearColor=e.clearColor.asArray(),n.ambientColor=e.ambientColor.asArray(),n.gravity=e.gravity.asArray(),n.collisionsEnabled=e.collisionsEnabled,n.workerCollisions=e.workerCollisions,e.fogMode&&0!==e.fogMode&&(n.fogMode=e.fogMode,n.fogColor=e.fogColor.asArray(),n.fogStart=e.fogStart,n.fogEnd=e.fogEnd,n.fogDensity=e.fogDensity),e.isPhysicsEnabled()){var o=e.getPhysicsEngine();o&&(n.physicsEnabled=!0,n.physicsGravity=o.gravity.asArray(),n.physicsEngine=o.getPhysicsPluginName())}e.metadata&&(n.metadata=e.metadata),n.morphTargetManagers=[];for(var s=0,a=e.meshes;s<a.length;s++){var l=(p=a[s]).morphTargetManager;l&&n.morphTargetManagers.push(l.serialize())}for(n.lights=[],t=0;t<e.lights.length;t++)(i=e.lights[t]).doNotSerialize||n.lights.push(i.serialize());for(n.cameras=[],t=0;t<e.cameras.length;t++){var c=e.cameras[t];c.doNotSerialize||n.cameras.push(c.serialize())}for(e.activeCamera&&(n.activeCameraID=e.activeCamera.id),ha.Animation.AppendSerializedAnimations(e,n),n.materials=[],n.multiMaterials=[],t=0;t<e.materials.length;t++)(r=e.materials[t]).doNotSerialize||n.materials.push(r.serialize());for(n.multiMaterials=[],t=0;t<e.multiMaterials.length;t++){var h=e.multiMaterials[t];n.multiMaterials.push(h.serialize())}for(e.environmentTexture&&(n.environmentTexture=e.environmentTexture.name),n.skeletons=[],t=0;t<e.skeletons.length;t++){var u=e.skeletons[t];u.doNotSerialize||n.skeletons.push(u.serialize())}for(n.transformNodes=[],t=0;t<e.transformNodes.length;t++)n.transformNodes.push(e.transformNodes[t].serialize());n.geometries={},n.geometries.boxes=[],n.geometries.spheres=[],n.geometries.cylinders=[],n.geometries.toruses=[],n.geometries.grounds=[],n.geometries.planes=[],n.geometries.torusKnots=[],n.geometries.vertexData=[],ua=[];var d=e.getGeometries();for(t=0;t<d.length;t++){var f=d[t];f.isReady()&&da(f,n.geometries)}for(n.meshes=[],t=0;t<e.meshes.length;t++){var p;if((p=e.meshes[t])instanceof ha.Mesh){var _=p;_.doNotSerialize||_.delayLoadState!==ha.Engine.DELAYLOADSTATE_LOADED&&_.delayLoadState!==ha.Engine.DELAYLOADSTATE_NONE||n.meshes.push(fa(_,n))}}for(n.particleSystems=[],t=0;t<e.particleSystems.length;t++)n.particleSystems.push(e.particleSystems[t].serialize());e.actionManager&&(n.actions=e.actionManager.serialize("scene"));for(var m=0,g=e._serializableComponents;m<g.length;m++){g[m].serialize(n)}return n},v.SerializeMesh=function(t,e,i){void 0===e&&(e=!1),void 0===i&&(i=!1);var r={};if(v.ClearCache(),t=t instanceof Array?t:[t],e||i)for(var n=0;n<t.length;++n)i&&t[n].getDescendants().forEach((function(e){e instanceof ha.Mesh&&t.indexOf(e)<0&&t.push(e)})),e&&t[n].parent&&t.indexOf(t[n].parent)<0&&t.push(t[n].parent);return t.forEach((function(e){!(function(t,e){if(t.delayLoadState===ha.Engine.DELAYLOADSTATE_LOADED||t.delayLoadState===ha.Engine.DELAYLOADSTATE_NONE){if(t.material)if(t.material instanceof ha.MultiMaterial){if(e.multiMaterials=e.multiMaterials||[],e.materials=e.materials||[],!e.multiMaterials.some((function(e){return e.id===t.material.id}))){e.multiMaterials.push(t.material.serialize());for(var i=function(t){t&&(e.materials.some((function(e){return e.id===t.id}))||e.materials.push(t.serialize()))},r=0,n=t.material.subMaterials;r<n.length;r++)i(n[r])}}else e.materials=e.materials||[],e.materials.some((function(e){return e.id===t.material.id}))||e.materials.push(t.material.serialize());var o=t._geometry;o&&(e.geometries||(e.geometries={},e.geometries.boxes=[],e.geometries.spheres=[],e.geometries.cylinders=[],e.geometries.toruses=[],e.geometries.grounds=[],e.geometries.planes=[],e.geometries.torusKnots=[],e.geometries.vertexData=[]),da(o,e.geometries)),t.skeleton&&(e.skeletons=e.skeletons||[],e.skeletons.push(t.skeleton.serialize())),e.meshes=e.meshes||[],e.meshes.push(fa(t,e))}})(e,r)})),r},v})(),ha.SceneSerializer=pa,_a=$a||($a={}),ma=(function(){function e(e,t,i,r,n){void 0===r&&(r=!0),void 0===n&&(n=!1);var o=this;this.name=e,this._viewMatrix=_a.Matrix.Identity(),this._target=_a.Vector3.Zero(),this._add=_a.Vector3.Zero(),this._invertYAxis=!1,this.position=_a.Vector3.Zero(),this._scene=i,this._scene.reflectionProbes||(this._scene.reflectionProbes=new Array),this._scene.reflectionProbes.push(this),this._renderTargetTexture=new _a.RenderTargetTexture(e,t,i,r,!0,n?_a.Engine.TEXTURETYPE_FLOAT:_a.Engine.TEXTURETYPE_UNSIGNED_INT,!0),this._renderTargetTexture.onBeforeRenderObservable.add((function(e){switch(e){case 0:o._add.copyFromFloats(1,0,0);break;case 1:o._add.copyFromFloats(-1,0,0);break;case 2:o._add.copyFromFloats(0,o._invertYAxis?1:-1,0);break;case 3:o._add.copyFromFloats(0,o._invertYAxis?-1:1,0);break;case 4:o._add.copyFromFloats(0,0,1);break;case 5:o._add.copyFromFloats(0,0,-1)}o._attachedMesh&&o.position.copyFrom(o._attachedMesh.getAbsolutePosition()),o.position.addToRef(o._add,o._target),_a.Matrix.LookAtLHToRef(o.position,o._target,_a.Vector3.Up(),o._viewMatrix),i.setTransformMatrix(o._viewMatrix,o._projectionMatrix),i._forcedViewPosition=o.position})),this._renderTargetTexture.onAfterUnbindObservable.add((function(){i._forcedViewPosition=null,i.updateTransformMatrix(!0)})),i.activeCamera&&(this._projectionMatrix=_a.Matrix.PerspectiveFovLH(Math.PI/2,1,i.activeCamera.minZ,i.activeCamera.maxZ))}return Object.defineProperty(e.prototype,"samples",{get:function(){return this._renderTargetTexture.samples},set:function(e){this._renderTargetTexture.samples=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"refreshRate",{get:function(){return this._renderTargetTexture.refreshRate},set:function(e){this._renderTargetTexture.refreshRate=e},enumerable:!0,configurable:!0}),e.prototype.getScene=function(){return this._scene},Object.defineProperty(e.prototype,"cubeTexture",{get:function(){return this._renderTargetTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderList",{get:function(){return this._renderTargetTexture.renderList},enumerable:!0,configurable:!0}),e.prototype.attachToMesh=function(e){this._attachedMesh=e},e.prototype.setRenderingAutoClearDepthStencil=function(e,t){this._renderTargetTexture.setRenderingAutoClearDepthStencil(e,t)},e.prototype.dispose=function(){var e=this._scene.reflectionProbes.indexOf(this);-1!==e&&this._scene.reflectionProbes.splice(e,1),this._renderTargetTexture&&(this._renderTargetTexture.dispose(),this._renderTargetTexture=null)},e})(),_a.ReflectionProbe=ma,ga=$a||($a={}),va=(function(){function e(e){this.name=ga.SceneComponentConstants.NAME_LAYER,this.scene=e,this._engine=e.getEngine(),e.layers=new Array}return e.prototype.register=function(){this.scene._beforeCameraDrawStage.registerStep(ga.SceneComponentConstants.STEP_BEFORECAMERADRAW_LAYER,this,this._drawBackground),this.scene._afterCameraDrawStage.registerStep(ga.SceneComponentConstants.STEP_AFTERCAMERADRAW_LAYER,this,this._drawForeground)},e.prototype.rebuild=function(){for(var e=0,t=this.scene.layers;e<t.length;e++){t[e]._rebuild()}},e.prototype.dispose=function(){for(var e=this.scene.layers;e.length;)e[0].dispose()},e.prototype._draw=function(e,t){var i=this.scene.layers;if(i.length){this._engine.setDepthBuffer(!1);for(var r=e.layerMask,n=0,o=i;n<o.length;n++){var s=o[n];s.isBackground===t&&0!=(s.layerMask&r)&&s.render()}this._engine.setDepthBuffer(!0)}},e.prototype._drawBackground=function(e){this._draw(e,!0)},e.prototype._drawForeground=function(e){this._draw(e,!1)},e})(),ga.LayerSceneComponent=va,ya=$a||($a={}),ba=(function(){function e(e,t,i,r,n){this.name=e,this.scale=new ya.Vector2(1,1),this.offset=new ya.Vector2(0,0),this.alphaBlendingMode=ya.Engine.ALPHA_COMBINE,this.layerMask=268435455,this._vertexBuffers={},this.onDisposeObservable=new ya.Observable,this.onBeforeRenderObservable=new ya.Observable,this.onAfterRenderObservable=new ya.Observable,this.texture=t?new ya.Texture(t,i,!0):null,this.isBackground=void 0===r||r,this.color=void 0===n?new ya.Color4(1,1,1,1):n,this._scene=i||ya.Engine.LastCreatedScene;var o=this._scene._getComponent(ya.SceneComponentConstants.NAME_LAYER);o||(o=new ya.LayerSceneComponent(this._scene),this._scene._addComponent(o)),this._scene.layers.push(this);var s=this._scene.getEngine(),a=[];a.push(1,1),a.push(-1,1),a.push(-1,-1),a.push(1,-1);var l=new ya.VertexBuffer(s,a,ya.VertexBuffer.PositionKind,!1,!1,2);this._vertexBuffers[ya.VertexBuffer.PositionKind]=l,this._createIndexBuffer(),this._effect=s.createEffect("layer",[ya.VertexBuffer.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],""),this._alphaTestEffect=s.createEffect("layer",[ya.VertexBuffer.PositionKind],["textureMatrix","color","scale","offset"],["textureSampler"],"#define ALPHATEST")}return Object.defineProperty(e.prototype,"onDispose",{set:function(e){this._onDisposeObserver&&this.onDisposeObservable.remove(this._onDisposeObserver),this._onDisposeObserver=this.onDisposeObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onBeforeRender",{set:function(e){this._onBeforeRenderObserver&&this.onBeforeRenderObservable.remove(this._onBeforeRenderObserver),this._onBeforeRenderObserver=this.onBeforeRenderObservable.add(e)},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"onAfterRender",{set:function(e){this._onAfterRenderObserver&&this.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=this.onAfterRenderObservable.add(e)},enumerable:!0,configurable:!0}),e.prototype._createIndexBuffer=function(){var e=this._scene.getEngine(),t=[];t.push(0),t.push(1),t.push(2),t.push(0),t.push(2),t.push(3),this._indexBuffer=e.createIndexBuffer(t)},e.prototype._rebuild=function(){var e=this._vertexBuffers[ya.VertexBuffer.PositionKind];e&&e._rebuild(),this._createIndexBuffer()},e.prototype.render=function(){var e=this.alphaTest?this._alphaTestEffect:this._effect;if(e.isReady()&&this.texture&&this.texture.isReady()){var t=this._scene.getEngine();this.onBeforeRenderObservable.notifyObservers(this),t.enableEffect(e),t.setState(!1),e.setTexture("textureSampler",this.texture),e.setMatrix("textureMatrix",this.texture.getTextureMatrix()),e.setFloat4("color",this.color.r,this.color.g,this.color.b,this.color.a),e.setVector2("offset",this.offset),e.setVector2("scale",this.scale),t.bindBuffers(this._vertexBuffers,this._indexBuffer,e),this.alphaTest?t.drawElementsType(ya.Material.TriangleFillMode,0,6):(t.setAlphaMode(this.alphaBlendingMode),t.drawElementsType(ya.Material.TriangleFillMode,0,6),t.setAlphaMode(ya.Engine.ALPHA_DISABLE)),this.onAfterRenderObservable.notifyObservers(this)}},e.prototype.dispose=function(){var e=this._vertexBuffers[ya.VertexBuffer.PositionKind];e&&(e.dispose(),this._vertexBuffers[ya.VertexBuffer.PositionKind]=null),this._indexBuffer&&(this._scene.getEngine()._releaseBuffer(this._indexBuffer),this._indexBuffer=null),this.texture&&(this.texture.dispose(),this.texture=null);var t=this._scene.layers.indexOf(this);this._scene.layers.splice(t,1),this.onDisposeObservable.notifyObservers(this),this.onDisposeObservable.clear(),this.onAfterRenderObservable.clear(),this.onBeforeRenderObservable.clear()},e})(),ya.Layer=ba,Ta=$a||($a={}),Ea=(function(){function e(){}return e.CreateResizedCopy=function(t,e,i,r){void 0===r&&(r=!0);var n=t.getScene(),o=n.getEngine(),s=new Ta.RenderTargetTexture("resized"+t.name,{width:e,height:i},n,!t.noMipmap,!0,t._texture.type,!1,t._samplingMode,!1);s.wrapU=t.wrapU,s.wrapV=t.wrapV,s.uOffset=t.uOffset,s.vOffset=t.vOffset,s.uScale=t.uScale,s.vScale=t.vScale,s.uAng=t.uAng,s.vAng=t.vAng,s.wAng=t.wAng,s.coordinatesIndex=t.coordinatesIndex,s.level=t.level,s.anisotropicFilteringLevel=t.anisotropicFilteringLevel,s._texture.isReady=!1,t.wrapU=Ta.Texture.CLAMP_ADDRESSMODE,t.wrapV=Ta.Texture.CLAMP_ADDRESSMODE;var a=new Ta.PassPostProcess("pass",1,null,r?Ta.Texture.BILINEAR_SAMPLINGMODE:Ta.Texture.NEAREST_SAMPLINGMODE,o,!1,Ta.Engine.TEXTURETYPE_UNSIGNED_INT);return a.getEffect().executeWhenCompiled((function(){a.onApply=function(e){e.setTexture("textureSampler",t)};var e=s.getInternalTexture();e&&(n.postProcessManager.directRender([a],e),o.unBindFramebuffer(e),s.disposeFramebufferObjects(),a.dispose(),e.isReady=!0)})),s},e.GetEnvironmentBRDFTexture=function(e){if(!e._environmentBRDFTexture){var t=Ta.Texture.CreateFromBase64String(this._environmentBRDFBase64Texture,"EnvironmentBRDFTexture",e,!0,!1,Ta.Texture.BILINEAR_SAMPLINGMODE);t.wrapU=Ta.Texture.CLAMP_ADDRESSMODE,t.wrapV=Ta.Texture.CLAMP_ADDRESSMODE,e._environmentBRDFTexture=t}return e._environmentBRDFTexture},e._environmentBRDFBase64Texture="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAQAAAAEACAYAAABccqhmAAAgAElEQVR4Xu19Z7PtTHbW1g3jMMbGmGDAZAMm5xxMLDAU0WSKWOQcCoqccw6eGdtgk4yNbZxnvvAL+Af8Af6AsQl+06ako9X36dXPSi3pnPu+cz/cOntL3S1pq5+w1mrpLs/eud9fvn27rf9evPPwFz+v22S7fGZ/n7/70G79J5/Xv/qzbLP+Pnvvoc/6Tz7jX/15/c62LfeH7fofbpfP3l/ct36Wf+u4+D37+XYb++G26LPsr/zFttnPuh37bm1bt0f7MvtlnOx4uv0H4fty8UUsz77rfn/57u32cgXvDv72eQf0tl0+G38b0Nf9K4Dl704MEfA16KsE8Gw9JgD+DQE8EA0DT2b7GwK4GHnF4a8iguXZt9/vL5/dbisJbEq/uwD5vIK/fbbAv4N9U/8nJIDNCazKvBLBGwdwu62OhajxmQSAx6gqNp5HCg9wPan2nwSNjhLD8ux/3u8vP3y7vbwDAYjtR8AzFyDqLu1Q+YEINnew23rPCYiKb+q/K7o4AVT4tg0t/h4ydJZfkQASQ/d5b9fZ/Z1ENmuPn/cwYCYEELBguKC3nRkCnE0AFOwOKCOAR/sH/L4hgFMpbSWP5dn/uN9ffs7t9mJ5cAHoBLTyszBAFJ/F/xIKdASw5wgaEWDMLySxAk4svf6L+4QAGPiJCziNAPb4f3UZ2dh/m+z7BK4SAPYrxf5FB6ABPgCUAfANAZwKyscc7IEA/vv9/uLzbreXzx9cQCMACAl00m8jAlF7ov6SCMQ8gJsMFFBnCECSg5H6TxJAU3vPAbwhgFfz9AABeOEDBcIbB3AqPzwQwH+731/8sNvt5Ydut5e3B2C/fG9P+jESgGz/RgxG9r9VAwTUUh0goQDafUz+DYnAnSha5l99Z1l/yQVswAZSGIAugNd/9xBgCw9E8aECkHUB22QPHIAVDlQdQAMWAibhBgZAasAVHUAI8Cqg96Tm0bj3VBS9jwd7IIBvuN9ffMHt9vLTbreXy+32QlwAhgMIeuNzKwOqCoB2Aa00KHE+EsIeDuj4H2N+Hf/TfAC6A4nhgQCQDDwiaKDXiq9KgBEJNPArAtCk0AEd2mpAizW3/lYIoANpBPg3BPA+hjs/9eXZV+0E8Bm32wsJA9aEoBCAuAABPiEAC/yDC4gSgRgKRHkAlgsI6v7iEFqJEMgBwb4BGkEfEEDnDlReoAP/SQRgOYIB+IYDMEE/SQBbXoLNr0jhq4qOZc0PHBSf5oKW519xvz//kbfby8+83V68ABfwniIBgwgQ/HoRUMv8w5qAoQqgk4DWQiCw+63eD8k/XAPQgK5s/5a5xzAAqgR6wY9k+ZEMtCOoJABb230hEHMFWQdgAl0Ap/+uc6tKBrrP/n0AuwfiNwTwNKguHHV5/qX3+/M1B/Ddb7cXax7g2e324vaQB3hhkMAW92tHoFb96cVAbimwkgQ0Vv7R+D8iACfuxzKfLvnNlAAjAsBwwP2MwLQAD9sbYJME0AFcg5uBPSAA0x0AobhtcDKDA0j3KYDhk7Hp8uKj9/vzH3C7vfget9uLT9nDgDUZuOYCLBJA8MNKPyGGIftPrL+4gy3eh5p/lwRUYYAs9Fn7tM/E9lvJwCH2DxJ/mPTr4nyyLiDtBgTAGCrgNuPzNuETgN+suEEAFhng9lkCoICMLH7V0isCeEMCxylrefkl9/uzz90J4NNUGLDmAnYXINUBrf5dCCAuQCcCvYVAYPk3G++VAveVfkIAFRLolgbr2F9ifP33pAqAV/fHRF4HcAS7AKlAAEIYFNwITOszs/wMsB6II4BXFZ0QwBsSOEYCDwTw2TsBfPrt9uLlqzCgcwFABI0EVCiANl8Uvq0JWNsi2JPZ/0YKsOiHxftsW4v51ZqAaBWgZf91PsBL/jFHwEqBR1cCiuJ3gAfCmCEA3cf8rmz8AMZHIoA3JDBPAsuHVgL4jNvt+UoCH34ggK0asIYBGArsAB7AD+reQgCl+GwZ8LaNlP3MEEDaSg4ACMGr/+ulwV4JsAEfLH42/vdKgWElAJ4QpBl+LAlKErHwt+oGMgTA2ngE4IUIOH3dGr/hAKT/m/UBdSJYPuVL7vflU26352sScCWAD+0EsCcDVxewKjfmAzAsENVn4EfgdySgnYB81yEAgL4RA8T8mTUASAAYBgylQAkL8K/+zL6rsl8qF6ArAeS7WRGoAB8Sf7isN/VZqTs6jQ5wXlweWfyqpQ8I4I0TmCCAT/3I/b48u92ef9bt9nwNAdZE4FoOFALYXcAGegkDMByAzzQEgJh+cAIs/legH0IA5QTCPADE+7ISkD0TgA/8sBIgLQfOgF/F9kPcr+J8fIYguyCILQRKgV4DNviOzoKqeJS0u4AA3pBAjQSWT//I/b5OmC0MWB3ASgBrGLA+IryvDNxCgRXo+wKhjgwk8bcTwUACsJ09ANRVAALwCxmEoFcrAUsuAJ4M1E8BDuHABAHomJ8RgACrZfQLyT9dBWi2OOEG9NJd/TDQ8HAQuBE97ZhjGKy6o+imnU+4gDckkCeB5cMfud/v6zr9Dz84gOdCAM/3JwQhF9CAD25gBWWz/8wNgMpj3K9Lfy0foMMBVffXyT4r+cceC9bvCcDFP0311QrATPkvWgosYQFLAuoqQEcQuw3v2si25F+M1RkZXLUU+CgBmCBOEsCbvECOBJbP+Oj9fv+u2+3Zp91uz9cy4Kfebs/3ROD6iPD2b10YJCXB+0PyrgsHdtBuRACfBeTN+uM+suJPSEDbfh3/oxPoHgwiC3/06j8Eutj69sAQqj++I0CUfvIpwCEvYCT90O4Pn1XsT5Ve1/+dcp9FBh3woqXBSEJkvjHHEOUPqJPAjUUCeOMGfCJYPvOj9/t7//d2e7YmAlcS2B3A8xcPYcBm/7ULEDIQew+5gS0EIEA31R8Uf6gAoBsgKwBd9ddvBBJAs6XARgLQXQ2o7T8+IETe+9eRACg7rhCMVgCiE8D4O9wOCb2ubOht1/vYd2ubzLlgKbBHEDSnAMfL6durVm8qBPwXWz7rY/f7/X/fbsvL2+3Zqv4QAjzfw4COAMAJbEC3wC8koBJ9lAhgxZ+4hi3Oh/f8dU8EqtV/JhHgWn9cC4CJQZXZp6GAk/1nawMkrrcqAiwPIIA2FwOB2oaAF5UkcX+GADBs0I5gsNbBQqCorJcFJjqWKvhNMjky0Aek7/LZH7vf3/vO2215vruAD91uz/dSYCOAPQzYkoD7vw34sFIQw4LNymNSUKk8Wv0hCYhkoJ74Q6BboO9eDKoWAHXvBiCvAdPZf4nt3QqA924AbfXV8t8uN4Bt2We029WkoErWpSoCSm11TM8AOYA5uRS4RAITIQDDavaYHxCcm5exfM7H7vd3v2N9McDt9uxDD//WKsAG/ue32/M1DEACuO3g1jkBsf57fqCL/7UbIISAio85AAG0VQEYiIC9DJTYfy/+Dx8HlpeDRK8G90IBHQbgWgD2WT8LoOJ7NyeA5JEkAwwxmuqzur5X6y+sBEwDMggrqoBNH7c68Puk/fI9Vwfwvx4e6H724oEA1iSg5AAaAewlweeyLmAnAHQCTfU1CTAH4GyTMt+QDMRFQFEYQB71lXUAOjHYlvTqh4N2xe5yASoh2PpaJUGDBDrLr9cGIDlY1l+vDlQOAQHckYMiA68KMFsGtOy65RCGsMIDT+QqJoD3yUwCy/f+6P3+7koAt50AXrwigM0FrIuEoBrwHMMAUhmQUKAlAwHo7VmAPURo9h/r//ozLv1V7/5v6wGMV4B3rwYPXEBqIZAQwp4TYDE+LQlqtQfw6my/LgsyZaeLg7wVgmDnWQ5AA5ZWCDRx7ECzyn3udgFptFCIgTlyFRMEUCKgA+O/jl2Xz/3o/f7Otz88QvpszQOsLmAPARoBSDVgud02AthdwPZ5BSxUBVr8L3kAVHrvs076KSLQi3/M9QCJ7H/G/rf4n8X41XIgcwHecuBMDgAe+BHA6uQgqnvbF5DB5hwUQM3vQgIWkKOVftH+gAC6cz0RXZ9MjmD5fh/ZCWCd1CsB7CSwhgArAUgIIC5AQoDOCewJwab+CH79WR4C0mQAZT4hEQS9DgfEztNkoEECDfi6FAhZflb6Q1XXqwHDEECpvZX4a0qP1l7bfAS98cQfzQUo9a4mASMC0CsIm6JGK/2i/QkCuFK9PxmIYPm8nQDu795uy3K7LTvwVyJAB7ARwJoAVLkA7QIkJ9A5AQS95Ad2YmgvAJWwQFcBpB38pUuB9wVKbAWgCXwV86Mz2ICKTwUWFgOxMEBicr0eoBwCGBUADfxsDsAiA+zflNay31ZcfnAdAAXgDGkcdAcfZCJYfuCX3O9vf/vtthHAmgcQF7ATwOoAtn9IACsRSDkQ/wqIIUGoXYEQQ/sL5IDJP539776DwodVAGlr5QBgP8sDdApP3gSUXQa8/rZsRaBeHmy+HwDyCI1MUNlZzX9iJSBO9igJGJYCo4RdIqMfJQ4Ztq8C7FXjHuSnQ92XH/yvdwJ4Z68ErOXAlQRW0O9/JRG42v9GBHsuAImAqv+uzDo30C3yAfVHoHeg9xyAp/7wlp+WFCSWv1sOTBb+0EoAZP5DImBrApAUMFHolQG19c+EAkbpjyUEdQ6gm/QEsCzZFxKDlWNwprJVWfBm/1WAvWrcQ0ie7Lz80H91v7/9v263+9sPI2zrAZAEdvXvXMBKBJIIFDcgyUAEvHICg/o7wA/Bvyt35wCc2F9Cg03RvRyAA34N8hD0xsIfXP7bQgDMFSgyYO8GsF4N/hQ5ALak1yUGRQDZZJ5VWXgKEsie8yQuH63b8vn/8oEA3lsJYJ2EQgD73xX4z9bs/74gaHMBQgA7+DsXAJWBBniHCLTtNx2AUnkG/LYNiUCpvX7wp6sIOHF/lwgkNf8UGagwYMgLMBdgLQCyVgOyciCGCs5nz/Jr8EXOQOcQZEbrfjjTU8qaCBseMyx4vxPB8iP+RU8A24Kg9R8Qgaj/av8lDBgcwApQ+QdVgW0bKr3+jsk//AztzBKgtv4K+Kj08rl7JFgt9BnCAIsQcD2AsQAolQj0CAGAqhOFCK5u3cA+84dyIJLCPm6buAgoBa5qDoDF6wzUkZ13iSDKKwTamSKZSf29cuzJUwq7LV/wz18RwH2Nl9dKABLArv6bC5B/+9OBGxmsIIR1AQ3w2gk4RECTfwBulgC0rP96/FYJUOv9SzkAB/xuKTBY/qsTgZ0LILF/s/RW9v81ywEwhbeAwUIH6hRwGp+wEOhqoF49fojqQoPlR/+z+/3t77jd3n3rdru999CzEYAQAYJfXACEAqL8W5lQgA5uoJUK9zxBB3ii9ALiYT2AjvuN72wFILP+XdlP8gLKFeg6f5QM3AC+VlMMZ9ABGuN+VePHWL6tHVD23or3tQPo2iWfBRgShDp0ELcBjmIAbwTWqEzIJvLM6kEDEFcD9erxCzg3my4/9p/e7299x+323lu32+oAtjwAhgE7Cazqv7mAvRLQcgG7A9B5AAwHus87CWBYsIKFfe+eCSBgt2J+7QBQ+VsogOU/9fIPBvLhASEF8AHwlhPQ2wVYFhmo/Wby74QyYLcmQAEbbbue2FcnAb28QTmHQKBwNVCvHv8IESw//h/f7299pyIA7QIE/LsTeIbqL59hPUADvHIBG8jBIWgn0L4rsKMj2Noomz8QgZELsCoAAnh0Caj8lup7ib9tX+ZBoKgUmFkWTGJ8S/UHZa/kAHT+QGaeoeQmMUC/CoAzVYAjYDvSNwPCq8fPnINus/zEfwQE8O7tdt8dwGZjIQQQ9Y9cwAB+RQIC4I4MdvvdLL+O//E7LgLykn6q3Efjf6X8bOUfkoNYcQZ8z/KzBUBYCqT/YQgjBuOBHxPs7JHh7JoAy/IzWz+xEtBKBEYg8fIGw+SeQQQ+CzHZP+oWXWPU/8z9y0/+h/f729/5kAN4791X/6/cpl4SCsDfLRQwHEBLCmJFYH92vssNgBPo7D8qv4CekIHpAjKgx1iffGbKb5UAQwdguIAtz2KsEWj7vIQggNON91lYoIFN2mznYKj9UBmwQgXLLcDstRTdBchEFWAWcLP9MgC9cuzM8aXN8lP//v3+9v/uCUDyAM0FIBFADqAjAsgFiAvYwK3/MfAL8InSd/Yfy37Qpyv3OSTgxf8C5vZXPfF3aB2AA3hJGg5LghMOgCUBo8SgEAyC3Irvh5xAwhW0cT1iQBKYWds/QQLdeVUQcrEjeGoiWH7633sggHfWJOAaAkglYL/wLQyQf3tYsCp9CwmgFIgOgIJ/JwMdBuB3cQTDX4z9wR2whN+WE9idh67761p/F/8bpb8O/OotQCsJDhZfji0qT9p0LsCI83X9H8E9KH8iCSiTrQO29bwAAbvlCipPAw4T/oRKQAVElbaMJ472t7jnqnEjrlt+1t+539/6P4oAxLquawIkF7Bb/40M9hAAHcD2GVzABmBYKSgxfyMGAbROCipl1w6gs/8ZF0Cy/UIOOr7vHAIu9iHP/2v77yX9ROUt29+AHVUCnDJgtvSn8wXsnQGzIUAW3F27qFS4z2CrD07wCogqbR8LtGecUwR4vX/5OX/7FQFsOYC9FCiToBGAEAH83ZwA5AM06BspiPKrNQIt/kcg69iffBegNqVXb/wdQgIMC0DltUuQ+L+Bmz0OrNTdK/91+4JVf15SEPMCYRkwEfc3stBxurMS0AoTMKRocaV8cKw6jpcFsdUn2/8qRT8buGeP55HC8vP+5v3+1v99cADvvfNQBZB4dO24Kv5GAntSUOz/+n1wAis4wAnoMAC/N9svSUKsBABgmwPAbQTwWzsW/2vAI6j14h+1CEjnBYZFQWSxj+sEVFyPjgBBrhf+aOtPY39vRaBVJlQ2vyOGIATQsb6etBguDMSQyAF4IMhUAmZANNNnUNSqBDvtzzif6HSWL/wbuwN4eycA4gDEBQgRYPzfSGC3/BYBdOCHxKBHBAJoAbdWfIz1I9XXsf5g9y0yAJB7iUDPCaC6e2EA2ngMGyIHwAgBldncf4ID0EDXVp1NYmbnrclOtyfDhiPOoCO4CEXB/rOBfOZ4yy/8a7sDAALY1gKAfWMEgOovoNdk0IArKr+7gwH02gWQ2L4t/sEEoLL2IQnoFX96HYC4CIz/jcSgAJSVAtu2RPZ/SPRBHkC7AkYEqceC2fqBfdKaCcHAAeAkpKVBCANcElBVgBQRTC4HngHOTJ+rQo2jhEbP6xf/VU4AmBza7L+EAZgLgGSgxP8dGQDwmQOQbS2xp6oEWAnQn1seIEMCJO4fsv8Q2w/JQU0IJMvPiCCT/NPuQP/noJ0rAFBa23VSr1N/vQhIgxzzB9odMMIAkGvFZPF6JkyIlJeFFl6IcRYYX0ciOOOcll/6l+/3t/7fngPYy4BSCmyT0SGAlgvY4/+BAET10fZjUhAWCg2AV8nBEPQ6D6DJgSUAoQ/G+Dr+T9l/pfg0HxAs/e3WBUhbsihIgHKkHGiGCQHYO/UHomDgdd0BcRkZlYtyAFlgZNtlzqkSJcwc1xr/6FjLL/tLPQG8t+YA3tuXBKPiqISgAB//bjZdkoNE/Rs5EAIYXIAKCwYHYJADlvhalp8RgS4PogNwFN8jgo1A2LoALxRw1gA09TbCAjckQHBZlQEFwEoS0Iv1S3mAYFGPlwOIJn+0v+ocPohEsHzRX9gJYM0BvPvwTyoB2gGsP6iEAowANsBJWAAVgRYeAPCb/WdkAKEAttNJwRbzM+UPQI8K36k9Kf3RagBTe2vhj3o8uAFXLxUGxTdXBrK1AIltTZ2JzUe7Lp/Ralvxvrb5kcWP9nv2fwBzIRF4FRFkx/XcwRljHCGm5Vf++fv9re+63d4xCABVRhOAJoOtRCguQKoCmghwv7L/mBPQwB/KfMQhCEF0ym8RAUkIToUAxrP/gxOwSoDGmn9WCjTzASw3kHQA5poA7Q4g3n+MEMAChiadiopXwHZV26usvB43e/7Lr/pznADakmBdDcB8AFj+5ggcF4AhgAlwwyUM6m+pPgF8U3BS6jOdAAkJ3HUAO5C7ZKBT99/IVDsGhwyY3e8qNfhCERXDa5BrlW/ftaoqe265Ar0U+PIQQCUzqwqYBYfnSK4AcuW8sjmHaMzl1/zZnQDeud3eXRcCrfH/ngNYbyxzAKL8nQNAMiC5gI0gBNz42XIBAnAkBACwqDyWByPlp2BPWP7WD0Crs/5ewq+1JaBnWX8rEajbDiVAlbNpwHRyAJ4D6EqECQcQWfxo/0wI4E3wcPJnUbSLXqH5A26qHaD9kb7ssKaj+nV/ZiSALRG4rwhsJLBfUKt/k3yAJMGwEtCFBGD/PTIY4n6d8ANyaEk/Q/nPUv8h+WeRgXYCVgIwSwbK3osKi4PonEGUC2C2Pngc2LL73Xanlj9bBTg7BIgAFe2vuoxZS14B7wy/DCT8xX/qfn/rrYccwLtrElA7AJkgkrDSJUHJfO/Z/wZ4Kx8g4IXyYKfm0i9QfkoSJK5HghALr51Ce2Jwv0ad9BvAj1WCidKfZf1x3UDnvPQ90HYf7o1WfSQMGbOpU1D3H6oCynpjPE7VfSccpoalMEHNdAxFKkDLgDzTRo5ZaXukz1E34f1Gy2/8kzEB6MUlsjCoCwWMEAAdgOcGTECrnECn+JYTgPyABn0U82vwt7hfJft0rK9DAlHooTSolH94GxBUAnTSL/reAbz6UBADt344SDkIJBIT5E62HgnEAwgFmjq3ChFkAJUFd7Zd9fwsdZ89nnX85Tf/8Z0A1hwAOgDJAxBbuU1usboYCoiCKvWX+L/lAUDlNUG0bD8Bt7dviP9Vf0v9LbV3XQCz/3qbZf2d0h8D+JAPYDb/RAfArL1l92W7Z/OjEICpOZvkw7bES0EisET7M0RxRNkzx78qJGj37rf+MUUA+zoAnQjs1gTAhJNyFy4X7kBtkYHKB0ifDMgrLiADfJMESGa/Cwe0/a+CHsmA5QQ8N6ByAzJZh1IhEobOAegsvwaVDhEKDkCre0cielYbau4SQfIZggyIM0DMtMkc6ywnMHMsduzlt/+R+/2tt2+3d8QBiAtQSUBaEVDxPyYB22cEuiYDQgJtLUFk7539ke1vgAeAR05gC3ekbAclwuaEjEVA3XoAAnLpT6sBCuStrUrIpqsBHhkwcBOVTecFJAteCAFSyk/GzapwBOJofwV0mbEQkNX2p/X9HX9IEcB7eyLw3q8IlPgSbV/LBThEIMreQJkhAeYOIsDrsELV8VmIgHX9ITGo1L+BnxGB5wQY6IvKLzZZCKD7nsj8m+sADjoAVHk9ga19tF1CzSk5GO8T9MCUAdpZbSqEUW17lpNYfucfvN/fBgfwLlQBcEnwdkA9cdGiCjCgGrCpZhACDMSA6wL28dewgKl6GzuI963EXwtf1Nr/wQ0YMb+bCJwAPgKc5gPIPeiImeUC4B5J2zbZnGXBQjI4Mdk2HFNPYqv9MNlJCJByAzPPEezIiUAe7a8ANjPWGYpePc52Db/799/vb7/zKgQQAnhvDwH0cwFWLqBluwkRYJ7AqgoMTiHjApTqR9ZfbLxbCbCUX1wOKQGiO8ASn7XdKgMimL2SoG4nkxGVnqk+OoeBDHR4AN87EmCWnlULBGiBuiNJMFC5RJB8HsACRgYwZ7WpEEY2pNEuYOoYv/f37Q7g3dvtnT3+39YC6BBAv3IK1wVA9p8SAYC5gRDBqz53QDasvag/dQboGMCy0zBA7e/CgoTyszX/VeA35QeH1YGc2Hwr2YchGn5mJNGVd8FdoEOIHEBo9VkeQc3cqFJgEkPhxSBHwoIMCVTAlx1vlggq4y+/7/fe72+tDuDdV2XARgD7isDtd95BpZWjKRUov4Acwa6BT5OEsEjICg1aBUAl8DpwA2kgQeCYbHsjL0zygfKbll9XC5xk3zYGgM1yA0IKERGgI2PJQJ20M13CAQfgWv1kEjBj+Yc2zlqAGdWPgBPtrwI2O16FXMrn8Ad+z04AaxVgTwDiasAtBNgnrK4E6HBgSApichCBBHkBCnQNbmb1iTPoSEXlDXCfTv6x0EAA2OUDtCPA70bMT6sAXjVAlf4sIhieC8BYXy0CYk5gIPKCA8CJGzoAI5QYJqoRzx8NAZ6KCLLgzra7igSWP/i79hzA6gCAAMQFrBMNSUCrFypUm+x78k/cQRffY45AqatOGDJy0CDHkh5dDERielFhWvrTIYHO+icy/jK+qe6sCkCAH70erLsXylXMWv5GFowQrLyACISU6HZ0W+RALX0Qz2ug4NgYUWScRNQ+q6IZ8GbaVMCdHS99jX/4dwIBCAmsoNd5AHAB1sRDArByAV1YgLkBnfRDF6AtPbP4LNY32lkOgMX/tPynSKFzC466Y2JP+mT+mk8BOiVAVP2MA9COgH4nQGcgHxyCAe5uMicqARTcJ+QBIlB5+6O+V4E7c9wMCSx/9HfkCEDyAMPDJiQZ2AABqtZUVwG7s+ZWMlCDO/F9iPFZso9l/IkDaMRgxPqe4g8JQa30yg14pdaM7TddgWHxXcUPVgLqvnqyWw6AqrlT0jPV33AekYJb4IlAdfX+6LwR0BVi8Yhg+WO//X5/e68AyLMAawlwCAEwF2BkpTfgqwlu5QU6G45KrdYNsNi9qwAQMgjBnyEDI77XYGcxfjXut1wAhlfSptsGoNHJPab6XkLwTAeAk1MIidp+mJlRJYCqPxCABwizr0aUDl3I/ogEMsDMjJEZp0oYjECWP/HbSA4ACEDWAbA8gJ6MjADWbYP6i5LqvyRROBBABHgjXEAV14k963s7d0koOkm/s+J+FiaERADqbjkAHKNNrsRCoE7lmYsQ0HjlPm+dgMzKRLmQkkgyBJhR/SPWPwPyTJuriWD5U78FHMB7eyJQ5QDaYiBhXL0mgGWumRNQAO/KbieTASMOL8bvVgUSq2/lAvAaOvDiwiEjs6/BThdZ6bUBJNvfuQN0Z+pzVzI09nXqrT3UMRMAACAASURBVJcKg+J6xKAnLao7Tvruc6ZcyBS6EDpUXUIEvgyAz2oTnQuqe+aYzT386d98v69rALZ1AEIAazVgz/4zBzC8aorlAdS2rkIgC4e8v2TxkOsGMLeA45I6vgZ7ygFg4g8JQhOdl+FPZv+ZnRey0CQhE4PtH1TfCBmkXQd+S+1ZXkCTiQZq0gG4sb6qMHSAKFYQHpsIMoDMtKla/syYy5/9Tb0DWGP/7R8QgOUA2NtnzEw3LhRS6hjlA9CK6/gfS4XU5rOk427p9bg02cfATtS9CwGcSsB6/taTf9Zvx0ItvQ2JgH7WgEYyMMA+5AwmHMBMDsAjAhrPTz5M9H4mggy4M65g+XO/YSeAXf1lLYAsBca/24D7MwKdakBIYOUBxKYyJ0BDAeIOTOW2QI75AgVkXNVH7b+VBFTgDisAQda/gd5LrCrlZpa/WXJrEVBk+cGxNWAkqwDMQWiFNq2/zNKgDOi6A2NFICULRAV8rrSN7HgEzmh/NH4G2MZlDi8qXf78Fz8QgNj/thjIcADtvw9HNcgQwGxIwPIGLHTQVj8BfszWmzkAlZsQwFrlPbcCYOUCjBwKKwl6pUBRWyFhukxY7LmO7414X8f61BVY4YLY9iDBhy6BTX6LPJCoPHtcAXelbQRUD+gZEojGZyCvjrv8hV/fOwArBGBLgnFpcGdJYUJ0gNknxLDNCwm8xKEV6xtqPwt4DWpm92kIQICN7bSNF2Xv/pLfUgNd5wxoCEAA34GbqL0VAmhSuMIBuIqv8wGJRUQWmCzAfNIQwV/8tff7O+9BEhBKgEMiUIUAXjLQinMbAAAcCIruFWMVgBPFX28iLhW2Yvzu+JCo06A21wAQm69XRVJwk+RpaiEQCxeQKEDlaWhgtEWQWEqvt7vhwoQDKAFfjR+5hytdgjf20X1HLH/kIpa//GtUCLATgE4CogOQz628IwzslKx0gosuG1bWnuUGotJhyzUYYUIjBSsnoJKVXZnPCAeYo3EBH1UDDIA38CniiBR/CA1I1r5VEQBUg/1XVt8jjG7iWZUD5WEz5UIK8sRagIhYquQQgfqI/a/aeBYKZMOD5a/86r0MCGsApAqQcQDbgTQBMNuqJ70GE/nuOgMSGjDFj7ZZhNABnxBTIxon459Vfa9yYpUEEfRU5RXounEUkJEgGJlEYNb9O2IQ16hsO07y9nk2ETjzJKG4JIKUSlgQKqyDzgzQM22ic/AcxPLXflXSAew30no8eDsJvBGWyhmJsKojQOAOi3R0yRFtPcvuqxo/tf7qeryYv2T/mZqT0IARgfzmG9Eg6erP8Jvr+4Tk4Sk6IwnWfgA/IxsCPhmfKWuk3ugcqENIgLwC+hl1j4Ac7c+CPDNOd4/++q/ccwCRA1iFHkqAtBrA3ICh/J46Yp7AjM+DHIK27t1aA0YIbKGPIisrw59NAOqSH/0NEKyMCBS4qwnAtNpnk4JGnN8pfKYKoIgiA2R2DEYglW1XE8FZQI6AHu1vv8nf+BUPBNDKgFYOgDkAsHdmQhAnkhP74kNDg72OwgMP0CRuN90GW+CTdCwWoVluQKv3EAYQ1cZjuOpv9JXJNyT49KIgliMwlByVu7kJUFwvPBjcQuaxYSuUOBAGZMjGIxEP1BEQn3z/3/oi4gA0CQD4uxAACMBLCKLNjFSPJd3Q7rtJOWu1oZNcHMgmE+8H5T3P3Xj7OlCzCgEeN+sEVDs8Rpu4Ol9ggd1ScuYWkAQIsDv1lrYqB+BZ/2FfsBqQAe3sbZG6Xwn2aGzr3Ja//cuJA8CnAXfr314SajgBkwBwAs6EAwmwWWFChThY0s8iI297B3DDPYRtCLi3Psb2AdRAHrKvqb9BCEyNtaKXS4OkoqAnomXjKUEo9e/GSjqAs0HvAS8C5WzfaNwKES1/95cZDmAlAbIacPudIRcgi4H0oqBuUirgU6WDSVtJsHnJw8gtZNyGWeJLEJNn61vZzYjzo/3dQ0Ea1DgmUXMWAqTAbil9UOaLynttQj+iAzibCCLQRfstUM+ShJiqqP/y937p7gDuex5gBz5bByD23woDMA9ACeCAG8jkCLTis+8ZUhjCAisZOKvwySw/OoWONFWMrmv4ZsWAqX+wrXMGbLkwnMvgIowEIWuHTsV1CTKz978WeViA88IKDzRnA/Ts8TyCcUng7/+SngC2twFZJLBPljIB4IQ1wgA9waPM+rCfJApN9Tae1beOGZ1LO06CEKj7UbF9A7CVB7AShIa9R3Uf1gOwhF9V6S1iEEQFDqFN3my14IJEYNYRTANNERd+PZMMIsXXp7H8g198v68VgHf2uP9dBX5xAtvbgaUUqEqCg/1HKweAlx9vsLeGIlqxchWojCyqY1RCgXK5jxGHofIsD9B+V92nSAgIxCEkgLEGBU8mAaO4PgoVmEJbOQQG1CzIs+08Msg6kAwRzJBOlgiWf/SLRgewksCq8l0YAKBveQAgBGb/t4vDhJQmAwf4a9dQeZPWnJbiHMfgOYeNlAKlx3BFOxs3L6B+LySS8EUg6rzwuEgQ3luBGugDqx/lCzyCGPbtCBBi05M9Io2OFB4hEXgmGLMgzZDEjIvYruUf/0I7BGgkAJWAbY46SUArGThMyAIZVADH2ppEkiCBir2n5xmpu5ME1I5pUH+LYEnFICKEDpiFEADPSSu0JhQX/MphTBFBIYnI3MRjgLviLs48H9OR/JNf4IcAK9bxPwoV9TerAXgj4T0BOJk9MhAQDZOfACUCNgIy0zbTJpPZpyGAQwTiKug7AYkr0L+N991Vf00gpGyHINbK3yZVMQQwVT2xEMh1BEZ/Nvk1EKsKmgXyGeOeTQQdEf/TL3wggNX2b/H//jqwLRGo1gC0HMCeD9AlQPw+WDqZJEZIoCdaNY6OgOmFAVq5u7ae3Y9AHam7sd8kApUsZHaekclAvrv86eoBcwkZkFvrA1hf1wU4Cu4Btu1T/c8G/hWgrxDEmSFDc0D//OdDCEAqADoPIMnA7a8wrv6LpSEFfJlkoQtAdfKShEmAWlUDN7xgOYYE6DPuBY+Lv0W0HRXdK/cN2X6l0jqcsICubbx2AVeFAK7Sy+zV1YDiasAjgH6MvqZth+vXH6sksfyLn/eKAFaw6yoA5gEE9FYScDsZZfsR8CwhSJNb2Tq5UVLsQO0lE5Pk4bqRiBDU/oEcHFVn9X1T4dFZ6TKhYfWZcltqbm6HsZm6D07QKuGRcqQGgEUKSF5N2QySYPutbZkw4SmJwCIIJIXIYSz/8uf2BEDXAWAosN/w7gUhAHwhge7GY2wGBKFtf5oMGKgcl1Cx/wKwKKQY2hWB3oHbqver7ab6J8t/2L9VbaR6sM8auk4gArlRNbBchQnSaBw5RyV7lRCAgSYCerS/otRZwqiMmSECc7x/9XNUDkCvAyB5AAwDtrlBQgG8KegCOsvolQgrgPKcQKTQSReBhOCquBP3a8LTToXF/vpY8ls2J6AdBFH/rNJfov4YDoL6UzVP5gDc8MBJBFbBnwHrWW08EEcqrvhw+5oNBZZ//bMLBCDqb7kAcAJtUQeyOuQDcGIPnzFeJQClSbJqngBULW3xIzKpkBYe3wGxkISn/u5zASwccLbh5NHhht43ELsFcGeFXwfmA1UAdBsZ9YxU/ej+zDkwJ+RtO5Mkmhh9yc+637cKwJ79lxyAlP/kKcC1IqBzAJgL0K4AQwC0m7hgyAsBrAVEaL0HJU6SQKeiyT6dWictOwsTsqW+9ttosAax/pA3AKJBEqEhQLX+T+J2PG9GEIxEPPC6ag/SNzhOtm/fZo3JABYpfLT/KBFU+leUvxHNR37mSAAC/lYBUDkA76EgIYWOAHASKnXHm4/hwaB8pIxIV8oFFpxlziNws/0diSgF91bwuQQmE7QQ+2fUvwO+pf7KkXRA9db6W6QB1+KCHu1qMgTQE70DoTOG24/Y5qMuIEMOFYBXQ4FM++WjP2MnAFUClGTg5gCEAMhy4M4F7JNou/eZ0qBWELD7qO6D0uNkZXmEwKqb4HXI4wzAa8ejLTYSjb5mfXz8jgCvlP86YrhC/ZH4lfpSFU4SgAfMo88TZFxAlRgyY1aI4Iy2zQF87KfbBLCVAAP199YCaBJAV9AlnAxX0NqwnIBSrHSSziAPa/VeJt/ACMp0AY6l1+CNvofqb6h6NikoJMMUHN2apayZNt3YxRwAPa6Tb2iTXj4cVP2MwkdkUQFz5njsGt1tX/rTHghArwHY7P++DBhdwDanYCWgzgPIfh2TtfUB+6QcJhcBedfGUXoGwAaOyXhdKy4rC1rxPAtlymqfjP0x5h6ArVSdARJdiQa6BWC8t3h8RhQ616AnY+cEigRQdREWUZ1NDBnFz4I5Y+OroMf2y5f9VE4ACH50AS4B7OD28gDtxyEVgW6yOIQwWGlg/Uz8bQLXcBoa/AM56Dq8FcMbCTyx/o3ISF3fsvaMWPRv7JLEPht08nC4TyTDb5UNI1VnwO3coaHQFPBKxa0QwAO/G1LAucwA+2oHkDkny2Vs27/8pygCANUXF9D+h2CdC1CA334rcQf7Z7yxsp8qiFpBOKhPQAiW6jIlN9UdzllAKQBjdtxT9eF8HJLQ5xNae6Lska1nSu+pfyMjb3GOlxwEYrHANwA6sO/abdBxyRiPAf4ZoGf6WOA9y0Es/+YnAwHs4JfsP4v/JSEoTgD/is1veYFZEsB+xAp7gDEX0yRU2asQaHX2wD8QjEEsCDKt0pZqM2LpSqaiiNpteCW7mQSgukc4UTWxsH0Z8EaKT/erRGIW/E/pAo6AOdt35+Pxvwf/t0gA8BKQFfzZMiDmAYakoJ4oUB2gE4UtHDLiYQSa9bnsDEhJj4HfdBYHF/V4Vn8gvh3sh9Rfk60ot7c9Uf+Xc80AkDnCNGng+RrnzCa/RS6Z8zXBJDv0ORnf9bHY96Pbov7LV/ykMQfQrQMgVQABvP67//60BKgXA7UTU9Z/mDgk+TeAndjrBtpCBcEF9Wz23on7j1p9TW74mzaH4jgC/Vtri20uDdakzvIDbTL0y1I9Gx+V8CJHgNeTBfIMEXhjz5LDU5HB8pU/ccwByBOAXQ6AxP9sQVBL5EJGF8uByPYDCehJE1UGAuB7JKD3MadA22iFx9DCiPPpeZAFOZWyH46Jk2cDPiZFRX1IvI7XrMdg2fsOvCRsYGMM25QadgC8KAeQIg5BblAajOL26v5Z4DPrb6m95wKWf/cTxhwAPgJskQAu/aUhAIB5+22J9aelQa0uOuFFQoRBCY2Soc4PNBDBMQVAGJ50amqVI8kYOH4F3FTZsyU9EvuLMs4q/NBP3SNT1Y2FPQyQcs0RYYT7JxYTZQgiAmoE/Ki/8E80DgO+RQYe8Nvx/v2P3wng9updALgAyEoEYrY/ejS4katyBegG2OfOEqpSX7s4K0QohgVUpSft+5VgR7BFsb/nEkxScByD/s31pB2IIOMSIETRE9YLF0wiOGMtwcUu4EoyyIAe79uyEsDwIhAsBSrrT6sAuyJ0i4KU6p9CAkpl9boBNuHT7iCw9vThJBJfe8erKrt2IZZjoWSIcTkLCTwVt6oC6nojwLKYvuoWIsUf1DsZRljn7m3PAPcMBY/GqIK8YU/IHTYs/+HHKQLYAd+tBCQkMIQA7L0AQAxo8bbjI1MXPiOIqMJNOgIEly4HmvsUIaUA7oQ0tD/LuBsAzTqC7XosUnAy/MwBZADtKTl1fjhB2aT19j9RCHAGOWTGyII/Gyos//HHAgEo5c8kAbv4X6m+lRDEmy73EtViSEA5pcFOIVTSMHIEAgTLVuvVceXVeFWwO3F+ByIW5zuxv1ZRRqL6d2TK64E1Y/9dIiDWfVB3veqPEcEThAARcDNgPKtNdC6Dw/lPP+Z+fxcWAOHbgM2FQKDsQ/wP+7TSo+qzsiAqk1apLmGoVUor4kTpcCCDALzZen1EQpbNp+QEjgNdiZWxN8t4pCKQUXeLOChZOFacEoFxTmzsYRIjEZwQAnjjRwCL7Hu0PxofLnVc1IM7gzxGE96vWgkAHwUWF8AWAuGDQOyhIAQ/KwPu+9t5KmVvJwXtMHSgE9BQfU0g7oMy2g4byb9ZMFtkwUCMhNDtJ2VDDVoNLBoSEBLpQBYB18kPpElkv9HM1XRzwFB85gzw2BaArX4uoRRAFYG7up+RQYYgKm5i+aof/RACiPK39wAAEbB3ArSq3v4Bl//qpcAa8Nt3QhAM7N0FE7DTSWc4goEUAAwm8Ky1CNYCG69syWr/BJBWLkArvWflL1H/iDwE2I6dH0hKJkeyYtCRFYCThSdZYLuEwo6hCGwGlE9FBsNx//OP2gkAwwBJBBoVgK4SsE8KyQWwuJ8RAoIdCQJvpMXqVnlQA3z4TpRdjsHA1IEo6hss7JFzQQDQYwaE0AHAUmMrSWgAmJKomuRH7D8DmOVWGMAjgHb7T8oBeORR2XcFOcyMyfps2776C/ocwPr7df8rkEMC23xS/0uQLgVm3IBOAHYni1ldneHVcSMJKdbJEYYOQU7BDR+M8VMZeQZUY1tHVNYxlQJnQgJNKNbk9tzGAFovx0CWDXurDkPF1+MVcgBZhzDbbgaoVWdQsftNaIHcNwLQIYCQgCh9SwaC2jfgQ/lPg92qAnQnokIB6gCUcrlVAqNsZqqco+xMtTM2/FTwVxyBofAsvGGgNe25UxqskgxV+ETIkCaCAgFEzkLmqdXuqZ1ARBam6gMAl6/5kSoEUPYfwa/fBNSeBQBi2MZW7wRox8skBgnYTUfgKLeA11O4KDk3gJ0pWzI00BOYxuhOeU9fhwXWqdg/Io7MfuJKKNhBfRrAJisAFJgH1wF4oPYAF4HxyP6oLwN6xhls/f7Lj7jf5dHf9hdeBNoRgJH5L4UB+2TSpBDmBADsCG5U9izYq+Sg25uKqqsJhnJ64JdrcC13Mfan14tAdDL76MhM0qmOFdh2fRxGJBZQoycKI7BkQZ5tFx0v2h+BPw30BrhXH7bweCOA/eWf+kUgFvjxKcChGqAAbuYADCLQ4N5O14j9I/DjftcGe1UDpn7Ogh2LhCrHfyzw098Hwews/aVkkMzkD8qd7JciggNJQItUjoC0CuAjxMLOMzz3r/3h4ADgLcDM+ktOwKwC4HJg9ZmV/RoXWaGBUv1TiYABO8ofWLHwRDLPBd8JCn8quLMWPeMkiPozK5/dNpBCkAPIgnwWiLP9QqAqBc8of6rN1/3wh4VA8gRg9AxARwI7iFgJUCcAKwlBFg50lQIdDoCbMC1rpYKQrBygW+kUMcjkR+CsxvHus/sReCPQRvsR0A74rPCBnXtK6ZVTsdzgYwK+ovaVthE5zCi/8MnydZ+vQgC1AIiFARveINHnJQMbNlHlAbDbiTj7NBmUiYCoNqsiDBNUT+YjoHaSh3Lz3BDBcivedkaSjvqa8X2ypBe+QEQBVl9vBHrmCCi4H7EKcJban00GFcJYvv6H9UlA+i4AXAuAZT/1WWf/LdXv8G6VAQkxlMHPMsJFJ3CJylugstTaU2FPdT3wZpQ9UZ4LiYvU/TswJ1xDRsWZ88v0a0oIFjtDNt7YEQCPEEc0dnX/AwGQ2P9oDkDCAvld9XdP9dEV4I3tbpaenMZ3V2lIn0yCSlv0wyTh1Nkz9p6ppxVGoFU2VV/UOqn+6NKiMbtzdQgmcgRv1P/hJlXdw/C7/dcfajsAifeFDESU27MB+wa5jzoUaOB3LD4SA4v9NVF4LgAnd3ehgeozAHugHianEx6wCR+FG2YeA294whVQYtjvWQRUMw9BlDIkG7b6j4VmVrusOp9s/y0ncJX6R+POAD4kiI0A4L8BQ+Uf3gfg2H/2MBBTfdP+C7vAzdaPAFfIwLSERHVoIoqUBjNKm3EDGVIwx8kAOFLuaL86hkkkxcU/jDgrSh8CUhG9B6iMzc+0iUB7xO6H4EWszLqBb/ghJARgTwKytwI7OYAhBHBcQDYckOtlTmFYABIA3XILbCEJ3QaE1ampsRItHTbsF+mqqpUryCzZzYA/QzJJN+ICPLFqLwPCI/F/aXy5N4YjiRT6akB7BGmd2/INP/ghBGjJPwL+1QnIfGf2X8CuQ4GGEZXoO9UFEOdwhAxYDiCtXE79ngKh2t7LFWTAHwAbSTEKEby2kaqznEHUJ6XmCUJJjaPUdFbFK4CvtI2IprJ/+caVAHQSkD0ObL0MxCgJbnNNqb7+XlX+KATYLlwdky4NZVaRxY/ZcMGLZwNHkCaXCPwZ1bbOBZXNyS0wkJruSKmll1w9CsrHdACzZOBdYwWwYj7CcAhcijf+8o0/KHYAkgzs/u4Trqm+/g7gKYUDRNG7F4jKhTlAbz+SbgNjdz+g0S5yA0wFO5AQAnHVzwOoZ/vPAn8yMeclKSMlPwOspm1nhO2oeRZEM+0qgH8q9d/O8ZtWAig4AMGQuRDIWQ48JAUBkO3eRcDWuQSi+pETQOBSdpxQ/kjJI7IYljkrVXaBlajpZxbqeGrOQEDzGqA8OoywfvdqHP5+IICznEKFSDJOYhjvm35g0QEkFwIh2Bm4w3AgcAJ6MrV5R+y9BpcmCFQl+oOz8MByE0qNu/EK4UDkJBihWHF7Bvz4m5jAJct+I8Wn+6+I1a8YE0k4+OwBtaLwlbYZwIfjrQQwrP4jK/82+6+2y8q/IQmolR2SiNvvqFUc3x/A9jOwESfAgB6BnxGJFR6E9tWbhJ499ey9FUbIhDT6ejadAjwKMbSVtkgxY7kvAOuZjwFn1fvq0CACeAhucGPycejzzT9gdABYERheCLqDUQhh+0qeC2iYNcBvWf4wMWgQhE7+CdHoC04TAlFy0zkY6+41udAJkyANar8JKVIHEBFEspYfOZLIxofkmSEOr82B+H9WvWcIoALaStuILNj+bdtKAF4JUKu+uQpQx/5AFKj6NBwQeiLOYCCxKEegCELb++GHcCoCA2taYHXU0IrtXTJhjsd5kKcDpziDBEEgQZkkg+MBWVigiYjA/T3gZofjGI4kC+azwTszXgTaqwlgHX/5ls97tRRYVL2tADRCgUH1yYKgDofE4nc4VqDG/EGbE0ZiziMIF/yGYlCHYJEKKzviJLaOEWTbQ5CQpN9AAhcoP5JWGaBA8lmyKYHZI+FgldwMeLNhgncNlX0RWczufyAAWQqcjP2tCgACV+Z+t0RYAUmIpAOxEdtHTmDbTybBsHaAnIMmiuHmatcBk9m8iexcEgrqVgP2c6cxvFL+LMii2HkYJ5Er8H6TaeL4ANj/CKSPofiIowcH8P23COBGnwHQhOBVALxHg1l4kCED0mbIEVjqTIhk+4GT26dJIXAF0yGBQR4U6MR5ZNsNTkIRS0mVsa8ir+o4LnF4ZKvPYXKV3xWK/1o4gG/9/ioJKC8E9dyAAXaM75sDANDp+N8LA7p3CyjF1Y5B3xxKEsZ6AVo5SIDYZHMvGRUlqqLseLCSbzunpBVGMsy6hTA0icAWXf9sIjC45irZyPzKuJUjIH4KxR8cwLd+v50A1PMAmOzTnwXTYvkld7Bth5uM+9uBo3yAodKR8uP4HUEQ5dFtGYEM25QCDwQQqVAEzAgcQdx/JvipC4jICX50Cpxk/wzoorCkAsrM8WbHM0WCEGXU9qr9y0oAWwiglH8LCYz1/w3wqvznqr5BDhqsUwuEqg5BkUwHdgOI2yGsx02tHIHcaGd/pMQIbArMRF7hCGAwFMqAxWwTEdys+sO9zJzfjBuoKPVVba8lgGISsFsApElivyE45wdXADdNhwUdlkm8nnYCCeWXY+l439tecgvG5OxuZqSMjnPoJnwWYJETYUoenWOkaBP9M2C2yDML8my72fg/Am2FLKKxZvZvfb7t+77KAWxOwEj8NXUHp7DNb3QBCvwSAnSCq0MAQhiitugOcCzcbsX71qrAri9OXEY21nMGHUu9GnG4oQVncMg2Z8FPSDEFNMcVHemf6ssIidw3a6wsyM9oVwXhUQLwznkQMVIKbQRAV/45RKDJoAHcIQMhiwjUQwjQscer3hYh0BWBxhhCNCzej/ZZx9FuIsolHLbMFUWfAXIUviAY2ecKOUVjMTIoXH8EmAwhRSA/Cuoj/c255pHot33uQw6A5QFku5cLQGAjMSDmLCcw4BImixUaCDCZkntuwGtPCcABCx6nHBJkVDg7qSuvwEoAcQDIBPi9MTIAKyt59rcKyGWWHCr9IvJ4kv2NAII8gIC1Wwqs1wUAoi0yEABrx82UP+sGziCFDsgkHLDyBN1N80gjqCLg+CkQJOPqdn4BUOhEniENVJtE/2x8TduRa/IAmT1WBMSzxomO8yj7P/65r1YCotIPn0m8j28BFpVvwGdkoCRf2/gOd1k3MNgImIEEyBZZYEKJugVrHYEoi3EsTSzu5HEIZCCFyuQPnMIl4If7kgVMtt0hUkOCMj5XgVex7VM2XU3IlEAQxyPDdP0//n3GlYAh+FWs370OXBbbqWSfblNxAlbbsuUPyMLLBeA9YLafTZruB8+AO2vps+32650Flqem4b4T1d881oyreWICqJLL1e2XjQDkjUDkmX+d5WffEVeWE0CBNJU/qfq6f0eQBdVv/Qw1tdyCBWzGsDJGqBIZgiCAzjqK0kQ6A1hnjOGBNUEwIUmd5AAqxyndB0PFw7nkOAY9R5ePf+9XSUBGBAJudAVt234Ttn37xi4ESGyTE0rnAIBtBqwfAD/+Zl68r8nGdA3RykEsy2TtfJYkKsfWk+wM4GavJwnA2fj/CDCPgqzSPwoLov1HSOUVAeBKwGgtgJH80+AfbL8OC9A66Od0gFy0UiuCa+Sjt0cKboYQRGmHsR0w4vmGE0GRltk+AapuIlTbG9dcDh8mxpkCauL6wt/eUcojfY8AUiv0Wd+tc3ogAA/8xsKfDuykTVP2/YO1GlCLNnUCiii0Cpu7LUfgjUf2WTG/JgXLORwFtbkE2VLQRNKPTgiHjNKASBw7PZZ2J0Vnc+Q4ugsk6gAAG0BJREFUVVKKQH/muZxKCp/4Xv3DQGLn0fI3sEerAPVTghAaaFyllgcDi1Asq43t6yzwI2IIKgHiOFKWjZyjZ3XZBMuAOJqYbTJVwwuDfIb/l8FR2cy5VX6Ts0HmZdunz90i7eClJZnjZdoMv1EjAMcFbLiYAT+x8TpX0DCeAHPXxAA5XTug7YiW7on9NPYPwgLtEEKiSNjcTg2y4YSehCeBv+xUZid98ne5khCmwHaQDGeOGfVZVgKwqgAiiBH4U2XAfTCco1qxNcAZxiOAm+J/kSvwEoYU4Anl325ath0hr5BYNPDYq9Sr4LzY+reJfBZZVa/vhPYRGGf2Z/p4bZZPfM++CmCFAF4YIETR/upnApw3AqUJAQ4ShQPD/ovA3wjdANDwwxvKZbVjN45uSwI427eqnIywpsbIKOT7iAAy4Ix+p5kxMn2kzSsCCKoA+AiwJoOOAJTtF8vPSAK3NSFLhAJdPwLuTKiwHc8jhsx+1YaGBSRxJdeadQgWETBVTJNG0mVEE3TbXww9yg6lmPzL/gapawNSitpXgIdcF40783tlzmUd94EAEiVAuc8m+HWOoCH61fxAy19R/mplAElHicqrryeD3wM1fVkpm1gBkOgxHEV0gZA4VnpiFlQ5MzHNNoXjpM+9APBozKuI59BvpgAwJgE/B0KA6CWgrP7vZP4bWcBJZJYEI1FYQuzlAtw8gTFg2jXs12I+diz7gQA9tu/2GaRkOQvrfYapiZgNR6znyMn1zQCkpG7GOZfG0PenQAAZIM6cS2bcq9osnxAC0C6AgH14+Ie9EIQQwoY5FRo0HAbbKY5In3Yf2QtHEGVWiGEAVhHow1cHPHgeJnAZqAIll3GrSUdKBkdyBmQF41WTsxv3LMK6mAAe5bdwSKt6/AcCMEIAmevrbz88A7Dv1CofVQQ66w9ftAJrMdSuAHD46ucIiEGDeRDcKCwgB43KgZYa47l4biIav0QyybjfOufhWGcRiQHK7nivKQFUATcQ+Ylgnhl7+cT3sEOARgDO038dATjZ/w74AKTM9q05AScjBY8YEHRVy4/Kr4mEKZXbRnaSa/IAvR3HISk3CZkkr3AMOPeM3c2SiTtWAfyzgDyz3+xYZ/6e6XPoCMBZ9tuAboB8cALKIbT5x54H2CeVBrkGOHUFHjFQNlBJ6wnVZ+AWgogA3Fg6cVymuJ1zME/kYQdT0CwgXTUpEFdmUodtCgQQjrVf2NXtMuNn2lTu18x4rxyACgO8sp+n+ts+A+Rs+a+0Z1jFfXS/ASLLGQxjJEAYlgpn1FwdN0UazloDD6wR4aQVH4GTPP+ZCUkn/MmhxtWgsu7H7O9x5fkun/hsFQKw5B+AGsGfjfc9UrDIYjukmmjatlv4taoAFduvyccFWYJIvOSdFvIo7s8Avps0ScBaE606VoVUdFvL9byO4Inc2PvhnEcC2CfL+mf7p+P//ar1dgTsEA7AmJ1gFrZ36k36tXEjV8CshFwT3tEsqBPt2rDQNqX68GNl2kfEUQGmpcQR+VSOkQJIQf2vUMorxkxdd1R+hbl6aLzmAMhCnuEZAKPmrxW+EYAFcGtpsLM9dATgUrSiMvLQbSruYArQCaKIAJxyCjgxnGN6hGLuyy55npicFuEcJZSjAD7aPwvOK46TGfPBAej4nz3959T8B8VXYMR5aK4HIACOLD8DLZvzlp2nZiAB1G1+J9pVbD8jrdR6Awts5PymQL+Pf6j6EBCCNVHN/7iV/lgq6XkWCcn1k2NmwX2UxLLHyQBeLkPGXD7x3cccQGbdP1P9UPmt5CAAqiMLOVvD8re2XkjggHXASALUWfAzl4BzKLT0wblk+kdt0vuNc6lMbBPkhtU9tMpRgfUogGaApfmi8lsdPd9S/44ASLyPQEelZwlATQqIPU/56ctB1MtEGI61slP1NybvU4LfELBXmxMZfzZGxnGkQY8HgB9rxkVM9XkK0imqfYUYqgRYAnHBEelxXzkAJwcg4EOFz9p+5hSasBPlZuGCMgIPIkwmiN50RjWg+22zDsFxHRnwR21cEKtzjADvTUx0OzMgjsY2VbEI/iq4ps+L3JiKslfPszJ2pS2exwMBZHMA+8Re709HAGxxELTtnACgWZNIa5ew/APY9c0xngno+qlBXHxfDP7tBlaOwSZjsn+GFLZJciAMOUQYRQI4dKxHBvWVJDAz9vKJz4rXAYjidiHA/sPRtQDWE4LGOwIt1e+2KxvgEsD7DPyotNPqXwQNO84ApIkxI3IJwXryMcPjnUAAVeCd1f6MaxsJgNX9WXjgKbzlCIwyX7vn3jJhpZCUAGBjRBCKTzjukoraOlfbp04iooTk04mFic4I6QiwvQkvp+XlL44cewYkZwF0uDZ1D2Ztu76VR8ZZPv5ZDxpOwwDr+X9P4ZV9b66B2HodRmgXnHEGrc8Tgz98B4GF4wJp0Bud7B+BqDu9fcxMn6hNaT+5llL/IsnNkMNMn9eZUDYC0M/5I2jXzxqowzaw9l1bZzsCl1p9I1zQJCHkhffeVH+HJBgA9HwysZYE4TA/Z/sZziECi+clPAXOKg62y5xLFHJMjZFU2ciVnA30GRJ4jD7Lxz/zVQ5AwFVa/rt3osAv5gIQ3A+25OFuenbefV6AlBLZeBb4U/hMNSLQC8gonPyzx7Xq7gapyObwfKJx4SfIOJmzjveYQM78VlW7PktU2eseCSCI9wegW5Y/SQwakDpksPYLM1juofVTQHFxE71NKGkJQmyGDTyt9qsFGeCYo8N5ZcfJtnMnsvo9smNm2mWBUHU50bFnjvvYY67H6wiAvvLLyQPgk3xWqKCFRZSdAbdti5KBilws8YrcAd70cgxfJYtAYQPI97uPEog62DbxCmNGE7UKJjx2duwz2kVjXLl/hiAihzEz5isCCFYByhzRCj0A37H92xjE1neuwtmP/V1nQBYKWfMbQ40MCKvtD5EMO6ErgBqMGQGBnWa6z37sdPujoUYUipy4f9a+R0A/c9zl277bXgXYRQABjsDUIK0Anym7DiW0m2CCaS0ZHsggafuzYO6GSwCQNkn0CwnojDESYUwFjDjcTL9osVHZTTwigCMgvu77txCAEkCy7s9IAcHI3IIGNoJwIAV0ppmwYD+4xgn9HoCpAuIQl0aDsF9nH0J6KDWo2v5DKk86zxy/QjCZtq9Tm+hcrtq/EUCn9M4LQIYwYL+x5mpABUgK8H0jgmH47IC/U38Sl1fBnwV+GryzuYILwd+GTl5ENPmyzNONkzx2xg7PklP2ujLtHqtNdJxov3YljQBEibW1t7Y34CVW/Wngt3vv9MXxB4sPd5w5CBY+6PESTvihCUzU7JzF68uCwzrnSnKudCx1MZmJUxo/itWTP+bMeWX7PEW7s46ZGSdq00IA+uYfou4DkEG9vX2W7Weqz8gBccjcAQNPRfnNuUjcCQPB6a7BZIMqBI32SfBVjhZNtm6sxPFL48HglX5XtM2OeWa7zFhWm+VbP6NPAgrYXOX3VH8fwFT9qEqg+rvq76izRxQZfEVlQXcOJ4nDBdgZY6TZKoZ6ZpLFo4iq8JZHj1Htf1X7K8bNjDnTZiCAyPLPxvs4LnUEiaW/HaifCPyReEXEkSGfM22/nO82OaKTTyP4QMOLQo/M5NdnfXWf6viZ9pk263Vm2m0hwOoAUK3NxUCBsrvEkFH9YI1AN3+zFYHki0M6UBog8bCDYcth0SUHOgW3pwxyAPiJ9wvMjp6Z7Gzsx+pXPU62/RntGgFYyt/IQVnS9au3DwHL6vc6RIjWASDIBntvOMvsSkAPwBZuuu0HQBuNUwUFPd+LwZ+diFc4kPSxyQ/52H2rx6u0z7bV7ZZvkRyAEddr694BP3IFmXyAE/NHlt8iAv2fjXju1wJ/Cvhq4AzOzDZO58y4mXxClUxObX/4IvqzyU547xqOjnGkf7VvpX2p7bd8eCIJKIpLXAFTfq322jl0feCOee00qC2HYIHfUt408GFgb26n5v0JawVmiOVUgHuDpX6E+GwqEzseLRcnXz3OzDVV+3jtl5UAEKAIOhO40WO+mZifOA5KBEG7DuCJhUADIcDkZPPUJIQDil21/dP4KXYsNs9g46HNgYGrkz1/UucRwHrMo+c527/abwwBdgLoSIAou1bjSNU98jD/81Ct/t7/IyAuRPocAH9F9be2pEM0x+l+tTEag03u11H55Zy2yTZzURUUH2xbBVDmcEfGfOy+yzfrEMBaCrzfTAbsiBwyYcGg/oSEAOu9sKi2oe2fUP3WJQnacN4XbH84lp6VB9xJZoKn25RPPD3yaQ2PAC5zEkfHP9I/03cjAAbgAegHFv9YBMEsPyqsPgcNbNaWgb+bh4QsNLHgjWV9Q4IxZoZFIubxghmWcRWZSVrgj/xwb8Df/VYZMEY/7hVjPBAAgIIqvKHGkfJ3Y0UEsl99+L4AaQcoxLmm593Z4Gfz2pvrw76kg5giBXIiV+EwHDdsEE336/efAaiZszzzuEfHWr7508k7ARXIEMjMGZhKnnkpKGnDxhu2ESWfAX8K0Jn/ZwBmgjn3E7Y/i5uIWDITM3uszFgdYV01cPVEgvZHwXP0dK46fmXc5Zs+nZcBN8BFqn10v7H8V5NMZ7kTVYHBoicBTMkgqaqhC3AaRHiJ9m8TccJZeBM4dUw2wIHrjABVmdjkJ2nDV8eJzuus/VeelzX2RgCDwnuLghxV74CbedQ3Uy5MvBQkUn53P7odreIJUFnzvdueGKdq+b3xLwF2NqE/zRxnweiDNc6VpLD+Uo0AGnjBWg92f6dVur2yNFhA59h4nEfb5+T6fw2MCPxU9ZV8mG3UXKNzn1yjnqIRZtz9RXIpinaIplkiCgd+08D9Bc4ihuUbMQRQkzXrDBAv4UNBcllR+IDK/Ejgb5MZZnVEIJ7V9J4M9EAdEUI7ZqZhVrkzZJawFslTegPvR/gFMiSxEYBW2PX7oPIROWTe+JsIHzoygS/6fDTwjiq/Bv8s8BmJAOfR2x6BxnMW1dDBIyxrTkbnt/VzGqX6PwIgjhxCX0MGXEeO9xh912t4IIAo5nfAj2o0kAaqeDLb341hHNcDf/QEoAvsI8lCA4nW5D/iAE5558ABxR/O/SDCD3a/DCuZ83q/E8HyDZ/mVAF2pCEoKcizdj5DJEIaVfAnlgJXwT/lApxS3wzoM2DLTNSK8mfHE+UvtS/A9apxM6fwlMeW81vJ5WrnsREAA/W2LQHsVMyfGKez/gr8Q1ignEXm8V8PzFXXYIHJUmY2mWbIwPq/EvWEzkzeTJuQNMgg2XEzIJwJb6rjHgp7zjrYI43D3MryX8EBWHZ+VvUtEmGAbseAGUSPWwT/2apvglntOAv0bRwDWRnAXdYmM/BkEvKpgZm8tEeC7nWH6QhgRvVdkColt9rKcT1ioC4gsP0V8LttjUnMwFkBvjXJhu2EFGcBEk3saL8cN5uHmD3PaMpnzzMax9v/GMc4cn5n9N0IANXXBWnmPQCi0Enwb8AO2mbAXwFw1fJXiKQBxLg7FYJAR8aGiyboZfvVwNFxMhN1ZoyZPplzie5hZYzXve3y9RICEBAOZJAEdQnQxpiuG3DWBWA//RnJhu5TdyskFTIDKwBPtU2qfwQGb3/Ut/utEo0TTUxczPSd6ZMF5pVjZ88hanfkHDcCiAC7HSAqFQJthi4icAlU8YMyImPtAcAOmLBtCHzCHikwR6GEvtMnVxQY6ZFD2vMt8TDTjFN5yj5Xgisa29t/BNSV4y5f/6nj04ADABNZfI8kqJor5XcVPwF+D7RybimSgF/PHDNQ5YhAPCC2vkl3EYF6VvlpP7VxZpJW+lTasntbAYLVduYcKse9evzoXJav+9RX6wBkMnUKfgH4U+VFDcTkcmANCAR/SBIF8M+CPOUUCDnijZwB9UyfDlSJmZpo0s3HTPtMm7McRMkNRcgK9s9e18HDDt03AugArx7qMfftQ0XKP+MmvD4U4HguhDi8PpV9mfUGTJFToJdrMGaGNWHO2u46iYCQjgAwC4RsuyxRZoA0c8xo3CvGjI7p3dvla4kD2Dqom06JIOsOEs8A4A9jOZCzwV9yBKpxBtSZNt01JY5h3cwzicA7p84VZGZech1AFhjZdjPneYTIop+iet7ReGed60YAFuBc9T8R/IPiF2N+Rh6RWtM+xEmIw/EmlEckacA6KnsGuL0JaO5LJv2ykztqF+2fBXV23LNApcc5cnyPCM4Yd/kv6ACyoM62q7wSTD+BaDiQlAuYLBNSIBeAGRGBSQbkTlZAf0bb4dySbqQ62TOTNtPGDVkIarJjnkkCR45Z/V1nHMPa5xUBwEQ/TfnhF3DHJC8TYa7gKPhLqg8Hi4Bd3W9ZbDZhzgB3ZYx2bs7szUzsqM3R/Y/pBqJzPZM0HgP4eD0bAaTi/WxeoBDvD6SQIAzG/K1bslJgEUF3o48+XUhi32EiFev8WYKYAjzOPBCDSFkicHj7o75Zlc+MQy4vurS2vzp+9ryvtveZ81i+5lPGMiBT3zRJ7J3Tig9UHvVxHYC6SxmQm22csVwC2q8lcgTbGGRWHQF4tq83KbYxjNkegWAW6NG4mUk84wYyx50Zt3K+FgFUzu2o+9gIIALeVeBHuxmdQxb8VeAP48IAEZCn9zvHsCZQFuDZdvQ4CeWPJudTE0F0fjNOoDLmEQKoHmfmWjRhLF8dOQA1KVygFpKDrwP4B7IwgDkNdOYIDJBlgXt2O7wPenJEE3IG7DN9qhM9Ou8rx5slgMo5zzoT5hY2AjBBfTL48cfZhs6+OhzOvANtArBpR5AA5mEiIHc5GjPrCLLEcIXyW5O3uj07sTNgybTJgjU7Vna8KtEebe/1X/6z5QAmwT+AnL1g9CD4hTzcsMAiDba9mPCLQEv3G2RlTfoMoDNtvEnZ+quBZlR6Buwzx7lCvTMAz7SZIYDsuFlyZCrvnddGAIMDCMDfgbxCFIkKgUcg2q6m1X3/VWj7yTUD7Ec1iSHhLrJEcAT0dLIVKxHRRKwSQQSAq/dH15PdX2030z76LRj4oz7LV2kHQJRqIAgB1GOD31DRChF0bR3lM8GcKO91fYvuwmJr73y8yeQSRlL5zwL1rOJHk/jo/oxyR8e4GtDZ41fPoyeAQhKvVBk4Q/kD8FdIYLvhCTLxQozIAWzDBwCLQB3tj87BnQwTyl8hgkrbzKSNAHD1/gxJZNtkrhfVPLo2rfyV9hsBlMH8RMpfBjn8MpbyZ8asEEEbT/1GFZWOgB/tD13EBcpfBfwVbiCa+FfvrwA7OpfKWLNksZ7D8p8+lFwI9AS2H1U0A1Rp47YlwLTaTwF/7xSB9Oj+I+pfeX15SCYGyWYm5etGAhlQPmabqxwFjrsRgAaO+f0k5ccTcI+dBGuaHJLjReByCSNQ16PAj/qHgIUBKqrN2h7tH6ncFQQRgSoCeLQ/Gj+65gxxasufPSZrt/zHrAN4jcCfBjyG4RPPCZQdgAOuCLgeqUSEFIIeZt0VQD46pjeBryCBCMRX788CNjqPCplYx9wIIHQAB8GfVvwT3gNAgTQBflflme0l7qJCIDMgzwCvtQmcSZpECi82rTiECBTVsWbHi/pl9kdtzgT20bGW/xA5gNcc/K4bOAh8D8DdD3/kPygplhVLoL9Q+TPnESlUFdTV9rPOIgLw0f1HQRv9rjpE8I63EYDpAF5D8LuAP2j5o7GpSkMn/UNXvlfaZtxCa3Oh8lcAWWk7C9yzjpEFmAes2X3ZY2dIKNNm+feWA3hC8FeASNuS9QxZNbeOTfur38i6edkxI2BnVFc7kyPWPnO8yvhntI0m9WOSwBGQRy7g6P4skWwEMDiASfDjzTFdxX5m3f4CYCNyyCzwicZIkQUBv6fiFYWvtDVB9cjKnyWLqrqfBehZsM4CcbZfFrjR+BFRynGWf6cdwCT4GahSJBCAPwJrtx++6GOnQK3icVO5T3p+oAL0qG13fYScvImVAW/p+CoIzYxfPb8qkUSAuIIgZseMzjWzP9NmPb+NABpYXgPwlwAPE02vZjwT8BHJsMn7ZG6AzLoMAM9qU7H5Z6j7GWNkVLd6nCwAFVe2r5HCn7V/+crVAVSeAUALbyjhrPJ7LsIC9NaHKN4lDsBQVtMpOI7CIyg2ebxjzKr/DOgzfSok8NhtI2CeCfQjID3SN7pG3L985cvEOgAE/ZFXfSceCio7AMO1uIShriflFhySqQL2DMKgx0yofwbAnnupALYCpsx5PUaY8H4ILSoAjxzG8hUvi88C7Ee3VB5PjrZJuA02BgVp4EBSwM7E/cn1BBVV90A2tQ86RQCOCCuz/ygRZAF/lETOBLSnypXz9Igssy8igIp7WP7tTgAhcCfVuyOBE8DfLq4A/shVuERhAGsKpBeFBNH/gmRNqogoov2PRQJHj/MYJDBDDkeAPHs8fcxGAJaiVwHMwLZtS4Df7Kst+8HKgQX44fj7hizYz24XKbH8rmjzItAe3R+dU9WmZ53AB5UEZoE8228ggH+TdQAFADMgpQhGAZ0SAlHkSOGj/VZ4MRNCZPvMtuv6JQgqA9gqKWTBmAV3tl32uGcpvgWy6vZZpT8L5CgQlAA85a2qtwZ6RflDB5AEfwT4aL+21Fb7LIhn+kfAzfzHIhVgR22j8zmq/BVQZc61SgKV41fH9n6bWXI4q9/y5SoJiAMfBb9Xm7ccwXB8cQVE7QayIW8groI0s5KwOmYEHm9Cm/suUP+MEp/V5oiaV8B6VdsZEphR9Jk+FXLYCMAE0oTtb2OpCZoBq+kAjLFMsgDP4x33TOsfugohMnJuEUEM56lmRaSIV+/PnP8RwGfHrxzjyrZnksPlBPBlRhlwxrpnwW8CnWXJC0RymBCS5b4zwV5Wf+hwBNhH+lqW9rHdwVF1P9r/dQZ6ljiWlQC0SjIbPLRRilYFv0cC7Yc9WOrLAFWf94y9n+ljnZurdie8YnzquMS9PAUJHAVshqCs63oMsFeuzzvPaB8eZ/lS7QCU4jJVNckgUGurH1XuiVJfilSYFTdUtUIgR0nA67/tU7OjouBll2GEKVnQZ4EWXUPFps8es3KM15EEskoPt3T7KP02AojUO0UCk+CnoCWAzII7Au2w3yG8o6COzoUBioKCnKPrFBjJqRlQcQLVY2WJIjNuBaCvIwlUVX0G0NVjdATwMXEAAYBdEnhC8Ecgc/efGPNH5xFNdhOQRdt/ptpHCh3tj675CFE8JTFUjv2UriFz7GUlgOp/DNKRwUHwdxPfUeMjDoCCq5BfOOoEZvpr2x+BLavolXEyAM6obnTMzHEqoMuc09HxKv2rbTPAVYZO/ydUbXfkKP4/BnecprBuissAAAAASUVORK5CYII=",e})(),Ta.TextureTools=Ea,xa=$a||($a={}),Pa=(function(){function p(){this._mode=p.FitFrustumSidesMode,this._radiusScale=1,this._positionScale=.5,this._defaultElevation=.3,this._elevationReturnTime=1500,this._elevationReturnWaitTime=1e3,this._zoomStopsAnimation=!1,this._framingTime=1500,this.autoCorrectCameraLimitsAndSensibility=!0,this._isPointerDown=!1,this._lastInteractionTime=-1/0,this._animatables=new Array,this._betaIsAnimating=!1}return Object.defineProperty(p.prototype,"name",{get:function(){return"Framing"},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"mode",{get:function(){return this._mode},set:function(e){this._mode=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"radiusScale",{get:function(){return this._radiusScale},set:function(e){this._radiusScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"positionScale",{get:function(){return this._positionScale},set:function(e){this._positionScale=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"defaultElevation",{get:function(){return this._defaultElevation},set:function(e){this._defaultElevation=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"elevationReturnTime",{get:function(){return this._elevationReturnTime},set:function(e){this._elevationReturnTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"elevationReturnWaitTime",{get:function(){return this._elevationReturnWaitTime},set:function(e){this._elevationReturnWaitTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!0,configurable:!0}),Object.defineProperty(p.prototype,"framingTime",{get:function(){return this._framingTime},set:function(e){this._framingTime=e},enumerable:!0,configurable:!0}),p.prototype.init=function(){},p.prototype.attach=function(e){var t=this;this._attachedCamera=e;var i=this._attachedCamera.getScene();p.EasingFunction.setEasingMode(p.EasingMode),this._onPrePointerObservableObserver=i.onPrePointerObservable.add((function(e){e.type!==xa.PointerEventTypes.POINTERDOWN?e.type===xa.PointerEventTypes.POINTERUP&&(t._isPointerDown=!1):t._isPointerDown=!0})),this._onMeshTargetChangedObserver=e.onMeshTargetChangedObservable.add((function(e){e&&t.zoomOnMesh(e)})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._applyUserInteraction(),t._maintainCameraAboveGround()}))},p.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null}},p.prototype.zoomOnMesh=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var r=e.getBoundingInfo().boundingBox;this.zoomOnBoundingInfo(r.minimumWorld,r.maximumWorld,t,i)},p.prototype.zoomOnMeshHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null),e.computeWorldMatrix(!0);var r=e.getHierarchyBoundingVectors(!0);this.zoomOnBoundingInfo(r.min,r.max,t,i)},p.prototype.zoomOnMeshesHierarchy=function(e,t,i){void 0===t&&(t=!1),void 0===i&&(i=null);for(var r=new xa.Vector3(Number.MAX_VALUE,Number.MAX_VALUE,Number.MAX_VALUE),n=new xa.Vector3(-Number.MAX_VALUE,-Number.MAX_VALUE,-Number.MAX_VALUE),o=0;o<e.length;o++){var s=e[o].getHierarchyBoundingVectors(!0);xa.Tools.CheckExtends(s.min,r,n),xa.Tools.CheckExtends(s.max,r,n)}this.zoomOnBoundingInfo(r,n,t,i)},p.prototype.zoomOnBoundingInfo=function(e,t,i,r){var n,o=this;if(void 0===i&&(i=!1),void 0===r&&(r=null),this._attachedCamera){var s=e.y,a=s+(t.y-s)*this._positionScale,l=t.subtract(e).scale(.5);if(i)n=new xa.Vector3(0,a,0);else{var c=e.add(l);n=new xa.Vector3(c.x,a,c.z)}this._vectorTransition||(this._vectorTransition=xa.Animation.CreateAnimation("target",xa.Animation.ANIMATIONTYPE_VECTOR3,60,p.EasingFunction)),this._betaIsAnimating=!0;var h=xa.Animation.TransitionTo("target",n,this._attachedCamera,this._attachedCamera.getScene(),60,this._vectorTransition,this._framingTime);h&&this._animatables.push(h);var u=0;if(this._mode===p.FitFrustumSidesMode){var d=this._calculateLowerRadiusFromModelBoundingSphere(e,t);this.autoCorrectCameraLimitsAndSensibility&&(this._attachedCamera.lowerRadiusLimit=l.length()+this._attachedCamera.minZ),u=d}else this._mode===p.IgnoreBoundsSizeMode&&(u=this._calculateLowerRadiusFromModelBoundingSphere(e,t),this.autoCorrectCameraLimitsAndSensibility&&null===this._attachedCamera.lowerRadiusLimit&&(this._attachedCamera.lowerRadiusLimit=this._attachedCamera.minZ));if(this.autoCorrectCameraLimitsAndSensibility){var f=t.subtract(e).length();this._attachedCamera.panningSensibility=5e3/f,this._attachedCamera.wheelPrecision=100/u}this._radiusTransition||(this._radiusTransition=xa.Animation.CreateAnimation("radius",xa.Animation.ANIMATIONTYPE_FLOAT,60,p.EasingFunction)),(h=xa.Animation.TransitionTo("radius",u,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusTransition,this._framingTime,(function(){o.stopAllAnimations(),r&&r(),o._attachedCamera&&o._attachedCamera.useInputToRestoreState&&o._attachedCamera.storeState()})))&&this._animatables.push(h)}},p.prototype._calculateLowerRadiusFromModelBoundingSphere=function(e,t){var i=t.subtract(e).length(),r=this._getFrustumSlope(),n=.5*i*this._radiusScale,o=n*Math.sqrt(1+1/(r.x*r.x)),s=n*Math.sqrt(1+1/(r.y*r.y)),a=Math.max(o,s),l=this._attachedCamera;return l?(l.lowerRadiusLimit&&this._mode===p.IgnoreBoundsSizeMode&&(a=a<l.lowerRadiusLimit?l.lowerRadiusLimit:a),l.upperRadiusLimit&&(a=a>l.upperRadiusLimit?l.upperRadiusLimit:a),a):0},p.prototype._maintainCameraAboveGround=function(){var e=this;if(!(this._elevationReturnTime<0)){var t=xa.Tools.Now-this._lastInteractionTime,i=.5*Math.PI-this._defaultElevation,r=.5*Math.PI;if(this._attachedCamera&&!this._betaIsAnimating&&this._attachedCamera.beta>r&&t>=this._elevationReturnWaitTime){this._betaIsAnimating=!0,this.stopAllAnimations(),this._betaTransition||(this._betaTransition=xa.Animation.CreateAnimation("beta",xa.Animation.ANIMATIONTYPE_FLOAT,60,p.EasingFunction));var n=xa.Animation.TransitionTo("beta",i,this._attachedCamera,this._attachedCamera.getScene(),60,this._betaTransition,this._elevationReturnTime,(function(){e._clearAnimationLocks(),e.stopAllAnimations()}));n&&this._animatables.push(n)}}},p.prototype._getFrustumSlope=function(){var e=this._attachedCamera;if(!e)return xa.Vector2.Zero();var t=e.getScene().getEngine().getAspectRatio(e),i=Math.tan(e.fov/2),r=i*t;return new xa.Vector2(r,i)},p.prototype._clearAnimationLocks=function(){this._betaIsAnimating=!1},p.prototype._applyUserInteraction=function(){this.isUserIsMoving&&(this._lastInteractionTime=xa.Tools.Now,this.stopAllAnimations(),this._clearAnimationLocks())},p.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0]&&(this._animatables[0].onAnimationEnd=null,this._animatables[0].stop()),this._animatables.shift()},Object.defineProperty(p.prototype,"isUserIsMoving",{get:function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},enumerable:!0,configurable:!0}),p.EasingFunction=new xa.ExponentialEase,p.EasingMode=xa.EasingFunction.EASINGMODE_EASEINOUT,p.IgnoreBoundsSizeMode=0,p.FitFrustumSidesMode=1,p})(),xa.FramingBehavior=Pa,Aa=$a||($a={}),Sa=(function(){function r(){this.transitionDuration=450,this.lowerRadiusTransitionRange=2,this.upperRadiusTransitionRange=-2,this._autoTransitionRange=!1,this._radiusIsAnimating=!1,this._radiusBounceTransition=null,this._animatables=new Array}return Object.defineProperty(r.prototype,"name",{get:function(){return"Bouncing"},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"autoTransitionRange",{get:function(){return this._autoTransitionRange},set:function(e){var i=this;if(this._autoTransitionRange!==e){this._autoTransitionRange=e;var t=this._attachedCamera;t&&(e?this._onMeshTargetChangedObserver=t.onMeshTargetChangedObservable.add((function(e){if(e){e.computeWorldMatrix(!0);var t=e.getBoundingInfo().diagonalLength;i.lowerRadiusTransitionRange=.05*t,i.upperRadiusTransitionRange=.05*t}})):this._onMeshTargetChangedObserver&&t.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver))}},enumerable:!0,configurable:!0}),r.prototype.init=function(){},r.prototype.attach=function(e){var t=this;this._attachedCamera=e,this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){t._attachedCamera&&(t._isRadiusAtLimit(t._attachedCamera.lowerRadiusLimit)&&t._applyBoundRadiusAnimation(t.lowerRadiusTransitionRange),t._isRadiusAtLimit(t._attachedCamera.upperRadiusLimit)&&t._applyBoundRadiusAnimation(t.upperRadiusTransitionRange))}))},r.prototype.detach=function(){this._attachedCamera&&(this._onAfterCheckInputsObserver&&this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._onMeshTargetChangedObserver&&this._attachedCamera.onMeshTargetChangedObservable.remove(this._onMeshTargetChangedObserver),this._attachedCamera=null)},r.prototype._isRadiusAtLimit=function(e){return!!this._attachedCamera&&(this._attachedCamera.radius===e&&!this._radiusIsAnimating)},r.prototype._applyBoundRadiusAnimation=function(e){var t=this;if(this._attachedCamera){this._radiusBounceTransition||(r.EasingFunction.setEasingMode(r.EasingMode),this._radiusBounceTransition=Aa.Animation.CreateAnimation("radius",Aa.Animation.ANIMATIONTYPE_FLOAT,60,r.EasingFunction)),this._cachedWheelPrecision=this._attachedCamera.wheelPrecision,this._attachedCamera.wheelPrecision=1/0,this._attachedCamera.inertialRadiusOffset=0,this.stopAllAnimations(),this._radiusIsAnimating=!0;var i=Aa.Animation.TransitionTo("radius",this._attachedCamera.radius+e,this._attachedCamera,this._attachedCamera.getScene(),60,this._radiusBounceTransition,this.transitionDuration,(function(){return t._clearAnimationLocks()}));i&&this._animatables.push(i)}},r.prototype._clearAnimationLocks=function(){this._radiusIsAnimating=!1,this._attachedCamera&&(this._attachedCamera.wheelPrecision=this._cachedWheelPrecision)},r.prototype.stopAllAnimations=function(){for(this._attachedCamera&&(this._attachedCamera.animations=[]);this._animatables.length;)this._animatables[0].onAnimationEnd=null,this._animatables[0].stop(),this._animatables.shift()},r.EasingFunction=new Aa.BackEase(.3),r.EasingMode=Aa.EasingFunction.EASINGMODE_EASEOUT,r})(),Aa.BouncingBehavior=Sa,Ma=$a||($a={}),Ra=(function(){function e(){this._zoomStopsAnimation=!1,this._idleRotationSpeed=.05,this._idleRotationWaitTime=2e3,this._idleRotationSpinupTime=2e3,this._isPointerDown=!1,this._lastFrameTime=null,this._lastInteractionTime=-1/0,this._cameraRotationSpeed=0,this._lastFrameRadius=0}return Object.defineProperty(e.prototype,"name",{get:function(){return"AutoRotation"},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"zoomStopsAnimation",{get:function(){return this._zoomStopsAnimation},set:function(e){this._zoomStopsAnimation=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationSpeed",{get:function(){return this._idleRotationSpeed},set:function(e){this._idleRotationSpeed=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationWaitTime",{get:function(){return this._idleRotationWaitTime},set:function(e){this._idleRotationWaitTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"idleRotationSpinupTime",{get:function(){return this._idleRotationSpinupTime},set:function(e){this._idleRotationSpinupTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"rotationInProgress",{get:function(){return 0<Math.abs(this._cameraRotationSpeed)},enumerable:!0,configurable:!0}),e.prototype.init=function(){},e.prototype.attach=function(e){var n=this;this._attachedCamera=e;var t=this._attachedCamera.getScene();this._onPrePointerObservableObserver=t.onPrePointerObservable.add((function(e){e.type!==Ma.PointerEventTypes.POINTERDOWN?e.type===Ma.PointerEventTypes.POINTERUP&&(n._isPointerDown=!1):n._isPointerDown=!0})),this._onAfterCheckInputsObserver=e.onAfterCheckInputsObservable.add((function(){var e=Ma.Tools.Now,t=0;null!=n._lastFrameTime&&(t=e-n._lastFrameTime),n._lastFrameTime=e,n._applyUserInteraction();var i=e-n._lastInteractionTime-n._idleRotationWaitTime,r=Math.max(Math.min(i/n._idleRotationSpinupTime,1),0);n._cameraRotationSpeed=n._idleRotationSpeed*r,n._attachedCamera&&(n._attachedCamera.alpha-=n._cameraRotationSpeed*(t/1e3))}))},e.prototype.detach=function(){if(this._attachedCamera){var e=this._attachedCamera.getScene();this._onPrePointerObservableObserver&&e.onPrePointerObservable.remove(this._onPrePointerObservableObserver),this._attachedCamera.onAfterCheckInputsObservable.remove(this._onAfterCheckInputsObserver),this._attachedCamera=null}},e.prototype._userIsZooming=function(){return!!this._attachedCamera&&0!==this._attachedCamera.inertialRadiusOffset},e.prototype._shouldAnimationStopForInteraction=function(){if(!this._attachedCamera)return!1;var e=!1;return this._lastFrameRadius===this._attachedCamera.radius&&0!==this._attachedCamera.inertialRadiusOffset&&(e=!0),this._lastFrameRadius=this._attachedCamera.radius,this._zoomStopsAnimation?e:this._userIsZooming()},e.prototype._applyUserInteraction=function(){this._userIsMoving()&&!this._shouldAnimationStopForInteraction()&&(this._lastInteractionTime=Ma.Tools.Now)},e.prototype._userIsMoving=function(){return!!this._attachedCamera&&(0!==this._attachedCamera.inertialAlphaOffset||0!==this._attachedCamera.inertialBetaOffset||0!==this._attachedCamera.inertialRadiusOffset||0!==this._attachedCamera.inertialPanningX||0!==this._attachedCamera.inertialPanningY||this._isPointerDown)},e})(),Ma.AutoRotationBehavior=Ra,(function(d){var r=function(){this.renderWidth=512,this.renderHeight=256,this.textureSize=512,this.deterministicLockstep=!1,this.lockstepMaxSteps=4};d.NullEngineOptions=r;var e=(function(i){function e(e){void 0===e&&(e=new r);var t=i.call(this,null)||this;return void 0===e.deterministicLockstep&&(e.deterministicLockstep=!1),void 0===e.lockstepMaxSteps&&(e.lockstepMaxSteps=4),t._options=e,t._caps=new d.EngineCapabilities,t._caps.maxTexturesImageUnits=16,t._caps.maxVertexTextureImageUnits=16,t._caps.maxTextureSize=512,t._caps.maxCubemapTextureSize=512,t._caps.maxRenderTextureSize=512,t._caps.maxVertexAttribs=16,t._caps.maxVaryingVectors=16,t._caps.maxFragmentUniformVectors=16,t._caps.maxVertexUniformVectors=16,t._caps.standardDerivatives=!1,t._caps.astc=null,t._caps.s3tc=null,t._caps.pvrtc=null,t._caps.etc1=null,t._caps.etc2=null,t._caps.textureAnisotropicFilterExtension=null,t._caps.maxAnisotropy=0,t._caps.uintIndices=!1,t._caps.fragmentDepthSupported=!1,t._caps.highPrecisionShaderSupported=!0,t._caps.colorBufferFloat=!1,t._caps.textureFloat=!1,t._caps.textureFloatLinearFiltering=!1,t._caps.textureFloatRender=!1,t._caps.textureHalfFloat=!1,t._caps.textureHalfFloatLinearFiltering=!1,t._caps.textureHalfFloatRender=!1,t._caps.textureLOD=!1,t._caps.drawBuffersExtension=!1,t._caps.depthTextureExtension=!1,t._caps.vertexArrayObject=!1,t._caps.instancedArrays=!1,d.Tools.Log("Babylon.js null engine (v"+d.Engine.Version+") launched"),"undefined"==typeof URL&&(URL={createObjectURL:function(){},revokeObjectURL:function(){}}),"undefined"==typeof Blob&&(Blob=function(){}),t}return T(e,i),e.prototype.isDeterministicLockStep=function(){return this._options.deterministicLockstep},e.prototype.getLockstepMaxSteps=function(){return this._options.lockstepMaxSteps},e.prototype.getHardwareScalingLevel=function(){return 1},e.prototype.createVertexBuffer=function(e){return{capacity:0,references:1,is32Bits:!1}},e.prototype.createIndexBuffer=function(e){return{capacity:0,references:1,is32Bits:!1}},e.prototype.clear=function(e,t,i,r){void 0===r&&(r=!1)},e.prototype.getRenderWidth=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.width:this._options.renderWidth},e.prototype.getRenderHeight=function(e){return void 0===e&&(e=!1),!e&&this._currentRenderTarget?this._currentRenderTarget.height:this._options.renderHeight},e.prototype.setViewport=function(e,t,i){this._cachedViewport=e},e.prototype.createShaderProgram=function(e,t,i,r){return{transformFeedback:null,__SPECTOR_rebuildProgram:null}},e.prototype.getUniforms=function(e,t){return[]},e.prototype.getAttributes=function(e,t){return[]},e.prototype.bindSamplers=function(e){this._currentEffect=null},e.prototype.enableEffect=function(e){(this._currentEffect=e).onBind&&e.onBind(e),e._onBindObservable&&e._onBindObservable.notifyObservers(e)},e.prototype.setState=function(e,t,i,r){void 0===t&&(t=0),void 0===r&&(r=!1)},e.prototype.setIntArray=function(e,t){},e.prototype.setIntArray2=function(e,t){},e.prototype.setIntArray3=function(e,t){},e.prototype.setIntArray4=function(e,t){},e.prototype.setFloatArray=function(e,t){},e.prototype.setFloatArray2=function(e,t){},e.prototype.setFloatArray3=function(e,t){},e.prototype.setFloatArray4=function(e,t){},e.prototype.setArray=function(e,t){},e.prototype.setArray2=function(e,t){},e.prototype.setArray3=function(e,t){},e.prototype.setArray4=function(e,t){},e.prototype.setMatrices=function(e,t){},e.prototype.setMatrix=function(e,t){},e.prototype.setMatrix3x3=function(e,t){},e.prototype.setMatrix2x2=function(e,t){},e.prototype.setFloat=function(e,t){},e.prototype.setFloat2=function(e,t,i){},e.prototype.setFloat3=function(e,t,i,r){},e.prototype.setBool=function(e,t){},e.prototype.setFloat4=function(e,t,i,r,n){},e.prototype.setColor3=function(e,t){},e.prototype.setColor4=function(e,t,i){},e.prototype.setAlphaMode=function(e,t){void 0===t&&(t=!1),this._alphaMode!==e&&(this._alphaState.alphaBlend=e!==d.Engine.ALPHA_DISABLE,t||this.setDepthWrite(e===d.Engine.ALPHA_DISABLE),this._alphaMode=e)},e.prototype.bindBuffers=function(e,t,i){},e.prototype.wipeCaches=function(e){this.preventCacheWipeBetweenFrames||(this.resetTextureCache(),this._currentEffect=null,e&&(this._currentProgram=null,this._stencilState.reset(),this._depthCullingState.reset(),this._alphaState.reset()),this._cachedVertexBuffers=null,this._cachedIndexBuffer=null,this._cachedEffectForVertexBuffers=null)},e.prototype.draw=function(e,t,i,r){},e.prototype.drawElementsType=function(e,t,i,r){},e.prototype.drawArraysType=function(e,t,i,r){},e.prototype._createTexture=function(){return{}},e.prototype._releaseTexture=function(e){},e.prototype.createTexture=function(e,t,i,r,n,o,s,a,l,c){void 0===n&&(n=d.Texture.TRILINEAR_SAMPLINGMODE),void 0===o&&(o=null),void 0===s&&(s=null),void 0===a&&(a=null);var h=new d.InternalTexture(this,d.InternalTexture.DATASOURCE_URL),u=String(e);return h.url=u,h.generateMipMaps=!t,h.samplingMode=n,h.invertY=i,h.baseWidth=this._options.textureSize,h.baseHeight=this._options.textureSize,h.width=this._options.textureSize,h.height=this._options.textureSize,c&&(h.format=c),h.isReady=!0,o&&o(),this._internalTexturesCache.push(h),h},e.prototype.createRenderTargetTexture=function(e,t){var i=new d.RenderTargetCreationOptions;void 0!==t&&"object"==typeof t?(i.generateMipMaps=t.generateMipMaps,i.generateDepthBuffer=void 0===t.generateDepthBuffer||t.generateDepthBuffer,i.generateStencilBuffer=i.generateDepthBuffer&&t.generateStencilBuffer,i.type=void 0===t.type?d.Engine.TEXTURETYPE_UNSIGNED_INT:t.type,i.samplingMode=void 0===t.samplingMode?d.Texture.TRILINEAR_SAMPLINGMODE:t.samplingMode):(i.generateMipMaps=t,i.generateDepthBuffer=!0,i.generateStencilBuffer=!1,i.type=d.Engine.TEXTURETYPE_UNSIGNED_INT,i.samplingMode=d.Texture.TRILINEAR_SAMPLINGMODE);var r=new d.InternalTexture(this,d.InternalTexture.DATASOURCE_RENDERTARGET),n=e.width||e,o=e.height||e;return r._depthStencilBuffer={},r._framebuffer={},r.baseWidth=n,r.baseHeight=o,r.width=n,r.height=o,r.isReady=!0,r.samples=1,r.generateMipMaps=!!i.generateMipMaps,r.samplingMode=i.samplingMode,r.type=i.type,r._generateDepthBuffer=i.generateDepthBuffer,r._generateStencilBuffer=!!i.generateStencilBuffer,this._internalTexturesCache.push(r),r},e.prototype.updateTextureSamplingMode=function(e,t){t.samplingMode=e},e.prototype.bindFramebuffer=function(e,t,i,r,n){this._currentRenderTarget&&this.unBindFramebuffer(this._currentRenderTarget),this._currentRenderTarget=e,this._currentFramebuffer=e._MSAAFramebuffer?e._MSAAFramebuffer:e._framebuffer,this._cachedViewport&&!n&&this.setViewport(this._cachedViewport,i,r)},e.prototype.unBindFramebuffer=function(e,t,i){void 0===t&&(t=!1),this._currentRenderTarget=null,i&&(e._MSAAFramebuffer&&(this._currentFramebuffer=e._framebuffer),i()),this._currentFramebuffer=null},e.prototype.createDynamicVertexBuffer=function(e){return{capacity:1,references:1,is32Bits:!1}},e.prototype.updateDynamicTexture=function(e,t,i,r,n){void 0===r&&(r=!1)},e.prototype.getError=function(){return 0},e.prototype._getUnpackAlignement=function(){return 1},e.prototype._unpackFlipY=function(e){},e.prototype.updateDynamicIndexBuffer=function(e,t,i){void 0===i&&(i=0)},e.prototype.updateDynamicVertexBuffer=function(e,t,i,r){},e.prototype._bindTextureDirectly=function(e,t){return this._boundTexturesCache[this._activeChannel]!==t&&(this._boundTexturesCache[this._activeChannel]=t,!0)},e.prototype._bindTexture=function(e,t){e<0||this._bindTextureDirectly(0,t)},e.prototype._releaseBuffer=function(e){return e.references--,0===e.references},e.prototype.releaseEffects=function(){},e.prototype.displayLoadingUI=function(){},e.prototype.hideLoadingUI=function(){},e.prototype._uploadCompressedDataToTextureDirectly=function(e,t,i,r,n,o,s){void 0===o&&(o=0),void 0===s&&(s=0)},e.prototype._uploadDataToTextureDirectly=function(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0)},e.prototype._uploadArrayBufferViewToTexture=function(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0)},e.prototype._uploadImageToTexture=function(e,t,i,r){void 0===i&&(i=0),void 0===r&&(r=0)},e})(d.Engine);d.NullEngine=e})($a||($a={})),Ca=$a||($a={}),Oa=(function(){function e(e){this.engine=e,this._captureGPUFrameTime=!1,this._gpuFrameTime=new Ca.PerfCounter,this._captureShaderCompilationTime=!1,this._shaderCompilationTime=new Ca.PerfCounter,this._onBeginFrameObserver=null,this._onEndFrameObserver=null,this._onBeforeShaderCompilationObserver=null,this._onAfterShaderCompilationObserver=null}return Object.defineProperty(e.prototype,"gpuFrameTimeCounter",{get:function(){return this._gpuFrameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureGPUFrameTime",{get:function(){return this._captureGPUFrameTime},set:function(e){var t=this;e!==this._captureGPUFrameTime&&((this._captureGPUFrameTime=e)?(this._onBeginFrameObserver=this.engine.onBeginFrameObservable.add((function(){t._gpuFrameTimeToken||(t._gpuFrameTimeToken=t.engine.startTimeQuery())})),this._onEndFrameObserver=this.engine.onEndFrameObservable.add((function(){if(t._gpuFrameTimeToken){var e=t.engine.endTimeQuery(t._gpuFrameTimeToken);-1<e&&(t._gpuFrameTimeToken=null,t._gpuFrameTime.fetchNewFrame(),t._gpuFrameTime.addCount(e,!0))}}))):(this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"shaderCompilationTimeCounter",{get:function(){return this._shaderCompilationTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureShaderCompilationTime",{get:function(){return this._captureShaderCompilationTime},set:function(e){var t=this;e!==this._captureShaderCompilationTime&&((this._captureShaderCompilationTime=e)?(this._onBeforeShaderCompilationObserver=this.engine.onBeforeShaderCompilationObservable.add((function(){t._shaderCompilationTime.fetchNewFrame(),t._shaderCompilationTime.beginMonitoring()})),this._onAfterShaderCompilationObserver=this.engine.onAfterShaderCompilationObservable.add((function(){t._shaderCompilationTime.endMonitoring()}))):(this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null))},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.engine.onBeginFrameObservable.remove(this._onBeginFrameObserver),this._onBeginFrameObserver=null,this.engine.onEndFrameObservable.remove(this._onEndFrameObserver),this._onEndFrameObserver=null,this.engine.onBeforeShaderCompilationObservable.remove(this._onBeforeShaderCompilationObserver),this._onBeforeShaderCompilationObserver=null,this.engine.onAfterShaderCompilationObservable.remove(this._onAfterShaderCompilationObserver),this._onAfterShaderCompilationObserver=null,this.engine=null},e})(),Ca.EngineInstrumentation=Oa,Da=$a||($a={}),Ia=(function(){function e(e){var t=this;this.scene=e,this._captureActiveMeshesEvaluationTime=!1,this._activeMeshesEvaluationTime=new Da.PerfCounter,this._captureRenderTargetsRenderTime=!1,this._renderTargetsRenderTime=new Da.PerfCounter,this._captureFrameTime=!1,this._frameTime=new Da.PerfCounter,this._captureRenderTime=!1,this._renderTime=new Da.PerfCounter,this._captureInterFrameTime=!1,this._interFrameTime=new Da.PerfCounter,this._captureParticlesRenderTime=!1,this._particlesRenderTime=new Da.PerfCounter,this._captureSpritesRenderTime=!1,this._spritesRenderTime=new Da.PerfCounter,this._capturePhysicsTime=!1,this._physicsTime=new Da.PerfCounter,this._captureAnimationsTime=!1,this._animationsTime=new Da.PerfCounter,this._captureCameraRenderTime=!1,this._cameraRenderTime=new Da.PerfCounter,this._onBeforeActiveMeshesEvaluationObserver=null,this._onAfterActiveMeshesEvaluationObserver=null,this._onBeforeRenderTargetsRenderObserver=null,this._onAfterRenderTargetsRenderObserver=null,this._onAfterRenderObserver=null,this._onBeforeDrawPhaseObserver=null,this._onAfterDrawPhaseObserver=null,this._onBeforeAnimationsObserver=null,this._onBeforeParticlesRenderingObserver=null,this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver=null,this._onAfterSpritesRenderingObserver=null,this._onBeforePhysicsObserver=null,this._onAfterPhysicsObserver=null,this._onAfterAnimationsObserver=null,this._onBeforeCameraRenderObserver=null,this._onAfterCameraRenderObserver=null,this._onBeforeAnimationsObserver=e.onBeforeAnimationsObservable.add((function(){t._captureActiveMeshesEvaluationTime&&t._activeMeshesEvaluationTime.fetchNewFrame(),t._captureRenderTargetsRenderTime&&t._renderTargetsRenderTime.fetchNewFrame(),t._captureFrameTime&&(Da.Tools.StartPerformanceCounter("Scene rendering"),t._frameTime.beginMonitoring()),t._captureInterFrameTime&&t._interFrameTime.endMonitoring(),t._captureParticlesRenderTime&&t._particlesRenderTime.fetchNewFrame(),t._captureSpritesRenderTime&&t._spritesRenderTime.fetchNewFrame(),t._captureAnimationsTime&&t._animationsTime.beginMonitoring(),t.scene.getEngine()._drawCalls.fetchNewFrame(),t.scene.getEngine()._textureCollisions.fetchNewFrame()})),this._onAfterRenderObserver=e.onAfterRenderObservable.add((function(){t._captureFrameTime&&(Da.Tools.EndPerformanceCounter("Scene rendering"),t._frameTime.endMonitoring()),t._captureRenderTime&&t._renderTime.endMonitoring(!1),t._captureInterFrameTime&&t._interFrameTime.beginMonitoring()}))}return Object.defineProperty(e.prototype,"activeMeshesEvaluationTimeCounter",{get:function(){return this._activeMeshesEvaluationTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureActiveMeshesEvaluationTime",{get:function(){return this._captureActiveMeshesEvaluationTime},set:function(e){var t=this;e!==this._captureActiveMeshesEvaluationTime&&((this._captureActiveMeshesEvaluationTime=e)?(this._onBeforeActiveMeshesEvaluationObserver=this.scene.onBeforeActiveMeshesEvaluationObservable.add((function(){Da.Tools.StartPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.beginMonitoring()})),this._onAfterActiveMeshesEvaluationObserver=this.scene.onAfterActiveMeshesEvaluationObservable.add((function(){Da.Tools.EndPerformanceCounter("Active meshes evaluation"),t._activeMeshesEvaluationTime.endMonitoring()}))):(this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderTargetsRenderTimeCounter",{get:function(){return this._renderTargetsRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureRenderTargetsRenderTime",{get:function(){return this._captureRenderTargetsRenderTime},set:function(e){var t=this;e!==this._captureRenderTargetsRenderTime&&((this._captureRenderTargetsRenderTime=e)?(this._onBeforeRenderTargetsRenderObserver=this.scene.onBeforeRenderTargetsRenderObservable.add((function(){Da.Tools.StartPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.beginMonitoring()})),this._onAfterRenderTargetsRenderObserver=this.scene.onAfterRenderTargetsRenderObservable.add((function(){Da.Tools.EndPerformanceCounter("Render targets rendering"),t._renderTargetsRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"particlesRenderTimeCounter",{get:function(){return this._particlesRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureParticlesRenderTime",{get:function(){return this._captureParticlesRenderTime},set:function(e){var t=this;e!==this._captureParticlesRenderTime&&((this._captureParticlesRenderTime=e)?(this._onBeforeParticlesRenderingObserver=this.scene.onBeforeParticlesRenderingObservable.add((function(){Da.Tools.StartPerformanceCounter("Particles"),t._particlesRenderTime.beginMonitoring()})),this._onAfterParticlesRenderingObserver=this.scene.onAfterParticlesRenderingObservable.add((function(){Da.Tools.EndPerformanceCounter("Particles"),t._particlesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"spritesRenderTimeCounter",{get:function(){return this._spritesRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureSpritesRenderTime",{get:function(){return this._captureSpritesRenderTime},set:function(e){var t=this;e!==this._captureSpritesRenderTime&&(this._captureSpritesRenderTime=e,this.scene.spriteManagers&&(e?(this._onBeforeSpritesRenderingObserver=this.scene.onBeforeSpritesRenderingObservable.add((function(){Da.Tools.StartPerformanceCounter("Sprites"),t._spritesRenderTime.beginMonitoring()})),this._onAfterSpritesRenderingObserver=this.scene.onAfterSpritesRenderingObservable.add((function(){Da.Tools.EndPerformanceCounter("Sprites"),t._spritesRenderTime.endMonitoring(!1)}))):(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null,this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null)))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"physicsTimeCounter",{get:function(){return this._physicsTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"capturePhysicsTime",{get:function(){return this._capturePhysicsTime},set:function(e){var t=this;e!==this._capturePhysicsTime&&this.scene.onBeforePhysicsObservable&&((this._capturePhysicsTime=e)?(this._onBeforePhysicsObserver=this.scene.onBeforePhysicsObservable.add((function(){Da.Tools.StartPerformanceCounter("Physics"),t._physicsTime.beginMonitoring()})),this._onAfterPhysicsObserver=this.scene.onAfterPhysicsObservable.add((function(){Da.Tools.EndPerformanceCounter("Physics"),t._physicsTime.endMonitoring()}))):(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null,this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"animationsTimeCounter",{get:function(){return this._animationsTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureAnimationsTime",{get:function(){return this._captureAnimationsTime},set:function(e){var t=this;e!==this._captureAnimationsTime&&((this._captureAnimationsTime=e)?this._onAfterAnimationsObserver=this.scene.onAfterAnimationsObservable.add((function(){t._animationsTime.endMonitoring()})):(this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"frameTimeCounter",{get:function(){return this._frameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureFrameTime",{get:function(){return this._captureFrameTime},set:function(e){this._captureFrameTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"interFrameTimeCounter",{get:function(){return this._interFrameTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureInterFrameTime",{get:function(){return this._captureInterFrameTime},set:function(e){this._captureInterFrameTime=e},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"renderTimeCounter",{get:function(){return this._renderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureRenderTime",{get:function(){return this._captureRenderTime},set:function(e){var t=this;e!==this._captureRenderTime&&((this._captureRenderTime=e)?(this._onBeforeDrawPhaseObserver=this.scene.onBeforeDrawPhaseObservable.add((function(){t._renderTime.beginMonitoring(),Da.Tools.StartPerformanceCounter("Main render")})),this._onAfterDrawPhaseObserver=this.scene.onAfterDrawPhaseObservable.add((function(){t._renderTime.endMonitoring(!1),Da.Tools.EndPerformanceCounter("Main render")}))):(this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"cameraRenderTimeCounter",{get:function(){return this._cameraRenderTime},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"captureCameraRenderTime",{get:function(){return this._captureCameraRenderTime},set:function(e){var t=this;e!==this._captureCameraRenderTime&&((this._captureCameraRenderTime=e)?(this._onBeforeCameraRenderObserver=this.scene.onBeforeCameraRenderObservable.add((function(e){t._cameraRenderTime.beginMonitoring(),Da.Tools.StartPerformanceCounter("Rendering camera "+e.name)})),this._onAfterCameraRenderObserver=this.scene.onAfterCameraRenderObservable.add((function(e){t._cameraRenderTime.endMonitoring(!1),Da.Tools.EndPerformanceCounter("Rendering camera "+e.name)}))):(this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"drawCallsCounter",{get:function(){return this.scene.getEngine()._drawCalls},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"textureCollisionsCounter",{get:function(){return this.scene.getEngine()._textureCollisions},enumerable:!0,configurable:!0}),e.prototype.dispose=function(){this.scene.onAfterRenderObservable.remove(this._onAfterRenderObserver),this._onAfterRenderObserver=null,this.scene.onBeforeActiveMeshesEvaluationObservable.remove(this._onBeforeActiveMeshesEvaluationObserver),this._onBeforeActiveMeshesEvaluationObserver=null,this.scene.onAfterActiveMeshesEvaluationObservable.remove(this._onAfterActiveMeshesEvaluationObserver),this._onAfterActiveMeshesEvaluationObserver=null,this.scene.onBeforeRenderTargetsRenderObservable.remove(this._onBeforeRenderTargetsRenderObserver),this._onBeforeRenderTargetsRenderObserver=null,this.scene.onAfterRenderTargetsRenderObservable.remove(this._onAfterRenderTargetsRenderObserver),this._onAfterRenderTargetsRenderObserver=null,this.scene.onBeforeAnimationsObservable.remove(this._onBeforeAnimationsObserver),this._onBeforeAnimationsObserver=null,this.scene.onBeforeParticlesRenderingObservable.remove(this._onBeforeParticlesRenderingObserver),this._onBeforeParticlesRenderingObserver=null,this.scene.onAfterParticlesRenderingObservable.remove(this._onAfterParticlesRenderingObserver),this._onAfterParticlesRenderingObserver=null,this._onBeforeSpritesRenderingObserver&&(this.scene.onBeforeSpritesRenderingObservable.remove(this._onBeforeSpritesRenderingObserver),this._onBeforeSpritesRenderingObserver=null),this._onAfterSpritesRenderingObserver&&(this.scene.onAfterSpritesRenderingObservable.remove(this._onAfterSpritesRenderingObserver),this._onAfterSpritesRenderingObserver=null),this.scene.onBeforeDrawPhaseObservable.remove(this._onBeforeDrawPhaseObserver),this._onBeforeDrawPhaseObserver=null,this.scene.onAfterDrawPhaseObservable.remove(this._onAfterDrawPhaseObserver),this._onAfterDrawPhaseObserver=null,this._onBeforePhysicsObserver&&(this.scene.onBeforePhysicsObservable.remove(this._onBeforePhysicsObserver),this._onBeforePhysicsObserver=null),this._onAfterPhysicsObserver&&(this.scene.onAfterPhysicsObservable.remove(this._onAfterPhysicsObserver),this._onAfterPhysicsObserver=null),this.scene.onAfterAnimationsObservable.remove(this._onAfterAnimationsObserver),this._onAfterAnimationsObserver=null,this.scene.onBeforeCameraRenderObservable.remove(this._onBeforeCameraRenderObserver),this._onBeforeCameraRenderObserver=null,this.scene.onAfterCameraRenderObservable.remove(this._onAfterCameraRenderObserver),this._onAfterCameraRenderObserver=null,this.scene=null},e})(),Da.SceneInstrumentation=Ia,wa=function(){this._timeElapsedQueryEnded=!1},($a||($a={}))._TimeToken=wa,La=$a||($a={}),Fa=(function(t){function e(){var e=t.call(this)||this;return e.DIFFUSE=!1,e.DIFFUSEDIRECTUV=0,e.GAMMADIFFUSE=!1,e.DIFFUSEHASALPHA=!1,e.OPACITYFRESNEL=!1,e.REFLECTIONBLUR=!1,e.REFLECTIONFRESNEL=!1,e.REFLECTIONFALLOFF=!1,e.TEXTURELODSUPPORT=!1,e.PREMULTIPLYALPHA=!1,e.USERGBCOLOR=!1,e.USEHIGHLIGHTANDSHADOWCOLORS=!1,e.NOISE=!1,e.REFLECTIONBGR=!1,e.IMAGEPROCESSING=!1,e.VIGNETTE=!1,e.VIGNETTEBLENDMODEMULTIPLY=!1,e.VIGNETTEBLENDMODEOPAQUE=!1,e.TONEMAPPING=!1,e.TONEMAPPING_ACES=!1,e.CONTRAST=!1,e.COLORCURVES=!1,e.COLORGRADING=!1,e.COLORGRADING3D=!1,e.SAMPLER3DGREENDEPTH=!1,e.SAMPLER3DBGRMAP=!1,e.IMAGEPROCESSINGPOSTPROCESS=!1,e.EXPOSURE=!1,e.REFLECTION=!1,e.REFLECTIONMAP_3D=!1,e.REFLECTIONMAP_SPHERICAL=!1,e.REFLECTIONMAP_PLANAR=!1,e.REFLECTIONMAP_CUBIC=!1,e.REFLECTIONMAP_PROJECTION=!1,e.REFLECTIONMAP_SKYBOX=!1,e.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,e.REFLECTIONMAP_EXPLICIT=!1,e.REFLECTIONMAP_EQUIRECTANGULAR=!1,e.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,e.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,e.INVERTCUBICMAP=!1,e.REFLECTIONMAP_OPPOSITEZ=!1,e.LODINREFLECTIONALPHA=!1,e.GAMMAREFLECTION=!1,e.RGBDREFLECTION=!1,e.EQUIRECTANGULAR_RELFECTION_FOV=!1,e.MAINUV1=!1,e.MAINUV2=!1,e.UV1=!1,e.UV2=!1,e.CLIPPLANE=!1,e.CLIPPLANE2=!1,e.CLIPPLANE3=!1,e.CLIPPLANE4=!1,e.POINTSIZE=!1,e.FOG=!1,e.NORMAL=!1,e.NUM_BONE_INFLUENCERS=0,e.BonesPerMesh=0,e.INSTANCES=!1,e.SHADOWFLOAT=!1,e.rebuild(),e}return T(e,t),e})(La.MaterialDefines),Ba=(function(r){function n(e,t){var i=r.call(this,e,t)||this;return i.primaryColor=La.Color3.White(),i._primaryColorShadowLevel=0,i._primaryColorHighlightLevel=0,i.reflectionTexture=null,i.reflectionBlur=0,i.diffuseTexture=null,i._shadowLights=null,i.shadowLights=null,i.shadowLevel=0,i.sceneCenter=La.Vector3.Zero(),i.opacityFresnel=!0,i.reflectionFresnel=!1,i.reflectionFalloffDistance=0,i.reflectionAmount=1,i.reflectionReflectance0=.05,i.reflectionReflectance90=.5,i.useRGBColor=!0,i.enableNoise=!1,i._fovMultiplier=1,i.useEquirectangularFOV=!1,i._maxSimultaneousLights=4,i.maxSimultaneousLights=4,i._imageProcessingObserver=null,i.switchToBGR=!1,i._renderTargets=new La.SmartArray(16),i._reflectionControls=La.Vector4.Zero(),i._white=La.Color3.White(),i._primaryShadowColor=La.Color3.Black(),i._primaryHighlightColor=La.Color3.Black(),i._attachImageProcessingConfiguration(null),i.getRenderTargetTextures=function(){return i._renderTargets.reset(),i._diffuseTexture&&i._diffuseTexture.isRenderTarget&&i._renderTargets.push(i._diffuseTexture),i._reflectionTexture&&i._reflectionTexture.isRenderTarget&&i._renderTargets.push(i._reflectionTexture),i._renderTargets},i}return T(n,r),Object.defineProperty(n.prototype,"_perceptualColor",{get:function(){return this.__perceptualColor},set:function(e){this.__perceptualColor=e,this._computePrimaryColorFromPerceptualColor(),this._markAllSubMeshesAsLightsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"primaryColorShadowLevel",{get:function(){return this._primaryColorShadowLevel},set:function(e){this._primaryColorShadowLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"primaryColorHighlightLevel",{get:function(){return this._primaryColorHighlightLevel},set:function(e){this._primaryColorHighlightLevel=e,this._computePrimaryColors(),this._markAllSubMeshesAsLightsDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"reflectionStandardFresnelWeight",{set:function(e){var t=e;t<.5?(t*=2,this.reflectionReflectance0=n.StandardReflectance0*t,this.reflectionReflectance90=n.StandardReflectance90*t):(t=2*t-1,this.reflectionReflectance0=n.StandardReflectance0+(1-n.StandardReflectance0)*t,this.reflectionReflectance90=n.StandardReflectance90+(1-n.StandardReflectance90)*t)},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"fovMultiplier",{get:function(){return this._fovMultiplier},set:function(e){isNaN(e)&&(e=1),this._fovMultiplier=Math.max(0,Math.min(2,e))},enumerable:!0,configurable:!0}),n.prototype._attachImageProcessingConfiguration=function(e){var t=this;e!==this._imageProcessingConfiguration&&(this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),this._imageProcessingConfiguration=e||this.getScene().imageProcessingConfiguration,this._imageProcessingConfiguration&&(this._imageProcessingObserver=this._imageProcessingConfiguration.onUpdateParameters.add((function(e){t._computePrimaryColorFromPerceptualColor(),t._markAllSubMeshesAsImageProcessingDirty()}))))},Object.defineProperty(n.prototype,"imageProcessingConfiguration",{get:function(){return this._imageProcessingConfiguration},set:function(e){this._attachImageProcessingConfiguration(e),this._markAllSubMeshesAsTexturesDirty()},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorCurvesEnabled",{get:function(){return this.imageProcessingConfiguration.colorCurvesEnabled},set:function(e){this.imageProcessingConfiguration.colorCurvesEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorGradingEnabled",{get:function(){return this.imageProcessingConfiguration.colorGradingEnabled},set:function(e){this.imageProcessingConfiguration.colorGradingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraToneMappingEnabled",{get:function(){return this._imageProcessingConfiguration.toneMappingEnabled},set:function(e){this._imageProcessingConfiguration.toneMappingEnabled=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraExposure",{get:function(){return this._imageProcessingConfiguration.exposure},set:function(e){this._imageProcessingConfiguration.exposure=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraContrast",{get:function(){return this._imageProcessingConfiguration.contrast},set:function(e){this._imageProcessingConfiguration.contrast=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorGradingTexture",{get:function(){return this._imageProcessingConfiguration.colorGradingTexture},set:function(e){this.imageProcessingConfiguration.colorGradingTexture=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"cameraColorCurves",{get:function(){return this.imageProcessingConfiguration.colorCurves},set:function(e){this.imageProcessingConfiguration.colorCurves=e},enumerable:!0,configurable:!0}),Object.defineProperty(n.prototype,"hasRenderTargetTextures",{get:function(){return!(!this._diffuseTexture||!this._diffuseTexture.isRenderTarget)||!(!this._reflectionTexture||!this._reflectionTexture.isRenderTarget)},enumerable:!0,configurable:!0}),n.prototype.needAlphaTesting=function(){return!0},n.prototype.needAlphaBlending=function(){return this.alpha<0||null!=this._diffuseTexture&&this._diffuseTexture.hasAlpha},n.prototype.isReadyForSubMesh=function(e,t,i){var r=this;if(void 0===i&&(i=!1),t.effect&&this.isFrozen&&this._wasPreviouslyReady)return!0;t._materialDefines||(t._materialDefines=new Fa);var n=this.getScene(),o=t._materialDefines;if(!this.checkReadyOnEveryCall&&t.effect&&o._renderId===n.getRenderId())return!0;var s=n.getEngine();if(La.MaterialHelper.PrepareDefinesForLights(n,e,o,!1,this._maxSimultaneousLights),o._needNormals=!0,o._areTexturesDirty){if(o._needUVs=!1,n.texturesEnabled){if(n.getEngine().getCaps().textureLOD&&(o.TEXTURELODSUPPORT=!0),this._diffuseTexture&&La.StandardMaterial.DiffuseTextureEnabled){if(!this._diffuseTexture.isReadyOrNotBlocking())return!1;La.MaterialHelper.PrepareDefinesForMergedUV(this._diffuseTexture,o,"DIFFUSE"),o.DIFFUSEHASALPHA=this._diffuseTexture.hasAlpha,o.GAMMADIFFUSE=this._diffuseTexture.gammaSpace,o.OPACITYFRESNEL=this._opacityFresnel}else o.DIFFUSE=!1,o.DIFFUSEHASALPHA=!1,o.GAMMADIFFUSE=!1,o.OPACITYFRESNEL=!1;var a=this._reflectionTexture;if(a&&La.StandardMaterial.ReflectionTextureEnabled){if(!a.isReadyOrNotBlocking())return!1;switch(o.REFLECTION=!0,o.GAMMAREFLECTION=a.gammaSpace,o.RGBDREFLECTION=a.isRGBD,o.REFLECTIONBLUR=0<this._reflectionBlur,o.REFLECTIONMAP_OPPOSITEZ=this.getScene().useRightHandedSystem?!a.invertZ:a.invertZ,o.LODINREFLECTIONALPHA=a.lodLevelInAlpha,o.EQUIRECTANGULAR_RELFECTION_FOV=this.useEquirectangularFOV,o.REFLECTIONBGR=this.switchToBGR,a.coordinatesMode===La.Texture.INVCUBIC_MODE&&(o.INVERTCUBICMAP=!0),o.REFLECTIONMAP_3D=a.isCube,a.coordinatesMode){case La.Texture.EXPLICIT_MODE:o.REFLECTIONMAP_EXPLICIT=!0;break;case La.Texture.PLANAR_MODE:o.REFLECTIONMAP_PLANAR=!0;break;case La.Texture.PROJECTION_MODE:o.REFLECTIONMAP_PROJECTION=!0;break;case La.Texture.SKYBOX_MODE:o.REFLECTIONMAP_SKYBOX=!0,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!a.getReflectionTextureMatrix().isIdentity();break;case La.Texture.SPHERICAL_MODE:o.REFLECTIONMAP_SPHERICAL=!0;break;case La.Texture.EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR=!0;break;case La.Texture.FIXED_EQUIRECTANGULAR_MODE:o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!0;break;case La.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE:o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!0;break;case La.Texture.CUBIC_MODE:case La.Texture.INVCUBIC_MODE:default:o.REFLECTIONMAP_CUBIC=!0}this.reflectionFresnel?(o.REFLECTIONFRESNEL=!0,o.REFLECTIONFALLOFF=0<this.reflectionFalloffDistance,this._reflectionControls.x=this.reflectionAmount,this._reflectionControls.y=this.reflectionReflectance0,this._reflectionControls.z=this.reflectionReflectance90,this._reflectionControls.w=1/this.reflectionFalloffDistance):(o.REFLECTIONFRESNEL=!1,o.REFLECTIONFALLOFF=!1)}else o.REFLECTION=!1,o.REFLECTIONFRESNEL=!1,o.REFLECTIONFALLOFF=!1,o.REFLECTIONBLUR=!1,o.REFLECTIONMAP_3D=!1,o.REFLECTIONMAP_SPHERICAL=!1,o.REFLECTIONMAP_PLANAR=!1,o.REFLECTIONMAP_CUBIC=!1,o.REFLECTIONMAP_PROJECTION=!1,o.REFLECTIONMAP_SKYBOX=!1,o.REFLECTIONMAP_SKYBOX_TRANSFORMED=!1,o.REFLECTIONMAP_EXPLICIT=!1,o.REFLECTIONMAP_EQUIRECTANGULAR=!1,o.REFLECTIONMAP_EQUIRECTANGULAR_FIXED=!1,o.REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED=!1,o.INVERTCUBICMAP=!1,o.REFLECTIONMAP_OPPOSITEZ=!1,o.LODINREFLECTIONALPHA=!1,o.GAMMAREFLECTION=!1,o.RGBDREFLECTION=!1}o.PREMULTIPLYALPHA=this.alphaMode===La.Engine.ALPHA_PREMULTIPLIED||this.alphaMode===La.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF,o.USERGBCOLOR=this._useRGBColor,o.NOISE=this._enableNoise}if(o._areLightsDirty&&(o.USEHIGHLIGHTANDSHADOWCOLORS=!this._useRGBColor&&(0!==this._primaryColorShadowLevel||0!==this._primaryColorHighlightLevel)),o._areImageProcessingDirty&&this._imageProcessingConfiguration){if(!this._imageProcessingConfiguration.isReady())return!1;this._imageProcessingConfiguration.prepareDefines(o)}if(La.MaterialHelper.PrepareDefinesForMisc(e,n,!1,this.pointsCloud,this.fogEnabled,this._shouldTurnAlphaTestOn(e),o),La.MaterialHelper.PrepareDefinesForFrameBoundValues(n,s,o,i),La.MaterialHelper.PrepareDefinesForAttributes(e,o,!1,!0,!1)&&e&&(n.getEngine().getCaps().standardDerivatives||e.isVerticesDataPresent(La.VertexBuffer.NormalKind)||(e.createNormals(!0),La.Tools.Warn("BackgroundMaterial: Normals have been created for the mesh: "+e.name))),o.isDirty){o.markAsProcessed(),n.resetCachedMaterial();var l=new La.EffectFallbacks;o.FOG&&l.addFallback(0,"FOG"),o.POINTSIZE&&l.addFallback(1,"POINTSIZE"),La.MaterialHelper.HandleFallbacksForShadows(o,l,this._maxSimultaneousLights),0<o.NUM_BONE_INFLUENCERS&&l.addCPUSkinningFallback(0,e);var c=[La.VertexBuffer.PositionKind];o.NORMAL&&c.push(La.VertexBuffer.NormalKind),o.UV1&&c.push(La.VertexBuffer.UVKind),o.UV2&&c.push(La.VertexBuffer.UV2Kind),La.MaterialHelper.PrepareAttributesForBones(c,e,o,l),La.MaterialHelper.PrepareAttributesForInstances(c,o);var h=["world","view","viewProjection","vEyePosition","vLightsType","vFogInfos","vFogColor","pointSize","vClipPlane","vClipPlane2","vClipPlane3","vClipPlane4","mBones","vPrimaryColor","vPrimaryColorShadow","vReflectionInfos","reflectionMatrix","vReflectionMicrosurfaceInfos","fFovMultiplier","shadowLevel","alpha","vBackgroundCenter","vReflectionControl","vDiffuseInfos","diffuseMatrix"],u=["diffuseSampler","reflectionSampler","reflectionSamplerLow","reflectionSamplerHigh"],d=["Material","Scene"];La.ImageProcessingConfiguration&&(La.ImageProcessingConfiguration.PrepareUniforms(h,o),La.ImageProcessingConfiguration.PrepareSamplers(u,o)),La.MaterialHelper.PrepareUniformsAndSamplersList({uniformsNames:h,uniformBuffersNames:d,samplers:u,defines:o,maxSimultaneousLights:this._maxSimultaneousLights});var f=o.toString();t.setEffect(n.getEngine().createEffect("background",{attributes:c,uniformsNames:h,uniformBuffersNames:d,samplers:u,defines:f,fallbacks:l,onCompiled:function(e){r.onCompiled&&r.onCompiled(e),r.bindSceneUniformBuffer(e,n.getSceneUniformBuffer())},onError:this.onError,indexParameters:{maxSimultaneousLights:this._maxSimultaneousLights}},s),o),this.buildUniformLayout()}return!(!t.effect||!t.effect.isReady())&&(o._renderId=n.getRenderId(),this._wasPreviouslyReady=!0)},n.prototype._computePrimaryColorFromPerceptualColor=function(){this.__perceptualColor&&(this._primaryColor.copyFrom(this.__perceptualColor),this._primaryColor.toLinearSpaceToRef(this._primaryColor),this._imageProcessingConfiguration&&this._primaryColor.scaleToRef(1/this._imageProcessingConfiguration.exposure,this._primaryColor),this._computePrimaryColors())},n.prototype._computePrimaryColors=function(){0===this._primaryColorShadowLevel&&0===this._primaryColorHighlightLevel||(this._primaryColor.scaleToRef(this._primaryColorShadowLevel,this._primaryShadowColor),this._primaryColor.subtractToRef(this._primaryShadowColor,this._primaryShadowColor),this._white.subtractToRef(this._primaryColor,this._primaryHighlightColor),this._primaryHighlightColor.scaleToRef(this._primaryColorHighlightLevel,this._primaryHighlightColor),this._primaryColor.addToRef(this._primaryHighlightColor,this._primaryHighlightColor))},n.prototype.buildUniformLayout=function(){this._uniformBuffer.addUniform("vPrimaryColor",4),this._uniformBuffer.addUniform("vPrimaryColorShadow",4),this._uniformBuffer.addUniform("vDiffuseInfos",2),this._uniformBuffer.addUniform("vReflectionInfos",2),this._uniformBuffer.addUniform("diffuseMatrix",16),this._uniformBuffer.addUniform("reflectionMatrix",16),this._uniformBuffer.addUniform("vReflectionMicrosurfaceInfos",3),this._uniformBuffer.addUniform("fFovMultiplier",1),this._uniformBuffer.addUniform("pointSize",1),this._uniformBuffer.addUniform("shadowLevel",1),this._uniformBuffer.addUniform("alpha",1),this._uniformBuffer.addUniform("vBackgroundCenter",3),this._uniformBuffer.addUniform("vReflectionControl",4),this._uniformBuffer.create()},n.prototype.unbind=function(){this._diffuseTexture&&this._diffuseTexture.isRenderTarget&&this._uniformBuffer.setTexture("diffuseSampler",null),this._reflectionTexture&&this._reflectionTexture.isRenderTarget&&this._uniformBuffer.setTexture("reflectionSampler",null),r.prototype.unbind.call(this)},n.prototype.bindOnlyWorldMatrix=function(e){this._activeEffect.setMatrix("world",e)},n.prototype.bindForSubMesh=function(e,t,i){var r=this.getScene(),n=i._materialDefines;if(n){var o=i.effect;if(o){this._activeEffect=o,this.bindOnlyWorldMatrix(e),La.MaterialHelper.BindBonesParameters(t,this._activeEffect);var s=this._mustRebind(r,o,t.visibility);if(s){this._uniformBuffer.bindToEffect(o,"Material"),this.bindViewProjection(o);var a=this._reflectionTexture;this._uniformBuffer.useUbo&&this.isFrozen&&this._uniformBuffer.isSync||(r.texturesEnabled&&(this._diffuseTexture&&La.StandardMaterial.DiffuseTextureEnabled&&(this._uniformBuffer.updateFloat2("vDiffuseInfos",this._diffuseTexture.coordinatesIndex,this._diffuseTexture.level),La.MaterialHelper.BindTextureMatrix(this._diffuseTexture,this._uniformBuffer,"diffuse")),a&&La.StandardMaterial.ReflectionTextureEnabled&&(this._uniformBuffer.updateMatrix("reflectionMatrix",a.getReflectionTextureMatrix()),this._uniformBuffer.updateFloat2("vReflectionInfos",a.level,this._reflectionBlur),this._uniformBuffer.updateFloat3("vReflectionMicrosurfaceInfos",a.getSize().width,a.lodGenerationScale,a.lodGenerationOffset))),0<this.shadowLevel&&this._uniformBuffer.updateFloat("shadowLevel",this.shadowLevel),this._uniformBuffer.updateFloat("alpha",this.alpha),this.pointsCloud&&this._uniformBuffer.updateFloat("pointSize",this.pointSize),n.USEHIGHLIGHTANDSHADOWCOLORS?(this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryHighlightColor,1),this._uniformBuffer.updateColor4("vPrimaryColorShadow",this._primaryShadowColor,1)):this._uniformBuffer.updateColor4("vPrimaryColor",this._primaryColor,1)),this._uniformBuffer.updateFloat("fFovMultiplier",this._fovMultiplier),r.texturesEnabled&&(this._diffuseTexture&&La.StandardMaterial.DiffuseTextureEnabled&&this._uniformBuffer.setTexture("diffuseSampler",this._diffuseTexture),a&&La.StandardMaterial.ReflectionTextureEnabled&&(n.REFLECTIONBLUR&&n.TEXTURELODSUPPORT?this._uniformBuffer.setTexture("reflectionSampler",a):n.REFLECTIONBLUR?(this._uniformBuffer.setTexture("reflectionSampler",a._lodTextureMid||a),this._uniformBuffer.setTexture("reflectionSamplerLow",a._lodTextureLow||a),this._uniformBuffer.setTexture("reflectionSamplerHigh",a._lodTextureHigh||a)):this._uniformBuffer.setTexture("reflectionSampler",a),n.REFLECTIONFRESNEL&&(this._uniformBuffer.updateFloat3("vBackgroundCenter",this.sceneCenter.x,this.sceneCenter.y,this.sceneCenter.z),this._uniformBuffer.updateFloat4("vReflectionControl",this._reflectionControls.x,this._reflectionControls.y,this._reflectionControls.z,this._reflectionControls.w)))),La.MaterialHelper.BindClipPlane(this._activeEffect,r),La.MaterialHelper.BindEyePosition(o,r)}!s&&this.isFrozen||(r.lightsEnabled&&La.MaterialHelper.BindLights(r,t,this._activeEffect,n,this._maxSimultaneousLights,!1),this.bindView(o),La.MaterialHelper.BindFogParameters(r,t,this._activeEffect,!0),this._imageProcessingConfiguration&&this._imageProcessingConfiguration.bind(this._activeEffect)),this._uniformBuffer.update(),this._afterBind(t,this._activeEffect)}}},n.prototype.dispose=function(e,t){void 0===e&&(e=!1),void 0===t&&(t=!1),t&&(this.diffuseTexture&&this.diffuseTexture.dispose(),this.reflectionTexture&&this.reflectionTexture.dispose()),this._renderTargets.dispose(),this._imageProcessingConfiguration&&this._imageProcessingObserver&&this._imageProcessingConfiguration.onUpdateParameters.remove(this._imageProcessingObserver),r.prototype.dispose.call(this,e)},n.prototype.clone=function(e){var t=this;return La.SerializationHelper.Clone((function(){return new n(e,t.getScene())}),this)},n.prototype.serialize=function(){var e=La.SerializationHelper.Serialize(this);return e.customType="BABYLON.BackgroundMaterial",e},n.prototype.getClassName=function(){return"BackgroundMaterial"},n.Parse=function(e,t,i){return La.SerializationHelper.Parse((function(){return new n(e.name,t)}),e,t,i)},n.StandardReflectance0=.05,n.StandardReflectance90=.5,b([La.serializeAsColor3()],n.prototype,"_primaryColor",void 0),b([La.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"primaryColor",void 0),b([La.serializeAsColor3()],n.prototype,"__perceptualColor",void 0),b([La.serialize()],n.prototype,"_primaryColorShadowLevel",void 0),b([La.serialize()],n.prototype,"_primaryColorHighlightLevel",void 0),b([La.expandToProperty("_markAllSubMeshesAsLightsDirty")],n.prototype,"primaryColorHighlightLevel",null),b([La.serializeAsTexture()],n.prototype,"_reflectionTexture",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionTexture",void 0),b([La.serialize()],n.prototype,"_reflectionBlur",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionBlur",void 0),b([La.serializeAsTexture()],n.prototype,"_diffuseTexture",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"diffuseTexture",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"shadowLights",void 0),b([La.serialize()],n.prototype,"_shadowLevel",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"shadowLevel",void 0),b([La.serializeAsVector3()],n.prototype,"_sceneCenter",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"sceneCenter",void 0),b([La.serialize()],n.prototype,"_opacityFresnel",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"opacityFresnel",void 0),b([La.serialize()],n.prototype,"_reflectionFresnel",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionFresnel",void 0),b([La.serialize()],n.prototype,"_reflectionFalloffDistance",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionFalloffDistance",void 0),b([La.serialize()],n.prototype,"_reflectionAmount",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionAmount",void 0),b([La.serialize()],n.prototype,"_reflectionReflectance0",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionReflectance0",void 0),b([La.serialize()],n.prototype,"_reflectionReflectance90",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"reflectionReflectance90",void 0),b([La.serialize()],n.prototype,"_useRGBColor",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"useRGBColor",void 0),b([La.serialize()],n.prototype,"_enableNoise",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"enableNoise",void 0),b([La.serialize()],n.prototype,"_maxSimultaneousLights",void 0),b([La.expandToProperty("_markAllSubMeshesAsTexturesDirty")],n.prototype,"maxSimultaneousLights",void 0),b([La.serializeAsImageProcessingConfiguration()],n.prototype,"_imageProcessingConfiguration",void 0),n})(La.PushMaterial),La.BackgroundMaterial=Ba;var Na,Va,Ua,za,Ga,ka,Wa,Ha,Xa,ja,Ya,Ka,Qa,Za;ae=this&&this.__assign||function(){return(ae=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};Na=$a||($a={}),Va=(function(){function r(e,t){var i=this;this._errorHandler=function(e,t){i.onErrorObservable.notifyObservers({message:e,exception:t})},this._options=ae({},r._getDefaultOptions(),e),this._scene=t,this.onErrorObservable=new Na.Observable,this._setupBackground(),this._setupImageProcessing()}return r._getDefaultOptions=function(){return{createGround:!0,groundSize:15,groundTexture:this._groundTextureCDNUrl,groundColor:new Na.Color3(.2,.2,.3).toLinearSpace().scale(3),groundOpacity:.9,enableGroundShadow:!0,groundShadowLevel:.5,enableGroundMirror:!1,groundMirrorSizeRatio:.3,groundMirrorBlurKernel:64,groundMirrorAmount:1,groundMirrorFresnelWeight:1,groundMirrorFallOffDistance:0,groundMirrorTextureType:Na.Engine.TEXTURETYPE_UNSIGNED_INT,groundYBias:1e-5,createSkybox:!0,skyboxSize:20,skyboxTexture:this._skyboxTextureCDNUrl,skyboxColor:new Na.Color3(.2,.2,.3).toLinearSpace().scale(3),backgroundYRotation:0,sizeAuto:!0,rootPosition:Na.Vector3.Zero(),setupImageProcessing:!0,environmentTexture:this._environmentTextureCDNUrl,cameraExposure:.8,cameraContrast:1.2,toneMappingEnabled:!0}},Object.defineProperty(r.prototype,"rootMesh",{get:function(){return this._rootMesh},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"skybox",{get:function(){return this._skybox},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"skyboxTexture",{get:function(){return this._skyboxTexture},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"skyboxMaterial",{get:function(){return this._skyboxMaterial},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"ground",{get:function(){return this._ground},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"groundTexture",{get:function(){return this._groundTexture},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"groundMirror",{get:function(){return this._groundMirror},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"groundMirrorRenderList",{get:function(){return this._groundMirror?this._groundMirror.renderList:null},enumerable:!0,configurable:!0}),Object.defineProperty(r.prototype,"groundMaterial",{get:function(){return this._groundMaterial},enumerable:!0,configurable:!0}),r.prototype.updateOptions=function(e){var t=ae({},this._options,e);this._ground&&!t.createGround&&(this._ground.dispose(),this._ground=null),this._groundMaterial&&!t.createGround&&(this._groundMaterial.dispose(),this._groundMaterial=null),this._groundTexture&&this._options.groundTexture!=t.groundTexture&&(this._groundTexture.dispose(),this._groundTexture=null),this._skybox&&!t.createSkybox&&(this._skybox.dispose(),this._skybox=null),this._skyboxMaterial&&!t.createSkybox&&(this._skyboxMaterial.dispose(),this._skyboxMaterial=null),this._skyboxTexture&&this._options.skyboxTexture!=t.skyboxTexture&&(this._skyboxTexture.dispose(),this._skyboxTexture=null),this._groundMirror&&!t.enableGroundMirror&&(this._groundMirror.dispose(),this._groundMirror=null),this._scene.environmentTexture&&this._options.environmentTexture!=t.environmentTexture&&this._scene.environmentTexture.dispose(),this._options=t,this._setupBackground(),this._setupImageProcessing()},r.prototype.setMainColor=function(e){this.groundMaterial&&(this.groundMaterial.primaryColor=e),this.skyboxMaterial&&(this.skyboxMaterial.primaryColor=e),this.groundMirror&&(this.groundMirror.clearColor=new Na.Color4(e.r,e.g,e.b,1))},r.prototype._setupImageProcessing=function(){this._options.setupImageProcessing&&(this._scene.imageProcessingConfiguration.contrast=this._options.cameraContrast,this._scene.imageProcessingConfiguration.exposure=this._options.cameraExposure,this._scene.imageProcessingConfiguration.toneMappingEnabled=this._options.toneMappingEnabled,this._setupEnvironmentTexture())},r.prototype._setupEnvironmentTexture=function(){if(!this._scene.environmentTexture)if(this._options.environmentTexture instanceof Na.BaseTexture)this._scene.environmentTexture=this._options.environmentTexture;else{var e=Na.CubeTexture.CreateFromPrefilteredData(this._options.environmentTexture,this._scene);this._scene.environmentTexture=e}},r.prototype._setupBackground=function(){this._rootMesh||(this._rootMesh=new Na.Mesh("BackgroundHelper",this._scene)),this._rootMesh.rotation.y=this._options.backgroundYRotation;var e=this._getSceneSize();this._options.createGround&&(this._setupGround(e),this._setupGroundMaterial(),this._setupGroundDiffuseTexture(),this._options.enableGroundMirror&&this._setupGroundMirrorTexture(e),this._setupMirrorInGroundMaterial()),this._options.createSkybox&&(this._setupSkybox(e),this._setupSkyboxMaterial(),this._setupSkyboxReflectionTexture()),this._rootMesh.position.x=e.rootPosition.x,this._rootMesh.position.z=e.rootPosition.z,this._rootMesh.position.y=e.rootPosition.y},r.prototype._getSceneSize=function(){var t=this,e=this._options.groundSize,i=this._options.skyboxSize,r=this._options.rootPosition;if(!this._scene.meshes||1===this._scene.meshes.length)return{groundSize:e,skyboxSize:i,rootPosition:r};var n=this._scene.getWorldExtends((function(e){return e!==t._ground&&e!==t._rootMesh&&e!==t._skybox})),o=n.max.subtract(n.min);if(this._options.sizeAuto){this._scene.activeCamera instanceof Na.ArcRotateCamera&&this._scene.activeCamera.upperRadiusLimit&&(i=e=2*this._scene.activeCamera.upperRadiusLimit);var s=o.length();e<s&&(i=e=2*s),e*=1.1,i*=1.5,(r=n.min.add(o.scale(.5))).y=n.min.y-this._options.groundYBias}return{groundSize:e,skyboxSize:i,rootPosition:r}},r.prototype._setupGround=function(e){var t=this;this._ground&&!this._ground.isDisposed()||(this._ground=Na.Mesh.CreatePlane("BackgroundPlane",e.groundSize,this._scene),this._ground.rotation.x=Math.PI/2,this._ground.parent=this._rootMesh,this._ground.onDisposeObservable.add((function(){t._ground=null}))),this._ground.receiveShadows=this._options.enableGroundShadow},r.prototype._setupGroundMaterial=function(){this._groundMaterial||(this._groundMaterial=new Na.BackgroundMaterial("BackgroundPlaneMaterial",this._scene)),this._groundMaterial.alpha=this._options.groundOpacity,this._groundMaterial.alphaMode=Na.Engine.ALPHA_PREMULTIPLIED_PORTERDUFF,this._groundMaterial.shadowLevel=this._options.groundShadowLevel,this._groundMaterial.primaryColor=this._options.groundColor,this._groundMaterial.useRGBColor=!1,this._groundMaterial.enableNoise=!0,this._ground&&(this._ground.material=this._groundMaterial)},r.prototype._setupGroundDiffuseTexture=function(){if(this._groundMaterial&&!this._groundTexture)if(this._options.groundTexture instanceof Na.BaseTexture)this._groundMaterial.diffuseTexture=this._options.groundTexture;else{var e=new Na.Texture(this._options.groundTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler);e.gammaSpace=!1,e.hasAlpha=!0,this._groundMaterial.diffuseTexture=e}},r.prototype._setupGroundMirrorTexture=function(e){var t=Na.Texture.CLAMP_ADDRESSMODE;if(!this._groundMirror&&(this._groundMirror=new Na.MirrorTexture("BackgroundPlaneMirrorTexture",{ratio:this._options.groundMirrorSizeRatio},this._scene,!1,this._options.groundMirrorTextureType,Na.Texture.BILINEAR_SAMPLINGMODE,!0),this._groundMirror.mirrorPlane=new Na.Plane(0,-1,0,e.rootPosition.y),this._groundMirror.anisotropicFilteringLevel=1,this._groundMirror.wrapU=t,this._groundMirror.wrapV=t,this._groundMirror.gammaSpace=!1,this._groundMirror.renderList))for(var i=0;i<this._scene.meshes.length;i++){var r=this._scene.meshes[i];r!==this._ground&&r!==this._skybox&&r!==this._rootMesh&&this._groundMirror.renderList.push(r)}this._groundMirror.clearColor=new Na.Color4(this._options.groundColor.r,this._options.groundColor.g,this._options.groundColor.b,1),this._groundMirror.adaptiveBlurKernel=this._options.groundMirrorBlurKernel},r.prototype._setupMirrorInGroundMaterial=function(){this._groundMaterial&&(this._groundMaterial.reflectionTexture=this._groundMirror,this._groundMaterial.reflectionFresnel=!0,this._groundMaterial.reflectionAmount=this._options.groundMirrorAmount,this._groundMaterial.reflectionStandardFresnelWeight=this._options.groundMirrorFresnelWeight,this._groundMaterial.reflectionFalloffDistance=this._options.groundMirrorFallOffDistance)},r.prototype._setupSkybox=function(e){var t=this;this._skybox&&!this._skybox.isDisposed()||(this._skybox=Na.Mesh.CreateBox("BackgroundSkybox",e.skyboxSize,this._scene,void 0,Na.Mesh.BACKSIDE),this._skybox.onDisposeObservable.add((function(){t._skybox=null}))),this._skybox.parent=this._rootMesh},r.prototype._setupSkyboxMaterial=function(){this._skybox&&(this._skyboxMaterial||(this._skyboxMaterial=new Na.BackgroundMaterial("BackgroundSkyboxMaterial",this._scene)),this._skyboxMaterial.useRGBColor=!1,this._skyboxMaterial.primaryColor=this._options.skyboxColor,this._skyboxMaterial.enableNoise=!0,this._skybox.material=this._skyboxMaterial)},r.prototype._setupSkyboxReflectionTexture=function(){this._skyboxMaterial&&(this._skyboxTexture||(this._options.skyboxTexture instanceof Na.BaseTexture?this._skyboxMaterial.reflectionTexture=this._options.skyboxTexture:(this._skyboxTexture=new Na.CubeTexture(this._options.skyboxTexture,this._scene,void 0,void 0,void 0,void 0,this._errorHandler),this._skyboxTexture.coordinatesMode=Na.Texture.SKYBOX_MODE,this._skyboxTexture.gammaSpace=!1,this._skyboxMaterial.reflectionTexture=this._skyboxTexture)))},r.prototype.dispose=function(){this._groundMaterial&&this._groundMaterial.dispose(!0,!0),this._skyboxMaterial&&this._skyboxMaterial.dispose(!0,!0),this._rootMesh.dispose(!1)},r._groundTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundGround.png",r._skyboxTextureCDNUrl="https://assets.babylonjs.com/environments/backgroundSkybox.dds",r._environmentTextureCDNUrl="https://assets.babylonjs.com/environments/environmentSpecular.env",r})(),Na.EnvironmentHelper=Va,Ua=$a||($a={}),za=(function(){function c(){this.systems=new Array}return Object.defineProperty(c.prototype,"emitterNode",{get:function(){return this._emitterNode},enumerable:!0,configurable:!0}),c.prototype.setEmitterAsSphere=function(e,t,i){this._emitterNode&&this._emitterNode.dispose(),this._emitterCreationOptions={kind:"Sphere",options:e,renderingGroupId:t};var r=Ua.MeshBuilder.CreateSphere("emitterSphere",{diameter:e.diameter,segments:e.segments},i);r.renderingGroupId=t;var n=new Ua.StandardMaterial("emitterSphereMaterial",i);n.emissiveColor=e.color,r.material=n;for(var o=0,s=this.systems;o<s.length;o++){s[o].emitter=r}this._emitterNode=r},c.prototype.start=function(e){for(var t=0,i=this.systems;t<i.length;t++){var r=i[t];e&&(r.emitter=e),r.start()}},c.prototype.dispose=function(){for(var e=0,t=this.systems;e<t.length;e++){t[e].dispose()}this.systems=[],this._emitterNode&&(this._emitterNode.dispose(),this._emitterNode=null)},c.prototype.serialize=function(){for(var e={systems:[]},t=0,i=this.systems;t<i.length;t++){var r=i[t];e.systems.push(r.serialize())}return this._emitterNode&&(e.emitter=this._emitterCreationOptions),e},c.Parse=function(e,t,i){void 0===i&&(i=!1);var r=new c,n=Ua.ParticleHelper.BaseAssetsUrl+"/textures/";t=t||Ua.Engine.LastCreatedScene;for(var o=0,s=e.systems;o<s.length;o++){var a=s[o];r.systems.push(i?Ua.GPUParticleSystem.Parse(a,t,n,!0):Ua.ParticleSystem.Parse(a,t,n,!0))}if(e.emitter){var l=e.emitter.options;switch(e.emitter.kind){case"Sphere":r.setEmitterAsSphere({diameter:l.diameter,segments:l.segments,color:Ua.Color3.FromArray(l.color)},e.emitter.renderingGroupId,t)}}return r},c})(),Ua.ParticleSystemSet=za,Ga=$a||($a={}),ka=(function(){function e(){}return e.CreateDefault=function(e,t,i,r){var n;return void 0===t&&(t=500),void 0===r&&(r=!1),(n=r?new Ga.GPUParticleSystem("default system",{capacity:t},i):new Ga.ParticleSystem("default system",t,i)).emitter=e,n.particleTexture=new Ga.Texture("https://www.babylonjs.com/assets/Flare.png",n.getScene()),n.createConeEmitter(.1,Math.PI/4),n.color1=new Ga.Color4(1,1,1,1),n.color2=new Ga.Color4(1,1,1,1),n.colorDead=new Ga.Color4(1,1,1,0),n.minSize=.1,n.maxSize=.1,n.minEmitPower=2,n.maxEmitPower=2,n.updateSpeed=1/60,n.emitRate=30,n},e.CreateAsync=function(n,o,s){void 0===s&&(s=!1),o||(o=Ga.Engine.LastCreatedScene);var a={};return o._addPendingData(a),new Promise(function(r,i){if(s&&!Ga.GPUParticleSystem.IsSupported)return o._removePendingData(a),i("Particle system with GPU is not supported.");Ga.Tools.LoadFile(e.BaseAssetsUrl+"/systems/"+n+".json",(function(e,t){o._removePendingData(a);var i=JSON.parse(e.toString());return r(Ga.ParticleSystemSet.Parse(i,o,s))}),void 0,void 0,void 0,(function(e,t){return o._removePendingData(a),i("An error occured while the creation of your particle system. Check if your type '"+n+"' exists.")}))})},e.ExportSet=function(e){for(var t=new Ga.ParticleSystemSet,i=0,r=e;i<r.length;i++){var n=r[i];t.systems.push(n)}return t},e.BaseAssetsUrl="https://assets.babylonjs.com/particles",e})(),Ga.ParticleHelper=ka,Wa=$a||($a={}),Ha=(function(l){function e(e,t,i,r){var n=l.call(this,e,r)||this;n._useDirectMapping=!1,e=e||"videoDome",i.resolution=0|Math.abs(i.resolution)||32,i.clickToPlay=Boolean(i.clickToPlay),i.autoPlay=void 0===i.autoPlay||Boolean(i.autoPlay),i.loop=void 0===i.loop||Boolean(i.loop),i.size=Math.abs(i.size)||(r.activeCamera?.48*r.activeCamera.maxZ:1e3),void 0===i.useDirectMapping?n._useDirectMapping=!0:n._useDirectMapping=i.useDirectMapping,n._setReady(!1);var o={loop:i.loop,autoPlay:i.autoPlay,autoUpdateTexture:!0,poster:i.poster},s=n._material=new Wa.BackgroundMaterial(e+"_material",r),a=n._videoTexture=new Wa.VideoTexture(e+"_texture",t,r,!1,n._useDirectMapping,Wa.Texture.TRILINEAR_SAMPLINGMODE,o);return n._mesh=Wa.Mesh.CreateSphere(e+"_mesh",i.resolution,i.size,r,!1,Wa.Mesh.BACKSIDE),a.onLoadObservable.addOnce((function(){n._setReady(!0)})),s.useEquirectangularFOV=!0,s.fovMultiplier=1,s.opacityFresnel=!1,n._useDirectMapping?(a.wrapU=Wa.Texture.CLAMP_ADDRESSMODE,a.wrapV=Wa.Texture.CLAMP_ADDRESSMODE,s.diffuseTexture=a):(a.coordinatesMode=Wa.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,a.wrapV=Wa.Texture.CLAMP_ADDRESSMODE,s.reflectionTexture=a),n._mesh.material=s,n._mesh.parent=n,i.clickToPlay&&(r.onPointerUp=function(){n._videoTexture.video.play()}),n}return T(e,l),Object.defineProperty(e.prototype,"videoTexture",{get:function(){return this._videoTexture},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!0,configurable:!0}),e.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._videoTexture.dispose(),this._mesh.dispose(),this._material.dispose(),l.prototype.dispose.call(this,e,t)},e})(Wa.TransformNode),Wa.VideoDome=Ha,Xa=$a||($a={}),ja=(function(a){function e(e,t,i,r,n){void 0===n&&(n=null);var o=a.call(this,e,r)||this;o._useDirectMapping=!1,o.onLoadErrorObservable=new Xa.Observable,e=e||"photoDome",i.resolution=0|Math.abs(i.resolution)||32,i.size=Math.abs(i.size)||(r.activeCamera?.48*r.activeCamera.maxZ:1e3),void 0===i.useDirectMapping?o._useDirectMapping=!0:o._useDirectMapping=i.useDirectMapping,o._setReady(!1);var s=o._material=new Xa.BackgroundMaterial(e+"_material",r);return o._mesh=Xa.Mesh.CreateSphere(e+"_mesh",i.resolution,i.size,r,!1,Xa.Mesh.BACKSIDE),s.opacityFresnel=!1,s.useEquirectangularFOV=!0,s.fovMultiplier=1,o.photoTexture=new Xa.Texture(t,r,!0,!o._useDirectMapping,void 0,void 0,function(e,t){o.onLoadErrorObservable.notifyObservers(e||"Unknown error occured"),n&&n(e,t)}),o.photoTexture.onLoadObservable.addOnce((function(){o._setReady(!0)})),o._mesh.material=s,o._mesh.parent=o}return T(e,a),Object.defineProperty(e.prototype,"photoTexture",{get:function(){return this._photoTexture},set:function(e){this._photoTexture!==e&&(this._photoTexture=e,this._useDirectMapping?(this._photoTexture.wrapU=Xa.Texture.CLAMP_ADDRESSMODE,this._photoTexture.wrapV=Xa.Texture.CLAMP_ADDRESSMODE,this._material.diffuseTexture=this._photoTexture):(this._photoTexture.coordinatesMode=Xa.Texture.FIXED_EQUIRECTANGULAR_MIRRORED_MODE,this._photoTexture.wrapV=Xa.Texture.CLAMP_ADDRESSMODE,this._material.reflectionTexture=this._photoTexture))},enumerable:!0,configurable:!0}),Object.defineProperty(e.prototype,"fovMultiplier",{get:function(){return this._material.fovMultiplier},set:function(e){this._material.fovMultiplier=e},enumerable:!0,configurable:!0}),e.prototype.dispose=function(e,t){void 0===t&&(t=!1),this._photoTexture.dispose(),this._mesh.dispose(),this._material.dispose(),this.onLoadErrorObservable.clear(),a.prototype.dispose.call(this,e,t)},e})(Xa.TransformNode),Xa.PhotoDome=ja,Ya=$a||($a={}),Ka=function(){this.occlusionInternalRetryCounter=0,this.isOcclusionQueryInProgress=!1,this.isOccluded=!1,this.occlusionRetryCount=-1,this.occlusionType=Ya.AbstractMesh.OCCLUSION_TYPE_NONE,this.occlusionQueryAlgorithmType=Ya.AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE},Ya.Engine.prototype.createQuery=function(){return this._gl.createQuery()},Ya.Engine.prototype.deleteQuery=function(e){return this._gl.deleteQuery(e),this},Ya.Engine.prototype.isQueryResultAvailable=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT_AVAILABLE)},Ya.Engine.prototype.getQueryResult=function(e){return this._gl.getQueryParameter(e,this._gl.QUERY_RESULT)},Ya.Engine.prototype.beginOcclusionQuery=function(e,t){var i=this._getGlAlgorithmType(e);return this._gl.beginQuery(i,t),this},Ya.Engine.prototype.endOcclusionQuery=function(e){var t=this._getGlAlgorithmType(e);return this._gl.endQuery(t),this},Ya.Engine.prototype._createTimeQuery=function(){var e=this.getCaps().timerQuery;return e.createQueryEXT?e.createQueryEXT():this.createQuery()},Ya.Engine.prototype._deleteTimeQuery=function(e){var t=this.getCaps().timerQuery;t.deleteQueryEXT?t.deleteQueryEXT(e):this.deleteQuery(e)},Ya.Engine.prototype._getTimeQueryResult=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_EXT):this.getQueryResult(e)},Ya.Engine.prototype._getTimeQueryAvailability=function(e){var t=this.getCaps().timerQuery;return t.getQueryObjectEXT?t.getQueryObjectEXT(e,t.QUERY_RESULT_AVAILABLE_EXT):this.isQueryResultAvailable(e)},Ya.Engine.prototype.startTimeQuery=function(){var e=this.getCaps(),t=e.timerQuery;if(!t)return null;var i=new Ya._TimeToken;if(this._gl.getParameter(t.GPU_DISJOINT_EXT),e.canUseTimestampForTimerQuery)i._startTimeQuery=this._createTimeQuery(),t.queryCounterEXT(i._startTimeQuery,t.TIMESTAMP_EXT);else{if(this._currentNonTimestampToken)return this._currentNonTimestampToken;i._timeElapsedQuery=this._createTimeQuery(),t.beginQueryEXT?t.beginQueryEXT(t.TIME_ELAPSED_EXT,i._timeElapsedQuery):this._gl.beginQuery(t.TIME_ELAPSED_EXT,i._timeElapsedQuery),this._currentNonTimestampToken=i}return i},Ya.Engine.prototype.endTimeQuery=function(e){var t=this.getCaps(),i=t.timerQuery;if(!i||!e)return-1;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery)return-1;e._endTimeQuery||(e._endTimeQuery=this._createTimeQuery(),i.queryCounterEXT(e._endTimeQuery,i.TIMESTAMP_EXT))}else if(!e._timeElapsedQueryEnded){if(!e._timeElapsedQuery)return-1;i.endQueryEXT?i.endQueryEXT(i.TIME_ELAPSED_EXT):this._gl.endQuery(i.TIME_ELAPSED_EXT),e._timeElapsedQueryEnded=!0}var r=this._gl.getParameter(i.GPU_DISJOINT_EXT),n=!1;if(e._endTimeQuery?n=this._getTimeQueryAvailability(e._endTimeQuery):e._timeElapsedQuery&&(n=this._getTimeQueryAvailability(e._timeElapsedQuery)),n&&!r){var o=0;if(t.canUseTimestampForTimerQuery){if(!e._startTimeQuery||!e._endTimeQuery)return-1;var s=this._getTimeQueryResult(e._startTimeQuery);o=this._getTimeQueryResult(e._endTimeQuery)-s,this._deleteTimeQuery(e._startTimeQuery),this._deleteTimeQuery(e._endTimeQuery),e._startTimeQuery=null,e._endTimeQuery=null}else{if(!e._timeElapsedQuery)return-1;o=this._getTimeQueryResult(e._timeElapsedQuery),this._deleteTimeQuery(e._timeElapsedQuery),e._timeElapsedQuery=null,e._timeElapsedQueryEnded=!1,this._currentNonTimestampToken=null}return o}return-1},Ya.Engine.prototype._getGlAlgorithmType=function(e){return e===Ya.AbstractMesh.OCCLUSION_ALGORITHM_TYPE_CONSERVATIVE?this._gl.ANY_SAMPLES_PASSED_CONSERVATIVE:this._gl.ANY_SAMPLES_PASSED},Object.defineProperty(Ya.AbstractMesh.prototype,"isOcclusionQueryInProgress",{get:function(){return this._occlusionDataStorage.isOcclusionQueryInProgress},enumerable:!1,configurable:!0}),Object.defineProperty(Ya.AbstractMesh.prototype,"_occlusionDataStorage",{get:function(){return this.__occlusionDataStorage||(this.__occlusionDataStorage=new Ka),this.__occlusionDataStorage},enumerable:!1,configurable:!0}),Object.defineProperty(Ya.AbstractMesh.prototype,"isOccluded",{get:function(){return this._occlusionDataStorage.isOccluded},set:function(e){this._occlusionDataStorage.isOccluded=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ya.AbstractMesh.prototype,"occlusionQueryAlgorithmType",{get:function(){return this._occlusionDataStorage.occlusionQueryAlgorithmType},set:function(e){this._occlusionDataStorage.occlusionQueryAlgorithmType=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ya.AbstractMesh.prototype,"occlusionType",{get:function(){return this._occlusionDataStorage.occlusionType},set:function(e){this._occlusionDataStorage.occlusionType=e},enumerable:!0,configurable:!0}),Object.defineProperty(Ya.AbstractMesh.prototype,"occlusionRetryCount",{get:function(){return this._occlusionDataStorage.occlusionRetryCount},set:function(e){this._occlusionDataStorage.occlusionRetryCount=e},enumerable:!0,configurable:!0}),Ya.AbstractMesh.prototype._checkOcclusionQuery=function(){var e=this._occlusionDataStorage;if(e.occlusionType===Ya.AbstractMesh.OCCLUSION_TYPE_NONE)return e.isOccluded=!1;var t=this.getEngine();if(t.webGLVersion<2)return e.isOccluded=!1;if(!t.isQueryResultAvailable)return e.isOccluded=!1;if(this.isOcclusionQueryInProgress&&this._occlusionQuery)if(t.isQueryResultAvailable(this._occlusionQuery)){var i=t.getQueryResult(this._occlusionQuery);e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=1!==i}else{if(e.occlusionInternalRetryCounter++,!(-1!==e.occlusionRetryCount&&e.occlusionInternalRetryCounter>e.occlusionRetryCount))return!1;e.isOcclusionQueryInProgress=!1,e.occlusionInternalRetryCounter=0,e.isOccluded=e.occlusionType!==Ya.AbstractMesh.OCCLUSION_TYPE_OPTIMISTIC&&e.isOccluded}var r=this.getScene();if(r.getBoundingBoxRenderer){var n=r.getBoundingBoxRenderer();this._occlusionQuery||(this._occlusionQuery=t.createQuery()),t.beginOcclusionQuery(e.occlusionQueryAlgorithmType,this._occlusionQuery),n.renderOcclusionBoundingBox(this),t.endOcclusionQuery(e.occlusionQueryAlgorithmType),this._occlusionDataStorage.isOcclusionQueryInProgress=!0}return e.isOccluded},Qa=$a||($a={}),Za=(function(s){function n(e,t,i,r,n){void 0===t&&(t=256),void 0===i&&(i=Qa.Engine.LastCreatedScene);var o=s.call(this,e,t,"noise",i,r,n)||this;return o._time=0,o.brightness=.2,o.octaves=3,o.persistence=.8,o.animationSpeedFactor=1,o.autoClear=!1,o._updateShaderUniforms(),o}return T(n,s),n.prototype._updateShaderUniforms=function(){var e=this.getScene();e&&(this._time+=e.getAnimationRatio()*this.animationSpeedFactor*.01,this.setFloat("brightness",this.brightness),this.setFloat("persistence",this.persistence),this.setFloat("timeScale",this._time))},n.prototype._getDefines=function(){return"#define OCTAVES "+(0|this.octaves)},n.prototype.render=function(e){this._updateShaderUniforms(),s.prototype.render.call(this,e)},n.prototype.serialize=function(){var e={customType:"BABYLON.NoiseProceduralTexture"};return e.brightness=this.brightness,e.octaves=this.octaves,e.persistence=this.persistence,e.animationSpeedFactor=this.animationSpeedFactor,e.size=this.getSize().width,e.generateMipMaps=this._generateMipMaps,e},n.Parse=function(e,t,i){var r=new n(e.name,e.size,t,void 0,e.generateMipMaps);return r.brightness=e.brightness,r.octaves=e.octaves,r.persistence=e.persistence,r.animationSpeedFactor=e.animationSpeedFactor,r},n})(Qa.ProceduralTexture),Qa.NoiseProceduralTexture=Za;var qa,Ja,$a,el;ae=this&&this.__assign||function(){return(ae=Object.assign||function(e){for(var t,i=1,r=arguments.length;i<r;i++)for(var n in t=arguments[i])Object.prototype.hasOwnProperty.call(t,n)&&(e[n]=t[n]);return e}).apply(this,arguments)};qa=$a||($a={}),Ja=(function(){function n(e,t){if(void 0===t&&(t=null),!n.IsSupported(e))throw"Your browser does not support recording so far.";var i=e.getRenderingCanvas();if(!i)throw"The babylon engine must have a canvas to be recorded";this._canvas=i,this._canvas.isRecording=!1,this._options=ae({},n._defaultOptions,t);var r=this._canvas.captureStream(this._options.fps);this._mediaRecorder=new MediaRecorder(r,{mimeType:this._options.mimeType}),this._mediaRecorder.ondataavailable=this._handleDataAvailable.bind(this),this._mediaRecorder.onerror=this._handleError.bind(this),this._mediaRecorder.onstop=this._handleStop.bind(this)}return n.IsSupported=function(e){var t=e.getRenderingCanvas();return!!t&&"function"==typeof t.captureStream},Object.defineProperty(n.prototype,"isRecording",{get:function(){return!!this._canvas&&this._canvas.isRecording},enumerable:!0,configurable:!0}),n.prototype.stopRecording=function(){this._canvas&&this._mediaRecorder&&this.isRecording&&(this._canvas.isRecording=!1,this._mediaRecorder.stop())},n.prototype.startRecording=function(e,t){var i=this;if(void 0===e&&(e="babylonjs.webm"),void 0===t&&(t=7),!this._canvas||!this._mediaRecorder)throw"Recorder has already been disposed";if(this.isRecording)throw"Recording already in progress";return 0<t&&setTimeout((function(){i.stopRecording()}),1e3*t),this._fileName=e,this._recordedChunks=[],this._resolve=null,this._reject=null,this._canvas.isRecording=!0,this._mediaRecorder.start(this._options.recordChunckSize),new Promise(function(e,t){i._resolve=e,i._reject=t})},n.prototype.dispose=function(){this._canvas=null,this._mediaRecorder=null,this._recordedChunks=[],this._fileName=null,this._resolve=null,this._reject=null},n.prototype._handleDataAvailable=function(e){0<e.data.size&&this._recordedChunks.push(e.data)},n.prototype._handleError=function(e){if(this.stopRecording(),!this._reject)throw new e.error;this._reject(e.error)},n.prototype._handleStop=function(){this.stopRecording();var e=new Blob(this._recordedChunks);this._resolve&&this._resolve(e),window.URL.createObjectURL(e),this._fileName&&qa.Tools.Download(e,this._fileName)},n._defaultOptions={mimeType:"video/webm",fps:25,recordChunckSize:3e3},n})(),qa.VideoRecorder=Ja,(el=$a||($a={})).Scene.prototype.createDefaultLight=function(e){if(void 0===e&&(e=!1),e&&this.lights)for(var t=0;t<this.lights.length;t++)this.lights[t].dispose();0===this.lights.length&&new el.HemisphericLight("default light",el.Vector3.Up(),this)},el.Scene.prototype.createDefaultCamera=function(e,t,i){if(void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),t&&this.activeCamera&&(this.activeCamera.dispose(),this.activeCamera=null),!this.activeCamera){var r,n=this.getWorldExtends(),o=n.max.subtract(n.min),s=n.min.add(o.scale(.5)),a=1.5*o.length();if(isFinite(a)||(a=1,s.copyFromFloats(0,0,0)),e){var l=new el.ArcRotateCamera("default camera",-Math.PI/2,Math.PI/2,a,s,this);l.lowerRadiusLimit=.01*a,l.wheelPrecision=100/a,r=l}else{var c=new el.FreeCamera("default camera",new el.Vector3(s.x,s.y,-a),this);c.setTarget(s),r=c}r.minZ=.01*a,r.maxZ=1e3*a,r.speed=.2*a,this.activeCamera=r;var h=this.getEngine().getRenderingCanvas();i&&h&&r.attachControl(h)}},el.Scene.prototype.createDefaultCameraOrLight=function(e,t,i){void 0===e&&(e=!1),void 0===t&&(t=!1),void 0===i&&(i=!1),this.createDefaultLight(t),this.createDefaultCamera(e,t,i)},el.Scene.prototype.createDefaultSkybox=function(e,t,i,r,n){if(void 0===t&&(t=!1),void 0===i&&(i=1e3),void 0===r&&(r=0),void 0===n&&(n=!0),!e)return el.Tools.Warn("Can not create default skybox without environment texture."),null;n&&e&&(this.environmentTexture=e);var o=el.Mesh.CreateBox("hdrSkyBox",i,this);if(t){var s=new el.PBRMaterial("skyBox",this);s.backFaceCulling=!1,s.reflectionTexture=e.clone(),s.reflectionTexture&&(s.reflectionTexture.coordinatesMode=el.Texture.SKYBOX_MODE),s.microSurface=1-r,s.disableLighting=!0,s.twoSidedLighting=!0,o.infiniteDistance=!0,o.material=s}else{var a=new el.StandardMaterial("skyBox",this);a.backFaceCulling=!1,a.reflectionTexture=e.clone(),a.reflectionTexture&&(a.reflectionTexture.coordinatesMode=el.Texture.SKYBOX_MODE),a.disableLighting=!0,o.infiniteDistance=!0,o.material=a}return o},el.Scene.prototype.createDefaultEnvironment=function(e){return el.EnvironmentHelper?new el.EnvironmentHelper(e,this):null},el.Scene.prototype.createDefaultVRExperience=function(e){return void 0===e&&(e={}),new el.VRExperienceHelper(this,e)},$a.Effect.ShadersStore={defaultVertexShader:"#include<__decl__defaultVertex>\n\n#define CUSTOM_VERTEX_BEGIN\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nvarying vec2 vSpecularUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\n#define CUSTOM_VERTEX_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_VERTEX_MAIN_BEGIN\nvec3 positionUpdated=position;\n#ifdef NORMAL \nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\n#else\nvPositionUVW=position;\n#endif\n#endif \n#define CUSTOM_VERTEX_UPDATE_POSITION\n#define CUSTOM_VERTEX_UPDATE_NORMAL\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif\n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM) && SPECULARDIRECTUV == 0\nif (vSpecularInfos.x == 0.)\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvSpecularUV=vec2(specularMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#include<bumpVertex>\n#include<clipPlaneVertex>\n#include<fogVertex>\n#include<shadowsVertex>[0..maxSimultaneousLights]\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n#include<pointCloudVertex>\n#include<logDepthVertex>\n#define CUSTOM_VERTEX_MAIN_END\n}\n",defaultPixelShader:"#include<__decl__defaultFragment>\n#if defined(BUMP) || !defined(NORMAL)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#define CUSTOM_FRAGMENT_BEGIN\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\n\n#define RECIPROCAL_PI2 0.15915494\nuniform vec3 vEyePosition;\nuniform vec3 vAmbientColor;\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2;\n#endif\n\n#include<helperFunctions>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY \n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\nuniform samplerCube refractionCubeSampler;\n#else\nuniform sampler2D refraction2DSampler;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\n#if SPECULARDIRECTUV == 1\n#define vSpecularUV vMainUV1\n#elif SPECULARDIRECTUV == 2\n#define vSpecularUV vMainUV2\n#else\nvarying vec2 vSpecularUV;\n#endif\nuniform sampler2D specularSampler;\n#endif\n#ifdef ALPHATEST\nuniform float alphaCutOff;\n#endif\n\n#include<fresnelFunction>\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\nuniform samplerCube reflectionCubeSampler;\n#else\nuniform sampler2D reflection2DSampler;\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#include<imageProcessingDeclaration>\n#include<imageProcessingFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n#include<fogFragmentDeclaration>\n#define CUSTOM_FRAGMENT_DEFINITIONS\nvoid main(void) {\n#define CUSTOM_FRAGMENT_MAIN_BEGIN\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\nvec4 baseColor=vec4(1.,1.,1.,1.);\nvec3 diffuseColor=vDiffuseColor.rgb;\n\nfloat alpha=vDiffuseColor.a;\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(-cross(dFdx(vPositionW),dFdy(vPositionW)));\n#endif\n#include<bumpFragment>\n#ifdef TWOSIDEDLIGHTING\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n#ifdef DIFFUSE\nbaseColor=texture2D(diffuseSampler,vDiffuseUV+uvOffset);\n#ifdef ALPHATEST\nif (baseColor.a<alphaCutOff)\ndiscard;\n#endif\n#ifdef ALPHAFROMDIFFUSE\nalpha*=baseColor.a;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_ALPHA\nbaseColor.rgb*=vDiffuseInfos.y;\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nbaseColor.rgb*=vColor.rgb;\n#endif\n#define CUSTOM_FRAGMENT_UPDATE_DIFFUSE\n\nvec3 baseAmbientColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nbaseAmbientColor=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_LIGHTS\n\n#ifdef SPECULARTERM\nfloat glossiness=vSpecularColor.a;\nvec3 specularColor=vSpecularColor.rgb;\n#ifdef SPECULAR\nvec4 specularMapColor=texture2D(specularSampler,vSpecularUV+uvOffset);\nspecularColor=specularMapColor.rgb;\n#ifdef GLOSSINESS\nglossiness=glossiness*specularMapColor.a;\n#endif\n#endif\n#else\nfloat glossiness=0.;\n#endif\n\nvec3 diffuseBase=vec3(0.,0.,0.);\nlightingInfo info;\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\nfloat shadow=1.;\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb*vLightmapInfos.y;\n#endif\n#include<lightFragment>[0..maxSimultaneousLights]\n\nvec3 refractionColor=vec3(0.,0.,0.);\n#ifdef REFRACTION\nvec3 refractionVector=normalize(refract(-viewDirectionW,normalW,vRefractionInfos.y));\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nif (dot(refractionVector,viewDirectionW)<1.0) {\nrefractionColor=textureCube(refractionCubeSampler,refractionVector).rgb;\n}\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\nrefractionColor=texture2D(refraction2DSampler,refractionCoords).rgb;\n#endif\n#ifdef IS_REFRACTION_LINEAR\nrefractionColor=toGammaSpace(refractionColor);\n#endif\nrefractionColor*=vRefractionInfos.x;\n#endif\n\nvec3 reflectionColor=vec3(0.,0.,0.);\n#ifdef REFLECTION\nvec3 vReflectionUVW=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_3D\n#ifdef ROUGHNESS\nfloat bias=vReflectionInfos.y;\n#ifdef SPECULARTERM\n#ifdef SPECULAR\n#ifdef GLOSSINESS\nbias*=(1.0-specularMapColor.a);\n#endif\n#endif\n#endif\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW,bias).rgb;\n#else\nreflectionColor=textureCube(reflectionCubeSampler,vReflectionUVW).rgb;\n#endif\n#else\nvec2 coords=vReflectionUVW.xy;\n#ifdef REFLECTIONMAP_PROJECTION\ncoords/=vReflectionUVW.z;\n#endif\ncoords.y=1.0-coords.y;\nreflectionColor=texture2D(reflection2DSampler,coords).rgb;\n#endif\n#ifdef IS_REFLECTION_LINEAR\nreflectionColor=toGammaSpace(reflectionColor);\n#endif\nreflectionColor*=vReflectionInfos.x;\n#ifdef REFLECTIONFRESNEL\nfloat reflectionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,reflectionRightColor.a,reflectionLeftColor.a);\n#ifdef REFLECTIONFRESNELFROMSPECULAR\n#ifdef SPECULARTERM\nreflectionColor*=specularColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#else\nreflectionColor*=reflectionLeftColor.rgb*(1.0-reflectionFresnelTerm)+reflectionFresnelTerm*reflectionRightColor.rgb;\n#endif\n#endif\n#endif\n#ifdef REFRACTIONFRESNEL\nfloat refractionFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,refractionRightColor.a,refractionLeftColor.a);\nrefractionColor*=refractionLeftColor.rgb*(1.0-refractionFresnelTerm)+refractionFresnelTerm*refractionRightColor.rgb;\n#endif\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nopacityMap.rgb=opacityMap.rgb*vec3(0.3,0.59,0.11);\nalpha*=(opacityMap.x+opacityMap.y+opacityMap.z)* vOpacityInfos.y;\n#else\nalpha*=opacityMap.a*vOpacityInfos.y;\n#endif\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#ifdef OPACITYFRESNEL\nfloat opacityFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,opacityParts.z,opacityParts.w);\nalpha+=opacityParts.x*(1.0-opacityFresnelTerm)+opacityFresnelTerm*opacityParts.y;\n#endif\n\nvec3 emissiveColor=vEmissiveColor;\n#ifdef EMISSIVE\nemissiveColor+=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb*vEmissiveInfos.y;\n#endif\n#ifdef EMISSIVEFRESNEL\nfloat emissiveFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,emissiveRightColor.a,emissiveLeftColor.a);\nemissiveColor*=emissiveLeftColor.rgb*(1.0-emissiveFresnelTerm)+emissiveFresnelTerm*emissiveRightColor.rgb;\n#endif\n\n#ifdef DIFFUSEFRESNEL\nfloat diffuseFresnelTerm=computeFresnelTerm(viewDirectionW,normalW,diffuseRightColor.a,diffuseLeftColor.a);\ndiffuseBase*=diffuseLeftColor.rgb*(1.0-diffuseFresnelTerm)+diffuseFresnelTerm*diffuseRightColor.rgb;\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\n#ifdef LINKEMISSIVEWITHDIFFUSE\nvec3 finalDiffuse=clamp((diffuseBase+emissiveColor)*diffuseColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#else\nvec3 finalDiffuse=clamp(diffuseBase*diffuseColor+emissiveColor+vAmbientColor,0.0,1.0)*baseColor.rgb;\n#endif\n#endif\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase*specularColor;\n#ifdef SPECULAROVERALPHA\nalpha=clamp(alpha+dot(finalSpecular,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n#else\nvec3 finalSpecular=vec3(0.0);\n#endif\n#ifdef REFLECTIONOVERALPHA\nalpha=clamp(alpha+dot(reflectionColor,vec3(0.3,0.59,0.11)),0.,1.);\n#endif\n\n#ifdef EMISSIVEASILLUMINATION\nvec4 color=vec4(clamp(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+emissiveColor+refractionColor,0.0,1.0),alpha);\n#else\nvec4 color=vec4(finalDiffuse*baseAmbientColor+finalSpecular+reflectionColor+refractionColor,alpha);\n#endif\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\ncolor.rgb*=lightmapColor;\n#else\ncolor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FOG\ncolor.rgb=max(color.rgb,0.);\n#include<logDepthFragment>\n#include<fogFragment>\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\ncolor.rgb=toLinearSpace(color.rgb);\n#else\n#ifdef IMAGEPROCESSING\ncolor.rgb=toLinearSpace(color.rgb);\ncolor=applyImageProcessing(color);\n#endif\n#endif\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#define CUSTOM_FRAGMENT_BEFORE_FRAGCOLOR\ngl_FragColor=color;\n}\n",pbrVertexShader:"precision highp float;\n#include<__decl__pbrVertex>\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#ifdef TANGENT\nattribute vec4 tangent;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2; \n#endif \n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<helperFunctions>\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#if defined(ALBEDO) && ALBEDODIRECTUV == 0\nvarying vec2 vAlbedoUV;\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0\nvarying vec2 vAmbientUV;\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0\nvarying vec2 vOpacityUV;\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0\nvarying vec2 vEmissiveUV;\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0\nvarying vec2 vLightmapUV;\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0\nvarying vec2 vReflectivityUV;\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0\nvarying vec2 vBumpUV;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#include<harmonicsFunctions>\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n#include<bumpVertexDeclaration>\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\nvec3 positionUpdated=position;\n#ifdef NORMAL\nvec3 normalUpdated=normal;\n#endif\n#ifdef TANGENT\nvec4 tangentUpdated=tangent;\n#endif\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(positionUpdated,1.0)).xyz;\n#else\nvPositionUVW=positionUpdated;\n#endif\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0);\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normalUpdated);\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvec3 reflectionVector=vec3(reflectionMatrix*vec4(vNormalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\nvEnvironmentIrradiance=environmentIrradianceJones(reflectionVector);\n#endif\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(positionUpdated,0.0)));\n#endif\n\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif \n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif \n#if defined(ALBEDO) && ALBEDODIRECTUV == 0 \nif (vAlbedoInfos.x == 0.)\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAlbedoUV=vec2(albedoMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(AMBIENT) && AMBIENTDIRECTUV == 0 \nif (vAmbientInfos.x == 0.)\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvAmbientUV=vec2(ambientMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(OPACITY) && OPACITYDIRECTUV == 0 \nif (vOpacityInfos.x == 0.)\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvOpacityUV=vec2(opacityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(EMISSIVE) && EMISSIVEDIRECTUV == 0 \nif (vEmissiveInfos.x == 0.)\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvEmissiveUV=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(LIGHTMAP) && LIGHTMAPDIRECTUV == 0 \nif (vLightmapInfos.x == 0.)\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvLightmapUV=vec2(lightmapMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(REFLECTIVITY) && REFLECTIVITYDIRECTUV == 0 \nif (vReflectivityInfos.x == 0.)\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvReflectivityUV=vec2(reflectivityMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(MICROSURFACEMAP) && MICROSURFACEMAPDIRECTUV == 0 \nif (vMicroSurfaceSamplerInfos.x == 0.)\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvMicroSurfaceSamplerUV=vec2(microSurfaceSamplerMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n#if defined(BUMP) && BUMPDIRECTUV == 0 \nif (vBumpInfos.x == 0.)\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvBumpUV=vec2(bumpMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<bumpVertex>\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n\n#include<logDepthVertex>\n}",pbrPixelShader:"#if defined(BUMP) || !defined(NORMAL) || defined(FORCENORMALFORWARD) || defined(SPECULARAA)\n#extension GL_OES_standard_derivatives : enable\n#endif\n#ifdef LODBASEDMICROSFURACE\n#extension GL_EXT_shader_texture_lod : enable\n#endif\n#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nprecision highp float;\n#include<__decl__pbrFragment>\nuniform vec4 vEyePosition;\nuniform vec3 vAmbientColor;\nuniform vec4 vCameraInfos;\n\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif \n#ifdef MAINUV2 \nvarying vec2 vMainUV2;\n#endif \n#ifdef NORMAL\nvarying vec3 vNormalW;\n#if defined(USESPHERICALFROMREFLECTIONMAP) && defined(USESPHERICALINVERTEX)\nvarying vec3 vEnvironmentIrradiance;\n#endif\n#endif\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n\n#ifdef ALBEDO\n#if ALBEDODIRECTUV == 1\n#define vAlbedoUV vMainUV1\n#elif ALBEDODIRECTUV == 2\n#define vAlbedoUV vMainUV2\n#else\nvarying vec2 vAlbedoUV;\n#endif\nuniform sampler2D albedoSampler;\n#endif\n#ifdef AMBIENT\n#if AMBIENTDIRECTUV == 1\n#define vAmbientUV vMainUV1\n#elif AMBIENTDIRECTUV == 2\n#define vAmbientUV vMainUV2\n#else\nvarying vec2 vAmbientUV;\n#endif\nuniform sampler2D ambientSampler;\n#endif\n#ifdef OPACITY\n#if OPACITYDIRECTUV == 1\n#define vOpacityUV vMainUV1\n#elif OPACITYDIRECTUV == 2\n#define vOpacityUV vMainUV2\n#else\nvarying vec2 vOpacityUV;\n#endif\nuniform sampler2D opacitySampler;\n#endif\n#ifdef EMISSIVE\n#if EMISSIVEDIRECTUV == 1\n#define vEmissiveUV vMainUV1\n#elif EMISSIVEDIRECTUV == 2\n#define vEmissiveUV vMainUV2\n#else\nvarying vec2 vEmissiveUV;\n#endif\nuniform sampler2D emissiveSampler;\n#endif\n#ifdef LIGHTMAP\n#if LIGHTMAPDIRECTUV == 1\n#define vLightmapUV vMainUV1\n#elif LIGHTMAPDIRECTUV == 2\n#define vLightmapUV vMainUV2\n#else\nvarying vec2 vLightmapUV;\n#endif\nuniform sampler2D lightmapSampler;\n#endif\n#ifdef REFLECTIVITY\n#if REFLECTIVITYDIRECTUV == 1\n#define vReflectivityUV vMainUV1\n#elif REFLECTIVITYDIRECTUV == 2\n#define vReflectivityUV vMainUV2\n#else\nvarying vec2 vReflectivityUV;\n#endif\nuniform sampler2D reflectivitySampler;\n#endif\n#ifdef MICROSURFACEMAP\n#if MICROSURFACEMAPDIRECTUV == 1\n#define vMicroSurfaceSamplerUV vMainUV1\n#elif MICROSURFACEMAPDIRECTUV == 2\n#define vMicroSurfaceSamplerUV vMainUV2\n#else\nvarying vec2 vMicroSurfaceSamplerUV;\n#endif\nuniform sampler2D microSurfaceSampler;\n#endif\n\n#ifdef REFRACTION\n#ifdef REFRACTIONMAP_3D\n#define sampleRefraction(s,c) textureCube(s,c)\nuniform samplerCube refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#else\n#define sampleRefraction(s,c) texture2D(s,c)\nuniform sampler2D refractionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleRefractionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube refractionSamplerLow;\nuniform samplerCube refractionSamplerHigh;\n#endif\n#endif\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef LODBASEDMICROSFURACE\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n#ifdef ENVIRONMENTBRDF\nuniform sampler2D environmentBrdfSampler;\n#endif\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\n\n#include<shadowsFragmentFunctions>\n#include<pbrFunctions>\n#include<harmonicsFunctions>\n#include<pbrLightFunctions>\n#include<bumpFragmentFunctions>\n#include<clipPlaneFragmentDeclaration>\n#include<logDepthDeclaration>\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\n#include<clipPlaneFragment>\n\n\nvec3 viewDirectionW=normalize(vEyePosition.xyz-vPositionW);\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#endif\n#include<bumpFragment>\n#ifdef SPECULARAA\nvec3 nDfdx=dFdx(normalW.xyz);\nvec3 nDfdy=dFdy(normalW.xyz);\nfloat slopeSquare=max(dot(nDfdx,nDfdx),dot(nDfdy,nDfdy));\n\nfloat geometricRoughnessFactor=pow(clamp(slopeSquare ,0.,1.),0.333);\n\nfloat geometricAlphaGFactor=sqrt(slopeSquare);\n#else\nfloat geometricRoughnessFactor=0.;\n#endif\n#if defined(FORCENORMALFORWARD) && defined(NORMAL)\nvec3 faceNormal=normalize(cross(dFdx(vPositionW),dFdy(vPositionW)))*vEyePosition.w;\n#if defined(TWOSIDEDLIGHTING)\nfaceNormal=gl_FrontFacing ? faceNormal : -faceNormal;\n#endif\nnormalW*=sign(dot(normalW,faceNormal));\n#endif\n#if defined(TWOSIDEDLIGHTING) && defined(NORMAL)\nnormalW=gl_FrontFacing ? normalW : -normalW;\n#endif\n\n\nvec3 surfaceAlbedo=vAlbedoColor.rgb;\n\nfloat alpha=vAlbedoColor.a;\n#ifdef ALBEDO\nvec4 albedoTexture=texture2D(albedoSampler,vAlbedoUV+uvOffset);\n#if defined(ALPHAFROMALBEDO) || defined(ALPHATEST)\nalpha*=albedoTexture.a;\n#endif\nsurfaceAlbedo*=toLinearSpace(albedoTexture.rgb);\nsurfaceAlbedo*=vAlbedoInfos.y;\n#endif\n\n#ifdef OPACITY\nvec4 opacityMap=texture2D(opacitySampler,vOpacityUV+uvOffset);\n#ifdef OPACITYRGB\nalpha=getLuminance(opacityMap.rgb);\n#else\nalpha*=opacityMap.a;\n#endif\nalpha*=vOpacityInfos.y;\n#endif\n#ifdef VERTEXALPHA\nalpha*=vColor.a;\n#endif\n#if !defined(LINKREFRACTIONTOTRANSPARENCY) && !defined(ALPHAFRESNEL)\n#ifdef ALPHATEST\nif (alpha<ALPHATESTVALUE)\ndiscard;\n#ifndef ALPHABLEND\n\nalpha=1.0;\n#endif\n#endif\n#endif\n#include<depthPrePass>\n#ifdef VERTEXCOLOR\nsurfaceAlbedo*=vColor.rgb;\n#endif\n\nvec3 ambientOcclusionColor=vec3(1.,1.,1.);\n#ifdef AMBIENT\nvec3 ambientOcclusionColorMap=texture2D(ambientSampler,vAmbientUV+uvOffset).rgb*vAmbientInfos.y;\n#ifdef AMBIENTINGRAYSCALE\nambientOcclusionColorMap=vec3(ambientOcclusionColorMap.r,ambientOcclusionColorMap.r,ambientOcclusionColorMap.r);\n#endif\nambientOcclusionColor=mix(ambientOcclusionColor,ambientOcclusionColorMap,vAmbientInfos.z);\n#endif\n#ifdef UNLIT\nvec3 diffuseBase=vec3(1.,1.,1.);\n#else\n\nfloat microSurface=vReflectivityColor.a;\nvec3 surfaceReflectivityColor=vReflectivityColor.rgb;\n#ifdef METALLICWORKFLOW\nvec2 metallicRoughness=surfaceReflectivityColor.rg;\n#ifdef REFLECTIVITY\nvec4 surfaceMetallicColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\n#ifdef AOSTOREINMETALMAPRED\nvec3 aoStoreInMetalMap=vec3(surfaceMetallicColorMap.r,surfaceMetallicColorMap.r,surfaceMetallicColorMap.r);\nambientOcclusionColor=mix(ambientOcclusionColor,aoStoreInMetalMap,vReflectivityInfos.z);\n#endif\n#ifdef METALLNESSSTOREINMETALMAPBLUE\nmetallicRoughness.r*=surfaceMetallicColorMap.b;\n#else\nmetallicRoughness.r*=surfaceMetallicColorMap.r;\n#endif\n#ifdef ROUGHNESSSTOREINMETALMAPALPHA\nmetallicRoughness.g*=surfaceMetallicColorMap.a;\n#else\n#ifdef ROUGHNESSSTOREINMETALMAPGREEN\nmetallicRoughness.g*=surfaceMetallicColorMap.g;\n#endif\n#endif\n#endif\n#ifdef MICROSURFACEMAP\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\nmetallicRoughness.g*=microSurfaceTexel.r;\n#endif\n\nmicroSurface=1.0-metallicRoughness.g;\n\nvec3 baseColor=surfaceAlbedo;\n\n\nconst vec3 DefaultSpecularReflectanceDielectric=vec3(0.04,0.04,0.04);\n\nsurfaceAlbedo=mix(baseColor.rgb*(1.0-DefaultSpecularReflectanceDielectric.r),vec3(0.,0.,0.),metallicRoughness.r);\n\nsurfaceReflectivityColor=mix(DefaultSpecularReflectanceDielectric,baseColor,metallicRoughness.r);\n#else\n#ifdef REFLECTIVITY\nvec4 surfaceReflectivityColorMap=texture2D(reflectivitySampler,vReflectivityUV+uvOffset);\nsurfaceReflectivityColor*=toLinearSpace(surfaceReflectivityColorMap.rgb);\nsurfaceReflectivityColor*=vReflectivityInfos.y;\n#ifdef MICROSURFACEFROMREFLECTIVITYMAP\nmicroSurface*=surfaceReflectivityColorMap.a;\nmicroSurface*=vReflectivityInfos.z;\n#else\n#ifdef MICROSURFACEAUTOMATIC\nmicroSurface*=computeDefaultMicroSurface(microSurface,surfaceReflectivityColor);\n#endif\n#ifdef MICROSURFACEMAP\nvec4 microSurfaceTexel=texture2D(microSurfaceSampler,vMicroSurfaceSamplerUV+uvOffset)*vMicroSurfaceSamplerInfos.y;\nmicroSurface*=microSurfaceTexel.r;\n#endif\n#endif\n#endif\n#endif\n\nmicroSurface=clamp(microSurface,0.,1.);\n\nfloat roughness=1.-microSurface;\n\n#ifdef ALPHAFRESNEL\n#if defined(ALPHATEST) || defined(ALPHABLEND)\n\n\n\nfloat opacityPerceptual=alpha;\n#ifdef LINEARALPHAFRESNEL\nfloat opacity0=opacityPerceptual;\n#else\nfloat opacity0=opacityPerceptual*opacityPerceptual;\n#endif\nfloat opacity90=fresnelGrazingReflectance(opacity0);\nvec3 normalForward=faceforward(normalW,-viewDirectionW,normalW);\n\nalpha=fresnelSchlickEnvironmentGGX(clamp(dot(viewDirectionW,normalForward),0.0,1.0),vec3(opacity0),vec3(opacity90),sqrt(microSurface)).x;\n#ifdef ALPHATEST\nif (alpha<ALPHATESTVALUE)\ndiscard;\n#ifndef ALPHABLEND\n\nalpha=1.0;\n#endif\n#endif\n#endif\n#endif\n\n\nfloat NdotVUnclamped=dot(normalW,viewDirectionW);\nfloat NdotV=clamp(NdotVUnclamped,0.,1.)+0.00001;\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\n#ifdef SPECULARAA\n\n\nalphaG+=(0.75*geometricAlphaGFactor);\n#endif\n\n#ifdef REFRACTION\nvec4 environmentRefraction=vec4(0.,0.,0.,0.);\nvec3 refractionVector=refract(-viewDirectionW,normalW,vRefractionInfos.y);\n#ifdef REFRACTIONMAP_OPPOSITEZ\nrefractionVector.z*=-1.0;\n#endif\n\n#ifdef REFRACTIONMAP_3D\nrefractionVector.y=refractionVector.y*vRefractionInfos.w;\nvec3 refractionCoords=refractionVector;\nrefractionCoords=vec3(refractionMatrix*vec4(refractionCoords,0));\n#else\nvec3 vRefractionUVW=vec3(refractionMatrix*(view*vec4(vPositionW+refractionVector*vRefractionInfos.z,1.0)));\nvec2 refractionCoords=vRefractionUVW.xy/vRefractionUVW.z;\nrefractionCoords.y=1.0-refractionCoords.y;\n#endif\n#ifdef LODINREFRACTIONALPHA\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#else\nfloat refractionLOD=getLodFromAlphaG(vRefractionMicrosurfaceInfos.x,alphaG,1.0);\n#endif\n#ifdef LODBASEDMICROSFURACE\n\nrefractionLOD=refractionLOD*vRefractionMicrosurfaceInfos.y+vRefractionMicrosurfaceInfos.z;\n#ifdef LODINREFRACTIONALPHA\n\n\n\n\n\n\n\n\n\nfloat automaticRefractionLOD=UNPACK_LOD(sampleRefraction(refractionSampler,refractionCoords).a);\nfloat requestedRefractionLOD=max(automaticRefractionLOD,refractionLOD);\n#else\nfloat requestedRefractionLOD=refractionLOD;\n#endif\nenvironmentRefraction=sampleRefractionLod(refractionSampler,refractionCoords,requestedRefractionLOD);\n#else\nfloat lodRefractionNormalized=clamp(refractionLOD/log2(vRefractionMicrosurfaceInfos.x),0.,1.);\nfloat lodRefractionNormalizedDoubled=lodRefractionNormalized*2.0;\nvec4 environmentRefractionMid=sampleRefraction(refractionSampler,refractionCoords);\nif(lodRefractionNormalizedDoubled<1.0){\nenvironmentRefraction=mix(\nsampleRefraction(refractionSamplerHigh,refractionCoords),\nenvironmentRefractionMid,\nlodRefractionNormalizedDoubled\n);\n}else{\nenvironmentRefraction=mix(\nenvironmentRefractionMid,\nsampleRefraction(refractionSamplerLow,refractionCoords),\nlodRefractionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef GAMMAREFRACTION\nenvironmentRefraction.rgb=fromRGBD(environmentRefraction);\n#endif\n#ifdef RGBDREFRACTION\nenvironmentRefraction.rgb=toLinearSpace(environmentRefraction.rgb);\n#endif\n\nenvironmentRefraction.rgb*=vRefractionInfos.x;\n#endif\n\n#ifdef REFLECTION\nvec4 environmentRadiance=vec4(0.,0.,0.,0.);\nvec3 environmentIrradiance=vec3(0.,0.,0.);\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#if defined(LODINREFLECTIONALPHA) && !defined(REFLECTIONMAP_SKYBOX)\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,NdotVUnclamped);\n#else\nfloat reflectionLOD=getLodFromAlphaG(vReflectionMicrosurfaceInfos.x,alphaG,1.);\n#endif\n#ifdef LODBASEDMICROSFURACE\n\nreflectionLOD=reflectionLOD*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\n#ifdef LODINREFLECTIONALPHA\n\n\n\n\n\n\n\n\n\nfloat automaticReflectionLOD=UNPACK_LOD(sampleReflection(reflectionSampler,reflectionCoords).a);\nfloat requestedReflectionLOD=max(automaticReflectionLOD,reflectionLOD);\n#else\nfloat requestedReflectionLOD=reflectionLOD;\n#endif\nenvironmentRadiance=sampleReflectionLod(reflectionSampler,reflectionCoords,requestedReflectionLOD);\n#else\nfloat lodReflectionNormalized=clamp(reflectionLOD/log2(vReflectionMicrosurfaceInfos.x),0.,1.);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 environmentSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nenvironmentRadiance=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nenvironmentSpecularMid,\nlodReflectionNormalizedDoubled\n);\n}else{\nenvironmentRadiance=mix(\nenvironmentSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#ifdef RGBDREFLECTION\nenvironmentRadiance.rgb=fromRGBD(environmentRadiance);\n#endif\n#ifdef GAMMAREFLECTION\nenvironmentRadiance.rgb=toLinearSpace(environmentRadiance.rgb);\n#endif\n\n#ifdef USESPHERICALFROMREFLECTIONMAP\n#if defined(NORMAL) && defined(USESPHERICALINVERTEX)\nenvironmentIrradiance=vEnvironmentIrradiance;\n#else\nvec3 irradianceVector=vec3(reflectionMatrix*vec4(normalW,0)).xyz;\n#ifdef REFLECTIONMAP_OPPOSITEZ\nirradianceVector.z*=-1.0;\n#endif\nenvironmentIrradiance=environmentIrradianceJones(irradianceVector);\n#endif\n#endif\n\nenvironmentRadiance.rgb*=vReflectionInfos.x;\nenvironmentRadiance.rgb*=vReflectionColor.rgb;\nenvironmentIrradiance*=vReflectionColor.rgb;\n#endif\n\n\n\nfloat reflectance=max(max(surfaceReflectivityColor.r,surfaceReflectivityColor.g),surfaceReflectivityColor.b);\nfloat reflectance90=fresnelGrazingReflectance(reflectance);\nvec3 specularEnvironmentR0=surfaceReflectivityColor.rgb;\nvec3 specularEnvironmentR90=vec3(1.0,1.0,1.0)*reflectance90;\n\nvec3 diffuseBase=vec3(0.,0.,0.);\n#ifdef SPECULARTERM\nvec3 specularBase=vec3(0.,0.,0.);\n#endif\n#ifdef LIGHTMAP\nvec3 lightmapColor=texture2D(lightmapSampler,vLightmapUV+uvOffset).rgb;\n#ifdef GAMMALIGHTMAP\nlightmapColor=toLinearSpace(lightmapColor);\n#endif\nlightmapColor*=vLightmapInfos.y;\n#endif\nlightingInfo info;\npointLightingInfo pointInfo;\nspotLightingInfo spotInfo;\nfloat shadow=1.; \nfloat NdotL=-1.;\n#include<lightFragment>[0..maxSimultaneousLights]\n\n#if defined(ENVIRONMENTBRDF) && !defined(REFLECTIONMAP_SKYBOX)\n\nvec2 brdfSamplerUV=vec2(NdotV,roughness);\n\nvec4 environmentBrdf=texture2D(environmentBrdfSampler,brdfSamplerUV);\nvec3 specularEnvironmentReflectance=specularEnvironmentR0*environmentBrdf.x+environmentBrdf.y;\n#ifdef RADIANCEOCCLUSION\n#ifdef AMBIENTINGRAYSCALE\nfloat ambientMonochrome=ambientOcclusionColor.r;\n#else\nfloat ambientMonochrome=getLuminance(ambientOcclusionColor);\n#endif\nfloat seo=environmentRadianceOcclusion(ambientMonochrome,NdotVUnclamped);\nspecularEnvironmentReflectance*=seo;\n#endif\n#ifdef HORIZONOCCLUSION\n#ifdef BUMP\n#ifdef REFLECTIONMAP_3D\nfloat eho=environmentHorizonOcclusion(-viewDirectionW,normalW);\nspecularEnvironmentReflectance*=eho;\n#endif\n#endif\n#endif\n#else\n\nvec3 specularEnvironmentReflectance=fresnelSchlickEnvironmentGGX(NdotV,specularEnvironmentR0,specularEnvironmentR90,sqrt(microSurface));\n#endif\n\n#ifdef REFRACTION\nvec3 refractance=vec3(0.0,0.0,0.0);\nvec3 transmission=vec3(1.0,1.0,1.0);\n#ifdef LINKREFRACTIONTOTRANSPARENCY\n\ntransmission*=(1.0-alpha);\n\n\nvec3 mixedAlbedo=surfaceAlbedo;\nfloat maxChannel=max(max(mixedAlbedo.r,mixedAlbedo.g),mixedAlbedo.b);\nvec3 tint=clamp(maxChannel*mixedAlbedo,0.0,1.0);\n\nsurfaceAlbedo*=alpha;\n\nenvironmentIrradiance*=alpha;\n\nenvironmentRefraction.rgb*=tint;\n\nalpha=1.0;\n#endif\n\nvec3 bounceSpecularEnvironmentReflectance=(2.0*specularEnvironmentReflectance)/(1.0+specularEnvironmentReflectance);\nspecularEnvironmentReflectance=mix(bounceSpecularEnvironmentReflectance,specularEnvironmentReflectance,alpha);\n\ntransmission*=1.0-specularEnvironmentReflectance;\n\nrefractance=transmission;\n#endif\n\n\n\n\nsurfaceAlbedo.rgb=(1.-reflectance)*surfaceAlbedo.rgb;\n\n#ifdef REFLECTION\nvec3 finalIrradiance=environmentIrradiance;\nfinalIrradiance*=surfaceAlbedo.rgb;\n#endif\n\n#ifdef SPECULARTERM\nvec3 finalSpecular=specularBase;\nfinalSpecular=max(finalSpecular,0.0);\n\nvec3 finalSpecularScaled=finalSpecular*vLightingIntensity.x*vLightingIntensity.w;\n#endif\n\n#ifdef REFLECTION\nvec3 finalRadiance=environmentRadiance.rgb;\nfinalRadiance*=specularEnvironmentReflectance;\n\nvec3 finalRadianceScaled=finalRadiance*vLightingIntensity.z;\n#endif\n\n#ifdef REFRACTION\nvec3 finalRefraction=environmentRefraction.rgb;\nfinalRefraction*=refractance;\n#endif\n\n#ifdef ALPHABLEND\nfloat luminanceOverAlpha=0.0;\n#if defined(REFLECTION) && defined(RADIANCEOVERALPHA)\nluminanceOverAlpha+=getLuminance(finalRadianceScaled);\n#endif\n#if defined(SPECULARTERM) && defined(SPECULAROVERALPHA)\nluminanceOverAlpha+=getLuminance(finalSpecularScaled);\n#endif\n#if defined(RADIANCEOVERALPHA) || defined(SPECULAROVERALPHA)\nalpha=clamp(alpha+luminanceOverAlpha*luminanceOverAlpha,0.,1.);\n#endif\n#endif\n#endif\n\nvec3 finalDiffuse=diffuseBase;\nfinalDiffuse.rgb+=vAmbientColor;\nfinalDiffuse*=surfaceAlbedo.rgb;\nfinalDiffuse=max(finalDiffuse,0.0);\n\nvec3 finalEmissive=vEmissiveColor;\n#ifdef EMISSIVE\nvec3 emissiveColorTex=texture2D(emissiveSampler,vEmissiveUV+uvOffset).rgb;\nfinalEmissive*=toLinearSpace(emissiveColorTex.rgb);\nfinalEmissive*=vEmissiveInfos.y;\n#endif\n\n#ifdef AMBIENT\nvec3 ambientOcclusionForDirectDiffuse=mix(vec3(1.),ambientOcclusionColor,vAmbientInfos.w);\n#else\nvec3 ambientOcclusionForDirectDiffuse=ambientOcclusionColor;\n#endif\n\n\n\nvec4 finalColor=vec4(\nfinalDiffuse*ambientOcclusionForDirectDiffuse*vLightingIntensity.x +\n#ifndef UNLIT\n#ifdef REFLECTION\nfinalIrradiance*ambientOcclusionColor*vLightingIntensity.z +\n#endif\n#ifdef SPECULARTERM\n\n\nfinalSpecularScaled +\n#endif\n#ifdef REFLECTION\n\n\nfinalRadianceScaled +\n#endif\n#ifdef REFRACTION\nfinalRefraction*vLightingIntensity.z +\n#endif\n#endif\nfinalEmissive*vLightingIntensity.y,\nalpha);\n\n#ifdef LIGHTMAP\n#ifndef LIGHTMAPEXCLUDED\n#ifdef USELIGHTMAPASSHADOWMAP\nfinalColor.rgb*=lightmapColor;\n#else\nfinalColor.rgb+=lightmapColor;\n#endif\n#endif\n#endif\n\nfinalColor=max(finalColor,0.0);\n#include<logDepthFragment>\n#include<fogFragment>(color,finalColor)\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\nfinalColor.rgb=clamp(finalColor.rgb,0.,30.0);\n#else\n\nfinalColor=applyImageProcessing(finalColor);\n#endif\n#ifdef PREMULTIPLYALPHA\n\nfinalColor.rgb*=finalColor.a;\n#endif\ngl_FragColor=finalColor;\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n}",rgbdEncodePixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<helperFunctions>\nvoid main(void) \n{\ngl_FragColor=toRGBD(texture2D(textureSampler,vUV).rgb);\n}",rgbdDecodePixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<helperFunctions>\nvoid main(void) \n{\ngl_FragColor=vec4(fromRGBD(texture2D(textureSampler,vUV)),1.0);\n}",spritesVertexShader:"\nattribute vec4 position;\nattribute vec4 options;\nattribute vec4 cellInfo;\nattribute vec4 color;\n\nuniform vec2 textureInfos;\nuniform mat4 view;\nuniform mat4 projection;\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#include<fogVertexDeclaration>\nvoid main(void) { \nvec3 viewPos=(view*vec4(position.xyz,1.0)).xyz; \nvec2 cornerPos;\nfloat angle=position.w;\nvec2 size=vec2(options.x,options.y);\nvec2 offset=options.zw;\nvec2 uvScale=textureInfos.xy;\ncornerPos=vec2(offset.x-0.5,offset.y-0.5)*size;\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nviewPos+=rotatedCorner;\ngl_Position=projection*vec4(viewPos,1.0); \n\nvColor=color;\n\nvec2 uvOffset=vec2(abs(offset.x-cellInfo.x),1.0-abs(offset.y-cellInfo.y));\nvUV=(uvOffset+cellInfo.zw)*uvScale;\n\n#ifdef FOG\nvFogDistance=viewPos;\n#endif\n}",spritesPixelShader:"uniform bool alphaTest;\nvarying vec4 vColor;\n\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n\n#include<fogFragmentDeclaration>\nvoid main(void) {\nvec4 color=texture2D(diffuseSampler,vUV);\nif (alphaTest) \n{\nif (color.a<0.95)\ndiscard;\n}\ncolor*=vColor;\n#include<fogFragment>\ngl_FragColor=color;\n}",particlesVertexShader:"\nattribute vec3 position;\nattribute vec4 color;\nattribute float angle;\nattribute vec2 size;\n#ifdef ANIMATESHEET \nattribute float cellIndex;\n#endif\n#ifndef BILLBOARD \nattribute vec3 direction;\n#endif\n#ifdef BILLBOARDSTRETCHED\nattribute vec3 direction; \n#endif\n#ifdef RAMPGRADIENT\nattribute vec4 remapData;\n#endif\nattribute vec2 offset;\n\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n#ifdef ANIMATESHEET \nuniform vec3 particlesInfos; \n#endif\n\nvarying vec2 vUV;\nvarying vec4 vColor;\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\n#endif\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration>\n#ifdef BILLBOARD\nuniform vec3 eyePosition; \n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner; \n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner; \n}\n#endif\nvoid main(void) { \nvec2 cornerPos;\ncornerPos=(vec2(offset.x-0.5,offset.y-0.5)-translationPivot)*size+translationPivot;\n#ifdef BILLBOARD \n\nvec3 rotatedCorner;\n#ifdef BILLBOARDY \nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz; \n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition; \nvec3 worldPos=rotateAlign(toCamera,rotatedCorner);\nvec3 viewPos=(view*vec4(worldPos,1.0)).xyz; \n#else\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 viewPos=(view*vec4(position,1.0)).xyz+rotatedCorner; \n#endif\n#ifdef RAMPGRADIENT\nremapRanges=remapData;\n#endif\n\ngl_Position=projection*vec4(viewPos,1.0); \n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=normalize(direction);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\ngl_Position=projection*view*vec4(worldPos,1.0); \n#endif \nvColor=color;\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/particlesInfos.z);\nfloat columnOffset=cellIndex-rowOffset*particlesInfos.z;\nvec2 uvScale=particlesInfos.xy;\nvec2 uvOffset=vec2(offset.x ,1.0-offset.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else\nvUV=offset;\n#endif\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*vec4(viewPos,1.0);\n#endif\n#include<clipPlaneVertex>\n}",particlesPixelShader:"\nvarying vec2 vUV;\nvarying vec4 vColor;\nuniform vec4 textureMask;\nuniform sampler2D diffuseSampler;\n#include<clipPlaneFragmentDeclaration>\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\n#ifdef RAMPGRADIENT\nvarying vec4 remapRanges;\nuniform sampler2D rampSampler;\n#endif\nvoid main(void) {\n#include<clipPlaneFragment>\nvec4 textureColor=texture2D(diffuseSampler,vUV);\nvec4 baseColor=(textureColor*textureMask+(vec4(1.,1.,1.,1.)-textureMask))*vColor;\n#ifdef RAMPGRADIENT\nfloat alpha=baseColor.a;\nfloat remappedColorIndex=clamp((alpha-remapRanges.x)/remapRanges.y,0.0,1.0);\nvec4 rampColor=texture2D(rampSampler,vec2(1.0-remappedColorIndex,0.));\nbaseColor.rgb*=rampColor.rgb;\n\nfloat finalAlpha=baseColor.a;\nbaseColor.a=clamp((alpha*rampColor.a-remapRanges.z)/remapRanges.w,0.0,1.0);\n#endif\n#ifdef BLENDMULTIPLYMODE\nfloat sourceAlpha=vColor.a*textureColor.a;\nbaseColor.rgb=baseColor.rgb*sourceAlpha+vec3(1.0)*(1.0-sourceAlpha);\n#endif\n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\nbaseColor.rgb=toLinearSpace(baseColor.rgb);\nbaseColor=applyImageProcessing(baseColor);\n#endif\n#endif\ngl_FragColor=baseColor;\n}",colorVertexShader:"\nattribute vec3 position;\n#ifdef VERTEXCOLOR\nattribute vec4 color;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n\n#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#endif\nvoid main(void) {\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#ifdef VERTEXCOLOR\n\nvColor=color;\n#endif\n}",colorPixelShader:"#ifdef VERTEXCOLOR\nvarying vec4 vColor;\n#else\nuniform vec4 color;\n#endif\nvoid main(void) {\n#ifdef VERTEXCOLOR\ngl_FragColor=vColor;\n#else\ngl_FragColor=color;\n#endif\n}",gpuRenderParticlesVertexShader:"#version 300 es\nuniform mat4 view;\nuniform mat4 projection;\nuniform vec2 translationPivot;\n\nin vec3 position;\nin float age;\nin float life;\nin vec3 size;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef BILLBOARDSTRETCHED\nin vec3 direction;\n#endif\nin float angle;\n#ifdef ANIMATESHEET\nin float cellIndex;\n#endif\nin vec2 offset;\nin vec2 uv;\nout vec2 vUV;\nout vec4 vColor;\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nuniform mat4 invView;\n#endif\n#include<clipPlaneVertexDeclaration2>\n#ifdef COLORGRADIENTS\nuniform sampler2D colorGradientSampler;\n#else\nuniform vec4 colorDead;\nin vec4 color;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 sheetInfos;\n#endif\n#ifdef BILLBOARD\nuniform vec3 eyePosition; \n#endif\nvec3 rotate(vec3 yaxis,vec3 rotatedCorner) {\nvec3 xaxis=normalize(cross(vec3(0.,1.0,0.),yaxis));\nvec3 zaxis=normalize(cross(yaxis,xaxis));\nvec3 row0=vec3(xaxis.x,xaxis.y,xaxis.z);\nvec3 row1=vec3(yaxis.x,yaxis.y,yaxis.z);\nvec3 row2=vec3(zaxis.x,zaxis.y,zaxis.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner;\n}\n#ifdef BILLBOARDSTRETCHED\nvec3 rotateAlign(vec3 toCamera,vec3 rotatedCorner) {\nvec3 normalizedToCamera=normalize(toCamera);\nvec3 normalizedCrossDirToCamera=normalize(cross(normalize(direction),normalizedToCamera));\nvec3 crossProduct=normalize(cross(normalizedToCamera,normalizedCrossDirToCamera));\nvec3 row0=vec3(normalizedCrossDirToCamera.x,normalizedCrossDirToCamera.y,normalizedCrossDirToCamera.z);\nvec3 row1=vec3(crossProduct.x,crossProduct.y,crossProduct.z);\nvec3 row2=vec3(normalizedToCamera.x,normalizedToCamera.y,normalizedToCamera.z);\nmat3 rotMatrix=mat3(row0,row1,row2);\nvec3 alignedCorner=rotMatrix*rotatedCorner;\nreturn position+alignedCorner; \n}\n#endif\nvoid main() {\n#ifdef ANIMATESHEET\nfloat rowOffset=floor(cellIndex/sheetInfos.z);\nfloat columnOffset=cellIndex-rowOffset*sheetInfos.z;\nvec2 uvScale=sheetInfos.xy;\nvec2 uvOffset=vec2(uv.x ,1.0-uv.y);\nvUV=(uvOffset+vec2(columnOffset,rowOffset))*uvScale;\n#else \nvUV=uv;\n#endif\nfloat ratio=age/life;\n#ifdef COLORGRADIENTS\nvColor=texture(colorGradientSampler,vec2(ratio,0));\n#else\nvColor=color*vec4(1.0-ratio)+colorDead*vec4(ratio);\n#endif\nvec2 cornerPos=(offset-translationPivot)*size.yz*size.x+translationPivot;\n#ifdef BILLBOARD\nvec4 rotatedCorner;\nrotatedCorner.w=0.;\n#ifdef BILLBOARDY \nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.y=0.;\nvec3 yaxis=position-eyePosition;\nyaxis.y=0.;\nvec3 worldPos=rotate(normalize(yaxis),rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(worldPos,1.0)); \n#elif defined(BILLBOARDSTRETCHED)\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\nvec3 toCamera=position-eyePosition; \nvec3 worldPos=rotateAlign(toCamera,rotatedCorner.xyz);\nvec4 viewPosition=(view*vec4(worldPos,1.0)); \n#else\n\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nrotatedCorner.z=0.;\n\nvec4 viewPosition=view*vec4(position,1.0)+rotatedCorner;\n#endif\n#else\n\nvec3 rotatedCorner;\nrotatedCorner.x=cornerPos.x*cos(angle)-cornerPos.y*sin(angle);\nrotatedCorner.y=0.;\nrotatedCorner.z=cornerPos.x*sin(angle)+cornerPos.y*cos(angle);\nvec3 yaxis=normalize(initialDirection);\nvec3 worldPos=rotate(yaxis,rotatedCorner);\n\nvec4 viewPosition=view*vec4(worldPos,1.0); \n#endif\ngl_Position=projection*viewPosition;\n\n#if defined(CLIPPLANE) || defined(CLIPPLANE2) || defined(CLIPPLANE3) || defined(CLIPPLANE4)\nvec4 worldPos=invView*viewPosition;\n#endif \n#include<clipPlaneVertex>\n}",gpuRenderParticlesPixelShader:"#version 300 es\nuniform sampler2D textureSampler;\nin vec2 vUV;\nin vec4 vColor;\nout vec4 outFragColor;\n#include<clipPlaneFragmentDeclaration2> \n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\nvoid main() {\n#include<clipPlaneFragment> \nvec4 textureColor=texture(textureSampler,vUV);\noutFragColor=textureColor*vColor;\n#ifdef BLENDMULTIPLYMODE\nfloat alpha=vColor.a*textureColor.a;\noutFragColor.rgb=outFragColor.rgb*alpha+vec3(1.0)*(1.0-alpha); \n#endif \n\n\n#ifdef IMAGEPROCESSINGPOSTPROCESS\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\n#else\n#ifdef IMAGEPROCESSING\noutFragColor.rgb=toLinearSpace(outFragColor.rgb);\noutFragColor=applyImageProcessing(outFragColor);\n#endif\n#endif\n}\n",gpuUpdateParticlesVertexShader:"#version 300 es\n#define PI 3.14159\nuniform float currentCount;\nuniform float timeDelta;\nuniform float stopFactor;\nuniform mat4 emitterWM;\nuniform vec2 lifeTime;\nuniform vec2 emitPower;\nuniform vec2 sizeRange;\nuniform vec4 scaleRange;\n#ifndef COLORGRADIENTS\nuniform vec4 color1;\nuniform vec4 color2;\n#endif\nuniform vec3 gravity;\nuniform sampler2D randomSampler;\nuniform sampler2D randomSampler2;\nuniform vec4 angleRange;\n#ifdef BOXEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\nuniform vec3 minEmitBox;\nuniform vec3 maxEmitBox;\n#endif\n#ifdef POINTEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#endif\n#ifdef HEMISPHERICEMITTER\nuniform float radius;\nuniform float radiusRange;\nuniform float directionRandomizer;\n#endif\n#ifdef SPHEREEMITTER\nuniform float radius;\nuniform float radiusRange;\n#ifdef DIRECTEDSPHEREEMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CYLINDEREMITTER\nuniform float radius;\nuniform float height;\nuniform float radiusRange;\n#ifdef DIRECTEDCYLINDEREMITTER\nuniform vec3 direction1;\nuniform vec3 direction2;\n#else\nuniform float directionRandomizer;\n#endif\n#endif\n#ifdef CONEEMITTER\nuniform vec2 radius;\nuniform float coneAngle;\nuniform vec2 height;\nuniform float directionRandomizer;\n#endif\n\nin vec3 position;\nin float age;\nin float life;\nin vec4 seed;\nin vec3 size;\n#ifndef COLORGRADIENTS\nin vec4 color;\n#endif\nin vec3 direction;\n#ifndef BILLBOARD\nin vec3 initialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nin float angle;\n#else\nin vec2 angle;\n#endif\n#ifdef ANIMATESHEET\nin float cellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nin float cellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nin vec3 noiseCoordinates1;\nin vec3 noiseCoordinates2;\n#endif\n\nout vec3 outPosition;\nout float outAge;\nout float outLife;\nout vec4 outSeed;\nout vec3 outSize;\n#ifndef COLORGRADIENTS\nout vec4 outColor;\n#endif\nout vec3 outDirection;\n#ifndef BILLBOARD\nout vec3 outInitialDirection;\n#endif\n#ifdef ANGULARSPEEDGRADIENTS\nout float outAngle;\n#else\nout vec2 outAngle;\n#endif\n#ifdef ANIMATESHEET\nout float outCellIndex;\n#ifdef ANIMATESHEETRANDOMSTART\nout float outCellStartOffset;\n#endif\n#endif\n#ifdef NOISE\nout vec3 outNoiseCoordinates1;\nout vec3 outNoiseCoordinates2;\n#endif\n#ifdef SIZEGRADIENTS\nuniform sampler2D sizeGradientSampler;\n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nuniform sampler2D angularSpeedGradientSampler;\n#endif \n#ifdef VELOCITYGRADIENTS\nuniform sampler2D velocityGradientSampler;\n#endif\n#ifdef LIMITVELOCITYGRADIENTS\nuniform sampler2D limitVelocityGradientSampler;\nuniform float limitVelocityDamping;\n#endif\n#ifdef DRAGGRADIENTS\nuniform sampler2D dragGradientSampler;\n#endif\n#ifdef NOISE\nuniform vec3 noiseStrength;\nuniform sampler2D noiseSampler;\n#endif\n#ifdef ANIMATESHEET\nuniform vec3 cellInfos;\n#endif\nvec3 getRandomVec3(float offset) {\nreturn texture(randomSampler2,vec2(float(gl_VertexID)*offset/currentCount,0)).rgb;\n}\nvec4 getRandomVec4(float offset) {\nreturn texture(randomSampler,vec2(float(gl_VertexID)*offset/currentCount,0));\n}\nvoid main() {\nfloat newAge=age+timeDelta; \n\nif (newAge>=life && stopFactor != 0.) {\nvec3 position;\nvec3 direction;\n\nvec4 randoms=getRandomVec4(seed.x);\n\noutLife=lifeTime.x+(lifeTime.y-lifeTime.x)*randoms.r;\noutAge=mod(newAge,outLife);\n\noutSeed=seed;\n\n#ifdef SIZEGRADIENTS \noutSize.x=texture(sizeGradientSampler,vec2(0,0)).r;\n#else\noutSize.x=sizeRange.x+(sizeRange.y-sizeRange.x)*randoms.g;\n#endif\noutSize.y=scaleRange.x+(scaleRange.y-scaleRange.x)*randoms.b;\noutSize.z=scaleRange.z+(scaleRange.w-scaleRange.z)*randoms.a; \n#ifndef COLORGRADIENTS\n\noutColor=color1+(color2-color1)*randoms.b;\n#endif\n\n#ifndef ANGULARSPEEDGRADIENTS \noutAngle.y=angleRange.x+(angleRange.y-angleRange.x)*randoms.a;\noutAngle.x=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#else\noutAngle=angleRange.z+(angleRange.w-angleRange.z)*randoms.r;\n#endif \n\n#ifdef POINTEMITTER\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nposition=vec3(0,0,0);\ndirection=direction1+(direction2-direction1)*randoms3;\n#elif defined(BOXEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\nposition=minEmitBox+(maxEmitBox-minEmitBox)*randoms2;\ndirection=direction1+(direction2-direction1)*randoms3; \n#elif defined(HEMISPHERICEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,abs(randY),randZ);\ndirection=position+directionRandomizer*randoms3; \n#elif defined(SPHEREEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat phi=2.0*PI*randoms2.x;\nfloat theta=acos(2.0*randoms2.y-1.0);\nfloat randX=cos(phi)*sin(theta);\nfloat randY=cos(theta);\nfloat randZ=sin(phi)*sin(theta);\nposition=(radius-(radius*radiusRange*randoms2.z))*vec3(randX,randY,randZ);\n#ifdef DIRECTEDSPHEREEMITTER\ndirection=direction1+(direction2-direction1)*randoms3;\n#else\n\ndirection=position+directionRandomizer*randoms3;\n#endif\n#elif defined(CYLINDEREMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nvec3 randoms3=getRandomVec3(seed.z);\n\nfloat yPos=(randoms2.x-0.5)*height;\nfloat angle=randoms2.y*PI*2.;\nfloat inverseRadiusRangeSquared=((1.-radiusRange)*(1.-radiusRange));\nfloat positionRadius=radius*sqrt(inverseRadiusRangeSquared+(randoms2.z*(1.-inverseRadiusRangeSquared)));\nfloat xPos=positionRadius*cos(angle);\nfloat zPos=positionRadius*sin(angle);\nposition=vec3(xPos,yPos,zPos);\n#ifdef DIRECTEDCYLINDEREMITTER\ndirection=direction1+(direction2-direction1)*randoms3;\n#else\n\nangle=angle+((randoms3.x-0.5)*PI);\ndirection=vec3(cos(angle),randoms3.y-0.5,sin(angle));\ndirection=normalize(direction);\n#endif\n#elif defined(CONEEMITTER)\nvec3 randoms2=getRandomVec3(seed.y);\nfloat s=2.0*PI*randoms2.x;\n#ifdef CONEEMITTERSPAWNPOINT\nfloat h=0.00001;\n#else\nfloat h=randoms2.y*height.y;\n\nh=1.-h*h; \n#endif\nfloat lRadius=radius.x-radius.x*randoms2.z*radius.y;\nlRadius=lRadius*h;\nfloat randX=lRadius*sin(s);\nfloat randZ=lRadius*cos(s);\nfloat randY=h*height.x;\nposition=vec3(randX,randY,randZ); \n\nif (abs(cos(coneAngle)) == 1.0) {\ndirection=vec3(0.,1.0,0.);\n} else {\nvec3 randoms3=getRandomVec3(seed.z);\ndirection=position+directionRandomizer*randoms3;\n}\n#else \n\nposition=vec3(0.,0.,0.);\n\ndirection=2.0*(getRandomVec3(seed.w)-vec3(0.5,0.5,0.5));\n#endif\nfloat power=emitPower.x+(emitPower.y-emitPower.x)*randoms.a;\noutPosition=(emitterWM*vec4(position,1.)).xyz;\nvec3 initial=(emitterWM*vec4(direction,0.)).xyz;\noutDirection=initial*power;\n#ifndef BILLBOARD \noutInitialDirection=initial;\n#endif\n#ifdef ANIMATESHEET \noutCellIndex=cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=randoms.a*outLife;\n#endif \n#endif\n#ifdef NOISE\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif\n} else {\nfloat directionScale=timeDelta;\noutAge=newAge;\nfloat ageGradient=newAge/life;\n#ifdef VELOCITYGRADIENTS\ndirectionScale*=texture(velocityGradientSampler,vec2(ageGradient,0)).r;\n#endif\n#ifdef DRAGGRADIENTS\ndirectionScale*=1.0-texture(dragGradientSampler,vec2(ageGradient,0)).r;\n#endif\noutPosition=position+direction*directionScale;\noutLife=life;\noutSeed=seed;\n#ifndef COLORGRADIENTS \noutColor=color;\n#endif\n#ifdef SIZEGRADIENTS\noutSize.x=texture(sizeGradientSampler,vec2(ageGradient,0)).r;\noutSize.yz=size.yz;\n#else\noutSize=size;\n#endif \n#ifndef BILLBOARD \noutInitialDirection=initialDirection;\n#endif\nvec3 updatedDirection=direction+gravity*timeDelta;\n#ifdef LIMITVELOCITYGRADIENTS\nfloat limitVelocity=texture(limitVelocityGradientSampler,vec2(ageGradient,0)).r;\nfloat currentVelocity=length(updatedDirection);\nif (currentVelocity>limitVelocity) {\nupdatedDirection=updatedDirection*limitVelocityDamping;\n}\n#endif\noutDirection=updatedDirection;\n#ifdef NOISE\nvec3 localPosition=outPosition-emitterWM[3].xyz;\nfloat fetchedR=texture(noiseSampler,vec2(noiseCoordinates1.x,noiseCoordinates1.y)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedG=texture(noiseSampler,vec2(noiseCoordinates1.z,noiseCoordinates2.x)*vec2(0.5)+vec2(0.5)).r;\nfloat fetchedB=texture(noiseSampler,vec2(noiseCoordinates2.y,noiseCoordinates2.z)*vec2(0.5)+vec2(0.5)).r;\nvec3 force=vec3(2.*fetchedR-1.,2.*fetchedG-1.,2.*fetchedB-1.)*noiseStrength;\noutDirection=outDirection+force*timeDelta;\noutNoiseCoordinates1=noiseCoordinates1;\noutNoiseCoordinates2=noiseCoordinates2;\n#endif \n#ifdef ANGULARSPEEDGRADIENTS\nfloat angularSpeed=texture(angularSpeedGradientSampler,vec2(ageGradient,0)).r;\noutAngle=angle+angularSpeed*timeDelta;\n#else\noutAngle=vec2(angle.x+angle.y*timeDelta,angle.y);\n#endif\n#ifdef ANIMATESHEET \nfloat offsetAge=outAge;\nfloat dist=cellInfos.y-cellInfos.x;\n#ifdef ANIMATESHEETRANDOMSTART\noutCellStartOffset=cellStartOffset;\noffsetAge+=cellStartOffset;\n#endif \nfloat ratio=clamp(mod(offsetAge*cellInfos.z,life)/life,0.,1.0);\noutCellIndex=float(int(cellInfos.x+ratio*dist));\n#endif\n}\n}",gpuUpdateParticlesPixelShader:"#version 300 es\nvoid main() {\ndiscard;\n}\n",postprocessVertexShader:"\nattribute vec2 position;\nuniform vec2 scale;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=(position*madd+madd)*scale;\ngl_Position=vec4(position,0.0,1.0);\n}",passPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\n}",shadowMapVertexShader:"\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\nuniform vec3 lightData;\n#endif\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\n#include<instancesDeclaration>\n#include<helperFunctions>\nuniform mat4 viewProjection;\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\nvec4 worldPos=finalWorld*vec4(positionUpdated,1.0);\n\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvec3 worldNor=normalize(normalWorld*normal);\n#ifdef DIRECTIONINLIGHTDATA\nvec3 worldLightDir=normalize(-lightData.xyz);\n#else\nvec3 directionToLight=lightData.xyz-worldPos.xyz;\nvec3 worldLightDir=normalize(directionToLight);\n#endif\nfloat ndl=dot(worldNor,worldLightDir);\nfloat sinNL=sqrt(1.0-ndl*ndl);\nfloat normalBias=biasAndScale.y*sinNL;\nworldPos.xyz-=worldNor*normalBias;\n#endif\n\ngl_Position=viewProjection*worldPos;\n#ifdef DEPTHTEXTURE\n\ngl_Position.z+=biasAndScale.x*gl_Position.w;\n#endif\n\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y))+biasAndScale.x;\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}",shadowMapPixelShader:"#ifndef FLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvarying float vDepthMetric;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nuniform vec3 biasAndScale;\nuniform vec2 depthValues;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\nfloat depth=vDepthMetric;\n#ifdef ESM\ndepth=clamp(exp(-min(87.,biasAndScale.z*depth)),0.,1.);\n#endif\n#ifdef FLOAT\ngl_FragColor=vec4(depth,1.0,1.0,1.0);\n#else\ngl_FragColor=pack(depth);\n#endif\n}",depthBoxBlurPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nvoid main(void)\n{\nvec4 colorDepth=vec4(0.0);\nfor (int x=-OFFSET; x<=OFFSET; x++)\nfor (int y=-OFFSET; y<=OFFSET; y++)\ncolorDepth+=texture2D(textureSampler,vUV+vec2(x,y)/screenSize);\ngl_FragColor=(colorDepth/float((OFFSET*2+1)*(OFFSET*2+1)));\n}",proceduralVertexShader:"\nattribute vec2 position;\n\nvarying vec2 vPosition;\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvPosition=position;\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}",depthVertexShader:"\nattribute vec3 position;\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nuniform vec2 depthValues;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvDepthMetric=((gl_Position.z+depthValues.x)/(depthValues.y));\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}",depthPixelShader:"#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\nvarying float vDepthMetric;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(vDepthMetric,vDepthMetric*vDepthMetric,0.0,1.0);\n}",geometryVertexShader:"precision highp float;\nprecision highp int;\n#include<bonesDeclaration>\n#include<instancesDeclaration>\nattribute vec3 position;\nattribute vec3 normal;\n#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nvarying vec2 uv;\n#endif\n#ifdef UV2\nvarying vec2 uv2;\n#endif\n#endif\n\nuniform mat4 viewProjection;\nuniform mat4 view;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\nvoid main(void)\n{\n#include<instancesVertex>\n#include<bonesVertex>\nvec4 pos=vec4(finalWorld*vec4(position,1.0));\nvNormalV=normalize(vec3((view*finalWorld)*vec4(normal,0.0)));\nvViewPos=view*pos;\n#ifdef POSITION\nvPosition=pos.xyz/pos.w;\n#endif\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#if defined(ALPHATEST) || defined(BASIC_RENDER)\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}",geometryPixelShader:"#extension GL_EXT_draw_buffers : require\nprecision highp float;\nprecision highp int;\nvarying vec3 vNormalV;\nvarying vec4 vViewPos;\n#ifdef POSITION\nvarying vec3 vPosition;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef POSITION\n#include<mrtFragmentDeclaration>[3]\n#else\n#include<mrtFragmentDeclaration>[2]\n#endif\nvoid main() {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\ngl_FragData[0]=vec4(vViewPos.z/vViewPos.w,0.0,0.0,1.0);\n\ngl_FragData[1]=vec4(normalize(vNormalV),1.0);\n\n#ifdef POSITION\ngl_FragData[2]=vec4(vPosition,1.0);\n#endif\n}",ssaoPixelShader:"\nuniform sampler2D textureSampler;\nvarying vec2 vUV;\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float radius;\nuniform float area;\nuniform float fallOff;\nuniform float base;\nvec3 normalFromDepth(float depth,vec2 coords)\n{\nvec2 offset1=vec2(0.0,radius);\nvec2 offset2=vec2(radius,0.0);\nfloat depth1=texture2D(textureSampler,coords+offset1).r;\nfloat depth2=texture2D(textureSampler,coords+offset2).r;\nvec3 p1=vec3(offset1,depth1-depth);\nvec3 p2=vec3(offset2,depth2-depth);\nvec3 normal=cross(p1,p2);\nnormal.z=-normal.z;\nreturn normalize(normal);\n}\nvoid main()\n{\nvec3 random=normalize(texture2D(randomSampler,vUV*randTextureTiles).rgb);\nfloat depth=texture2D(textureSampler,vUV).r;\nvec3 position=vec3(vUV,depth);\nvec3 normal=normalFromDepth(depth,vUV);\nfloat radiusDepth=radius/depth;\nfloat occlusion=0.0;\nvec3 ray;\nvec3 hemiRay;\nfloat occlusionDepth;\nfloat difference;\nfor (int i=0; i<SAMPLES; i++)\n{\nray=radiusDepth*reflect(sampleSphere[i],random);\nhemiRay=position+sign(dot(ray,normal))*ray;\nocclusionDepth=texture2D(textureSampler,clamp(hemiRay.xy,vec2(0.001,0.001),vec2(0.999,0.999))).r;\ndifference=depth-occlusionDepth;\nocclusion+=step(fallOff,difference)*(1.0-smoothstep(fallOff,area,difference));\n}\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor.r=result;\ngl_FragColor.g=result;\ngl_FragColor.b=result;\ngl_FragColor.a=1.0;\n}\n#endif\n",ssao2PixelShader:"\nprecision highp float;\nuniform sampler2D textureSampler;\nuniform float near;\nuniform float far;\nuniform float radius;\nfloat scales[16]=float[16](\n0.1,\n0.11406250000000001,\n0.131640625,\n0.15625,\n0.187890625,\n0.2265625,\n0.272265625,\n0.325,\n0.384765625,\n0.4515625,\n0.525390625,\n0.60625,\n0.694140625,\n0.7890625,\n0.891015625,\n1.0\n);\nvarying vec2 vUV;\nfloat perspectiveDepthToViewZ( const in float invClipZ,const in float near,const in float far ) {\nreturn ( near*far )/( ( far-near )*invClipZ-far );\n}\nfloat viewZToPerspectiveDepth( const in float viewZ,const in float near,const in float far ) {\nreturn ( near*far/viewZ+far)/( far-near );\n}\nfloat viewZToOrthographicDepth( const in float viewZ,const in float near,const in float far ) {\nreturn ( viewZ+near )/( near-far );\n}\n#ifdef SSAO\nuniform sampler2D randomSampler;\nuniform sampler2D normalSampler;\nuniform float randTextureTiles;\nuniform float samplesFactor;\nuniform vec3 sampleSphere[SAMPLES];\nuniform float totalStrength;\nuniform float base;\nuniform float xViewport;\nuniform float yViewport;\nuniform float maxZ;\nuniform float minZAspect;\nuniform vec2 texelSize;\nuniform mat4 projection;\nvoid main()\n{\nvec3 random=texture2D(randomSampler,vUV*randTextureTiles).rgb;\nfloat depth=texture2D(textureSampler,vUV).r;\nfloat depthSign=depth/abs(depth);\ndepth=depth*depthSign;\nvec3 normal=texture2D(normalSampler,vUV).rgb; \nfloat occlusion=0.0;\nfloat correctedRadius=min(radius,minZAspect*depth/near);\nvec3 vViewRay=vec3((vUV.x*2.0-1.0)*xViewport,(vUV.y*2.0-1.0)*yViewport,depthSign);\nvec3 origin=vViewRay*depth;\nvec3 rvec=random*2.0-1.0;\nrvec.z=0.0;\n\nfloat dotProduct=dot(rvec,normal);\nrvec=1.0-abs(dotProduct)>1e-2 ? rvec : vec3(-rvec.y,0.0,rvec.x);\nvec3 tangent=normalize(rvec-normal*dot(rvec,normal));\nvec3 bitangent=cross(normal,tangent);\nmat3 tbn=mat3(tangent,bitangent,normal);\nfloat difference;\nfor (int i=0; i<SAMPLES; ++i) {\n\nvec3 samplePosition=scales[(i+int(random.x*16.0)) % 16]*tbn*sampleSphere[(i+int(random.y*16.0)) % 16];\nsamplePosition=samplePosition*correctedRadius+origin;\n\nvec4 offset=vec4(samplePosition,1.0);\noffset=projection*offset;\noffset.xyz/=offset.w;\noffset.xy=offset.xy*0.5+0.5;\nif (offset.x<0.0 || offset.y<0.0 || offset.x>1.0 || offset.y>1.0) {\ncontinue;\n}\n\nfloat sampleDepth=abs(texture2D(textureSampler,offset.xy).r);\n\ndifference=depthSign*samplePosition.z-sampleDepth;\nfloat rangeCheck=1.0-smoothstep(correctedRadius*0.5,correctedRadius,difference);\nocclusion+=(difference>=0.0 ? 1.0 : 0.0)*rangeCheck;\n}\nocclusion=occlusion*(1.0-smoothstep(maxZ*0.75,maxZ,depth));\nfloat ao=1.0-totalStrength*occlusion*samplesFactor;\nfloat result=clamp(ao+base,0.0,1.0);\ngl_FragColor=vec4(vec3(result),1.0);\n}\n#endif\n#ifdef BILATERAL_BLUR\nuniform sampler2D depthSampler;\nuniform float outSize;\nuniform float samplerOffsets[SAMPLES];\nvec4 blur9(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.3846153846)*direction;\nvec2 off2=vec2(3.2307692308)*direction;\ncolor+=texture2D(image,uv)*0.2270270270;\ncolor+=texture2D(image,uv+(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv-(off1/resolution))*0.3162162162;\ncolor+=texture2D(image,uv+(off2/resolution))*0.0702702703;\ncolor+=texture2D(image,uv-(off2/resolution))*0.0702702703;\nreturn color;\n}\nvec4 blur13(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\ncolor+=texture2D(image,uv)*0.1964825501511404;\ncolor+=texture2D(image,uv+(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv-(off1/resolution))*0.2969069646728344;\ncolor+=texture2D(image,uv+(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv-(off2/resolution))*0.09447039785044732;\ncolor+=texture2D(image,uv+(off3/resolution))*0.010381362401148057;\ncolor+=texture2D(image,uv-(off3/resolution))*0.010381362401148057;\nreturn color;\n}\nvec4 blur13Bilateral(sampler2D image,vec2 uv,float resolution,vec2 direction) {\nvec4 color=vec4(0.0);\nvec2 off1=vec2(1.411764705882353)*direction;\nvec2 off2=vec2(3.2941176470588234)*direction;\nvec2 off3=vec2(5.176470588235294)*direction;\nfloat compareDepth=abs(texture2D(depthSampler,uv).r);\nfloat sampleDepth;\nfloat weight;\nfloat weightSum=30.0;\ncolor+=texture2D(image,uv)*30.0;\nsampleDepth=abs(texture2D(depthSampler,uv+(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off1/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off1/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off2/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off2/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv+(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv+(off3/resolution))*weight;\nsampleDepth=abs(texture2D(depthSampler,uv-(off3/resolution)).r);\nweight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30.0);\nweightSum+=weight;\ncolor+=texture2D(image,uv-(off3/resolution))*weight;\nreturn color/weightSum;\n}\nvoid main()\n{\n#if EXPENSIVE\nfloat compareDepth=abs(texture2D(depthSampler,vUV).r);\nfloat texelsize=1.0/outSize;\nfloat result=0.0;\nfloat weightSum=0.0;\nfor (int i=0; i<SAMPLES; ++i)\n{\n#ifdef BILATERAL_BLUR_H\nvec2 direction=vec2(1.0,0.0);\nvec2 sampleOffset=vec2(texelsize*samplerOffsets[i],0.0);\n#else\nvec2 direction=vec2(0.0,1.0);\nvec2 sampleOffset=vec2(0.0,texelsize*samplerOffsets[i]);\n#endif\nvec2 samplePos=vUV+sampleOffset;\nfloat sampleDepth=abs(texture2D(depthSampler,samplePos).r);\nfloat weight=clamp(1.0/( 0.003+abs(compareDepth-sampleDepth)),0.0,30000.0);\nresult+=texture2D(textureSampler,samplePos).r*weight;\nweightSum+=weight;\n}\nresult/=weightSum;\ngl_FragColor.rgb=vec3(result);\ngl_FragColor.a=1.0;\n#else\nvec4 color;\n#ifdef BILATERAL_BLUR_H\nvec2 direction=vec2(1.0,0.0);\ncolor=blur13Bilateral(textureSampler,vUV,outSize,direction);\n#else\nvec2 direction=vec2(0.0,1.0);\ncolor=blur13Bilateral(textureSampler,vUV,outSize,direction);\n#endif\ngl_FragColor.rgb=vec3(color.r);\ngl_FragColor.a=1.0;\n#endif\n}\n#endif\n",ssaoCombinePixelShader:"uniform sampler2D textureSampler;\nuniform sampler2D originalColor;\nuniform vec4 viewport;\nvarying vec2 vUV;\nvoid main(void) {\nvec4 ssaoColor=texture2D(textureSampler,viewport.xy+vUV*viewport.zw);\nvec4 sceneColor=texture2D(originalColor,vUV);\ngl_FragColor=sceneColor*ssaoColor;\n}\n",lensHighlightsPixelShader:"\nuniform sampler2D textureSampler; \n\nuniform float gain;\nuniform float threshold;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\n\nvec4 highlightColor(vec4 color) {\nvec4 highlight=color;\nfloat luminance=dot(highlight.rgb,vec3(0.2125,0.7154,0.0721));\nfloat lum_threshold;\nif (threshold>1.0) { lum_threshold=0.94+0.01*threshold; }\nelse { lum_threshold=0.5+0.44*threshold; }\nluminance=clamp((luminance-lum_threshold)*(1.0/(1.0-lum_threshold)),0.0,1.0);\nhighlight*=luminance*gain;\nhighlight.a=1.0;\nreturn highlight;\n}\nvoid main(void)\n{\nvec4 original=texture2D(textureSampler,vUV);\n\nif (gain == -1.0) {\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\nreturn;\n}\nfloat w=2.0/screen_width;\nfloat h=2.0/screen_height;\nfloat weight=1.0;\n\nvec4 blurred=vec4(0.0,0.0,0.0,0.0);\n#ifdef PENTAGON\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.84*w,0.43*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.48*w,-1.29*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.61*w,1.51*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.55*w,-0.74*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.71*w,-0.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.94*w,1.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.40*w,-1.87*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.62*w,1.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.09*w,0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.46*w,-1.71*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.08*w,2.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.85*w,-1.89*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.89*w,0.16*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.29*w,1.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.40*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.54*w,2.26*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.60*w,-0.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.31*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.83*w,2.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.12*w,-2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.60*w,1.11*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.99*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.50*w,-2.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.85*w,3.33*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.94*w,-1.92*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.27*w,-0.53*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.95*w,2.48*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.23*w,-3.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.17*w,2.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.97*w,-0.04*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.25*w,-2.00*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.31*w,3.08*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.94*w,-2.59*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.37*w,0.64*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.13*w,1.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.03*w,-3.65*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.60*w,3.17*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.14*w,-1.19*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.00*w,-1.19*h)));\n#else\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.85*w,0.36*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.52*w,-1.14*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.46*w,1.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.46*w,-0.83*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.79*w,-0.42*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.11*w,1.62*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.29*w,-2.07*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.69*w,1.39*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.28*w,0.12*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.65*w,-1.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.08*w,2.44*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.63*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.55*w,0.31*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.13*w,1.52*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.56*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.38*w,2.34*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.64*w,-0.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.53*w,-1.21*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.06*w,2.63*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.00*w,-2.69*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.59*w,1.32*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.82*w,0.78*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.57*w,-2.50*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(0.54*w,2.93*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.39*w,-1.81*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,-0.28*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.04*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.02*w,-3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.09*w,2.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-3.07*w,-0.25*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.44*w,-1.90*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-0.52*w,3.05*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-1.68*w,-2.61*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(3.01*w,0.79*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.76*w,1.46*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.05*w,-2.94*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(1.21*w,2.88*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(-2.84*w,-1.30*h)));\nblurred+=highlightColor(texture2D(textureSampler,vUV+vec2(2.98*w,-0.96*h)));\n#endif\nblurred/=39.0;\ngl_FragColor=blurred;\n\n}",depthOfFieldPixelShader:"\n\n\n\n\nuniform sampler2D textureSampler;\nuniform sampler2D highlightsSampler;\nuniform sampler2D depthSampler;\nuniform sampler2D grainSampler;\n\nuniform float grain_amount;\nuniform bool blur_noise;\nuniform float screen_width;\nuniform float screen_height;\nuniform float distortion;\nuniform bool dof_enabled;\n\nuniform float screen_distance; \nuniform float aperture;\nuniform float darken;\nuniform float edge_blur;\nuniform bool highlights;\n\nuniform float near;\nuniform float far;\n\nvarying vec2 vUV;\n\n#define PI 3.14159265\n#define TWOPI 6.28318530\n#define inverse_focal_length 0.1 \n\nvec2 centered_screen_pos;\nvec2 distorted_coords;\nfloat radius2;\nfloat radius;\n\nvec2 rand(vec2 co)\n{\nfloat noise1=(fract(sin(dot(co,vec2(12.9898,78.233)))*43758.5453));\nfloat noise2=(fract(sin(dot(co,vec2(12.9898,78.233)*2.0))*43758.5453));\nreturn clamp(vec2(noise1,noise2),0.0,1.0);\n}\n\nvec2 getDistortedCoords(vec2 coords) {\nif (distortion == 0.0) { return coords; }\nvec2 direction=1.0*normalize(centered_screen_pos);\nvec2 dist_coords=vec2(0.5,0.5);\ndist_coords.x=0.5+direction.x*radius2*1.0;\ndist_coords.y=0.5+direction.y*radius2*1.0;\nfloat dist_amount=clamp(distortion*0.23,0.0,1.0);\ndist_coords=mix(coords,dist_coords,dist_amount);\nreturn dist_coords;\n}\n\nfloat sampleScreen(inout vec4 color,const in vec2 offset,const in float weight) {\n\nvec2 coords=distorted_coords;\nfloat angle=rand(coords*100.0).x*TWOPI;\ncoords+=vec2(offset.x*cos(angle)-offset.y*sin(angle),offset.x*sin(angle)+offset.y*cos(angle));\ncolor+=texture2D(textureSampler,coords)*weight;\nreturn weight;\n}\n\nfloat getBlurLevel(float size) {\nreturn min(3.0,ceil(size/1.0));\n}\n\nvec4 getBlurColor(float size) {\nvec4 col=texture2D(textureSampler,distorted_coords);\nif (size == 0.0) { return col; }\n\n\nfloat blur_level=getBlurLevel(size);\nfloat w=(size/screen_width);\nfloat h=(size/screen_height);\nfloat total_weight=1.0;\nvec2 sample_coords;\ntotal_weight+=sampleScreen(col,vec2(-0.50*w,0.24*h),0.93);\ntotal_weight+=sampleScreen(col,vec2(0.30*w,-0.75*h),0.90);\ntotal_weight+=sampleScreen(col,vec2(0.36*w,0.96*h),0.87);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,-0.55*h),0.85);\ntotal_weight+=sampleScreen(col,vec2(1.33*w,-0.37*h),0.83);\ntotal_weight+=sampleScreen(col,vec2(-0.82*w,1.31*h),0.80);\ntotal_weight+=sampleScreen(col,vec2(-0.31*w,-1.67*h),0.78);\ntotal_weight+=sampleScreen(col,vec2(1.47*w,1.11*h),0.76);\ntotal_weight+=sampleScreen(col,vec2(-1.97*w,0.19*h),0.74);\ntotal_weight+=sampleScreen(col,vec2(1.42*w,-1.57*h),0.72);\nif (blur_level>1.0) {\ntotal_weight+=sampleScreen(col,vec2(0.01*w,2.25*h),0.70);\ntotal_weight+=sampleScreen(col,vec2(-1.62*w,-1.74*h),0.67);\ntotal_weight+=sampleScreen(col,vec2(2.49*w,0.20*h),0.65);\ntotal_weight+=sampleScreen(col,vec2(-2.07*w,1.61*h),0.63);\ntotal_weight+=sampleScreen(col,vec2(0.46*w,-2.70*h),0.61);\ntotal_weight+=sampleScreen(col,vec2(1.55*w,2.40*h),0.59);\ntotal_weight+=sampleScreen(col,vec2(-2.88*w,-0.75*h),0.56);\ntotal_weight+=sampleScreen(col,vec2(2.73*w,-1.44*h),0.54);\ntotal_weight+=sampleScreen(col,vec2(-1.08*w,3.02*h),0.52);\ntotal_weight+=sampleScreen(col,vec2(-1.28*w,-3.05*h),0.49);\n}\nif (blur_level>2.0) {\ntotal_weight+=sampleScreen(col,vec2(3.11*w,1.43*h),0.46);\ntotal_weight+=sampleScreen(col,vec2(-3.36*w,1.08*h),0.44);\ntotal_weight+=sampleScreen(col,vec2(1.80*w,-3.16*h),0.41);\ntotal_weight+=sampleScreen(col,vec2(0.83*w,3.65*h),0.38);\ntotal_weight+=sampleScreen(col,vec2(-3.16*w,-2.19*h),0.34);\ntotal_weight+=sampleScreen(col,vec2(3.92*w,-0.53*h),0.31);\ntotal_weight+=sampleScreen(col,vec2(-2.59*w,3.12*h),0.26);\ntotal_weight+=sampleScreen(col,vec2(-0.20*w,-4.15*h),0.22);\ntotal_weight+=sampleScreen(col,vec2(3.02*w,3.00*h),0.15);\n}\ncol/=total_weight; \n\nif (darken>0.0) {\ncol.rgb*=clamp(0.3,1.0,1.05-size*0.5*darken);\n}\n\n\n\n\nreturn col;\n}\nvoid main(void)\n{\n\ncentered_screen_pos=vec2(vUV.x-0.5,vUV.y-0.5);\nradius2=centered_screen_pos.x*centered_screen_pos.x+centered_screen_pos.y*centered_screen_pos.y;\nradius=sqrt(radius2);\ndistorted_coords=getDistortedCoords(vUV); \nvec2 texels_coords=vec2(vUV.x*screen_width,vUV.y*screen_height); \nfloat depth=texture2D(depthSampler,distorted_coords).r; \nfloat distance=near+(far-near)*depth; \nvec4 color=texture2D(textureSampler,vUV); \n\n\nfloat coc=abs(aperture*(screen_distance*(inverse_focal_length-1.0/distance)-1.0));\n\nif (dof_enabled == false || coc<0.07) { coc=0.0; }\n\nfloat edge_blur_amount=0.0;\nif (edge_blur>0.0) {\nedge_blur_amount=clamp((radius*2.0-1.0+0.15*edge_blur)*1.5,0.0,1.0)*1.3;\n}\n\nfloat blur_amount=max(edge_blur_amount,coc);\n\nif (blur_amount == 0.0) {\ngl_FragColor=texture2D(textureSampler,distorted_coords);\n}\nelse {\n\ngl_FragColor=getBlurColor(blur_amount*1.7);\n\nif (highlights) {\ngl_FragColor.rgb+=clamp(coc,0.0,1.0)*texture2D(highlightsSampler,distorted_coords).rgb;\n}\nif (blur_noise) {\n\nvec2 noise=rand(distorted_coords)*0.01*blur_amount;\nvec2 blurred_coord=vec2(distorted_coords.x+noise.x,distorted_coords.y+noise.y);\ngl_FragColor=0.04*texture2D(textureSampler,blurred_coord)+0.96*gl_FragColor;\n}\n}\n\nif (grain_amount>0.0) {\nvec4 grain_color=texture2D(grainSampler,texels_coords*0.003);\ngl_FragColor.rgb+=(-0.5+grain_color.rgb)*0.30*grain_amount;\n}\n}\n",standardPixelShader:"uniform sampler2D textureSampler;\nvarying vec2 vUV;\n#if defined(PASS_POST_PROCESS)\nvoid main(void)\n{\nvec4 color=texture2D(textureSampler,vUV);\ngl_FragColor=color;\n}\n#endif\n#if defined(DOWN_SAMPLE_X4)\nuniform vec2 dsOffsets[16];\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+dsOffsets[0]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[1]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[2]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[3]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[4]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[5]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[6]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[7]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[8]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[9]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[10]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[11]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[12]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[13]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[14]);\naverage+=texture2D(textureSampler,vUV+dsOffsets[15]);\naverage/=16.0;\ngl_FragColor=average;\n}\n#endif\n#if defined(BRIGHT_PASS)\nuniform vec2 dsOffsets[4];\nuniform float brightThreshold;\nvoid main(void)\n{\nvec4 average=vec4(0.0,0.0,0.0,0.0);\naverage=texture2D(textureSampler,vUV+vec2(dsOffsets[0].x,dsOffsets[0].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[1].x,dsOffsets[1].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[2].x,dsOffsets[2].y));\naverage+=texture2D(textureSampler,vUV+vec2(dsOffsets[3].x,dsOffsets[3].y));\naverage*=0.25;\nfloat luminance=length(average.rgb);\nif (luminance<brightThreshold) {\naverage=vec4(0.0,0.0,0.0,1.0);\n}\ngl_FragColor=average;\n}\n#endif\n#if defined(TEXTURE_ADDER)\nuniform sampler2D otherSampler;\nuniform sampler2D lensSampler;\nuniform float exposure;\nvoid main(void)\n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\ncolour*=exposure;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\ncolour+=colour*texture2D(lensSampler,vUV).rgb;\nvec4 finalColor=vec4(colour.rgb,1.0)+texture2D(otherSampler,vUV);\ngl_FragColor=finalColor;\n}\n#endif\n#if defined(VLS)\n#define PI 3.1415926535897932384626433832795\nuniform mat4 shadowViewProjection;\nuniform mat4 lightWorld;\nuniform vec3 cameraPosition;\nuniform vec3 sunDirection;\nuniform vec3 sunColor;\nuniform vec2 depthValues;\nuniform float scatteringCoefficient;\nuniform float scatteringPower;\nuniform sampler2D shadowMapSampler;\nuniform sampler2D positionSampler;\nfloat computeScattering(float lightDotView)\n{\nfloat result=1.0-scatteringCoefficient*scatteringCoefficient;\nresult/=(4.0*PI*pow(1.0+scatteringCoefficient*scatteringCoefficient-(2.0*scatteringCoefficient)*lightDotView,1.5));\nreturn result;\n}\nvoid main(void)\n{\n\nvec3 worldPos=texture2D(positionSampler,vUV).rgb;\nvec3 startPosition=cameraPosition;\nvec3 rayVector=worldPos-startPosition;\nfloat rayLength=length(rayVector);\nvec3 rayDirection=rayVector/rayLength;\nfloat stepLength=rayLength/NB_STEPS;\nvec3 stepL=rayDirection*stepLength;\nvec3 currentPosition=startPosition;\nvec3 accumFog=vec3(0.0);\nfor (int i=0; i<int(NB_STEPS); i++)\n{\nvec4 worldInShadowCameraSpace=shadowViewProjection*vec4(currentPosition,1.0);\nfloat depthMetric=(worldInShadowCameraSpace.z+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depthMetric,0.0,1.0);\nworldInShadowCameraSpace.xyz/=worldInShadowCameraSpace.w;\nworldInShadowCameraSpace.xyz=0.5*worldInShadowCameraSpace.xyz+vec3(0.5);\nfloat shadowMapValue=texture2D(shadowMapSampler,worldInShadowCameraSpace.xy).r;\nif (shadowMapValue>shadowPixelDepth)\naccumFog+=sunColor*computeScattering(dot(rayDirection,sunDirection));\ncurrentPosition+=stepL;\n}\naccumFog/=NB_STEPS;\nvec3 color=accumFog*scatteringPower;\ngl_FragColor=vec4(color*exp(color) ,1.0);\n}\n#endif\n#if defined(VLSMERGE)\nuniform sampler2D originalSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(originalSampler,vUV)+texture2D(textureSampler,vUV);\n}\n#endif\n#if defined(LUMINANCE)\nuniform vec2 lumOffsets[4];\nvoid main()\n{\nfloat average=0.0;\nvec4 color=vec4(0.0);\nfloat maximum=-1e20;\nvec3 weight=vec3(0.299,0.587,0.114);\nfor (int i=0; i<4; i++)\n{\ncolor=texture2D(textureSampler,vUV+ lumOffsets[i]);\n\nfloat GreyValue=dot(color.rgb,vec3(0.33,0.33,0.33));\n\n#ifdef WEIGHTED_AVERAGE\nfloat GreyValue=dot(color.rgb,weight);\n#endif\n#ifdef BRIGHTNESS\nfloat GreyValue=max(color.r,max(color.g,color.b));\n#endif\n#ifdef HSL_COMPONENT\nfloat GreyValue=0.5*(max(color.r,max(color.g,color.b))+min(color.r,min(color.g,color.b)));\n#endif\n#ifdef MAGNITUDE\nfloat GreyValue=length(color.rgb);\n#endif\nmaximum=max(maximum,GreyValue);\naverage+=(0.25*log(1e-5+GreyValue));\n}\naverage=exp(average);\ngl_FragColor=vec4(average,maximum,0.0,1.0);\n}\n#endif\n#if defined(LUMINANCE_DOWN_SAMPLE)\nuniform vec2 dsOffsets[9];\nuniform float halfDestPixelSize;\n#ifdef FINAL_DOWN_SAMPLER\nvec4 pack(float value) {\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(value*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\n#endif\nvoid main()\n{\nvec4 color=vec4(0.0);\nfloat average=0.0;\nfor (int i=0; i<9; i++)\n{\ncolor=texture2D(textureSampler,vUV+vec2(halfDestPixelSize,halfDestPixelSize)+dsOffsets[i]);\naverage+=color.r;\n}\naverage/=9.0;\n#ifdef FINAL_DOWN_SAMPLER\ngl_FragColor=pack(average);\n#else\ngl_FragColor=vec4(average,average,0.0,1.0);\n#endif\n}\n#endif\n#if defined(HDR)\nuniform sampler2D textureAdderSampler;\nuniform float averageLuminance;\nvoid main()\n{\nvec4 color=texture2D(textureAdderSampler,vUV);\nvec4 adjustedColor=color/averageLuminance;\ncolor=adjustedColor;\ncolor.a=1.0;\ngl_FragColor=color;\n}\n#endif\n#if defined(LENS_FLARE)\n#define GHOSTS 3\nuniform sampler2D lensColorSampler;\nuniform float strength;\nuniform float ghostDispersal;\nuniform float haloWidth;\nuniform vec2 resolution;\nuniform float distortionStrength;\nfloat hash(vec2 p)\n{\nfloat h=dot(p,vec2(127.1,311.7));\nreturn -1.0+2.0*fract(sin(h)*43758.5453123);\n}\nfloat noise(in vec2 p)\n{\nvec2 i=floor(p);\nvec2 f=fract(p);\nvec2 u=f*f*(3.0-2.0*f);\nreturn mix(mix(hash(i+vec2(0.0,0.0)),\nhash(i+vec2(1.0,0.0)),u.x),\nmix(hash(i+vec2(0.0,1.0)),\nhash(i+vec2(1.0,1.0)),u.x),u.y);\n}\nfloat fbm(vec2 p)\n{\nfloat f=0.0;\nf+=0.5000*noise(p); p*=2.02;\nf+=0.2500*noise(p); p*=2.03;\nf+=0.1250*noise(p); p*=2.01;\nf+=0.0625*noise(p); p*=2.04;\nf/=0.9375;\nreturn f;\n}\nvec3 pattern(vec2 uv)\n{\nvec2 p=-1.0+2.0*uv;\nfloat p2=dot(p,p);\nfloat f=fbm(vec2(15.0*p2))/2.0;\nfloat r=0.2+0.6*sin(12.5*length(uv-vec2(0.5)));\nfloat g=0.2+0.6*sin(20.5*length(uv-vec2(0.5)));\nfloat b=0.2+0.6*sin(17.2*length(uv-vec2(0.5)));\nreturn (1.0-f)*vec3(r,g,b);\n}\nfloat luminance(vec3 color)\n{\nreturn dot(color.rgb,vec3(0.2126,0.7152,0.0722));\n}\nvec4 textureDistorted(sampler2D tex,vec2 texcoord,vec2 direction,vec3 distortion)\n{\nreturn vec4(\ntexture2D(tex,texcoord+direction*distortion.r).r,\ntexture2D(tex,texcoord+direction*distortion.g).g,\ntexture2D(tex,texcoord+direction*distortion.b).b,\n1.0\n);\n}\nvoid main(void)\n{\nvec2 uv=-vUV+vec2(1.0);\nvec2 ghostDir=(vec2(0.5)-uv)*ghostDispersal;\nvec2 texelSize=1.0/resolution;\nvec3 distortion=vec3(-texelSize.x*distortionStrength,0.0,texelSize.x*distortionStrength);\nvec4 result=vec4(0.0);\nfloat ghostIndice=1.0;\nfor (int i=0; i<GHOSTS; ++i)\n{\nvec2 offset=fract(uv+ghostDir*ghostIndice);\nfloat weight=length(vec2(0.5)-offset)/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,offset,normalize(ghostDir),distortion)*weight*strength;\nghostIndice+=1.0;\n}\nvec2 haloVec=normalize(ghostDir)*haloWidth;\nfloat weight=length(vec2(0.5)-fract(uv+haloVec))/length(vec2(0.5));\nweight=pow(1.0-weight,10.0);\nresult+=textureDistorted(textureSampler,fract(uv+haloVec),normalize(ghostDir),distortion)*weight*strength;\nresult*=texture2D(lensColorSampler,vec2(length(vec2(0.5)-uv)/length(vec2(0.5))));\ngl_FragColor=result;\n}\n#endif\n#if defined(LENS_FLARE_COMPOSE)\nuniform sampler2D otherSampler;\nuniform sampler2D lensDirtSampler;\nuniform sampler2D lensStarSampler;\nuniform mat4 lensStarMatrix;\nvoid main(void)\n{\nvec2 lensFlareCoords=(lensStarMatrix*vec4(vUV,1.0,1.0)).xy;\nvec4 lensMod=texture2D(lensDirtSampler,vUV);\nlensMod+=texture2D(lensStarSampler,vUV);\nvec4 result=texture2D(textureSampler,vUV)*lensMod;\ngl_FragColor=texture2D(otherSampler,vUV)+result;\n}\n#endif\n#if defined(DEPTH_OF_FIELD)\nuniform sampler2D otherSampler;\nuniform sampler2D depthSampler;\nuniform float distance;\nvoid main(void)\n{\nvec4 sharp=texture2D(otherSampler,vUV);\nvec4 blur=texture2D(textureSampler,vUV);\nfloat dist=clamp(texture2D(depthSampler,vUV).r*distance,0.0,1.0);\nfloat factor=0.0;\nif (dist<0.05)\nfactor=1.0;\nelse if (dist<0.1)\nfactor=20.0*(0.1-dist);\nelse if (dist<0.5)\nfactor=0.0;\nelse\nfactor=2.0*(dist-0.5);\nfactor=clamp(factor,0.0,0.90);\ngl_FragColor=mix(sharp,blur,factor);\n}\n#endif\n#if defined(MOTION_BLUR)\nuniform mat4 inverseViewProjection;\nuniform mat4 prevViewProjection;\nuniform vec2 screenSize;\nuniform float motionScale;\nuniform float motionStrength;\nuniform sampler2D depthSampler;\nvoid main(void)\n{\nvec2 texelSize=1.0/screenSize;\nfloat depth=texture2D(depthSampler,vUV).r;\nvec4 cpos=vec4(vUV*2.0-1.0,depth,1.0);\ncpos=cpos*inverseViewProjection;\nvec4 ppos=cpos*prevViewProjection;\nppos.xyz/=ppos.w;\nppos.xy=ppos.xy*0.5+0.5;\nvec2 velocity=(ppos.xy-vUV)*motionScale*motionStrength;\nfloat speed=length(velocity/texelSize);\nint nSamples=int(clamp(speed,1.0,MAX_MOTION_SAMPLES));\nvec4 result=texture2D(textureSampler,vUV);\nfor (int i=1; i<int(MAX_MOTION_SAMPLES); ++i) {\nif (i>=nSamples)\nbreak;\nvec2 offset1=vUV+velocity*(float(i)/float(nSamples-1)-0.5);\nresult+=texture2D(textureSampler,offset1);\n}\ngl_FragColor=result/float(nSamples);\n}\n#endif\n",fxaaVertexShader:"\nattribute vec2 position;\nuniform vec2 texelSize;\n\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=(position*madd+madd);\nsampleCoordS=vUV+vec2( 0.0,1.0)*texelSize;\nsampleCoordE=vUV+vec2( 1.0,0.0)*texelSize;\nsampleCoordN=vUV+vec2( 0.0,-1.0)*texelSize;\nsampleCoordW=vUV+vec2(-1.0,0.0)*texelSize;\nsampleCoordNW=vUV+vec2(-1.0,-1.0)*texelSize;\nsampleCoordSE=vUV+vec2( 1.0,1.0)*texelSize;\nsampleCoordNE=vUV+vec2( 1.0,-1.0)*texelSize;\nsampleCoordSW=vUV+vec2(-1.0,1.0)*texelSize;\ngl_Position=vec4(position,0.0,1.0);\n}",fxaaPixelShader:"uniform sampler2D textureSampler;\nuniform vec2 texelSize;\nvarying vec2 vUV;\nvarying vec2 sampleCoordS;\nvarying vec2 sampleCoordE;\nvarying vec2 sampleCoordN;\nvarying vec2 sampleCoordW;\nvarying vec2 sampleCoordNW;\nvarying vec2 sampleCoordSE;\nvarying vec2 sampleCoordNE;\nvarying vec2 sampleCoordSW;\nconst float fxaaQualitySubpix=1.0;\nconst float fxaaQualityEdgeThreshold=0.166;\nconst float fxaaQualityEdgeThresholdMin=0.0833;\nconst vec3 kLumaCoefficients=vec3(0.2126,0.7152,0.0722);\n#define FxaaLuma(rgba) dot(rgba.rgb,kLumaCoefficients)\nvoid main(){\nvec2 posM;\nposM.x=vUV.x;\nposM.y=vUV.y;\nvec4 rgbyM=texture2D(textureSampler,vUV,0.0);\nfloat lumaM=FxaaLuma(rgbyM);\nfloat lumaS=FxaaLuma(texture2D(textureSampler,sampleCoordS,0.0));\nfloat lumaE=FxaaLuma(texture2D(textureSampler,sampleCoordE,0.0));\nfloat lumaN=FxaaLuma(texture2D(textureSampler,sampleCoordN,0.0));\nfloat lumaW=FxaaLuma(texture2D(textureSampler,sampleCoordW,0.0));\nfloat maxSM=max(lumaS,lumaM);\nfloat minSM=min(lumaS,lumaM);\nfloat maxESM=max(lumaE,maxSM);\nfloat minESM=min(lumaE,minSM);\nfloat maxWN=max(lumaN,lumaW);\nfloat minWN=min(lumaN,lumaW);\nfloat rangeMax=max(maxWN,maxESM);\nfloat rangeMin=min(minWN,minESM);\nfloat rangeMaxScaled=rangeMax*fxaaQualityEdgeThreshold;\nfloat range=rangeMax-rangeMin;\nfloat rangeMaxClamped=max(fxaaQualityEdgeThresholdMin,rangeMaxScaled);\n#ifndef MALI\nif(range<rangeMaxClamped) \n{\ngl_FragColor=rgbyM;\nreturn;\n}\n#endif\nfloat lumaNW=FxaaLuma(texture2D(textureSampler,sampleCoordNW,0.0));\nfloat lumaSE=FxaaLuma(texture2D(textureSampler,sampleCoordSE,0.0));\nfloat lumaNE=FxaaLuma(texture2D(textureSampler,sampleCoordNE,0.0));\nfloat lumaSW=FxaaLuma(texture2D(textureSampler,sampleCoordSW,0.0));\nfloat lumaNS=lumaN+lumaS;\nfloat lumaWE=lumaW+lumaE;\nfloat subpixRcpRange=1.0/range;\nfloat subpixNSWE=lumaNS+lumaWE;\nfloat edgeHorz1=(-2.0*lumaM)+lumaNS;\nfloat edgeVert1=(-2.0*lumaM)+lumaWE;\nfloat lumaNESE=lumaNE+lumaSE;\nfloat lumaNWNE=lumaNW+lumaNE;\nfloat edgeHorz2=(-2.0*lumaE)+lumaNESE;\nfloat edgeVert2=(-2.0*lumaN)+lumaNWNE;\nfloat lumaNWSW=lumaNW+lumaSW;\nfloat lumaSWSE=lumaSW+lumaSE;\nfloat edgeHorz4=(abs(edgeHorz1)*2.0)+abs(edgeHorz2);\nfloat edgeVert4=(abs(edgeVert1)*2.0)+abs(edgeVert2);\nfloat edgeHorz3=(-2.0*lumaW)+lumaNWSW;\nfloat edgeVert3=(-2.0*lumaS)+lumaSWSE;\nfloat edgeHorz=abs(edgeHorz3)+edgeHorz4;\nfloat edgeVert=abs(edgeVert3)+edgeVert4;\nfloat subpixNWSWNESE=lumaNWSW+lumaNESE;\nfloat lengthSign=texelSize.x;\nbool horzSpan=edgeHorz>=edgeVert;\nfloat subpixA=subpixNSWE*2.0+subpixNWSWNESE;\nif (!horzSpan)\n{\nlumaN=lumaW;\n}\nif (!horzSpan) \n{\nlumaS=lumaE;\n}\nif (horzSpan) \n{\nlengthSign=texelSize.y;\n}\nfloat subpixB=(subpixA*(1.0/12.0))-lumaM;\nfloat gradientN=lumaN-lumaM;\nfloat gradientS=lumaS-lumaM;\nfloat lumaNN=lumaN+lumaM;\nfloat lumaSS=lumaS+lumaM;\nbool pairN=abs(gradientN)>=abs(gradientS);\nfloat gradient=max(abs(gradientN),abs(gradientS));\nif (pairN)\n{\nlengthSign=-lengthSign;\n}\nfloat subpixC=clamp(abs(subpixB)*subpixRcpRange,0.0,1.0);\nvec2 posB;\nposB.x=posM.x;\nposB.y=posM.y;\nvec2 offNP;\noffNP.x=(!horzSpan) ? 0.0 : texelSize.x;\noffNP.y=(horzSpan) ? 0.0 : texelSize.y;\nif (!horzSpan) \n{\nposB.x+=lengthSign*0.5;\n}\nif (horzSpan)\n{\nposB.y+=lengthSign*0.5;\n}\nvec2 posN;\nposN.x=posB.x-offNP.x*1.5;\nposN.y=posB.y-offNP.y*1.5;\nvec2 posP;\nposP.x=posB.x+offNP.x*1.5;\nposP.y=posB.y+offNP.y*1.5;\nfloat subpixD=((-2.0)*subpixC)+3.0;\nfloat lumaEndN=FxaaLuma(texture2D(textureSampler,posN,0.0));\nfloat subpixE=subpixC*subpixC;\nfloat lumaEndP=FxaaLuma(texture2D(textureSampler,posP,0.0));\nif (!pairN) \n{\nlumaNN=lumaSS;\n}\nfloat gradientScaled=gradient*1.0/4.0;\nfloat lumaMM=lumaM-lumaNN*0.5;\nfloat subpixF=subpixD*subpixE;\nbool lumaMLTZero=lumaMM<0.0;\nlumaEndN-=lumaNN*0.5;\nlumaEndP-=lumaNN*0.5;\nbool doneN=abs(lumaEndN)>=gradientScaled;\nbool doneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) \n{\nposN.x-=offNP.x*3.0;\n}\nif (!doneN) \n{\nposN.y-=offNP.y*3.0;\n}\nbool doneNP=(!doneN) || (!doneP);\nif (!doneP) \n{\nposP.x+=offNP.x*3.0;\n}\nif (!doneP)\n{\nposP.y+=offNP.y*3.0;\n}\nif (doneNP)\n{\nif (!doneN) lumaEndN=FxaaLuma(texture2D(textureSampler,posN.xy,0.0));\nif (!doneP) lumaEndP=FxaaLuma(texture2D(textureSampler,posP.xy,0.0));\nif (!doneN) lumaEndN=lumaEndN-lumaNN*0.5;\nif (!doneP) lumaEndP=lumaEndP-lumaNN*0.5;\ndoneN=abs(lumaEndN)>=gradientScaled;\ndoneP=abs(lumaEndP)>=gradientScaled;\nif (!doneN) posN.x-=offNP.x*12.0;\nif (!doneN) posN.y-=offNP.y*12.0;\ndoneNP=(!doneN) || (!doneP);\nif (!doneP) posP.x+=offNP.x*12.0;\nif (!doneP) posP.y+=offNP.y*12.0;\n}\nfloat dstN=posM.x-posN.x;\nfloat dstP=posP.x-posM.x;\nif (!horzSpan)\n{\ndstN=posM.y-posN.y;\n}\nif (!horzSpan) \n{\ndstP=posP.y-posM.y;\n}\nbool goodSpanN=(lumaEndN<0.0) != lumaMLTZero;\nfloat spanLength=(dstP+dstN);\nbool goodSpanP=(lumaEndP<0.0) != lumaMLTZero;\nfloat spanLengthRcp=1.0/spanLength;\nbool directionN=dstN<dstP;\nfloat dst=min(dstN,dstP);\nbool goodSpan=directionN ? goodSpanN : goodSpanP;\nfloat subpixG=subpixF*subpixF;\nfloat pixelOffset=(dst*(-spanLengthRcp))+0.5;\nfloat subpixH=subpixG*fxaaQualitySubpix;\nfloat pixelOffsetGood=goodSpan ? pixelOffset : 0.0;\nfloat pixelOffsetSubpix=max(pixelOffsetGood,subpixH);\nif (!horzSpan)\n{\nposM.x+=pixelOffsetSubpix*lengthSign;\n}\nif (horzSpan)\n{\nposM.y+=pixelOffsetSubpix*lengthSign;\n}\n#ifdef MALI\nif(range<rangeMaxClamped) \n{\ngl_FragColor=rgbyM;\n}\nelse\n{\ngl_FragColor=texture2D(textureSampler,posM,0.0);\n}\n#else\ngl_FragColor=texture2D(textureSampler,posM,0.0);\n#endif\n}",chromaticAberrationPixelShader:"\nuniform sampler2D textureSampler; \n\nuniform float chromatic_aberration;\nuniform float radialIntensity;\nuniform vec2 direction;\nuniform vec2 centerPosition;\nuniform float screen_width;\nuniform float screen_height;\n\nvarying vec2 vUV;\nvoid main(void)\n{\nvec2 centered_screen_pos=vec2(vUV.x-centerPosition.x,vUV.y-centerPosition.y);\nvec2 directionOfEffect=direction;\nif(directionOfEffect.x == 0. && directionOfEffect.y == 0.){\ndirectionOfEffect=normalize(centered_screen_pos);\n}\nfloat radius2=centered_screen_pos.x*centered_screen_pos.x\n+centered_screen_pos.y*centered_screen_pos.y;\nfloat radius=sqrt(radius2);\nvec4 original=texture2D(textureSampler,vUV);\n\nvec3 ref_indices=vec3(-0.3,0.0,0.3);\nfloat ref_shiftX=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.x/screen_width;\nfloat ref_shiftY=chromatic_aberration*pow(radius,radialIntensity)*directionOfEffect.y/screen_height;\n\nvec2 ref_coords_r=vec2(vUV.x+ref_indices.r*ref_shiftX,vUV.y+ref_indices.r*ref_shiftY*0.5);\nvec2 ref_coords_g=vec2(vUV.x+ref_indices.g*ref_shiftX,vUV.y+ref_indices.g*ref_shiftY*0.5);\nvec2 ref_coords_b=vec2(vUV.x+ref_indices.b*ref_shiftX,vUV.y+ref_indices.b*ref_shiftY*0.5);\noriginal.r=texture2D(textureSampler,ref_coords_r).r;\noriginal.g=texture2D(textureSampler,ref_coords_g).g;\noriginal.b=texture2D(textureSampler,ref_coords_b).b;\noriginal.a=clamp(texture2D(textureSampler,ref_coords_r).a+texture2D(textureSampler,ref_coords_g).a+texture2D(textureSampler,ref_coords_b).a,0.,1.);\ngl_FragColor=original;\n}",grainPixelShader:"#include<helperFunctions>\n\nuniform sampler2D textureSampler; \n\nuniform float intensity;\nuniform float animatedSeed;\n\nvarying vec2 vUV;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec2 seed=vUV*(animatedSeed);\nfloat grain=dither(seed,intensity);\n\nfloat lum=getLuminance(gl_FragColor.rgb);\nfloat grainAmount=(cos(-PI+(lum*PI*2.))+1.)/2.;\ngl_FragColor.rgb+=grain*grainAmount;\ngl_FragColor.rgb=max(gl_FragColor.rgb,0.0);\n}",sharpenPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform vec2 sharpnessAmounts;\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 color=texture2D(textureSampler,vUV);\nvec4 edgeDetection=texture2D(textureSampler,vUV+onePixel*vec2(0,-1)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0)) +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1)) -\ncolor*4.0;\ngl_FragColor=max(vec4(color.rgb*sharpnessAmounts.y,color.a)-(sharpnessAmounts.x*vec4(edgeDetection.rgb,0)),0.);\n}",kernelBlurVertexShader:"\nattribute vec2 position;\n\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#include<kernelBlurVaryingDeclaration>[0..varyingCount]\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nsampleCenter=(position*madd+madd);\n#include<kernelBlurVertex>[0..varyingCount]\ngl_Position=vec4(position,0.0,1.0);\n}",kernelBlurPixelShader:"\nuniform sampler2D textureSampler;\nuniform vec2 delta;\n\nvarying vec2 sampleCenter;\n#ifdef DOF\nuniform sampler2D circleOfConfusionSampler;\nuniform vec2 cameraMinMaxZ;\nfloat sampleDistance(const in vec2 offset) {\nfloat depth=texture2D(circleOfConfusionSampler,offset).g; \nreturn cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth; \n}\nfloat sampleCoC(const in vec2 offset) {\nfloat coc=texture2D(circleOfConfusionSampler,offset).r; \nreturn coc; \n}\n#endif\n#include<kernelBlurVaryingDeclaration>[0..varyingCount]\n#ifdef PACKEDFLOAT\nvec4 pack(float depth)\n{\nconst vec4 bit_shift=vec4(255.0*255.0*255.0,255.0*255.0,255.0,1.0);\nconst vec4 bit_mask=vec4(0.0,1.0/255.0,1.0/255.0,1.0/255.0);\nvec4 res=fract(depth*bit_shift);\nres-=res.xxyz*bit_mask;\nreturn res;\n}\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nvoid main(void)\n{\nfloat computedWeight=0.0;\n#ifdef PACKEDFLOAT \nfloat blend=0.;\n#else\nvec4 blend=vec4(0.);\n#endif\n#ifdef DOF\nfloat sumOfWeights=CENTER_WEIGHT; \nfloat factor=0.0;\n\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter))*CENTER_WEIGHT;\n#else\nblend+=texture2D(textureSampler,sampleCenter)*CENTER_WEIGHT;\n#endif\n#endif\n#include<kernelBlurFragment>[0..varyingCount]\n#include<kernelBlurFragment2>[0..depCount]\n#ifdef PACKEDFLOAT\ngl_FragColor=pack(blend);\n#else\ngl_FragColor=blend;\n#endif\n#ifdef DOF\ngl_FragColor/=sumOfWeights;\n#endif\n}",depthOfFieldMergePixelShader:"uniform sampler2D textureSampler;\nvarying vec2 vUV;\nuniform sampler2D circleOfConfusionSampler;\nuniform sampler2D blurStep0;\n#if BLUR_LEVEL>0\nuniform sampler2D blurStep1;\n#endif\n#if BLUR_LEVEL>1\nuniform sampler2D blurStep2;\n#endif\nvoid main(void)\n{\nfloat coc=texture2D(circleOfConfusionSampler,vUV).r;\n#if BLUR_LEVEL == 0\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred0=texture2D(blurStep0,vUV);\ngl_FragColor=mix(original,blurred0,coc);\n#endif\n#if BLUR_LEVEL == 1\nif(coc<0.5){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(original,blurred1,coc/0.5);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV); \nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.5)/0.5);\n}\n#endif\n#if BLUR_LEVEL == 2\nif(coc<0.33){\nvec4 original=texture2D(textureSampler,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(original,blurred2,coc/0.33);\n}else if(coc<0.66){\nvec4 blurred1=texture2D(blurStep1,vUV);\nvec4 blurred2=texture2D(blurStep2,vUV);\ngl_FragColor=mix(blurred2,blurred1,(coc-0.33)/0.33);\n}else{\nvec4 blurred0=texture2D(blurStep0,vUV);\nvec4 blurred1=texture2D(blurStep1,vUV);\ngl_FragColor=mix(blurred1,blurred0,(coc-0.66)/0.34);\n}\n#endif\n}\n",circleOfConfusionPixelShader:"\nuniform sampler2D depthSampler;\n\nvarying vec2 vUV;\n\nuniform vec2 cameraMinMaxZ;\n\nuniform float focusDistance;\nuniform float cocPrecalculation;\nvoid main(void)\n{\nfloat depth=texture2D(depthSampler,vUV).r;\nfloat pixelDistance=(cameraMinMaxZ.x+(cameraMinMaxZ.y-cameraMinMaxZ.x)*depth)*1000.0; \nfloat coc=abs(cocPrecalculation* ((focusDistance-pixelDistance)/pixelDistance));\ncoc=clamp(coc,0.0,1.0);\ngl_FragColor=vec4(coc,depth,coc,1.0);\n}\n",bloomMergePixelShader:"uniform sampler2D textureSampler;\nuniform sampler2D bloomBlur;\nvarying vec2 vUV;\nuniform float bloomWeight;\nvoid main(void)\n{\ngl_FragColor=texture2D(textureSampler,vUV);\nvec3 blurred=texture2D(bloomBlur,vUV).rgb;\ngl_FragColor.rgb=gl_FragColor.rgb+(blurred.rgb*bloomWeight); \n}\n",extractHighlightsPixelShader:"#include<helperFunctions>\n\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float threshold;\nuniform float exposure;\nvoid main(void) \n{\ngl_FragColor=texture2D(textureSampler,vUV);\nfloat luma=getLuminance(gl_FragColor.rgb*exposure);\ngl_FragColor.rgb=step(threshold,luma)*gl_FragColor.rgb;\n}",refractionPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D refractionSampler;\n\nuniform vec3 baseColor;\nuniform float depth;\nuniform float colorLevel;\nvoid main() {\nfloat ref=1.0-texture2D(refractionSampler,vUV).r;\nvec2 uv=vUV-vec2(0.5);\nvec2 offset=uv*depth*ref;\nvec3 sourceColor=texture2D(textureSampler,vUV-offset).rgb;\ngl_FragColor=vec4(sourceColor+sourceColor*ref*colorLevel,1.0);\n}",blackAndWhitePixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform float degree;\nvoid main(void) \n{\nvec3 color=texture2D(textureSampler,vUV).rgb;\nfloat luminance=dot(color,vec3(0.3,0.59,0.11)); \nvec3 blackAndWhite=vec3(luminance,luminance,luminance);\ngl_FragColor=vec4(color-((color-blackAndWhite)*degree),1.0);\n}",convolutionPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 screenSize;\nuniform float kernel[9];\nvoid main(void)\n{\nvec2 onePixel=vec2(1.0,1.0)/screenSize;\nvec4 colorSum =\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,-1))*kernel[0] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,-1))*kernel[1] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,-1))*kernel[2] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,0))*kernel[3] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,0))*kernel[4] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,0))*kernel[5] +\ntexture2D(textureSampler,vUV+onePixel*vec2(-1,1))*kernel[6] +\ntexture2D(textureSampler,vUV+onePixel*vec2(0,1))*kernel[7] +\ntexture2D(textureSampler,vUV+onePixel*vec2(1,1))*kernel[8];\nfloat kernelWeight =\nkernel[0] +\nkernel[1] +\nkernel[2] +\nkernel[3] +\nkernel[4] +\nkernel[5] +\nkernel[6] +\nkernel[7] +\nkernel[8];\nif (kernelWeight<=0.0) {\nkernelWeight=1.0;\n}\ngl_FragColor=vec4((colorSum/kernelWeight).rgb,1);\n}",filterPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform mat4 kernelMatrix;\nvoid main(void)\n{\nvec3 baseColor=texture2D(textureSampler,vUV).rgb;\nvec3 updatedColor=(kernelMatrix*vec4(baseColor,1.0)).rgb;\ngl_FragColor=vec4(updatedColor,1.0);\n}",volumetricLightScatteringPixelShader:"uniform sampler2D textureSampler;\nuniform sampler2D lightScatteringSampler;\nuniform float decay;\nuniform float exposure;\nuniform float weight;\nuniform float density;\nuniform vec2 meshPositionOnScreen;\nvarying vec2 vUV;\nvoid main(void) {\nvec2 tc=vUV;\nvec2 deltaTexCoord=(tc-meshPositionOnScreen.xy);\ndeltaTexCoord*=1.0/float(NUM_SAMPLES)*density;\nfloat illuminationDecay=1.0;\nvec4 color=texture2D(lightScatteringSampler,tc)*0.4;\nfor(int i=0; i<NUM_SAMPLES; i++) {\ntc-=deltaTexCoord;\nvec4 dataSample=texture2D(lightScatteringSampler,tc)*0.4;\ndataSample*=illuminationDecay*weight;\ncolor+=dataSample;\nilluminationDecay*=decay;\n}\nvec4 realColor=texture2D(textureSampler,vUV);\ngl_FragColor=((vec4((vec3(color.r,color.g,color.b)*exposure),1))+(realColor*(1.5-0.4)));\n}\n",volumetricLightScatteringPassPixelShader:"#if defined(ALPHATEST) || defined(NEED_UV)\nvarying vec2 vUV;\n#endif\n#if defined(ALPHATEST)\nuniform sampler2D diffuseSampler;\n#endif\nvoid main(void)\n{\n#if defined(ALPHATEST)\nvec4 diffuseColor=texture2D(diffuseSampler,vUV);\nif (diffuseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=vec4(0.0,0.0,0.0,1.0);\n}\n",colorCorrectionPixelShader:"\nuniform sampler2D textureSampler; \nuniform sampler2D colorTable; \n\nvarying vec2 vUV;\n\nconst float SLICE_COUNT=16.0; \n\nvec4 sampleAs3DTexture(sampler2D textureSampler,vec3 uv,float width) {\nfloat sliceSize=1.0/width; \nfloat slicePixelSize=sliceSize/width; \nfloat sliceInnerSize=slicePixelSize*(width-1.0); \nfloat zSlice0=min(floor(uv.z*width),width-1.0);\nfloat zSlice1=min(zSlice0+1.0,width-1.0);\nfloat xOffset=slicePixelSize*0.5+uv.x*sliceInnerSize;\nfloat s0=xOffset+(zSlice0*sliceSize);\nfloat s1=xOffset+(zSlice1*sliceSize);\nvec4 slice0Color=texture2D(textureSampler,vec2(s0,uv.y));\nvec4 slice1Color=texture2D(textureSampler,vec2(s1,uv.y));\nfloat zOffset=mod(uv.z*width,1.0);\nvec4 result=mix(slice0Color,slice1Color,zOffset);\nreturn result;\n}\nvoid main(void)\n{\nvec4 screen_color=texture2D(textureSampler,vUV);\ngl_FragColor=sampleAs3DTexture(colorTable,screen_color.rgb,SLICE_COUNT);\n}",tonemapPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform float _ExposureAdjustment;\n#if defined(HABLE_TONEMAPPING)\nconst float A=0.15;\nconst float B=0.50;\nconst float C=0.10;\nconst float D=0.20;\nconst float E=0.02;\nconst float F=0.30;\nconst float W=11.2;\n#endif\nfloat Luminance(vec3 c)\n{\nreturn dot(c,vec3(0.22,0.707,0.071));\n}\nvoid main(void) \n{\nvec3 colour=texture2D(textureSampler,vUV).rgb;\n#if defined(REINHARD_TONEMAPPING)\nfloat lum=Luminance(colour.rgb); \nfloat lumTm=lum*_ExposureAdjustment;\nfloat scale=lumTm/(1.0+lumTm); \ncolour*=scale/lum;\n#elif defined(HABLE_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nconst float ExposureBias=2.0;\nvec3 x=ExposureBias*colour;\nvec3 curr=((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F;\nx=vec3(W,W,W);\nvec3 whiteScale=1.0/(((x*(A*x+C*B)+D*E)/(x*(A*x+B)+D*F))-E/F);\ncolour=curr*whiteScale;\n#elif defined(OPTIMIZED_HEJIDAWSON_TONEMAPPING)\ncolour*=_ExposureAdjustment;\nvec3 X=max(vec3(0.0,0.0,0.0),colour-0.004);\nvec3 retColor=(X*(6.2*X+0.5))/(X*(6.2*X+1.7)+0.06);\ncolour=retColor*retColor;\n#elif defined(PHOTOGRAPHIC_TONEMAPPING)\ncolour=vec3(1.0,1.0,1.0)-exp2(-_ExposureAdjustment*colour);\n#endif\ngl_FragColor=vec4(colour.rgb,1.0);\n}",displayPassPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D passSampler;\nvoid main(void)\n{\ngl_FragColor=texture2D(passSampler,vUV);\n}",highlightsPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nconst vec3 RGBLuminanceCoefficients=vec3(0.2126,0.7152,0.0722);\nvoid main(void) \n{\nvec4 tex=texture2D(textureSampler,vUV);\nvec3 c=tex.rgb;\nfloat luma=dot(c.rgb,RGBLuminanceCoefficients);\n\n\ngl_FragColor=vec4(pow(c,vec3(25.0-luma*15.0)),tex.a); \n}",imageProcessingPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#include<imageProcessingDeclaration>\n#include<helperFunctions>\n#include<imageProcessingFunctions>\nvoid main(void)\n{\nvec4 result=texture2D(textureSampler,vUV);\n#ifdef IMAGEPROCESSING\n#ifndef FROMLINEARSPACE\n\nresult.rgb=toLinearSpace(result.rgb);\n#endif\nresult=applyImageProcessing(result);\n#else\n\n#ifdef FROMLINEARSPACE\nresult=applyImageProcessing(result);\n#endif\n#endif\ngl_FragColor=result;\n}",lensFlareVertexShader:"\nattribute vec2 position;\n\nuniform mat4 viewportMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvUV=position*madd+madd;\ngl_Position=viewportMatrix*vec4(position,0.0,1.0);\n}",lensFlarePixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\ngl_FragColor=baseColor*color;\n}",anaglyphPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform sampler2D leftSampler;\nvoid main(void)\n{\nvec4 leftFrag=texture2D(leftSampler,vUV);\nleftFrag=vec4(1.0,leftFrag.g,leftFrag.b,1.0);\nvec4 rightFrag=texture2D(textureSampler,vUV);\nrightFrag=vec4(rightFrag.r,1.0,1.0,1.0);\ngl_FragColor=vec4(rightFrag.rgb*leftFrag.rgb,1.0);\n}",stereoscopicInterlacePixelShader:"const vec3 TWO=vec3(2.0,2.0,2.0);\nvarying vec2 vUV;\nuniform sampler2D camASampler;\nuniform sampler2D textureSampler;\nuniform vec2 stepSize;\nvoid main(void)\n{\nbool useCamB;\nvec2 texCoord1;\nvec2 texCoord2;\nvec3 frag1;\nvec3 frag2;\n#ifdef IS_STEREOSCOPIC_HORIZ\nuseCamB=vUV.x>0.5;\ntexCoord1=vec2(useCamB ? (vUV.x-0.5)*2.0 : vUV.x*2.0,vUV.y);\ntexCoord2=vec2(texCoord1.x+stepSize.x,vUV.y);\n#else\nuseCamB=vUV.y>0.5;\ntexCoord1=vec2(vUV.x,useCamB ? (vUV.y-0.5)*2.0 : vUV.y*2.0);\ntexCoord2=vec2(vUV.x,texCoord1.y+stepSize.y);\n#endif\n\nif (useCamB){\nfrag1=texture2D(textureSampler,texCoord1).rgb;\nfrag2=texture2D(textureSampler,texCoord2).rgb;\n}else{\nfrag1=texture2D(camASampler ,texCoord1).rgb;\nfrag2=texture2D(camASampler ,texCoord2).rgb;\n}\ngl_FragColor=vec4((frag1+frag2)/TWO,1.0);\n}",vrDistortionCorrectionPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\nuniform vec2 LensCenter;\nuniform vec2 Scale;\nuniform vec2 ScaleIn;\nuniform vec4 HmdWarpParam;\nvec2 HmdWarp(vec2 in01) {\nvec2 theta=(in01-LensCenter)*ScaleIn; \nfloat rSq=theta.x*theta.x+theta.y*theta.y;\nvec2 rvector=theta*(HmdWarpParam.x+HmdWarpParam.y*rSq+HmdWarpParam.z*rSq*rSq+HmdWarpParam.w*rSq*rSq*rSq);\nreturn LensCenter+Scale*rvector;\n}\nvoid main(void)\n{\nvec2 tc=HmdWarp(vUV);\nif (tc.x <0.0 || tc.x>1.0 || tc.y<0.0 || tc.y>1.0)\ngl_FragColor=vec4(0.0,0.0,0.0,0.0);\nelse{\ngl_FragColor=texture2D(textureSampler,tc);\n}\n}",glowBlurPostProcessPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec2 screenSize;\nuniform vec2 direction;\nuniform float blurWidth;\n\nfloat getLuminance(vec3 color)\n{\nreturn dot(color,vec3(0.2126,0.7152,0.0722));\n}\nvoid main(void)\n{\nfloat weights[7];\nweights[0]=0.05;\nweights[1]=0.1;\nweights[2]=0.2;\nweights[3]=0.3;\nweights[4]=0.2;\nweights[5]=0.1;\nweights[6]=0.05;\nvec2 texelSize=vec2(1.0/screenSize.x,1.0/screenSize.y);\nvec2 texelStep=texelSize*direction*blurWidth;\nvec2 start=vUV-3.0*texelStep;\nvec4 baseColor=vec4(0.,0.,0.,0.);\nvec2 texelOffset=vec2(0.,0.);\nfor (int i=0; i<7; i++)\n{\n\nvec4 texel=texture2D(textureSampler,start+texelOffset);\nbaseColor.a+=texel.a*weights[i];\n\nfloat luminance=getLuminance(baseColor.rgb);\nfloat luminanceTexel=getLuminance(texel.rgb);\nfloat choice=step(luminanceTexel,luminance);\nbaseColor.rgb=choice*baseColor.rgb+(1.0-choice)*texel.rgb;\ntexelOffset+=texelStep;\n}\ngl_FragColor=baseColor;\n}",glowMapGenerationPixelShader:"#ifdef ALPHATEST\nvarying vec2 vUVDiffuse;\nuniform sampler2D diffuseSampler;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform sampler2D emissiveSampler;\n#endif\nuniform vec4 color;\nvoid main(void)\n{\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUVDiffuse).a<0.4)\ndiscard;\n#endif\n#ifdef EMISSIVE\ngl_FragColor=texture2D(emissiveSampler,vUVEmissive)*color;\n#else\ngl_FragColor=color;\n#endif\n}",glowMapGenerationVertexShader:"\nattribute vec3 position;\n#include<bonesDeclaration>\n#include<morphTargetsVertexGlobalDeclaration>\n#include<morphTargetsVertexDeclaration>[0..maxSimultaneousMorphTargets]\n\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\nvarying vec4 vPosition;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef ALPHATEST\nvarying vec2 vUVDiffuse;\nuniform mat4 diffuseMatrix;\n#endif\n#ifdef EMISSIVE\nvarying vec2 vUVEmissive;\nuniform mat4 emissiveMatrix;\n#endif\nvoid main(void)\n{\nvec3 positionUpdated=position;\n#include<morphTargetsVertex>[0..maxSimultaneousMorphTargets]\n#include<instancesVertex>\n#include<bonesVertex>\n#ifdef CUBEMAP\nvPosition=finalWorld*vec4(positionUpdated,1.0);\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\n#else\nvPosition=viewProjection*finalWorld*vec4(positionUpdated,1.0);\ngl_Position=vPosition;\n#endif\n#ifdef ALPHATEST\n#ifdef DIFFUSEUV1\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef DIFFUSEUV2\nvUVDiffuse=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#ifdef EMISSIVE\n#ifdef EMISSIVEUV1\nvUVEmissive=vec2(emissiveMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef EMISSIVEUV2\nvUVEmissive=vec2(emissiveMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n}",glowMapMergePixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n#ifdef EMISSIVE\nuniform sampler2D textureSampler2;\n#endif\n\nuniform float offset;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef EMISSIVE\nbaseColor+=texture2D(textureSampler2,vUV);\nbaseColor*=offset;\n#else\nbaseColor.a=abs(offset-baseColor.a);\n#ifdef STROKE\nfloat alpha=smoothstep(.0,.1,baseColor.a);\nbaseColor.a=alpha;\nbaseColor.rgb=baseColor.rgb*alpha;\n#endif\n#endif\ngl_FragColor=baseColor;\n}",glowMapMergeVertexShader:"\nattribute vec2 position;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) {\nvUV=position*madd+madd;\ngl_Position=vec4(position,0.0,1.0);\n}",lineVertexShader:"\nattribute vec3 position;\nattribute vec4 normal;\n\nuniform mat4 worldViewProjection;\nuniform float width;\nuniform float aspectRatio;\nvoid main(void) {\nvec4 viewPosition=worldViewProjection*vec4(position,1.0);\nvec4 viewPositionNext=worldViewProjection*vec4(normal.xyz,1.0);\nvec2 currentScreen=viewPosition.xy/viewPosition.w;\nvec2 nextScreen=viewPositionNext.xy/viewPositionNext.w;\ncurrentScreen.x*=aspectRatio;\nnextScreen.x*=aspectRatio;\nvec2 dir=normalize(nextScreen-currentScreen);\nvec2 normalDir=vec2(-dir.y,dir.x);\nnormalDir*=width/2.0;\nnormalDir.x/=aspectRatio;\nvec4 offset=vec4(normalDir*normal.w,0.0,0.0);\ngl_Position=viewPosition+offset;\n}",linePixelShader:"uniform vec4 color;\nvoid main(void) {\ngl_FragColor=color;\n}",outlineVertexShader:"\nattribute vec3 position;\nattribute vec3 normal;\n#include<bonesDeclaration>\n\nuniform float offset;\n#include<instancesDeclaration>\nuniform mat4 viewProjection;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform mat4 diffuseMatrix;\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#endif\n#include<logDepthDeclaration>\nvoid main(void)\n{\nvec3 offsetPosition=position+normal*offset;\n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(offsetPosition,1.0);\n#ifdef ALPHATEST\n#ifdef UV1\nvUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n#endif\n#ifdef UV2\nvUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n#endif\n#endif\n#include<logDepthVertex>\n}\n",outlinePixelShader:"#ifdef LOGARITHMICDEPTH\n#extension GL_EXT_frag_depth : enable\n#endif\nuniform vec4 color;\n#ifdef ALPHATEST\nvarying vec2 vUV;\nuniform sampler2D diffuseSampler;\n#endif\n#include<logDepthDeclaration>\nvoid main(void) {\n#ifdef ALPHATEST\nif (texture2D(diffuseSampler,vUV).a<0.4)\ndiscard;\n#endif\n#include<logDepthFragment>\ngl_FragColor=color;\n}",layerVertexShader:"\nattribute vec2 position;\n\nuniform vec2 scale;\nuniform vec2 offset;\nuniform mat4 textureMatrix;\n\nvarying vec2 vUV;\nconst vec2 madd=vec2(0.5,0.5);\nvoid main(void) { \nvec2 shiftedPosition=position*scale+offset;\nvUV=vec2(textureMatrix*vec4(shiftedPosition*madd+madd,1.0,0.0));\ngl_Position=vec4(shiftedPosition,0.0,1.0);\n}",layerPixelShader:"\nvarying vec2 vUV;\nuniform sampler2D textureSampler;\n\nuniform vec4 color;\nvoid main(void) {\nvec4 baseColor=texture2D(textureSampler,vUV);\n#ifdef ALPHATEST\nif (baseColor.a<0.4)\ndiscard;\n#endif\ngl_FragColor=baseColor*color;\n}",backgroundVertexShader:"precision highp float;\n#include<__decl__backgroundVertex>\n#include<helperFunctions>\n\nattribute vec3 position;\n#ifdef NORMAL\nattribute vec3 normal;\n#endif\n#include<bonesDeclaration>\n\n#include<instancesDeclaration>\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\nvarying vec3 vPositionW;\n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef UV1\nattribute vec2 uv;\n#endif\n#ifdef UV2\nattribute vec2 uv2;\n#endif\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif\n#ifdef MAINUV2\nvarying vec2 vMainUV2; \n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0\nvarying vec2 vDiffuseUV;\n#endif\n#include<clipPlaneVertexDeclaration>\n#include<fogVertexDeclaration>\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\nvoid main(void) {\n#ifdef REFLECTIONMAP_SKYBOX\n#ifdef REFLECTIONMAP_SKYBOX_TRANSFORMED\nvPositionUVW=(reflectionMatrix*vec4(position,1.0)).xyz;\n#else\nvPositionUVW=position;\n#endif\n#endif \n#include<instancesVertex>\n#include<bonesVertex>\ngl_Position=viewProjection*finalWorld*vec4(position,1.0);\nvec4 worldPos=finalWorld*vec4(position,1.0);\nvPositionW=vec3(worldPos);\n#ifdef NORMAL\nmat3 normalWorld=mat3(finalWorld);\n#ifdef NONUNIFORMSCALING\nnormalWorld=transposeMat3(inverseMat3(normalWorld));\n#endif\nvNormalW=normalize(normalWorld*normal);\n#endif\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvDirectionW=normalize(vec3(finalWorld*vec4(position,0.0)));\n#ifdef EQUIRECTANGULAR_RELFECTION_FOV\nmat3 screenToWorld=inverseMat3(mat3(finalWorld*viewProjection));\nvec3 segment=mix(vDirectionW,screenToWorld*vec3(0.0,0.0,1.0),abs(fFovMultiplier-1.0));\nif (fFovMultiplier<=1.0) {\nvDirectionW=normalize(segment);\n} else {\nvDirectionW=normalize(vDirectionW+(vDirectionW-segment));\n}\n#endif\n#endif\n#ifndef UV1\nvec2 uv=vec2(0.,0.);\n#endif\n#ifndef UV2\nvec2 uv2=vec2(0.,0.);\n#endif\n#ifdef MAINUV1\nvMainUV1=uv;\n#endif \n#ifdef MAINUV2\nvMainUV2=uv2;\n#endif\n#if defined(DIFFUSE) && DIFFUSEDIRECTUV == 0 \nif (vDiffuseInfos.x == 0.)\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv,1.0,0.0));\n}\nelse\n{\nvDiffuseUV=vec2(diffuseMatrix*vec4(uv2,1.0,0.0));\n}\n#endif\n\n#include<clipPlaneVertex>\n\n#include<fogVertex>\n\n#include<shadowsVertex>[0..maxSimultaneousLights]\n\n#ifdef VERTEXCOLOR\nvColor=color;\n#endif\n\n#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif\n}\n",backgroundPixelShader:"#ifdef TEXTURELODSUPPORT\n#extension GL_EXT_shader_texture_lod : enable\n#endif\nprecision highp float;\n#include<__decl__backgroundFragment>\n#define RECIPROCAL_PI2 0.15915494\n\nuniform vec3 vEyePosition;\n\nvarying vec3 vPositionW;\n#ifdef MAINUV1\nvarying vec2 vMainUV1;\n#endif \n#ifdef MAINUV2 \nvarying vec2 vMainUV2; \n#endif \n#ifdef NORMAL\nvarying vec3 vNormalW;\n#endif\n#ifdef DIFFUSE\n#if DIFFUSEDIRECTUV == 1\n#define vDiffuseUV vMainUV1\n#elif DIFFUSEDIRECTUV == 2\n#define vDiffuseUV vMainUV2\n#else\nvarying vec2 vDiffuseUV;\n#endif\nuniform sampler2D diffuseSampler;\n#endif\n\n#ifdef REFLECTION\n#ifdef REFLECTIONMAP_3D\n#define sampleReflection(s,c) textureCube(s,c)\nuniform samplerCube reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) textureCubeLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#else\n#define sampleReflection(s,c) texture2D(s,c)\nuniform sampler2D reflectionSampler;\n#ifdef TEXTURELODSUPPORT\n#define sampleReflectionLod(s,c,l) texture2DLodEXT(s,c,l)\n#else\nuniform samplerCube reflectionSamplerLow;\nuniform samplerCube reflectionSamplerHigh;\n#endif\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nvarying vec3 vPositionUVW;\n#else\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvarying vec3 vDirectionW;\n#endif\n#endif\n#include<reflectionFunction>\n#endif\n\n#ifndef FROMLINEARSPACE\n#define FROMLINEARSPACE;\n#endif\n\n#ifndef SHADOWONLY\n#define SHADOWONLY;\n#endif\n#include<imageProcessingDeclaration>\n\n#include<__decl__lightFragment>[0..maxSimultaneousLights]\n#include<helperFunctions>\n#include<lightsFragmentFunctions>\n#include<shadowsFragmentFunctions>\n#include<imageProcessingFunctions>\n#include<clipPlaneFragmentDeclaration>\n\n#include<fogFragmentDeclaration>\n#ifdef REFLECTIONFRESNEL\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow(clamp(1.0-VdotN,0.,1.),5.0);\n}\n#endif\nvoid main(void) {\n#include<clipPlaneFragment>\nvec3 viewDirectionW=normalize(vEyePosition-vPositionW);\n\n#ifdef NORMAL\nvec3 normalW=normalize(vNormalW);\n#else\nvec3 normalW=vec3(0.0,1.0,0.0);\n#endif\n\nfloat shadow=1.;\nfloat globalShadow=0.;\nfloat shadowLightCount=0.;\n#include<lightFragment>[0..maxSimultaneousLights]\n#ifdef SHADOWINUSE\nglobalShadow/=shadowLightCount;\n#else\nglobalShadow=1.0;\n#endif\n\nvec4 reflectionColor=vec4(1.,1.,1.,1.);\n#ifdef REFLECTION\nvec3 reflectionVector=computeReflectionCoords(vec4(vPositionW,1.0),normalW);\n#ifdef REFLECTIONMAP_OPPOSITEZ\nreflectionVector.z*=-1.0;\n#endif\n\n#ifdef REFLECTIONMAP_3D\nvec3 reflectionCoords=reflectionVector;\n#else\nvec2 reflectionCoords=reflectionVector.xy;\n#ifdef REFLECTIONMAP_PROJECTION\nreflectionCoords/=reflectionVector.z;\n#endif\nreflectionCoords.y=1.0-reflectionCoords.y;\n#endif\n#ifdef REFLECTIONBLUR\nfloat reflectionLOD=vReflectionInfos.y;\n#ifdef TEXTURELODSUPPORT\n\nreflectionLOD=reflectionLOD*log2(vReflectionMicrosurfaceInfos.x)*vReflectionMicrosurfaceInfos.y+vReflectionMicrosurfaceInfos.z;\nreflectionColor=sampleReflectionLod(reflectionSampler,reflectionCoords,reflectionLOD);\n#else\nfloat lodReflectionNormalized=clamp(reflectionLOD,0.,1.);\nfloat lodReflectionNormalizedDoubled=lodReflectionNormalized*2.0;\nvec4 reflectionSpecularMid=sampleReflection(reflectionSampler,reflectionCoords);\nif(lodReflectionNormalizedDoubled<1.0){\nreflectionColor=mix(\nsampleReflection(reflectionSamplerHigh,reflectionCoords),\nreflectionSpecularMid,\nlodReflectionNormalizedDoubled\n);\n} else {\nreflectionColor=mix(\nreflectionSpecularMid,\nsampleReflection(reflectionSamplerLow,reflectionCoords),\nlodReflectionNormalizedDoubled-1.0\n);\n}\n#endif\n#else\nvec4 reflectionSample=sampleReflection(reflectionSampler,reflectionCoords);\nreflectionColor=reflectionSample;\n#endif\n#ifdef RGBDREFLECTION\nreflectionColor.rgb=fromRGBD(reflectionColor);\n#endif\n#ifdef GAMMAREFLECTION\nreflectionColor.rgb=toLinearSpace(reflectionColor.rgb);\n#endif\n#ifdef REFLECTIONBGR\nreflectionColor.rgb=reflectionColor.bgr;\n#endif\n\nreflectionColor.rgb*=vReflectionInfos.x;\n#endif\n\nvec3 diffuseColor=vec3(1.,1.,1.);\nfloat finalAlpha=alpha;\n#ifdef DIFFUSE\nvec4 diffuseMap=texture2D(diffuseSampler,vDiffuseUV);\n#ifdef GAMMADIFFUSE\ndiffuseMap.rgb=toLinearSpace(diffuseMap.rgb);\n#endif\n\ndiffuseMap.rgb*=vDiffuseInfos.y;\n#ifdef DIFFUSEHASALPHA\nfinalAlpha*=diffuseMap.a;\n#endif\ndiffuseColor=diffuseMap.rgb;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 colorBase=diffuseColor;\n#else\nvec3 colorBase=reflectionColor.rgb*diffuseColor;\n#endif\ncolorBase=max(colorBase,0.0);\n\n#ifdef USERGBCOLOR\nvec3 finalColor=colorBase;\n#else\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nvec3 mainColor=mix(vPrimaryColorShadow.rgb,vPrimaryColor.rgb,colorBase);\n#else\nvec3 mainColor=vPrimaryColor.rgb;\n#endif\nvec3 finalColor=colorBase*mainColor;\n#endif\n\n#ifdef REFLECTIONFRESNEL\nvec3 reflectionAmount=vReflectionControl.xxx;\nvec3 reflectionReflectance0=vReflectionControl.yyy;\nvec3 reflectionReflectance90=vReflectionControl.zzz;\nfloat VdotN=dot(normalize(vEyePosition),normalW);\nvec3 planarReflectionFresnel=fresnelSchlickEnvironmentGGX(clamp(VdotN,0.0,1.0),reflectionReflectance0,reflectionReflectance90,1.0);\nreflectionAmount*=planarReflectionFresnel;\n#ifdef REFLECTIONFALLOFF\nfloat reflectionDistanceFalloff=1.0-clamp(length(vPositionW.xyz-vBackgroundCenter)*vReflectionControl.w,0.0,1.0);\nreflectionDistanceFalloff*=reflectionDistanceFalloff;\nreflectionAmount*=reflectionDistanceFalloff;\n#endif\nfinalColor=mix(finalColor,reflectionColor.rgb,clamp(reflectionAmount,0.,1.));\n#endif\n#ifdef OPACITYFRESNEL\nfloat viewAngleToFloor=dot(normalW,normalize(vEyePosition-vBackgroundCenter));\n\nconst float startAngle=0.1;\nfloat fadeFactor=clamp(viewAngleToFloor/startAngle,0.0,1.0);\nfinalAlpha*=fadeFactor*fadeFactor;\n#endif\n\n#ifdef SHADOWINUSE\nfinalColor=mix(finalColor*shadowLevel,finalColor,globalShadow);\n#endif\n\nvec4 color=vec4(finalColor,finalAlpha);\n#include<fogFragment>\n#ifdef IMAGEPROCESSINGPOSTPROCESS\n\n\ncolor.rgb=clamp(color.rgb,0.,30.0);\n#else\n\ncolor=applyImageProcessing(color);\n#endif\n#ifdef PREMULTIPLYALPHA\n\ncolor.rgb*=color.a;\n#endif\n#ifdef NOISE\ncolor.rgb+=dither(vPositionW.xy,0.5);\ncolor=max(color,0.0);\n#endif\ngl_FragColor=color;\n}\n",noisePixelShader:"\n\nuniform float brightness;\nuniform float persistence;\nuniform float timeScale;\n\nvarying vec2 vUV;\n\nvec2 hash22(vec2 p)\n{\np=p*mat2(127.1,311.7,269.5,183.3);\np=-1.0+2.0*fract(sin(p)*43758.5453123);\nreturn sin(p*6.283+timeScale);\n}\nfloat interpolationNoise(vec2 p)\n{\nvec2 pi=floor(p);\nvec2 pf=p-pi;\nvec2 w=pf*pf*(3.-2.*pf);\nfloat f00=dot(hash22(pi+vec2(.0,.0)),pf-vec2(.0,.0));\nfloat f01=dot(hash22(pi+vec2(.0,1.)),pf-vec2(.0,1.));\nfloat f10=dot(hash22(pi+vec2(1.0,0.)),pf-vec2(1.0,0.));\nfloat f11=dot(hash22(pi+vec2(1.0,1.)),pf-vec2(1.0,1.));\nfloat xm1=mix(f00,f10,w.x);\nfloat xm2=mix(f01,f11,w.x);\nfloat ym=mix(xm1,xm2,w.y); \nreturn ym;\n}\nfloat perlinNoise2D(float x,float y)\n{\nfloat sum=0.0;\nfloat frequency=0.0;\nfloat amplitude=0.0;\nfor(int i=0; i<OCTAVES; i++)\n{\nfrequency=pow(2.0,float(i));\namplitude=pow(persistence,float(i));\nsum=sum+interpolationNoise(vec2(x*frequency,y*frequency))*amplitude;\n}\nreturn sum;\n}\n\nvoid main(void)\n{\nfloat x=abs(vUV.x);\nfloat y=abs(vUV.y);\nfloat noise=brightness+(1.0-brightness)*perlinNoise2D(x,y);\ngl_FragColor=vec4(noise,noise,noise,1.0);\n}\n"},$a.Effect.IncludesShadersStore={depthPrePass:"#ifdef DEPTHPREPASS\ngl_FragColor=vec4(0.,0.,0.,1.0);\nreturn;\n#endif",bonesDeclaration:"#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mBones[BonesPerMesh];\nattribute vec4 matricesIndices;\nattribute vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nattribute vec4 matricesIndicesExtra;\nattribute vec4 matricesWeightsExtra;\n#endif\n#endif",instancesDeclaration:"#ifdef INSTANCES\nattribute vec4 world0;\nattribute vec4 world1;\nattribute vec4 world2;\nattribute vec4 world3;\n#else\nuniform mat4 world;\n#endif",pointCloudVertexDeclaration:"#ifdef POINTSIZE\nuniform float pointSize;\n#endif",bumpVertexDeclaration:"#if defined(BUMP) || defined(PARALLAX)\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#endif\n",clipPlaneVertexDeclaration:"#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nvarying float fClipDistance4;\n#endif",fogVertexDeclaration:"#ifdef FOG\nvarying vec3 vFogDistance;\n#endif",morphTargetsVertexGlobalDeclaration:"#ifdef MORPHTARGETS\nuniform float morphTargetInfluences[NUM_MORPH_INFLUENCERS];\n#endif",morphTargetsVertexDeclaration:"#ifdef MORPHTARGETS\nattribute vec3 position{X};\n#ifdef MORPHTARGETS_NORMAL\nattribute vec3 normal{X};\n#endif\n#ifdef MORPHTARGETS_TANGENT\nattribute vec3 tangent{X};\n#endif\n#endif",logDepthDeclaration:"#ifdef LOGARITHMICDEPTH\nuniform float logarithmicDepthConstant;\nvarying float vFragmentDepth;\n#endif",morphTargetsVertex:"#ifdef MORPHTARGETS\npositionUpdated+=(position{X}-position)*morphTargetInfluences[{X}];\n#ifdef MORPHTARGETS_NORMAL\nnormalUpdated+=(normal{X}-normal)*morphTargetInfluences[{X}];\n#endif\n#ifdef MORPHTARGETS_TANGENT\ntangentUpdated.xyz+=(tangent{X}-tangent.xyz)*morphTargetInfluences[{X}];\n#endif\n#endif",instancesVertex:"#ifdef INSTANCES\nmat4 finalWorld=mat4(world0,world1,world2,world3);\n#else\nmat4 finalWorld=world;\n#endif",bonesVertex:"#if NUM_BONE_INFLUENCERS>0\nmat4 influence;\ninfluence=mBones[int(matricesIndices[0])]*matricesWeights[0];\n#if NUM_BONE_INFLUENCERS>1\ninfluence+=mBones[int(matricesIndices[1])]*matricesWeights[1];\n#endif \n#if NUM_BONE_INFLUENCERS>2\ninfluence+=mBones[int(matricesIndices[2])]*matricesWeights[2];\n#endif \n#if NUM_BONE_INFLUENCERS>3\ninfluence+=mBones[int(matricesIndices[3])]*matricesWeights[3];\n#endif \n#if NUM_BONE_INFLUENCERS>4\ninfluence+=mBones[int(matricesIndicesExtra[0])]*matricesWeightsExtra[0];\n#endif \n#if NUM_BONE_INFLUENCERS>5\ninfluence+=mBones[int(matricesIndicesExtra[1])]*matricesWeightsExtra[1];\n#endif \n#if NUM_BONE_INFLUENCERS>6\ninfluence+=mBones[int(matricesIndicesExtra[2])]*matricesWeightsExtra[2];\n#endif \n#if NUM_BONE_INFLUENCERS>7\ninfluence+=mBones[int(matricesIndicesExtra[3])]*matricesWeightsExtra[3];\n#endif \nfinalWorld=finalWorld*influence;\n#endif",bumpVertex:"#if defined(BUMP) || defined(PARALLAX)\n#if defined(TANGENT) && defined(NORMAL)\nvec3 tbnNormal=normalize(normalUpdated);\nvec3 tbnTangent=normalize(tangentUpdated.xyz);\nvec3 tbnBitangent=cross(tbnNormal,tbnTangent)*tangentUpdated.w;\nvTBN=mat3(finalWorld)*mat3(tbnTangent,tbnBitangent,tbnNormal);\n#endif\n#endif",clipPlaneVertex:"#ifdef CLIPPLANE\nfClipDistance=dot(worldPos,vClipPlane);\n#endif\n#ifdef CLIPPLANE2\nfClipDistance2=dot(worldPos,vClipPlane2);\n#endif\n#ifdef CLIPPLANE3\nfClipDistance3=dot(worldPos,vClipPlane3);\n#endif\n#ifdef CLIPPLANE4\nfClipDistance4=dot(worldPos,vClipPlane4);\n#endif",fogVertex:"#ifdef FOG\nvFogDistance=(view*worldPos).xyz;\n#endif",shadowsVertex:"#ifdef SHADOWS\n#if defined(SHADOW{X}) && !defined(SHADOWCUBE{X})\nvPositionFromLight{X}=lightMatrix{X}*worldPos;\nvDepthMetric{X}=((vPositionFromLight{X}.z+light{X}.depthValues.x)/(light{X}.depthValues.y));\n#endif\n#endif",pointCloudVertex:"#ifdef POINTSIZE\ngl_PointSize=pointSize;\n#endif",logDepthVertex:"#ifdef LOGARITHMICDEPTH\nvFragmentDepth=1.0+gl_Position.w;\ngl_Position.z=log2(max(0.000001,vFragmentDepth))*logarithmicDepthConstant;\n#endif",helperFunctions:"const float PI=3.1415926535897932384626433832795;\nconst float LinearEncodePowerApprox=2.2;\nconst float GammaEncodePowerApprox=1.0/LinearEncodePowerApprox;\nconst vec3 LuminanceEncodeApprox=vec3(0.2126,0.7152,0.0722);\nmat3 transposeMat3(mat3 inMatrix) {\nvec3 i0=inMatrix[0];\nvec3 i1=inMatrix[1];\nvec3 i2=inMatrix[2];\nmat3 outMatrix=mat3(\nvec3(i0.x,i1.x,i2.x),\nvec3(i0.y,i1.y,i2.y),\nvec3(i0.z,i1.z,i2.z)\n);\nreturn outMatrix;\n}\n\nmat3 inverseMat3(mat3 inMatrix) {\nfloat a00=inMatrix[0][0],a01=inMatrix[0][1],a02=inMatrix[0][2];\nfloat a10=inMatrix[1][0],a11=inMatrix[1][1],a12=inMatrix[1][2];\nfloat a20=inMatrix[2][0],a21=inMatrix[2][1],a22=inMatrix[2][2];\nfloat b01=a22*a11-a12*a21;\nfloat b11=-a22*a10+a12*a20;\nfloat b21=a21*a10-a11*a20;\nfloat det=a00*b01+a01*b11+a02*b21;\nreturn mat3(b01,(-a22*a01+a02*a21),(a12*a01-a02*a11),\nb11,(a22*a00-a02*a20),(-a12*a00+a02*a10),\nb21,(-a21*a00+a01*a20),(a11*a00-a01*a10))/det;\n}\nfloat computeFallOff(float value,vec2 clipSpace,float frustumEdgeFalloff)\n{\nfloat mask=smoothstep(1.0-frustumEdgeFalloff,1.0,clamp(dot(clipSpace,clipSpace),0.,1.));\nreturn mix(value,1.0,mask);\n}\nvec3 applyEaseInOut(vec3 x){\nreturn x*x*(3.0-2.0*x);\n}\nvec3 toLinearSpace(vec3 color)\n{\nreturn pow(color,vec3(LinearEncodePowerApprox));\n}\nvec3 toGammaSpace(vec3 color)\n{\nreturn pow(color,vec3(GammaEncodePowerApprox));\n}\nfloat square(float value)\n{\nreturn value*value;\n}\nfloat getLuminance(vec3 color)\n{\nreturn clamp(dot(color,LuminanceEncodeApprox),0.,1.);\n}\n\nfloat getRand(vec2 seed) {\nreturn fract(sin(dot(seed.xy ,vec2(12.9898,78.233)))*43758.5453);\n}\nfloat dither(vec2 seed,float varianceAmount) {\nfloat rand=getRand(seed);\nfloat dither=mix(-varianceAmount/255.0,varianceAmount/255.0,rand);\nreturn dither;\n}\n\nconst float rgbdMaxRange=255.0;\nvec4 toRGBD(vec3 color) {\nfloat maxRGB=max(0.0000001,max(color.r,max(color.g,color.b)));\nfloat D=max(rgbdMaxRange/maxRGB,1.);\nD=clamp(floor(D)/255.0,0.,1.);\n\nvec3 rgb=color.rgb*D;\n\nrgb=toGammaSpace(rgb);\nreturn vec4(rgb,D); \n}\nvec3 fromRGBD(vec4 rgbd) {\n\nrgbd.rgb=toLinearSpace(rgbd.rgb);\n\nreturn rgbd.rgb/rgbd.a;\n}",lightFragmentDeclaration:"#ifdef LIGHT{X}\nuniform vec4 vLightData{X};\nuniform vec4 vLightDiffuse{X};\n#ifdef SPECULARTERM\nuniform vec3 vLightSpecular{X};\n#else\nvec3 vLightSpecular{X}=vec3(0.);\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X};\n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\nuniform vec4 shadowsInfo{X};\nuniform vec2 depthValues{X};\n#endif\n#ifdef SPOTLIGHT{X}\nuniform vec4 vLightDirection{X};\nuniform vec4 vLightFalloff{X};\n#elif defined(POINTLIGHT{X})\nuniform vec4 vLightFalloff{X};\n#elif defined(HEMILIGHT{X})\nuniform vec3 vLightGround{X};\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#endif",lightsFragmentFunctions:"\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n#ifdef NDOTL\nfloat ndl;\n#endif\n};\nlightingInfo computeLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 lightVectorW;\nfloat attenuation=1.0;\nif (lightData.w == 0.)\n{\nvec3 direction=lightData.xyz-vPositionW;\nattenuation=max(0.,1.0-length(direction)/range);\nlightVectorW=normalize(direction);\n}\nelse\n{\nlightVectorW=normalize(-lightData.xyz);\n}\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec4 lightDirection,vec3 diffuseColor,vec3 specularColor,float range,float glossiness) {\nlightingInfo result;\nvec3 direction=lightData.xyz-vPositionW;\nvec3 lightVectorW=normalize(direction);\nfloat attenuation=max(0.,1.0-length(direction)/range);\n\nfloat cosAngle=max(0.,dot(lightDirection.xyz,-lightVectorW));\nif (cosAngle>=lightDirection.w)\n{\ncosAngle=max(0.,pow(cosAngle,lightData.w));\nattenuation*=cosAngle;\n\nfloat ndl=max(0.,dot(vNormal,lightVectorW));\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=ndl*diffuseColor*attenuation;\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightVectorW);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor*attenuation;\n#endif\nreturn result;\n}\nresult.diffuse=vec3(0.);\n#ifdef SPECULARTERM\nresult.specular=vec3(0.);\n#endif\n#ifdef NDOTL\nresult.ndl=0.;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float glossiness) {\nlightingInfo result;\n\nfloat ndl=dot(vNormal,lightData.xyz)*0.5+0.5;\n#ifdef NDOTL\nresult.ndl=ndl;\n#endif\nresult.diffuse=mix(groundColor,diffuseColor,ndl);\n#ifdef SPECULARTERM\n\nvec3 angleW=normalize(viewDirectionW+lightData.xyz);\nfloat specComp=max(0.,dot(vNormal,angleW));\nspecComp=pow(specComp,max(1.,glossiness));\nresult.specular=specComp*specularColor;\n#endif\nreturn result;\n}\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn textureColor;\n}",lightUboDeclaration:"#ifdef LIGHT{X}\nuniform Light{X}\n{\nvec4 vLightData;\nvec4 vLightDiffuse;\nvec3 vLightSpecular;\n#ifdef SPOTLIGHT{X}\nvec4 vLightDirection;\nvec4 vLightFalloff;\n#elif defined(POINTLIGHT{X})\nvec4 vLightFalloff;\n#elif defined(HEMILIGHT{X})\nvec3 vLightGround;\n#endif\nvec4 shadowsInfo;\nvec2 depthValues;\n} light{X};\n#ifdef PROJECTEDLIGHTTEXTURE{X}\nuniform mat4 textureProjectionMatrix{X};\nuniform sampler2D projectionLightSampler{X};\n#endif\n#ifdef SHADOW{X}\n#if defined(SHADOWCUBE{X})\nuniform samplerCube shadowSampler{X}; \n#else\nvarying vec4 vPositionFromLight{X};\nvarying float vDepthMetric{X};\n#if defined(SHADOWPCSS{X})\nuniform highp sampler2DShadow shadowSampler{X};\nuniform highp sampler2D depthSampler{X};\n#elif defined(SHADOWPCF{X})\nuniform highp sampler2DShadow shadowSampler{X};\n#else\nuniform sampler2D shadowSampler{X};\n#endif\nuniform mat4 lightMatrix{X};\n#endif\n#endif\n#endif",defaultVertexDeclaration:"\nuniform mat4 viewProjection;\nuniform mat4 view;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\nuniform mat4 specularMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef REFLECTION\nuniform mat4 reflectionMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n",defaultFragmentDeclaration:"uniform vec4 vDiffuseColor;\n#ifdef SPECULARTERM\nuniform vec4 vSpecularColor;\n#endif\nuniform vec3 vEmissiveColor;\n\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef AMBIENT\nuniform vec2 vAmbientInfos;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\n#ifndef REFRACTIONMAP_3D\nuniform mat4 refractionMatrix;\n#endif\n#ifdef REFRACTIONFRESNEL\nuniform vec4 refractionLeftColor;\nuniform vec4 refractionRightColor;\n#endif\n#endif\n#if defined(SPECULAR) && defined(SPECULARTERM)\nuniform vec2 vSpecularInfos;\n#endif\n#ifdef DIFFUSEFRESNEL\nuniform vec4 diffuseLeftColor;\nuniform vec4 diffuseRightColor;\n#endif\n#ifdef OPACITYFRESNEL\nuniform vec4 opacityParts;\n#endif\n#ifdef EMISSIVEFRESNEL\nuniform vec4 emissiveLeftColor;\nuniform vec4 emissiveRightColor;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\n#ifdef REFLECTIONMAP_SKYBOX\n#else\n#if defined(REFLECTIONMAP_PLANAR) || defined(REFLECTIONMAP_CUBIC) || defined(REFLECTIONMAP_PROJECTION)\nuniform mat4 reflectionMatrix;\n#endif\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 reflectionLeftColor;\nuniform vec4 reflectionRightColor;\n#endif\n#endif",defaultUboDeclaration:"layout(std140,column_major) uniform;\nuniform Material\n{\nvec4 diffuseLeftColor;\nvec4 diffuseRightColor;\nvec4 opacityParts;\nvec4 reflectionLeftColor;\nvec4 reflectionRightColor;\nvec4 refractionLeftColor;\nvec4 refractionRightColor;\nvec4 emissiveLeftColor; \nvec4 emissiveRightColor;\nvec2 vDiffuseInfos;\nvec2 vAmbientInfos;\nvec2 vOpacityInfos;\nvec2 vReflectionInfos;\nvec3 vReflectionPosition;\nvec3 vReflectionSize;\nvec2 vEmissiveInfos;\nvec2 vLightmapInfos;\nvec2 vSpecularInfos;\nvec3 vBumpInfos;\nmat4 diffuseMatrix;\nmat4 ambientMatrix;\nmat4 opacityMatrix;\nmat4 reflectionMatrix;\nmat4 emissiveMatrix;\nmat4 lightmapMatrix;\nmat4 specularMatrix;\nmat4 bumpMatrix; \nvec4 vTangentSpaceParams;\nmat4 refractionMatrix;\nvec4 vRefractionInfos;\nvec4 vSpecularColor;\nvec3 vEmissiveColor;\nvec4 vDiffuseColor;\nfloat pointSize; \n};\nuniform Scene {\nmat4 viewProjection;\nmat4 view;\n};",shadowsFragmentFunctions:"#ifdef SHADOWS\n#ifndef SHADOWFLOAT\nfloat unpack(vec4 color)\n{\nconst vec4 bit_shift=vec4(1.0/(255.0*255.0*255.0),1.0/(255.0*255.0),1.0/255.0,1.0);\nreturn dot(color,bit_shift);\n}\n#endif\nfloat computeShadowCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadow=textureCube(shadowSampler,directionToLight).x;\n#endif\nif (depth>shadow)\n{\nreturn darkness;\n}\nreturn 1.0;\n}\nfloat computeShadowWithPoissonSamplingCube(vec3 lightPosition,samplerCube shadowSampler,float mapSize,float darkness,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\ndepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\nfloat visibility=1.;\nvec3 poissonDisk[4];\npoissonDisk[0]=vec3(-1.0,1.0,-1.0);\npoissonDisk[1]=vec3(1.0,-1.0,-1.0);\npoissonDisk[2]=vec3(-1.0,-1.0,-1.0);\npoissonDisk[3]=vec3(1.0,-1.0,1.0);\n\n#ifndef SHADOWFLOAT\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize))<depth) visibility-=0.25;\nif (unpack(textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize))<depth) visibility-=0.25;\n#else\nif (textureCube(shadowSampler,directionToLight+poissonDisk[0]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[1]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[2]*mapSize).x<depth) visibility-=0.25;\nif (textureCube(shadowSampler,directionToLight+poissonDisk[3]*mapSize).x<depth) visibility-=0.25;\n#endif\nreturn min(1.0,visibility+darkness);\n}\nfloat computeShadowWithESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness); \nreturn esm;\n}\nfloat computeShadowWithCloseESMCube(vec3 lightPosition,samplerCube shadowSampler,float darkness,float depthScale,vec2 depthValues)\n{\nvec3 directionToLight=vPositionW-lightPosition;\nfloat depth=length(directionToLight);\ndepth=(depth+depthValues.x)/(depthValues.y);\nfloat shadowPixelDepth=clamp(depth,0.,1.0);\ndirectionToLight=normalize(directionToLight);\ndirectionToLight.y=-directionToLight.y;\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(textureCube(shadowSampler,directionToLight));\n#else\nfloat shadowMapSample=textureCube(shadowSampler,directionToLight).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn esm;\n}\nfloat computeShadow(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadow=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadow=texture2D(shadowSampler,uv).x;\n#endif\nif (shadowPixelDepth>shadow)\n{\nreturn computeFallOff(darkness,clipSpace.xy,frustumEdgeFalloff);\n}\nreturn 1.;\n}\nfloat computeShadowWithPoissonSampling(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float mapSize,float darkness,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\nfloat visibility=1.;\nvec2 poissonDisk[4];\npoissonDisk[0]=vec2(-0.94201624,-0.39906216);\npoissonDisk[1]=vec2(0.94558609,-0.76890725);\npoissonDisk[2]=vec2(-0.094184101,-0.92938870);\npoissonDisk[3]=vec2(0.34495938,0.29387760);\n\n#ifndef SHADOWFLOAT\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[0]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[1]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[2]*mapSize))<shadowPixelDepth) visibility-=0.25;\nif (unpack(texture2D(shadowSampler,uv+poissonDisk[3]*mapSize))<shadowPixelDepth) visibility-=0.25;\n#else\nif (texture2D(shadowSampler,uv+poissonDisk[0]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[1]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[2]*mapSize).x<shadowPixelDepth) visibility-=0.25;\nif (texture2D(shadowSampler,uv+poissonDisk[3]*mapSize).x<shadowPixelDepth) visibility-=0.25;\n#endif\nreturn computeFallOff(min(1.0,visibility+darkness),clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0);\n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=1.0-clamp(exp(min(87.,depthScale*shadowPixelDepth))*shadowMapSample,0.,1.-darkness);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithCloseESM(vec4 vPositionFromLight,float depthMetric,sampler2D shadowSampler,float darkness,float depthScale,float frustumEdgeFalloff)\n{\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec2 uv=0.5*clipSpace.xy+vec2(0.5);\nif (uv.x<0. || uv.x>1.0 || uv.y<0. || uv.y>1.0)\n{\nreturn 1.0;\n}\nfloat shadowPixelDepth=clamp(depthMetric,0.,1.0); \n#ifndef SHADOWFLOAT\nfloat shadowMapSample=unpack(texture2D(shadowSampler,uv));\n#else\nfloat shadowMapSample=texture2D(shadowSampler,uv).x;\n#endif\nfloat esm=clamp(exp(min(87.,-depthScale*(shadowPixelDepth-shadowMapSample))),darkness,1.);\nreturn computeFallOff(esm,clipSpace.xy,frustumEdgeFalloff);\n}\n#ifdef WEBGL2\n\nfloat computeShadowWithPCF1(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat shadow=texture2D(shadowSampler,uvDepth);\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF3(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \n\n\n\n\nvec2 uvw0=3.-2.*st;\nvec2 uvw1=1.+2.*st;\nvec2 u=vec2((2.-st.x)/uvw0.x-1.,st.x/uvw1.x+1.)*shadowMapSizeAndInverse.y;\nvec2 v=vec2((2.-st.y)/uvw0.y-1.,st.y/uvw1.y+1.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow=shadow/16.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\n\n\n\nfloat computeShadowWithPCF5(vec4 vPositionFromLight,float depthMetric,sampler2DShadow shadowSampler,vec2 shadowMapSizeAndInverse,float darkness,float frustumEdgeFalloff)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nvec2 uv=uvDepth.xy*shadowMapSizeAndInverse.x; \nuv+=0.5; \nvec2 st=fract(uv); \nvec2 base_uv=floor(uv)-0.5; \nbase_uv*=shadowMapSizeAndInverse.y; \n\n\nvec2 uvw0=4.-3.*st;\nvec2 uvw1=vec2(7.);\nvec2 uvw2=1.+3.*st;\nvec3 u=vec3((3.-2.*st.x)/uvw0.x-2.,(3.+st.x)/uvw1.x,st.x/uvw2.x+2.)*shadowMapSizeAndInverse.y;\nvec3 v=vec3((3.-2.*st.y)/uvw0.y-2.,(3.+st.y)/uvw1.y,st.y/uvw2.y+2.)*shadowMapSizeAndInverse.y;\nfloat shadow=0.;\nshadow+=uvw0.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[0]),uvDepth.z));\nshadow+=uvw1.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[0]),uvDepth.z));\nshadow+=uvw2.x*uvw0.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[0]),uvDepth.z));\nshadow+=uvw0.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[1]),uvDepth.z));\nshadow+=uvw1.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[1]),uvDepth.z));\nshadow+=uvw2.x*uvw1.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[1]),uvDepth.z));\nshadow+=uvw0.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[0],v[2]),uvDepth.z));\nshadow+=uvw1.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[1],v[2]),uvDepth.z));\nshadow+=uvw2.x*uvw2.y*texture2D(shadowSampler,vec3(base_uv.xy+vec2(u[2],v[2]),uvDepth.z));\nshadow=shadow/144.;\nshadow=mix(darkness,1.,shadow);\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\nconst vec3 PoissonSamplers32[64]=vec3[64](\nvec3(0.06407013,0.05409927,0.),\nvec3(0.7366577,0.5789394,0.),\nvec3(-0.6270542,-0.5320278,0.),\nvec3(-0.4096107,0.8411095,0.),\nvec3(0.6849564,-0.4990818,0.),\nvec3(-0.874181,-0.04579735,0.),\nvec3(0.9989998,0.0009880066,0.),\nvec3(-0.004920578,-0.9151649,0.),\nvec3(0.1805763,0.9747483,0.),\nvec3(-0.2138451,0.2635818,0.),\nvec3(0.109845,0.3884785,0.),\nvec3(0.06876755,-0.3581074,0.),\nvec3(0.374073,-0.7661266,0.),\nvec3(0.3079132,-0.1216763,0.),\nvec3(-0.3794335,-0.8271583,0.),\nvec3(-0.203878,-0.07715034,0.),\nvec3(0.5912697,0.1469799,0.),\nvec3(-0.88069,0.3031784,0.),\nvec3(0.5040108,0.8283722,0.),\nvec3(-0.5844124,0.5494877,0.),\nvec3(0.6017799,-0.1726654,0.),\nvec3(-0.5554981,0.1559997,0.),\nvec3(-0.3016369,-0.3900928,0.),\nvec3(-0.5550632,-0.1723762,0.),\nvec3(0.925029,0.2995041,0.),\nvec3(-0.2473137,0.5538505,0.),\nvec3(0.9183037,-0.2862392,0.),\nvec3(0.2469421,0.6718712,0.),\nvec3(0.3916397,-0.4328209,0.),\nvec3(-0.03576927,-0.6220032,0.),\nvec3(-0.04661255,0.7995201,0.),\nvec3(0.4402924,0.3640312,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.),\nvec3(0.,0.,0.)\n);\nconst vec3 PoissonSamplers64[64]=vec3[64](\nvec3(-0.613392,0.617481,0.),\nvec3(0.170019,-0.040254,0.),\nvec3(-0.299417,0.791925,0.),\nvec3(0.645680,0.493210,0.),\nvec3(-0.651784,0.717887,0.),\nvec3(0.421003,0.027070,0.),\nvec3(-0.817194,-0.271096,0.),\nvec3(-0.705374,-0.668203,0.),\nvec3(0.977050,-0.108615,0.),\nvec3(0.063326,0.142369,0.),\nvec3(0.203528,0.214331,0.),\nvec3(-0.667531,0.326090,0.),\nvec3(-0.098422,-0.295755,0.),\nvec3(-0.885922,0.215369,0.),\nvec3(0.566637,0.605213,0.),\nvec3(0.039766,-0.396100,0.),\nvec3(0.751946,0.453352,0.),\nvec3(0.078707,-0.715323,0.),\nvec3(-0.075838,-0.529344,0.),\nvec3(0.724479,-0.580798,0.),\nvec3(0.222999,-0.215125,0.),\nvec3(-0.467574,-0.405438,0.),\nvec3(-0.248268,-0.814753,0.),\nvec3(0.354411,-0.887570,0.),\nvec3(0.175817,0.382366,0.),\nvec3(0.487472,-0.063082,0.),\nvec3(-0.084078,0.898312,0.),\nvec3(0.488876,-0.783441,0.),\nvec3(0.470016,0.217933,0.),\nvec3(-0.696890,-0.549791,0.),\nvec3(-0.149693,0.605762,0.),\nvec3(0.034211,0.979980,0.),\nvec3(0.503098,-0.308878,0.),\nvec3(-0.016205,-0.872921,0.),\nvec3(0.385784,-0.393902,0.),\nvec3(-0.146886,-0.859249,0.),\nvec3(0.643361,0.164098,0.),\nvec3(0.634388,-0.049471,0.),\nvec3(-0.688894,0.007843,0.),\nvec3(0.464034,-0.188818,0.),\nvec3(-0.440840,0.137486,0.),\nvec3(0.364483,0.511704,0.),\nvec3(0.034028,0.325968,0.),\nvec3(0.099094,-0.308023,0.),\nvec3(0.693960,-0.366253,0.),\nvec3(0.678884,-0.204688,0.),\nvec3(0.001801,0.780328,0.),\nvec3(0.145177,-0.898984,0.),\nvec3(0.062655,-0.611866,0.),\nvec3(0.315226,-0.604297,0.),\nvec3(-0.780145,0.486251,0.),\nvec3(-0.371868,0.882138,0.),\nvec3(0.200476,0.494430,0.),\nvec3(-0.494552,-0.711051,0.),\nvec3(0.612476,0.705252,0.),\nvec3(-0.578845,-0.768792,0.),\nvec3(-0.772454,-0.090976,0.),\nvec3(0.504440,0.372295,0.),\nvec3(0.155736,0.065157,0.),\nvec3(0.391522,0.849605,0.),\nvec3(-0.620106,-0.328104,0.),\nvec3(0.789239,-0.419965,0.),\nvec3(-0.545396,0.538133,0.),\nvec3(-0.178564,-0.596057,0.)\n);\n\n\n\n\n\nfloat computeShadowWithPCSS(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff,int searchTapCount,int pcfTapCount,vec3[64] poissonSamplers)\n{\nif (depthMetric>1.0 || depthMetric<0.0) {\nreturn 1.0;\n}\nvec3 clipSpace=vPositionFromLight.xyz/vPositionFromLight.w;\nvec3 uvDepth=vec3(0.5*clipSpace.xyz+vec3(0.5));\nfloat blockerDepth=0.0;\nfloat sumBlockerDepth=0.0;\nfloat numBlocker=0.0;\nfor (int i=0; i<searchTapCount; i ++) {\nblockerDepth=texture(depthSampler,uvDepth.xy+(lightSizeUV*shadowMapSizeInverse*PoissonSamplers32[i].xy)).r;\nif (blockerDepth<depthMetric) {\nsumBlockerDepth+=blockerDepth;\nnumBlocker++;\n}\n}\nif (numBlocker<1.0) {\nreturn 1.0;\n}\nfloat avgBlockerDepth=sumBlockerDepth/numBlocker;\n\nfloat AAOffset=shadowMapSizeInverse*10.;\n\n\nfloat penumbraRatio=((depthMetric-avgBlockerDepth)+AAOffset);\nfloat filterRadius=penumbraRatio*lightSizeUV*shadowMapSizeInverse;\nfloat random=getRand(vPositionFromLight.xy);\nfloat rotationAngle=random*3.1415926;\nvec2 rotationVector=vec2(cos(rotationAngle),sin(rotationAngle));\nfloat shadow=0.;\nfor (int i=0; i<pcfTapCount; i++) {\nvec3 offset=poissonSamplers[i];\n\noffset=vec3(offset.x*rotationVector.x-offset.y*rotationVector.y,offset.y*rotationVector.x+offset.x*rotationVector.y,0.);\nshadow+=texture2D(shadowSampler,uvDepth+offset*filterRadius);\n}\nshadow/=float(pcfTapCount);\n\nshadow=mix(shadow,1.,depthMetric-avgBlockerDepth);\n\nshadow=mix(darkness,1.,shadow);\n\nreturn computeFallOff(shadow,clipSpace.xy,frustumEdgeFalloff);\n}\nfloat computeShadowWithPCSS16(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,16,PoissonSamplers32);\n}\nfloat computeShadowWithPCSS32(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,16,32,PoissonSamplers32);\n}\nfloat computeShadowWithPCSS64(vec4 vPositionFromLight,float depthMetric,sampler2D depthSampler,sampler2DShadow shadowSampler,float shadowMapSizeInverse,float lightSizeUV,float darkness,float frustumEdgeFalloff)\n{\nreturn computeShadowWithPCSS(vPositionFromLight,depthMetric,depthSampler,shadowSampler,shadowMapSizeInverse,lightSizeUV,darkness,frustumEdgeFalloff,32,64,PoissonSamplers64);\n}\n#endif\n#endif\n",fresnelFunction:"#ifdef FRESNEL\nfloat computeFresnelTerm(vec3 viewDirection,vec3 worldNormal,float bias,float power)\n{\nfloat fresnelTerm=pow(bias+abs(dot(viewDirection,worldNormal)),power);\nreturn clamp(fresnelTerm,0.,1.);\n}\n#endif",reflectionFunction:"#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\nvec3 parallaxCorrectNormal( vec3 vertexPos,vec3 origVec,vec3 cubeSize,vec3 cubePos ) {\n\nvec3 invOrigVec=vec3(1.0,1.0,1.0)/origVec;\nvec3 halfSize=cubeSize*0.5;\nvec3 intersecAtMaxPlane=(cubePos+halfSize-vertexPos)*invOrigVec;\nvec3 intersecAtMinPlane=(cubePos-halfSize-vertexPos)*invOrigVec;\n\nvec3 largestIntersec=max(intersecAtMaxPlane,intersecAtMinPlane);\n\nfloat distance=min(min(largestIntersec.x,largestIntersec.y),largestIntersec.z);\n\nvec3 intersectPositionWS=vertexPos+origVec*distance;\n\nreturn intersectPositionWS-cubePos;\n}\n#endif\nvec3 computeReflectionCoords(vec4 worldPos,vec3 worldNormal)\n{\n#if defined(REFLECTIONMAP_EQUIRECTANGULAR_FIXED) || defined(REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED)\nvec3 direction=normalize(vDirectionW);\nfloat lon=atan(direction.z,direction.x);\nfloat lat=acos(direction.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y; \n#ifdef REFLECTIONMAP_MIRROREDEQUIRECTANGULAR_FIXED\nreturn vec3(1.0-s,t,0);\n#else\nreturn vec3(s,t,0);\n#endif\n#endif\n#ifdef REFLECTIONMAP_EQUIRECTANGULAR\nvec3 cameraToVertex=normalize(worldPos.xyz-vEyePosition.xyz);\nvec3 r=normalize(reflect(cameraToVertex,worldNormal));\nfloat lon=atan(r.z,r.x);\nfloat lat=acos(r.y);\nvec2 sphereCoords=vec2(lon,lat)*RECIPROCAL_PI2*2.0;\nfloat s=sphereCoords.x*0.5+0.5;\nfloat t=sphereCoords.y; \nreturn vec3(s,t,0);\n#endif\n#ifdef REFLECTIONMAP_SPHERICAL\nvec3 viewDir=normalize(vec3(view*worldPos));\nvec3 viewNormal=normalize(vec3(view*vec4(worldNormal,0.0)));\nvec3 r=reflect(viewDir,viewNormal);\nr.z=r.z-1.0;\nfloat m=2.0*length(r);\nreturn vec3(r.x/m+0.5,1.0-r.y/m-0.5,0);\n#endif\n#ifdef REFLECTIONMAP_PLANAR\nvec3 viewDir=worldPos.xyz-vEyePosition.xyz;\nvec3 coords=normalize(reflect(viewDir,worldNormal));\nreturn vec3(reflectionMatrix*vec4(coords,1));\n#endif\n#ifdef REFLECTIONMAP_CUBIC\nvec3 viewDir=normalize(worldPos.xyz-vEyePosition.xyz);\n\nvec3 coords=reflect(viewDir,worldNormal);\n#ifdef USE_LOCAL_REFLECTIONMAP_CUBIC\ncoords=parallaxCorrectNormal(worldPos.xyz,coords,vReflectionSize,vReflectionPosition);\n#endif\ncoords=vec3(reflectionMatrix*vec4(coords,0));\n#ifdef INVERTCUBICMAP\ncoords.y*=-1.0;\n#endif\nreturn coords;\n#endif\n#ifdef REFLECTIONMAP_PROJECTION\nreturn vec3(reflectionMatrix*(view*worldPos));\n#endif\n#ifdef REFLECTIONMAP_SKYBOX\nreturn vPositionUVW;\n#endif\n#ifdef REFLECTIONMAP_EXPLICIT\nreturn vec3(0,0,0);\n#endif\n}",imageProcessingDeclaration:"#ifdef EXPOSURE\nuniform float exposureLinear;\n#endif\n#ifdef CONTRAST\nuniform float contrast;\n#endif\n#ifdef VIGNETTE\nuniform vec2 vInverseScreenSize;\nuniform vec4 vignetteSettings1;\nuniform vec4 vignetteSettings2;\n#endif\n#ifdef COLORCURVES\nuniform vec4 vCameraColorCurveNegative;\nuniform vec4 vCameraColorCurveNeutral;\nuniform vec4 vCameraColorCurvePositive;\n#endif\n#ifdef COLORGRADING\n#ifdef COLORGRADING3D\nuniform highp sampler3D txColorTransform;\n#else\nuniform sampler2D txColorTransform;\n#endif\nuniform vec4 colorTransformSettings;\n#endif",imageProcessingFunctions:"#if defined(COLORGRADING) && !defined(COLORGRADING3D)\n\nvec3 sampleTexture3D(sampler2D colorTransform,vec3 color,vec2 sampler3dSetting)\n{\nfloat sliceSize=2.0*sampler3dSetting.x; \n#ifdef SAMPLER3DGREENDEPTH\nfloat sliceContinuous=(color.g-sampler3dSetting.x)*sampler3dSetting.y;\n#else\nfloat sliceContinuous=(color.b-sampler3dSetting.x)*sampler3dSetting.y;\n#endif\nfloat sliceInteger=floor(sliceContinuous);\n\n\nfloat sliceFraction=sliceContinuous-sliceInteger;\n#ifdef SAMPLER3DGREENDEPTH\nvec2 sliceUV=color.rb;\n#else\nvec2 sliceUV=color.rg;\n#endif\nsliceUV.x*=sliceSize;\nsliceUV.x+=sliceInteger*sliceSize;\nsliceUV=clamp(sliceUV,0.,1.);\nvec4 slice0Color=texture2D(colorTransform,sliceUV);\nsliceUV.x+=sliceSize;\nsliceUV=clamp(sliceUV,0.,1.);\nvec4 slice1Color=texture2D(colorTransform,sliceUV);\nvec3 result=mix(slice0Color.rgb,slice1Color.rgb,sliceFraction);\n#ifdef SAMPLER3DBGRMAP\ncolor.rgb=result.rgb;\n#else\ncolor.rgb=result.bgr;\n#endif\nreturn color;\n}\n#endif\n#ifdef TONEMAPPING_ACES\n\n\n\n\n\nconst mat3 ACESInputMat=mat3(\nvec3(0.59719,0.07600,0.02840),\nvec3(0.35458,0.90834,0.13383),\nvec3(0.04823,0.01566,0.83777)\n);\n\nconst mat3 ACESOutputMat=mat3(\nvec3( 1.60475,-0.10208,-0.00327),\nvec3(-0.53108,1.10813,-0.07276),\nvec3(-0.07367,-0.00605,1.07602)\n);\nvec3 RRTAndODTFit(vec3 v)\n{\nvec3 a=v*(v+0.0245786)-0.000090537;\nvec3 b=v*(0.983729*v+0.4329510)+0.238081;\nreturn a/b;\n}\nvec3 ACESFitted(vec3 color)\n{\ncolor=ACESInputMat*color;\n\ncolor=RRTAndODTFit(color);\ncolor=ACESOutputMat*color;\n\ncolor=clamp(color,0.0,1.0);\nreturn color;\n}\n#endif\nvec4 applyImageProcessing(vec4 result) {\n#ifdef EXPOSURE\nresult.rgb*=exposureLinear;\n#endif\n#ifdef VIGNETTE\n\nvec2 viewportXY=gl_FragCoord.xy*vInverseScreenSize;\nviewportXY=viewportXY*2.0-1.0;\nvec3 vignetteXY1=vec3(viewportXY*vignetteSettings1.xy+vignetteSettings1.zw,1.0);\nfloat vignetteTerm=dot(vignetteXY1,vignetteXY1);\nfloat vignette=pow(vignetteTerm,vignetteSettings2.w);\n\nvec3 vignetteColor=vignetteSettings2.rgb;\n#ifdef VIGNETTEBLENDMODEMULTIPLY\nvec3 vignetteColorMultiplier=mix(vignetteColor,vec3(1,1,1),vignette);\nresult.rgb*=vignetteColorMultiplier;\n#endif\n#ifdef VIGNETTEBLENDMODEOPAQUE\nresult.rgb=mix(vignetteColor,result.rgb,vignette);\n#endif\n#endif\n#ifdef TONEMAPPING\n#ifdef TONEMAPPING_ACES\nresult.rgb=ACESFitted(result.rgb);\n#else\nconst float tonemappingCalibration=1.590579;\nresult.rgb=1.0-exp2(-tonemappingCalibration*result.rgb);\n#endif\n#endif\n\nresult.rgb=toGammaSpace(result.rgb);\nresult.rgb=clamp(result.rgb,0.0,1.0);\n#ifdef CONTRAST\n\nvec3 resultHighContrast=applyEaseInOut(result.rgb);\nif (contrast<1.0) {\n\nresult.rgb=mix(vec3(0.5,0.5,0.5),result.rgb,contrast);\n} else {\n\nresult.rgb=mix(result.rgb,resultHighContrast,contrast-1.0);\n}\n#endif\n\n#ifdef COLORGRADING\nvec3 colorTransformInput=result.rgb*colorTransformSettings.xxx+colorTransformSettings.yyy;\n#ifdef COLORGRADING3D\nvec3 colorTransformOutput=texture(txColorTransform,colorTransformInput).rgb;\n#else\nvec3 colorTransformOutput=sampleTexture3D(txColorTransform,colorTransformInput,colorTransformSettings.yz).rgb;\n#endif\nresult.rgb=mix(result.rgb,colorTransformOutput,colorTransformSettings.www);\n#endif\n#ifdef COLORCURVES\n\nfloat luma=getLuminance(result.rgb);\nvec2 curveMix=clamp(vec2(luma*3.0-1.5,luma*-3.0+1.5),vec2(0.0),vec2(1.0));\nvec4 colorCurve=vCameraColorCurveNeutral+curveMix.x*vCameraColorCurvePositive-curveMix.y*vCameraColorCurveNegative;\nresult.rgb*=colorCurve.rgb;\nresult.rgb=mix(vec3(luma),result.rgb,colorCurve.a);\n#endif\nreturn result;\n}",bumpFragmentFunctions:"#ifdef BUMP\n#if BUMPDIRECTUV == 1\n#define vBumpUV vMainUV1\n#elif BUMPDIRECTUV == 2\n#define vBumpUV vMainUV2\n#else\nvarying vec2 vBumpUV;\n#endif\nuniform sampler2D bumpSampler;\n#if defined(TANGENT) && defined(NORMAL) \nvarying mat3 vTBN;\n#endif\n#ifdef OBJECTSPACE_NORMALMAP\nuniform mat4 normalMatrix;\n#endif\n\nmat3 cotangent_frame(vec3 normal,vec3 p,vec2 uv)\n{\n\nuv=gl_FrontFacing ? uv : -uv;\n\nvec3 dp1=dFdx(p);\nvec3 dp2=dFdy(p);\nvec2 duv1=dFdx(uv);\nvec2 duv2=dFdy(uv);\n\nvec3 dp2perp=cross(dp2,normal);\nvec3 dp1perp=cross(normal,dp1);\nvec3 tangent=dp2perp*duv1.x+dp1perp*duv2.x;\nvec3 bitangent=dp2perp*duv1.y+dp1perp*duv2.y;\n\ntangent*=vTangentSpaceParams.x;\nbitangent*=vTangentSpaceParams.y;\n\nfloat invmax=inversesqrt(max(dot(tangent,tangent),dot(bitangent,bitangent)));\nreturn mat3(tangent*invmax,bitangent*invmax,normal);\n}\nvec3 perturbNormal(mat3 cotangentFrame,vec2 uv)\n{\nvec3 map=texture2D(bumpSampler,uv).xyz;\nmap=map*2.0-1.0;\n#ifdef NORMALXYSCALE\nmap=normalize(map*vec3(vBumpInfos.y,vBumpInfos.y,1.0));\n#endif\nreturn normalize(cotangentFrame*map);\n}\n#ifdef PARALLAX\nconst float minSamples=4.;\nconst float maxSamples=15.;\nconst int iMaxSamples=15;\n\nvec2 parallaxOcclusion(vec3 vViewDirCoT,vec3 vNormalCoT,vec2 texCoord,float parallaxScale) {\nfloat parallaxLimit=length(vViewDirCoT.xy)/vViewDirCoT.z;\nparallaxLimit*=parallaxScale;\nvec2 vOffsetDir=normalize(vViewDirCoT.xy);\nvec2 vMaxOffset=vOffsetDir*parallaxLimit;\nfloat numSamples=maxSamples+(dot(vViewDirCoT,vNormalCoT)*(minSamples-maxSamples));\nfloat stepSize=1.0/numSamples;\n\nfloat currRayHeight=1.0;\nvec2 vCurrOffset=vec2(0,0);\nvec2 vLastOffset=vec2(0,0);\nfloat lastSampledHeight=1.0;\nfloat currSampledHeight=1.0;\nfor (int i=0; i<iMaxSamples; i++)\n{\ncurrSampledHeight=texture2D(bumpSampler,vBumpUV+vCurrOffset).w;\n\nif (currSampledHeight>currRayHeight)\n{\nfloat delta1=currSampledHeight-currRayHeight;\nfloat delta2=(currRayHeight+stepSize)-lastSampledHeight;\nfloat ratio=delta1/(delta1+delta2);\nvCurrOffset=(ratio)* vLastOffset+(1.0-ratio)*vCurrOffset;\n\nbreak;\n}\nelse\n{\ncurrRayHeight-=stepSize;\nvLastOffset=vCurrOffset;\nvCurrOffset+=stepSize*vMaxOffset;\nlastSampledHeight=currSampledHeight;\n}\n}\nreturn vCurrOffset;\n}\nvec2 parallaxOffset(vec3 viewDir,float heightScale)\n{\n\nfloat height=texture2D(bumpSampler,vBumpUV).w;\nvec2 texCoordOffset=heightScale*viewDir.xy*height;\nreturn -texCoordOffset;\n}\n#endif\n#endif",clipPlaneFragmentDeclaration:"#ifdef CLIPPLANE\nvarying float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nvarying float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nvarying float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nvarying float fClipDistance4;\n#endif",fogFragmentDeclaration:"#ifdef FOG\n#define FOGMODE_NONE 0.\n#define FOGMODE_EXP 1.\n#define FOGMODE_EXP2 2.\n#define FOGMODE_LINEAR 3.\n#define E 2.71828\nuniform vec4 vFogInfos;\nuniform vec3 vFogColor;\nvarying vec3 vFogDistance;\nfloat CalcFogFactor()\n{\nfloat fogCoeff=1.0;\nfloat fogStart=vFogInfos.y;\nfloat fogEnd=vFogInfos.z;\nfloat fogDensity=vFogInfos.w;\nfloat fogDistance=length(vFogDistance);\nif (FOGMODE_LINEAR == vFogInfos.x)\n{\nfogCoeff=(fogEnd-fogDistance)/(fogEnd-fogStart);\n}\nelse if (FOGMODE_EXP == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDensity);\n}\nelse if (FOGMODE_EXP2 == vFogInfos.x)\n{\nfogCoeff=1.0/pow(E,fogDistance*fogDistance*fogDensity*fogDensity);\n}\nreturn clamp(fogCoeff,0.0,1.0);\n}\n#endif",clipPlaneFragment:"#ifdef CLIPPLANE\nif (fClipDistance>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE2\nif (fClipDistance2>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE3\nif (fClipDistance3>0.0)\n{\ndiscard;\n}\n#endif\n#ifdef CLIPPLANE4\nif (fClipDistance4>0.0)\n{\ndiscard;\n}\n#endif",bumpFragment:"vec2 uvOffset=vec2(0.0,0.0);\n#if defined(BUMP) || defined(PARALLAX)\n#ifdef NORMALXYSCALE\nfloat normalScale=1.0;\n#else \nfloat normalScale=vBumpInfos.y;\n#endif\n#if defined(TANGENT) && defined(NORMAL)\nmat3 TBN=vTBN;\n#else\nmat3 TBN=cotangent_frame(normalW*normalScale,vPositionW,vBumpUV);\n#endif\n#endif\n#ifdef PARALLAX\nmat3 invTBN=transposeMat3(TBN);\n#ifdef PARALLAXOCCLUSION\nuvOffset=parallaxOcclusion(invTBN*-viewDirectionW,invTBN*normalW,vBumpUV,vBumpInfos.z);\n#else\nuvOffset=parallaxOffset(invTBN*viewDirectionW,vBumpInfos.z);\n#endif\n#endif\n#ifdef BUMP\n#ifdef OBJECTSPACE_NORMALMAP\nnormalW=normalize(texture2D(bumpSampler,vBumpUV).xyz*2.0-1.0);\nnormalW=normalize(mat3(normalMatrix)*normalW); \n#else\nnormalW=perturbNormal(TBN,vBumpUV+uvOffset);\n#endif\n#endif",lightFragment:"#ifdef LIGHT{X}\n#if defined(SHADOWONLY) || (defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X}) && defined(LIGHTMAPNOSPECULAR{X}))\n\n#else\n#ifdef PBR\n#ifdef SPOTLIGHT{X}\nspotInfo=computeSpotLightingInfo(light{X}.vLightData);\n#ifdef LIGHT_FALLOFF_GLTF{X}\nspotInfo.attenuation=computeDistanceLightFalloff_GLTF(spotInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\nspotInfo.attenuation*=computeDirectionalLightFalloff_GLTF(light{X}.vLightDirection.xyz,spotInfo.directionToLightCenterW,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\nspotInfo.attenuation=computeDistanceLightFalloff_Physical(spotInfo.lightDistanceSquared);\nspotInfo.attenuation*=computeDirectionalLightFalloff_Physical(light{X}.vLightDirection.xyz,spotInfo.directionToLightCenterW,light{X}.vLightDirection.w);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\nspotInfo.attenuation=computeDistanceLightFalloff_Standard(spotInfo.lightOffset,light{X}.vLightFalloff.x);\nspotInfo.attenuation*=computeDirectionalLightFalloff_Standard(light{X}.vLightDirection.xyz,spotInfo.directionToLightCenterW,light{X}.vLightDirection.w,light{X}.vLightData.w);\n#else\nspotInfo.attenuation=computeDistanceLightFalloff(spotInfo.lightOffset,spotInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\nspotInfo.attenuation*=computeDirectionalLightFalloff(light{X}.vLightDirection.xyz,spotInfo.directionToLightCenterW,light{X}.vLightDirection.w,light{X}.vLightData.w,light{X}.vLightFalloff.z,light{X}.vLightFalloff.w);\n#endif\ninfo=computeSpotLighting(spotInfo,viewDirectionW,normalW,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#elif defined(POINTLIGHT{X})\npointInfo=computePointLightingInfo(light{X}.vLightData);\n#ifdef LIGHT_FALLOFF_GLTF{X}\npointInfo.attenuation=computeDistanceLightFalloff_GLTF(pointInfo.lightDistanceSquared,light{X}.vLightFalloff.y);\n#elif defined(LIGHT_FALLOFF_PHYSICAL{X})\npointInfo.attenuation=computeDistanceLightFalloff_Physical(pointInfo.lightDistanceSquared);\n#elif defined(LIGHT_FALLOFF_STANDARD{X})\npointInfo.attenuation=computeDistanceLightFalloff_Standard(pointInfo.lightOffset,light{X}.vLightFalloff.x);\n#else\npointInfo.attenuation=computeDistanceLightFalloff(pointInfo.lightOffset,pointInfo.lightDistanceSquared,light{X}.vLightFalloff.x,light{X}.vLightFalloff.y);\n#endif\ninfo=computePointLighting(pointInfo,viewDirectionW,normalW,light{X}.vLightDiffuse.rgb,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#elif defined(DIRLIGHT{X})\ninfo=computeDirectionalLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,roughness,NdotV,specularEnvironmentR0,specularEnvironmentR90,geometricRoughnessFactor,NdotL);\n#endif\n#else\n#ifdef SPOTLIGHT{X}\ninfo=computeSpotLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDirection,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\n#elif defined(HEMILIGHT{X})\ninfo=computeHemisphericLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightGround,glossiness);\n#elif defined(POINTLIGHT{X}) || defined(DIRLIGHT{X})\ninfo=computeLighting(viewDirectionW,normalW,light{X}.vLightData,light{X}.vLightDiffuse.rgb,light{X}.vLightSpecular,light{X}.vLightDiffuse.a,glossiness);\n#endif\n#endif\n#ifdef PROJECTEDLIGHTTEXTURE{X}\ninfo.diffuse*=computeProjectionTextureDiffuseLighting(projectionLightSampler{X},textureProjectionMatrix{X});\n#endif\n#endif\n#ifdef SHADOW{X}\n#ifdef SHADOWCLOSEESM{X}\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithCloseESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithCloseESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWESM{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithESMCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.depthValues);\n#else\nshadow=computeShadowWithESM(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.z,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPOISSON{X})\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowWithPoissonSamplingCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadowWithPoissonSampling(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCF{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCF1(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCF3(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCF5(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.yz,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#elif defined(SHADOWPCSS{X})\n#if defined(SHADOWLOWQUALITY{X})\nshadow=computeShadowWithPCSS16(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#elif defined(SHADOWMEDIUMQUALITY{X})\nshadow=computeShadowWithPCSS32(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#else\nshadow=computeShadowWithPCSS64(vPositionFromLight{X},vDepthMetric{X},depthSampler{X},shadowSampler{X},light{X}.shadowsInfo.y,light{X}.shadowsInfo.z,light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#else\n#if defined(SHADOWCUBE{X})\nshadow=computeShadowCube(light{X}.vLightData.xyz,shadowSampler{X},light{X}.shadowsInfo.x,light{X}.depthValues);\n#else\nshadow=computeShadow(vPositionFromLight{X},vDepthMetric{X},shadowSampler{X},light{X}.shadowsInfo.x,light{X}.shadowsInfo.w);\n#endif\n#endif\n#ifdef SHADOWONLY\n#ifndef SHADOWINUSE\n#define SHADOWINUSE\n#endif\nglobalShadow+=shadow;\nshadowLightCount+=1.0;\n#endif\n#else\nshadow=1.;\n#endif\n#ifndef SHADOWONLY\n#ifdef CUSTOMUSERLIGHTING\ndiffuseBase+=computeCustomDiffuseLighting(info,diffuseBase,shadow);\n#ifdef SPECULARTERM\nspecularBase+=computeCustomSpecularLighting(info,specularBase,shadow);\n#endif\n#elif defined(LIGHTMAP) && defined(LIGHTMAPEXCLUDED{X})\ndiffuseBase+=lightmapColor*shadow;\n#ifdef SPECULARTERM\n#ifndef LIGHTMAPNOSPECULAR{X}\nspecularBase+=info.specular*shadow*lightmapColor;\n#endif\n#endif\n#else\ndiffuseBase+=info.diffuse*shadow;\n#ifdef SPECULARTERM\nspecularBase+=info.specular*shadow;\n#endif\n#endif\n#endif\n#endif",logDepthFragment:"#ifdef LOGARITHMICDEPTH\ngl_FragDepthEXT=log2(vFragmentDepth)*logarithmicDepthConstant*0.5;\n#endif",fogFragment:"#ifdef FOG\nfloat fog=CalcFogFactor();\ncolor.rgb=fog*color.rgb+(1.0-fog)*vFogColor;\n#endif",pbrVertexDeclaration:"uniform mat4 view;\nuniform mat4 viewProjection;\n#ifdef ALBEDO\nuniform mat4 albedoMatrix;\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform mat4 ambientMatrix;\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef OPACITY\nuniform mat4 opacityMatrix;\nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\nuniform mat4 emissiveMatrix;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\nuniform mat4 lightmapMatrix;\n#endif\n#ifdef REFLECTIVITY \nuniform vec3 vReflectivityInfos;\nuniform mat4 reflectivityMatrix;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform mat4 microSurfaceSamplerMatrix;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform mat4 bumpMatrix;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif\n\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n",pbrFragmentDeclaration:"uniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\n\nuniform vec4 vLightingIntensity;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\n\n#ifdef ALBEDO\nuniform vec2 vAlbedoInfos;\n#endif\n#ifdef AMBIENT\nuniform vec4 vAmbientInfos;\n#endif\n#ifdef BUMP\nuniform vec3 vBumpInfos;\nuniform vec2 vTangentSpaceParams;\n#endif\n#ifdef OPACITY \nuniform vec2 vOpacityInfos;\n#endif\n#ifdef EMISSIVE\nuniform vec2 vEmissiveInfos;\n#endif\n#ifdef LIGHTMAP\nuniform vec2 vLightmapInfos;\n#endif\n#ifdef REFLECTIVITY\nuniform vec3 vReflectivityInfos;\n#endif\n#ifdef MICROSURFACEMAP\nuniform vec2 vMicroSurfaceSamplerInfos;\n#endif\n\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif\n\n#ifdef REFRACTION\nuniform vec4 vRefractionInfos;\nuniform mat4 refractionMatrix;\nuniform vec3 vRefractionMicrosurfaceInfos;\n#endif\n\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#if defined(USE_LOCAL_REFLECTIONMAP_CUBIC) && defined(REFLECTIONMAP_CUBIC)\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \n#endif\n#endif",pbrUboDeclaration:"layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec2 vAlbedoInfos;\nuniform vec4 vAmbientInfos;\nuniform vec2 vOpacityInfos;\nuniform vec2 vEmissiveInfos;\nuniform vec2 vLightmapInfos;\nuniform vec3 vReflectivityInfos;\nuniform vec2 vMicroSurfaceSamplerInfos;\nuniform vec4 vRefractionInfos;\nuniform vec2 vReflectionInfos;\nuniform vec3 vReflectionPosition;\nuniform vec3 vReflectionSize; \nuniform vec3 vBumpInfos;\nuniform mat4 albedoMatrix;\nuniform mat4 ambientMatrix;\nuniform mat4 opacityMatrix;\nuniform mat4 emissiveMatrix;\nuniform mat4 lightmapMatrix;\nuniform mat4 reflectivityMatrix;\nuniform mat4 microSurfaceSamplerMatrix;\nuniform mat4 bumpMatrix;\nuniform vec2 vTangentSpaceParams;\nuniform mat4 refractionMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionColor;\nuniform vec4 vAlbedoColor;\nuniform vec4 vLightingIntensity;\nuniform vec3 vRefractionMicrosurfaceInfos;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform vec4 vReflectivityColor;\nuniform vec3 vEmissiveColor;\nuniform float pointSize;\n};\nuniform Scene {\nmat4 viewProjection;\nmat4 view;\n};",pbrFunctions:"\n#define RECIPROCAL_PI2 0.15915494\n#define FRESNEL_MAXIMUM_ON_ROUGH 0.25\n\nconst float kRougnhessToAlphaScale=0.1;\nconst float kRougnhessToAlphaOffset=0.29248125;\nfloat convertRoughnessToAverageSlope(float roughness)\n{\n\nconst float kMinimumVariance=0.0005;\nfloat alphaG=square(roughness)+kMinimumVariance;\nreturn alphaG;\n}\n\nfloat smithVisibilityG1_TrowbridgeReitzGGX(float dot,float alphaG)\n{\nfloat tanSquared=(1.0-dot*dot)/(dot*dot);\nreturn 2.0/(1.0+sqrt(1.0+alphaG*alphaG*tanSquared));\n}\nfloat smithVisibilityG_TrowbridgeReitzGGX_Walter(float NdotL,float NdotV,float alphaG)\n{\nreturn smithVisibilityG1_TrowbridgeReitzGGX(NdotL,alphaG)*smithVisibilityG1_TrowbridgeReitzGGX(NdotV,alphaG);\n}\n\n\nfloat normalDistributionFunction_TrowbridgeReitzGGX(float NdotH,float alphaG)\n{\n\n\n\nfloat a2=square(alphaG);\nfloat d=NdotH*NdotH*(a2-1.0)+1.0;\nreturn a2/(PI*d*d);\n}\nvec3 fresnelSchlickGGX(float VdotH,vec3 reflectance0,vec3 reflectance90)\n{\nreturn reflectance0+(reflectance90-reflectance0)*pow(clamp(1.0-VdotH,0.,1.),5.0);\n}\nvec3 fresnelSchlickEnvironmentGGX(float VdotN,vec3 reflectance0,vec3 reflectance90,float smoothness)\n{\n\nfloat weight=mix(FRESNEL_MAXIMUM_ON_ROUGH,1.0,smoothness);\nreturn reflectance0+weight*(reflectance90-reflectance0)*pow(clamp(1.0-VdotN,0.,1.),5.0);\n}\n\nvec3 computeSpecularTerm(float NdotH,float NdotL,float NdotV,float VdotH,float roughness,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor)\n{\nroughness=max(roughness,geometricRoughnessFactor);\nfloat alphaG=convertRoughnessToAverageSlope(roughness);\nfloat distribution=normalDistributionFunction_TrowbridgeReitzGGX(NdotH,alphaG);\nfloat visibility=smithVisibilityG_TrowbridgeReitzGGX_Walter(NdotL,NdotV,alphaG);\nvisibility/=(4.0*NdotL*NdotV); \nfloat specTerm=max(0.,visibility*distribution)*NdotL;\nvec3 fresnel=fresnelSchlickGGX(VdotH,reflectance0,reflectance90);\nreturn fresnel*specTerm;\n}\nfloat computeDiffuseTerm(float NdotL,float NdotV,float VdotH,float roughness)\n{\n\n\nfloat diffuseFresnelNV=pow(clamp(1.0-NdotL,0.000001,1.),5.0);\nfloat diffuseFresnelNL=pow(clamp(1.0-NdotV,0.000001,1.),5.0);\nfloat diffuseFresnel90=0.5+2.0*VdotH*VdotH*roughness;\nfloat fresnel =\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNL) *\n(1.0+(diffuseFresnel90-1.0)*diffuseFresnelNV);\nreturn fresnel*NdotL/PI;\n}\nfloat adjustRoughnessFromLightProperties(float roughness,float lightRadius,float lightDistance)\n{\n#if defined(USEPHYSICALLIGHTFALLOFF) || defined(USEGLTFLIGHTFALLOFF)\n\nfloat lightRoughness=lightRadius/lightDistance;\n\nfloat totalRoughness=clamp(lightRoughness+roughness,0.,1.);\nreturn totalRoughness;\n#else\nreturn roughness;\n#endif\n}\nfloat computeDefaultMicroSurface(float microSurface,vec3 reflectivityColor)\n{\nconst float kReflectivityNoAlphaWorkflow_SmoothnessMax=0.95;\nfloat reflectivityLuminance=getLuminance(reflectivityColor);\nfloat reflectivityLuma=sqrt(reflectivityLuminance);\nmicroSurface=reflectivityLuma*kReflectivityNoAlphaWorkflow_SmoothnessMax;\nreturn microSurface;\n}\n\n\nfloat fresnelGrazingReflectance(float reflectance0) {\nfloat reflectance90=clamp(reflectance0*25.0,0.0,1.0);\nreturn reflectance90;\n}\n\n\n#define UNPACK_LOD(x) (1.0-x)*255.0\nfloat getLodFromAlphaG(float cubeMapDimensionPixels,float alphaG,float NdotV) {\nfloat microsurfaceAverageSlope=alphaG;\n\n\n\n\n\n\nmicrosurfaceAverageSlope*=sqrt(abs(NdotV));\nfloat microsurfaceAverageSlopeTexels=microsurfaceAverageSlope*cubeMapDimensionPixels;\nfloat lod=log2(microsurfaceAverageSlopeTexels);\nreturn lod;\n}\nfloat environmentRadianceOcclusion(float ambientOcclusion,float NdotVUnclamped) {\n\n\nfloat temp=NdotVUnclamped+ambientOcclusion;\nreturn clamp(square(temp)-1.0+ambientOcclusion,0.0,1.0);\n}\nfloat environmentHorizonOcclusion(vec3 view,vec3 normal) {\n\nvec3 reflection=reflect(view,normal);\nfloat temp=clamp( 1.0+1.1*dot(reflection,normal),0.0,1.0);\nreturn square(temp);\n}",harmonicsFunctions:"#ifdef USESPHERICALFROMREFLECTIONMAP\nuniform vec3 vSphericalX;\nuniform vec3 vSphericalY;\nuniform vec3 vSphericalZ;\nuniform vec3 vSphericalXX_ZZ;\nuniform vec3 vSphericalYY_ZZ;\nuniform vec3 vSphericalZZ;\nuniform vec3 vSphericalXY;\nuniform vec3 vSphericalYZ;\nuniform vec3 vSphericalZX;\nvec3 quaternionVectorRotation_ScaledSqrtTwo(vec4 Q,vec3 V){\nvec3 T=cross(Q.xyz,V);\nT+=Q.www*V;\nreturn cross(Q.xyz,T)+V;\n}\nvec3 environmentIrradianceJones(vec3 normal)\n{\n\n\n\n\n\n\n\n\n\nfloat Nx=normal.x;\nfloat Ny=normal.y;\nfloat Nz=normal.z;\nvec3 C1=vSphericalZZ.rgb;\nvec3 Cx=vSphericalX.rgb;\nvec3 Cy=vSphericalY.rgb;\nvec3 Cz=vSphericalZ.rgb;\nvec3 Cxx_zz=vSphericalXX_ZZ.rgb;\nvec3 Cyy_zz=vSphericalYY_ZZ.rgb;\nvec3 Cxy=vSphericalXY.rgb;\nvec3 Cyz=vSphericalYZ.rgb;\nvec3 Czx=vSphericalZX.rgb;\nvec3 a1=Cyy_zz*Ny+Cy;\nvec3 a2=Cyz*Nz+a1;\nvec3 b1=Czx*Nz+Cx;\nvec3 b2=Cxy*Ny+b1;\nvec3 b3=Cxx_zz*Nx+b2;\nvec3 t1=Cz*Nz+C1;\nvec3 t2=a2*Ny+t1;\nvec3 t3=b3*Nx+t2;\nreturn t3;\n}\n#endif",pbrLightFunctions:"\nstruct lightingInfo\n{\nvec3 diffuse;\n#ifdef SPECULARTERM\nvec3 specular;\n#endif\n};\nstruct pointLightingInfo\n{\nvec3 lightOffset;\nfloat lightDistanceSquared;\nfloat attenuation;\n};\nstruct spotLightingInfo\n{\nvec3 lightOffset;\nfloat lightDistanceSquared;\nvec3 directionToLightCenterW;\nfloat attenuation;\n};\nfloat computeDistanceLightFalloff_Standard(vec3 lightOffset,float range)\n{\nreturn max(0.,1.0-length(lightOffset)/range);\n}\nfloat computeDistanceLightFalloff_Physical(float lightDistanceSquared)\n{\nreturn 1.0/((lightDistanceSquared+0.001));\n}\nfloat computeDistanceLightFalloff_GLTF(float lightDistanceSquared,float inverseSquaredRange)\n{\nconst float minDistanceSquared=0.01*0.01;\nfloat lightDistanceFalloff=1.0/(max(lightDistanceSquared,minDistanceSquared));\nfloat factor=lightDistanceSquared*inverseSquaredRange;\nfloat attenuation=clamp(1.0-factor*factor,0.,1.);\nattenuation*=attenuation;\n\nlightDistanceFalloff*=attenuation;\nreturn lightDistanceFalloff;\n}\nfloat computeDistanceLightFalloff(vec3 lightOffset,float lightDistanceSquared,float range,float inverseSquaredRange)\n{ \n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDistanceLightFalloff_Physical(lightDistanceSquared);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDistanceLightFalloff_GLTF(lightDistanceSquared,inverseSquaredRange);\n#else\nreturn computeDistanceLightFalloff_Standard(lightOffset,range);\n#endif\n}\nfloat computeDirectionalLightFalloff_Standard(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent)\n{\nfloat falloff=0.0;\nfloat cosAngle=max(0.000000000000001,dot(-lightDirection,directionToLightCenterW));\nif (cosAngle>=cosHalfAngle)\n{\nfalloff=max(0.,pow(cosAngle,exponent));\n}\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_Physical(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle)\n{\nconst float kMinusLog2ConeAngleIntensityRatio=6.64385618977; \n\n\n\n\n\nfloat concentrationKappa=kMinusLog2ConeAngleIntensityRatio/(1.0-cosHalfAngle);\n\n\nvec4 lightDirectionSpreadSG=vec4(-lightDirection*concentrationKappa,-concentrationKappa);\nfloat falloff=exp2(dot(vec4(directionToLightCenterW,1.0),lightDirectionSpreadSG));\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff_GLTF(vec3 lightDirection,vec3 directionToLightCenterW,float lightAngleScale,float lightAngleOffset)\n{\n\n\n\nfloat cd=dot(-lightDirection,directionToLightCenterW);\nfloat falloff=clamp(cd*lightAngleScale+lightAngleOffset,0.,1.);\n\nfalloff*=falloff;\nreturn falloff;\n}\nfloat computeDirectionalLightFalloff(vec3 lightDirection,vec3 directionToLightCenterW,float cosHalfAngle,float exponent,float lightAngleScale,float lightAngleOffset)\n{\n#ifdef USEPHYSICALLIGHTFALLOFF\nreturn computeDirectionalLightFalloff_Physical(lightDirection,directionToLightCenterW,cosHalfAngle);\n#elif defined(USEGLTFLIGHTFALLOFF)\nreturn computeDirectionalLightFalloff_GLTF(lightDirection,directionToLightCenterW,lightAngleScale,lightAngleOffset);\n#else\nreturn computeDirectionalLightFalloff_Standard(lightDirection,directionToLightCenterW,cosHalfAngle,exponent);\n#endif\n}\npointLightingInfo computePointLightingInfo(vec4 lightData) {\npointLightingInfo result;\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\nreturn result;\n}\nspotLightingInfo computeSpotLightingInfo(vec4 lightData) {\nspotLightingInfo result;\nresult.lightOffset=lightData.xyz-vPositionW;\nresult.directionToLightCenterW=normalize(result.lightOffset);\nresult.lightDistanceSquared=dot(result.lightOffset,result.lightOffset);\nreturn result;\n}\nlightingInfo computePointLighting(pointLightingInfo info,vec3 viewDirectionW,vec3 vNormal,vec3 diffuseColor,float lightRadius,float roughness,float NdotV,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,out float NdotL) {\nlightingInfo result;\nfloat lightDistance=sqrt(info.lightDistanceSquared);\nvec3 lightDirection=normalize(info.lightOffset);\n\nroughness=adjustRoughnessFromLightProperties(roughness,lightRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW+lightDirection);\nNdotL=clamp(dot(vNormal,lightDirection),0.00000000001,1.0);\nfloat VdotH=clamp(dot(viewDirectionW,H),0.0,1.0);\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor*info.attenuation;\n#ifdef SPECULARTERM\n\nfloat NdotH=clamp(dot(vNormal,H),0.000000000001,1.0);\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,reflectance0,reflectance90,geometricRoughnessFactor);\nresult.specular=specTerm*diffuseColor*info.attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeSpotLighting(spotLightingInfo info,vec3 viewDirectionW,vec3 vNormal,vec4 lightDirection,vec3 diffuseColor,float lightRadius,float roughness,float NdotV,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,out float NdotL) {\nlightingInfo result;\n\nfloat lightDistance=sqrt(info.lightDistanceSquared);\nroughness=adjustRoughnessFromLightProperties(roughness,lightRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW+info.directionToLightCenterW);\nNdotL=clamp(dot(vNormal,info.directionToLightCenterW),0.000000000001,1.0);\nfloat VdotH=clamp(dot(viewDirectionW,H),0.0,1.0);\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor*info.attenuation;\n#ifdef SPECULARTERM\n\nfloat NdotH=clamp(dot(vNormal,H),0.000000000001,1.0);\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,reflectance0,reflectance90,geometricRoughnessFactor);\nresult.specular=specTerm*diffuseColor*info.attenuation;\n#endif\nreturn result;\n}\nlightingInfo computeDirectionalLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,float lightRadius,float roughness,float NdotV,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,out float NdotL) {\nlightingInfo result;\nfloat lightDistance=length(-lightData.xyz);\nvec3 lightDirection=normalize(-lightData.xyz);\n\nroughness=adjustRoughnessFromLightProperties(roughness,lightRadius,lightDistance);\n\nvec3 H=normalize(viewDirectionW+lightDirection);\nNdotL=clamp(dot(vNormal,lightDirection),0.00000000001,1.0);\nfloat VdotH=clamp(dot(viewDirectionW,H),0.0,1.0);\nfloat diffuseTerm=computeDiffuseTerm(NdotL,NdotV,VdotH,roughness);\nresult.diffuse=diffuseTerm*diffuseColor;\n#ifdef SPECULARTERM\n\nfloat NdotH=clamp(dot(vNormal,H),0.000000000001,1.0);\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,reflectance0,reflectance90,geometricRoughnessFactor);\nresult.specular=specTerm*diffuseColor;\n#endif\nreturn result;\n}\nlightingInfo computeHemisphericLighting(vec3 viewDirectionW,vec3 vNormal,vec4 lightData,vec3 diffuseColor,vec3 specularColor,vec3 groundColor,float roughness,float NdotV,vec3 reflectance0,vec3 reflectance90,float geometricRoughnessFactor,out float NdotL) {\nlightingInfo result;\n\n\n\nNdotL=dot(vNormal,lightData.xyz)*0.5+0.5;\nresult.diffuse=mix(groundColor,diffuseColor,NdotL);\n#ifdef SPECULARTERM\n\nvec3 lightVectorW=normalize(lightData.xyz);\nvec3 H=normalize(viewDirectionW+lightVectorW);\nfloat NdotH=clamp(dot(vNormal,H),0.000000000001,1.0);\nNdotL=clamp(NdotL,0.000000000001,1.0);\nfloat VdotH=clamp(dot(viewDirectionW,H),0.0,1.0);\nvec3 specTerm=computeSpecularTerm(NdotH,NdotL,NdotV,VdotH,roughness,reflectance0,reflectance90,geometricRoughnessFactor);\nresult.specular=specTerm*diffuseColor;\n#endif\nreturn result;\n}\nvec3 computeProjectionTextureDiffuseLighting(sampler2D projectionLightSampler,mat4 textureProjectionMatrix){\nvec4 strq=textureProjectionMatrix*vec4(vPositionW,1.0);\nstrq/=strq.w;\nvec3 textureColor=texture2D(projectionLightSampler,strq.xy).rgb;\nreturn toLinearSpace(textureColor);\n}",clipPlaneVertexDeclaration2:"#ifdef CLIPPLANE\nuniform vec4 vClipPlane;\nout float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nuniform vec4 vClipPlane2;\nout float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nuniform vec4 vClipPlane3;\nout float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nuniform vec4 vClipPlane4;\nout float fClipDistance4;\n#endif",clipPlaneFragmentDeclaration2:"#ifdef CLIPPLANE\nin float fClipDistance;\n#endif\n#ifdef CLIPPLANE2\nin float fClipDistance2;\n#endif\n#ifdef CLIPPLANE3\nin float fClipDistance3;\n#endif\n#ifdef CLIPPLANE4\nin float fClipDistance4;\n#endif",mrtFragmentDeclaration:"#if __VERSION__>=200\nlayout(location=0) out vec4 glFragData[{X}];\n#endif\n",bones300Declaration:"#if NUM_BONE_INFLUENCERS>0\nuniform mat4 mBones[BonesPerMesh];\nin vec4 matricesIndices;\nin vec4 matricesWeights;\n#if NUM_BONE_INFLUENCERS>4\nin vec4 matricesIndicesExtra;\nin vec4 matricesWeightsExtra;\n#endif\n#endif",instances300Declaration:"#ifdef INSTANCES\nin vec4 world0;\nin vec4 world1;\nin vec4 world2;\nin vec4 world3;\n#else\nuniform mat4 world;\n#endif",kernelBlurFragment:"#ifdef DOF\nfactor=sampleCoC(sampleCoord{X}); \ncomputedWeight=KERNEL_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCoord{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCoord{X})*computedWeight;\n#endif",kernelBlurFragment2:"#ifdef DOF\nfactor=sampleCoC(sampleCenter+delta*KERNEL_DEP_OFFSET{X});\ncomputedWeight=KERNEL_DEP_WEIGHT{X}*factor;\nsumOfWeights+=computedWeight;\n#else\ncomputedWeight=KERNEL_DEP_WEIGHT{X};\n#endif\n#ifdef PACKEDFLOAT\nblend+=unpack(texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X}))*computedWeight;\n#else\nblend+=texture2D(textureSampler,sampleCenter+delta*KERNEL_DEP_OFFSET{X})*computedWeight;\n#endif",kernelBlurVaryingDeclaration:"varying vec2 sampleCoord{X};",kernelBlurVertex:"sampleCoord{X}=sampleCenter+delta*KERNEL_OFFSET{X};",backgroundVertexDeclaration:"uniform mat4 view;\nuniform mat4 viewProjection;\nuniform float shadowLevel;\n#ifdef DIFFUSE\nuniform mat4 diffuseMatrix;\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\n#endif\n#ifdef POINTSIZE\nuniform float pointSize;\n#endif",backgroundFragmentDeclaration:" uniform vec4 vPrimaryColor;\n#ifdef USEHIGHLIGHTANDSHADOWCOLORS\nuniform vec4 vPrimaryColorShadow;\n#endif\nuniform float shadowLevel;\nuniform float alpha;\n#ifdef DIFFUSE\nuniform vec2 vDiffuseInfos;\n#endif\n#ifdef REFLECTION\nuniform vec2 vReflectionInfos;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\n#endif\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n#if defined(REFLECTIONMAP_SPHERICAL) || defined(REFLECTIONMAP_PROJECTION) || defined(REFRACTION)\nuniform mat4 view;\n#endif",backgroundUboDeclaration:"layout(std140,column_major) uniform;\nuniform Material\n{\nuniform vec4 vPrimaryColor;\nuniform vec4 vPrimaryColorShadow;\nuniform vec2 vDiffuseInfos;\nuniform vec2 vReflectionInfos;\nuniform mat4 diffuseMatrix;\nuniform mat4 reflectionMatrix;\nuniform vec3 vReflectionMicrosurfaceInfos;\nuniform float fFovMultiplier;\nuniform float pointSize;\nuniform float shadowLevel;\nuniform float alpha;\n#if defined(REFLECTIONFRESNEL) || defined(OPACITYFRESNEL)\nuniform vec3 vBackgroundCenter;\n#endif\n#ifdef REFLECTIONFRESNEL\nuniform vec4 vReflectionControl;\n#endif\n};\nuniform Scene {\nmat4 viewProjection;\nmat4 view;\n};"};var tl="undefined"!=typeof global?global:"undefined"!=typeof window?window:this;return tl.BABYLON=$a,void 0!==m&&(tl.Earcut={earcut:m}),$a}));
  65852. /***/ }),
  65853. /***/ "./node_modules/ngx-device-detector/ngx-device-detector.umd.js":
  65854. /*!*********************************************************************!*\
  65855. !*** ./node_modules/ngx-device-detector/ngx-device-detector.umd.js ***!
  65856. \*********************************************************************/
  65857. /*! no static exports found */
  65858. /***/ (function(module, exports, __webpack_require__) {
  65859. (function (global, factory) {
  65860. true ? factory(exports, __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js"), __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js")) :
  65861. undefined;
  65862. }(this, (function (exports,core,common) { 'use strict';
  65863. /**
  65864. * @fileoverview added by tsickle
  65865. * @suppress {checkTypes} checked by tsc
  65866. */
  65867. /**
  65868. * Created by ahsanayaz on 08/11/2016.
  65869. */
  65870. var BROWSERS = {
  65871. CHROME: 'Chrome',
  65872. FIREFOX: 'Firefox',
  65873. SAFARI: 'Safari',
  65874. OPERA: 'Opera',
  65875. IE: 'IE',
  65876. MS_EDGE: 'MS-Edge',
  65877. FB_MESSANGER: 'FB-Messanger',
  65878. SAMSUNG: 'Samsung',
  65879. UCBROWSER: 'UC-Browser',
  65880. UNKNOWN: 'Unknown'
  65881. };
  65882. var DEVICES = {
  65883. ANDROID: 'Android',
  65884. I_PAD: 'iPad',
  65885. IPHONE: 'iPhone',
  65886. I_POD: 'iPod',
  65887. BLACKBERRY: 'Blackberry',
  65888. FIREFOX_OS: 'Firefox-OS',
  65889. CHROME_BOOK: 'Chrome-Book',
  65890. WINDOWS_PHONE: 'Windows-Phone',
  65891. PS4: 'PS4',
  65892. VITA: 'Vita',
  65893. CHROMECAST: 'Chromecast',
  65894. APPLE_TV: 'Apple-TV',
  65895. GOOGLE_TV: 'Google-TV',
  65896. UNKNOWN: 'Unknown'
  65897. };
  65898. var OS = {
  65899. WINDOWS: 'Windows',
  65900. MAC: 'Mac',
  65901. IOS: 'iOS',
  65902. ANDROID: 'Android',
  65903. LINUX: 'Linux',
  65904. UNIX: 'Unix',
  65905. FIREFOX_OS: 'Firefox-OS',
  65906. CHROME_OS: 'Chrome-OS',
  65907. WINDOWS_PHONE: 'Windows-Phone',
  65908. UNKNOWN: 'Unknown'
  65909. };
  65910. var OS_VERSIONS = {
  65911. WINDOWS_3_11: 'windows-3-11',
  65912. WINDOWS_95: 'windows-95',
  65913. WINDOWS_ME: 'windows-me',
  65914. WINDOWS_98: 'windows-98',
  65915. WINDOWS_CE: 'windows-ce',
  65916. WINDOWS_2000: 'windows-2000',
  65917. WINDOWS_XP: 'windows-xp',
  65918. WINDOWS_SERVER_2003: 'windows-server-2003',
  65919. WINDOWS_VISTA: 'windows-vista',
  65920. WINDOWS_7: 'windows-7',
  65921. WINDOWS_8_1: 'windows-8-1',
  65922. WINDOWS_8: 'windows-8',
  65923. WINDOWS_10: 'windows-10',
  65924. WINDOWS_PHONE_7_5: 'windows-phone-7-5',
  65925. WINDOWS_PHONE_8_1: 'windows-phone-8-1',
  65926. WINDOWS_PHONE_10: 'windows-phone-10',
  65927. WINDOWS_NT_4_0: 'windows-nt-4-0',
  65928. MACOSX_15: 'mac-os-x-15',
  65929. MACOSX_14: 'mac-os-x-14',
  65930. MACOSX_13: 'mac-os-x-13',
  65931. MACOSX_12: 'mac-os-x-12',
  65932. MACOSX_11: 'mac-os-x-11',
  65933. MACOSX_10: 'mac-os-x-10',
  65934. MACOSX_9: 'mac-os-x-9',
  65935. MACOSX_8: 'mac-os-x-8',
  65936. MACOSX_7: 'mac-os-x-7',
  65937. MACOSX_6: 'mac-os-x-6',
  65938. MACOSX_5: 'mac-os-x-5',
  65939. MACOSX_4: 'mac-os-x-4',
  65940. MACOSX_3: 'mac-os-x-3',
  65941. MACOSX_2: 'mac-os-x-2',
  65942. MACOSX: 'mac-os-x',
  65943. UNKNOWN: 'unknown'
  65944. };
  65945. var OS_RE = {
  65946. WINDOWS: { and: [{ or: [/\bWindows|(Win\d\d)\b/, /\bWin 9x\b/] }, { not: /\bWindows Phone\b/ }] },
  65947. MAC: { and: [/\bMac OS\b/, { not: { or: [/\biPhone\b/, /\bWindows Phone\b/] } }] },
  65948. IOS: { and: [{ or: [/\biPad\b/, /\biPhone\b/, /\biPod\b/] }, { not: /\bWindows Phone\b/ }] },
  65949. ANDROID: { and: [/\bAndroid\b/, { not: /\bWindows Phone\b/ }] },
  65950. LINUX: /\bLinux\b/,
  65951. UNIX: /\bUNIX\b/,
  65952. FIREFOX_OS: { and: [/\bFirefox\b/, /Mobile\b/] },
  65953. CHROME_OS: /\bCrOS\b/,
  65954. WINDOWS_PHONE: { or: [/\bIEMobile\b/, /\bWindows Phone\b/] },
  65955. PS4: /\bMozilla\/5.0 \(PlayStation 4\b/,
  65956. VITA: /\bMozilla\/5.0 \(Play(S|s)tation Vita\b/
  65957. };
  65958. var BROWSERS_RE = {
  65959. CHROME: { and: [{ or: [/\bChrome\b/, /\bCriOS\b/] }, { not: { or: [/\bOPR\b/, /\bEdg(e|A|iOS)\b/, /\bSamsungBrowser\b/, /\bUCBrowser\b/] } }] },
  65960. FIREFOX: { or: [/\bFirefox\b/, /\bFxiOS\b/] },
  65961. SAFARI: { and: [/^((?!CriOS).)*\Safari\b.*$/, { not: {
  65962. or: [/\bOPR\b/, /\bEdg(e|A|iOS)\b/, /\bWindows Phone\b/, /\bSamsungBrowser\b/, /\bUCBrowser\b/]
  65963. } }] },
  65964. OPERA: { or: [/Opera\b/, /\bOPR\b/] },
  65965. IE: { or: [/\bMSIE\b/, /\bTrident\b/, /^Mozilla\/5\.0 \(Windows NT 10\.0; Win64; x64\)$/] },
  65966. MS_EDGE: { or: [/\bEdg(e|A|iOS)\b/] },
  65967. PS4: /\bMozilla\/5.0 \(PlayStation 4\b/,
  65968. VITA: /\bMozilla\/5.0 \(Play(S|s)tation Vita\b/,
  65969. FB_MESSANGER: /\bFBAN\/MessengerForiOS\b/,
  65970. SAMSUNG: /\bSamsungBrowser\b/,
  65971. UCBROWSER: /\bUCBrowser\b/,
  65972. };
  65973. var DEVICES_RE = {
  65974. ANDROID: { and: [/\bAndroid\b/, { not: /Windows Phone/ }] },
  65975. I_PAD: /\biPad\b/,
  65976. IPHONE: { and: [/\biPhone\b/, { not: /Windows Phone/ }] },
  65977. I_POD: /\biPod\b/,
  65978. BLACKBERRY: /\bblackberry\b/,
  65979. FIREFOX_OS: { and: [/\bFirefox\b/, /\bMobile\b/] },
  65980. CHROME_BOOK: /\bCrOS\b/,
  65981. WINDOWS_PHONE: { or: [/\bIEMobile\b/, /\bWindows Phone\b/] },
  65982. PS4: /\bMozilla\/5.0 \(PlayStation 4\b/,
  65983. CHROMECAST: /\bCrKey\b/,
  65984. APPLE_TV: /^iTunes-AppleTV\/4.1$/,
  65985. GOOGLE_TV: /\bGoogleTV\b/,
  65986. VITA: /\bMozilla\/5.0 \(Play(S|s)tation Vita\b/
  65987. };
  65988. var OS_VERSIONS_RE = {
  65989. WINDOWS_3_11: /Win16/,
  65990. WINDOWS_95: /(Windows 95|Win95|Windows_95)/,
  65991. WINDOWS_ME: /(Win 9x 4.90|Windows ME)/,
  65992. WINDOWS_98: /(Windows 98|Win98)/,
  65993. WINDOWS_CE: /Windows CE/,
  65994. WINDOWS_2000: /(Windows NT 5.0|Windows 2000)/,
  65995. WINDOWS_XP: /(Windows NT 5.1|Windows XP)/,
  65996. WINDOWS_SERVER_2003: /Windows NT 5.2/,
  65997. WINDOWS_VISTA: /Windows NT 6.0/,
  65998. WINDOWS_7: /(Windows 7|Windows NT 6.1)/,
  65999. WINDOWS_8_1: /(Windows 8.1|Windows NT 6.3)/,
  66000. WINDOWS_8: /(Windows 8|Windows NT 6.2)/,
  66001. WINDOWS_10: /(Windows NT 10.0)/,
  66002. WINDOWS_PHONE_7_5: /(Windows Phone OS 7.5)/,
  66003. WINDOWS_PHONE_8_1: /(Windows Phone 8.1)/,
  66004. WINDOWS_PHONE_10: /(Windows Phone 10)/,
  66005. WINDOWS_NT_4_0: { and: [/(Windows NT 4.0|WinNT4.0|WinNT|Windows NT)/, { not: /Windows NT 10.0/ }] },
  66006. MACOSX: /(MAC OS X\s*[^ 0-9])/,
  66007. MACOSX_3: /(Darwin 10.3|Mac OS X 10.3)/,
  66008. MACOSX_4: /(Darwin 10.4|Mac OS X 10.4)/,
  66009. MACOSX_5: /(Mac OS X 10.5)/,
  66010. MACOSX_6: /(Mac OS X 10.6)/,
  66011. MACOSX_7: /(Mac OS X 10.7)/,
  66012. MACOSX_8: /(Mac OS X 10.8)/,
  66013. MACOSX_9: /(Mac OS X 10.9)/,
  66014. MACOSX_10: /(Mac OS X 10.10)/,
  66015. MACOSX_11: /(Mac OS X 10.11)/,
  66016. MACOSX_12: /(Mac OS X 10.12)/,
  66017. MACOSX_13: /(Mac OS X 10.13)/,
  66018. MACOSX_14: /(Mac OS X 10.14)/,
  66019. MACOSX_15: /(Mac OS X 10.15)/
  66020. };
  66021. var BROWSER_VERSIONS_RE_MAP = {
  66022. CHROME: [/\bChrome\/([\d\.]+)\b/, /\bCriOS\/([\d\.]+)\b/],
  66023. FIREFOX: /\bFirefox\/([\d\.]+)\b/,
  66024. SAFARI: /\bVersion\/([\d\.]+)\b/,
  66025. OPERA: [/\bVersion\/([\d\.]+)\b/, /\bOPR\/([\d\.]+)\b/],
  66026. IE: [/\bMSIE ([\d\.]+\w?)\b/, /\brv:([\d\.]+\w?)\b/],
  66027. MS_EDGE: /\bEdg(?:e|A|iOS)\/([\d\.]+)\b/,
  66028. SAMSUNG: /\bSamsungBrowser\/([\d\.]+)\b/,
  66029. UCBROWSER: /\bUCBrowser\/([\d\.]+)\b/,
  66030. };
  66031. var BROWSER_VERSIONS_RE = Object.keys(BROWSER_VERSIONS_RE_MAP).reduce(function (obj, key) {
  66032. obj[BROWSERS[key]] = BROWSER_VERSIONS_RE_MAP[key];
  66033. return obj;
  66034. }, {});
  66035. var Constants = Object.freeze({
  66036. BROWSERS: BROWSERS,
  66037. DEVICES: DEVICES,
  66038. OS: OS,
  66039. OS_VERSIONS: OS_VERSIONS,
  66040. OS_RE: OS_RE,
  66041. BROWSERS_RE: BROWSERS_RE,
  66042. DEVICES_RE: DEVICES_RE,
  66043. OS_VERSIONS_RE: OS_VERSIONS_RE,
  66044. BROWSER_VERSIONS_RE_MAP: BROWSER_VERSIONS_RE_MAP,
  66045. BROWSER_VERSIONS_RE: BROWSER_VERSIONS_RE
  66046. });
  66047. /**
  66048. * @fileoverview added by tsickle
  66049. * @suppress {checkTypes} checked by tsc
  66050. */
  66051. /**
  66052. * Created by ahsanayaz on 08/11/2016.
  66053. */
  66054. var ReTree = /** @class */ (function () {
  66055. function ReTree() {
  66056. }
  66057. /**
  66058. * @param {?} string
  66059. * @param {?} regex
  66060. * @return {?}
  66061. */
  66062. ReTree.prototype.test = /**
  66063. * @param {?} string
  66064. * @param {?} regex
  66065. * @return {?}
  66066. */
  66067. function (string, regex) {
  66068. var /** @type {?} */ self = this;
  66069. if (typeof regex === 'string') {
  66070. regex = new RegExp(regex);
  66071. }
  66072. if (regex instanceof RegExp) {
  66073. return regex.test(string);
  66074. }
  66075. else if (regex && Array.isArray(regex.and)) {
  66076. return regex.and.every(function (item) {
  66077. return self.test(string, item);
  66078. });
  66079. }
  66080. else if (regex && Array.isArray(regex.or)) {
  66081. return regex.or.some(function (item) {
  66082. return self.test(string, item);
  66083. });
  66084. }
  66085. else if (regex && regex.not) {
  66086. return !self.test(string, regex.not);
  66087. }
  66088. else {
  66089. return false;
  66090. }
  66091. };
  66092. /**
  66093. * @param {?} string
  66094. * @param {?} regex
  66095. * @return {?}
  66096. */
  66097. ReTree.prototype.exec = /**
  66098. * @param {?} string
  66099. * @param {?} regex
  66100. * @return {?}
  66101. */
  66102. function (string, regex) {
  66103. var /** @type {?} */ self = this;
  66104. if (typeof regex === 'string') {
  66105. regex = new RegExp(regex);
  66106. }
  66107. if (regex instanceof RegExp) {
  66108. return regex.exec(string);
  66109. }
  66110. else if (regex && Array.isArray(regex)) {
  66111. return regex.reduce(function (res, item) {
  66112. return (!!res) ? res : self.exec(string, item);
  66113. }, null);
  66114. }
  66115. else {
  66116. return null;
  66117. }
  66118. };
  66119. return ReTree;
  66120. }());
  66121. /**
  66122. * @fileoverview added by tsickle
  66123. * @suppress {checkTypes} checked by tsc
  66124. */
  66125. /**
  66126. * @record
  66127. */
  66128. var DeviceDetectorService = /** @class */ (function () {
  66129. function DeviceDetectorService(platformId) {
  66130. this.platformId = platformId;
  66131. this.ua = '';
  66132. this.userAgent = '';
  66133. this.os = '';
  66134. this.browser = '';
  66135. this.device = '';
  66136. this.os_version = '';
  66137. this.browser_version = '';
  66138. if (common.isPlatformBrowser(this.platformId)) {
  66139. this.ua = window.navigator.userAgent;
  66140. }
  66141. this._setDeviceInfo();
  66142. }
  66143. /**
  66144. * @author Ahsan Ayaz
  66145. * @desc Sets the initial value of the device when the service is initiated.
  66146. * This value is later accessible for usage
  66147. * @return {?}
  66148. */
  66149. DeviceDetectorService.prototype._setDeviceInfo = /**
  66150. * @author Ahsan Ayaz
  66151. * @desc Sets the initial value of the device when the service is initiated.
  66152. * This value is later accessible for usage
  66153. * @return {?}
  66154. */
  66155. function () {
  66156. var _this = this;
  66157. var /** @type {?} */ reTree = new ReTree();
  66158. var /** @type {?} */ ua = this.ua;
  66159. this.userAgent = ua;
  66160. var /** @type {?} */ mappings = [
  66161. { const: 'OS', prop: 'os' },
  66162. { const: 'BROWSERS', prop: 'browser' },
  66163. { const: 'DEVICES', prop: 'device' },
  66164. { const: 'OS_VERSIONS', prop: 'os_version' },
  66165. ];
  66166. mappings.forEach(function (mapping) {
  66167. _this[mapping.prop] = Object.keys(Constants[mapping.const]).reduce(function (obj, item) {
  66168. obj[Constants[mapping.const][item]] = reTree.test(ua, Constants[mapping.const + "_RE"][item]);
  66169. return obj;
  66170. }, {});
  66171. });
  66172. mappings.forEach(function (mapping) {
  66173. _this[mapping.prop] = Object.keys(Constants[mapping.const])
  66174. .map(function (key) {
  66175. return Constants[mapping.const][key];
  66176. }).reduce(function (previousValue, currentValue) {
  66177. return (previousValue === Constants[mapping.const].UNKNOWN && _this[mapping.prop][currentValue])
  66178. ? currentValue : previousValue;
  66179. }, Constants[mapping.const].UNKNOWN);
  66180. });
  66181. this.browser_version = '0';
  66182. if (this.browser !== BROWSERS.UNKNOWN) {
  66183. var /** @type {?} */ re = BROWSER_VERSIONS_RE[this.browser];
  66184. var /** @type {?} */ res = reTree.exec(ua, re);
  66185. if (!!res) {
  66186. this.browser_version = res[1];
  66187. }
  66188. }
  66189. };
  66190. /**
  66191. * @author Ahsan Ayaz
  66192. * @desc Returns the device information
  66193. * @return {?} the device information object.
  66194. */
  66195. DeviceDetectorService.prototype.getDeviceInfo = /**
  66196. * @author Ahsan Ayaz
  66197. * @desc Returns the device information
  66198. * @return {?} the device information object.
  66199. */
  66200. function () {
  66201. var /** @type {?} */ deviceInfo = {
  66202. userAgent: this.userAgent,
  66203. os: this.os,
  66204. browser: this.browser,
  66205. device: this.device,
  66206. os_version: this.os_version,
  66207. browser_version: this.browser_version
  66208. };
  66209. return deviceInfo;
  66210. };
  66211. /**
  66212. * @author Ahsan Ayaz
  66213. * @desc Compares the current device info with the mobile devices to check
  66214. * if the current device is a mobile.
  66215. * @return {?} whether the current device is a mobile
  66216. */
  66217. DeviceDetectorService.prototype.isMobile = /**
  66218. * @author Ahsan Ayaz
  66219. * @desc Compares the current device info with the mobile devices to check
  66220. * if the current device is a mobile.
  66221. * @return {?} whether the current device is a mobile
  66222. */
  66223. function () {
  66224. var _this = this;
  66225. return [
  66226. DEVICES.ANDROID,
  66227. DEVICES.IPHONE,
  66228. DEVICES.I_POD,
  66229. DEVICES.BLACKBERRY,
  66230. DEVICES.FIREFOX_OS,
  66231. DEVICES.WINDOWS_PHONE,
  66232. DEVICES.VITA
  66233. ].some(function (item) {
  66234. return _this.device === item;
  66235. });
  66236. };
  66237. /**
  66238. * @author Ahsan Ayaz
  66239. * @desc Compares the current device info with the tablet devices to check
  66240. * if the current device is a tablet.
  66241. * @return {?} whether the current device is a tablet
  66242. */
  66243. DeviceDetectorService.prototype.isTablet = /**
  66244. * @author Ahsan Ayaz
  66245. * @desc Compares the current device info with the tablet devices to check
  66246. * if the current device is a tablet.
  66247. * @return {?} whether the current device is a tablet
  66248. */
  66249. function () {
  66250. var _this = this;
  66251. return [
  66252. DEVICES.I_PAD,
  66253. DEVICES.FIREFOX_OS
  66254. ].some(function (item) {
  66255. return _this.device === item;
  66256. });
  66257. };
  66258. /**
  66259. * @author Ahsan Ayaz
  66260. * @desc Compares the current device info with the desktop devices to check
  66261. * if the current device is a desktop device.
  66262. * @return {?} whether the current device is a desktop device
  66263. */
  66264. DeviceDetectorService.prototype.isDesktop = /**
  66265. * @author Ahsan Ayaz
  66266. * @desc Compares the current device info with the desktop devices to check
  66267. * if the current device is a desktop device.
  66268. * @return {?} whether the current device is a desktop device
  66269. */
  66270. function () {
  66271. var _this = this;
  66272. return [
  66273. DEVICES.PS4,
  66274. DEVICES.CHROME_BOOK,
  66275. DEVICES.UNKNOWN
  66276. ].some(function (item) {
  66277. return _this.device === item;
  66278. });
  66279. };
  66280. DeviceDetectorService.decorators = [
  66281. { type: core.Injectable },
  66282. ];
  66283. /** @nocollapse */
  66284. DeviceDetectorService.ctorParameters = function () { return [
  66285. { type: undefined, decorators: [{ type: core.Inject, args: [core.PLATFORM_ID,] },] },
  66286. ]; };
  66287. return DeviceDetectorService;
  66288. }());
  66289. /**
  66290. * @fileoverview added by tsickle
  66291. * @suppress {checkTypes} checked by tsc
  66292. */
  66293. var DeviceDetectorModule = /** @class */ (function () {
  66294. function DeviceDetectorModule() {
  66295. }
  66296. /**
  66297. * @return {?}
  66298. */
  66299. DeviceDetectorModule.forRoot = /**
  66300. * @return {?}
  66301. */
  66302. function () {
  66303. return {
  66304. ngModule: DeviceDetectorModule,
  66305. providers: [DeviceDetectorService]
  66306. };
  66307. };
  66308. DeviceDetectorModule.decorators = [
  66309. { type: core.NgModule, args: [{
  66310. imports: [
  66311. common.CommonModule
  66312. ]
  66313. },] },
  66314. ];
  66315. return DeviceDetectorModule;
  66316. }());
  66317. exports.DeviceDetectorModule = DeviceDetectorModule;
  66318. exports.DeviceDetectorService = DeviceDetectorService;
  66319. exports.ReTree = ReTree;
  66320. exports.BROWSERS = BROWSERS;
  66321. exports.DEVICES = DEVICES;
  66322. exports.OS = OS;
  66323. exports.OS_VERSIONS = OS_VERSIONS;
  66324. exports.OS_RE = OS_RE;
  66325. exports.BROWSERS_RE = BROWSERS_RE;
  66326. exports.DEVICES_RE = DEVICES_RE;
  66327. exports.OS_VERSIONS_RE = OS_VERSIONS_RE;
  66328. exports.BROWSER_VERSIONS_RE_MAP = BROWSER_VERSIONS_RE_MAP;
  66329. exports.BROWSER_VERSIONS_RE = BROWSER_VERSIONS_RE;
  66330. Object.defineProperty(exports, '__esModule', { value: true });
  66331. })));
  66332. /***/ }),
  66333. /***/ "./node_modules/ngx-pagination/dist/ngx-pagination.js":
  66334. /*!************************************************************!*\
  66335. !*** ./node_modules/ngx-pagination/dist/ngx-pagination.js ***!
  66336. \************************************************************/
  66337. /*! exports provided: ɵb, ɵa, NgxPaginationModule, PaginationService, PaginationControlsComponent, PaginationControlsDirective, PaginatePipe */
  66338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  66339. "use strict";
  66340. __webpack_require__.r(__webpack_exports__);
  66341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵb", function() { return DEFAULT_STYLES; });
  66342. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ɵa", function() { return DEFAULT_TEMPLATE; });
  66343. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgxPaginationModule", function() { return NgxPaginationModule; });
  66344. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PaginationService", function() { return PaginationService; });
  66345. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PaginationControlsComponent", function() { return PaginationControlsComponent; });
  66346. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PaginationControlsDirective", function() { return PaginationControlsDirective; });
  66347. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "PaginatePipe", function() { return PaginatePipe; });
  66348. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  66349. /* harmony import */ var _angular_common__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! @angular/common */ "./node_modules/@angular/common/fesm5/common.js");
  66350. var PaginationService = (function () {
  66351. function PaginationService() {
  66352. this.change = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  66353. this.instances = {};
  66354. this.DEFAULT_ID = 'DEFAULT_PAGINATION_ID';
  66355. }
  66356. PaginationService.prototype.defaultId = function () { return this.DEFAULT_ID; };
  66357. PaginationService.prototype.register = function (instance) {
  66358. if (instance.id == null) {
  66359. instance.id = this.DEFAULT_ID;
  66360. }
  66361. if (!this.instances[instance.id]) {
  66362. this.instances[instance.id] = instance;
  66363. this.change.emit(instance.id);
  66364. }
  66365. else {
  66366. var changed = this.updateInstance(instance);
  66367. if (changed) {
  66368. this.change.emit(instance.id);
  66369. }
  66370. }
  66371. };
  66372. /**
  66373. * Check each property of the instance and update any that have changed. Return
  66374. * true if any changes were made, else return false.
  66375. */
  66376. PaginationService.prototype.updateInstance = function (instance) {
  66377. var changed = false;
  66378. for (var prop in this.instances[instance.id]) {
  66379. if (instance[prop] !== this.instances[instance.id][prop]) {
  66380. this.instances[instance.id][prop] = instance[prop];
  66381. changed = true;
  66382. }
  66383. }
  66384. return changed;
  66385. };
  66386. /**
  66387. * Returns the current page number.
  66388. */
  66389. PaginationService.prototype.getCurrentPage = function (id) {
  66390. if (this.instances[id]) {
  66391. return this.instances[id].currentPage;
  66392. }
  66393. };
  66394. /**
  66395. * Sets the current page number.
  66396. */
  66397. PaginationService.prototype.setCurrentPage = function (id, page) {
  66398. if (this.instances[id]) {
  66399. var instance = this.instances[id];
  66400. var maxPage = Math.ceil(instance.totalItems / instance.itemsPerPage);
  66401. if (page <= maxPage && 1 <= page) {
  66402. this.instances[id].currentPage = page;
  66403. this.change.emit(id);
  66404. }
  66405. }
  66406. };
  66407. /**
  66408. * Sets the value of instance.totalItems
  66409. */
  66410. PaginationService.prototype.setTotalItems = function (id, totalItems) {
  66411. if (this.instances[id] && 0 <= totalItems) {
  66412. this.instances[id].totalItems = totalItems;
  66413. this.change.emit(id);
  66414. }
  66415. };
  66416. /**
  66417. * Sets the value of instance.itemsPerPage.
  66418. */
  66419. PaginationService.prototype.setItemsPerPage = function (id, itemsPerPage) {
  66420. if (this.instances[id]) {
  66421. this.instances[id].itemsPerPage = itemsPerPage;
  66422. this.change.emit(id);
  66423. }
  66424. };
  66425. /**
  66426. * Returns a clone of the pagination instance object matching the id. If no
  66427. * id specified, returns the instance corresponding to the default id.
  66428. */
  66429. PaginationService.prototype.getInstance = function (id) {
  66430. if (id === void 0) { id = this.DEFAULT_ID; }
  66431. if (this.instances[id]) {
  66432. return this.clone(this.instances[id]);
  66433. }
  66434. return {};
  66435. };
  66436. /**
  66437. * Perform a shallow clone of an object.
  66438. */
  66439. PaginationService.prototype.clone = function (obj) {
  66440. var target = {};
  66441. for (var i in obj) {
  66442. if (obj.hasOwnProperty(i)) {
  66443. target[i] = obj[i];
  66444. }
  66445. }
  66446. return target;
  66447. };
  66448. return PaginationService;
  66449. }());
  66450. var LARGE_NUMBER = Number.MAX_SAFE_INTEGER;
  66451. var PaginatePipe = (function () {
  66452. function PaginatePipe(service) {
  66453. this.service = service;
  66454. // store the values from the last time the pipe was invoked
  66455. this.state = {};
  66456. }
  66457. PaginatePipe.prototype.transform = function (collection, args) {
  66458. // When an observable is passed through the AsyncPipe, it will output
  66459. // `null` until the subscription resolves. In this case, we want to
  66460. // use the cached data from the `state` object to prevent the NgFor
  66461. // from flashing empty until the real values arrive.
  66462. if (args instanceof Array) {
  66463. // compatible with angular2 before beta16
  66464. args = args[0];
  66465. }
  66466. if (!(collection instanceof Array)) {
  66467. var _id = args.id || this.service.defaultId;
  66468. if (this.state[_id]) {
  66469. return this.state[_id].slice;
  66470. }
  66471. else {
  66472. return collection;
  66473. }
  66474. }
  66475. var serverSideMode = args.totalItems && args.totalItems !== collection.length;
  66476. var instance = this.createInstance(collection, args);
  66477. var id = instance.id;
  66478. var start, end;
  66479. var perPage = instance.itemsPerPage;
  66480. this.service.register(instance);
  66481. if (!serverSideMode && collection instanceof Array) {
  66482. perPage = +perPage || LARGE_NUMBER;
  66483. start = (instance.currentPage - 1) * perPage;
  66484. end = start + perPage;
  66485. var isIdentical = this.stateIsIdentical(id, collection, start, end);
  66486. if (isIdentical) {
  66487. return this.state[id].slice;
  66488. }
  66489. else {
  66490. var slice = collection.slice(start, end);
  66491. this.saveState(id, collection, slice, start, end);
  66492. this.service.change.emit(id);
  66493. return slice;
  66494. }
  66495. }
  66496. // save the state for server-side collection to avoid null
  66497. // flash as new data loads.
  66498. this.saveState(id, collection, collection, start, end);
  66499. return collection;
  66500. };
  66501. /**
  66502. * Create an PaginationInstance object, using defaults for any optional properties not supplied.
  66503. */
  66504. PaginatePipe.prototype.createInstance = function (collection, args) {
  66505. var config = args;
  66506. this.checkConfig(config);
  66507. return {
  66508. id: config.id != null ? config.id : this.service.defaultId(),
  66509. itemsPerPage: +config.itemsPerPage || 0,
  66510. currentPage: +config.currentPage || 1,
  66511. totalItems: +config.totalItems || collection.length
  66512. };
  66513. };
  66514. /**
  66515. * Ensure the argument passed to the filter contains the required properties.
  66516. */
  66517. PaginatePipe.prototype.checkConfig = function (config) {
  66518. var required = ['itemsPerPage', 'currentPage'];
  66519. var missing = required.filter(function (prop) { return !(prop in config); });
  66520. if (0 < missing.length) {
  66521. throw new Error("PaginatePipe: Argument is missing the following required properties: " + missing.join(', '));
  66522. }
  66523. };
  66524. /**
  66525. * To avoid returning a brand new array each time the pipe is run, we store the state of the sliced
  66526. * array for a given id. This means that the next time the pipe is run on this collection & id, we just
  66527. * need to check that the collection, start and end points are all identical, and if so, return the
  66528. * last sliced array.
  66529. */
  66530. PaginatePipe.prototype.saveState = function (id, collection, slice, start, end) {
  66531. this.state[id] = {
  66532. collection: collection,
  66533. size: collection.length,
  66534. slice: slice,
  66535. start: start,
  66536. end: end
  66537. };
  66538. };
  66539. /**
  66540. * For a given id, returns true if the collection, size, start and end values are identical.
  66541. */
  66542. PaginatePipe.prototype.stateIsIdentical = function (id, collection, start, end) {
  66543. var state = this.state[id];
  66544. if (!state) {
  66545. return false;
  66546. }
  66547. var isMetaDataIdentical = state.size === collection.length &&
  66548. state.start === start &&
  66549. state.end === end;
  66550. if (!isMetaDataIdentical) {
  66551. return false;
  66552. }
  66553. return state.slice.every(function (element, index) { return element === collection[start + index]; });
  66554. };
  66555. PaginatePipe.decorators = [
  66556. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Pipe"], args: [{
  66557. name: 'paginate',
  66558. pure: false
  66559. },] },
  66560. ];
  66561. /** @nocollapse */
  66562. PaginatePipe.ctorParameters = function () { return [
  66563. { type: PaginationService, },
  66564. ]; };
  66565. return PaginatePipe;
  66566. }());
  66567. /**
  66568. * The default template and styles for the pagination links are borrowed directly
  66569. * from Zurb Foundation 6: http://foundation.zurb.com/sites/docs/pagination.html
  66570. */
  66571. var DEFAULT_TEMPLATE = "\n <pagination-template #p=\"paginationApi\"\n [id]=\"id\"\n [maxSize]=\"maxSize\"\n (pageChange)=\"pageChange.emit($event)\">\n <ul class=\"ngx-pagination\" \n role=\"navigation\" \n [attr.aria-label]=\"screenReaderPaginationLabel\" \n [class.responsive]=\"responsive\"\n *ngIf=\"!(autoHide && p.pages.length <= 1)\">\n\n <li class=\"pagination-previous\" [class.disabled]=\"p.isFirstPage()\" *ngIf=\"directionLinks\"> \n <a tabindex=\"0\" *ngIf=\"1 < p.getCurrent()\" (keyup.enter)=\"p.previous()\" (click)=\"p.previous()\" [attr.aria-label]=\"previousLabel + ' ' + screenReaderPageLabel\">\n {{ previousLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\n </a>\n <span *ngIf=\"p.isFirstPage()\">\n {{ previousLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\n </span>\n </li> \n\n <li class=\"small-screen\">\n {{ p.getCurrent() }} / {{ p.getLastPage() }}\n </li>\n\n <li [class.current]=\"p.getCurrent() === page.value\" \n [class.ellipsis]=\"page.label === '...'\"\n *ngFor=\"let page of p.pages\">\n <a tabindex=\"0\" (keyup.enter)=\"p.setCurrent(page.value)\" (click)=\"p.setCurrent(page.value)\" *ngIf=\"p.getCurrent() !== page.value\">\n <span class=\"show-for-sr\">{{ screenReaderPageLabel }} </span>\n <span>{{ page.label }}</span>\n </a>\n <ng-container *ngIf=\"p.getCurrent() === page.value\">\n <span class=\"show-for-sr\">{{ screenReaderCurrentLabel }} </span>\n <span>{{ page.label }}</span> \n </ng-container>\n </li>\n\n <li class=\"pagination-next\" [class.disabled]=\"p.isLastPage()\" *ngIf=\"directionLinks\">\n <a tabindex=\"0\" *ngIf=\"!p.isLastPage()\" (keyup.enter)=\"p.next()\" (click)=\"p.next()\" [attr.aria-label]=\"nextLabel + ' ' + screenReaderPageLabel\">\n {{ nextLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\n </a>\n <span *ngIf=\"p.isLastPage()\">\n {{ nextLabel }} <span class=\"show-for-sr\">{{ screenReaderPageLabel }}</span>\n </span>\n </li>\n\n </ul>\n </pagination-template>\n ";
  66572. var DEFAULT_STYLES = "\n.ngx-pagination {\n margin-left: 0;\n margin-bottom: 1rem; }\n .ngx-pagination::before, .ngx-pagination::after {\n content: ' ';\n display: table; }\n .ngx-pagination::after {\n clear: both; }\n .ngx-pagination li {\n -moz-user-select: none;\n -webkit-user-select: none;\n -ms-user-select: none;\n margin-right: 0.0625rem;\n border-radius: 0; }\n .ngx-pagination li {\n display: inline-block; }\n .ngx-pagination a,\n .ngx-pagination button {\n color: #0a0a0a; \n display: block;\n padding: 0.1875rem 0.625rem;\n border-radius: 0; }\n .ngx-pagination a:hover,\n .ngx-pagination button:hover {\n background: #e6e6e6; }\n .ngx-pagination .current {\n padding: 0.1875rem 0.625rem;\n background: #2199e8;\n color: #fefefe;\n cursor: default; }\n .ngx-pagination .disabled {\n padding: 0.1875rem 0.625rem;\n color: #cacaca;\n cursor: default; } \n .ngx-pagination .disabled:hover {\n background: transparent; }\n .ngx-pagination a, .ngx-pagination button {\n cursor: pointer; }\n\n.ngx-pagination .pagination-previous a::before,\n.ngx-pagination .pagination-previous.disabled::before { \n content: '\u00AB';\n display: inline-block;\n margin-right: 0.5rem; }\n\n.ngx-pagination .pagination-next a::after,\n.ngx-pagination .pagination-next.disabled::after {\n content: '\u00BB';\n display: inline-block;\n margin-left: 0.5rem; }\n\n.ngx-pagination .show-for-sr {\n position: absolute !important;\n width: 1px;\n height: 1px;\n overflow: hidden;\n clip: rect(0, 0, 0, 0); }\n.ngx-pagination .small-screen {\n display: none; }\n@media screen and (max-width: 601px) {\n .ngx-pagination.responsive .small-screen {\n display: inline-block; } \n .ngx-pagination.responsive li:not(.small-screen):not(.pagination-previous):not(.pagination-next) {\n display: none; }\n}\n ";
  66573. function coerceToBoolean(input) {
  66574. return !!input && input !== 'false';
  66575. }
  66576. /**
  66577. * The default pagination controls component. Actually just a default implementation of a custom template.
  66578. */
  66579. var PaginationControlsComponent = (function () {
  66580. function PaginationControlsComponent() {
  66581. this.maxSize = 7;
  66582. this.previousLabel = 'Previous';
  66583. this.nextLabel = 'Next';
  66584. this.screenReaderPaginationLabel = 'Pagination';
  66585. this.screenReaderPageLabel = 'page';
  66586. this.screenReaderCurrentLabel = "You're on page";
  66587. this.pageChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  66588. this._directionLinks = true;
  66589. this._autoHide = false;
  66590. this._responsive = false;
  66591. }
  66592. Object.defineProperty(PaginationControlsComponent.prototype, "directionLinks", {
  66593. get: function () {
  66594. return this._directionLinks;
  66595. },
  66596. set: function (value) {
  66597. this._directionLinks = coerceToBoolean(value);
  66598. },
  66599. enumerable: true,
  66600. configurable: true
  66601. });
  66602. Object.defineProperty(PaginationControlsComponent.prototype, "autoHide", {
  66603. get: function () {
  66604. return this._autoHide;
  66605. },
  66606. set: function (value) {
  66607. this._autoHide = coerceToBoolean(value);
  66608. },
  66609. enumerable: true,
  66610. configurable: true
  66611. });
  66612. Object.defineProperty(PaginationControlsComponent.prototype, "responsive", {
  66613. get: function () {
  66614. return this._responsive;
  66615. },
  66616. set: function (value) {
  66617. this._responsive = coerceToBoolean(value);
  66618. },
  66619. enumerable: true,
  66620. configurable: true
  66621. });
  66622. PaginationControlsComponent.decorators = [
  66623. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Component"], args: [{
  66624. selector: 'pagination-controls',
  66625. template: DEFAULT_TEMPLATE,
  66626. styles: [DEFAULT_STYLES],
  66627. changeDetection: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectionStrategy"].OnPush,
  66628. encapsulation: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ViewEncapsulation"].None
  66629. },] },
  66630. ];
  66631. /** @nocollapse */
  66632. PaginationControlsComponent.ctorParameters = function () { return []; };
  66633. PaginationControlsComponent.propDecorators = {
  66634. 'id': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66635. 'maxSize': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66636. 'directionLinks': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66637. 'autoHide': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66638. 'responsive': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66639. 'previousLabel': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66640. 'nextLabel': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66641. 'screenReaderPaginationLabel': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66642. 'screenReaderPageLabel': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66643. 'screenReaderCurrentLabel': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66644. 'pageChange': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] },],
  66645. };
  66646. return PaginationControlsComponent;
  66647. }());
  66648. /**
  66649. * This directive is what powers all pagination controls components, including the default one.
  66650. * It exposes an API which is hooked up to the PaginationService to keep the PaginatePipe in sync
  66651. * with the pagination controls.
  66652. */
  66653. var PaginationControlsDirective = (function () {
  66654. function PaginationControlsDirective(service, changeDetectorRef) {
  66655. var _this = this;
  66656. this.service = service;
  66657. this.changeDetectorRef = changeDetectorRef;
  66658. this.maxSize = 7;
  66659. this.pageChange = new _angular_core__WEBPACK_IMPORTED_MODULE_0__["EventEmitter"]();
  66660. this.pages = [];
  66661. this.changeSub = this.service.change
  66662. .subscribe(function (id) {
  66663. if (_this.id === id) {
  66664. _this.updatePageLinks();
  66665. _this.changeDetectorRef.markForCheck();
  66666. _this.changeDetectorRef.detectChanges();
  66667. }
  66668. });
  66669. }
  66670. PaginationControlsDirective.prototype.ngOnInit = function () {
  66671. if (this.id === undefined) {
  66672. this.id = this.service.defaultId();
  66673. }
  66674. this.updatePageLinks();
  66675. };
  66676. PaginationControlsDirective.prototype.ngOnChanges = function (changes) {
  66677. this.updatePageLinks();
  66678. };
  66679. PaginationControlsDirective.prototype.ngOnDestroy = function () {
  66680. this.changeSub.unsubscribe();
  66681. };
  66682. /**
  66683. * Go to the previous page
  66684. */
  66685. PaginationControlsDirective.prototype.previous = function () {
  66686. this.checkValidId();
  66687. this.setCurrent(this.getCurrent() - 1);
  66688. };
  66689. /**
  66690. * Go to the next page
  66691. */
  66692. PaginationControlsDirective.prototype.next = function () {
  66693. this.checkValidId();
  66694. this.setCurrent(this.getCurrent() + 1);
  66695. };
  66696. /**
  66697. * Returns true if current page is first page
  66698. */
  66699. PaginationControlsDirective.prototype.isFirstPage = function () {
  66700. return this.getCurrent() === 1;
  66701. };
  66702. /**
  66703. * Returns true if current page is last page
  66704. */
  66705. PaginationControlsDirective.prototype.isLastPage = function () {
  66706. return this.getLastPage() === this.getCurrent();
  66707. };
  66708. /**
  66709. * Set the current page number.
  66710. */
  66711. PaginationControlsDirective.prototype.setCurrent = function (page) {
  66712. this.pageChange.emit(page);
  66713. };
  66714. /**
  66715. * Get the current page number.
  66716. */
  66717. PaginationControlsDirective.prototype.getCurrent = function () {
  66718. return this.service.getCurrentPage(this.id);
  66719. };
  66720. /**
  66721. * Returns the last page number
  66722. */
  66723. PaginationControlsDirective.prototype.getLastPage = function () {
  66724. var inst = this.service.getInstance(this.id);
  66725. if (inst.totalItems < 1) {
  66726. // when there are 0 or fewer (an error case) items, there are no "pages" as such,
  66727. // but it makes sense to consider a single, empty page as the last page.
  66728. return 1;
  66729. }
  66730. return Math.ceil(inst.totalItems / inst.itemsPerPage);
  66731. };
  66732. PaginationControlsDirective.prototype.getTotalItems = function () {
  66733. return this.service.getInstance(this.id).totalItems;
  66734. };
  66735. PaginationControlsDirective.prototype.checkValidId = function () {
  66736. if (this.service.getInstance(this.id).id == null) {
  66737. console.warn("PaginationControlsDirective: the specified id \"" + this.id + "\" does not match any registered PaginationInstance");
  66738. }
  66739. };
  66740. /**
  66741. * Updates the page links and checks that the current page is valid. Should run whenever the
  66742. * PaginationService.change stream emits a value matching the current ID, or when any of the
  66743. * input values changes.
  66744. */
  66745. PaginationControlsDirective.prototype.updatePageLinks = function () {
  66746. var _this = this;
  66747. var inst = this.service.getInstance(this.id);
  66748. var correctedCurrentPage = this.outOfBoundCorrection(inst);
  66749. if (correctedCurrentPage !== inst.currentPage) {
  66750. setTimeout(function () {
  66751. _this.setCurrent(correctedCurrentPage);
  66752. _this.pages = _this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, _this.maxSize);
  66753. });
  66754. }
  66755. else {
  66756. this.pages = this.createPageArray(inst.currentPage, inst.itemsPerPage, inst.totalItems, this.maxSize);
  66757. }
  66758. };
  66759. /**
  66760. * Checks that the instance.currentPage property is within bounds for the current page range.
  66761. * If not, return a correct value for currentPage, or the current value if OK.
  66762. */
  66763. PaginationControlsDirective.prototype.outOfBoundCorrection = function (instance) {
  66764. var totalPages = Math.ceil(instance.totalItems / instance.itemsPerPage);
  66765. if (totalPages < instance.currentPage && 0 < totalPages) {
  66766. return totalPages;
  66767. }
  66768. else if (instance.currentPage < 1) {
  66769. return 1;
  66770. }
  66771. return instance.currentPage;
  66772. };
  66773. /**
  66774. * Returns an array of Page objects to use in the pagination controls.
  66775. */
  66776. PaginationControlsDirective.prototype.createPageArray = function (currentPage, itemsPerPage, totalItems, paginationRange) {
  66777. // paginationRange could be a string if passed from attribute, so cast to number.
  66778. paginationRange = +paginationRange;
  66779. var pages = [];
  66780. var totalPages = Math.ceil(totalItems / itemsPerPage);
  66781. var halfWay = Math.ceil(paginationRange / 2);
  66782. var isStart = currentPage <= halfWay;
  66783. var isEnd = totalPages - halfWay < currentPage;
  66784. var isMiddle = !isStart && !isEnd;
  66785. var ellipsesNeeded = paginationRange < totalPages;
  66786. var i = 1;
  66787. while (i <= totalPages && i <= paginationRange) {
  66788. var label = void 0;
  66789. var pageNumber = this.calculatePageNumber(i, currentPage, paginationRange, totalPages);
  66790. var openingEllipsesNeeded = (i === 2 && (isMiddle || isEnd));
  66791. var closingEllipsesNeeded = (i === paginationRange - 1 && (isMiddle || isStart));
  66792. if (ellipsesNeeded && (openingEllipsesNeeded || closingEllipsesNeeded)) {
  66793. label = '...';
  66794. }
  66795. else {
  66796. label = pageNumber;
  66797. }
  66798. pages.push({
  66799. label: label,
  66800. value: pageNumber
  66801. });
  66802. i++;
  66803. }
  66804. return pages;
  66805. };
  66806. /**
  66807. * Given the position in the sequence of pagination links [i],
  66808. * figure out what page number corresponds to that position.
  66809. */
  66810. PaginationControlsDirective.prototype.calculatePageNumber = function (i, currentPage, paginationRange, totalPages) {
  66811. var halfWay = Math.ceil(paginationRange / 2);
  66812. if (i === paginationRange) {
  66813. return totalPages;
  66814. }
  66815. else if (i === 1) {
  66816. return i;
  66817. }
  66818. else if (paginationRange < totalPages) {
  66819. if (totalPages - halfWay < currentPage) {
  66820. return totalPages - paginationRange + i;
  66821. }
  66822. else if (halfWay < currentPage) {
  66823. return currentPage - halfWay + i;
  66824. }
  66825. else {
  66826. return i;
  66827. }
  66828. }
  66829. else {
  66830. return i;
  66831. }
  66832. };
  66833. PaginationControlsDirective.decorators = [
  66834. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Directive"], args: [{
  66835. selector: 'pagination-template,[pagination-template]',
  66836. exportAs: 'paginationApi'
  66837. },] },
  66838. ];
  66839. /** @nocollapse */
  66840. PaginationControlsDirective.ctorParameters = function () { return [
  66841. { type: PaginationService, },
  66842. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["ChangeDetectorRef"], },
  66843. ]; };
  66844. PaginationControlsDirective.propDecorators = {
  66845. 'id': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66846. 'maxSize': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Input"] },],
  66847. 'pageChange': [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["Output"] },],
  66848. };
  66849. return PaginationControlsDirective;
  66850. }());
  66851. var NgxPaginationModule = (function () {
  66852. function NgxPaginationModule() {
  66853. }
  66854. NgxPaginationModule.decorators = [
  66855. { type: _angular_core__WEBPACK_IMPORTED_MODULE_0__["NgModule"], args: [{
  66856. imports: [_angular_common__WEBPACK_IMPORTED_MODULE_1__["CommonModule"]],
  66857. declarations: [
  66858. PaginatePipe,
  66859. PaginationControlsComponent,
  66860. PaginationControlsDirective
  66861. ],
  66862. providers: [PaginationService],
  66863. exports: [PaginatePipe, PaginationControlsComponent, PaginationControlsDirective]
  66864. },] },
  66865. ];
  66866. /** @nocollapse */
  66867. NgxPaginationModule.ctorParameters = function () { return []; };
  66868. return NgxPaginationModule;
  66869. }());
  66870. /**
  66871. * Generated bundle index. Do not edit.
  66872. */
  66873. /***/ }),
  66874. /***/ "./node_modules/ngx-twitter-timeline/fesm5/ngx-twitter-timeline.js":
  66875. /*!*************************************************************************!*\
  66876. !*** ./node_modules/ngx-twitter-timeline/fesm5/ngx-twitter-timeline.js ***!
  66877. \*************************************************************************/
  66878. /*! exports provided: NgxTwitterTimelineService, NgxTwitterTimelineComponent, NgxTwitterTimelineModule */
  66879. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  66880. "use strict";
  66881. __webpack_require__.r(__webpack_exports__);
  66882. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgxTwitterTimelineService", function() { return NgxTwitterTimelineService; });
  66883. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgxTwitterTimelineComponent", function() { return NgxTwitterTimelineComponent; });
  66884. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NgxTwitterTimelineModule", function() { return NgxTwitterTimelineModule; });
  66885. /* harmony import */ var rxjs__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! rxjs */ "./node_modules/rxjs/_esm5/index.js");
  66886. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  66887. /* harmony import */ var _angular_core__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! @angular/core */ "./node_modules/@angular/core/fesm5/core.js");
  66888. /**
  66889. * @fileoverview added by tsickle
  66890. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  66891. */
  66892. var NgxTwitterTimelineService = /** @class */ (function () {
  66893. function NgxTwitterTimelineService() {
  66894. this.TWITTER_SCRIPT_ID = 'twitter-wjs';
  66895. this.TWITTER_WIDGET_URL = 'https://platform.twitter.com/widgets.js';
  66896. }
  66897. /**
  66898. * @return {?}
  66899. */
  66900. NgxTwitterTimelineService.prototype.loadScript = /**
  66901. * @return {?}
  66902. */
  66903. function () {
  66904. var _this = this;
  66905. return rxjs__WEBPACK_IMPORTED_MODULE_0__["Observable"].create((/**
  66906. * @param {?} observer
  66907. * @return {?}
  66908. */
  66909. function (observer) {
  66910. _this.startScriptLoad();
  66911. window['twttr'].ready((/**
  66912. * @param {?} twttr
  66913. * @return {?}
  66914. */
  66915. function (twttr) {
  66916. observer.next(twttr);
  66917. observer.complete();
  66918. }));
  66919. }));
  66920. };
  66921. /**
  66922. * @private
  66923. * @return {?}
  66924. */
  66925. NgxTwitterTimelineService.prototype.startScriptLoad = /**
  66926. * @private
  66927. * @return {?}
  66928. */
  66929. function () {
  66930. window['twttr'] = ((/**
  66931. * @param {?} d
  66932. * @param {?} s
  66933. * @param {?} id
  66934. * @param {?} url
  66935. * @return {?}
  66936. */
  66937. function (d, s, id, url) {
  66938. /** @type {?} */
  66939. var script;
  66940. /** @type {?} */
  66941. var firstScriptEl = d.getElementsByTagName(s)[0];
  66942. /** @type {?} */
  66943. var twitterScript = window['twttr'] || {};
  66944. if (d.getElementById(id)) {
  66945. return twitterScript;
  66946. }
  66947. script = d.createElement(s);
  66948. script.id = id;
  66949. script.src = url;
  66950. firstScriptEl.parentNode.insertBefore(script, firstScriptEl);
  66951. twitterScript._e = [];
  66952. twitterScript.ready = (/**
  66953. * @param {?} f
  66954. * @return {?}
  66955. */
  66956. function (f) {
  66957. twitterScript._e.push(f);
  66958. });
  66959. return twitterScript;
  66960. })(document, 'script', this.TWITTER_SCRIPT_ID, this.TWITTER_WIDGET_URL));
  66961. };
  66962. NgxTwitterTimelineService.decorators = [
  66963. { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Injectable"], args: [{
  66964. providedIn: 'root'
  66965. },] }
  66966. ];
  66967. /** @nocollapse */
  66968. NgxTwitterTimelineService.ctorParameters = function () { return []; };
  66969. /** @nocollapse */ NgxTwitterTimelineService.ngInjectableDef = Object(_angular_core__WEBPACK_IMPORTED_MODULE_2__["defineInjectable"])({ factory: function NgxTwitterTimelineService_Factory() { return new NgxTwitterTimelineService(); }, token: NgxTwitterTimelineService, providedIn: "root" });
  66970. return NgxTwitterTimelineService;
  66971. }());
  66972. /**
  66973. * @fileoverview added by tsickle
  66974. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  66975. */
  66976. var NgxTwitterTimelineComponent = /** @class */ (function () {
  66977. function NgxTwitterTimelineComponent(element, twitterTimelineService) {
  66978. this.element = element;
  66979. this.twitterTimelineService = twitterTimelineService;
  66980. this.defaultOpts = {
  66981. tweetLimit: 5
  66982. };
  66983. this.defaultData = {
  66984. sourceType: 'url',
  66985. url: 'https://twitter.com/twitterdev',
  66986. screenName: 'twitterdev'
  66987. };
  66988. }
  66989. /**
  66990. * @return {?}
  66991. */
  66992. NgxTwitterTimelineComponent.prototype.ngOnChanges = /**
  66993. * @return {?}
  66994. */
  66995. function () {
  66996. if (this.data && this.data.sourceType) {
  66997. switch (this.data.sourceType) {
  66998. case 'url':
  66999. delete this.defaultData.screenName;
  67000. break;
  67001. case 'profile':
  67002. delete this.defaultData.url;
  67003. break;
  67004. default:
  67005. break;
  67006. }
  67007. this.loadTwitterWidget();
  67008. }
  67009. };
  67010. /**
  67011. * @return {?}
  67012. */
  67013. NgxTwitterTimelineComponent.prototype.loadTwitterWidget = /**
  67014. * @return {?}
  67015. */
  67016. function () {
  67017. var _this = this;
  67018. this.twitterTimelineService
  67019. .loadScript()
  67020. .subscribe((/**
  67021. * @param {?} twttr
  67022. * @return {?}
  67023. */
  67024. function (twttr) {
  67025. /** @type {?} */
  67026. var nativeElement = _this.element.nativeElement;
  67027. nativeElement.innerHTML = "";
  67028. window['twttr']
  67029. .widgets
  67030. .createTimeline(Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, _this.defaultData, _this.data), nativeElement, Object(tslib__WEBPACK_IMPORTED_MODULE_1__["__assign"])({}, _this.defaultOpts, _this.opts))
  67031. .then((/**
  67032. * @param {?} embed
  67033. * @return {?}
  67034. */
  67035. function (embed) {
  67036. // console.log(embed);
  67037. }))
  67038. .catch((/**
  67039. * @param {?} error
  67040. * @return {?}
  67041. */
  67042. function (error) { return console.error(error); }));
  67043. }), (/**
  67044. * @param {?} err
  67045. * @return {?}
  67046. */
  67047. function (err) { return console.error(err); }));
  67048. };
  67049. NgxTwitterTimelineComponent.decorators = [
  67050. { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Component"], args: [{
  67051. selector: 'ngx-twitter-timeline',
  67052. template: ""
  67053. }] }
  67054. ];
  67055. /** @nocollapse */
  67056. NgxTwitterTimelineComponent.ctorParameters = function () { return [
  67057. { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["ElementRef"] },
  67058. { type: NgxTwitterTimelineService }
  67059. ]; };
  67060. NgxTwitterTimelineComponent.propDecorators = {
  67061. data: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Input"] }],
  67062. opts: [{ type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["Input"] }]
  67063. };
  67064. return NgxTwitterTimelineComponent;
  67065. }());
  67066. /**
  67067. * @fileoverview added by tsickle
  67068. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  67069. */
  67070. var NgxTwitterTimelineModule = /** @class */ (function () {
  67071. function NgxTwitterTimelineModule() {
  67072. }
  67073. NgxTwitterTimelineModule.decorators = [
  67074. { type: _angular_core__WEBPACK_IMPORTED_MODULE_2__["NgModule"], args: [{
  67075. declarations: [NgxTwitterTimelineComponent],
  67076. imports: [],
  67077. exports: [NgxTwitterTimelineComponent]
  67078. },] }
  67079. ];
  67080. return NgxTwitterTimelineModule;
  67081. }());
  67082. /**
  67083. * @fileoverview added by tsickle
  67084. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  67085. */
  67086. /**
  67087. * @fileoverview added by tsickle
  67088. * @suppress {checkTypes,extraRequire,missingOverride,missingReturn,unusedPrivateMembers,uselessCode} checked by tsc
  67089. */
  67090. //# sourceMappingURL=ngx-twitter-timeline.js.map
  67091. /***/ }),
  67092. /***/ "./node_modules/pepjs/dist/pep.js":
  67093. /*!****************************************!*\
  67094. !*** ./node_modules/pepjs/dist/pep.js ***!
  67095. \****************************************/
  67096. /*! no static exports found */
  67097. /***/ (function(module, exports, __webpack_require__) {
  67098. /*!
  67099. * PEP v0.5.1 | https://github.com/jquery/PEP
  67100. * Copyright jQuery Foundation and other contributors | http://jquery.org/license
  67101. */
  67102. (function (global, factory) {
  67103. true ? module.exports = factory() :
  67104. undefined;
  67105. }(this, function () { 'use strict';
  67106. /**
  67107. * This is the constructor for new PointerEvents.
  67108. *
  67109. * New Pointer Events must be given a type, and an optional dictionary of
  67110. * initialization properties.
  67111. *
  67112. * Due to certain platform requirements, events returned from the constructor
  67113. * identify as MouseEvents.
  67114. *
  67115. * @constructor
  67116. * @param {String} inType The type of the event to create.
  67117. * @param {Object} [inDict] An optional dictionary of initial event properties.
  67118. * @return {Event} A new PointerEvent of type `inType`, initialized with properties from `inDict`.
  67119. */
  67120. var MOUSE_PROPS = [
  67121. 'bubbles',
  67122. 'cancelable',
  67123. 'view',
  67124. 'screenX',
  67125. 'screenY',
  67126. 'clientX',
  67127. 'clientY',
  67128. 'ctrlKey',
  67129. 'altKey',
  67130. 'shiftKey',
  67131. 'metaKey',
  67132. 'button',
  67133. 'relatedTarget',
  67134. 'pageX',
  67135. 'pageY'
  67136. ];
  67137. var MOUSE_DEFAULTS = [
  67138. false,
  67139. false,
  67140. null,
  67141. 0,
  67142. 0,
  67143. 0,
  67144. 0,
  67145. false,
  67146. false,
  67147. false,
  67148. false,
  67149. 0,
  67150. null,
  67151. 0,
  67152. 0
  67153. ];
  67154. function PointerEvent(inType, inDict) {
  67155. inDict = inDict || Object.create(null);
  67156. var e = document.createEvent('Event');
  67157. e.initEvent(inType, inDict.bubbles || false, inDict.cancelable || false);
  67158. // define inherited MouseEvent properties
  67159. // skip bubbles and cancelable since they're set above in initEvent()
  67160. for (var i = 2, p; i < MOUSE_PROPS.length; i++) {
  67161. p = MOUSE_PROPS[i];
  67162. e[p] = inDict[p] || MOUSE_DEFAULTS[i];
  67163. }
  67164. e.buttons = inDict.buttons || 0;
  67165. // Spec requires that pointers without pressure specified use 0.5 for down
  67166. // state and 0 for up state.
  67167. var pressure = 0;
  67168. if (inDict.pressure !== undefined && e.buttons) {
  67169. pressure = inDict.pressure;
  67170. } else {
  67171. pressure = e.buttons ? 0.5 : 0;
  67172. }
  67173. // add x/y properties aliased to clientX/Y
  67174. e.x = e.clientX;
  67175. e.y = e.clientY;
  67176. // define the properties of the PointerEvent interface
  67177. e.pointerId = inDict.pointerId || 0;
  67178. e.width = inDict.width || 1;
  67179. e.height = inDict.height || 1;
  67180. e.pressure = pressure;
  67181. e.tiltX = inDict.tiltX || 0;
  67182. e.tiltY = inDict.tiltY || 0;
  67183. e.twist = inDict.twist || 0;
  67184. e.tangentialPressure = inDict.tangentialPressure || 0;
  67185. e.pointerType = inDict.pointerType || '';
  67186. e.hwTimestamp = inDict.hwTimestamp || 0;
  67187. e.isPrimary = inDict.isPrimary || false;
  67188. e.detail = 0;
  67189. return e;
  67190. }
  67191. /**
  67192. * This module implements a map of pointer states
  67193. */
  67194. var USE_MAP = window.Map && window.Map.prototype.forEach;
  67195. var PointerMap = USE_MAP ? Map : SparseArrayMap;
  67196. function SparseArrayMap() {
  67197. this.array = [];
  67198. this.size = 0;
  67199. }
  67200. SparseArrayMap.prototype = {
  67201. set: function(k, v) {
  67202. if (v === undefined) {
  67203. return this.delete(k);
  67204. }
  67205. if (!this.has(k)) {
  67206. this.size++;
  67207. }
  67208. this.array[k] = v;
  67209. },
  67210. has: function(k) {
  67211. return this.array[k] !== undefined;
  67212. },
  67213. delete: function(k) {
  67214. if (this.has(k)) {
  67215. delete this.array[k];
  67216. this.size--;
  67217. }
  67218. },
  67219. get: function(k) {
  67220. return this.array[k];
  67221. },
  67222. clear: function() {
  67223. this.array.length = 0;
  67224. this.size = 0;
  67225. },
  67226. // return value, key, map
  67227. forEach: function(callback, thisArg) {
  67228. return this.array.forEach(function(v, k) {
  67229. callback.call(thisArg, v, k, this);
  67230. }, this);
  67231. }
  67232. };
  67233. var CLONE_PROPS = [
  67234. // MouseEvent
  67235. 'bubbles',
  67236. 'cancelable',
  67237. 'view',
  67238. 'detail',
  67239. 'screenX',
  67240. 'screenY',
  67241. 'clientX',
  67242. 'clientY',
  67243. 'ctrlKey',
  67244. 'altKey',
  67245. 'shiftKey',
  67246. 'metaKey',
  67247. 'button',
  67248. 'relatedTarget',
  67249. // DOM Level 3
  67250. 'buttons',
  67251. // PointerEvent
  67252. 'pointerId',
  67253. 'width',
  67254. 'height',
  67255. 'pressure',
  67256. 'tiltX',
  67257. 'tiltY',
  67258. 'pointerType',
  67259. 'hwTimestamp',
  67260. 'isPrimary',
  67261. // event instance
  67262. 'type',
  67263. 'target',
  67264. 'currentTarget',
  67265. 'which',
  67266. 'pageX',
  67267. 'pageY',
  67268. 'timeStamp'
  67269. ];
  67270. var CLONE_DEFAULTS = [
  67271. // MouseEvent
  67272. false,
  67273. false,
  67274. null,
  67275. null,
  67276. 0,
  67277. 0,
  67278. 0,
  67279. 0,
  67280. false,
  67281. false,
  67282. false,
  67283. false,
  67284. 0,
  67285. null,
  67286. // DOM Level 3
  67287. 0,
  67288. // PointerEvent
  67289. 0,
  67290. 0,
  67291. 0,
  67292. 0,
  67293. 0,
  67294. 0,
  67295. '',
  67296. 0,
  67297. false,
  67298. // event instance
  67299. '',
  67300. null,
  67301. null,
  67302. 0,
  67303. 0,
  67304. 0,
  67305. 0
  67306. ];
  67307. var BOUNDARY_EVENTS = {
  67308. 'pointerover': 1,
  67309. 'pointerout': 1,
  67310. 'pointerenter': 1,
  67311. 'pointerleave': 1
  67312. };
  67313. var HAS_SVG_INSTANCE = (typeof SVGElementInstance !== 'undefined');
  67314. /**
  67315. * This module is for normalizing events. Mouse and Touch events will be
  67316. * collected here, and fire PointerEvents that have the same semantics, no
  67317. * matter the source.
  67318. * Events fired:
  67319. * - pointerdown: a pointing is added
  67320. * - pointerup: a pointer is removed
  67321. * - pointermove: a pointer is moved
  67322. * - pointerover: a pointer crosses into an element
  67323. * - pointerout: a pointer leaves an element
  67324. * - pointercancel: a pointer will no longer generate events
  67325. */
  67326. var dispatcher = {
  67327. pointermap: new PointerMap(),
  67328. eventMap: Object.create(null),
  67329. captureInfo: Object.create(null),
  67330. // Scope objects for native events.
  67331. // This exists for ease of testing.
  67332. eventSources: Object.create(null),
  67333. eventSourceList: [],
  67334. /**
  67335. * Add a new event source that will generate pointer events.
  67336. *
  67337. * `inSource` must contain an array of event names named `events`, and
  67338. * functions with the names specified in the `events` array.
  67339. * @param {string} name A name for the event source
  67340. * @param {Object} source A new source of platform events.
  67341. */
  67342. registerSource: function(name, source) {
  67343. var s = source;
  67344. var newEvents = s.events;
  67345. if (newEvents) {
  67346. newEvents.forEach(function(e) {
  67347. if (s[e]) {
  67348. this.eventMap[e] = s[e].bind(s);
  67349. }
  67350. }, this);
  67351. this.eventSources[name] = s;
  67352. this.eventSourceList.push(s);
  67353. }
  67354. },
  67355. register: function(element) {
  67356. var l = this.eventSourceList.length;
  67357. for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
  67358. // call eventsource register
  67359. es.register.call(es, element);
  67360. }
  67361. },
  67362. unregister: function(element) {
  67363. var l = this.eventSourceList.length;
  67364. for (var i = 0, es; (i < l) && (es = this.eventSourceList[i]); i++) {
  67365. // call eventsource register
  67366. es.unregister.call(es, element);
  67367. }
  67368. },
  67369. contains: /*scope.external.contains || */function(container, contained) {
  67370. try {
  67371. return container.contains(contained);
  67372. } catch (ex) {
  67373. // most likely: https://bugzilla.mozilla.org/show_bug.cgi?id=208427
  67374. return false;
  67375. }
  67376. },
  67377. // EVENTS
  67378. down: function(inEvent) {
  67379. inEvent.bubbles = true;
  67380. this.fireEvent('pointerdown', inEvent);
  67381. },
  67382. move: function(inEvent) {
  67383. inEvent.bubbles = true;
  67384. this.fireEvent('pointermove', inEvent);
  67385. },
  67386. up: function(inEvent) {
  67387. inEvent.bubbles = true;
  67388. this.fireEvent('pointerup', inEvent);
  67389. },
  67390. enter: function(inEvent) {
  67391. inEvent.bubbles = false;
  67392. this.fireEvent('pointerenter', inEvent);
  67393. },
  67394. leave: function(inEvent) {
  67395. inEvent.bubbles = false;
  67396. this.fireEvent('pointerleave', inEvent);
  67397. },
  67398. over: function(inEvent) {
  67399. inEvent.bubbles = true;
  67400. this.fireEvent('pointerover', inEvent);
  67401. },
  67402. out: function(inEvent) {
  67403. inEvent.bubbles = true;
  67404. this.fireEvent('pointerout', inEvent);
  67405. },
  67406. cancel: function(inEvent) {
  67407. inEvent.bubbles = true;
  67408. this.fireEvent('pointercancel', inEvent);
  67409. },
  67410. leaveOut: function(event) {
  67411. this.out(event);
  67412. this.propagate(event, this.leave, false);
  67413. },
  67414. enterOver: function(event) {
  67415. this.over(event);
  67416. this.propagate(event, this.enter, true);
  67417. },
  67418. // LISTENER LOGIC
  67419. eventHandler: function(inEvent) {
  67420. // This is used to prevent multiple dispatch of pointerevents from
  67421. // platform events. This can happen when two elements in different scopes
  67422. // are set up to create pointer events, which is relevant to Shadow DOM.
  67423. if (inEvent._handledByPE) {
  67424. return;
  67425. }
  67426. var type = inEvent.type;
  67427. var fn = this.eventMap && this.eventMap[type];
  67428. if (fn) {
  67429. fn(inEvent);
  67430. }
  67431. inEvent._handledByPE = true;
  67432. },
  67433. // set up event listeners
  67434. listen: function(target, events) {
  67435. events.forEach(function(e) {
  67436. this.addEvent(target, e);
  67437. }, this);
  67438. },
  67439. // remove event listeners
  67440. unlisten: function(target, events) {
  67441. events.forEach(function(e) {
  67442. this.removeEvent(target, e);
  67443. }, this);
  67444. },
  67445. addEvent: /*scope.external.addEvent || */function(target, eventName) {
  67446. target.addEventListener(eventName, this.boundHandler);
  67447. },
  67448. removeEvent: /*scope.external.removeEvent || */function(target, eventName) {
  67449. target.removeEventListener(eventName, this.boundHandler);
  67450. },
  67451. // EVENT CREATION AND TRACKING
  67452. /**
  67453. * Creates a new Event of type `inType`, based on the information in
  67454. * `inEvent`.
  67455. *
  67456. * @param {string} inType A string representing the type of event to create
  67457. * @param {Event} inEvent A platform event with a target
  67458. * @return {Event} A PointerEvent of type `inType`
  67459. */
  67460. makeEvent: function(inType, inEvent) {
  67461. // relatedTarget must be null if pointer is captured
  67462. if (this.captureInfo[inEvent.pointerId]) {
  67463. inEvent.relatedTarget = null;
  67464. }
  67465. var e = new PointerEvent(inType, inEvent);
  67466. if (inEvent.preventDefault) {
  67467. e.preventDefault = inEvent.preventDefault;
  67468. }
  67469. e._target = e._target || inEvent.target;
  67470. return e;
  67471. },
  67472. // make and dispatch an event in one call
  67473. fireEvent: function(inType, inEvent) {
  67474. var e = this.makeEvent(inType, inEvent);
  67475. return this.dispatchEvent(e);
  67476. },
  67477. /**
  67478. * Returns a snapshot of inEvent, with writable properties.
  67479. *
  67480. * @param {Event} inEvent An event that contains properties to copy.
  67481. * @return {Object} An object containing shallow copies of `inEvent`'s
  67482. * properties.
  67483. */
  67484. cloneEvent: function(inEvent) {
  67485. var eventCopy = Object.create(null);
  67486. var p;
  67487. for (var i = 0; i < CLONE_PROPS.length; i++) {
  67488. p = CLONE_PROPS[i];
  67489. eventCopy[p] = inEvent[p] || CLONE_DEFAULTS[i];
  67490. // Work around SVGInstanceElement shadow tree
  67491. // Return the <use> element that is represented by the instance for Safari, Chrome, IE.
  67492. // This is the behavior implemented by Firefox.
  67493. if (HAS_SVG_INSTANCE && (p === 'target' || p === 'relatedTarget')) {
  67494. if (eventCopy[p] instanceof SVGElementInstance) {
  67495. eventCopy[p] = eventCopy[p].correspondingUseElement;
  67496. }
  67497. }
  67498. }
  67499. // keep the semantics of preventDefault
  67500. if (inEvent.preventDefault) {
  67501. eventCopy.preventDefault = function() {
  67502. inEvent.preventDefault();
  67503. };
  67504. }
  67505. return eventCopy;
  67506. },
  67507. getTarget: function(inEvent) {
  67508. var capture = this.captureInfo[inEvent.pointerId];
  67509. if (!capture) {
  67510. return inEvent._target;
  67511. }
  67512. if (inEvent._target === capture || !(inEvent.type in BOUNDARY_EVENTS)) {
  67513. return capture;
  67514. }
  67515. },
  67516. propagate: function(event, fn, propagateDown) {
  67517. var target = event.target;
  67518. var targets = [];
  67519. // Order of conditions due to document.contains() missing in IE.
  67520. while (target != null && target !== document && !target.contains(event.relatedTarget)) {
  67521. targets.push(target);
  67522. target = target.parentNode;
  67523. // Touch: Do not propagate if node is detached.
  67524. if (!target) {
  67525. return;
  67526. }
  67527. }
  67528. if (propagateDown) {
  67529. targets.reverse();
  67530. }
  67531. targets.forEach(function(target) {
  67532. event.target = target;
  67533. fn.call(this, event);
  67534. }, this);
  67535. },
  67536. setCapture: function(inPointerId, inTarget, skipDispatch) {
  67537. if (this.captureInfo[inPointerId]) {
  67538. this.releaseCapture(inPointerId, skipDispatch);
  67539. }
  67540. this.captureInfo[inPointerId] = inTarget;
  67541. this.implicitRelease = this.releaseCapture.bind(this, inPointerId, skipDispatch);
  67542. document.addEventListener('pointerup', this.implicitRelease);
  67543. document.addEventListener('pointercancel', this.implicitRelease);
  67544. var e = new PointerEvent('gotpointercapture', { bubbles: true });
  67545. e.pointerId = inPointerId;
  67546. e._target = inTarget;
  67547. if (!skipDispatch) {
  67548. this.asyncDispatchEvent(e);
  67549. }
  67550. },
  67551. releaseCapture: function(inPointerId, skipDispatch) {
  67552. var t = this.captureInfo[inPointerId];
  67553. if (!t) {
  67554. return;
  67555. }
  67556. this.captureInfo[inPointerId] = undefined;
  67557. document.removeEventListener('pointerup', this.implicitRelease);
  67558. document.removeEventListener('pointercancel', this.implicitRelease);
  67559. var e = new PointerEvent('lostpointercapture', { bubbles: true });
  67560. e.pointerId = inPointerId;
  67561. e._target = t;
  67562. if (!skipDispatch) {
  67563. this.asyncDispatchEvent(e);
  67564. }
  67565. },
  67566. /**
  67567. * Dispatches the event to its target.
  67568. *
  67569. * @param {Event} inEvent The event to be dispatched.
  67570. * @return {Boolean} True if an event handler returns true, false otherwise.
  67571. */
  67572. dispatchEvent: /*scope.external.dispatchEvent || */function(inEvent) {
  67573. var t = this.getTarget(inEvent);
  67574. if (t) {
  67575. return t.dispatchEvent(inEvent);
  67576. }
  67577. },
  67578. asyncDispatchEvent: function(inEvent) {
  67579. requestAnimationFrame(this.dispatchEvent.bind(this, inEvent));
  67580. }
  67581. };
  67582. dispatcher.boundHandler = dispatcher.eventHandler.bind(dispatcher);
  67583. var targeting = {
  67584. shadow: function(inEl) {
  67585. if (inEl) {
  67586. return inEl.shadowRoot || inEl.webkitShadowRoot;
  67587. }
  67588. },
  67589. canTarget: function(shadow) {
  67590. return shadow && Boolean(shadow.elementFromPoint);
  67591. },
  67592. targetingShadow: function(inEl) {
  67593. var s = this.shadow(inEl);
  67594. if (this.canTarget(s)) {
  67595. return s;
  67596. }
  67597. },
  67598. olderShadow: function(shadow) {
  67599. var os = shadow.olderShadowRoot;
  67600. if (!os) {
  67601. var se = shadow.querySelector('shadow');
  67602. if (se) {
  67603. os = se.olderShadowRoot;
  67604. }
  67605. }
  67606. return os;
  67607. },
  67608. allShadows: function(element) {
  67609. var shadows = [];
  67610. var s = this.shadow(element);
  67611. while (s) {
  67612. shadows.push(s);
  67613. s = this.olderShadow(s);
  67614. }
  67615. return shadows;
  67616. },
  67617. searchRoot: function(inRoot, x, y) {
  67618. if (inRoot) {
  67619. var t = inRoot.elementFromPoint(x, y);
  67620. var st, sr;
  67621. // is element a shadow host?
  67622. sr = this.targetingShadow(t);
  67623. while (sr) {
  67624. // find the the element inside the shadow root
  67625. st = sr.elementFromPoint(x, y);
  67626. if (!st) {
  67627. // check for older shadows
  67628. sr = this.olderShadow(sr);
  67629. } else {
  67630. // shadowed element may contain a shadow root
  67631. var ssr = this.targetingShadow(st);
  67632. return this.searchRoot(ssr, x, y) || st;
  67633. }
  67634. }
  67635. // light dom element is the target
  67636. return t;
  67637. }
  67638. },
  67639. owner: function(element) {
  67640. var s = element;
  67641. // walk up until you hit the shadow root or document
  67642. while (s.parentNode) {
  67643. s = s.parentNode;
  67644. }
  67645. // the owner element is expected to be a Document or ShadowRoot
  67646. if (s.nodeType !== Node.DOCUMENT_NODE && s.nodeType !== Node.DOCUMENT_FRAGMENT_NODE) {
  67647. s = document;
  67648. }
  67649. return s;
  67650. },
  67651. findTarget: function(inEvent) {
  67652. var x = inEvent.clientX;
  67653. var y = inEvent.clientY;
  67654. // if the listener is in the shadow root, it is much faster to start there
  67655. var s = this.owner(inEvent.target);
  67656. // if x, y is not in this root, fall back to document search
  67657. if (!s.elementFromPoint(x, y)) {
  67658. s = document;
  67659. }
  67660. return this.searchRoot(s, x, y);
  67661. }
  67662. };
  67663. var forEach = Array.prototype.forEach.call.bind(Array.prototype.forEach);
  67664. var map = Array.prototype.map.call.bind(Array.prototype.map);
  67665. var toArray = Array.prototype.slice.call.bind(Array.prototype.slice);
  67666. var filter = Array.prototype.filter.call.bind(Array.prototype.filter);
  67667. var MO = window.MutationObserver || window.WebKitMutationObserver;
  67668. var SELECTOR = '[touch-action]';
  67669. var OBSERVER_INIT = {
  67670. subtree: true,
  67671. childList: true,
  67672. attributes: true,
  67673. attributeOldValue: true,
  67674. attributeFilter: ['touch-action']
  67675. };
  67676. function Installer(add, remove, changed, binder) {
  67677. this.addCallback = add.bind(binder);
  67678. this.removeCallback = remove.bind(binder);
  67679. this.changedCallback = changed.bind(binder);
  67680. if (MO) {
  67681. this.observer = new MO(this.mutationWatcher.bind(this));
  67682. }
  67683. }
  67684. Installer.prototype = {
  67685. watchSubtree: function(target) {
  67686. // Only watch scopes that can target find, as these are top-level.
  67687. // Otherwise we can see duplicate additions and removals that add noise.
  67688. //
  67689. // TODO(dfreedman): For some instances with ShadowDOMPolyfill, we can see
  67690. // a removal without an insertion when a node is redistributed among
  67691. // shadows. Since it all ends up correct in the document, watching only
  67692. // the document will yield the correct mutations to watch.
  67693. if (this.observer && targeting.canTarget(target)) {
  67694. this.observer.observe(target, OBSERVER_INIT);
  67695. }
  67696. },
  67697. enableOnSubtree: function(target) {
  67698. this.watchSubtree(target);
  67699. if (target === document && document.readyState !== 'complete') {
  67700. this.installOnLoad();
  67701. } else {
  67702. this.installNewSubtree(target);
  67703. }
  67704. },
  67705. installNewSubtree: function(target) {
  67706. forEach(this.findElements(target), this.addElement, this);
  67707. },
  67708. findElements: function(target) {
  67709. if (target.querySelectorAll) {
  67710. return target.querySelectorAll(SELECTOR);
  67711. }
  67712. return [];
  67713. },
  67714. removeElement: function(el) {
  67715. this.removeCallback(el);
  67716. },
  67717. addElement: function(el) {
  67718. this.addCallback(el);
  67719. },
  67720. elementChanged: function(el, oldValue) {
  67721. this.changedCallback(el, oldValue);
  67722. },
  67723. concatLists: function(accum, list) {
  67724. return accum.concat(toArray(list));
  67725. },
  67726. // register all touch-action = none nodes on document load
  67727. installOnLoad: function() {
  67728. document.addEventListener('readystatechange', function() {
  67729. if (document.readyState === 'complete') {
  67730. this.installNewSubtree(document);
  67731. }
  67732. }.bind(this));
  67733. },
  67734. isElement: function(n) {
  67735. return n.nodeType === Node.ELEMENT_NODE;
  67736. },
  67737. flattenMutationTree: function(inNodes) {
  67738. // find children with touch-action
  67739. var tree = map(inNodes, this.findElements, this);
  67740. // make sure the added nodes are accounted for
  67741. tree.push(filter(inNodes, this.isElement));
  67742. // flatten the list
  67743. return tree.reduce(this.concatLists, []);
  67744. },
  67745. mutationWatcher: function(mutations) {
  67746. mutations.forEach(this.mutationHandler, this);
  67747. },
  67748. mutationHandler: function(m) {
  67749. if (m.type === 'childList') {
  67750. var added = this.flattenMutationTree(m.addedNodes);
  67751. added.forEach(this.addElement, this);
  67752. var removed = this.flattenMutationTree(m.removedNodes);
  67753. removed.forEach(this.removeElement, this);
  67754. } else if (m.type === 'attributes') {
  67755. this.elementChanged(m.target, m.oldValue);
  67756. }
  67757. }
  67758. };
  67759. function shadowSelector(s) {
  67760. return 'body /shadow-deep/ ' + s;
  67761. }
  67762. function rule(v) {
  67763. return '{ -ms-touch-action: ' + v + '; touch-action: ' + v + '; }';
  67764. }
  67765. var attrib2css = [
  67766. { selector: '[touch-action="none"]', value: 'none' },
  67767. { selector: '[touch-action="auto"]', value: 'auto' },
  67768. { selector: '[touch-action~="pan-x"]', value: 'pan-x' },
  67769. { selector: '[touch-action~="pan-y"]', value: 'pan-y' },
  67770. { selector: '[touch-action~="pan-up"]', value: 'pan-up' },
  67771. { selector: '[touch-action~="pan-down"]', value: 'pan-down' },
  67772. { selector: '[touch-action~="pan-left"]', value: 'pan-left' },
  67773. { selector: '[touch-action~="pan-right"]', value: 'pan-right' }
  67774. ];
  67775. var styles = '';
  67776. // only install stylesheet if the browser has touch action support
  67777. var hasNativePE = window.PointerEvent || window.MSPointerEvent;
  67778. // only add shadow selectors if shadowdom is supported
  67779. var hasShadowRoot = !window.ShadowDOMPolyfill && document.head.createShadowRoot;
  67780. function applyAttributeStyles() {
  67781. if (hasNativePE) {
  67782. attrib2css.forEach(function(r) {
  67783. styles += r.selector + rule(r.value) + '\n';
  67784. if (hasShadowRoot) {
  67785. styles += shadowSelector(r.selector) + rule(r.value) + '\n';
  67786. }
  67787. });
  67788. var el = document.createElement('style');
  67789. el.textContent = styles;
  67790. document.head.appendChild(el);
  67791. }
  67792. }
  67793. var pointermap = dispatcher.pointermap;
  67794. // radius around touchend that swallows mouse events
  67795. var DEDUP_DIST = 25;
  67796. // left, middle, right, back, forward
  67797. var BUTTON_TO_BUTTONS = [1, 4, 2, 8, 16];
  67798. var HAS_BUTTONS = false;
  67799. try {
  67800. HAS_BUTTONS = new MouseEvent('test', { buttons: 1 }).buttons === 1;
  67801. } catch (e) {}
  67802. // handler block for native mouse events
  67803. var mouseEvents = {
  67804. POINTER_ID: 1,
  67805. POINTER_TYPE: 'mouse',
  67806. events: [
  67807. 'mousedown',
  67808. 'webkitmouseforcechanged',
  67809. 'mousemove',
  67810. 'mouseup',
  67811. 'mouseover',
  67812. 'mouseout'
  67813. ],
  67814. register: function(target) {
  67815. dispatcher.listen(target, this.events);
  67816. },
  67817. unregister: function(target) {
  67818. dispatcher.unlisten(target, this.events);
  67819. },
  67820. lastTouches: [],
  67821. // collide with the global mouse listener
  67822. isEventSimulatedFromTouch: function(inEvent) {
  67823. var lts = this.lastTouches;
  67824. var x = inEvent.clientX;
  67825. var y = inEvent.clientY;
  67826. for (var i = 0, l = lts.length, t; i < l && (t = lts[i]); i++) {
  67827. // simulated mouse events will be swallowed near a primary touchend
  67828. var dx = Math.abs(x - t.x);
  67829. var dy = Math.abs(y - t.y);
  67830. if (dx <= DEDUP_DIST && dy <= DEDUP_DIST) {
  67831. return true;
  67832. }
  67833. }
  67834. },
  67835. prepareEvent: function(inEvent) {
  67836. var e = dispatcher.cloneEvent(inEvent);
  67837. // forward mouse preventDefault
  67838. var pd = e.preventDefault;
  67839. e.preventDefault = function() {
  67840. inEvent.preventDefault();
  67841. pd();
  67842. };
  67843. e.pointerId = this.POINTER_ID;
  67844. e.isPrimary = true;
  67845. e.pointerType = this.POINTER_TYPE;
  67846. if ('webkitForce' in inEvent) {
  67847. e.pressure = inEvent.webkitForce - MouseEvent.WEBKIT_FORCE_AT_MOUSE_DOWN;
  67848. }
  67849. return e;
  67850. },
  67851. prepareButtonsForMove: function(e, inEvent) {
  67852. var p = pointermap.get(this.POINTER_ID);
  67853. // Update buttons state after possible out-of-document mouseup.
  67854. if (inEvent.which === 0 || !p) {
  67855. e.buttons = 0;
  67856. } else {
  67857. e.buttons = p.buttons;
  67858. }
  67859. inEvent.buttons = e.buttons;
  67860. },
  67861. mousedown: function(inEvent) {
  67862. if (!this.isEventSimulatedFromTouch(inEvent)) {
  67863. var p = pointermap.get(this.POINTER_ID);
  67864. var e = this.prepareEvent(inEvent);
  67865. if (!HAS_BUTTONS) {
  67866. e.buttons = BUTTON_TO_BUTTONS[e.button];
  67867. if (p) { e.buttons |= p.buttons; }
  67868. inEvent.buttons = e.buttons;
  67869. }
  67870. pointermap.set(this.POINTER_ID, inEvent);
  67871. if (!p || p.buttons === 0) {
  67872. dispatcher.down(e);
  67873. } else {
  67874. dispatcher.move(e);
  67875. }
  67876. }
  67877. },
  67878. // This is called when the user force presses without moving x/y
  67879. webkitmouseforcechanged: function(inEvent) {
  67880. this.mousemove(inEvent);
  67881. },
  67882. mousemove: function(inEvent) {
  67883. if (!this.isEventSimulatedFromTouch(inEvent)) {
  67884. var e = this.prepareEvent(inEvent);
  67885. if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
  67886. e.button = -1;
  67887. pointermap.set(this.POINTER_ID, inEvent);
  67888. dispatcher.move(e);
  67889. }
  67890. },
  67891. mouseup: function(inEvent) {
  67892. if (!this.isEventSimulatedFromTouch(inEvent)) {
  67893. var p = pointermap.get(this.POINTER_ID);
  67894. var e = this.prepareEvent(inEvent);
  67895. if (!HAS_BUTTONS) {
  67896. var up = BUTTON_TO_BUTTONS[e.button];
  67897. // Produces wrong state of buttons in Browsers without `buttons` support
  67898. // when a mouse button that was pressed outside the document is released
  67899. // inside and other buttons are still pressed down.
  67900. e.buttons = p ? p.buttons & ~up : 0;
  67901. inEvent.buttons = e.buttons;
  67902. }
  67903. pointermap.set(this.POINTER_ID, inEvent);
  67904. // Support: Firefox <=44 only
  67905. // FF Ubuntu includes the lifted button in the `buttons` property on
  67906. // mouseup.
  67907. // https://bugzilla.mozilla.org/show_bug.cgi?id=1223366
  67908. e.buttons &= ~BUTTON_TO_BUTTONS[e.button];
  67909. if (e.buttons === 0) {
  67910. dispatcher.up(e);
  67911. } else {
  67912. dispatcher.move(e);
  67913. }
  67914. }
  67915. },
  67916. mouseover: function(inEvent) {
  67917. if (!this.isEventSimulatedFromTouch(inEvent)) {
  67918. var e = this.prepareEvent(inEvent);
  67919. if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
  67920. e.button = -1;
  67921. pointermap.set(this.POINTER_ID, inEvent);
  67922. dispatcher.enterOver(e);
  67923. }
  67924. },
  67925. mouseout: function(inEvent) {
  67926. if (!this.isEventSimulatedFromTouch(inEvent)) {
  67927. var e = this.prepareEvent(inEvent);
  67928. if (!HAS_BUTTONS) { this.prepareButtonsForMove(e, inEvent); }
  67929. e.button = -1;
  67930. dispatcher.leaveOut(e);
  67931. }
  67932. },
  67933. cancel: function(inEvent) {
  67934. var e = this.prepareEvent(inEvent);
  67935. dispatcher.cancel(e);
  67936. this.deactivateMouse();
  67937. },
  67938. deactivateMouse: function() {
  67939. pointermap.delete(this.POINTER_ID);
  67940. }
  67941. };
  67942. var captureInfo = dispatcher.captureInfo;
  67943. var findTarget = targeting.findTarget.bind(targeting);
  67944. var allShadows = targeting.allShadows.bind(targeting);
  67945. var pointermap$1 = dispatcher.pointermap;
  67946. // this should be long enough to ignore compat mouse events made by touch
  67947. var DEDUP_TIMEOUT = 2500;
  67948. var ATTRIB = 'touch-action';
  67949. var INSTALLER;
  67950. // bitmask for _scrollType
  67951. var UP = 1;
  67952. var DOWN = 2;
  67953. var LEFT = 4;
  67954. var RIGHT = 8;
  67955. var AUTO = UP | DOWN | LEFT | RIGHT;
  67956. // handler block for native touch events
  67957. var touchEvents = {
  67958. events: [
  67959. 'touchstart',
  67960. 'touchmove',
  67961. 'touchforcechange',
  67962. 'touchend',
  67963. 'touchcancel'
  67964. ],
  67965. register: function(target) {
  67966. INSTALLER.enableOnSubtree(target);
  67967. },
  67968. unregister: function() {
  67969. // TODO(dfreedman): is it worth it to disconnect the MO?
  67970. },
  67971. elementAdded: function(el) {
  67972. var a = el.getAttribute(ATTRIB);
  67973. var st = this.touchActionToScrollType(a);
  67974. if (typeof st === "number") {
  67975. el._scrollType = st;
  67976. dispatcher.listen(el, this.events);
  67977. // set touch-action on shadows as well
  67978. allShadows(el).forEach(function(s) {
  67979. s._scrollType = st;
  67980. dispatcher.listen(s, this.events);
  67981. }, this);
  67982. }
  67983. },
  67984. elementRemoved: function(el) {
  67985. // In some cases, an element is removed before a touchend.
  67986. // When this is the case, we should wait for the touchend before unlistening,
  67987. // because we still want pointer events to bubble up after removing from DOM.
  67988. if (pointermap$1.size > 0) {
  67989. var evts = this.events;
  67990. el.addEventListener('touchend', function() {
  67991. el._scrollType = undefined;
  67992. dispatcher.unlisten(el, evts);
  67993. });
  67994. } else {
  67995. el._scrollType = undefined;
  67996. dispatcher.unlisten(el, this.events);
  67997. }
  67998. // remove touch-action from shadow
  67999. allShadows(el).forEach(function(s) {
  68000. s._scrollType = undefined;
  68001. dispatcher.unlisten(s, this.events);
  68002. }, this);
  68003. },
  68004. elementChanged: function(el, oldValue) {
  68005. var a = el.getAttribute(ATTRIB);
  68006. var st = this.touchActionToScrollType(a);
  68007. var oldSt = this.touchActionToScrollType(oldValue);
  68008. // simply update scrollType if listeners are already established
  68009. if (typeof st === "number" && typeof oldSt === "number") {
  68010. el._scrollType = st;
  68011. allShadows(el).forEach(function(s) {
  68012. s._scrollType = st;
  68013. }, this);
  68014. } else if (typeof oldSt === "number") {
  68015. this.elementRemoved(el);
  68016. } else if (typeof st === "number") {
  68017. this.elementAdded(el);
  68018. }
  68019. },
  68020. scrollTypes: {
  68021. UP: function(s) {
  68022. return s.includes('pan-y') || s.includes('pan-up') ? UP : 0;
  68023. },
  68024. DOWN: function(s) {
  68025. return s.includes('pan-y') || s.includes('pan-down') ? DOWN : 0;
  68026. },
  68027. LEFT: function(s) {
  68028. return s.includes('pan-x') || s.includes('pan-left') ? LEFT : 0;
  68029. },
  68030. RIGHT: function(s) {
  68031. return s.includes('pan-x') || s.includes('pan-right') ? RIGHT : 0;
  68032. }
  68033. },
  68034. touchActionToScrollType: function(touchAction) {
  68035. if (!touchAction) {
  68036. return;
  68037. }
  68038. if (touchAction === "auto") {
  68039. return AUTO;
  68040. }
  68041. if (touchAction === "none") {
  68042. return 0;
  68043. }
  68044. var s = touchAction.split(' ');
  68045. var st = this.scrollTypes;
  68046. // construct a bitmask of allowed scroll directions
  68047. return st.UP(s) | st.DOWN(s) | st.LEFT(s) | st.RIGHT(s);
  68048. },
  68049. POINTER_TYPE: 'touch',
  68050. firstTouch: null,
  68051. isPrimaryTouch: function(inTouch) {
  68052. return this.firstTouch === inTouch.identifier;
  68053. },
  68054. setPrimaryTouch: function(inTouch) {
  68055. // set primary touch if there no pointers, or the only pointer is the mouse
  68056. if (pointermap$1.size === 0 || (pointermap$1.size === 1 && pointermap$1.has(1))) {
  68057. this.firstTouch = inTouch.identifier;
  68058. this.firstXY = { X: inTouch.clientX, Y: inTouch.clientY };
  68059. this.scrolling = false;
  68060. }
  68061. },
  68062. removePrimaryPointer: function(inPointer) {
  68063. if (inPointer.isPrimary) {
  68064. this.firstTouch = null;
  68065. this.firstXY = null;
  68066. }
  68067. },
  68068. typeToButtons: function(type) {
  68069. var ret = 0;
  68070. if (type === 'touchstart' || type === 'touchmove' || type === 'touchforcechange') {
  68071. ret = 1;
  68072. }
  68073. return ret;
  68074. },
  68075. touchToPointer: function(inTouch) {
  68076. var cte = this.currentTouchEvent;
  68077. var e = dispatcher.cloneEvent(inTouch);
  68078. // We reserve pointerId 1 for Mouse.
  68079. // Touch identifiers can start at 0.
  68080. // Add 2 to the touch identifier for compatibility.
  68081. var id = e.pointerId = inTouch.identifier + 2;
  68082. e.target = captureInfo[id] || findTarget(e);
  68083. e.bubbles = true;
  68084. e.cancelable = true;
  68085. e.button = 0;
  68086. e.buttons = this.typeToButtons(cte.type);
  68087. e.width = (inTouch.radiusX || inTouch.webkitRadiusX || 0) * 2;
  68088. e.height = (inTouch.radiusY || inTouch.webkitRadiusY || 0) * 2;
  68089. e.pressure = inTouch.force !== undefined ?
  68090. inTouch.force :
  68091. inTouch.webkitForce !== undefined ?
  68092. inTouch.webkitForce : undefined;
  68093. e.isPrimary = this.isPrimaryTouch(inTouch);
  68094. if (inTouch.altitudeAngle) {
  68095. const tan = Math.tan(inTouch.altitudeAngle);
  68096. const radToDeg = 180 / Math.PI;
  68097. e.tiltX = Math.atan(Math.cos(inTouch.azimuthAngle) / tan) * radToDeg;
  68098. e.tiltY = Math.atan(Math.sin(inTouch.azimuthAngle) / tan) * radToDeg;
  68099. } else {
  68100. e.tiltX = 0;
  68101. e.tiltY = 0;
  68102. }
  68103. if (inTouch.touchType === 'stylus') {
  68104. e.pointerType = 'pen';
  68105. } else {
  68106. e.pointerType = this.POINTER_TYPE;
  68107. }
  68108. // forward modifier keys
  68109. e.altKey = cte.altKey;
  68110. e.ctrlKey = cte.ctrlKey;
  68111. e.metaKey = cte.metaKey;
  68112. e.shiftKey = cte.shiftKey;
  68113. // forward touch preventDefaults
  68114. var self = this;
  68115. e.preventDefault = function() {
  68116. self.scrolling = false;
  68117. self.firstXY = null;
  68118. cte.preventDefault();
  68119. };
  68120. return e;
  68121. },
  68122. processTouches: function(inEvent, inFunction) {
  68123. var tl = inEvent.changedTouches;
  68124. this.currentTouchEvent = inEvent;
  68125. for (var i = 0, t; i < tl.length; i++) {
  68126. t = tl[i];
  68127. inFunction.call(this, this.touchToPointer(t));
  68128. }
  68129. },
  68130. // For single axis scrollers, determines whether the element should emit
  68131. // pointer events or behave as a scroller
  68132. shouldScroll: function(inEvent) {
  68133. if (this.firstXY) {
  68134. var ret;
  68135. var st = inEvent.currentTarget._scrollType;
  68136. if (st === 0) {
  68137. // this element is a `touch-action: none`, should never scroll
  68138. ret = false;
  68139. } else if (st === AUTO) {
  68140. // this element is a `touch-action: auto`, should always scroll
  68141. ret = true;
  68142. } else {
  68143. var t = inEvent.changedTouches[0];
  68144. var dy = t.clientY - this.firstXY.Y;
  68145. var dya = Math.abs(dy);
  68146. var dx = t.clientX - this.firstXY.X;
  68147. var dxa = Math.abs(dx);
  68148. var up = st & UP;
  68149. var down = st & DOWN;
  68150. var left = st & LEFT;
  68151. var right = st & RIGHT;
  68152. if (left && right) {
  68153. // should scroll on the x axis
  68154. ret = dxa > dya;
  68155. } else if (left) {
  68156. // should scroll left
  68157. ret = dxa > dya && dx > 0;
  68158. } else if (right) {
  68159. // should scroll right
  68160. ret = dxa > dya && dx < 0;
  68161. }
  68162. if (!ret) {
  68163. if (up && down) {
  68164. // should scroll on the y axis
  68165. ret = dxa < dya;
  68166. } else if (up) {
  68167. // should scroll up
  68168. ret = dxa < dya && dy > 0;
  68169. } else if (down) {
  68170. // should scroll down
  68171. ret = dxa < dya && dy < 0;
  68172. }
  68173. }
  68174. }
  68175. this.firstXY = null;
  68176. return ret;
  68177. }
  68178. },
  68179. findTouch: function(inTL, inId) {
  68180. for (var i = 0, l = inTL.length, t; i < l && (t = inTL[i]); i++) {
  68181. if (t.identifier === inId) {
  68182. return true;
  68183. }
  68184. }
  68185. },
  68186. // In some instances, a touchstart can happen without a touchend. This
  68187. // leaves the pointermap in a broken state.
  68188. // Therefore, on every touchstart, we remove the touches that did not fire a
  68189. // touchend event.
  68190. // To keep state globally consistent, we fire a
  68191. // pointercancel for this "abandoned" touch
  68192. vacuumTouches: function(inEvent) {
  68193. var tl = inEvent.touches;
  68194. // pointermap.size should be < tl.length here, as the touchstart has not
  68195. // been processed yet.
  68196. if (pointermap$1.size >= tl.length) {
  68197. var d = [];
  68198. pointermap$1.forEach(function(value, key) {
  68199. // Never remove pointerId == 1, which is mouse.
  68200. // Touch identifiers are 2 smaller than their pointerId, which is the
  68201. // index in pointermap.
  68202. if (key !== 1 && !this.findTouch(tl, key - 2)) {
  68203. var p = value.out;
  68204. d.push(p);
  68205. }
  68206. }, this);
  68207. d.forEach(this.cancelOut, this);
  68208. }
  68209. },
  68210. touchstart: function(inEvent) {
  68211. this.vacuumTouches(inEvent);
  68212. this.setPrimaryTouch(inEvent.changedTouches[0]);
  68213. this.dedupSynthMouse(inEvent);
  68214. if (!this.scrolling) {
  68215. this.processTouches(inEvent, this.overDown);
  68216. }
  68217. },
  68218. overDown: function(inPointer) {
  68219. pointermap$1.set(inPointer.pointerId, {
  68220. target: inPointer.target,
  68221. out: inPointer,
  68222. outTarget: inPointer.target
  68223. });
  68224. dispatcher.enterOver(inPointer);
  68225. dispatcher.down(inPointer);
  68226. },
  68227. // Called when pressure or tilt changes without the x/y changing
  68228. touchforcechange: function(inEvent) {
  68229. this.touchmove(inEvent);
  68230. },
  68231. touchmove: function(inEvent) {
  68232. if (!this.scrolling) {
  68233. if (this.shouldScroll(inEvent)) {
  68234. this.scrolling = true;
  68235. this.touchcancel(inEvent);
  68236. } else {
  68237. inEvent.preventDefault();
  68238. this.processTouches(inEvent, this.moveOverOut);
  68239. }
  68240. }
  68241. },
  68242. moveOverOut: function(inPointer) {
  68243. var event = inPointer;
  68244. var pointer = pointermap$1.get(event.pointerId);
  68245. // a finger drifted off the screen, ignore it
  68246. if (!pointer) {
  68247. return;
  68248. }
  68249. var outEvent = pointer.out;
  68250. var outTarget = pointer.outTarget;
  68251. dispatcher.move(event);
  68252. if (outEvent && outTarget !== event.target) {
  68253. outEvent.relatedTarget = event.target;
  68254. event.relatedTarget = outTarget;
  68255. // recover from retargeting by shadow
  68256. outEvent.target = outTarget;
  68257. if (event.target) {
  68258. dispatcher.leaveOut(outEvent);
  68259. dispatcher.enterOver(event);
  68260. } else {
  68261. // clean up case when finger leaves the screen
  68262. event.target = outTarget;
  68263. event.relatedTarget = null;
  68264. this.cancelOut(event);
  68265. }
  68266. }
  68267. pointer.out = event;
  68268. pointer.outTarget = event.target;
  68269. },
  68270. touchend: function(inEvent) {
  68271. this.dedupSynthMouse(inEvent);
  68272. this.processTouches(inEvent, this.upOut);
  68273. },
  68274. upOut: function(inPointer) {
  68275. if (!this.scrolling) {
  68276. dispatcher.up(inPointer);
  68277. dispatcher.leaveOut(inPointer);
  68278. }
  68279. this.cleanUpPointer(inPointer);
  68280. },
  68281. touchcancel: function(inEvent) {
  68282. this.processTouches(inEvent, this.cancelOut);
  68283. },
  68284. cancelOut: function(inPointer) {
  68285. dispatcher.cancel(inPointer);
  68286. dispatcher.leaveOut(inPointer);
  68287. this.cleanUpPointer(inPointer);
  68288. },
  68289. cleanUpPointer: function(inPointer) {
  68290. pointermap$1.delete(inPointer.pointerId);
  68291. this.removePrimaryPointer(inPointer);
  68292. },
  68293. // prevent synth mouse events from creating pointer events
  68294. dedupSynthMouse: function(inEvent) {
  68295. var lts = mouseEvents.lastTouches;
  68296. var t = inEvent.changedTouches[0];
  68297. // only the primary finger will synth mouse events
  68298. if (this.isPrimaryTouch(t)) {
  68299. // remember x/y of last touch
  68300. var lt = { x: t.clientX, y: t.clientY };
  68301. lts.push(lt);
  68302. var fn = (function(lts, lt) {
  68303. var i = lts.indexOf(lt);
  68304. if (i > -1) {
  68305. lts.splice(i, 1);
  68306. }
  68307. }).bind(null, lts, lt);
  68308. setTimeout(fn, DEDUP_TIMEOUT);
  68309. }
  68310. }
  68311. };
  68312. INSTALLER = new Installer(touchEvents.elementAdded, touchEvents.elementRemoved,
  68313. touchEvents.elementChanged, touchEvents);
  68314. var pointermap$2 = dispatcher.pointermap;
  68315. var HAS_BITMAP_TYPE = window.MSPointerEvent &&
  68316. typeof window.MSPointerEvent.MSPOINTER_TYPE_MOUSE === 'number';
  68317. var msEvents = {
  68318. events: [
  68319. 'MSPointerDown',
  68320. 'MSPointerMove',
  68321. 'MSPointerUp',
  68322. 'MSPointerOut',
  68323. 'MSPointerOver',
  68324. 'MSPointerCancel',
  68325. 'MSGotPointerCapture',
  68326. 'MSLostPointerCapture'
  68327. ],
  68328. register: function(target) {
  68329. dispatcher.listen(target, this.events);
  68330. },
  68331. unregister: function(target) {
  68332. dispatcher.unlisten(target, this.events);
  68333. },
  68334. POINTER_TYPES: [
  68335. '',
  68336. 'unavailable',
  68337. 'touch',
  68338. 'pen',
  68339. 'mouse'
  68340. ],
  68341. prepareEvent: function(inEvent) {
  68342. var e = inEvent;
  68343. if (HAS_BITMAP_TYPE) {
  68344. e = dispatcher.cloneEvent(inEvent);
  68345. e.pointerType = this.POINTER_TYPES[inEvent.pointerType];
  68346. }
  68347. return e;
  68348. },
  68349. cleanup: function(id) {
  68350. pointermap$2.delete(id);
  68351. },
  68352. MSPointerDown: function(inEvent) {
  68353. pointermap$2.set(inEvent.pointerId, inEvent);
  68354. var e = this.prepareEvent(inEvent);
  68355. dispatcher.down(e);
  68356. },
  68357. MSPointerMove: function(inEvent) {
  68358. var e = this.prepareEvent(inEvent);
  68359. dispatcher.move(e);
  68360. },
  68361. MSPointerUp: function(inEvent) {
  68362. var e = this.prepareEvent(inEvent);
  68363. dispatcher.up(e);
  68364. this.cleanup(inEvent.pointerId);
  68365. },
  68366. MSPointerOut: function(inEvent) {
  68367. var e = this.prepareEvent(inEvent);
  68368. dispatcher.leaveOut(e);
  68369. },
  68370. MSPointerOver: function(inEvent) {
  68371. var e = this.prepareEvent(inEvent);
  68372. dispatcher.enterOver(e);
  68373. },
  68374. MSPointerCancel: function(inEvent) {
  68375. var e = this.prepareEvent(inEvent);
  68376. dispatcher.cancel(e);
  68377. this.cleanup(inEvent.pointerId);
  68378. },
  68379. MSLostPointerCapture: function(inEvent) {
  68380. var e = dispatcher.makeEvent('lostpointercapture', inEvent);
  68381. dispatcher.dispatchEvent(e);
  68382. },
  68383. MSGotPointerCapture: function(inEvent) {
  68384. var e = dispatcher.makeEvent('gotpointercapture', inEvent);
  68385. dispatcher.dispatchEvent(e);
  68386. }
  68387. };
  68388. function applyPolyfill() {
  68389. // only activate if this platform does not have pointer events
  68390. if (!window.PointerEvent) {
  68391. window.PointerEvent = PointerEvent;
  68392. if (window.navigator.msPointerEnabled) {
  68393. var tp = window.navigator.msMaxTouchPoints;
  68394. Object.defineProperty(window.navigator, 'maxTouchPoints', {
  68395. value: tp,
  68396. enumerable: true
  68397. });
  68398. dispatcher.registerSource('ms', msEvents);
  68399. } else {
  68400. Object.defineProperty(window.navigator, 'maxTouchPoints', {
  68401. value: 0,
  68402. enumerable: true
  68403. });
  68404. dispatcher.registerSource('mouse', mouseEvents);
  68405. if (window.ontouchstart !== undefined) {
  68406. dispatcher.registerSource('touch', touchEvents);
  68407. }
  68408. }
  68409. dispatcher.register(document);
  68410. }
  68411. }
  68412. var n = window.navigator;
  68413. var s;
  68414. var r;
  68415. var h;
  68416. function assertActive(id) {
  68417. if (!dispatcher.pointermap.has(id)) {
  68418. var error = new Error('NotFoundError');
  68419. error.name = 'NotFoundError';
  68420. throw error;
  68421. }
  68422. }
  68423. function assertConnected(elem) {
  68424. var parent = elem.parentNode;
  68425. while (parent && parent !== elem.ownerDocument) {
  68426. parent = parent.parentNode;
  68427. }
  68428. if (!parent) {
  68429. var error = new Error('InvalidStateError');
  68430. error.name = 'InvalidStateError';
  68431. throw error;
  68432. }
  68433. }
  68434. function inActiveButtonState(id) {
  68435. var p = dispatcher.pointermap.get(id);
  68436. return p.buttons !== 0;
  68437. }
  68438. if (n.msPointerEnabled) {
  68439. s = function(pointerId) {
  68440. assertActive(pointerId);
  68441. assertConnected(this);
  68442. if (inActiveButtonState(pointerId)) {
  68443. dispatcher.setCapture(pointerId, this, true);
  68444. this.msSetPointerCapture(pointerId);
  68445. }
  68446. };
  68447. r = function(pointerId) {
  68448. assertActive(pointerId);
  68449. dispatcher.releaseCapture(pointerId, true);
  68450. this.msReleasePointerCapture(pointerId);
  68451. };
  68452. } else {
  68453. s = function setPointerCapture(pointerId) {
  68454. assertActive(pointerId);
  68455. assertConnected(this);
  68456. if (inActiveButtonState(pointerId)) {
  68457. dispatcher.setCapture(pointerId, this);
  68458. }
  68459. };
  68460. r = function releasePointerCapture(pointerId) {
  68461. assertActive(pointerId);
  68462. dispatcher.releaseCapture(pointerId);
  68463. };
  68464. }
  68465. h = function hasPointerCapture(pointerId) {
  68466. return !!dispatcher.captureInfo[pointerId];
  68467. };
  68468. function applyPolyfill$1() {
  68469. if (window.Element && !Element.prototype.setPointerCapture) {
  68470. Object.defineProperties(Element.prototype, {
  68471. 'setPointerCapture': {
  68472. value: s
  68473. },
  68474. 'releasePointerCapture': {
  68475. value: r
  68476. },
  68477. 'hasPointerCapture': {
  68478. value: h
  68479. }
  68480. });
  68481. }
  68482. }
  68483. applyAttributeStyles();
  68484. applyPolyfill();
  68485. applyPolyfill$1();
  68486. var pointerevents = {
  68487. dispatcher: dispatcher,
  68488. Installer: Installer,
  68489. PointerEvent: PointerEvent,
  68490. PointerMap: PointerMap,
  68491. targetFinding: targeting
  68492. };
  68493. return pointerevents;
  68494. }));
  68495. /***/ }),
  68496. /***/ "./node_modules/qrcodejs2/qrcode.js":
  68497. /*!******************************************!*\
  68498. !*** ./node_modules/qrcodejs2/qrcode.js ***!
  68499. \******************************************/
  68500. /*! no static exports found */
  68501. /***/ (function(module, exports, __webpack_require__) {
  68502. /**
  68503. * @fileoverview
  68504. * - Using the 'QRCode for Javascript library'
  68505. * - Fixed dataset of 'QRCode for Javascript library' for support full-spec.
  68506. * - this library has no dependencies.
  68507. *
  68508. * @author davidshimjs
  68509. * @see <a href="http://www.d-project.com/" target="_blank">http://www.d-project.com/</a>
  68510. * @see <a href="http://jeromeetienne.github.com/jquery-qrcode/" target="_blank">http://jeromeetienne.github.com/jquery-qrcode/</a>
  68511. */
  68512. var QRCode;
  68513. (function (root, factory) {
  68514. /* CommonJS */
  68515. if (true) module.exports = factory()
  68516. /* AMD module */
  68517. else {}
  68518. }(this, function () { //---------------------------------------------------------------------
  68519. // QRCode for JavaScript
  68520. //
  68521. // Copyright (c) 2009 Kazuhiko Arase
  68522. //
  68523. // URL: http://www.d-project.com/
  68524. //
  68525. // Licensed under the MIT license:
  68526. // http://www.opensource.org/licenses/mit-license.php
  68527. //
  68528. // The word "QR Code" is registered trademark of
  68529. // DENSO WAVE INCORPORATED
  68530. // http://www.denso-wave.com/qrcode/faqpatent-e.html
  68531. //
  68532. //---------------------------------------------------------------------
  68533. function QR8bitByte(data) {
  68534. this.mode = QRMode.MODE_8BIT_BYTE;
  68535. this.data = data;
  68536. this.parsedData = [];
  68537. // Added to support UTF-8 Characters
  68538. for (var i = 0, l = this.data.length; i < l; i++) {
  68539. var byteArray = [];
  68540. var code = this.data.charCodeAt(i);
  68541. if (code > 0x10000) {
  68542. byteArray[0] = 0xF0 | ((code & 0x1C0000) >>> 18);
  68543. byteArray[1] = 0x80 | ((code & 0x3F000) >>> 12);
  68544. byteArray[2] = 0x80 | ((code & 0xFC0) >>> 6);
  68545. byteArray[3] = 0x80 | (code & 0x3F);
  68546. } else if (code > 0x800) {
  68547. byteArray[0] = 0xE0 | ((code & 0xF000) >>> 12);
  68548. byteArray[1] = 0x80 | ((code & 0xFC0) >>> 6);
  68549. byteArray[2] = 0x80 | (code & 0x3F);
  68550. } else if (code > 0x80) {
  68551. byteArray[0] = 0xC0 | ((code & 0x7C0) >>> 6);
  68552. byteArray[1] = 0x80 | (code & 0x3F);
  68553. } else {
  68554. byteArray[0] = code;
  68555. }
  68556. this.parsedData.push(byteArray);
  68557. }
  68558. this.parsedData = Array.prototype.concat.apply([], this.parsedData);
  68559. if (this.parsedData.length != this.data.length) {
  68560. this.parsedData.unshift(191);
  68561. this.parsedData.unshift(187);
  68562. this.parsedData.unshift(239);
  68563. }
  68564. }
  68565. QR8bitByte.prototype = {
  68566. getLength: function (buffer) {
  68567. return this.parsedData.length;
  68568. },
  68569. write: function (buffer) {
  68570. for (var i = 0, l = this.parsedData.length; i < l; i++) {
  68571. buffer.put(this.parsedData[i], 8);
  68572. }
  68573. }
  68574. };
  68575. function QRCodeModel(typeNumber, errorCorrectLevel) {
  68576. this.typeNumber = typeNumber;
  68577. this.errorCorrectLevel = errorCorrectLevel;
  68578. this.modules = null;
  68579. this.moduleCount = 0;
  68580. this.dataCache = null;
  68581. this.dataList = [];
  68582. }
  68583. QRCodeModel.prototype={addData:function(data){var newData=new QR8bitByte(data);this.dataList.push(newData);this.dataCache=null;},isDark:function(row,col){if(row<0||this.moduleCount<=row||col<0||this.moduleCount<=col){throw new Error(row+","+col);}
  68584. return this.modules[row][col];},getModuleCount:function(){return this.moduleCount;},make:function(){this.makeImpl(false,this.getBestMaskPattern());},makeImpl:function(test,maskPattern){this.moduleCount=this.typeNumber*4+17;this.modules=new Array(this.moduleCount);for(var row=0;row<this.moduleCount;row++){this.modules[row]=new Array(this.moduleCount);for(var col=0;col<this.moduleCount;col++){this.modules[row][col]=null;}}
  68585. this.setupPositionProbePattern(0,0);this.setupPositionProbePattern(this.moduleCount-7,0);this.setupPositionProbePattern(0,this.moduleCount-7);this.setupPositionAdjustPattern();this.setupTimingPattern();this.setupTypeInfo(test,maskPattern);if(this.typeNumber>=7){this.setupTypeNumber(test);}
  68586. if(this.dataCache==null){this.dataCache=QRCodeModel.createData(this.typeNumber,this.errorCorrectLevel,this.dataList);}
  68587. this.mapData(this.dataCache,maskPattern);},setupPositionProbePattern:function(row,col){for(var r=-1;r<=7;r++){if(row+r<=-1||this.moduleCount<=row+r)continue;for(var c=-1;c<=7;c++){if(col+c<=-1||this.moduleCount<=col+c)continue;if((0<=r&&r<=6&&(c==0||c==6))||(0<=c&&c<=6&&(r==0||r==6))||(2<=r&&r<=4&&2<=c&&c<=4)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}},getBestMaskPattern:function(){var minLostPoint=0;var pattern=0;for(var i=0;i<8;i++){this.makeImpl(true,i);var lostPoint=QRUtil.getLostPoint(this);if(i==0||minLostPoint>lostPoint){minLostPoint=lostPoint;pattern=i;}}
  68588. return pattern;},createMovieClip:function(target_mc,instance_name,depth){var qr_mc=target_mc.createEmptyMovieClip(instance_name,depth);var cs=1;this.make();for(var row=0;row<this.modules.length;row++){var y=row*cs;for(var col=0;col<this.modules[row].length;col++){var x=col*cs;var dark=this.modules[row][col];if(dark){qr_mc.beginFill(0,100);qr_mc.moveTo(x,y);qr_mc.lineTo(x+cs,y);qr_mc.lineTo(x+cs,y+cs);qr_mc.lineTo(x,y+cs);qr_mc.endFill();}}}
  68589. return qr_mc;},setupTimingPattern:function(){for(var r=8;r<this.moduleCount-8;r++){if(this.modules[r][6]!=null){continue;}
  68590. this.modules[r][6]=(r%2==0);}
  68591. for(var c=8;c<this.moduleCount-8;c++){if(this.modules[6][c]!=null){continue;}
  68592. this.modules[6][c]=(c%2==0);}},setupPositionAdjustPattern:function(){var pos=QRUtil.getPatternPosition(this.typeNumber);for(var i=0;i<pos.length;i++){for(var j=0;j<pos.length;j++){var row=pos[i];var col=pos[j];if(this.modules[row][col]!=null){continue;}
  68593. for(var r=-2;r<=2;r++){for(var c=-2;c<=2;c++){if(r==-2||r==2||c==-2||c==2||(r==0&&c==0)){this.modules[row+r][col+c]=true;}else{this.modules[row+r][col+c]=false;}}}}}},setupTypeNumber:function(test){var bits=QRUtil.getBCHTypeNumber(this.typeNumber);for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[Math.floor(i/3)][i%3+this.moduleCount-8-3]=mod;}
  68594. for(var i=0;i<18;i++){var mod=(!test&&((bits>>i)&1)==1);this.modules[i%3+this.moduleCount-8-3][Math.floor(i/3)]=mod;}},setupTypeInfo:function(test,maskPattern){var data=(this.errorCorrectLevel<<3)|maskPattern;var bits=QRUtil.getBCHTypeInfo(data);for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<6){this.modules[i][8]=mod;}else if(i<8){this.modules[i+1][8]=mod;}else{this.modules[this.moduleCount-15+i][8]=mod;}}
  68595. for(var i=0;i<15;i++){var mod=(!test&&((bits>>i)&1)==1);if(i<8){this.modules[8][this.moduleCount-i-1]=mod;}else if(i<9){this.modules[8][15-i-1+1]=mod;}else{this.modules[8][15-i-1]=mod;}}
  68596. this.modules[this.moduleCount-8][8]=(!test);},mapData:function(data,maskPattern){var inc=-1;var row=this.moduleCount-1;var bitIndex=7;var byteIndex=0;for(var col=this.moduleCount-1;col>0;col-=2){if(col==6)col--;while(true){for(var c=0;c<2;c++){if(this.modules[row][col-c]==null){var dark=false;if(byteIndex<data.length){dark=(((data[byteIndex]>>>bitIndex)&1)==1);}
  68597. var mask=QRUtil.getMask(maskPattern,row,col-c);if(mask){dark=!dark;}
  68598. this.modules[row][col-c]=dark;bitIndex--;if(bitIndex==-1){byteIndex++;bitIndex=7;}}}
  68599. row+=inc;if(row<0||this.moduleCount<=row){row-=inc;inc=-inc;break;}}}}};QRCodeModel.PAD0=0xEC;QRCodeModel.PAD1=0x11;QRCodeModel.createData=function(typeNumber,errorCorrectLevel,dataList){var rsBlocks=QRRSBlock.getRSBlocks(typeNumber,errorCorrectLevel);var buffer=new QRBitBuffer();for(var i=0;i<dataList.length;i++){var data=dataList[i];buffer.put(data.mode,4);buffer.put(data.getLength(),QRUtil.getLengthInBits(data.mode,typeNumber));data.write(buffer);}
  68600. var totalDataCount=0;for(var i=0;i<rsBlocks.length;i++){totalDataCount+=rsBlocks[i].dataCount;}
  68601. if(buffer.getLengthInBits()>totalDataCount*8){throw new Error("code length overflow. ("
  68602. +buffer.getLengthInBits()
  68603. +">"
  68604. +totalDataCount*8
  68605. +")");}
  68606. if(buffer.getLengthInBits()+4<=totalDataCount*8){buffer.put(0,4);}
  68607. while(buffer.getLengthInBits()%8!=0){buffer.putBit(false);}
  68608. while(true){if(buffer.getLengthInBits()>=totalDataCount*8){break;}
  68609. buffer.put(QRCodeModel.PAD0,8);if(buffer.getLengthInBits()>=totalDataCount*8){break;}
  68610. buffer.put(QRCodeModel.PAD1,8);}
  68611. return QRCodeModel.createBytes(buffer,rsBlocks);};QRCodeModel.createBytes=function(buffer,rsBlocks){var offset=0;var maxDcCount=0;var maxEcCount=0;var dcdata=new Array(rsBlocks.length);var ecdata=new Array(rsBlocks.length);for(var r=0;r<rsBlocks.length;r++){var dcCount=rsBlocks[r].dataCount;var ecCount=rsBlocks[r].totalCount-dcCount;maxDcCount=Math.max(maxDcCount,dcCount);maxEcCount=Math.max(maxEcCount,ecCount);dcdata[r]=new Array(dcCount);for(var i=0;i<dcdata[r].length;i++){dcdata[r][i]=0xff&buffer.buffer[i+offset];}
  68612. offset+=dcCount;var rsPoly=QRUtil.getErrorCorrectPolynomial(ecCount);var rawPoly=new QRPolynomial(dcdata[r],rsPoly.getLength()-1);var modPoly=rawPoly.mod(rsPoly);ecdata[r]=new Array(rsPoly.getLength()-1);for(var i=0;i<ecdata[r].length;i++){var modIndex=i+modPoly.getLength()-ecdata[r].length;ecdata[r][i]=(modIndex>=0)?modPoly.get(modIndex):0;}}
  68613. var totalCodeCount=0;for(var i=0;i<rsBlocks.length;i++){totalCodeCount+=rsBlocks[i].totalCount;}
  68614. var data=new Array(totalCodeCount);var index=0;for(var i=0;i<maxDcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<dcdata[r].length){data[index++]=dcdata[r][i];}}}
  68615. for(var i=0;i<maxEcCount;i++){for(var r=0;r<rsBlocks.length;r++){if(i<ecdata[r].length){data[index++]=ecdata[r][i];}}}
  68616. return data;};var QRMode={MODE_NUMBER:1<<0,MODE_ALPHA_NUM:1<<1,MODE_8BIT_BYTE:1<<2,MODE_KANJI:1<<3};var QRErrorCorrectLevel={L:1,M:0,Q:3,H:2};var QRMaskPattern={PATTERN000:0,PATTERN001:1,PATTERN010:2,PATTERN011:3,PATTERN100:4,PATTERN101:5,PATTERN110:6,PATTERN111:7};var QRUtil={PATTERN_POSITION_TABLE:[[],[6,18],[6,22],[6,26],[6,30],[6,34],[6,22,38],[6,24,42],[6,26,46],[6,28,50],[6,30,54],[6,32,58],[6,34,62],[6,26,46,66],[6,26,48,70],[6,26,50,74],[6,30,54,78],[6,30,56,82],[6,30,58,86],[6,34,62,90],[6,28,50,72,94],[6,26,50,74,98],[6,30,54,78,102],[6,28,54,80,106],[6,32,58,84,110],[6,30,58,86,114],[6,34,62,90,118],[6,26,50,74,98,122],[6,30,54,78,102,126],[6,26,52,78,104,130],[6,30,56,82,108,134],[6,34,60,86,112,138],[6,30,58,86,114,142],[6,34,62,90,118,146],[6,30,54,78,102,126,150],[6,24,50,76,102,128,154],[6,28,54,80,106,132,158],[6,32,58,84,110,136,162],[6,26,54,82,110,138,166],[6,30,58,86,114,142,170]],G15:(1<<10)|(1<<8)|(1<<5)|(1<<4)|(1<<2)|(1<<1)|(1<<0),G18:(1<<12)|(1<<11)|(1<<10)|(1<<9)|(1<<8)|(1<<5)|(1<<2)|(1<<0),G15_MASK:(1<<14)|(1<<12)|(1<<10)|(1<<4)|(1<<1),getBCHTypeInfo:function(data){var d=data<<10;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)>=0){d^=(QRUtil.G15<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G15)));}
  68617. return((data<<10)|d)^QRUtil.G15_MASK;},getBCHTypeNumber:function(data){var d=data<<12;while(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)>=0){d^=(QRUtil.G18<<(QRUtil.getBCHDigit(d)-QRUtil.getBCHDigit(QRUtil.G18)));}
  68618. return(data<<12)|d;},getBCHDigit:function(data){var digit=0;while(data!=0){digit++;data>>>=1;}
  68619. return digit;},getPatternPosition:function(typeNumber){return QRUtil.PATTERN_POSITION_TABLE[typeNumber-1];},getMask:function(maskPattern,i,j){switch(maskPattern){case QRMaskPattern.PATTERN000:return(i+j)%2==0;case QRMaskPattern.PATTERN001:return i%2==0;case QRMaskPattern.PATTERN010:return j%3==0;case QRMaskPattern.PATTERN011:return(i+j)%3==0;case QRMaskPattern.PATTERN100:return(Math.floor(i/2)+Math.floor(j/3))%2==0;case QRMaskPattern.PATTERN101:return(i*j)%2+(i*j)%3==0;case QRMaskPattern.PATTERN110:return((i*j)%2+(i*j)%3)%2==0;case QRMaskPattern.PATTERN111:return((i*j)%3+(i+j)%2)%2==0;default:throw new Error("bad maskPattern:"+maskPattern);}},getErrorCorrectPolynomial:function(errorCorrectLength){var a=new QRPolynomial([1],0);for(var i=0;i<errorCorrectLength;i++){a=a.multiply(new QRPolynomial([1,QRMath.gexp(i)],0));}
  68620. return a;},getLengthInBits:function(mode,type){if(1<=type&&type<10){switch(mode){case QRMode.MODE_NUMBER:return 10;case QRMode.MODE_ALPHA_NUM:return 9;case QRMode.MODE_8BIT_BYTE:return 8;case QRMode.MODE_KANJI:return 8;default:throw new Error("mode:"+mode);}}else if(type<27){switch(mode){case QRMode.MODE_NUMBER:return 12;case QRMode.MODE_ALPHA_NUM:return 11;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 10;default:throw new Error("mode:"+mode);}}else if(type<41){switch(mode){case QRMode.MODE_NUMBER:return 14;case QRMode.MODE_ALPHA_NUM:return 13;case QRMode.MODE_8BIT_BYTE:return 16;case QRMode.MODE_KANJI:return 12;default:throw new Error("mode:"+mode);}}else{throw new Error("type:"+type);}},getLostPoint:function(qrCode){var moduleCount=qrCode.getModuleCount();var lostPoint=0;for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount;col++){var sameCount=0;var dark=qrCode.isDark(row,col);for(var r=-1;r<=1;r++){if(row+r<0||moduleCount<=row+r){continue;}
  68621. for(var c=-1;c<=1;c++){if(col+c<0||moduleCount<=col+c){continue;}
  68622. if(r==0&&c==0){continue;}
  68623. if(dark==qrCode.isDark(row+r,col+c)){sameCount++;}}}
  68624. if(sameCount>5){lostPoint+=(3+sameCount-5);}}}
  68625. for(var row=0;row<moduleCount-1;row++){for(var col=0;col<moduleCount-1;col++){var count=0;if(qrCode.isDark(row,col))count++;if(qrCode.isDark(row+1,col))count++;if(qrCode.isDark(row,col+1))count++;if(qrCode.isDark(row+1,col+1))count++;if(count==0||count==4){lostPoint+=3;}}}
  68626. for(var row=0;row<moduleCount;row++){for(var col=0;col<moduleCount-6;col++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row,col+1)&&qrCode.isDark(row,col+2)&&qrCode.isDark(row,col+3)&&qrCode.isDark(row,col+4)&&!qrCode.isDark(row,col+5)&&qrCode.isDark(row,col+6)){lostPoint+=40;}}}
  68627. for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount-6;row++){if(qrCode.isDark(row,col)&&!qrCode.isDark(row+1,col)&&qrCode.isDark(row+2,col)&&qrCode.isDark(row+3,col)&&qrCode.isDark(row+4,col)&&!qrCode.isDark(row+5,col)&&qrCode.isDark(row+6,col)){lostPoint+=40;}}}
  68628. var darkCount=0;for(var col=0;col<moduleCount;col++){for(var row=0;row<moduleCount;row++){if(qrCode.isDark(row,col)){darkCount++;}}}
  68629. var ratio=Math.abs(100*darkCount/moduleCount/moduleCount-50)/5;lostPoint+=ratio*10;return lostPoint;}};var QRMath={glog:function(n){if(n<1){throw new Error("glog("+n+")");}
  68630. return QRMath.LOG_TABLE[n];},gexp:function(n){while(n<0){n+=255;}
  68631. while(n>=256){n-=255;}
  68632. return QRMath.EXP_TABLE[n];},EXP_TABLE:new Array(256),LOG_TABLE:new Array(256)};for(var i=0;i<8;i++){QRMath.EXP_TABLE[i]=1<<i;}
  68633. for(var i=8;i<256;i++){QRMath.EXP_TABLE[i]=QRMath.EXP_TABLE[i-4]^QRMath.EXP_TABLE[i-5]^QRMath.EXP_TABLE[i-6]^QRMath.EXP_TABLE[i-8];}
  68634. for(var i=0;i<255;i++){QRMath.LOG_TABLE[QRMath.EXP_TABLE[i]]=i;}
  68635. function QRPolynomial(num,shift){if(num.length==undefined){throw new Error(num.length+"/"+shift);}
  68636. var offset=0;while(offset<num.length&&num[offset]==0){offset++;}
  68637. this.num=new Array(num.length-offset+shift);for(var i=0;i<num.length-offset;i++){this.num[i]=num[i+offset];}}
  68638. QRPolynomial.prototype={get:function(index){return this.num[index];},getLength:function(){return this.num.length;},multiply:function(e){var num=new Array(this.getLength()+e.getLength()-1);for(var i=0;i<this.getLength();i++){for(var j=0;j<e.getLength();j++){num[i+j]^=QRMath.gexp(QRMath.glog(this.get(i))+QRMath.glog(e.get(j)));}}
  68639. return new QRPolynomial(num,0);},mod:function(e){if(this.getLength()-e.getLength()<0){return this;}
  68640. var ratio=QRMath.glog(this.get(0))-QRMath.glog(e.get(0));var num=new Array(this.getLength());for(var i=0;i<this.getLength();i++){num[i]=this.get(i);}
  68641. for(var i=0;i<e.getLength();i++){num[i]^=QRMath.gexp(QRMath.glog(e.get(i))+ratio);}
  68642. return new QRPolynomial(num,0).mod(e);}};function QRRSBlock(totalCount,dataCount){this.totalCount=totalCount;this.dataCount=dataCount;}
  68643. QRRSBlock.RS_BLOCK_TABLE=[[1,26,19],[1,26,16],[1,26,13],[1,26,9],[1,44,34],[1,44,28],[1,44,22],[1,44,16],[1,70,55],[1,70,44],[2,35,17],[2,35,13],[1,100,80],[2,50,32],[2,50,24],[4,25,9],[1,134,108],[2,67,43],[2,33,15,2,34,16],[2,33,11,2,34,12],[2,86,68],[4,43,27],[4,43,19],[4,43,15],[2,98,78],[4,49,31],[2,32,14,4,33,15],[4,39,13,1,40,14],[2,121,97],[2,60,38,2,61,39],[4,40,18,2,41,19],[4,40,14,2,41,15],[2,146,116],[3,58,36,2,59,37],[4,36,16,4,37,17],[4,36,12,4,37,13],[2,86,68,2,87,69],[4,69,43,1,70,44],[6,43,19,2,44,20],[6,43,15,2,44,16],[4,101,81],[1,80,50,4,81,51],[4,50,22,4,51,23],[3,36,12,8,37,13],[2,116,92,2,117,93],[6,58,36,2,59,37],[4,46,20,6,47,21],[7,42,14,4,43,15],[4,133,107],[8,59,37,1,60,38],[8,44,20,4,45,21],[12,33,11,4,34,12],[3,145,115,1,146,116],[4,64,40,5,65,41],[11,36,16,5,37,17],[11,36,12,5,37,13],[5,109,87,1,110,88],[5,65,41,5,66,42],[5,54,24,7,55,25],[11,36,12],[5,122,98,1,123,99],[7,73,45,3,74,46],[15,43,19,2,44,20],[3,45,15,13,46,16],[1,135,107,5,136,108],[10,74,46,1,75,47],[1,50,22,15,51,23],[2,42,14,17,43,15],[5,150,120,1,151,121],[9,69,43,4,70,44],[17,50,22,1,51,23],[2,42,14,19,43,15],[3,141,113,4,142,114],[3,70,44,11,71,45],[17,47,21,4,48,22],[9,39,13,16,40,14],[3,135,107,5,136,108],[3,67,41,13,68,42],[15,54,24,5,55,25],[15,43,15,10,44,16],[4,144,116,4,145,117],[17,68,42],[17,50,22,6,51,23],[19,46,16,6,47,17],[2,139,111,7,140,112],[17,74,46],[7,54,24,16,55,25],[34,37,13],[4,151,121,5,152,122],[4,75,47,14,76,48],[11,54,24,14,55,25],[16,45,15,14,46,16],[6,147,117,4,148,118],[6,73,45,14,74,46],[11,54,24,16,55,25],[30,46,16,2,47,17],[8,132,106,4,133,107],[8,75,47,13,76,48],[7,54,24,22,55,25],[22,45,15,13,46,16],[10,142,114,2,143,115],[19,74,46,4,75,47],[28,50,22,6,51,23],[33,46,16,4,47,17],[8,152,122,4,153,123],[22,73,45,3,74,46],[8,53,23,26,54,24],[12,45,15,28,46,16],[3,147,117,10,148,118],[3,73,45,23,74,46],[4,54,24,31,55,25],[11,45,15,31,46,16],[7,146,116,7,147,117],[21,73,45,7,74,46],[1,53,23,37,54,24],[19,45,15,26,46,16],[5,145,115,10,146,116],[19,75,47,10,76,48],[15,54,24,25,55,25],[23,45,15,25,46,16],[13,145,115,3,146,116],[2,74,46,29,75,47],[42,54,24,1,55,25],[23,45,15,28,46,16],[17,145,115],[10,74,46,23,75,47],[10,54,24,35,55,25],[19,45,15,35,46,16],[17,145,115,1,146,116],[14,74,46,21,75,47],[29,54,24,19,55,25],[11,45,15,46,46,16],[13,145,115,6,146,116],[14,74,46,23,75,47],[44,54,24,7,55,25],[59,46,16,1,47,17],[12,151,121,7,152,122],[12,75,47,26,76,48],[39,54,24,14,55,25],[22,45,15,41,46,16],[6,151,121,14,152,122],[6,75,47,34,76,48],[46,54,24,10,55,25],[2,45,15,64,46,16],[17,152,122,4,153,123],[29,74,46,14,75,47],[49,54,24,10,55,25],[24,45,15,46,46,16],[4,152,122,18,153,123],[13,74,46,32,75,47],[48,54,24,14,55,25],[42,45,15,32,46,16],[20,147,117,4,148,118],[40,75,47,7,76,48],[43,54,24,22,55,25],[10,45,15,67,46,16],[19,148,118,6,149,119],[18,75,47,31,76,48],[34,54,24,34,55,25],[20,45,15,61,46,16]];QRRSBlock.getRSBlocks=function(typeNumber,errorCorrectLevel){var rsBlock=QRRSBlock.getRsBlockTable(typeNumber,errorCorrectLevel);if(rsBlock==undefined){throw new Error("bad rs block @ typeNumber:"+typeNumber+"/errorCorrectLevel:"+errorCorrectLevel);}
  68644. var length=rsBlock.length/3;var list=[];for(var i=0;i<length;i++){var count=rsBlock[i*3+0];var totalCount=rsBlock[i*3+1];var dataCount=rsBlock[i*3+2];for(var j=0;j<count;j++){list.push(new QRRSBlock(totalCount,dataCount));}}
  68645. return list;};QRRSBlock.getRsBlockTable=function(typeNumber,errorCorrectLevel){switch(errorCorrectLevel){case QRErrorCorrectLevel.L:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+0];case QRErrorCorrectLevel.M:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+1];case QRErrorCorrectLevel.Q:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+2];case QRErrorCorrectLevel.H:return QRRSBlock.RS_BLOCK_TABLE[(typeNumber-1)*4+3];default:return undefined;}};function QRBitBuffer(){this.buffer=[];this.length=0;}
  68646. QRBitBuffer.prototype={get:function(index){var bufIndex=Math.floor(index/8);return((this.buffer[bufIndex]>>>(7-index%8))&1)==1;},put:function(num,length){for(var i=0;i<length;i++){this.putBit(((num>>>(length-i-1))&1)==1);}},getLengthInBits:function(){return this.length;},putBit:function(bit){var bufIndex=Math.floor(this.length/8);if(this.buffer.length<=bufIndex){this.buffer.push(0);}
  68647. if(bit){this.buffer[bufIndex]|=(0x80>>>(this.length%8));}
  68648. this.length++;}};var QRCodeLimitLength=[[17,14,11,7],[32,26,20,14],[53,42,32,24],[78,62,46,34],[106,84,60,44],[134,106,74,58],[154,122,86,64],[192,152,108,84],[230,180,130,98],[271,213,151,119],[321,251,177,137],[367,287,203,155],[425,331,241,177],[458,362,258,194],[520,412,292,220],[586,450,322,250],[644,504,364,280],[718,560,394,310],[792,624,442,338],[858,666,482,382],[929,711,509,403],[1003,779,565,439],[1091,857,611,461],[1171,911,661,511],[1273,997,715,535],[1367,1059,751,593],[1465,1125,805,625],[1528,1190,868,658],[1628,1264,908,698],[1732,1370,982,742],[1840,1452,1030,790],[1952,1538,1112,842],[2068,1628,1168,898],[2188,1722,1228,958],[2303,1809,1283,983],[2431,1911,1351,1051],[2563,1989,1423,1093],[2699,2099,1499,1139],[2809,2213,1579,1219],[2953,2331,1663,1273]];
  68649. function _isSupportCanvas() {
  68650. return typeof CanvasRenderingContext2D != "undefined";
  68651. }
  68652. // android 2.x doesn't support Data-URI spec
  68653. function _getAndroid() {
  68654. var android = false;
  68655. var sAgent = navigator.userAgent;
  68656. if (/android/i.test(sAgent)) { // android
  68657. android = true;
  68658. var aMat = sAgent.toString().match(/android ([0-9]\.[0-9])/i);
  68659. if (aMat && aMat[1]) {
  68660. android = parseFloat(aMat[1]);
  68661. }
  68662. }
  68663. return android;
  68664. }
  68665. var svgDrawer = (function() {
  68666. var Drawing = function (el, htOption) {
  68667. this._el = el;
  68668. this._htOption = htOption;
  68669. };
  68670. Drawing.prototype.draw = function (oQRCode) {
  68671. var _htOption = this._htOption;
  68672. var _el = this._el;
  68673. var nCount = oQRCode.getModuleCount();
  68674. var nWidth = Math.floor(_htOption.width / nCount);
  68675. var nHeight = Math.floor(_htOption.height / nCount);
  68676. this.clear();
  68677. function makeSVG(tag, attrs) {
  68678. var el = document.createElementNS('http://www.w3.org/2000/svg', tag);
  68679. for (var k in attrs)
  68680. if (attrs.hasOwnProperty(k)) el.setAttribute(k, attrs[k]);
  68681. return el;
  68682. }
  68683. var svg = makeSVG("svg" , {'viewBox': '0 0 ' + String(nCount) + " " + String(nCount), 'width': '100%', 'height': '100%', 'fill': _htOption.colorLight});
  68684. svg.setAttributeNS("http://www.w3.org/2000/xmlns/", "xmlns:xlink", "http://www.w3.org/1999/xlink");
  68685. _el.appendChild(svg);
  68686. svg.appendChild(makeSVG("rect", {"fill": _htOption.colorLight, "width": "100%", "height": "100%"}));
  68687. svg.appendChild(makeSVG("rect", {"fill": _htOption.colorDark, "width": "1", "height": "1", "id": "template"}));
  68688. for (var row = 0; row < nCount; row++) {
  68689. for (var col = 0; col < nCount; col++) {
  68690. if (oQRCode.isDark(row, col)) {
  68691. var child = makeSVG("use", {"x": String(col), "y": String(row)});
  68692. child.setAttributeNS("http://www.w3.org/1999/xlink", "href", "#template")
  68693. svg.appendChild(child);
  68694. }
  68695. }
  68696. }
  68697. };
  68698. Drawing.prototype.clear = function () {
  68699. while (this._el.hasChildNodes())
  68700. this._el.removeChild(this._el.lastChild);
  68701. };
  68702. return Drawing;
  68703. })();
  68704. var useSVG = document.documentElement.tagName.toLowerCase() === "svg";
  68705. // Drawing in DOM by using Table tag
  68706. var Drawing = useSVG ? svgDrawer : !_isSupportCanvas() ? (function () {
  68707. var Drawing = function (el, htOption) {
  68708. this._el = el;
  68709. this._htOption = htOption;
  68710. };
  68711. /**
  68712. * Draw the QRCode
  68713. *
  68714. * @param {QRCode} oQRCode
  68715. */
  68716. Drawing.prototype.draw = function (oQRCode) {
  68717. var _htOption = this._htOption;
  68718. var _el = this._el;
  68719. var nCount = oQRCode.getModuleCount();
  68720. var nWidth = Math.floor(_htOption.width / nCount);
  68721. var nHeight = Math.floor(_htOption.height / nCount);
  68722. var aHTML = ['<table style="border:0;border-collapse:collapse;">'];
  68723. for (var row = 0; row < nCount; row++) {
  68724. aHTML.push('<tr>');
  68725. for (var col = 0; col < nCount; col++) {
  68726. aHTML.push('<td style="border:0;border-collapse:collapse;padding:0;margin:0;width:' + nWidth + 'px;height:' + nHeight + 'px;background-color:' + (oQRCode.isDark(row, col) ? _htOption.colorDark : _htOption.colorLight) + ';"></td>');
  68727. }
  68728. aHTML.push('</tr>');
  68729. }
  68730. aHTML.push('</table>');
  68731. _el.innerHTML = aHTML.join('');
  68732. // Fix the margin values as real size.
  68733. var elTable = _el.childNodes[0];
  68734. var nLeftMarginTable = (_htOption.width - elTable.offsetWidth) / 2;
  68735. var nTopMarginTable = (_htOption.height - elTable.offsetHeight) / 2;
  68736. if (nLeftMarginTable > 0 && nTopMarginTable > 0) {
  68737. elTable.style.margin = nTopMarginTable + "px " + nLeftMarginTable + "px";
  68738. }
  68739. };
  68740. /**
  68741. * Clear the QRCode
  68742. */
  68743. Drawing.prototype.clear = function () {
  68744. this._el.innerHTML = '';
  68745. };
  68746. return Drawing;
  68747. })() : (function () { // Drawing in Canvas
  68748. function _onMakeImage() {
  68749. this._elImage.src = this._elCanvas.toDataURL("image/png");
  68750. this._elImage.style.display = "block";
  68751. this._elCanvas.style.display = "none";
  68752. }
  68753. // Android 2.1 bug workaround
  68754. // http://code.google.com/p/android/issues/detail?id=5141
  68755. if (this._android && this._android <= 2.1) {
  68756. var factor = 1 / window.devicePixelRatio;
  68757. var drawImage = CanvasRenderingContext2D.prototype.drawImage;
  68758. CanvasRenderingContext2D.prototype.drawImage = function (image, sx, sy, sw, sh, dx, dy, dw, dh) {
  68759. if (("nodeName" in image) && /img/i.test(image.nodeName)) {
  68760. for (var i = arguments.length - 1; i >= 1; i--) {
  68761. arguments[i] = arguments[i] * factor;
  68762. }
  68763. } else if (typeof dw == "undefined") {
  68764. arguments[1] *= factor;
  68765. arguments[2] *= factor;
  68766. arguments[3] *= factor;
  68767. arguments[4] *= factor;
  68768. }
  68769. drawImage.apply(this, arguments);
  68770. };
  68771. }
  68772. /**
  68773. * Check whether the user's browser supports Data URI or not
  68774. *
  68775. * @private
  68776. * @param {Function} fSuccess Occurs if it supports Data URI
  68777. * @param {Function} fFail Occurs if it doesn't support Data URI
  68778. */
  68779. function _safeSetDataURI(fSuccess, fFail) {
  68780. var self = this;
  68781. self._fFail = fFail;
  68782. self._fSuccess = fSuccess;
  68783. // Check it just once
  68784. if (self._bSupportDataURI === null) {
  68785. var el = document.createElement("img");
  68786. var fOnError = function() {
  68787. self._bSupportDataURI = false;
  68788. if (self._fFail) {
  68789. self._fFail.call(self);
  68790. }
  68791. };
  68792. var fOnSuccess = function() {
  68793. self._bSupportDataURI = true;
  68794. if (self._fSuccess) {
  68795. self._fSuccess.call(self);
  68796. }
  68797. };
  68798. el.onabort = fOnError;
  68799. el.onerror = fOnError;
  68800. el.onload = fOnSuccess;
  68801. el.src = "data:image/gif;base64,iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="; // the Image contains 1px data.
  68802. return;
  68803. } else if (self._bSupportDataURI === true && self._fSuccess) {
  68804. self._fSuccess.call(self);
  68805. } else if (self._bSupportDataURI === false && self._fFail) {
  68806. self._fFail.call(self);
  68807. }
  68808. };
  68809. /**
  68810. * Drawing QRCode by using canvas
  68811. *
  68812. * @constructor
  68813. * @param {HTMLElement} el
  68814. * @param {Object} htOption QRCode Options
  68815. */
  68816. var Drawing = function (el, htOption) {
  68817. this._bIsPainted = false;
  68818. this._android = _getAndroid();
  68819. this._htOption = htOption;
  68820. this._elCanvas = document.createElement("canvas");
  68821. this._elCanvas.width = htOption.width;
  68822. this._elCanvas.height = htOption.height;
  68823. el.appendChild(this._elCanvas);
  68824. this._el = el;
  68825. this._oContext = this._elCanvas.getContext("2d");
  68826. this._bIsPainted = false;
  68827. this._elImage = document.createElement("img");
  68828. this._elImage.alt = "Scan me!";
  68829. this._elImage.style.display = "none";
  68830. this._el.appendChild(this._elImage);
  68831. this._bSupportDataURI = null;
  68832. };
  68833. /**
  68834. * Draw the QRCode
  68835. *
  68836. * @param {QRCode} oQRCode
  68837. */
  68838. Drawing.prototype.draw = function (oQRCode) {
  68839. var _elImage = this._elImage;
  68840. var _oContext = this._oContext;
  68841. var _htOption = this._htOption;
  68842. var nCount = oQRCode.getModuleCount();
  68843. var nWidth = _htOption.width / nCount;
  68844. var nHeight = _htOption.height / nCount;
  68845. var nRoundedWidth = Math.round(nWidth);
  68846. var nRoundedHeight = Math.round(nHeight);
  68847. _elImage.style.display = "none";
  68848. this.clear();
  68849. for (var row = 0; row < nCount; row++) {
  68850. for (var col = 0; col < nCount; col++) {
  68851. var bIsDark = oQRCode.isDark(row, col);
  68852. var nLeft = col * nWidth;
  68853. var nTop = row * nHeight;
  68854. _oContext.strokeStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
  68855. _oContext.lineWidth = 1;
  68856. _oContext.fillStyle = bIsDark ? _htOption.colorDark : _htOption.colorLight;
  68857. _oContext.fillRect(nLeft, nTop, nWidth, nHeight);
  68858. // 안티 앨리어싱 방지 처리
  68859. _oContext.strokeRect(
  68860. Math.floor(nLeft) + 0.5,
  68861. Math.floor(nTop) + 0.5,
  68862. nRoundedWidth,
  68863. nRoundedHeight
  68864. );
  68865. _oContext.strokeRect(
  68866. Math.ceil(nLeft) - 0.5,
  68867. Math.ceil(nTop) - 0.5,
  68868. nRoundedWidth,
  68869. nRoundedHeight
  68870. );
  68871. }
  68872. }
  68873. this._bIsPainted = true;
  68874. };
  68875. /**
  68876. * Make the image from Canvas if the browser supports Data URI.
  68877. */
  68878. Drawing.prototype.makeImage = function () {
  68879. if (this._bIsPainted) {
  68880. _safeSetDataURI.call(this, _onMakeImage);
  68881. }
  68882. };
  68883. /**
  68884. * Return whether the QRCode is painted or not
  68885. *
  68886. * @return {Boolean}
  68887. */
  68888. Drawing.prototype.isPainted = function () {
  68889. return this._bIsPainted;
  68890. };
  68891. /**
  68892. * Clear the QRCode
  68893. */
  68894. Drawing.prototype.clear = function () {
  68895. this._oContext.clearRect(0, 0, this._elCanvas.width, this._elCanvas.height);
  68896. this._bIsPainted = false;
  68897. };
  68898. /**
  68899. * @private
  68900. * @param {Number} nNumber
  68901. */
  68902. Drawing.prototype.round = function (nNumber) {
  68903. if (!nNumber) {
  68904. return nNumber;
  68905. }
  68906. return Math.floor(nNumber * 1000) / 1000;
  68907. };
  68908. return Drawing;
  68909. })();
  68910. /**
  68911. * Get the type by string length
  68912. *
  68913. * @private
  68914. * @param {String} sText
  68915. * @param {Number} nCorrectLevel
  68916. * @return {Number} type
  68917. */
  68918. function _getTypeNumber(sText, nCorrectLevel) {
  68919. var nType = 1;
  68920. var length = _getUTF8Length(sText);
  68921. for (var i = 0, len = QRCodeLimitLength.length; i <= len; i++) {
  68922. var nLimit = 0;
  68923. switch (nCorrectLevel) {
  68924. case QRErrorCorrectLevel.L :
  68925. nLimit = QRCodeLimitLength[i][0];
  68926. break;
  68927. case QRErrorCorrectLevel.M :
  68928. nLimit = QRCodeLimitLength[i][1];
  68929. break;
  68930. case QRErrorCorrectLevel.Q :
  68931. nLimit = QRCodeLimitLength[i][2];
  68932. break;
  68933. case QRErrorCorrectLevel.H :
  68934. nLimit = QRCodeLimitLength[i][3];
  68935. break;
  68936. }
  68937. if (length <= nLimit) {
  68938. break;
  68939. } else {
  68940. nType++;
  68941. }
  68942. }
  68943. if (nType > QRCodeLimitLength.length) {
  68944. throw new Error("Too long data");
  68945. }
  68946. return nType;
  68947. }
  68948. function _getUTF8Length(sText) {
  68949. var replacedText = encodeURI(sText).toString().replace(/\%[0-9a-fA-F]{2}/g, 'a');
  68950. return replacedText.length + (replacedText.length != sText ? 3 : 0);
  68951. }
  68952. /**
  68953. * @class QRCode
  68954. * @constructor
  68955. * @example
  68956. * new QRCode(document.getElementById("test"), "http://jindo.dev.naver.com/collie");
  68957. *
  68958. * @example
  68959. * var oQRCode = new QRCode("test", {
  68960. * text : "http://naver.com",
  68961. * width : 128,
  68962. * height : 128
  68963. * });
  68964. *
  68965. * oQRCode.clear(); // Clear the QRCode.
  68966. * oQRCode.makeCode("http://map.naver.com"); // Re-create the QRCode.
  68967. *
  68968. * @param {HTMLElement|String} el target element or 'id' attribute of element.
  68969. * @param {Object|String} vOption
  68970. * @param {String} vOption.text QRCode link data
  68971. * @param {Number} [vOption.width=256]
  68972. * @param {Number} [vOption.height=256]
  68973. * @param {String} [vOption.colorDark="#000000"]
  68974. * @param {String} [vOption.colorLight="#ffffff"]
  68975. * @param {QRCode.CorrectLevel} [vOption.correctLevel=QRCode.CorrectLevel.H] [L|M|Q|H]
  68976. */
  68977. QRCode = function (el, vOption) {
  68978. this._htOption = {
  68979. width : 256,
  68980. height : 256,
  68981. typeNumber : 4,
  68982. colorDark : "#000000",
  68983. colorLight : "#ffffff",
  68984. correctLevel : QRErrorCorrectLevel.H
  68985. };
  68986. if (typeof vOption === 'string') {
  68987. vOption = {
  68988. text : vOption
  68989. };
  68990. }
  68991. // Overwrites options
  68992. if (vOption) {
  68993. for (var i in vOption) {
  68994. this._htOption[i] = vOption[i];
  68995. }
  68996. }
  68997. if (typeof el == "string") {
  68998. el = document.getElementById(el);
  68999. }
  69000. if (this._htOption.useSVG) {
  69001. Drawing = svgDrawer;
  69002. }
  69003. this._android = _getAndroid();
  69004. this._el = el;
  69005. this._oQRCode = null;
  69006. this._oDrawing = new Drawing(this._el, this._htOption);
  69007. if (this._htOption.text) {
  69008. this.makeCode(this._htOption.text);
  69009. }
  69010. };
  69011. /**
  69012. * Make the QRCode
  69013. *
  69014. * @param {String} sText link data
  69015. */
  69016. QRCode.prototype.makeCode = function (sText) {
  69017. this._oQRCode = new QRCodeModel(_getTypeNumber(sText, this._htOption.correctLevel), this._htOption.correctLevel);
  69018. this._oQRCode.addData(sText);
  69019. this._oQRCode.make();
  69020. this._el.title = sText;
  69021. this._oDrawing.draw(this._oQRCode);
  69022. this.makeImage();
  69023. };
  69024. /**
  69025. * Make the Image from Canvas element
  69026. * - It occurs automatically
  69027. * - Android below 3 doesn't support Data-URI spec.
  69028. *
  69029. * @private
  69030. */
  69031. QRCode.prototype.makeImage = function () {
  69032. if (typeof this._oDrawing.makeImage == "function" && (!this._android || this._android >= 3)) {
  69033. this._oDrawing.makeImage();
  69034. }
  69035. };
  69036. /**
  69037. * Clear the QRCode
  69038. */
  69039. QRCode.prototype.clear = function () {
  69040. this._oDrawing.clear();
  69041. };
  69042. /**
  69043. * @name QRCode.CorrectLevel
  69044. */
  69045. QRCode.CorrectLevel = QRErrorCorrectLevel;
  69046. return QRCode;
  69047. }));
  69048. /***/ }),
  69049. /***/ "./node_modules/rxjs/_esm5/index.js":
  69050. /*!******************************************!*\
  69051. !*** ./node_modules/rxjs/_esm5/index.js ***!
  69052. \******************************************/
  69053. /*! exports provided: Observable, ConnectableObservable, GroupedObservable, observable, Subject, BehaviorSubject, ReplaySubject, AsyncSubject, asapScheduler, asyncScheduler, queueScheduler, animationFrameScheduler, VirtualTimeScheduler, VirtualAction, Scheduler, Subscription, Subscriber, Notification, pipe, noop, identity, isObservable, ArgumentOutOfRangeError, EmptyError, ObjectUnsubscribedError, UnsubscriptionError, TimeoutError, bindCallback, bindNodeCallback, combineLatest, concat, defer, empty, forkJoin, from, fromEvent, fromEventPattern, generate, iif, interval, merge, never, of, onErrorResumeNext, pairs, race, range, throwError, timer, using, zip, EMPTY, NEVER, config */
  69054. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69055. "use strict";
  69056. __webpack_require__.r(__webpack_exports__);
  69057. /* harmony import */ var _internal_Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./internal/Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  69058. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Observable", function() { return _internal_Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]; });
  69059. /* harmony import */ var _internal_observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./internal/observable/ConnectableObservable */ "./node_modules/rxjs/_esm5/internal/observable/ConnectableObservable.js");
  69060. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ConnectableObservable", function() { return _internal_observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_1__["ConnectableObservable"]; });
  69061. /* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./internal/operators/groupBy */ "./node_modules/rxjs/_esm5/internal/operators/groupBy.js");
  69062. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "GroupedObservable", function() { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_2__["GroupedObservable"]; });
  69063. /* harmony import */ var _internal_symbol_observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./internal/symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js");
  69064. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observable", function() { return _internal_symbol_observable__WEBPACK_IMPORTED_MODULE_3__["observable"]; });
  69065. /* harmony import */ var _internal_Subject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./internal/Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  69066. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return _internal_Subject__WEBPACK_IMPORTED_MODULE_4__["Subject"]; });
  69067. /* harmony import */ var _internal_BehaviorSubject__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./internal/BehaviorSubject */ "./node_modules/rxjs/_esm5/internal/BehaviorSubject.js");
  69068. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "BehaviorSubject", function() { return _internal_BehaviorSubject__WEBPACK_IMPORTED_MODULE_5__["BehaviorSubject"]; });
  69069. /* harmony import */ var _internal_ReplaySubject__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./internal/ReplaySubject */ "./node_modules/rxjs/_esm5/internal/ReplaySubject.js");
  69070. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ReplaySubject", function() { return _internal_ReplaySubject__WEBPACK_IMPORTED_MODULE_6__["ReplaySubject"]; });
  69071. /* harmony import */ var _internal_AsyncSubject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./internal/AsyncSubject */ "./node_modules/rxjs/_esm5/internal/AsyncSubject.js");
  69072. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "AsyncSubject", function() { return _internal_AsyncSubject__WEBPACK_IMPORTED_MODULE_7__["AsyncSubject"]; });
  69073. /* harmony import */ var _internal_scheduler_asap__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./internal/scheduler/asap */ "./node_modules/rxjs/_esm5/internal/scheduler/asap.js");
  69074. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "asapScheduler", function() { return _internal_scheduler_asap__WEBPACK_IMPORTED_MODULE_8__["asap"]; });
  69075. /* harmony import */ var _internal_scheduler_async__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ./internal/scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  69076. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "asyncScheduler", function() { return _internal_scheduler_async__WEBPACK_IMPORTED_MODULE_9__["async"]; });
  69077. /* harmony import */ var _internal_scheduler_queue__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ./internal/scheduler/queue */ "./node_modules/rxjs/_esm5/internal/scheduler/queue.js");
  69078. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "queueScheduler", function() { return _internal_scheduler_queue__WEBPACK_IMPORTED_MODULE_10__["queue"]; });
  69079. /* harmony import */ var _internal_scheduler_animationFrame__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ./internal/scheduler/animationFrame */ "./node_modules/rxjs/_esm5/internal/scheduler/animationFrame.js");
  69080. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "animationFrameScheduler", function() { return _internal_scheduler_animationFrame__WEBPACK_IMPORTED_MODULE_11__["animationFrame"]; });
  69081. /* harmony import */ var _internal_scheduler_VirtualTimeScheduler__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ./internal/scheduler/VirtualTimeScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/VirtualTimeScheduler.js");
  69082. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VirtualTimeScheduler", function() { return _internal_scheduler_VirtualTimeScheduler__WEBPACK_IMPORTED_MODULE_12__["VirtualTimeScheduler"]; });
  69083. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "VirtualAction", function() { return _internal_scheduler_VirtualTimeScheduler__WEBPACK_IMPORTED_MODULE_12__["VirtualAction"]; });
  69084. /* harmony import */ var _internal_Scheduler__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ./internal/Scheduler */ "./node_modules/rxjs/_esm5/internal/Scheduler.js");
  69085. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Scheduler", function() { return _internal_Scheduler__WEBPACK_IMPORTED_MODULE_13__["Scheduler"]; });
  69086. /* harmony import */ var _internal_Subscription__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ./internal/Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  69087. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subscription", function() { return _internal_Subscription__WEBPACK_IMPORTED_MODULE_14__["Subscription"]; });
  69088. /* harmony import */ var _internal_Subscriber__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ./internal/Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  69089. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Subscriber", function() { return _internal_Subscriber__WEBPACK_IMPORTED_MODULE_15__["Subscriber"]; });
  69090. /* harmony import */ var _internal_Notification__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ./internal/Notification */ "./node_modules/rxjs/_esm5/internal/Notification.js");
  69091. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "Notification", function() { return _internal_Notification__WEBPACK_IMPORTED_MODULE_16__["Notification"]; });
  69092. /* harmony import */ var _internal_util_pipe__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ./internal/util/pipe */ "./node_modules/rxjs/_esm5/internal/util/pipe.js");
  69093. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pipe", function() { return _internal_util_pipe__WEBPACK_IMPORTED_MODULE_17__["pipe"]; });
  69094. /* harmony import */ var _internal_util_noop__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ./internal/util/noop */ "./node_modules/rxjs/_esm5/internal/util/noop.js");
  69095. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return _internal_util_noop__WEBPACK_IMPORTED_MODULE_18__["noop"]; });
  69096. /* harmony import */ var _internal_util_identity__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ./internal/util/identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js");
  69097. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return _internal_util_identity__WEBPACK_IMPORTED_MODULE_19__["identity"]; });
  69098. /* harmony import */ var _internal_util_isObservable__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ./internal/util/isObservable */ "./node_modules/rxjs/_esm5/internal/util/isObservable.js");
  69099. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isObservable", function() { return _internal_util_isObservable__WEBPACK_IMPORTED_MODULE_20__["isObservable"]; });
  69100. /* harmony import */ var _internal_util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ./internal/util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js");
  69101. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ArgumentOutOfRangeError", function() { return _internal_util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_21__["ArgumentOutOfRangeError"]; });
  69102. /* harmony import */ var _internal_util_EmptyError__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ./internal/util/EmptyError */ "./node_modules/rxjs/_esm5/internal/util/EmptyError.js");
  69103. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EmptyError", function() { return _internal_util_EmptyError__WEBPACK_IMPORTED_MODULE_22__["EmptyError"]; });
  69104. /* harmony import */ var _internal_util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ./internal/util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js");
  69105. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ObjectUnsubscribedError", function() { return _internal_util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_23__["ObjectUnsubscribedError"]; });
  69106. /* harmony import */ var _internal_util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ./internal/util/UnsubscriptionError */ "./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js");
  69107. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "UnsubscriptionError", function() { return _internal_util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_24__["UnsubscriptionError"]; });
  69108. /* harmony import */ var _internal_util_TimeoutError__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ./internal/util/TimeoutError */ "./node_modules/rxjs/_esm5/internal/util/TimeoutError.js");
  69109. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "TimeoutError", function() { return _internal_util_TimeoutError__WEBPACK_IMPORTED_MODULE_25__["TimeoutError"]; });
  69110. /* harmony import */ var _internal_observable_bindCallback__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ./internal/observable/bindCallback */ "./node_modules/rxjs/_esm5/internal/observable/bindCallback.js");
  69111. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bindCallback", function() { return _internal_observable_bindCallback__WEBPACK_IMPORTED_MODULE_26__["bindCallback"]; });
  69112. /* harmony import */ var _internal_observable_bindNodeCallback__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ./internal/observable/bindNodeCallback */ "./node_modules/rxjs/_esm5/internal/observable/bindNodeCallback.js");
  69113. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bindNodeCallback", function() { return _internal_observable_bindNodeCallback__WEBPACK_IMPORTED_MODULE_27__["bindNodeCallback"]; });
  69114. /* harmony import */ var _internal_observable_combineLatest__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ./internal/observable/combineLatest */ "./node_modules/rxjs/_esm5/internal/observable/combineLatest.js");
  69115. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return _internal_observable_combineLatest__WEBPACK_IMPORTED_MODULE_28__["combineLatest"]; });
  69116. /* harmony import */ var _internal_observable_concat__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ./internal/observable/concat */ "./node_modules/rxjs/_esm5/internal/observable/concat.js");
  69117. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return _internal_observable_concat__WEBPACK_IMPORTED_MODULE_29__["concat"]; });
  69118. /* harmony import */ var _internal_observable_defer__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ./internal/observable/defer */ "./node_modules/rxjs/_esm5/internal/observable/defer.js");
  69119. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return _internal_observable_defer__WEBPACK_IMPORTED_MODULE_30__["defer"]; });
  69120. /* harmony import */ var _internal_observable_empty__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ./internal/observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  69121. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "empty", function() { return _internal_observable_empty__WEBPACK_IMPORTED_MODULE_31__["empty"]; });
  69122. /* harmony import */ var _internal_observable_forkJoin__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ./internal/observable/forkJoin */ "./node_modules/rxjs/_esm5/internal/observable/forkJoin.js");
  69123. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "forkJoin", function() { return _internal_observable_forkJoin__WEBPACK_IMPORTED_MODULE_32__["forkJoin"]; });
  69124. /* harmony import */ var _internal_observable_from__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ./internal/observable/from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  69125. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "from", function() { return _internal_observable_from__WEBPACK_IMPORTED_MODULE_33__["from"]; });
  69126. /* harmony import */ var _internal_observable_fromEvent__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ./internal/observable/fromEvent */ "./node_modules/rxjs/_esm5/internal/observable/fromEvent.js");
  69127. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fromEvent", function() { return _internal_observable_fromEvent__WEBPACK_IMPORTED_MODULE_34__["fromEvent"]; });
  69128. /* harmony import */ var _internal_observable_fromEventPattern__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ./internal/observable/fromEventPattern */ "./node_modules/rxjs/_esm5/internal/observable/fromEventPattern.js");
  69129. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "fromEventPattern", function() { return _internal_observable_fromEventPattern__WEBPACK_IMPORTED_MODULE_35__["fromEventPattern"]; });
  69130. /* harmony import */ var _internal_observable_generate__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ./internal/observable/generate */ "./node_modules/rxjs/_esm5/internal/observable/generate.js");
  69131. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return _internal_observable_generate__WEBPACK_IMPORTED_MODULE_36__["generate"]; });
  69132. /* harmony import */ var _internal_observable_iif__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ./internal/observable/iif */ "./node_modules/rxjs/_esm5/internal/observable/iif.js");
  69133. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "iif", function() { return _internal_observable_iif__WEBPACK_IMPORTED_MODULE_37__["iif"]; });
  69134. /* harmony import */ var _internal_observable_interval__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ./internal/observable/interval */ "./node_modules/rxjs/_esm5/internal/observable/interval.js");
  69135. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "interval", function() { return _internal_observable_interval__WEBPACK_IMPORTED_MODULE_38__["interval"]; });
  69136. /* harmony import */ var _internal_observable_merge__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ./internal/observable/merge */ "./node_modules/rxjs/_esm5/internal/observable/merge.js");
  69137. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return _internal_observable_merge__WEBPACK_IMPORTED_MODULE_39__["merge"]; });
  69138. /* harmony import */ var _internal_observable_never__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ./internal/observable/never */ "./node_modules/rxjs/_esm5/internal/observable/never.js");
  69139. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "never", function() { return _internal_observable_never__WEBPACK_IMPORTED_MODULE_40__["never"]; });
  69140. /* harmony import */ var _internal_observable_of__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ./internal/observable/of */ "./node_modules/rxjs/_esm5/internal/observable/of.js");
  69141. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "of", function() { return _internal_observable_of__WEBPACK_IMPORTED_MODULE_41__["of"]; });
  69142. /* harmony import */ var _internal_observable_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ./internal/observable/onErrorResumeNext */ "./node_modules/rxjs/_esm5/internal/observable/onErrorResumeNext.js");
  69143. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return _internal_observable_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_42__["onErrorResumeNext"]; });
  69144. /* harmony import */ var _internal_observable_pairs__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ./internal/observable/pairs */ "./node_modules/rxjs/_esm5/internal/observable/pairs.js");
  69145. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return _internal_observable_pairs__WEBPACK_IMPORTED_MODULE_43__["pairs"]; });
  69146. /* harmony import */ var _internal_observable_race__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ./internal/observable/race */ "./node_modules/rxjs/_esm5/internal/observable/race.js");
  69147. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function() { return _internal_observable_race__WEBPACK_IMPORTED_MODULE_44__["race"]; });
  69148. /* harmony import */ var _internal_observable_range__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ./internal/observable/range */ "./node_modules/rxjs/_esm5/internal/observable/range.js");
  69149. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "range", function() { return _internal_observable_range__WEBPACK_IMPORTED_MODULE_45__["range"]; });
  69150. /* harmony import */ var _internal_observable_throwError__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ./internal/observable/throwError */ "./node_modules/rxjs/_esm5/internal/observable/throwError.js");
  69151. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwError", function() { return _internal_observable_throwError__WEBPACK_IMPORTED_MODULE_46__["throwError"]; });
  69152. /* harmony import */ var _internal_observable_timer__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ./internal/observable/timer */ "./node_modules/rxjs/_esm5/internal/observable/timer.js");
  69153. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timer", function() { return _internal_observable_timer__WEBPACK_IMPORTED_MODULE_47__["timer"]; });
  69154. /* harmony import */ var _internal_observable_using__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ./internal/observable/using */ "./node_modules/rxjs/_esm5/internal/observable/using.js");
  69155. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "using", function() { return _internal_observable_using__WEBPACK_IMPORTED_MODULE_48__["using"]; });
  69156. /* harmony import */ var _internal_observable_zip__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ./internal/observable/zip */ "./node_modules/rxjs/_esm5/internal/observable/zip.js");
  69157. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return _internal_observable_zip__WEBPACK_IMPORTED_MODULE_49__["zip"]; });
  69158. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "EMPTY", function() { return _internal_observable_empty__WEBPACK_IMPORTED_MODULE_31__["EMPTY"]; });
  69159. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "NEVER", function() { return _internal_observable_never__WEBPACK_IMPORTED_MODULE_40__["NEVER"]; });
  69160. /* harmony import */ var _internal_config__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ./internal/config */ "./node_modules/rxjs/_esm5/internal/config.js");
  69161. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "config", function() { return _internal_config__WEBPACK_IMPORTED_MODULE_50__["config"]; });
  69162. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  69163. //# sourceMappingURL=index.js.map
  69164. /***/ }),
  69165. /***/ "./node_modules/rxjs/_esm5/internal/AsyncSubject.js":
  69166. /*!**********************************************************!*\
  69167. !*** ./node_modules/rxjs/_esm5/internal/AsyncSubject.js ***!
  69168. \**********************************************************/
  69169. /*! exports provided: AsyncSubject */
  69170. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69171. "use strict";
  69172. __webpack_require__.r(__webpack_exports__);
  69173. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncSubject", function() { return AsyncSubject; });
  69174. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69175. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  69176. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  69177. /** PURE_IMPORTS_START tslib,_Subject,_Subscription PURE_IMPORTS_END */
  69178. var AsyncSubject = /*@__PURE__*/ (function (_super) {
  69179. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AsyncSubject, _super);
  69180. function AsyncSubject() {
  69181. var _this = _super !== null && _super.apply(this, arguments) || this;
  69182. _this.value = null;
  69183. _this.hasNext = false;
  69184. _this.hasCompleted = false;
  69185. return _this;
  69186. }
  69187. AsyncSubject.prototype._subscribe = function (subscriber) {
  69188. if (this.hasError) {
  69189. subscriber.error(this.thrownError);
  69190. return _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY;
  69191. }
  69192. else if (this.hasCompleted && this.hasNext) {
  69193. subscriber.next(this.value);
  69194. subscriber.complete();
  69195. return _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"].EMPTY;
  69196. }
  69197. return _super.prototype._subscribe.call(this, subscriber);
  69198. };
  69199. AsyncSubject.prototype.next = function (value) {
  69200. if (!this.hasCompleted) {
  69201. this.value = value;
  69202. this.hasNext = true;
  69203. }
  69204. };
  69205. AsyncSubject.prototype.error = function (error) {
  69206. if (!this.hasCompleted) {
  69207. _super.prototype.error.call(this, error);
  69208. }
  69209. };
  69210. AsyncSubject.prototype.complete = function () {
  69211. this.hasCompleted = true;
  69212. if (this.hasNext) {
  69213. _super.prototype.next.call(this, this.value);
  69214. }
  69215. _super.prototype.complete.call(this);
  69216. };
  69217. return AsyncSubject;
  69218. }(_Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]));
  69219. //# sourceMappingURL=AsyncSubject.js.map
  69220. /***/ }),
  69221. /***/ "./node_modules/rxjs/_esm5/internal/BehaviorSubject.js":
  69222. /*!*************************************************************!*\
  69223. !*** ./node_modules/rxjs/_esm5/internal/BehaviorSubject.js ***!
  69224. \*************************************************************/
  69225. /*! exports provided: BehaviorSubject */
  69226. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69227. "use strict";
  69228. __webpack_require__.r(__webpack_exports__);
  69229. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "BehaviorSubject", function() { return BehaviorSubject; });
  69230. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69231. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  69232. /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js");
  69233. /** PURE_IMPORTS_START tslib,_Subject,_util_ObjectUnsubscribedError PURE_IMPORTS_END */
  69234. var BehaviorSubject = /*@__PURE__*/ (function (_super) {
  69235. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BehaviorSubject, _super);
  69236. function BehaviorSubject(_value) {
  69237. var _this = _super.call(this) || this;
  69238. _this._value = _value;
  69239. return _this;
  69240. }
  69241. Object.defineProperty(BehaviorSubject.prototype, "value", {
  69242. get: function () {
  69243. return this.getValue();
  69244. },
  69245. enumerable: true,
  69246. configurable: true
  69247. });
  69248. BehaviorSubject.prototype._subscribe = function (subscriber) {
  69249. var subscription = _super.prototype._subscribe.call(this, subscriber);
  69250. if (subscription && !subscription.closed) {
  69251. subscriber.next(this._value);
  69252. }
  69253. return subscription;
  69254. };
  69255. BehaviorSubject.prototype.getValue = function () {
  69256. if (this.hasError) {
  69257. throw this.thrownError;
  69258. }
  69259. else if (this.closed) {
  69260. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_2__["ObjectUnsubscribedError"]();
  69261. }
  69262. else {
  69263. return this._value;
  69264. }
  69265. };
  69266. BehaviorSubject.prototype.next = function (value) {
  69267. _super.prototype.next.call(this, this._value = value);
  69268. };
  69269. return BehaviorSubject;
  69270. }(_Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]));
  69271. //# sourceMappingURL=BehaviorSubject.js.map
  69272. /***/ }),
  69273. /***/ "./node_modules/rxjs/_esm5/internal/InnerSubscriber.js":
  69274. /*!*************************************************************!*\
  69275. !*** ./node_modules/rxjs/_esm5/internal/InnerSubscriber.js ***!
  69276. \*************************************************************/
  69277. /*! exports provided: InnerSubscriber */
  69278. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69279. "use strict";
  69280. __webpack_require__.r(__webpack_exports__);
  69281. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "InnerSubscriber", function() { return InnerSubscriber; });
  69282. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69283. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  69284. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  69285. var InnerSubscriber = /*@__PURE__*/ (function (_super) {
  69286. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](InnerSubscriber, _super);
  69287. function InnerSubscriber(parent, outerValue, outerIndex) {
  69288. var _this = _super.call(this) || this;
  69289. _this.parent = parent;
  69290. _this.outerValue = outerValue;
  69291. _this.outerIndex = outerIndex;
  69292. _this.index = 0;
  69293. return _this;
  69294. }
  69295. InnerSubscriber.prototype._next = function (value) {
  69296. this.parent.notifyNext(this.outerValue, value, this.outerIndex, this.index++, this);
  69297. };
  69298. InnerSubscriber.prototype._error = function (error) {
  69299. this.parent.notifyError(error, this);
  69300. this.unsubscribe();
  69301. };
  69302. InnerSubscriber.prototype._complete = function () {
  69303. this.parent.notifyComplete(this);
  69304. this.unsubscribe();
  69305. };
  69306. return InnerSubscriber;
  69307. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  69308. //# sourceMappingURL=InnerSubscriber.js.map
  69309. /***/ }),
  69310. /***/ "./node_modules/rxjs/_esm5/internal/Notification.js":
  69311. /*!**********************************************************!*\
  69312. !*** ./node_modules/rxjs/_esm5/internal/Notification.js ***!
  69313. \**********************************************************/
  69314. /*! exports provided: Notification */
  69315. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69316. "use strict";
  69317. __webpack_require__.r(__webpack_exports__);
  69318. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Notification", function() { return Notification; });
  69319. /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  69320. /* harmony import */ var _observable_of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./observable/of */ "./node_modules/rxjs/_esm5/internal/observable/of.js");
  69321. /* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./observable/throwError */ "./node_modules/rxjs/_esm5/internal/observable/throwError.js");
  69322. /** PURE_IMPORTS_START _observable_empty,_observable_of,_observable_throwError PURE_IMPORTS_END */
  69323. var Notification = /*@__PURE__*/ (function () {
  69324. function Notification(kind, value, error) {
  69325. this.kind = kind;
  69326. this.value = value;
  69327. this.error = error;
  69328. this.hasValue = kind === 'N';
  69329. }
  69330. Notification.prototype.observe = function (observer) {
  69331. switch (this.kind) {
  69332. case 'N':
  69333. return observer.next && observer.next(this.value);
  69334. case 'E':
  69335. return observer.error && observer.error(this.error);
  69336. case 'C':
  69337. return observer.complete && observer.complete();
  69338. }
  69339. };
  69340. Notification.prototype.do = function (next, error, complete) {
  69341. var kind = this.kind;
  69342. switch (kind) {
  69343. case 'N':
  69344. return next && next(this.value);
  69345. case 'E':
  69346. return error && error(this.error);
  69347. case 'C':
  69348. return complete && complete();
  69349. }
  69350. };
  69351. Notification.prototype.accept = function (nextOrObserver, error, complete) {
  69352. if (nextOrObserver && typeof nextOrObserver.next === 'function') {
  69353. return this.observe(nextOrObserver);
  69354. }
  69355. else {
  69356. return this.do(nextOrObserver, error, complete);
  69357. }
  69358. };
  69359. Notification.prototype.toObservable = function () {
  69360. var kind = this.kind;
  69361. switch (kind) {
  69362. case 'N':
  69363. return Object(_observable_of__WEBPACK_IMPORTED_MODULE_1__["of"])(this.value);
  69364. case 'E':
  69365. return Object(_observable_throwError__WEBPACK_IMPORTED_MODULE_2__["throwError"])(this.error);
  69366. case 'C':
  69367. return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_0__["empty"])();
  69368. }
  69369. throw new Error('unexpected notification kind value');
  69370. };
  69371. Notification.createNext = function (value) {
  69372. if (typeof value !== 'undefined') {
  69373. return new Notification('N', value);
  69374. }
  69375. return Notification.undefinedValueNotification;
  69376. };
  69377. Notification.createError = function (err) {
  69378. return new Notification('E', undefined, err);
  69379. };
  69380. Notification.createComplete = function () {
  69381. return Notification.completeNotification;
  69382. };
  69383. Notification.completeNotification = new Notification('C');
  69384. Notification.undefinedValueNotification = new Notification('N', undefined);
  69385. return Notification;
  69386. }());
  69387. //# sourceMappingURL=Notification.js.map
  69388. /***/ }),
  69389. /***/ "./node_modules/rxjs/_esm5/internal/Observable.js":
  69390. /*!********************************************************!*\
  69391. !*** ./node_modules/rxjs/_esm5/internal/Observable.js ***!
  69392. \********************************************************/
  69393. /*! exports provided: Observable */
  69394. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69395. "use strict";
  69396. __webpack_require__.r(__webpack_exports__);
  69397. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Observable", function() { return Observable; });
  69398. /* harmony import */ var _util_toSubscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/toSubscriber */ "./node_modules/rxjs/_esm5/internal/util/toSubscriber.js");
  69399. /* harmony import */ var _internal_symbol_observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../internal/symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js");
  69400. /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/pipe */ "./node_modules/rxjs/_esm5/internal/util/pipe.js");
  69401. /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./config */ "./node_modules/rxjs/_esm5/internal/config.js");
  69402. /** PURE_IMPORTS_START _util_toSubscriber,_internal_symbol_observable,_util_pipe,_config PURE_IMPORTS_END */
  69403. var Observable = /*@__PURE__*/ (function () {
  69404. function Observable(subscribe) {
  69405. this._isScalar = false;
  69406. if (subscribe) {
  69407. this._subscribe = subscribe;
  69408. }
  69409. }
  69410. Observable.prototype.lift = function (operator) {
  69411. var observable = new Observable();
  69412. observable.source = this;
  69413. observable.operator = operator;
  69414. return observable;
  69415. };
  69416. Observable.prototype.subscribe = function (observerOrNext, error, complete) {
  69417. var operator = this.operator;
  69418. var sink = Object(_util_toSubscriber__WEBPACK_IMPORTED_MODULE_0__["toSubscriber"])(observerOrNext, error, complete);
  69419. if (operator) {
  69420. operator.call(sink, this.source);
  69421. }
  69422. else {
  69423. sink.add(this.source || (_config__WEBPACK_IMPORTED_MODULE_3__["config"].useDeprecatedSynchronousErrorHandling && !sink.syncErrorThrowable) ?
  69424. this._subscribe(sink) :
  69425. this._trySubscribe(sink));
  69426. }
  69427. if (_config__WEBPACK_IMPORTED_MODULE_3__["config"].useDeprecatedSynchronousErrorHandling) {
  69428. if (sink.syncErrorThrowable) {
  69429. sink.syncErrorThrowable = false;
  69430. if (sink.syncErrorThrown) {
  69431. throw sink.syncErrorValue;
  69432. }
  69433. }
  69434. }
  69435. return sink;
  69436. };
  69437. Observable.prototype._trySubscribe = function (sink) {
  69438. try {
  69439. return this._subscribe(sink);
  69440. }
  69441. catch (err) {
  69442. if (_config__WEBPACK_IMPORTED_MODULE_3__["config"].useDeprecatedSynchronousErrorHandling) {
  69443. sink.syncErrorThrown = true;
  69444. sink.syncErrorValue = err;
  69445. }
  69446. sink.error(err);
  69447. }
  69448. };
  69449. Observable.prototype.forEach = function (next, promiseCtor) {
  69450. var _this = this;
  69451. promiseCtor = getPromiseCtor(promiseCtor);
  69452. return new promiseCtor(function (resolve, reject) {
  69453. var subscription;
  69454. subscription = _this.subscribe(function (value) {
  69455. try {
  69456. next(value);
  69457. }
  69458. catch (err) {
  69459. reject(err);
  69460. if (subscription) {
  69461. subscription.unsubscribe();
  69462. }
  69463. }
  69464. }, reject, resolve);
  69465. });
  69466. };
  69467. Observable.prototype._subscribe = function (subscriber) {
  69468. var source = this.source;
  69469. return source && source.subscribe(subscriber);
  69470. };
  69471. Observable.prototype[_internal_symbol_observable__WEBPACK_IMPORTED_MODULE_1__["observable"]] = function () {
  69472. return this;
  69473. };
  69474. Observable.prototype.pipe = function () {
  69475. var operations = [];
  69476. for (var _i = 0; _i < arguments.length; _i++) {
  69477. operations[_i] = arguments[_i];
  69478. }
  69479. if (operations.length === 0) {
  69480. return this;
  69481. }
  69482. return Object(_util_pipe__WEBPACK_IMPORTED_MODULE_2__["pipeFromArray"])(operations)(this);
  69483. };
  69484. Observable.prototype.toPromise = function (promiseCtor) {
  69485. var _this = this;
  69486. promiseCtor = getPromiseCtor(promiseCtor);
  69487. return new promiseCtor(function (resolve, reject) {
  69488. var value;
  69489. _this.subscribe(function (x) { return value = x; }, function (err) { return reject(err); }, function () { return resolve(value); });
  69490. });
  69491. };
  69492. Observable.create = function (subscribe) {
  69493. return new Observable(subscribe);
  69494. };
  69495. return Observable;
  69496. }());
  69497. function getPromiseCtor(promiseCtor) {
  69498. if (!promiseCtor) {
  69499. promiseCtor = _config__WEBPACK_IMPORTED_MODULE_3__["config"].Promise || Promise;
  69500. }
  69501. if (!promiseCtor) {
  69502. throw new Error('no Promise impl found');
  69503. }
  69504. return promiseCtor;
  69505. }
  69506. //# sourceMappingURL=Observable.js.map
  69507. /***/ }),
  69508. /***/ "./node_modules/rxjs/_esm5/internal/Observer.js":
  69509. /*!******************************************************!*\
  69510. !*** ./node_modules/rxjs/_esm5/internal/Observer.js ***!
  69511. \******************************************************/
  69512. /*! exports provided: empty */
  69513. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69514. "use strict";
  69515. __webpack_require__.r(__webpack_exports__);
  69516. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "empty", function() { return empty; });
  69517. /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./config */ "./node_modules/rxjs/_esm5/internal/config.js");
  69518. /* harmony import */ var _util_hostReportError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/hostReportError */ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js");
  69519. /** PURE_IMPORTS_START _config,_util_hostReportError PURE_IMPORTS_END */
  69520. var empty = {
  69521. closed: true,
  69522. next: function (value) { },
  69523. error: function (err) {
  69524. if (_config__WEBPACK_IMPORTED_MODULE_0__["config"].useDeprecatedSynchronousErrorHandling) {
  69525. throw err;
  69526. }
  69527. else {
  69528. Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_1__["hostReportError"])(err);
  69529. }
  69530. },
  69531. complete: function () { }
  69532. };
  69533. //# sourceMappingURL=Observer.js.map
  69534. /***/ }),
  69535. /***/ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js":
  69536. /*!*************************************************************!*\
  69537. !*** ./node_modules/rxjs/_esm5/internal/OuterSubscriber.js ***!
  69538. \*************************************************************/
  69539. /*! exports provided: OuterSubscriber */
  69540. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69541. "use strict";
  69542. __webpack_require__.r(__webpack_exports__);
  69543. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "OuterSubscriber", function() { return OuterSubscriber; });
  69544. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69545. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  69546. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  69547. var OuterSubscriber = /*@__PURE__*/ (function (_super) {
  69548. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](OuterSubscriber, _super);
  69549. function OuterSubscriber() {
  69550. return _super !== null && _super.apply(this, arguments) || this;
  69551. }
  69552. OuterSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  69553. this.destination.next(innerValue);
  69554. };
  69555. OuterSubscriber.prototype.notifyError = function (error, innerSub) {
  69556. this.destination.error(error);
  69557. };
  69558. OuterSubscriber.prototype.notifyComplete = function (innerSub) {
  69559. this.destination.complete();
  69560. };
  69561. return OuterSubscriber;
  69562. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  69563. //# sourceMappingURL=OuterSubscriber.js.map
  69564. /***/ }),
  69565. /***/ "./node_modules/rxjs/_esm5/internal/ReplaySubject.js":
  69566. /*!***********************************************************!*\
  69567. !*** ./node_modules/rxjs/_esm5/internal/ReplaySubject.js ***!
  69568. \***********************************************************/
  69569. /*! exports provided: ReplaySubject */
  69570. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69571. "use strict";
  69572. __webpack_require__.r(__webpack_exports__);
  69573. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ReplaySubject", function() { return ReplaySubject; });
  69574. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69575. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  69576. /* harmony import */ var _scheduler_queue__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./scheduler/queue */ "./node_modules/rxjs/_esm5/internal/scheduler/queue.js");
  69577. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  69578. /* harmony import */ var _operators_observeOn__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./operators/observeOn */ "./node_modules/rxjs/_esm5/internal/operators/observeOn.js");
  69579. /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js");
  69580. /* harmony import */ var _SubjectSubscription__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./SubjectSubscription */ "./node_modules/rxjs/_esm5/internal/SubjectSubscription.js");
  69581. /** PURE_IMPORTS_START tslib,_Subject,_scheduler_queue,_Subscription,_operators_observeOn,_util_ObjectUnsubscribedError,_SubjectSubscription PURE_IMPORTS_END */
  69582. var ReplaySubject = /*@__PURE__*/ (function (_super) {
  69583. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ReplaySubject, _super);
  69584. function ReplaySubject(bufferSize, windowTime, scheduler) {
  69585. if (bufferSize === void 0) {
  69586. bufferSize = Number.POSITIVE_INFINITY;
  69587. }
  69588. if (windowTime === void 0) {
  69589. windowTime = Number.POSITIVE_INFINITY;
  69590. }
  69591. var _this = _super.call(this) || this;
  69592. _this.scheduler = scheduler;
  69593. _this._events = [];
  69594. _this._infiniteTimeWindow = false;
  69595. _this._bufferSize = bufferSize < 1 ? 1 : bufferSize;
  69596. _this._windowTime = windowTime < 1 ? 1 : windowTime;
  69597. if (windowTime === Number.POSITIVE_INFINITY) {
  69598. _this._infiniteTimeWindow = true;
  69599. _this.next = _this.nextInfiniteTimeWindow;
  69600. }
  69601. else {
  69602. _this.next = _this.nextTimeWindow;
  69603. }
  69604. return _this;
  69605. }
  69606. ReplaySubject.prototype.nextInfiniteTimeWindow = function (value) {
  69607. var _events = this._events;
  69608. _events.push(value);
  69609. if (_events.length > this._bufferSize) {
  69610. _events.shift();
  69611. }
  69612. _super.prototype.next.call(this, value);
  69613. };
  69614. ReplaySubject.prototype.nextTimeWindow = function (value) {
  69615. this._events.push(new ReplayEvent(this._getNow(), value));
  69616. this._trimBufferThenGetEvents();
  69617. _super.prototype.next.call(this, value);
  69618. };
  69619. ReplaySubject.prototype._subscribe = function (subscriber) {
  69620. var _infiniteTimeWindow = this._infiniteTimeWindow;
  69621. var _events = _infiniteTimeWindow ? this._events : this._trimBufferThenGetEvents();
  69622. var scheduler = this.scheduler;
  69623. var len = _events.length;
  69624. var subscription;
  69625. if (this.closed) {
  69626. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_5__["ObjectUnsubscribedError"]();
  69627. }
  69628. else if (this.isStopped || this.hasError) {
  69629. subscription = _Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"].EMPTY;
  69630. }
  69631. else {
  69632. this.observers.push(subscriber);
  69633. subscription = new _SubjectSubscription__WEBPACK_IMPORTED_MODULE_6__["SubjectSubscription"](this, subscriber);
  69634. }
  69635. if (scheduler) {
  69636. subscriber.add(subscriber = new _operators_observeOn__WEBPACK_IMPORTED_MODULE_4__["ObserveOnSubscriber"](subscriber, scheduler));
  69637. }
  69638. if (_infiniteTimeWindow) {
  69639. for (var i = 0; i < len && !subscriber.closed; i++) {
  69640. subscriber.next(_events[i]);
  69641. }
  69642. }
  69643. else {
  69644. for (var i = 0; i < len && !subscriber.closed; i++) {
  69645. subscriber.next(_events[i].value);
  69646. }
  69647. }
  69648. if (this.hasError) {
  69649. subscriber.error(this.thrownError);
  69650. }
  69651. else if (this.isStopped) {
  69652. subscriber.complete();
  69653. }
  69654. return subscription;
  69655. };
  69656. ReplaySubject.prototype._getNow = function () {
  69657. return (this.scheduler || _scheduler_queue__WEBPACK_IMPORTED_MODULE_2__["queue"]).now();
  69658. };
  69659. ReplaySubject.prototype._trimBufferThenGetEvents = function () {
  69660. var now = this._getNow();
  69661. var _bufferSize = this._bufferSize;
  69662. var _windowTime = this._windowTime;
  69663. var _events = this._events;
  69664. var eventsCount = _events.length;
  69665. var spliceCount = 0;
  69666. while (spliceCount < eventsCount) {
  69667. if ((now - _events[spliceCount].time) < _windowTime) {
  69668. break;
  69669. }
  69670. spliceCount++;
  69671. }
  69672. if (eventsCount > _bufferSize) {
  69673. spliceCount = Math.max(spliceCount, eventsCount - _bufferSize);
  69674. }
  69675. if (spliceCount > 0) {
  69676. _events.splice(0, spliceCount);
  69677. }
  69678. return _events;
  69679. };
  69680. return ReplaySubject;
  69681. }(_Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]));
  69682. var ReplayEvent = /*@__PURE__*/ (function () {
  69683. function ReplayEvent(time, value) {
  69684. this.time = time;
  69685. this.value = value;
  69686. }
  69687. return ReplayEvent;
  69688. }());
  69689. //# sourceMappingURL=ReplaySubject.js.map
  69690. /***/ }),
  69691. /***/ "./node_modules/rxjs/_esm5/internal/Scheduler.js":
  69692. /*!*******************************************************!*\
  69693. !*** ./node_modules/rxjs/_esm5/internal/Scheduler.js ***!
  69694. \*******************************************************/
  69695. /*! exports provided: Scheduler */
  69696. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69697. "use strict";
  69698. __webpack_require__.r(__webpack_exports__);
  69699. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Scheduler", function() { return Scheduler; });
  69700. var Scheduler = /*@__PURE__*/ (function () {
  69701. function Scheduler(SchedulerAction, now) {
  69702. if (now === void 0) {
  69703. now = Scheduler.now;
  69704. }
  69705. this.SchedulerAction = SchedulerAction;
  69706. this.now = now;
  69707. }
  69708. Scheduler.prototype.schedule = function (work, delay, state) {
  69709. if (delay === void 0) {
  69710. delay = 0;
  69711. }
  69712. return new this.SchedulerAction(this, work).schedule(state, delay);
  69713. };
  69714. Scheduler.now = function () { return Date.now(); };
  69715. return Scheduler;
  69716. }());
  69717. //# sourceMappingURL=Scheduler.js.map
  69718. /***/ }),
  69719. /***/ "./node_modules/rxjs/_esm5/internal/Subject.js":
  69720. /*!*****************************************************!*\
  69721. !*** ./node_modules/rxjs/_esm5/internal/Subject.js ***!
  69722. \*****************************************************/
  69723. /*! exports provided: SubjectSubscriber, Subject, AnonymousSubject */
  69724. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69725. "use strict";
  69726. __webpack_require__.r(__webpack_exports__);
  69727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubjectSubscriber", function() { return SubjectSubscriber; });
  69728. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subject", function() { return Subject; });
  69729. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnonymousSubject", function() { return AnonymousSubject; });
  69730. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69731. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  69732. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  69733. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  69734. /* harmony import */ var _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/ObjectUnsubscribedError */ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js");
  69735. /* harmony import */ var _SubjectSubscription__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./SubjectSubscription */ "./node_modules/rxjs/_esm5/internal/SubjectSubscription.js");
  69736. /* harmony import */ var _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../internal/symbol/rxSubscriber */ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js");
  69737. /** PURE_IMPORTS_START tslib,_Observable,_Subscriber,_Subscription,_util_ObjectUnsubscribedError,_SubjectSubscription,_internal_symbol_rxSubscriber PURE_IMPORTS_END */
  69738. var SubjectSubscriber = /*@__PURE__*/ (function (_super) {
  69739. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SubjectSubscriber, _super);
  69740. function SubjectSubscriber(destination) {
  69741. var _this = _super.call(this, destination) || this;
  69742. _this.destination = destination;
  69743. return _this;
  69744. }
  69745. return SubjectSubscriber;
  69746. }(_Subscriber__WEBPACK_IMPORTED_MODULE_2__["Subscriber"]));
  69747. var Subject = /*@__PURE__*/ (function (_super) {
  69748. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](Subject, _super);
  69749. function Subject() {
  69750. var _this = _super.call(this) || this;
  69751. _this.observers = [];
  69752. _this.closed = false;
  69753. _this.isStopped = false;
  69754. _this.hasError = false;
  69755. _this.thrownError = null;
  69756. return _this;
  69757. }
  69758. Subject.prototype[_internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_6__["rxSubscriber"]] = function () {
  69759. return new SubjectSubscriber(this);
  69760. };
  69761. Subject.prototype.lift = function (operator) {
  69762. var subject = new AnonymousSubject(this, this);
  69763. subject.operator = operator;
  69764. return subject;
  69765. };
  69766. Subject.prototype.next = function (value) {
  69767. if (this.closed) {
  69768. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__["ObjectUnsubscribedError"]();
  69769. }
  69770. if (!this.isStopped) {
  69771. var observers = this.observers;
  69772. var len = observers.length;
  69773. var copy = observers.slice();
  69774. for (var i = 0; i < len; i++) {
  69775. copy[i].next(value);
  69776. }
  69777. }
  69778. };
  69779. Subject.prototype.error = function (err) {
  69780. if (this.closed) {
  69781. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__["ObjectUnsubscribedError"]();
  69782. }
  69783. this.hasError = true;
  69784. this.thrownError = err;
  69785. this.isStopped = true;
  69786. var observers = this.observers;
  69787. var len = observers.length;
  69788. var copy = observers.slice();
  69789. for (var i = 0; i < len; i++) {
  69790. copy[i].error(err);
  69791. }
  69792. this.observers.length = 0;
  69793. };
  69794. Subject.prototype.complete = function () {
  69795. if (this.closed) {
  69796. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__["ObjectUnsubscribedError"]();
  69797. }
  69798. this.isStopped = true;
  69799. var observers = this.observers;
  69800. var len = observers.length;
  69801. var copy = observers.slice();
  69802. for (var i = 0; i < len; i++) {
  69803. copy[i].complete();
  69804. }
  69805. this.observers.length = 0;
  69806. };
  69807. Subject.prototype.unsubscribe = function () {
  69808. this.isStopped = true;
  69809. this.closed = true;
  69810. this.observers = null;
  69811. };
  69812. Subject.prototype._trySubscribe = function (subscriber) {
  69813. if (this.closed) {
  69814. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__["ObjectUnsubscribedError"]();
  69815. }
  69816. else {
  69817. return _super.prototype._trySubscribe.call(this, subscriber);
  69818. }
  69819. };
  69820. Subject.prototype._subscribe = function (subscriber) {
  69821. if (this.closed) {
  69822. throw new _util_ObjectUnsubscribedError__WEBPACK_IMPORTED_MODULE_4__["ObjectUnsubscribedError"]();
  69823. }
  69824. else if (this.hasError) {
  69825. subscriber.error(this.thrownError);
  69826. return _Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"].EMPTY;
  69827. }
  69828. else if (this.isStopped) {
  69829. subscriber.complete();
  69830. return _Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"].EMPTY;
  69831. }
  69832. else {
  69833. this.observers.push(subscriber);
  69834. return new _SubjectSubscription__WEBPACK_IMPORTED_MODULE_5__["SubjectSubscription"](this, subscriber);
  69835. }
  69836. };
  69837. Subject.prototype.asObservable = function () {
  69838. var observable = new _Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]();
  69839. observable.source = this;
  69840. return observable;
  69841. };
  69842. Subject.create = function (destination, source) {
  69843. return new AnonymousSubject(destination, source);
  69844. };
  69845. return Subject;
  69846. }(_Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]));
  69847. var AnonymousSubject = /*@__PURE__*/ (function (_super) {
  69848. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AnonymousSubject, _super);
  69849. function AnonymousSubject(destination, source) {
  69850. var _this = _super.call(this) || this;
  69851. _this.destination = destination;
  69852. _this.source = source;
  69853. return _this;
  69854. }
  69855. AnonymousSubject.prototype.next = function (value) {
  69856. var destination = this.destination;
  69857. if (destination && destination.next) {
  69858. destination.next(value);
  69859. }
  69860. };
  69861. AnonymousSubject.prototype.error = function (err) {
  69862. var destination = this.destination;
  69863. if (destination && destination.error) {
  69864. this.destination.error(err);
  69865. }
  69866. };
  69867. AnonymousSubject.prototype.complete = function () {
  69868. var destination = this.destination;
  69869. if (destination && destination.complete) {
  69870. this.destination.complete();
  69871. }
  69872. };
  69873. AnonymousSubject.prototype._subscribe = function (subscriber) {
  69874. var source = this.source;
  69875. if (source) {
  69876. return this.source.subscribe(subscriber);
  69877. }
  69878. else {
  69879. return _Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"].EMPTY;
  69880. }
  69881. };
  69882. return AnonymousSubject;
  69883. }(Subject));
  69884. //# sourceMappingURL=Subject.js.map
  69885. /***/ }),
  69886. /***/ "./node_modules/rxjs/_esm5/internal/SubjectSubscription.js":
  69887. /*!*****************************************************************!*\
  69888. !*** ./node_modules/rxjs/_esm5/internal/SubjectSubscription.js ***!
  69889. \*****************************************************************/
  69890. /*! exports provided: SubjectSubscription */
  69891. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69892. "use strict";
  69893. __webpack_require__.r(__webpack_exports__);
  69894. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubjectSubscription", function() { return SubjectSubscription; });
  69895. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69896. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  69897. /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
  69898. var SubjectSubscription = /*@__PURE__*/ (function (_super) {
  69899. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SubjectSubscription, _super);
  69900. function SubjectSubscription(subject, subscriber) {
  69901. var _this = _super.call(this) || this;
  69902. _this.subject = subject;
  69903. _this.subscriber = subscriber;
  69904. _this.closed = false;
  69905. return _this;
  69906. }
  69907. SubjectSubscription.prototype.unsubscribe = function () {
  69908. if (this.closed) {
  69909. return;
  69910. }
  69911. this.closed = true;
  69912. var subject = this.subject;
  69913. var observers = subject.observers;
  69914. this.subject = null;
  69915. if (!observers || observers.length === 0 || subject.isStopped || subject.closed) {
  69916. return;
  69917. }
  69918. var subscriberIndex = observers.indexOf(this.subscriber);
  69919. if (subscriberIndex !== -1) {
  69920. observers.splice(subscriberIndex, 1);
  69921. }
  69922. };
  69923. return SubjectSubscription;
  69924. }(_Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]));
  69925. //# sourceMappingURL=SubjectSubscription.js.map
  69926. /***/ }),
  69927. /***/ "./node_modules/rxjs/_esm5/internal/Subscriber.js":
  69928. /*!********************************************************!*\
  69929. !*** ./node_modules/rxjs/_esm5/internal/Subscriber.js ***!
  69930. \********************************************************/
  69931. /*! exports provided: Subscriber */
  69932. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  69933. "use strict";
  69934. __webpack_require__.r(__webpack_exports__);
  69935. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subscriber", function() { return Subscriber; });
  69936. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  69937. /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js");
  69938. /* harmony import */ var _Observer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./Observer */ "./node_modules/rxjs/_esm5/internal/Observer.js");
  69939. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  69940. /* harmony import */ var _internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../internal/symbol/rxSubscriber */ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js");
  69941. /* harmony import */ var _config__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./config */ "./node_modules/rxjs/_esm5/internal/config.js");
  69942. /* harmony import */ var _util_hostReportError__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./util/hostReportError */ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js");
  69943. /** PURE_IMPORTS_START tslib,_util_isFunction,_Observer,_Subscription,_internal_symbol_rxSubscriber,_config,_util_hostReportError PURE_IMPORTS_END */
  69944. var Subscriber = /*@__PURE__*/ (function (_super) {
  69945. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](Subscriber, _super);
  69946. function Subscriber(destinationOrNext, error, complete) {
  69947. var _this = _super.call(this) || this;
  69948. _this.syncErrorValue = null;
  69949. _this.syncErrorThrown = false;
  69950. _this.syncErrorThrowable = false;
  69951. _this.isStopped = false;
  69952. switch (arguments.length) {
  69953. case 0:
  69954. _this.destination = _Observer__WEBPACK_IMPORTED_MODULE_2__["empty"];
  69955. break;
  69956. case 1:
  69957. if (!destinationOrNext) {
  69958. _this.destination = _Observer__WEBPACK_IMPORTED_MODULE_2__["empty"];
  69959. break;
  69960. }
  69961. if (typeof destinationOrNext === 'object') {
  69962. if (isTrustedSubscriber(destinationOrNext)) {
  69963. var trustedSubscriber = destinationOrNext[_internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_4__["rxSubscriber"]]();
  69964. _this.syncErrorThrowable = trustedSubscriber.syncErrorThrowable;
  69965. _this.destination = trustedSubscriber;
  69966. trustedSubscriber.add(_this);
  69967. }
  69968. else {
  69969. _this.syncErrorThrowable = true;
  69970. _this.destination = new SafeSubscriber(_this, destinationOrNext);
  69971. }
  69972. break;
  69973. }
  69974. default:
  69975. _this.syncErrorThrowable = true;
  69976. _this.destination = new SafeSubscriber(_this, destinationOrNext, error, complete);
  69977. break;
  69978. }
  69979. return _this;
  69980. }
  69981. Subscriber.prototype[_internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_4__["rxSubscriber"]] = function () { return this; };
  69982. Subscriber.create = function (next, error, complete) {
  69983. var subscriber = new Subscriber(next, error, complete);
  69984. subscriber.syncErrorThrowable = false;
  69985. return subscriber;
  69986. };
  69987. Subscriber.prototype.next = function (value) {
  69988. if (!this.isStopped) {
  69989. this._next(value);
  69990. }
  69991. };
  69992. Subscriber.prototype.error = function (err) {
  69993. if (!this.isStopped) {
  69994. this.isStopped = true;
  69995. this._error(err);
  69996. }
  69997. };
  69998. Subscriber.prototype.complete = function () {
  69999. if (!this.isStopped) {
  70000. this.isStopped = true;
  70001. this._complete();
  70002. }
  70003. };
  70004. Subscriber.prototype.unsubscribe = function () {
  70005. if (this.closed) {
  70006. return;
  70007. }
  70008. this.isStopped = true;
  70009. _super.prototype.unsubscribe.call(this);
  70010. };
  70011. Subscriber.prototype._next = function (value) {
  70012. this.destination.next(value);
  70013. };
  70014. Subscriber.prototype._error = function (err) {
  70015. this.destination.error(err);
  70016. this.unsubscribe();
  70017. };
  70018. Subscriber.prototype._complete = function () {
  70019. this.destination.complete();
  70020. this.unsubscribe();
  70021. };
  70022. Subscriber.prototype._unsubscribeAndRecycle = function () {
  70023. var _a = this, _parent = _a._parent, _parents = _a._parents;
  70024. this._parent = null;
  70025. this._parents = null;
  70026. this.unsubscribe();
  70027. this.closed = false;
  70028. this.isStopped = false;
  70029. this._parent = _parent;
  70030. this._parents = _parents;
  70031. return this;
  70032. };
  70033. return Subscriber;
  70034. }(_Subscription__WEBPACK_IMPORTED_MODULE_3__["Subscription"]));
  70035. var SafeSubscriber = /*@__PURE__*/ (function (_super) {
  70036. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SafeSubscriber, _super);
  70037. function SafeSubscriber(_parentSubscriber, observerOrNext, error, complete) {
  70038. var _this = _super.call(this) || this;
  70039. _this._parentSubscriber = _parentSubscriber;
  70040. var next;
  70041. var context = _this;
  70042. if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_1__["isFunction"])(observerOrNext)) {
  70043. next = observerOrNext;
  70044. }
  70045. else if (observerOrNext) {
  70046. next = observerOrNext.next;
  70047. error = observerOrNext.error;
  70048. complete = observerOrNext.complete;
  70049. if (observerOrNext !== _Observer__WEBPACK_IMPORTED_MODULE_2__["empty"]) {
  70050. context = Object.create(observerOrNext);
  70051. if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_1__["isFunction"])(context.unsubscribe)) {
  70052. _this.add(context.unsubscribe.bind(context));
  70053. }
  70054. context.unsubscribe = _this.unsubscribe.bind(_this);
  70055. }
  70056. }
  70057. _this._context = context;
  70058. _this._next = next;
  70059. _this._error = error;
  70060. _this._complete = complete;
  70061. return _this;
  70062. }
  70063. SafeSubscriber.prototype.next = function (value) {
  70064. if (!this.isStopped && this._next) {
  70065. var _parentSubscriber = this._parentSubscriber;
  70066. if (!_config__WEBPACK_IMPORTED_MODULE_5__["config"].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
  70067. this.__tryOrUnsub(this._next, value);
  70068. }
  70069. else if (this.__tryOrSetError(_parentSubscriber, this._next, value)) {
  70070. this.unsubscribe();
  70071. }
  70072. }
  70073. };
  70074. SafeSubscriber.prototype.error = function (err) {
  70075. if (!this.isStopped) {
  70076. var _parentSubscriber = this._parentSubscriber;
  70077. var useDeprecatedSynchronousErrorHandling = _config__WEBPACK_IMPORTED_MODULE_5__["config"].useDeprecatedSynchronousErrorHandling;
  70078. if (this._error) {
  70079. if (!useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
  70080. this.__tryOrUnsub(this._error, err);
  70081. this.unsubscribe();
  70082. }
  70083. else {
  70084. this.__tryOrSetError(_parentSubscriber, this._error, err);
  70085. this.unsubscribe();
  70086. }
  70087. }
  70088. else if (!_parentSubscriber.syncErrorThrowable) {
  70089. this.unsubscribe();
  70090. if (useDeprecatedSynchronousErrorHandling) {
  70091. throw err;
  70092. }
  70093. Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__["hostReportError"])(err);
  70094. }
  70095. else {
  70096. if (useDeprecatedSynchronousErrorHandling) {
  70097. _parentSubscriber.syncErrorValue = err;
  70098. _parentSubscriber.syncErrorThrown = true;
  70099. }
  70100. else {
  70101. Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__["hostReportError"])(err);
  70102. }
  70103. this.unsubscribe();
  70104. }
  70105. }
  70106. };
  70107. SafeSubscriber.prototype.complete = function () {
  70108. var _this = this;
  70109. if (!this.isStopped) {
  70110. var _parentSubscriber = this._parentSubscriber;
  70111. if (this._complete) {
  70112. var wrappedComplete = function () { return _this._complete.call(_this._context); };
  70113. if (!_config__WEBPACK_IMPORTED_MODULE_5__["config"].useDeprecatedSynchronousErrorHandling || !_parentSubscriber.syncErrorThrowable) {
  70114. this.__tryOrUnsub(wrappedComplete);
  70115. this.unsubscribe();
  70116. }
  70117. else {
  70118. this.__tryOrSetError(_parentSubscriber, wrappedComplete);
  70119. this.unsubscribe();
  70120. }
  70121. }
  70122. else {
  70123. this.unsubscribe();
  70124. }
  70125. }
  70126. };
  70127. SafeSubscriber.prototype.__tryOrUnsub = function (fn, value) {
  70128. try {
  70129. fn.call(this._context, value);
  70130. }
  70131. catch (err) {
  70132. this.unsubscribe();
  70133. if (_config__WEBPACK_IMPORTED_MODULE_5__["config"].useDeprecatedSynchronousErrorHandling) {
  70134. throw err;
  70135. }
  70136. else {
  70137. Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__["hostReportError"])(err);
  70138. }
  70139. }
  70140. };
  70141. SafeSubscriber.prototype.__tryOrSetError = function (parent, fn, value) {
  70142. if (!_config__WEBPACK_IMPORTED_MODULE_5__["config"].useDeprecatedSynchronousErrorHandling) {
  70143. throw new Error('bad call');
  70144. }
  70145. try {
  70146. fn.call(this._context, value);
  70147. }
  70148. catch (err) {
  70149. if (_config__WEBPACK_IMPORTED_MODULE_5__["config"].useDeprecatedSynchronousErrorHandling) {
  70150. parent.syncErrorValue = err;
  70151. parent.syncErrorThrown = true;
  70152. return true;
  70153. }
  70154. else {
  70155. Object(_util_hostReportError__WEBPACK_IMPORTED_MODULE_6__["hostReportError"])(err);
  70156. return true;
  70157. }
  70158. }
  70159. return false;
  70160. };
  70161. SafeSubscriber.prototype._unsubscribe = function () {
  70162. var _parentSubscriber = this._parentSubscriber;
  70163. this._context = null;
  70164. this._parentSubscriber = null;
  70165. _parentSubscriber.unsubscribe();
  70166. };
  70167. return SafeSubscriber;
  70168. }(Subscriber));
  70169. function isTrustedSubscriber(obj) {
  70170. return obj instanceof Subscriber || ('syncErrorThrowable' in obj && obj[_internal_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_4__["rxSubscriber"]]);
  70171. }
  70172. //# sourceMappingURL=Subscriber.js.map
  70173. /***/ }),
  70174. /***/ "./node_modules/rxjs/_esm5/internal/Subscription.js":
  70175. /*!**********************************************************!*\
  70176. !*** ./node_modules/rxjs/_esm5/internal/Subscription.js ***!
  70177. \**********************************************************/
  70178. /*! exports provided: Subscription */
  70179. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70180. "use strict";
  70181. __webpack_require__.r(__webpack_exports__);
  70182. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Subscription", function() { return Subscription; });
  70183. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  70184. /* harmony import */ var _util_isObject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./util/isObject */ "./node_modules/rxjs/_esm5/internal/util/isObject.js");
  70185. /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js");
  70186. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  70187. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  70188. /* harmony import */ var _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./util/UnsubscriptionError */ "./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js");
  70189. /** PURE_IMPORTS_START _util_isArray,_util_isObject,_util_isFunction,_util_tryCatch,_util_errorObject,_util_UnsubscriptionError PURE_IMPORTS_END */
  70190. var Subscription = /*@__PURE__*/ (function () {
  70191. function Subscription(unsubscribe) {
  70192. this.closed = false;
  70193. this._parent = null;
  70194. this._parents = null;
  70195. this._subscriptions = null;
  70196. if (unsubscribe) {
  70197. this._unsubscribe = unsubscribe;
  70198. }
  70199. }
  70200. Subscription.prototype.unsubscribe = function () {
  70201. var hasErrors = false;
  70202. var errors;
  70203. if (this.closed) {
  70204. return;
  70205. }
  70206. var _a = this, _parent = _a._parent, _parents = _a._parents, _unsubscribe = _a._unsubscribe, _subscriptions = _a._subscriptions;
  70207. this.closed = true;
  70208. this._parent = null;
  70209. this._parents = null;
  70210. this._subscriptions = null;
  70211. var index = -1;
  70212. var len = _parents ? _parents.length : 0;
  70213. while (_parent) {
  70214. _parent.remove(this);
  70215. _parent = ++index < len && _parents[index] || null;
  70216. }
  70217. if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(_unsubscribe)) {
  70218. var trial = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_3__["tryCatch"])(_unsubscribe).call(this);
  70219. if (trial === _util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"]) {
  70220. hasErrors = true;
  70221. errors = errors || (_util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"].e instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_5__["UnsubscriptionError"] ?
  70222. flattenUnsubscriptionErrors(_util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"].e.errors) : [_util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"].e]);
  70223. }
  70224. }
  70225. if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(_subscriptions)) {
  70226. index = -1;
  70227. len = _subscriptions.length;
  70228. while (++index < len) {
  70229. var sub = _subscriptions[index];
  70230. if (Object(_util_isObject__WEBPACK_IMPORTED_MODULE_1__["isObject"])(sub)) {
  70231. var trial = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_3__["tryCatch"])(sub.unsubscribe).call(sub);
  70232. if (trial === _util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"]) {
  70233. hasErrors = true;
  70234. errors = errors || [];
  70235. var err = _util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"].e;
  70236. if (err instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_5__["UnsubscriptionError"]) {
  70237. errors = errors.concat(flattenUnsubscriptionErrors(err.errors));
  70238. }
  70239. else {
  70240. errors.push(err);
  70241. }
  70242. }
  70243. }
  70244. }
  70245. }
  70246. if (hasErrors) {
  70247. throw new _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_5__["UnsubscriptionError"](errors);
  70248. }
  70249. };
  70250. Subscription.prototype.add = function (teardown) {
  70251. if (!teardown || (teardown === Subscription.EMPTY)) {
  70252. return Subscription.EMPTY;
  70253. }
  70254. if (teardown === this) {
  70255. return this;
  70256. }
  70257. var subscription = teardown;
  70258. switch (typeof teardown) {
  70259. case 'function':
  70260. subscription = new Subscription(teardown);
  70261. case 'object':
  70262. if (subscription.closed || typeof subscription.unsubscribe !== 'function') {
  70263. return subscription;
  70264. }
  70265. else if (this.closed) {
  70266. subscription.unsubscribe();
  70267. return subscription;
  70268. }
  70269. else if (typeof subscription._addParent !== 'function') {
  70270. var tmp = subscription;
  70271. subscription = new Subscription();
  70272. subscription._subscriptions = [tmp];
  70273. }
  70274. break;
  70275. default:
  70276. throw new Error('unrecognized teardown ' + teardown + ' added to Subscription.');
  70277. }
  70278. var subscriptions = this._subscriptions || (this._subscriptions = []);
  70279. subscriptions.push(subscription);
  70280. subscription._addParent(this);
  70281. return subscription;
  70282. };
  70283. Subscription.prototype.remove = function (subscription) {
  70284. var subscriptions = this._subscriptions;
  70285. if (subscriptions) {
  70286. var subscriptionIndex = subscriptions.indexOf(subscription);
  70287. if (subscriptionIndex !== -1) {
  70288. subscriptions.splice(subscriptionIndex, 1);
  70289. }
  70290. }
  70291. };
  70292. Subscription.prototype._addParent = function (parent) {
  70293. var _a = this, _parent = _a._parent, _parents = _a._parents;
  70294. if (!_parent || _parent === parent) {
  70295. this._parent = parent;
  70296. }
  70297. else if (!_parents) {
  70298. this._parents = [parent];
  70299. }
  70300. else if (_parents.indexOf(parent) === -1) {
  70301. _parents.push(parent);
  70302. }
  70303. };
  70304. Subscription.EMPTY = (function (empty) {
  70305. empty.closed = true;
  70306. return empty;
  70307. }(new Subscription()));
  70308. return Subscription;
  70309. }());
  70310. function flattenUnsubscriptionErrors(errors) {
  70311. return errors.reduce(function (errs, err) { return errs.concat((err instanceof _util_UnsubscriptionError__WEBPACK_IMPORTED_MODULE_5__["UnsubscriptionError"]) ? err.errors : err); }, []);
  70312. }
  70313. //# sourceMappingURL=Subscription.js.map
  70314. /***/ }),
  70315. /***/ "./node_modules/rxjs/_esm5/internal/config.js":
  70316. /*!****************************************************!*\
  70317. !*** ./node_modules/rxjs/_esm5/internal/config.js ***!
  70318. \****************************************************/
  70319. /*! exports provided: config */
  70320. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70321. "use strict";
  70322. __webpack_require__.r(__webpack_exports__);
  70323. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "config", function() { return config; });
  70324. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  70325. var _enable_super_gross_mode_that_will_cause_bad_things = false;
  70326. var config = {
  70327. Promise: undefined,
  70328. set useDeprecatedSynchronousErrorHandling(value) {
  70329. if (value) {
  70330. var error = /*@__PURE__*/ new Error();
  70331. /*@__PURE__*/ console.warn('DEPRECATED! RxJS was set to use deprecated synchronous error handling behavior by code at: \n' + error.stack);
  70332. }
  70333. else if (_enable_super_gross_mode_that_will_cause_bad_things) {
  70334. /*@__PURE__*/ console.log('RxJS: Back to a better error behavior. Thank you. <3');
  70335. }
  70336. _enable_super_gross_mode_that_will_cause_bad_things = value;
  70337. },
  70338. get useDeprecatedSynchronousErrorHandling() {
  70339. return _enable_super_gross_mode_that_will_cause_bad_things;
  70340. },
  70341. };
  70342. //# sourceMappingURL=config.js.map
  70343. /***/ }),
  70344. /***/ "./node_modules/rxjs/_esm5/internal/observable/ConnectableObservable.js":
  70345. /*!******************************************************************************!*\
  70346. !*** ./node_modules/rxjs/_esm5/internal/observable/ConnectableObservable.js ***!
  70347. \******************************************************************************/
  70348. /*! exports provided: ConnectableObservable, connectableObservableDescriptor */
  70349. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70350. "use strict";
  70351. __webpack_require__.r(__webpack_exports__);
  70352. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ConnectableObservable", function() { return ConnectableObservable; });
  70353. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "connectableObservableDescriptor", function() { return connectableObservableDescriptor; });
  70354. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  70355. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  70356. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70357. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  70358. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  70359. /* harmony import */ var _operators_refCount__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../operators/refCount */ "./node_modules/rxjs/_esm5/internal/operators/refCount.js");
  70360. /** PURE_IMPORTS_START tslib,_Subject,_Observable,_Subscriber,_Subscription,_operators_refCount PURE_IMPORTS_END */
  70361. var ConnectableObservable = /*@__PURE__*/ (function (_super) {
  70362. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ConnectableObservable, _super);
  70363. function ConnectableObservable(source, subjectFactory) {
  70364. var _this = _super.call(this) || this;
  70365. _this.source = source;
  70366. _this.subjectFactory = subjectFactory;
  70367. _this._refCount = 0;
  70368. _this._isComplete = false;
  70369. return _this;
  70370. }
  70371. ConnectableObservable.prototype._subscribe = function (subscriber) {
  70372. return this.getSubject().subscribe(subscriber);
  70373. };
  70374. ConnectableObservable.prototype.getSubject = function () {
  70375. var subject = this._subject;
  70376. if (!subject || subject.isStopped) {
  70377. this._subject = this.subjectFactory();
  70378. }
  70379. return this._subject;
  70380. };
  70381. ConnectableObservable.prototype.connect = function () {
  70382. var connection = this._connection;
  70383. if (!connection) {
  70384. this._isComplete = false;
  70385. connection = this._connection = new _Subscription__WEBPACK_IMPORTED_MODULE_4__["Subscription"]();
  70386. connection.add(this.source
  70387. .subscribe(new ConnectableSubscriber(this.getSubject(), this)));
  70388. if (connection.closed) {
  70389. this._connection = null;
  70390. connection = _Subscription__WEBPACK_IMPORTED_MODULE_4__["Subscription"].EMPTY;
  70391. }
  70392. else {
  70393. this._connection = connection;
  70394. }
  70395. }
  70396. return connection;
  70397. };
  70398. ConnectableObservable.prototype.refCount = function () {
  70399. return Object(_operators_refCount__WEBPACK_IMPORTED_MODULE_5__["refCount"])()(this);
  70400. };
  70401. return ConnectableObservable;
  70402. }(_Observable__WEBPACK_IMPORTED_MODULE_2__["Observable"]));
  70403. var connectableProto = ConnectableObservable.prototype;
  70404. var connectableObservableDescriptor = {
  70405. operator: { value: null },
  70406. _refCount: { value: 0, writable: true },
  70407. _subject: { value: null, writable: true },
  70408. _connection: { value: null, writable: true },
  70409. _subscribe: { value: connectableProto._subscribe },
  70410. _isComplete: { value: connectableProto._isComplete, writable: true },
  70411. getSubject: { value: connectableProto.getSubject },
  70412. connect: { value: connectableProto.connect },
  70413. refCount: { value: connectableProto.refCount }
  70414. };
  70415. var ConnectableSubscriber = /*@__PURE__*/ (function (_super) {
  70416. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ConnectableSubscriber, _super);
  70417. function ConnectableSubscriber(destination, connectable) {
  70418. var _this = _super.call(this, destination) || this;
  70419. _this.connectable = connectable;
  70420. return _this;
  70421. }
  70422. ConnectableSubscriber.prototype._error = function (err) {
  70423. this._unsubscribe();
  70424. _super.prototype._error.call(this, err);
  70425. };
  70426. ConnectableSubscriber.prototype._complete = function () {
  70427. this.connectable._isComplete = true;
  70428. this._unsubscribe();
  70429. _super.prototype._complete.call(this);
  70430. };
  70431. ConnectableSubscriber.prototype._unsubscribe = function () {
  70432. var connectable = this.connectable;
  70433. if (connectable) {
  70434. this.connectable = null;
  70435. var connection = connectable._connection;
  70436. connectable._refCount = 0;
  70437. connectable._subject = null;
  70438. connectable._connection = null;
  70439. if (connection) {
  70440. connection.unsubscribe();
  70441. }
  70442. }
  70443. };
  70444. return ConnectableSubscriber;
  70445. }(_Subject__WEBPACK_IMPORTED_MODULE_1__["SubjectSubscriber"]));
  70446. var RefCountOperator = /*@__PURE__*/ (function () {
  70447. function RefCountOperator(connectable) {
  70448. this.connectable = connectable;
  70449. }
  70450. RefCountOperator.prototype.call = function (subscriber, source) {
  70451. var connectable = this.connectable;
  70452. connectable._refCount++;
  70453. var refCounter = new RefCountSubscriber(subscriber, connectable);
  70454. var subscription = source.subscribe(refCounter);
  70455. if (!refCounter.closed) {
  70456. refCounter.connection = connectable.connect();
  70457. }
  70458. return subscription;
  70459. };
  70460. return RefCountOperator;
  70461. }());
  70462. var RefCountSubscriber = /*@__PURE__*/ (function (_super) {
  70463. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RefCountSubscriber, _super);
  70464. function RefCountSubscriber(destination, connectable) {
  70465. var _this = _super.call(this, destination) || this;
  70466. _this.connectable = connectable;
  70467. return _this;
  70468. }
  70469. RefCountSubscriber.prototype._unsubscribe = function () {
  70470. var connectable = this.connectable;
  70471. if (!connectable) {
  70472. this.connection = null;
  70473. return;
  70474. }
  70475. this.connectable = null;
  70476. var refCount = connectable._refCount;
  70477. if (refCount <= 0) {
  70478. this.connection = null;
  70479. return;
  70480. }
  70481. connectable._refCount = refCount - 1;
  70482. if (refCount > 1) {
  70483. this.connection = null;
  70484. return;
  70485. }
  70486. var connection = this.connection;
  70487. var sharedConnection = connectable._connection;
  70488. this.connection = null;
  70489. if (sharedConnection && (!connection || sharedConnection === connection)) {
  70490. sharedConnection.unsubscribe();
  70491. }
  70492. };
  70493. return RefCountSubscriber;
  70494. }(_Subscriber__WEBPACK_IMPORTED_MODULE_3__["Subscriber"]));
  70495. //# sourceMappingURL=ConnectableObservable.js.map
  70496. /***/ }),
  70497. /***/ "./node_modules/rxjs/_esm5/internal/observable/SubscribeOnObservable.js":
  70498. /*!******************************************************************************!*\
  70499. !*** ./node_modules/rxjs/_esm5/internal/observable/SubscribeOnObservable.js ***!
  70500. \******************************************************************************/
  70501. /*! exports provided: SubscribeOnObservable */
  70502. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70503. "use strict";
  70504. __webpack_require__.r(__webpack_exports__);
  70505. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SubscribeOnObservable", function() { return SubscribeOnObservable; });
  70506. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  70507. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70508. /* harmony import */ var _scheduler_asap__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scheduler/asap */ "./node_modules/rxjs/_esm5/internal/scheduler/asap.js");
  70509. /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isNumeric */ "./node_modules/rxjs/_esm5/internal/util/isNumeric.js");
  70510. /** PURE_IMPORTS_START tslib,_Observable,_scheduler_asap,_util_isNumeric PURE_IMPORTS_END */
  70511. var SubscribeOnObservable = /*@__PURE__*/ (function (_super) {
  70512. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SubscribeOnObservable, _super);
  70513. function SubscribeOnObservable(source, delayTime, scheduler) {
  70514. if (delayTime === void 0) {
  70515. delayTime = 0;
  70516. }
  70517. if (scheduler === void 0) {
  70518. scheduler = _scheduler_asap__WEBPACK_IMPORTED_MODULE_2__["asap"];
  70519. }
  70520. var _this = _super.call(this) || this;
  70521. _this.source = source;
  70522. _this.delayTime = delayTime;
  70523. _this.scheduler = scheduler;
  70524. if (!Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_3__["isNumeric"])(delayTime) || delayTime < 0) {
  70525. _this.delayTime = 0;
  70526. }
  70527. if (!scheduler || typeof scheduler.schedule !== 'function') {
  70528. _this.scheduler = _scheduler_asap__WEBPACK_IMPORTED_MODULE_2__["asap"];
  70529. }
  70530. return _this;
  70531. }
  70532. SubscribeOnObservable.create = function (source, delay, scheduler) {
  70533. if (delay === void 0) {
  70534. delay = 0;
  70535. }
  70536. if (scheduler === void 0) {
  70537. scheduler = _scheduler_asap__WEBPACK_IMPORTED_MODULE_2__["asap"];
  70538. }
  70539. return new SubscribeOnObservable(source, delay, scheduler);
  70540. };
  70541. SubscribeOnObservable.dispatch = function (arg) {
  70542. var source = arg.source, subscriber = arg.subscriber;
  70543. return this.add(source.subscribe(subscriber));
  70544. };
  70545. SubscribeOnObservable.prototype._subscribe = function (subscriber) {
  70546. var delay = this.delayTime;
  70547. var source = this.source;
  70548. var scheduler = this.scheduler;
  70549. return scheduler.schedule(SubscribeOnObservable.dispatch, delay, {
  70550. source: source, subscriber: subscriber
  70551. });
  70552. };
  70553. return SubscribeOnObservable;
  70554. }(_Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"]));
  70555. //# sourceMappingURL=SubscribeOnObservable.js.map
  70556. /***/ }),
  70557. /***/ "./node_modules/rxjs/_esm5/internal/observable/bindCallback.js":
  70558. /*!*********************************************************************!*\
  70559. !*** ./node_modules/rxjs/_esm5/internal/observable/bindCallback.js ***!
  70560. \*********************************************************************/
  70561. /*! exports provided: bindCallback */
  70562. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70563. "use strict";
  70564. __webpack_require__.r(__webpack_exports__);
  70565. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindCallback", function() { return bindCallback; });
  70566. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70567. /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AsyncSubject */ "./node_modules/rxjs/_esm5/internal/AsyncSubject.js");
  70568. /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../operators/map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  70569. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  70570. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  70571. /** PURE_IMPORTS_START _Observable,_AsyncSubject,_operators_map,_util_isArray,_util_isScheduler PURE_IMPORTS_END */
  70572. function bindCallback(callbackFunc, resultSelector, scheduler) {
  70573. if (resultSelector) {
  70574. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(resultSelector)) {
  70575. scheduler = resultSelector;
  70576. }
  70577. else {
  70578. return function () {
  70579. var args = [];
  70580. for (var _i = 0; _i < arguments.length; _i++) {
  70581. args[_i] = arguments[_i];
  70582. }
  70583. return bindCallback(callbackFunc, scheduler).apply(void 0, args).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_2__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_3__["isArray"])(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
  70584. };
  70585. }
  70586. }
  70587. return function () {
  70588. var args = [];
  70589. for (var _i = 0; _i < arguments.length; _i++) {
  70590. args[_i] = arguments[_i];
  70591. }
  70592. var context = this;
  70593. var subject;
  70594. var params = {
  70595. context: context,
  70596. subject: subject,
  70597. callbackFunc: callbackFunc,
  70598. scheduler: scheduler,
  70599. };
  70600. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  70601. if (!scheduler) {
  70602. if (!subject) {
  70603. subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"]();
  70604. var handler = function () {
  70605. var innerArgs = [];
  70606. for (var _i = 0; _i < arguments.length; _i++) {
  70607. innerArgs[_i] = arguments[_i];
  70608. }
  70609. subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
  70610. subject.complete();
  70611. };
  70612. try {
  70613. callbackFunc.apply(context, args.concat([handler]));
  70614. }
  70615. catch (err) {
  70616. subject.error(err);
  70617. }
  70618. }
  70619. return subject.subscribe(subscriber);
  70620. }
  70621. else {
  70622. var state = {
  70623. args: args, subscriber: subscriber, params: params,
  70624. };
  70625. return scheduler.schedule(dispatch, 0, state);
  70626. }
  70627. });
  70628. };
  70629. }
  70630. function dispatch(state) {
  70631. var _this = this;
  70632. var self = this;
  70633. var args = state.args, subscriber = state.subscriber, params = state.params;
  70634. var callbackFunc = params.callbackFunc, context = params.context, scheduler = params.scheduler;
  70635. var subject = params.subject;
  70636. if (!subject) {
  70637. subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"]();
  70638. var handler = function () {
  70639. var innerArgs = [];
  70640. for (var _i = 0; _i < arguments.length; _i++) {
  70641. innerArgs[_i] = arguments[_i];
  70642. }
  70643. var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
  70644. _this.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
  70645. };
  70646. try {
  70647. callbackFunc.apply(context, args.concat([handler]));
  70648. }
  70649. catch (err) {
  70650. subject.error(err);
  70651. }
  70652. }
  70653. this.add(subject.subscribe(subscriber));
  70654. }
  70655. function dispatchNext(state) {
  70656. var value = state.value, subject = state.subject;
  70657. subject.next(value);
  70658. subject.complete();
  70659. }
  70660. function dispatchError(state) {
  70661. var err = state.err, subject = state.subject;
  70662. subject.error(err);
  70663. }
  70664. //# sourceMappingURL=bindCallback.js.map
  70665. /***/ }),
  70666. /***/ "./node_modules/rxjs/_esm5/internal/observable/bindNodeCallback.js":
  70667. /*!*************************************************************************!*\
  70668. !*** ./node_modules/rxjs/_esm5/internal/observable/bindNodeCallback.js ***!
  70669. \*************************************************************************/
  70670. /*! exports provided: bindNodeCallback */
  70671. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70672. "use strict";
  70673. __webpack_require__.r(__webpack_exports__);
  70674. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bindNodeCallback", function() { return bindNodeCallback; });
  70675. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70676. /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../AsyncSubject */ "./node_modules/rxjs/_esm5/internal/AsyncSubject.js");
  70677. /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../operators/map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  70678. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  70679. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  70680. /** PURE_IMPORTS_START _Observable,_AsyncSubject,_operators_map,_util_isScheduler,_util_isArray PURE_IMPORTS_END */
  70681. function bindNodeCallback(callbackFunc, resultSelector, scheduler) {
  70682. if (resultSelector) {
  70683. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(resultSelector)) {
  70684. scheduler = resultSelector;
  70685. }
  70686. else {
  70687. return function () {
  70688. var args = [];
  70689. for (var _i = 0; _i < arguments.length; _i++) {
  70690. args[_i] = arguments[_i];
  70691. }
  70692. return bindNodeCallback(callbackFunc, scheduler).apply(void 0, args).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_2__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_4__["isArray"])(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
  70693. };
  70694. }
  70695. }
  70696. return function () {
  70697. var args = [];
  70698. for (var _i = 0; _i < arguments.length; _i++) {
  70699. args[_i] = arguments[_i];
  70700. }
  70701. var params = {
  70702. subject: undefined,
  70703. args: args,
  70704. callbackFunc: callbackFunc,
  70705. scheduler: scheduler,
  70706. context: this,
  70707. };
  70708. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  70709. var context = params.context;
  70710. var subject = params.subject;
  70711. if (!scheduler) {
  70712. if (!subject) {
  70713. subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"]();
  70714. var handler = function () {
  70715. var innerArgs = [];
  70716. for (var _i = 0; _i < arguments.length; _i++) {
  70717. innerArgs[_i] = arguments[_i];
  70718. }
  70719. var err = innerArgs.shift();
  70720. if (err) {
  70721. subject.error(err);
  70722. return;
  70723. }
  70724. subject.next(innerArgs.length <= 1 ? innerArgs[0] : innerArgs);
  70725. subject.complete();
  70726. };
  70727. try {
  70728. callbackFunc.apply(context, args.concat([handler]));
  70729. }
  70730. catch (err) {
  70731. subject.error(err);
  70732. }
  70733. }
  70734. return subject.subscribe(subscriber);
  70735. }
  70736. else {
  70737. return scheduler.schedule(dispatch, 0, { params: params, subscriber: subscriber, context: context });
  70738. }
  70739. });
  70740. };
  70741. }
  70742. function dispatch(state) {
  70743. var _this = this;
  70744. var params = state.params, subscriber = state.subscriber, context = state.context;
  70745. var callbackFunc = params.callbackFunc, args = params.args, scheduler = params.scheduler;
  70746. var subject = params.subject;
  70747. if (!subject) {
  70748. subject = params.subject = new _AsyncSubject__WEBPACK_IMPORTED_MODULE_1__["AsyncSubject"]();
  70749. var handler = function () {
  70750. var innerArgs = [];
  70751. for (var _i = 0; _i < arguments.length; _i++) {
  70752. innerArgs[_i] = arguments[_i];
  70753. }
  70754. var err = innerArgs.shift();
  70755. if (err) {
  70756. _this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));
  70757. }
  70758. else {
  70759. var value = innerArgs.length <= 1 ? innerArgs[0] : innerArgs;
  70760. _this.add(scheduler.schedule(dispatchNext, 0, { value: value, subject: subject }));
  70761. }
  70762. };
  70763. try {
  70764. callbackFunc.apply(context, args.concat([handler]));
  70765. }
  70766. catch (err) {
  70767. this.add(scheduler.schedule(dispatchError, 0, { err: err, subject: subject }));
  70768. }
  70769. }
  70770. this.add(subject.subscribe(subscriber));
  70771. }
  70772. function dispatchNext(arg) {
  70773. var value = arg.value, subject = arg.subject;
  70774. subject.next(value);
  70775. subject.complete();
  70776. }
  70777. function dispatchError(arg) {
  70778. var err = arg.err, subject = arg.subject;
  70779. subject.error(err);
  70780. }
  70781. //# sourceMappingURL=bindNodeCallback.js.map
  70782. /***/ }),
  70783. /***/ "./node_modules/rxjs/_esm5/internal/observable/combineLatest.js":
  70784. /*!**********************************************************************!*\
  70785. !*** ./node_modules/rxjs/_esm5/internal/observable/combineLatest.js ***!
  70786. \**********************************************************************/
  70787. /*! exports provided: combineLatest, CombineLatestOperator, CombineLatestSubscriber */
  70788. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70789. "use strict";
  70790. __webpack_require__.r(__webpack_exports__);
  70791. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return combineLatest; });
  70792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CombineLatestOperator", function() { return CombineLatestOperator; });
  70793. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "CombineLatestSubscriber", function() { return CombineLatestSubscriber; });
  70794. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  70795. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  70796. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  70797. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  70798. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  70799. /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  70800. /** PURE_IMPORTS_START tslib,_util_isScheduler,_util_isArray,_OuterSubscriber,_util_subscribeToResult,_fromArray PURE_IMPORTS_END */
  70801. var NONE = {};
  70802. function combineLatest() {
  70803. var observables = [];
  70804. for (var _i = 0; _i < arguments.length; _i++) {
  70805. observables[_i] = arguments[_i];
  70806. }
  70807. var resultSelector = null;
  70808. var scheduler = null;
  70809. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_1__["isScheduler"])(observables[observables.length - 1])) {
  70810. scheduler = observables.pop();
  70811. }
  70812. if (typeof observables[observables.length - 1] === 'function') {
  70813. resultSelector = observables.pop();
  70814. }
  70815. if (observables.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(observables[0])) {
  70816. observables = observables[0];
  70817. }
  70818. return Object(_fromArray__WEBPACK_IMPORTED_MODULE_5__["fromArray"])(observables, scheduler).lift(new CombineLatestOperator(resultSelector));
  70819. }
  70820. var CombineLatestOperator = /*@__PURE__*/ (function () {
  70821. function CombineLatestOperator(resultSelector) {
  70822. this.resultSelector = resultSelector;
  70823. }
  70824. CombineLatestOperator.prototype.call = function (subscriber, source) {
  70825. return source.subscribe(new CombineLatestSubscriber(subscriber, this.resultSelector));
  70826. };
  70827. return CombineLatestOperator;
  70828. }());
  70829. var CombineLatestSubscriber = /*@__PURE__*/ (function (_super) {
  70830. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](CombineLatestSubscriber, _super);
  70831. function CombineLatestSubscriber(destination, resultSelector) {
  70832. var _this = _super.call(this, destination) || this;
  70833. _this.resultSelector = resultSelector;
  70834. _this.active = 0;
  70835. _this.values = [];
  70836. _this.observables = [];
  70837. return _this;
  70838. }
  70839. CombineLatestSubscriber.prototype._next = function (observable) {
  70840. this.values.push(NONE);
  70841. this.observables.push(observable);
  70842. };
  70843. CombineLatestSubscriber.prototype._complete = function () {
  70844. var observables = this.observables;
  70845. var len = observables.length;
  70846. if (len === 0) {
  70847. this.destination.complete();
  70848. }
  70849. else {
  70850. this.active = len;
  70851. this.toRespond = len;
  70852. for (var i = 0; i < len; i++) {
  70853. var observable = observables[i];
  70854. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(this, observable, observable, i));
  70855. }
  70856. }
  70857. };
  70858. CombineLatestSubscriber.prototype.notifyComplete = function (unused) {
  70859. if ((this.active -= 1) === 0) {
  70860. this.destination.complete();
  70861. }
  70862. };
  70863. CombineLatestSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  70864. var values = this.values;
  70865. var oldVal = values[outerIndex];
  70866. var toRespond = !this.toRespond
  70867. ? 0
  70868. : oldVal === NONE ? --this.toRespond : this.toRespond;
  70869. values[outerIndex] = innerValue;
  70870. if (toRespond === 0) {
  70871. if (this.resultSelector) {
  70872. this._tryResultSelector(values);
  70873. }
  70874. else {
  70875. this.destination.next(values.slice());
  70876. }
  70877. }
  70878. };
  70879. CombineLatestSubscriber.prototype._tryResultSelector = function (values) {
  70880. var result;
  70881. try {
  70882. result = this.resultSelector.apply(this, values);
  70883. }
  70884. catch (err) {
  70885. this.destination.error(err);
  70886. return;
  70887. }
  70888. this.destination.next(result);
  70889. };
  70890. return CombineLatestSubscriber;
  70891. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  70892. //# sourceMappingURL=combineLatest.js.map
  70893. /***/ }),
  70894. /***/ "./node_modules/rxjs/_esm5/internal/observable/concat.js":
  70895. /*!***************************************************************!*\
  70896. !*** ./node_modules/rxjs/_esm5/internal/observable/concat.js ***!
  70897. \***************************************************************/
  70898. /*! exports provided: concat */
  70899. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70900. "use strict";
  70901. __webpack_require__.r(__webpack_exports__);
  70902. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return concat; });
  70903. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  70904. /* harmony import */ var _of__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./of */ "./node_modules/rxjs/_esm5/internal/observable/of.js");
  70905. /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  70906. /* harmony import */ var _operators_concatAll__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../operators/concatAll */ "./node_modules/rxjs/_esm5/internal/operators/concatAll.js");
  70907. /** PURE_IMPORTS_START _util_isScheduler,_of,_from,_operators_concatAll PURE_IMPORTS_END */
  70908. function concat() {
  70909. var observables = [];
  70910. for (var _i = 0; _i < arguments.length; _i++) {
  70911. observables[_i] = arguments[_i];
  70912. }
  70913. if (observables.length === 1 || (observables.length === 2 && Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_0__["isScheduler"])(observables[1]))) {
  70914. return Object(_from__WEBPACK_IMPORTED_MODULE_2__["from"])(observables[0]);
  70915. }
  70916. return Object(_operators_concatAll__WEBPACK_IMPORTED_MODULE_3__["concatAll"])()(_of__WEBPACK_IMPORTED_MODULE_1__["of"].apply(void 0, observables));
  70917. }
  70918. //# sourceMappingURL=concat.js.map
  70919. /***/ }),
  70920. /***/ "./node_modules/rxjs/_esm5/internal/observable/defer.js":
  70921. /*!**************************************************************!*\
  70922. !*** ./node_modules/rxjs/_esm5/internal/observable/defer.js ***!
  70923. \**************************************************************/
  70924. /*! exports provided: defer */
  70925. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70926. "use strict";
  70927. __webpack_require__.r(__webpack_exports__);
  70928. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defer", function() { return defer; });
  70929. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70930. /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  70931. /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  70932. /** PURE_IMPORTS_START _Observable,_from,_empty PURE_IMPORTS_END */
  70933. function defer(observableFactory) {
  70934. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  70935. var input;
  70936. try {
  70937. input = observableFactory();
  70938. }
  70939. catch (err) {
  70940. subscriber.error(err);
  70941. return undefined;
  70942. }
  70943. var source = input ? Object(_from__WEBPACK_IMPORTED_MODULE_1__["from"])(input) : Object(_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])();
  70944. return source.subscribe(subscriber);
  70945. });
  70946. }
  70947. //# sourceMappingURL=defer.js.map
  70948. /***/ }),
  70949. /***/ "./node_modules/rxjs/_esm5/internal/observable/empty.js":
  70950. /*!**************************************************************!*\
  70951. !*** ./node_modules/rxjs/_esm5/internal/observable/empty.js ***!
  70952. \**************************************************************/
  70953. /*! exports provided: EMPTY, empty, emptyScheduled */
  70954. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70955. "use strict";
  70956. __webpack_require__.r(__webpack_exports__);
  70957. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EMPTY", function() { return EMPTY; });
  70958. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "empty", function() { return empty; });
  70959. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "emptyScheduled", function() { return emptyScheduled; });
  70960. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70961. /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
  70962. var EMPTY = /*@__PURE__*/ new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return subscriber.complete(); });
  70963. function empty(scheduler) {
  70964. return scheduler ? emptyScheduled(scheduler) : EMPTY;
  70965. }
  70966. function emptyScheduled(scheduler) {
  70967. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return scheduler.schedule(function () { return subscriber.complete(); }); });
  70968. }
  70969. //# sourceMappingURL=empty.js.map
  70970. /***/ }),
  70971. /***/ "./node_modules/rxjs/_esm5/internal/observable/forkJoin.js":
  70972. /*!*****************************************************************!*\
  70973. !*** ./node_modules/rxjs/_esm5/internal/observable/forkJoin.js ***!
  70974. \*****************************************************************/
  70975. /*! exports provided: forkJoin */
  70976. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  70977. "use strict";
  70978. __webpack_require__.r(__webpack_exports__);
  70979. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "forkJoin", function() { return forkJoin; });
  70980. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  70981. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  70982. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  70983. /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  70984. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  70985. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  70986. /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../operators/map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  70987. /** PURE_IMPORTS_START tslib,_Observable,_util_isArray,_empty,_util_subscribeToResult,_OuterSubscriber,_operators_map PURE_IMPORTS_END */
  70988. function forkJoin() {
  70989. var sources = [];
  70990. for (var _i = 0; _i < arguments.length; _i++) {
  70991. sources[_i] = arguments[_i];
  70992. }
  70993. var resultSelector;
  70994. if (typeof sources[sources.length - 1] === 'function') {
  70995. resultSelector = sources.pop();
  70996. }
  70997. if (sources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(sources[0])) {
  70998. sources = sources[0];
  70999. }
  71000. if (sources.length === 0) {
  71001. return _empty__WEBPACK_IMPORTED_MODULE_3__["EMPTY"];
  71002. }
  71003. if (resultSelector) {
  71004. return forkJoin(sources).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_6__["map"])(function (args) { return resultSelector.apply(void 0, args); }));
  71005. }
  71006. return new _Observable__WEBPACK_IMPORTED_MODULE_1__["Observable"](function (subscriber) {
  71007. return new ForkJoinSubscriber(subscriber, sources);
  71008. });
  71009. }
  71010. var ForkJoinSubscriber = /*@__PURE__*/ (function (_super) {
  71011. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ForkJoinSubscriber, _super);
  71012. function ForkJoinSubscriber(destination, sources) {
  71013. var _this = _super.call(this, destination) || this;
  71014. _this.sources = sources;
  71015. _this.completed = 0;
  71016. _this.haveValues = 0;
  71017. var len = sources.length;
  71018. _this.values = new Array(len);
  71019. for (var i = 0; i < len; i++) {
  71020. var source = sources[i];
  71021. var innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(_this, source, null, i);
  71022. if (innerSubscription) {
  71023. _this.add(innerSubscription);
  71024. }
  71025. }
  71026. return _this;
  71027. }
  71028. ForkJoinSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  71029. this.values[outerIndex] = innerValue;
  71030. if (!innerSub._hasValue) {
  71031. innerSub._hasValue = true;
  71032. this.haveValues++;
  71033. }
  71034. };
  71035. ForkJoinSubscriber.prototype.notifyComplete = function (innerSub) {
  71036. var _a = this, destination = _a.destination, haveValues = _a.haveValues, values = _a.values;
  71037. var len = values.length;
  71038. if (!innerSub._hasValue) {
  71039. destination.complete();
  71040. return;
  71041. }
  71042. this.completed++;
  71043. if (this.completed !== len) {
  71044. return;
  71045. }
  71046. if (haveValues === len) {
  71047. destination.next(values);
  71048. }
  71049. destination.complete();
  71050. };
  71051. return ForkJoinSubscriber;
  71052. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_5__["OuterSubscriber"]));
  71053. //# sourceMappingURL=forkJoin.js.map
  71054. /***/ }),
  71055. /***/ "./node_modules/rxjs/_esm5/internal/observable/from.js":
  71056. /*!*************************************************************!*\
  71057. !*** ./node_modules/rxjs/_esm5/internal/observable/from.js ***!
  71058. \*************************************************************/
  71059. /*! exports provided: from */
  71060. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71061. "use strict";
  71062. __webpack_require__.r(__webpack_exports__);
  71063. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "from", function() { return from; });
  71064. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71065. /* harmony import */ var _util_isPromise__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/isPromise */ "./node_modules/rxjs/_esm5/internal/util/isPromise.js");
  71066. /* harmony import */ var _util_isArrayLike__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isArrayLike */ "./node_modules/rxjs/_esm5/internal/util/isArrayLike.js");
  71067. /* harmony import */ var _util_isInteropObservable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isInteropObservable */ "./node_modules/rxjs/_esm5/internal/util/isInteropObservable.js");
  71068. /* harmony import */ var _util_isIterable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/isIterable */ "./node_modules/rxjs/_esm5/internal/util/isIterable.js");
  71069. /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  71070. /* harmony import */ var _fromPromise__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./fromPromise */ "./node_modules/rxjs/_esm5/internal/observable/fromPromise.js");
  71071. /* harmony import */ var _fromIterable__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./fromIterable */ "./node_modules/rxjs/_esm5/internal/observable/fromIterable.js");
  71072. /* harmony import */ var _fromObservable__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ./fromObservable */ "./node_modules/rxjs/_esm5/internal/observable/fromObservable.js");
  71073. /* harmony import */ var _util_subscribeTo__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../util/subscribeTo */ "./node_modules/rxjs/_esm5/internal/util/subscribeTo.js");
  71074. /** PURE_IMPORTS_START _Observable,_util_isPromise,_util_isArrayLike,_util_isInteropObservable,_util_isIterable,_fromArray,_fromPromise,_fromIterable,_fromObservable,_util_subscribeTo PURE_IMPORTS_END */
  71075. function from(input, scheduler) {
  71076. if (!scheduler) {
  71077. if (input instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]) {
  71078. return input;
  71079. }
  71080. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeTo__WEBPACK_IMPORTED_MODULE_9__["subscribeTo"])(input));
  71081. }
  71082. if (input != null) {
  71083. if (Object(_util_isInteropObservable__WEBPACK_IMPORTED_MODULE_3__["isInteropObservable"])(input)) {
  71084. return Object(_fromObservable__WEBPACK_IMPORTED_MODULE_8__["fromObservable"])(input, scheduler);
  71085. }
  71086. else if (Object(_util_isPromise__WEBPACK_IMPORTED_MODULE_1__["isPromise"])(input)) {
  71087. return Object(_fromPromise__WEBPACK_IMPORTED_MODULE_6__["fromPromise"])(input, scheduler);
  71088. }
  71089. else if (Object(_util_isArrayLike__WEBPACK_IMPORTED_MODULE_2__["isArrayLike"])(input)) {
  71090. return Object(_fromArray__WEBPACK_IMPORTED_MODULE_5__["fromArray"])(input, scheduler);
  71091. }
  71092. else if (Object(_util_isIterable__WEBPACK_IMPORTED_MODULE_4__["isIterable"])(input) || typeof input === 'string') {
  71093. return Object(_fromIterable__WEBPACK_IMPORTED_MODULE_7__["fromIterable"])(input, scheduler);
  71094. }
  71095. }
  71096. throw new TypeError((input !== null && typeof input || input) + ' is not observable');
  71097. }
  71098. //# sourceMappingURL=from.js.map
  71099. /***/ }),
  71100. /***/ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js":
  71101. /*!******************************************************************!*\
  71102. !*** ./node_modules/rxjs/_esm5/internal/observable/fromArray.js ***!
  71103. \******************************************************************/
  71104. /*! exports provided: fromArray */
  71105. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71106. "use strict";
  71107. __webpack_require__.r(__webpack_exports__);
  71108. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromArray", function() { return fromArray; });
  71109. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71110. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  71111. /* harmony import */ var _util_subscribeToArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToArray */ "./node_modules/rxjs/_esm5/internal/util/subscribeToArray.js");
  71112. /** PURE_IMPORTS_START _Observable,_Subscription,_util_subscribeToArray PURE_IMPORTS_END */
  71113. function fromArray(input, scheduler) {
  71114. if (!scheduler) {
  71115. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeToArray__WEBPACK_IMPORTED_MODULE_2__["subscribeToArray"])(input));
  71116. }
  71117. else {
  71118. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71119. var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  71120. var i = 0;
  71121. sub.add(scheduler.schedule(function () {
  71122. if (i === input.length) {
  71123. subscriber.complete();
  71124. return;
  71125. }
  71126. subscriber.next(input[i++]);
  71127. if (!subscriber.closed) {
  71128. sub.add(this.schedule());
  71129. }
  71130. }));
  71131. return sub;
  71132. });
  71133. }
  71134. }
  71135. //# sourceMappingURL=fromArray.js.map
  71136. /***/ }),
  71137. /***/ "./node_modules/rxjs/_esm5/internal/observable/fromEvent.js":
  71138. /*!******************************************************************!*\
  71139. !*** ./node_modules/rxjs/_esm5/internal/observable/fromEvent.js ***!
  71140. \******************************************************************/
  71141. /*! exports provided: fromEvent */
  71142. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71143. "use strict";
  71144. __webpack_require__.r(__webpack_exports__);
  71145. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromEvent", function() { return fromEvent; });
  71146. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71147. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  71148. /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js");
  71149. /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../operators/map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  71150. /** PURE_IMPORTS_START _Observable,_util_isArray,_util_isFunction,_operators_map PURE_IMPORTS_END */
  71151. var toString = Object.prototype.toString;
  71152. function fromEvent(target, eventName, options, resultSelector) {
  71153. if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(options)) {
  71154. resultSelector = options;
  71155. options = undefined;
  71156. }
  71157. if (resultSelector) {
  71158. return fromEvent(target, eventName, options).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
  71159. }
  71160. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71161. function handler(e) {
  71162. if (arguments.length > 1) {
  71163. subscriber.next(Array.prototype.slice.call(arguments));
  71164. }
  71165. else {
  71166. subscriber.next(e);
  71167. }
  71168. }
  71169. setupSubscription(target, eventName, handler, subscriber, options);
  71170. });
  71171. }
  71172. function setupSubscription(sourceObj, eventName, handler, subscriber, options) {
  71173. var unsubscribe;
  71174. if (isEventTarget(sourceObj)) {
  71175. var source_1 = sourceObj;
  71176. sourceObj.addEventListener(eventName, handler, options);
  71177. unsubscribe = function () { return source_1.removeEventListener(eventName, handler, options); };
  71178. }
  71179. else if (isJQueryStyleEventEmitter(sourceObj)) {
  71180. var source_2 = sourceObj;
  71181. sourceObj.on(eventName, handler);
  71182. unsubscribe = function () { return source_2.off(eventName, handler); };
  71183. }
  71184. else if (isNodeStyleEventEmitter(sourceObj)) {
  71185. var source_3 = sourceObj;
  71186. sourceObj.addListener(eventName, handler);
  71187. unsubscribe = function () { return source_3.removeListener(eventName, handler); };
  71188. }
  71189. else if (sourceObj && sourceObj.length) {
  71190. for (var i = 0, len = sourceObj.length; i < len; i++) {
  71191. setupSubscription(sourceObj[i], eventName, handler, subscriber, options);
  71192. }
  71193. }
  71194. else {
  71195. throw new TypeError('Invalid event target');
  71196. }
  71197. subscriber.add(unsubscribe);
  71198. }
  71199. function isNodeStyleEventEmitter(sourceObj) {
  71200. return sourceObj && typeof sourceObj.addListener === 'function' && typeof sourceObj.removeListener === 'function';
  71201. }
  71202. function isJQueryStyleEventEmitter(sourceObj) {
  71203. return sourceObj && typeof sourceObj.on === 'function' && typeof sourceObj.off === 'function';
  71204. }
  71205. function isEventTarget(sourceObj) {
  71206. return sourceObj && typeof sourceObj.addEventListener === 'function' && typeof sourceObj.removeEventListener === 'function';
  71207. }
  71208. //# sourceMappingURL=fromEvent.js.map
  71209. /***/ }),
  71210. /***/ "./node_modules/rxjs/_esm5/internal/observable/fromEventPattern.js":
  71211. /*!*************************************************************************!*\
  71212. !*** ./node_modules/rxjs/_esm5/internal/observable/fromEventPattern.js ***!
  71213. \*************************************************************************/
  71214. /*! exports provided: fromEventPattern */
  71215. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71216. "use strict";
  71217. __webpack_require__.r(__webpack_exports__);
  71218. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromEventPattern", function() { return fromEventPattern; });
  71219. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71220. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  71221. /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js");
  71222. /* harmony import */ var _operators_map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../operators/map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  71223. /** PURE_IMPORTS_START _Observable,_util_isArray,_util_isFunction,_operators_map PURE_IMPORTS_END */
  71224. function fromEventPattern(addHandler, removeHandler, resultSelector) {
  71225. if (resultSelector) {
  71226. return fromEventPattern(addHandler, removeHandler).pipe(Object(_operators_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (args) { return Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(args) ? resultSelector.apply(void 0, args) : resultSelector(args); }));
  71227. }
  71228. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71229. var handler = function () {
  71230. var e = [];
  71231. for (var _i = 0; _i < arguments.length; _i++) {
  71232. e[_i] = arguments[_i];
  71233. }
  71234. return subscriber.next(e.length === 1 ? e[0] : e);
  71235. };
  71236. var retValue;
  71237. try {
  71238. retValue = addHandler(handler);
  71239. }
  71240. catch (err) {
  71241. subscriber.error(err);
  71242. return undefined;
  71243. }
  71244. if (!Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_2__["isFunction"])(removeHandler)) {
  71245. return undefined;
  71246. }
  71247. return function () { return removeHandler(handler, retValue); };
  71248. });
  71249. }
  71250. //# sourceMappingURL=fromEventPattern.js.map
  71251. /***/ }),
  71252. /***/ "./node_modules/rxjs/_esm5/internal/observable/fromIterable.js":
  71253. /*!*********************************************************************!*\
  71254. !*** ./node_modules/rxjs/_esm5/internal/observable/fromIterable.js ***!
  71255. \*********************************************************************/
  71256. /*! exports provided: fromIterable */
  71257. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71258. "use strict";
  71259. __webpack_require__.r(__webpack_exports__);
  71260. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromIterable", function() { return fromIterable; });
  71261. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71262. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  71263. /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../symbol/iterator */ "./node_modules/rxjs/_esm5/internal/symbol/iterator.js");
  71264. /* harmony import */ var _util_subscribeToIterable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/subscribeToIterable */ "./node_modules/rxjs/_esm5/internal/util/subscribeToIterable.js");
  71265. /** PURE_IMPORTS_START _Observable,_Subscription,_symbol_iterator,_util_subscribeToIterable PURE_IMPORTS_END */
  71266. function fromIterable(input, scheduler) {
  71267. if (!input) {
  71268. throw new Error('Iterable cannot be null');
  71269. }
  71270. if (!scheduler) {
  71271. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeToIterable__WEBPACK_IMPORTED_MODULE_3__["subscribeToIterable"])(input));
  71272. }
  71273. else {
  71274. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71275. var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  71276. var iterator;
  71277. sub.add(function () {
  71278. if (iterator && typeof iterator.return === 'function') {
  71279. iterator.return();
  71280. }
  71281. });
  71282. sub.add(scheduler.schedule(function () {
  71283. iterator = input[_symbol_iterator__WEBPACK_IMPORTED_MODULE_2__["iterator"]]();
  71284. sub.add(scheduler.schedule(function () {
  71285. if (subscriber.closed) {
  71286. return;
  71287. }
  71288. var value;
  71289. var done;
  71290. try {
  71291. var result = iterator.next();
  71292. value = result.value;
  71293. done = result.done;
  71294. }
  71295. catch (err) {
  71296. subscriber.error(err);
  71297. return;
  71298. }
  71299. if (done) {
  71300. subscriber.complete();
  71301. }
  71302. else {
  71303. subscriber.next(value);
  71304. this.schedule();
  71305. }
  71306. }));
  71307. }));
  71308. return sub;
  71309. });
  71310. }
  71311. }
  71312. //# sourceMappingURL=fromIterable.js.map
  71313. /***/ }),
  71314. /***/ "./node_modules/rxjs/_esm5/internal/observable/fromObservable.js":
  71315. /*!***********************************************************************!*\
  71316. !*** ./node_modules/rxjs/_esm5/internal/observable/fromObservable.js ***!
  71317. \***********************************************************************/
  71318. /*! exports provided: fromObservable */
  71319. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71320. "use strict";
  71321. __webpack_require__.r(__webpack_exports__);
  71322. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromObservable", function() { return fromObservable; });
  71323. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71324. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  71325. /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js");
  71326. /* harmony import */ var _util_subscribeToObservable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/subscribeToObservable */ "./node_modules/rxjs/_esm5/internal/util/subscribeToObservable.js");
  71327. /** PURE_IMPORTS_START _Observable,_Subscription,_symbol_observable,_util_subscribeToObservable PURE_IMPORTS_END */
  71328. function fromObservable(input, scheduler) {
  71329. if (!scheduler) {
  71330. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeToObservable__WEBPACK_IMPORTED_MODULE_3__["subscribeToObservable"])(input));
  71331. }
  71332. else {
  71333. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71334. var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  71335. sub.add(scheduler.schedule(function () {
  71336. var observable = input[_symbol_observable__WEBPACK_IMPORTED_MODULE_2__["observable"]]();
  71337. sub.add(observable.subscribe({
  71338. next: function (value) { sub.add(scheduler.schedule(function () { return subscriber.next(value); })); },
  71339. error: function (err) { sub.add(scheduler.schedule(function () { return subscriber.error(err); })); },
  71340. complete: function () { sub.add(scheduler.schedule(function () { return subscriber.complete(); })); },
  71341. }));
  71342. }));
  71343. return sub;
  71344. });
  71345. }
  71346. }
  71347. //# sourceMappingURL=fromObservable.js.map
  71348. /***/ }),
  71349. /***/ "./node_modules/rxjs/_esm5/internal/observable/fromPromise.js":
  71350. /*!********************************************************************!*\
  71351. !*** ./node_modules/rxjs/_esm5/internal/observable/fromPromise.js ***!
  71352. \********************************************************************/
  71353. /*! exports provided: fromPromise */
  71354. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71355. "use strict";
  71356. __webpack_require__.r(__webpack_exports__);
  71357. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "fromPromise", function() { return fromPromise; });
  71358. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71359. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  71360. /* harmony import */ var _util_subscribeToPromise__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToPromise */ "./node_modules/rxjs/_esm5/internal/util/subscribeToPromise.js");
  71361. /** PURE_IMPORTS_START _Observable,_Subscription,_util_subscribeToPromise PURE_IMPORTS_END */
  71362. function fromPromise(input, scheduler) {
  71363. if (!scheduler) {
  71364. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](Object(_util_subscribeToPromise__WEBPACK_IMPORTED_MODULE_2__["subscribeToPromise"])(input));
  71365. }
  71366. else {
  71367. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71368. var sub = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  71369. sub.add(scheduler.schedule(function () {
  71370. return input.then(function (value) {
  71371. sub.add(scheduler.schedule(function () {
  71372. subscriber.next(value);
  71373. sub.add(scheduler.schedule(function () { return subscriber.complete(); }));
  71374. }));
  71375. }, function (err) {
  71376. sub.add(scheduler.schedule(function () { return subscriber.error(err); }));
  71377. });
  71378. }));
  71379. return sub;
  71380. });
  71381. }
  71382. }
  71383. //# sourceMappingURL=fromPromise.js.map
  71384. /***/ }),
  71385. /***/ "./node_modules/rxjs/_esm5/internal/observable/generate.js":
  71386. /*!*****************************************************************!*\
  71387. !*** ./node_modules/rxjs/_esm5/internal/observable/generate.js ***!
  71388. \*****************************************************************/
  71389. /*! exports provided: generate */
  71390. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71391. "use strict";
  71392. __webpack_require__.r(__webpack_exports__);
  71393. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "generate", function() { return generate; });
  71394. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71395. /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js");
  71396. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  71397. /** PURE_IMPORTS_START _Observable,_util_identity,_util_isScheduler PURE_IMPORTS_END */
  71398. function generate(initialStateOrOptions, condition, iterate, resultSelectorOrObservable, scheduler) {
  71399. var resultSelector;
  71400. var initialState;
  71401. if (arguments.length == 1) {
  71402. var options = initialStateOrOptions;
  71403. initialState = options.initialState;
  71404. condition = options.condition;
  71405. iterate = options.iterate;
  71406. resultSelector = options.resultSelector || _util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"];
  71407. scheduler = options.scheduler;
  71408. }
  71409. else if (resultSelectorOrObservable === undefined || Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_2__["isScheduler"])(resultSelectorOrObservable)) {
  71410. initialState = initialStateOrOptions;
  71411. resultSelector = _util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"];
  71412. scheduler = resultSelectorOrObservable;
  71413. }
  71414. else {
  71415. initialState = initialStateOrOptions;
  71416. resultSelector = resultSelectorOrObservable;
  71417. }
  71418. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71419. var state = initialState;
  71420. if (scheduler) {
  71421. return scheduler.schedule(dispatch, 0, {
  71422. subscriber: subscriber,
  71423. iterate: iterate,
  71424. condition: condition,
  71425. resultSelector: resultSelector,
  71426. state: state
  71427. });
  71428. }
  71429. do {
  71430. if (condition) {
  71431. var conditionResult = void 0;
  71432. try {
  71433. conditionResult = condition(state);
  71434. }
  71435. catch (err) {
  71436. subscriber.error(err);
  71437. return undefined;
  71438. }
  71439. if (!conditionResult) {
  71440. subscriber.complete();
  71441. break;
  71442. }
  71443. }
  71444. var value = void 0;
  71445. try {
  71446. value = resultSelector(state);
  71447. }
  71448. catch (err) {
  71449. subscriber.error(err);
  71450. return undefined;
  71451. }
  71452. subscriber.next(value);
  71453. if (subscriber.closed) {
  71454. break;
  71455. }
  71456. try {
  71457. state = iterate(state);
  71458. }
  71459. catch (err) {
  71460. subscriber.error(err);
  71461. return undefined;
  71462. }
  71463. } while (true);
  71464. return undefined;
  71465. });
  71466. }
  71467. function dispatch(state) {
  71468. var subscriber = state.subscriber, condition = state.condition;
  71469. if (subscriber.closed) {
  71470. return undefined;
  71471. }
  71472. if (state.needIterate) {
  71473. try {
  71474. state.state = state.iterate(state.state);
  71475. }
  71476. catch (err) {
  71477. subscriber.error(err);
  71478. return undefined;
  71479. }
  71480. }
  71481. else {
  71482. state.needIterate = true;
  71483. }
  71484. if (condition) {
  71485. var conditionResult = void 0;
  71486. try {
  71487. conditionResult = condition(state.state);
  71488. }
  71489. catch (err) {
  71490. subscriber.error(err);
  71491. return undefined;
  71492. }
  71493. if (!conditionResult) {
  71494. subscriber.complete();
  71495. return undefined;
  71496. }
  71497. if (subscriber.closed) {
  71498. return undefined;
  71499. }
  71500. }
  71501. var value;
  71502. try {
  71503. value = state.resultSelector(state.state);
  71504. }
  71505. catch (err) {
  71506. subscriber.error(err);
  71507. return undefined;
  71508. }
  71509. if (subscriber.closed) {
  71510. return undefined;
  71511. }
  71512. subscriber.next(value);
  71513. if (subscriber.closed) {
  71514. return undefined;
  71515. }
  71516. return this.schedule(state);
  71517. }
  71518. //# sourceMappingURL=generate.js.map
  71519. /***/ }),
  71520. /***/ "./node_modules/rxjs/_esm5/internal/observable/iif.js":
  71521. /*!************************************************************!*\
  71522. !*** ./node_modules/rxjs/_esm5/internal/observable/iif.js ***!
  71523. \************************************************************/
  71524. /*! exports provided: iif */
  71525. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71526. "use strict";
  71527. __webpack_require__.r(__webpack_exports__);
  71528. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iif", function() { return iif; });
  71529. /* harmony import */ var _defer__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./defer */ "./node_modules/rxjs/_esm5/internal/observable/defer.js");
  71530. /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  71531. /** PURE_IMPORTS_START _defer,_empty PURE_IMPORTS_END */
  71532. function iif(condition, trueResult, falseResult) {
  71533. if (trueResult === void 0) {
  71534. trueResult = _empty__WEBPACK_IMPORTED_MODULE_1__["EMPTY"];
  71535. }
  71536. if (falseResult === void 0) {
  71537. falseResult = _empty__WEBPACK_IMPORTED_MODULE_1__["EMPTY"];
  71538. }
  71539. return Object(_defer__WEBPACK_IMPORTED_MODULE_0__["defer"])(function () { return condition() ? trueResult : falseResult; });
  71540. }
  71541. //# sourceMappingURL=iif.js.map
  71542. /***/ }),
  71543. /***/ "./node_modules/rxjs/_esm5/internal/observable/interval.js":
  71544. /*!*****************************************************************!*\
  71545. !*** ./node_modules/rxjs/_esm5/internal/observable/interval.js ***!
  71546. \*****************************************************************/
  71547. /*! exports provided: interval */
  71548. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71549. "use strict";
  71550. __webpack_require__.r(__webpack_exports__);
  71551. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "interval", function() { return interval; });
  71552. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71553. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  71554. /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isNumeric */ "./node_modules/rxjs/_esm5/internal/util/isNumeric.js");
  71555. /** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric PURE_IMPORTS_END */
  71556. function interval(period, scheduler) {
  71557. if (period === void 0) {
  71558. period = 0;
  71559. }
  71560. if (scheduler === void 0) {
  71561. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
  71562. }
  71563. if (!Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(period) || period < 0) {
  71564. period = 0;
  71565. }
  71566. if (!scheduler || typeof scheduler.schedule !== 'function') {
  71567. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
  71568. }
  71569. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71570. subscriber.add(scheduler.schedule(dispatch, period, { subscriber: subscriber, counter: 0, period: period }));
  71571. return subscriber;
  71572. });
  71573. }
  71574. function dispatch(state) {
  71575. var subscriber = state.subscriber, counter = state.counter, period = state.period;
  71576. subscriber.next(counter);
  71577. this.schedule({ subscriber: subscriber, counter: counter + 1, period: period }, period);
  71578. }
  71579. //# sourceMappingURL=interval.js.map
  71580. /***/ }),
  71581. /***/ "./node_modules/rxjs/_esm5/internal/observable/merge.js":
  71582. /*!**************************************************************!*\
  71583. !*** ./node_modules/rxjs/_esm5/internal/observable/merge.js ***!
  71584. \**************************************************************/
  71585. /*! exports provided: merge */
  71586. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71587. "use strict";
  71588. __webpack_require__.r(__webpack_exports__);
  71589. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return merge; });
  71590. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71591. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  71592. /* harmony import */ var _operators_mergeAll__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../operators/mergeAll */ "./node_modules/rxjs/_esm5/internal/operators/mergeAll.js");
  71593. /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  71594. /** PURE_IMPORTS_START _Observable,_util_isScheduler,_operators_mergeAll,_fromArray PURE_IMPORTS_END */
  71595. function merge() {
  71596. var observables = [];
  71597. for (var _i = 0; _i < arguments.length; _i++) {
  71598. observables[_i] = arguments[_i];
  71599. }
  71600. var concurrent = Number.POSITIVE_INFINITY;
  71601. var scheduler = null;
  71602. var last = observables[observables.length - 1];
  71603. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_1__["isScheduler"])(last)) {
  71604. scheduler = observables.pop();
  71605. if (observables.length > 1 && typeof observables[observables.length - 1] === 'number') {
  71606. concurrent = observables.pop();
  71607. }
  71608. }
  71609. else if (typeof last === 'number') {
  71610. concurrent = observables.pop();
  71611. }
  71612. if (scheduler === null && observables.length === 1 && observables[0] instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]) {
  71613. return observables[0];
  71614. }
  71615. return Object(_operators_mergeAll__WEBPACK_IMPORTED_MODULE_2__["mergeAll"])(concurrent)(Object(_fromArray__WEBPACK_IMPORTED_MODULE_3__["fromArray"])(observables, scheduler));
  71616. }
  71617. //# sourceMappingURL=merge.js.map
  71618. /***/ }),
  71619. /***/ "./node_modules/rxjs/_esm5/internal/observable/never.js":
  71620. /*!**************************************************************!*\
  71621. !*** ./node_modules/rxjs/_esm5/internal/observable/never.js ***!
  71622. \**************************************************************/
  71623. /*! exports provided: NEVER, never */
  71624. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71625. "use strict";
  71626. __webpack_require__.r(__webpack_exports__);
  71627. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "NEVER", function() { return NEVER; });
  71628. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "never", function() { return never; });
  71629. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71630. /* harmony import */ var _util_noop__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/noop */ "./node_modules/rxjs/_esm5/internal/util/noop.js");
  71631. /** PURE_IMPORTS_START _Observable,_util_noop PURE_IMPORTS_END */
  71632. var NEVER = /*@__PURE__*/ new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](_util_noop__WEBPACK_IMPORTED_MODULE_1__["noop"]);
  71633. function never() {
  71634. return NEVER;
  71635. }
  71636. //# sourceMappingURL=never.js.map
  71637. /***/ }),
  71638. /***/ "./node_modules/rxjs/_esm5/internal/observable/of.js":
  71639. /*!***********************************************************!*\
  71640. !*** ./node_modules/rxjs/_esm5/internal/observable/of.js ***!
  71641. \***********************************************************/
  71642. /*! exports provided: of */
  71643. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71644. "use strict";
  71645. __webpack_require__.r(__webpack_exports__);
  71646. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "of", function() { return of; });
  71647. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  71648. /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  71649. /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  71650. /* harmony import */ var _scalar__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./scalar */ "./node_modules/rxjs/_esm5/internal/observable/scalar.js");
  71651. /** PURE_IMPORTS_START _util_isScheduler,_fromArray,_empty,_scalar PURE_IMPORTS_END */
  71652. function of() {
  71653. var args = [];
  71654. for (var _i = 0; _i < arguments.length; _i++) {
  71655. args[_i] = arguments[_i];
  71656. }
  71657. var scheduler = args[args.length - 1];
  71658. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_0__["isScheduler"])(scheduler)) {
  71659. args.pop();
  71660. }
  71661. else {
  71662. scheduler = undefined;
  71663. }
  71664. switch (args.length) {
  71665. case 0:
  71666. return Object(_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(scheduler);
  71667. case 1:
  71668. return scheduler ? Object(_fromArray__WEBPACK_IMPORTED_MODULE_1__["fromArray"])(args, scheduler) : Object(_scalar__WEBPACK_IMPORTED_MODULE_3__["scalar"])(args[0]);
  71669. default:
  71670. return Object(_fromArray__WEBPACK_IMPORTED_MODULE_1__["fromArray"])(args, scheduler);
  71671. }
  71672. }
  71673. //# sourceMappingURL=of.js.map
  71674. /***/ }),
  71675. /***/ "./node_modules/rxjs/_esm5/internal/observable/onErrorResumeNext.js":
  71676. /*!**************************************************************************!*\
  71677. !*** ./node_modules/rxjs/_esm5/internal/observable/onErrorResumeNext.js ***!
  71678. \**************************************************************************/
  71679. /*! exports provided: onErrorResumeNext */
  71680. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71681. "use strict";
  71682. __webpack_require__.r(__webpack_exports__);
  71683. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return onErrorResumeNext; });
  71684. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71685. /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  71686. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  71687. /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  71688. /** PURE_IMPORTS_START _Observable,_from,_util_isArray,_empty PURE_IMPORTS_END */
  71689. function onErrorResumeNext() {
  71690. var sources = [];
  71691. for (var _i = 0; _i < arguments.length; _i++) {
  71692. sources[_i] = arguments[_i];
  71693. }
  71694. if (sources.length === 0) {
  71695. return _empty__WEBPACK_IMPORTED_MODULE_3__["EMPTY"];
  71696. }
  71697. var first = sources[0], remainder = sources.slice(1);
  71698. if (sources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(first)) {
  71699. return onErrorResumeNext.apply(void 0, first);
  71700. }
  71701. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71702. var subNext = function () { return subscriber.add(onErrorResumeNext.apply(void 0, remainder).subscribe(subscriber)); };
  71703. return Object(_from__WEBPACK_IMPORTED_MODULE_1__["from"])(first).subscribe({
  71704. next: function (value) { subscriber.next(value); },
  71705. error: subNext,
  71706. complete: subNext,
  71707. });
  71708. });
  71709. }
  71710. //# sourceMappingURL=onErrorResumeNext.js.map
  71711. /***/ }),
  71712. /***/ "./node_modules/rxjs/_esm5/internal/observable/pairs.js":
  71713. /*!**************************************************************!*\
  71714. !*** ./node_modules/rxjs/_esm5/internal/observable/pairs.js ***!
  71715. \**************************************************************/
  71716. /*! exports provided: pairs, dispatch */
  71717. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71718. "use strict";
  71719. __webpack_require__.r(__webpack_exports__);
  71720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pairs", function() { return pairs; });
  71721. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function() { return dispatch; });
  71722. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71723. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  71724. /** PURE_IMPORTS_START _Observable,_Subscription PURE_IMPORTS_END */
  71725. function pairs(obj, scheduler) {
  71726. if (!scheduler) {
  71727. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71728. var keys = Object.keys(obj);
  71729. for (var i = 0; i < keys.length && !subscriber.closed; i++) {
  71730. var key = keys[i];
  71731. if (obj.hasOwnProperty(key)) {
  71732. subscriber.next([key, obj[key]]);
  71733. }
  71734. }
  71735. subscriber.complete();
  71736. });
  71737. }
  71738. else {
  71739. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71740. var keys = Object.keys(obj);
  71741. var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  71742. subscription.add(scheduler.schedule(dispatch, 0, { keys: keys, index: 0, subscriber: subscriber, subscription: subscription, obj: obj }));
  71743. return subscription;
  71744. });
  71745. }
  71746. }
  71747. function dispatch(state) {
  71748. var keys = state.keys, index = state.index, subscriber = state.subscriber, subscription = state.subscription, obj = state.obj;
  71749. if (!subscriber.closed) {
  71750. if (index < keys.length) {
  71751. var key = keys[index];
  71752. subscriber.next([key, obj[key]]);
  71753. subscription.add(this.schedule({ keys: keys, index: index + 1, subscriber: subscriber, subscription: subscription, obj: obj }));
  71754. }
  71755. else {
  71756. subscriber.complete();
  71757. }
  71758. }
  71759. }
  71760. //# sourceMappingURL=pairs.js.map
  71761. /***/ }),
  71762. /***/ "./node_modules/rxjs/_esm5/internal/observable/race.js":
  71763. /*!*************************************************************!*\
  71764. !*** ./node_modules/rxjs/_esm5/internal/observable/race.js ***!
  71765. \*************************************************************/
  71766. /*! exports provided: race, RaceOperator, RaceSubscriber */
  71767. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71768. "use strict";
  71769. __webpack_require__.r(__webpack_exports__);
  71770. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "race", function() { return race; });
  71771. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RaceOperator", function() { return RaceOperator; });
  71772. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "RaceSubscriber", function() { return RaceSubscriber; });
  71773. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  71774. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  71775. /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  71776. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  71777. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  71778. /** PURE_IMPORTS_START tslib,_util_isArray,_fromArray,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  71779. function race() {
  71780. var observables = [];
  71781. for (var _i = 0; _i < arguments.length; _i++) {
  71782. observables[_i] = arguments[_i];
  71783. }
  71784. if (observables.length === 1) {
  71785. if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_1__["isArray"])(observables[0])) {
  71786. observables = observables[0];
  71787. }
  71788. else {
  71789. return observables[0];
  71790. }
  71791. }
  71792. return Object(_fromArray__WEBPACK_IMPORTED_MODULE_2__["fromArray"])(observables, undefined).lift(new RaceOperator());
  71793. }
  71794. var RaceOperator = /*@__PURE__*/ (function () {
  71795. function RaceOperator() {
  71796. }
  71797. RaceOperator.prototype.call = function (subscriber, source) {
  71798. return source.subscribe(new RaceSubscriber(subscriber));
  71799. };
  71800. return RaceOperator;
  71801. }());
  71802. var RaceSubscriber = /*@__PURE__*/ (function (_super) {
  71803. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RaceSubscriber, _super);
  71804. function RaceSubscriber(destination) {
  71805. var _this = _super.call(this, destination) || this;
  71806. _this.hasFirst = false;
  71807. _this.observables = [];
  71808. _this.subscriptions = [];
  71809. return _this;
  71810. }
  71811. RaceSubscriber.prototype._next = function (observable) {
  71812. this.observables.push(observable);
  71813. };
  71814. RaceSubscriber.prototype._complete = function () {
  71815. var observables = this.observables;
  71816. var len = observables.length;
  71817. if (len === 0) {
  71818. this.destination.complete();
  71819. }
  71820. else {
  71821. for (var i = 0; i < len && !this.hasFirst; i++) {
  71822. var observable = observables[i];
  71823. var subscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(this, observable, observable, i);
  71824. if (this.subscriptions) {
  71825. this.subscriptions.push(subscription);
  71826. }
  71827. this.add(subscription);
  71828. }
  71829. this.observables = null;
  71830. }
  71831. };
  71832. RaceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  71833. if (!this.hasFirst) {
  71834. this.hasFirst = true;
  71835. for (var i = 0; i < this.subscriptions.length; i++) {
  71836. if (i !== outerIndex) {
  71837. var subscription = this.subscriptions[i];
  71838. subscription.unsubscribe();
  71839. this.remove(subscription);
  71840. }
  71841. }
  71842. this.subscriptions = null;
  71843. }
  71844. this.destination.next(innerValue);
  71845. };
  71846. return RaceSubscriber;
  71847. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  71848. //# sourceMappingURL=race.js.map
  71849. /***/ }),
  71850. /***/ "./node_modules/rxjs/_esm5/internal/observable/range.js":
  71851. /*!**************************************************************!*\
  71852. !*** ./node_modules/rxjs/_esm5/internal/observable/range.js ***!
  71853. \**************************************************************/
  71854. /*! exports provided: range, dispatch */
  71855. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71856. "use strict";
  71857. __webpack_require__.r(__webpack_exports__);
  71858. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "range", function() { return range; });
  71859. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dispatch", function() { return dispatch; });
  71860. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71861. /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
  71862. function range(start, count, scheduler) {
  71863. if (start === void 0) {
  71864. start = 0;
  71865. }
  71866. if (count === void 0) {
  71867. count = 0;
  71868. }
  71869. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71870. var index = 0;
  71871. var current = start;
  71872. if (scheduler) {
  71873. return scheduler.schedule(dispatch, 0, {
  71874. index: index, count: count, start: start, subscriber: subscriber
  71875. });
  71876. }
  71877. else {
  71878. do {
  71879. if (index++ >= count) {
  71880. subscriber.complete();
  71881. break;
  71882. }
  71883. subscriber.next(current++);
  71884. if (subscriber.closed) {
  71885. break;
  71886. }
  71887. } while (true);
  71888. }
  71889. return undefined;
  71890. });
  71891. }
  71892. function dispatch(state) {
  71893. var start = state.start, index = state.index, count = state.count, subscriber = state.subscriber;
  71894. if (index >= count) {
  71895. subscriber.complete();
  71896. return;
  71897. }
  71898. subscriber.next(start);
  71899. if (subscriber.closed) {
  71900. return;
  71901. }
  71902. state.index = index + 1;
  71903. state.start = start + 1;
  71904. this.schedule(state);
  71905. }
  71906. //# sourceMappingURL=range.js.map
  71907. /***/ }),
  71908. /***/ "./node_modules/rxjs/_esm5/internal/observable/scalar.js":
  71909. /*!***************************************************************!*\
  71910. !*** ./node_modules/rxjs/_esm5/internal/observable/scalar.js ***!
  71911. \***************************************************************/
  71912. /*! exports provided: scalar */
  71913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71914. "use strict";
  71915. __webpack_require__.r(__webpack_exports__);
  71916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scalar", function() { return scalar; });
  71917. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71918. /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
  71919. function scalar(value) {
  71920. var result = new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71921. subscriber.next(value);
  71922. subscriber.complete();
  71923. });
  71924. result._isScalar = true;
  71925. result.value = value;
  71926. return result;
  71927. }
  71928. //# sourceMappingURL=scalar.js.map
  71929. /***/ }),
  71930. /***/ "./node_modules/rxjs/_esm5/internal/observable/throwError.js":
  71931. /*!*******************************************************************!*\
  71932. !*** ./node_modules/rxjs/_esm5/internal/observable/throwError.js ***!
  71933. \*******************************************************************/
  71934. /*! exports provided: throwError */
  71935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71936. "use strict";
  71937. __webpack_require__.r(__webpack_exports__);
  71938. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwError", function() { return throwError; });
  71939. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71940. /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
  71941. function throwError(error, scheduler) {
  71942. if (!scheduler) {
  71943. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return subscriber.error(error); });
  71944. }
  71945. else {
  71946. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) { return scheduler.schedule(dispatch, 0, { error: error, subscriber: subscriber }); });
  71947. }
  71948. }
  71949. function dispatch(_a) {
  71950. var error = _a.error, subscriber = _a.subscriber;
  71951. subscriber.error(error);
  71952. }
  71953. //# sourceMappingURL=throwError.js.map
  71954. /***/ }),
  71955. /***/ "./node_modules/rxjs/_esm5/internal/observable/timer.js":
  71956. /*!**************************************************************!*\
  71957. !*** ./node_modules/rxjs/_esm5/internal/observable/timer.js ***!
  71958. \**************************************************************/
  71959. /*! exports provided: timer */
  71960. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  71961. "use strict";
  71962. __webpack_require__.r(__webpack_exports__);
  71963. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timer", function() { return timer; });
  71964. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  71965. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  71966. /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isNumeric */ "./node_modules/rxjs/_esm5/internal/util/isNumeric.js");
  71967. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  71968. /** PURE_IMPORTS_START _Observable,_scheduler_async,_util_isNumeric,_util_isScheduler PURE_IMPORTS_END */
  71969. function timer(dueTime, periodOrScheduler, scheduler) {
  71970. if (dueTime === void 0) {
  71971. dueTime = 0;
  71972. }
  71973. var period = -1;
  71974. if (Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(periodOrScheduler)) {
  71975. period = Number(periodOrScheduler) < 1 && 1 || Number(periodOrScheduler);
  71976. }
  71977. else if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(periodOrScheduler)) {
  71978. scheduler = periodOrScheduler;
  71979. }
  71980. if (!Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(scheduler)) {
  71981. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
  71982. }
  71983. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  71984. var due = Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_2__["isNumeric"])(dueTime)
  71985. ? dueTime
  71986. : (+dueTime - scheduler.now());
  71987. return scheduler.schedule(dispatch, due, {
  71988. index: 0, period: period, subscriber: subscriber
  71989. });
  71990. });
  71991. }
  71992. function dispatch(state) {
  71993. var index = state.index, period = state.period, subscriber = state.subscriber;
  71994. subscriber.next(index);
  71995. if (subscriber.closed) {
  71996. return;
  71997. }
  71998. else if (period === -1) {
  71999. return subscriber.complete();
  72000. }
  72001. state.index = index + 1;
  72002. this.schedule(state, period);
  72003. }
  72004. //# sourceMappingURL=timer.js.map
  72005. /***/ }),
  72006. /***/ "./node_modules/rxjs/_esm5/internal/observable/using.js":
  72007. /*!**************************************************************!*\
  72008. !*** ./node_modules/rxjs/_esm5/internal/observable/using.js ***!
  72009. \**************************************************************/
  72010. /*! exports provided: using */
  72011. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72012. "use strict";
  72013. __webpack_require__.r(__webpack_exports__);
  72014. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "using", function() { return using; });
  72015. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  72016. /* harmony import */ var _from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  72017. /* harmony import */ var _empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  72018. /** PURE_IMPORTS_START _Observable,_from,_empty PURE_IMPORTS_END */
  72019. function using(resourceFactory, observableFactory) {
  72020. return new _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"](function (subscriber) {
  72021. var resource;
  72022. try {
  72023. resource = resourceFactory();
  72024. }
  72025. catch (err) {
  72026. subscriber.error(err);
  72027. return undefined;
  72028. }
  72029. var result;
  72030. try {
  72031. result = observableFactory(resource);
  72032. }
  72033. catch (err) {
  72034. subscriber.error(err);
  72035. return undefined;
  72036. }
  72037. var source = result ? Object(_from__WEBPACK_IMPORTED_MODULE_1__["from"])(result) : _empty__WEBPACK_IMPORTED_MODULE_2__["EMPTY"];
  72038. var subscription = source.subscribe(subscriber);
  72039. return function () {
  72040. subscription.unsubscribe();
  72041. if (resource) {
  72042. resource.unsubscribe();
  72043. }
  72044. };
  72045. });
  72046. }
  72047. //# sourceMappingURL=using.js.map
  72048. /***/ }),
  72049. /***/ "./node_modules/rxjs/_esm5/internal/observable/zip.js":
  72050. /*!************************************************************!*\
  72051. !*** ./node_modules/rxjs/_esm5/internal/observable/zip.js ***!
  72052. \************************************************************/
  72053. /*! exports provided: zip, ZipOperator, ZipSubscriber */
  72054. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72055. "use strict";
  72056. __webpack_require__.r(__webpack_exports__);
  72057. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return zip; });
  72058. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZipOperator", function() { return ZipOperator; });
  72059. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ZipSubscriber", function() { return ZipSubscriber; });
  72060. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72061. /* harmony import */ var _fromArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  72062. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  72063. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  72064. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  72065. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  72066. /* harmony import */ var _internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../../internal/symbol/iterator */ "./node_modules/rxjs/_esm5/internal/symbol/iterator.js");
  72067. /** PURE_IMPORTS_START tslib,_fromArray,_util_isArray,_Subscriber,_OuterSubscriber,_util_subscribeToResult,_.._internal_symbol_iterator PURE_IMPORTS_END */
  72068. function zip() {
  72069. var observables = [];
  72070. for (var _i = 0; _i < arguments.length; _i++) {
  72071. observables[_i] = arguments[_i];
  72072. }
  72073. var resultSelector = observables[observables.length - 1];
  72074. if (typeof resultSelector === 'function') {
  72075. observables.pop();
  72076. }
  72077. return Object(_fromArray__WEBPACK_IMPORTED_MODULE_1__["fromArray"])(observables, undefined).lift(new ZipOperator(resultSelector));
  72078. }
  72079. var ZipOperator = /*@__PURE__*/ (function () {
  72080. function ZipOperator(resultSelector) {
  72081. this.resultSelector = resultSelector;
  72082. }
  72083. ZipOperator.prototype.call = function (subscriber, source) {
  72084. return source.subscribe(new ZipSubscriber(subscriber, this.resultSelector));
  72085. };
  72086. return ZipOperator;
  72087. }());
  72088. var ZipSubscriber = /*@__PURE__*/ (function (_super) {
  72089. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ZipSubscriber, _super);
  72090. function ZipSubscriber(destination, resultSelector, values) {
  72091. if (values === void 0) {
  72092. values = Object.create(null);
  72093. }
  72094. var _this = _super.call(this, destination) || this;
  72095. _this.iterators = [];
  72096. _this.active = 0;
  72097. _this.resultSelector = (typeof resultSelector === 'function') ? resultSelector : null;
  72098. _this.values = values;
  72099. return _this;
  72100. }
  72101. ZipSubscriber.prototype._next = function (value) {
  72102. var iterators = this.iterators;
  72103. if (Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(value)) {
  72104. iterators.push(new StaticArrayIterator(value));
  72105. }
  72106. else if (typeof value[_internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_6__["iterator"]] === 'function') {
  72107. iterators.push(new StaticIterator(value[_internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_6__["iterator"]]()));
  72108. }
  72109. else {
  72110. iterators.push(new ZipBufferIterator(this.destination, this, value));
  72111. }
  72112. };
  72113. ZipSubscriber.prototype._complete = function () {
  72114. var iterators = this.iterators;
  72115. var len = iterators.length;
  72116. if (len === 0) {
  72117. this.destination.complete();
  72118. return;
  72119. }
  72120. this.active = len;
  72121. for (var i = 0; i < len; i++) {
  72122. var iterator = iterators[i];
  72123. if (iterator.stillUnsubscribed) {
  72124. this.add(iterator.subscribe(iterator, i));
  72125. }
  72126. else {
  72127. this.active--;
  72128. }
  72129. }
  72130. };
  72131. ZipSubscriber.prototype.notifyInactive = function () {
  72132. this.active--;
  72133. if (this.active === 0) {
  72134. this.destination.complete();
  72135. }
  72136. };
  72137. ZipSubscriber.prototype.checkIterators = function () {
  72138. var iterators = this.iterators;
  72139. var len = iterators.length;
  72140. var destination = this.destination;
  72141. for (var i = 0; i < len; i++) {
  72142. var iterator = iterators[i];
  72143. if (typeof iterator.hasValue === 'function' && !iterator.hasValue()) {
  72144. return;
  72145. }
  72146. }
  72147. var shouldComplete = false;
  72148. var args = [];
  72149. for (var i = 0; i < len; i++) {
  72150. var iterator = iterators[i];
  72151. var result = iterator.next();
  72152. if (iterator.hasCompleted()) {
  72153. shouldComplete = true;
  72154. }
  72155. if (result.done) {
  72156. destination.complete();
  72157. return;
  72158. }
  72159. args.push(result.value);
  72160. }
  72161. if (this.resultSelector) {
  72162. this._tryresultSelector(args);
  72163. }
  72164. else {
  72165. destination.next(args);
  72166. }
  72167. if (shouldComplete) {
  72168. destination.complete();
  72169. }
  72170. };
  72171. ZipSubscriber.prototype._tryresultSelector = function (args) {
  72172. var result;
  72173. try {
  72174. result = this.resultSelector.apply(this, args);
  72175. }
  72176. catch (err) {
  72177. this.destination.error(err);
  72178. return;
  72179. }
  72180. this.destination.next(result);
  72181. };
  72182. return ZipSubscriber;
  72183. }(_Subscriber__WEBPACK_IMPORTED_MODULE_3__["Subscriber"]));
  72184. var StaticIterator = /*@__PURE__*/ (function () {
  72185. function StaticIterator(iterator) {
  72186. this.iterator = iterator;
  72187. this.nextResult = iterator.next();
  72188. }
  72189. StaticIterator.prototype.hasValue = function () {
  72190. return true;
  72191. };
  72192. StaticIterator.prototype.next = function () {
  72193. var result = this.nextResult;
  72194. this.nextResult = this.iterator.next();
  72195. return result;
  72196. };
  72197. StaticIterator.prototype.hasCompleted = function () {
  72198. var nextResult = this.nextResult;
  72199. return nextResult && nextResult.done;
  72200. };
  72201. return StaticIterator;
  72202. }());
  72203. var StaticArrayIterator = /*@__PURE__*/ (function () {
  72204. function StaticArrayIterator(array) {
  72205. this.array = array;
  72206. this.index = 0;
  72207. this.length = 0;
  72208. this.length = array.length;
  72209. }
  72210. StaticArrayIterator.prototype[_internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_6__["iterator"]] = function () {
  72211. return this;
  72212. };
  72213. StaticArrayIterator.prototype.next = function (value) {
  72214. var i = this.index++;
  72215. var array = this.array;
  72216. return i < this.length ? { value: array[i], done: false } : { value: null, done: true };
  72217. };
  72218. StaticArrayIterator.prototype.hasValue = function () {
  72219. return this.array.length > this.index;
  72220. };
  72221. StaticArrayIterator.prototype.hasCompleted = function () {
  72222. return this.array.length === this.index;
  72223. };
  72224. return StaticArrayIterator;
  72225. }());
  72226. var ZipBufferIterator = /*@__PURE__*/ (function (_super) {
  72227. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ZipBufferIterator, _super);
  72228. function ZipBufferIterator(destination, parent, observable) {
  72229. var _this = _super.call(this, destination) || this;
  72230. _this.parent = parent;
  72231. _this.observable = observable;
  72232. _this.stillUnsubscribed = true;
  72233. _this.buffer = [];
  72234. _this.isComplete = false;
  72235. return _this;
  72236. }
  72237. ZipBufferIterator.prototype[_internal_symbol_iterator__WEBPACK_IMPORTED_MODULE_6__["iterator"]] = function () {
  72238. return this;
  72239. };
  72240. ZipBufferIterator.prototype.next = function () {
  72241. var buffer = this.buffer;
  72242. if (buffer.length === 0 && this.isComplete) {
  72243. return { value: null, done: true };
  72244. }
  72245. else {
  72246. return { value: buffer.shift(), done: false };
  72247. }
  72248. };
  72249. ZipBufferIterator.prototype.hasValue = function () {
  72250. return this.buffer.length > 0;
  72251. };
  72252. ZipBufferIterator.prototype.hasCompleted = function () {
  72253. return this.buffer.length === 0 && this.isComplete;
  72254. };
  72255. ZipBufferIterator.prototype.notifyComplete = function () {
  72256. if (this.buffer.length > 0) {
  72257. this.isComplete = true;
  72258. this.parent.notifyInactive();
  72259. }
  72260. else {
  72261. this.destination.complete();
  72262. }
  72263. };
  72264. ZipBufferIterator.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  72265. this.buffer.push(innerValue);
  72266. this.parent.checkIterators();
  72267. };
  72268. ZipBufferIterator.prototype.subscribe = function (value, index) {
  72269. return Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__["subscribeToResult"])(this, this.observable, this, index);
  72270. };
  72271. return ZipBufferIterator;
  72272. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__["OuterSubscriber"]));
  72273. //# sourceMappingURL=zip.js.map
  72274. /***/ }),
  72275. /***/ "./node_modules/rxjs/_esm5/internal/operators/audit.js":
  72276. /*!*************************************************************!*\
  72277. !*** ./node_modules/rxjs/_esm5/internal/operators/audit.js ***!
  72278. \*************************************************************/
  72279. /*! exports provided: audit */
  72280. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72281. "use strict";
  72282. __webpack_require__.r(__webpack_exports__);
  72283. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "audit", function() { return audit; });
  72284. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72285. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  72286. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  72287. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  72288. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  72289. /** PURE_IMPORTS_START tslib,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  72290. function audit(durationSelector) {
  72291. return function auditOperatorFunction(source) {
  72292. return source.lift(new AuditOperator(durationSelector));
  72293. };
  72294. }
  72295. var AuditOperator = /*@__PURE__*/ (function () {
  72296. function AuditOperator(durationSelector) {
  72297. this.durationSelector = durationSelector;
  72298. }
  72299. AuditOperator.prototype.call = function (subscriber, source) {
  72300. return source.subscribe(new AuditSubscriber(subscriber, this.durationSelector));
  72301. };
  72302. return AuditOperator;
  72303. }());
  72304. var AuditSubscriber = /*@__PURE__*/ (function (_super) {
  72305. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AuditSubscriber, _super);
  72306. function AuditSubscriber(destination, durationSelector) {
  72307. var _this = _super.call(this, destination) || this;
  72308. _this.durationSelector = durationSelector;
  72309. _this.hasValue = false;
  72310. return _this;
  72311. }
  72312. AuditSubscriber.prototype._next = function (value) {
  72313. this.value = value;
  72314. this.hasValue = true;
  72315. if (!this.throttled) {
  72316. var duration = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_1__["tryCatch"])(this.durationSelector)(value);
  72317. if (duration === _util_errorObject__WEBPACK_IMPORTED_MODULE_2__["errorObject"]) {
  72318. this.destination.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_2__["errorObject"].e);
  72319. }
  72320. else {
  72321. var innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(this, duration);
  72322. if (!innerSubscription || innerSubscription.closed) {
  72323. this.clearThrottle();
  72324. }
  72325. else {
  72326. this.add(this.throttled = innerSubscription);
  72327. }
  72328. }
  72329. }
  72330. };
  72331. AuditSubscriber.prototype.clearThrottle = function () {
  72332. var _a = this, value = _a.value, hasValue = _a.hasValue, throttled = _a.throttled;
  72333. if (throttled) {
  72334. this.remove(throttled);
  72335. this.throttled = null;
  72336. throttled.unsubscribe();
  72337. }
  72338. if (hasValue) {
  72339. this.value = null;
  72340. this.hasValue = false;
  72341. this.destination.next(value);
  72342. }
  72343. };
  72344. AuditSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex) {
  72345. this.clearThrottle();
  72346. };
  72347. AuditSubscriber.prototype.notifyComplete = function () {
  72348. this.clearThrottle();
  72349. };
  72350. return AuditSubscriber;
  72351. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  72352. //# sourceMappingURL=audit.js.map
  72353. /***/ }),
  72354. /***/ "./node_modules/rxjs/_esm5/internal/operators/auditTime.js":
  72355. /*!*****************************************************************!*\
  72356. !*** ./node_modules/rxjs/_esm5/internal/operators/auditTime.js ***!
  72357. \*****************************************************************/
  72358. /*! exports provided: auditTime */
  72359. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72360. "use strict";
  72361. __webpack_require__.r(__webpack_exports__);
  72362. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return auditTime; });
  72363. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  72364. /* harmony import */ var _audit__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./audit */ "./node_modules/rxjs/_esm5/internal/operators/audit.js");
  72365. /* harmony import */ var _observable_timer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/timer */ "./node_modules/rxjs/_esm5/internal/observable/timer.js");
  72366. /** PURE_IMPORTS_START _scheduler_async,_audit,_observable_timer PURE_IMPORTS_END */
  72367. function auditTime(duration, scheduler) {
  72368. if (scheduler === void 0) {
  72369. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"];
  72370. }
  72371. return Object(_audit__WEBPACK_IMPORTED_MODULE_1__["audit"])(function () { return Object(_observable_timer__WEBPACK_IMPORTED_MODULE_2__["timer"])(duration, scheduler); });
  72372. }
  72373. //# sourceMappingURL=auditTime.js.map
  72374. /***/ }),
  72375. /***/ "./node_modules/rxjs/_esm5/internal/operators/buffer.js":
  72376. /*!**************************************************************!*\
  72377. !*** ./node_modules/rxjs/_esm5/internal/operators/buffer.js ***!
  72378. \**************************************************************/
  72379. /*! exports provided: buffer */
  72380. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72381. "use strict";
  72382. __webpack_require__.r(__webpack_exports__);
  72383. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return buffer; });
  72384. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72385. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  72386. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  72387. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  72388. function buffer(closingNotifier) {
  72389. return function bufferOperatorFunction(source) {
  72390. return source.lift(new BufferOperator(closingNotifier));
  72391. };
  72392. }
  72393. var BufferOperator = /*@__PURE__*/ (function () {
  72394. function BufferOperator(closingNotifier) {
  72395. this.closingNotifier = closingNotifier;
  72396. }
  72397. BufferOperator.prototype.call = function (subscriber, source) {
  72398. return source.subscribe(new BufferSubscriber(subscriber, this.closingNotifier));
  72399. };
  72400. return BufferOperator;
  72401. }());
  72402. var BufferSubscriber = /*@__PURE__*/ (function (_super) {
  72403. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BufferSubscriber, _super);
  72404. function BufferSubscriber(destination, closingNotifier) {
  72405. var _this = _super.call(this, destination) || this;
  72406. _this.buffer = [];
  72407. _this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(_this, closingNotifier));
  72408. return _this;
  72409. }
  72410. BufferSubscriber.prototype._next = function (value) {
  72411. this.buffer.push(value);
  72412. };
  72413. BufferSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  72414. var buffer = this.buffer;
  72415. this.buffer = [];
  72416. this.destination.next(buffer);
  72417. };
  72418. return BufferSubscriber;
  72419. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  72420. //# sourceMappingURL=buffer.js.map
  72421. /***/ }),
  72422. /***/ "./node_modules/rxjs/_esm5/internal/operators/bufferCount.js":
  72423. /*!*******************************************************************!*\
  72424. !*** ./node_modules/rxjs/_esm5/internal/operators/bufferCount.js ***!
  72425. \*******************************************************************/
  72426. /*! exports provided: bufferCount */
  72427. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72428. "use strict";
  72429. __webpack_require__.r(__webpack_exports__);
  72430. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function() { return bufferCount; });
  72431. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72432. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  72433. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  72434. function bufferCount(bufferSize, startBufferEvery) {
  72435. if (startBufferEvery === void 0) {
  72436. startBufferEvery = null;
  72437. }
  72438. return function bufferCountOperatorFunction(source) {
  72439. return source.lift(new BufferCountOperator(bufferSize, startBufferEvery));
  72440. };
  72441. }
  72442. var BufferCountOperator = /*@__PURE__*/ (function () {
  72443. function BufferCountOperator(bufferSize, startBufferEvery) {
  72444. this.bufferSize = bufferSize;
  72445. this.startBufferEvery = startBufferEvery;
  72446. if (!startBufferEvery || bufferSize === startBufferEvery) {
  72447. this.subscriberClass = BufferCountSubscriber;
  72448. }
  72449. else {
  72450. this.subscriberClass = BufferSkipCountSubscriber;
  72451. }
  72452. }
  72453. BufferCountOperator.prototype.call = function (subscriber, source) {
  72454. return source.subscribe(new this.subscriberClass(subscriber, this.bufferSize, this.startBufferEvery));
  72455. };
  72456. return BufferCountOperator;
  72457. }());
  72458. var BufferCountSubscriber = /*@__PURE__*/ (function (_super) {
  72459. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BufferCountSubscriber, _super);
  72460. function BufferCountSubscriber(destination, bufferSize) {
  72461. var _this = _super.call(this, destination) || this;
  72462. _this.bufferSize = bufferSize;
  72463. _this.buffer = [];
  72464. return _this;
  72465. }
  72466. BufferCountSubscriber.prototype._next = function (value) {
  72467. var buffer = this.buffer;
  72468. buffer.push(value);
  72469. if (buffer.length == this.bufferSize) {
  72470. this.destination.next(buffer);
  72471. this.buffer = [];
  72472. }
  72473. };
  72474. BufferCountSubscriber.prototype._complete = function () {
  72475. var buffer = this.buffer;
  72476. if (buffer.length > 0) {
  72477. this.destination.next(buffer);
  72478. }
  72479. _super.prototype._complete.call(this);
  72480. };
  72481. return BufferCountSubscriber;
  72482. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  72483. var BufferSkipCountSubscriber = /*@__PURE__*/ (function (_super) {
  72484. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BufferSkipCountSubscriber, _super);
  72485. function BufferSkipCountSubscriber(destination, bufferSize, startBufferEvery) {
  72486. var _this = _super.call(this, destination) || this;
  72487. _this.bufferSize = bufferSize;
  72488. _this.startBufferEvery = startBufferEvery;
  72489. _this.buffers = [];
  72490. _this.count = 0;
  72491. return _this;
  72492. }
  72493. BufferSkipCountSubscriber.prototype._next = function (value) {
  72494. var _a = this, bufferSize = _a.bufferSize, startBufferEvery = _a.startBufferEvery, buffers = _a.buffers, count = _a.count;
  72495. this.count++;
  72496. if (count % startBufferEvery === 0) {
  72497. buffers.push([]);
  72498. }
  72499. for (var i = buffers.length; i--;) {
  72500. var buffer = buffers[i];
  72501. buffer.push(value);
  72502. if (buffer.length === bufferSize) {
  72503. buffers.splice(i, 1);
  72504. this.destination.next(buffer);
  72505. }
  72506. }
  72507. };
  72508. BufferSkipCountSubscriber.prototype._complete = function () {
  72509. var _a = this, buffers = _a.buffers, destination = _a.destination;
  72510. while (buffers.length > 0) {
  72511. var buffer = buffers.shift();
  72512. if (buffer.length > 0) {
  72513. destination.next(buffer);
  72514. }
  72515. }
  72516. _super.prototype._complete.call(this);
  72517. };
  72518. return BufferSkipCountSubscriber;
  72519. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  72520. //# sourceMappingURL=bufferCount.js.map
  72521. /***/ }),
  72522. /***/ "./node_modules/rxjs/_esm5/internal/operators/bufferTime.js":
  72523. /*!******************************************************************!*\
  72524. !*** ./node_modules/rxjs/_esm5/internal/operators/bufferTime.js ***!
  72525. \******************************************************************/
  72526. /*! exports provided: bufferTime */
  72527. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72528. "use strict";
  72529. __webpack_require__.r(__webpack_exports__);
  72530. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function() { return bufferTime; });
  72531. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72532. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  72533. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  72534. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  72535. /** PURE_IMPORTS_START tslib,_scheduler_async,_Subscriber,_util_isScheduler PURE_IMPORTS_END */
  72536. function bufferTime(bufferTimeSpan) {
  72537. var length = arguments.length;
  72538. var scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
  72539. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_3__["isScheduler"])(arguments[arguments.length - 1])) {
  72540. scheduler = arguments[arguments.length - 1];
  72541. length--;
  72542. }
  72543. var bufferCreationInterval = null;
  72544. if (length >= 2) {
  72545. bufferCreationInterval = arguments[1];
  72546. }
  72547. var maxBufferSize = Number.POSITIVE_INFINITY;
  72548. if (length >= 3) {
  72549. maxBufferSize = arguments[2];
  72550. }
  72551. return function bufferTimeOperatorFunction(source) {
  72552. return source.lift(new BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler));
  72553. };
  72554. }
  72555. var BufferTimeOperator = /*@__PURE__*/ (function () {
  72556. function BufferTimeOperator(bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
  72557. this.bufferTimeSpan = bufferTimeSpan;
  72558. this.bufferCreationInterval = bufferCreationInterval;
  72559. this.maxBufferSize = maxBufferSize;
  72560. this.scheduler = scheduler;
  72561. }
  72562. BufferTimeOperator.prototype.call = function (subscriber, source) {
  72563. return source.subscribe(new BufferTimeSubscriber(subscriber, this.bufferTimeSpan, this.bufferCreationInterval, this.maxBufferSize, this.scheduler));
  72564. };
  72565. return BufferTimeOperator;
  72566. }());
  72567. var Context = /*@__PURE__*/ (function () {
  72568. function Context() {
  72569. this.buffer = [];
  72570. }
  72571. return Context;
  72572. }());
  72573. var BufferTimeSubscriber = /*@__PURE__*/ (function (_super) {
  72574. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BufferTimeSubscriber, _super);
  72575. function BufferTimeSubscriber(destination, bufferTimeSpan, bufferCreationInterval, maxBufferSize, scheduler) {
  72576. var _this = _super.call(this, destination) || this;
  72577. _this.bufferTimeSpan = bufferTimeSpan;
  72578. _this.bufferCreationInterval = bufferCreationInterval;
  72579. _this.maxBufferSize = maxBufferSize;
  72580. _this.scheduler = scheduler;
  72581. _this.contexts = [];
  72582. var context = _this.openContext();
  72583. _this.timespanOnly = bufferCreationInterval == null || bufferCreationInterval < 0;
  72584. if (_this.timespanOnly) {
  72585. var timeSpanOnlyState = { subscriber: _this, context: context, bufferTimeSpan: bufferTimeSpan };
  72586. _this.add(context.closeAction = scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
  72587. }
  72588. else {
  72589. var closeState = { subscriber: _this, context: context };
  72590. var creationState = { bufferTimeSpan: bufferTimeSpan, bufferCreationInterval: bufferCreationInterval, subscriber: _this, scheduler: scheduler };
  72591. _this.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, closeState));
  72592. _this.add(scheduler.schedule(dispatchBufferCreation, bufferCreationInterval, creationState));
  72593. }
  72594. return _this;
  72595. }
  72596. BufferTimeSubscriber.prototype._next = function (value) {
  72597. var contexts = this.contexts;
  72598. var len = contexts.length;
  72599. var filledBufferContext;
  72600. for (var i = 0; i < len; i++) {
  72601. var context_1 = contexts[i];
  72602. var buffer = context_1.buffer;
  72603. buffer.push(value);
  72604. if (buffer.length == this.maxBufferSize) {
  72605. filledBufferContext = context_1;
  72606. }
  72607. }
  72608. if (filledBufferContext) {
  72609. this.onBufferFull(filledBufferContext);
  72610. }
  72611. };
  72612. BufferTimeSubscriber.prototype._error = function (err) {
  72613. this.contexts.length = 0;
  72614. _super.prototype._error.call(this, err);
  72615. };
  72616. BufferTimeSubscriber.prototype._complete = function () {
  72617. var _a = this, contexts = _a.contexts, destination = _a.destination;
  72618. while (contexts.length > 0) {
  72619. var context_2 = contexts.shift();
  72620. destination.next(context_2.buffer);
  72621. }
  72622. _super.prototype._complete.call(this);
  72623. };
  72624. BufferTimeSubscriber.prototype._unsubscribe = function () {
  72625. this.contexts = null;
  72626. };
  72627. BufferTimeSubscriber.prototype.onBufferFull = function (context) {
  72628. this.closeContext(context);
  72629. var closeAction = context.closeAction;
  72630. closeAction.unsubscribe();
  72631. this.remove(closeAction);
  72632. if (!this.closed && this.timespanOnly) {
  72633. context = this.openContext();
  72634. var bufferTimeSpan = this.bufferTimeSpan;
  72635. var timeSpanOnlyState = { subscriber: this, context: context, bufferTimeSpan: bufferTimeSpan };
  72636. this.add(context.closeAction = this.scheduler.schedule(dispatchBufferTimeSpanOnly, bufferTimeSpan, timeSpanOnlyState));
  72637. }
  72638. };
  72639. BufferTimeSubscriber.prototype.openContext = function () {
  72640. var context = new Context();
  72641. this.contexts.push(context);
  72642. return context;
  72643. };
  72644. BufferTimeSubscriber.prototype.closeContext = function (context) {
  72645. this.destination.next(context.buffer);
  72646. var contexts = this.contexts;
  72647. var spliceIndex = contexts ? contexts.indexOf(context) : -1;
  72648. if (spliceIndex >= 0) {
  72649. contexts.splice(contexts.indexOf(context), 1);
  72650. }
  72651. };
  72652. return BufferTimeSubscriber;
  72653. }(_Subscriber__WEBPACK_IMPORTED_MODULE_2__["Subscriber"]));
  72654. function dispatchBufferTimeSpanOnly(state) {
  72655. var subscriber = state.subscriber;
  72656. var prevContext = state.context;
  72657. if (prevContext) {
  72658. subscriber.closeContext(prevContext);
  72659. }
  72660. if (!subscriber.closed) {
  72661. state.context = subscriber.openContext();
  72662. state.context.closeAction = this.schedule(state, state.bufferTimeSpan);
  72663. }
  72664. }
  72665. function dispatchBufferCreation(state) {
  72666. var bufferCreationInterval = state.bufferCreationInterval, bufferTimeSpan = state.bufferTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler;
  72667. var context = subscriber.openContext();
  72668. var action = this;
  72669. if (!subscriber.closed) {
  72670. subscriber.add(context.closeAction = scheduler.schedule(dispatchBufferClose, bufferTimeSpan, { subscriber: subscriber, context: context }));
  72671. action.schedule(state, bufferCreationInterval);
  72672. }
  72673. }
  72674. function dispatchBufferClose(arg) {
  72675. var subscriber = arg.subscriber, context = arg.context;
  72676. subscriber.closeContext(context);
  72677. }
  72678. //# sourceMappingURL=bufferTime.js.map
  72679. /***/ }),
  72680. /***/ "./node_modules/rxjs/_esm5/internal/operators/bufferToggle.js":
  72681. /*!********************************************************************!*\
  72682. !*** ./node_modules/rxjs/_esm5/internal/operators/bufferToggle.js ***!
  72683. \********************************************************************/
  72684. /*! exports provided: bufferToggle */
  72685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72686. "use strict";
  72687. __webpack_require__.r(__webpack_exports__);
  72688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function() { return bufferToggle; });
  72689. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72690. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  72691. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  72692. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  72693. /** PURE_IMPORTS_START tslib,_Subscription,_util_subscribeToResult,_OuterSubscriber PURE_IMPORTS_END */
  72694. function bufferToggle(openings, closingSelector) {
  72695. return function bufferToggleOperatorFunction(source) {
  72696. return source.lift(new BufferToggleOperator(openings, closingSelector));
  72697. };
  72698. }
  72699. var BufferToggleOperator = /*@__PURE__*/ (function () {
  72700. function BufferToggleOperator(openings, closingSelector) {
  72701. this.openings = openings;
  72702. this.closingSelector = closingSelector;
  72703. }
  72704. BufferToggleOperator.prototype.call = function (subscriber, source) {
  72705. return source.subscribe(new BufferToggleSubscriber(subscriber, this.openings, this.closingSelector));
  72706. };
  72707. return BufferToggleOperator;
  72708. }());
  72709. var BufferToggleSubscriber = /*@__PURE__*/ (function (_super) {
  72710. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BufferToggleSubscriber, _super);
  72711. function BufferToggleSubscriber(destination, openings, closingSelector) {
  72712. var _this = _super.call(this, destination) || this;
  72713. _this.openings = openings;
  72714. _this.closingSelector = closingSelector;
  72715. _this.contexts = [];
  72716. _this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(_this, openings));
  72717. return _this;
  72718. }
  72719. BufferToggleSubscriber.prototype._next = function (value) {
  72720. var contexts = this.contexts;
  72721. var len = contexts.length;
  72722. for (var i = 0; i < len; i++) {
  72723. contexts[i].buffer.push(value);
  72724. }
  72725. };
  72726. BufferToggleSubscriber.prototype._error = function (err) {
  72727. var contexts = this.contexts;
  72728. while (contexts.length > 0) {
  72729. var context_1 = contexts.shift();
  72730. context_1.subscription.unsubscribe();
  72731. context_1.buffer = null;
  72732. context_1.subscription = null;
  72733. }
  72734. this.contexts = null;
  72735. _super.prototype._error.call(this, err);
  72736. };
  72737. BufferToggleSubscriber.prototype._complete = function () {
  72738. var contexts = this.contexts;
  72739. while (contexts.length > 0) {
  72740. var context_2 = contexts.shift();
  72741. this.destination.next(context_2.buffer);
  72742. context_2.subscription.unsubscribe();
  72743. context_2.buffer = null;
  72744. context_2.subscription = null;
  72745. }
  72746. this.contexts = null;
  72747. _super.prototype._complete.call(this);
  72748. };
  72749. BufferToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  72750. outerValue ? this.closeBuffer(outerValue) : this.openBuffer(innerValue);
  72751. };
  72752. BufferToggleSubscriber.prototype.notifyComplete = function (innerSub) {
  72753. this.closeBuffer(innerSub.context);
  72754. };
  72755. BufferToggleSubscriber.prototype.openBuffer = function (value) {
  72756. try {
  72757. var closingSelector = this.closingSelector;
  72758. var closingNotifier = closingSelector.call(this, value);
  72759. if (closingNotifier) {
  72760. this.trySubscribe(closingNotifier);
  72761. }
  72762. }
  72763. catch (err) {
  72764. this._error(err);
  72765. }
  72766. };
  72767. BufferToggleSubscriber.prototype.closeBuffer = function (context) {
  72768. var contexts = this.contexts;
  72769. if (contexts && context) {
  72770. var buffer = context.buffer, subscription = context.subscription;
  72771. this.destination.next(buffer);
  72772. contexts.splice(contexts.indexOf(context), 1);
  72773. this.remove(subscription);
  72774. subscription.unsubscribe();
  72775. }
  72776. };
  72777. BufferToggleSubscriber.prototype.trySubscribe = function (closingNotifier) {
  72778. var contexts = this.contexts;
  72779. var buffer = [];
  72780. var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  72781. var context = { buffer: buffer, subscription: subscription };
  72782. contexts.push(context);
  72783. var innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, closingNotifier, context);
  72784. if (!innerSubscription || innerSubscription.closed) {
  72785. this.closeBuffer(context);
  72786. }
  72787. else {
  72788. innerSubscription.context = context;
  72789. this.add(innerSubscription);
  72790. subscription.add(innerSubscription);
  72791. }
  72792. };
  72793. return BufferToggleSubscriber;
  72794. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  72795. //# sourceMappingURL=bufferToggle.js.map
  72796. /***/ }),
  72797. /***/ "./node_modules/rxjs/_esm5/internal/operators/bufferWhen.js":
  72798. /*!******************************************************************!*\
  72799. !*** ./node_modules/rxjs/_esm5/internal/operators/bufferWhen.js ***!
  72800. \******************************************************************/
  72801. /*! exports provided: bufferWhen */
  72802. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72803. "use strict";
  72804. __webpack_require__.r(__webpack_exports__);
  72805. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function() { return bufferWhen; });
  72806. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72807. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  72808. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  72809. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  72810. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  72811. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  72812. /** PURE_IMPORTS_START tslib,_Subscription,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  72813. function bufferWhen(closingSelector) {
  72814. return function (source) {
  72815. return source.lift(new BufferWhenOperator(closingSelector));
  72816. };
  72817. }
  72818. var BufferWhenOperator = /*@__PURE__*/ (function () {
  72819. function BufferWhenOperator(closingSelector) {
  72820. this.closingSelector = closingSelector;
  72821. }
  72822. BufferWhenOperator.prototype.call = function (subscriber, source) {
  72823. return source.subscribe(new BufferWhenSubscriber(subscriber, this.closingSelector));
  72824. };
  72825. return BufferWhenOperator;
  72826. }());
  72827. var BufferWhenSubscriber = /*@__PURE__*/ (function (_super) {
  72828. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](BufferWhenSubscriber, _super);
  72829. function BufferWhenSubscriber(destination, closingSelector) {
  72830. var _this = _super.call(this, destination) || this;
  72831. _this.closingSelector = closingSelector;
  72832. _this.subscribing = false;
  72833. _this.openBuffer();
  72834. return _this;
  72835. }
  72836. BufferWhenSubscriber.prototype._next = function (value) {
  72837. this.buffer.push(value);
  72838. };
  72839. BufferWhenSubscriber.prototype._complete = function () {
  72840. var buffer = this.buffer;
  72841. if (buffer) {
  72842. this.destination.next(buffer);
  72843. }
  72844. _super.prototype._complete.call(this);
  72845. };
  72846. BufferWhenSubscriber.prototype._unsubscribe = function () {
  72847. this.buffer = null;
  72848. this.subscribing = false;
  72849. };
  72850. BufferWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  72851. this.openBuffer();
  72852. };
  72853. BufferWhenSubscriber.prototype.notifyComplete = function () {
  72854. if (this.subscribing) {
  72855. this.complete();
  72856. }
  72857. else {
  72858. this.openBuffer();
  72859. }
  72860. };
  72861. BufferWhenSubscriber.prototype.openBuffer = function () {
  72862. var closingSubscription = this.closingSubscription;
  72863. if (closingSubscription) {
  72864. this.remove(closingSubscription);
  72865. closingSubscription.unsubscribe();
  72866. }
  72867. var buffer = this.buffer;
  72868. if (this.buffer) {
  72869. this.destination.next(buffer);
  72870. }
  72871. this.buffer = [];
  72872. var closingNotifier = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(this.closingSelector)();
  72873. if (closingNotifier === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  72874. this.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"].e);
  72875. }
  72876. else {
  72877. closingSubscription = new _Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]();
  72878. this.closingSubscription = closingSubscription;
  72879. this.add(closingSubscription);
  72880. this.subscribing = true;
  72881. closingSubscription.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__["subscribeToResult"])(this, closingNotifier));
  72882. this.subscribing = false;
  72883. }
  72884. };
  72885. return BufferWhenSubscriber;
  72886. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__["OuterSubscriber"]));
  72887. //# sourceMappingURL=bufferWhen.js.map
  72888. /***/ }),
  72889. /***/ "./node_modules/rxjs/_esm5/internal/operators/catchError.js":
  72890. /*!******************************************************************!*\
  72891. !*** ./node_modules/rxjs/_esm5/internal/operators/catchError.js ***!
  72892. \******************************************************************/
  72893. /*! exports provided: catchError */
  72894. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72895. "use strict";
  72896. __webpack_require__.r(__webpack_exports__);
  72897. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "catchError", function() { return catchError; });
  72898. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  72899. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  72900. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  72901. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  72902. function catchError(selector) {
  72903. return function catchErrorOperatorFunction(source) {
  72904. var operator = new CatchOperator(selector);
  72905. var caught = source.lift(operator);
  72906. return (operator.caught = caught);
  72907. };
  72908. }
  72909. var CatchOperator = /*@__PURE__*/ (function () {
  72910. function CatchOperator(selector) {
  72911. this.selector = selector;
  72912. }
  72913. CatchOperator.prototype.call = function (subscriber, source) {
  72914. return source.subscribe(new CatchSubscriber(subscriber, this.selector, this.caught));
  72915. };
  72916. return CatchOperator;
  72917. }());
  72918. var CatchSubscriber = /*@__PURE__*/ (function (_super) {
  72919. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](CatchSubscriber, _super);
  72920. function CatchSubscriber(destination, selector, caught) {
  72921. var _this = _super.call(this, destination) || this;
  72922. _this.selector = selector;
  72923. _this.caught = caught;
  72924. return _this;
  72925. }
  72926. CatchSubscriber.prototype.error = function (err) {
  72927. if (!this.isStopped) {
  72928. var result = void 0;
  72929. try {
  72930. result = this.selector(err, this.caught);
  72931. }
  72932. catch (err2) {
  72933. _super.prototype.error.call(this, err2);
  72934. return;
  72935. }
  72936. this._unsubscribeAndRecycle();
  72937. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, result));
  72938. }
  72939. };
  72940. return CatchSubscriber;
  72941. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  72942. //# sourceMappingURL=catchError.js.map
  72943. /***/ }),
  72944. /***/ "./node_modules/rxjs/_esm5/internal/operators/combineAll.js":
  72945. /*!******************************************************************!*\
  72946. !*** ./node_modules/rxjs/_esm5/internal/operators/combineAll.js ***!
  72947. \******************************************************************/
  72948. /*! exports provided: combineAll */
  72949. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72950. "use strict";
  72951. __webpack_require__.r(__webpack_exports__);
  72952. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineAll", function() { return combineAll; });
  72953. /* harmony import */ var _observable_combineLatest__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/combineLatest */ "./node_modules/rxjs/_esm5/internal/observable/combineLatest.js");
  72954. /** PURE_IMPORTS_START _observable_combineLatest PURE_IMPORTS_END */
  72955. function combineAll(project) {
  72956. return function (source) { return source.lift(new _observable_combineLatest__WEBPACK_IMPORTED_MODULE_0__["CombineLatestOperator"](project)); };
  72957. }
  72958. //# sourceMappingURL=combineAll.js.map
  72959. /***/ }),
  72960. /***/ "./node_modules/rxjs/_esm5/internal/operators/combineLatest.js":
  72961. /*!*********************************************************************!*\
  72962. !*** ./node_modules/rxjs/_esm5/internal/operators/combineLatest.js ***!
  72963. \*********************************************************************/
  72964. /*! exports provided: combineLatest */
  72965. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72966. "use strict";
  72967. __webpack_require__.r(__webpack_exports__);
  72968. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return combineLatest; });
  72969. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  72970. /* harmony import */ var _observable_combineLatest__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../observable/combineLatest */ "./node_modules/rxjs/_esm5/internal/observable/combineLatest.js");
  72971. /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  72972. /** PURE_IMPORTS_START _util_isArray,_observable_combineLatest,_observable_from PURE_IMPORTS_END */
  72973. var none = {};
  72974. function combineLatest() {
  72975. var observables = [];
  72976. for (var _i = 0; _i < arguments.length; _i++) {
  72977. observables[_i] = arguments[_i];
  72978. }
  72979. var project = null;
  72980. if (typeof observables[observables.length - 1] === 'function') {
  72981. project = observables.pop();
  72982. }
  72983. if (observables.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(observables[0])) {
  72984. observables = observables[0].slice();
  72985. }
  72986. return function (source) { return source.lift.call(Object(_observable_from__WEBPACK_IMPORTED_MODULE_2__["from"])([source].concat(observables)), new _observable_combineLatest__WEBPACK_IMPORTED_MODULE_1__["CombineLatestOperator"](project)); };
  72987. }
  72988. //# sourceMappingURL=combineLatest.js.map
  72989. /***/ }),
  72990. /***/ "./node_modules/rxjs/_esm5/internal/operators/concat.js":
  72991. /*!**************************************************************!*\
  72992. !*** ./node_modules/rxjs/_esm5/internal/operators/concat.js ***!
  72993. \**************************************************************/
  72994. /*! exports provided: concat */
  72995. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  72996. "use strict";
  72997. __webpack_require__.r(__webpack_exports__);
  72998. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return concat; });
  72999. /* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/concat */ "./node_modules/rxjs/_esm5/internal/observable/concat.js");
  73000. /** PURE_IMPORTS_START _observable_concat PURE_IMPORTS_END */
  73001. function concat() {
  73002. var observables = [];
  73003. for (var _i = 0; _i < arguments.length; _i++) {
  73004. observables[_i] = arguments[_i];
  73005. }
  73006. return function (source) { return source.lift.call(_observable_concat__WEBPACK_IMPORTED_MODULE_0__["concat"].apply(void 0, [source].concat(observables))); };
  73007. }
  73008. //# sourceMappingURL=concat.js.map
  73009. /***/ }),
  73010. /***/ "./node_modules/rxjs/_esm5/internal/operators/concatAll.js":
  73011. /*!*****************************************************************!*\
  73012. !*** ./node_modules/rxjs/_esm5/internal/operators/concatAll.js ***!
  73013. \*****************************************************************/
  73014. /*! exports provided: concatAll */
  73015. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73016. "use strict";
  73017. __webpack_require__.r(__webpack_exports__);
  73018. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatAll", function() { return concatAll; });
  73019. /* harmony import */ var _mergeAll__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mergeAll */ "./node_modules/rxjs/_esm5/internal/operators/mergeAll.js");
  73020. /** PURE_IMPORTS_START _mergeAll PURE_IMPORTS_END */
  73021. function concatAll() {
  73022. return Object(_mergeAll__WEBPACK_IMPORTED_MODULE_0__["mergeAll"])(1);
  73023. }
  73024. //# sourceMappingURL=concatAll.js.map
  73025. /***/ }),
  73026. /***/ "./node_modules/rxjs/_esm5/internal/operators/concatMap.js":
  73027. /*!*****************************************************************!*\
  73028. !*** ./node_modules/rxjs/_esm5/internal/operators/concatMap.js ***!
  73029. \*****************************************************************/
  73030. /*! exports provided: concatMap */
  73031. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73032. "use strict";
  73033. __webpack_require__.r(__webpack_exports__);
  73034. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMap", function() { return concatMap; });
  73035. /* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mergeMap */ "./node_modules/rxjs/_esm5/internal/operators/mergeMap.js");
  73036. /** PURE_IMPORTS_START _mergeMap PURE_IMPORTS_END */
  73037. function concatMap(project, resultSelector) {
  73038. return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(project, resultSelector, 1);
  73039. }
  73040. //# sourceMappingURL=concatMap.js.map
  73041. /***/ }),
  73042. /***/ "./node_modules/rxjs/_esm5/internal/operators/concatMapTo.js":
  73043. /*!*******************************************************************!*\
  73044. !*** ./node_modules/rxjs/_esm5/internal/operators/concatMapTo.js ***!
  73045. \*******************************************************************/
  73046. /*! exports provided: concatMapTo */
  73047. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73048. "use strict";
  73049. __webpack_require__.r(__webpack_exports__);
  73050. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return concatMapTo; });
  73051. /* harmony import */ var _concatMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./concatMap */ "./node_modules/rxjs/_esm5/internal/operators/concatMap.js");
  73052. /** PURE_IMPORTS_START _concatMap PURE_IMPORTS_END */
  73053. function concatMapTo(innerObservable, resultSelector) {
  73054. return Object(_concatMap__WEBPACK_IMPORTED_MODULE_0__["concatMap"])(function () { return innerObservable; }, resultSelector);
  73055. }
  73056. //# sourceMappingURL=concatMapTo.js.map
  73057. /***/ }),
  73058. /***/ "./node_modules/rxjs/_esm5/internal/operators/count.js":
  73059. /*!*************************************************************!*\
  73060. !*** ./node_modules/rxjs/_esm5/internal/operators/count.js ***!
  73061. \*************************************************************/
  73062. /*! exports provided: count */
  73063. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73064. "use strict";
  73065. __webpack_require__.r(__webpack_exports__);
  73066. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "count", function() { return count; });
  73067. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73068. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73069. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  73070. function count(predicate) {
  73071. return function (source) { return source.lift(new CountOperator(predicate, source)); };
  73072. }
  73073. var CountOperator = /*@__PURE__*/ (function () {
  73074. function CountOperator(predicate, source) {
  73075. this.predicate = predicate;
  73076. this.source = source;
  73077. }
  73078. CountOperator.prototype.call = function (subscriber, source) {
  73079. return source.subscribe(new CountSubscriber(subscriber, this.predicate, this.source));
  73080. };
  73081. return CountOperator;
  73082. }());
  73083. var CountSubscriber = /*@__PURE__*/ (function (_super) {
  73084. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](CountSubscriber, _super);
  73085. function CountSubscriber(destination, predicate, source) {
  73086. var _this = _super.call(this, destination) || this;
  73087. _this.predicate = predicate;
  73088. _this.source = source;
  73089. _this.count = 0;
  73090. _this.index = 0;
  73091. return _this;
  73092. }
  73093. CountSubscriber.prototype._next = function (value) {
  73094. if (this.predicate) {
  73095. this._tryPredicate(value);
  73096. }
  73097. else {
  73098. this.count++;
  73099. }
  73100. };
  73101. CountSubscriber.prototype._tryPredicate = function (value) {
  73102. var result;
  73103. try {
  73104. result = this.predicate(value, this.index++, this.source);
  73105. }
  73106. catch (err) {
  73107. this.destination.error(err);
  73108. return;
  73109. }
  73110. if (result) {
  73111. this.count++;
  73112. }
  73113. };
  73114. CountSubscriber.prototype._complete = function () {
  73115. this.destination.next(this.count);
  73116. this.destination.complete();
  73117. };
  73118. return CountSubscriber;
  73119. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73120. //# sourceMappingURL=count.js.map
  73121. /***/ }),
  73122. /***/ "./node_modules/rxjs/_esm5/internal/operators/debounce.js":
  73123. /*!****************************************************************!*\
  73124. !*** ./node_modules/rxjs/_esm5/internal/operators/debounce.js ***!
  73125. \****************************************************************/
  73126. /*! exports provided: debounce */
  73127. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73128. "use strict";
  73129. __webpack_require__.r(__webpack_exports__);
  73130. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return debounce; });
  73131. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73132. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  73133. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  73134. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  73135. function debounce(durationSelector) {
  73136. return function (source) { return source.lift(new DebounceOperator(durationSelector)); };
  73137. }
  73138. var DebounceOperator = /*@__PURE__*/ (function () {
  73139. function DebounceOperator(durationSelector) {
  73140. this.durationSelector = durationSelector;
  73141. }
  73142. DebounceOperator.prototype.call = function (subscriber, source) {
  73143. return source.subscribe(new DebounceSubscriber(subscriber, this.durationSelector));
  73144. };
  73145. return DebounceOperator;
  73146. }());
  73147. var DebounceSubscriber = /*@__PURE__*/ (function (_super) {
  73148. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DebounceSubscriber, _super);
  73149. function DebounceSubscriber(destination, durationSelector) {
  73150. var _this = _super.call(this, destination) || this;
  73151. _this.durationSelector = durationSelector;
  73152. _this.hasValue = false;
  73153. _this.durationSubscription = null;
  73154. return _this;
  73155. }
  73156. DebounceSubscriber.prototype._next = function (value) {
  73157. try {
  73158. var result = this.durationSelector.call(this, value);
  73159. if (result) {
  73160. this._tryNext(value, result);
  73161. }
  73162. }
  73163. catch (err) {
  73164. this.destination.error(err);
  73165. }
  73166. };
  73167. DebounceSubscriber.prototype._complete = function () {
  73168. this.emitValue();
  73169. this.destination.complete();
  73170. };
  73171. DebounceSubscriber.prototype._tryNext = function (value, duration) {
  73172. var subscription = this.durationSubscription;
  73173. this.value = value;
  73174. this.hasValue = true;
  73175. if (subscription) {
  73176. subscription.unsubscribe();
  73177. this.remove(subscription);
  73178. }
  73179. subscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, duration);
  73180. if (subscription && !subscription.closed) {
  73181. this.add(this.durationSubscription = subscription);
  73182. }
  73183. };
  73184. DebounceSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  73185. this.emitValue();
  73186. };
  73187. DebounceSubscriber.prototype.notifyComplete = function () {
  73188. this.emitValue();
  73189. };
  73190. DebounceSubscriber.prototype.emitValue = function () {
  73191. if (this.hasValue) {
  73192. var value = this.value;
  73193. var subscription = this.durationSubscription;
  73194. if (subscription) {
  73195. this.durationSubscription = null;
  73196. subscription.unsubscribe();
  73197. this.remove(subscription);
  73198. }
  73199. this.value = null;
  73200. this.hasValue = false;
  73201. _super.prototype._next.call(this, value);
  73202. }
  73203. };
  73204. return DebounceSubscriber;
  73205. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  73206. //# sourceMappingURL=debounce.js.map
  73207. /***/ }),
  73208. /***/ "./node_modules/rxjs/_esm5/internal/operators/debounceTime.js":
  73209. /*!********************************************************************!*\
  73210. !*** ./node_modules/rxjs/_esm5/internal/operators/debounceTime.js ***!
  73211. \********************************************************************/
  73212. /*! exports provided: debounceTime */
  73213. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73214. "use strict";
  73215. __webpack_require__.r(__webpack_exports__);
  73216. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function() { return debounceTime; });
  73217. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73218. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73219. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  73220. /** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async PURE_IMPORTS_END */
  73221. function debounceTime(dueTime, scheduler) {
  73222. if (scheduler === void 0) {
  73223. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_2__["async"];
  73224. }
  73225. return function (source) { return source.lift(new DebounceTimeOperator(dueTime, scheduler)); };
  73226. }
  73227. var DebounceTimeOperator = /*@__PURE__*/ (function () {
  73228. function DebounceTimeOperator(dueTime, scheduler) {
  73229. this.dueTime = dueTime;
  73230. this.scheduler = scheduler;
  73231. }
  73232. DebounceTimeOperator.prototype.call = function (subscriber, source) {
  73233. return source.subscribe(new DebounceTimeSubscriber(subscriber, this.dueTime, this.scheduler));
  73234. };
  73235. return DebounceTimeOperator;
  73236. }());
  73237. var DebounceTimeSubscriber = /*@__PURE__*/ (function (_super) {
  73238. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DebounceTimeSubscriber, _super);
  73239. function DebounceTimeSubscriber(destination, dueTime, scheduler) {
  73240. var _this = _super.call(this, destination) || this;
  73241. _this.dueTime = dueTime;
  73242. _this.scheduler = scheduler;
  73243. _this.debouncedSubscription = null;
  73244. _this.lastValue = null;
  73245. _this.hasValue = false;
  73246. return _this;
  73247. }
  73248. DebounceTimeSubscriber.prototype._next = function (value) {
  73249. this.clearDebounce();
  73250. this.lastValue = value;
  73251. this.hasValue = true;
  73252. this.add(this.debouncedSubscription = this.scheduler.schedule(dispatchNext, this.dueTime, this));
  73253. };
  73254. DebounceTimeSubscriber.prototype._complete = function () {
  73255. this.debouncedNext();
  73256. this.destination.complete();
  73257. };
  73258. DebounceTimeSubscriber.prototype.debouncedNext = function () {
  73259. this.clearDebounce();
  73260. if (this.hasValue) {
  73261. var lastValue = this.lastValue;
  73262. this.lastValue = null;
  73263. this.hasValue = false;
  73264. this.destination.next(lastValue);
  73265. }
  73266. };
  73267. DebounceTimeSubscriber.prototype.clearDebounce = function () {
  73268. var debouncedSubscription = this.debouncedSubscription;
  73269. if (debouncedSubscription !== null) {
  73270. this.remove(debouncedSubscription);
  73271. debouncedSubscription.unsubscribe();
  73272. this.debouncedSubscription = null;
  73273. }
  73274. };
  73275. return DebounceTimeSubscriber;
  73276. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73277. function dispatchNext(subscriber) {
  73278. subscriber.debouncedNext();
  73279. }
  73280. //# sourceMappingURL=debounceTime.js.map
  73281. /***/ }),
  73282. /***/ "./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js":
  73283. /*!**********************************************************************!*\
  73284. !*** ./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js ***!
  73285. \**********************************************************************/
  73286. /*! exports provided: defaultIfEmpty */
  73287. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73288. "use strict";
  73289. __webpack_require__.r(__webpack_exports__);
  73290. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function() { return defaultIfEmpty; });
  73291. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73292. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73293. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  73294. function defaultIfEmpty(defaultValue) {
  73295. if (defaultValue === void 0) {
  73296. defaultValue = null;
  73297. }
  73298. return function (source) { return source.lift(new DefaultIfEmptyOperator(defaultValue)); };
  73299. }
  73300. var DefaultIfEmptyOperator = /*@__PURE__*/ (function () {
  73301. function DefaultIfEmptyOperator(defaultValue) {
  73302. this.defaultValue = defaultValue;
  73303. }
  73304. DefaultIfEmptyOperator.prototype.call = function (subscriber, source) {
  73305. return source.subscribe(new DefaultIfEmptySubscriber(subscriber, this.defaultValue));
  73306. };
  73307. return DefaultIfEmptyOperator;
  73308. }());
  73309. var DefaultIfEmptySubscriber = /*@__PURE__*/ (function (_super) {
  73310. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DefaultIfEmptySubscriber, _super);
  73311. function DefaultIfEmptySubscriber(destination, defaultValue) {
  73312. var _this = _super.call(this, destination) || this;
  73313. _this.defaultValue = defaultValue;
  73314. _this.isEmpty = true;
  73315. return _this;
  73316. }
  73317. DefaultIfEmptySubscriber.prototype._next = function (value) {
  73318. this.isEmpty = false;
  73319. this.destination.next(value);
  73320. };
  73321. DefaultIfEmptySubscriber.prototype._complete = function () {
  73322. if (this.isEmpty) {
  73323. this.destination.next(this.defaultValue);
  73324. }
  73325. this.destination.complete();
  73326. };
  73327. return DefaultIfEmptySubscriber;
  73328. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73329. //# sourceMappingURL=defaultIfEmpty.js.map
  73330. /***/ }),
  73331. /***/ "./node_modules/rxjs/_esm5/internal/operators/delay.js":
  73332. /*!*************************************************************!*\
  73333. !*** ./node_modules/rxjs/_esm5/internal/operators/delay.js ***!
  73334. \*************************************************************/
  73335. /*! exports provided: delay */
  73336. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73337. "use strict";
  73338. __webpack_require__.r(__webpack_exports__);
  73339. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return delay; });
  73340. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73341. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  73342. /* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isDate */ "./node_modules/rxjs/_esm5/internal/util/isDate.js");
  73343. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73344. /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Notification */ "./node_modules/rxjs/_esm5/internal/Notification.js");
  73345. /** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_Subscriber,_Notification PURE_IMPORTS_END */
  73346. function delay(delay, scheduler) {
  73347. if (scheduler === void 0) {
  73348. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
  73349. }
  73350. var absoluteDelay = Object(_util_isDate__WEBPACK_IMPORTED_MODULE_2__["isDate"])(delay);
  73351. var delayFor = absoluteDelay ? (+delay - scheduler.now()) : Math.abs(delay);
  73352. return function (source) { return source.lift(new DelayOperator(delayFor, scheduler)); };
  73353. }
  73354. var DelayOperator = /*@__PURE__*/ (function () {
  73355. function DelayOperator(delay, scheduler) {
  73356. this.delay = delay;
  73357. this.scheduler = scheduler;
  73358. }
  73359. DelayOperator.prototype.call = function (subscriber, source) {
  73360. return source.subscribe(new DelaySubscriber(subscriber, this.delay, this.scheduler));
  73361. };
  73362. return DelayOperator;
  73363. }());
  73364. var DelaySubscriber = /*@__PURE__*/ (function (_super) {
  73365. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DelaySubscriber, _super);
  73366. function DelaySubscriber(destination, delay, scheduler) {
  73367. var _this = _super.call(this, destination) || this;
  73368. _this.delay = delay;
  73369. _this.scheduler = scheduler;
  73370. _this.queue = [];
  73371. _this.active = false;
  73372. _this.errored = false;
  73373. return _this;
  73374. }
  73375. DelaySubscriber.dispatch = function (state) {
  73376. var source = state.source;
  73377. var queue = source.queue;
  73378. var scheduler = state.scheduler;
  73379. var destination = state.destination;
  73380. while (queue.length > 0 && (queue[0].time - scheduler.now()) <= 0) {
  73381. queue.shift().notification.observe(destination);
  73382. }
  73383. if (queue.length > 0) {
  73384. var delay_1 = Math.max(0, queue[0].time - scheduler.now());
  73385. this.schedule(state, delay_1);
  73386. }
  73387. else {
  73388. this.unsubscribe();
  73389. source.active = false;
  73390. }
  73391. };
  73392. DelaySubscriber.prototype._schedule = function (scheduler) {
  73393. this.active = true;
  73394. this.add(scheduler.schedule(DelaySubscriber.dispatch, this.delay, {
  73395. source: this, destination: this.destination, scheduler: scheduler
  73396. }));
  73397. };
  73398. DelaySubscriber.prototype.scheduleNotification = function (notification) {
  73399. if (this.errored === true) {
  73400. return;
  73401. }
  73402. var scheduler = this.scheduler;
  73403. var message = new DelayMessage(scheduler.now() + this.delay, notification);
  73404. this.queue.push(message);
  73405. if (this.active === false) {
  73406. this._schedule(scheduler);
  73407. }
  73408. };
  73409. DelaySubscriber.prototype._next = function (value) {
  73410. this.scheduleNotification(_Notification__WEBPACK_IMPORTED_MODULE_4__["Notification"].createNext(value));
  73411. };
  73412. DelaySubscriber.prototype._error = function (err) {
  73413. this.errored = true;
  73414. this.queue = [];
  73415. this.destination.error(err);
  73416. };
  73417. DelaySubscriber.prototype._complete = function () {
  73418. this.scheduleNotification(_Notification__WEBPACK_IMPORTED_MODULE_4__["Notification"].createComplete());
  73419. };
  73420. return DelaySubscriber;
  73421. }(_Subscriber__WEBPACK_IMPORTED_MODULE_3__["Subscriber"]));
  73422. var DelayMessage = /*@__PURE__*/ (function () {
  73423. function DelayMessage(time, notification) {
  73424. this.time = time;
  73425. this.notification = notification;
  73426. }
  73427. return DelayMessage;
  73428. }());
  73429. //# sourceMappingURL=delay.js.map
  73430. /***/ }),
  73431. /***/ "./node_modules/rxjs/_esm5/internal/operators/delayWhen.js":
  73432. /*!*****************************************************************!*\
  73433. !*** ./node_modules/rxjs/_esm5/internal/operators/delayWhen.js ***!
  73434. \*****************************************************************/
  73435. /*! exports provided: delayWhen */
  73436. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73437. "use strict";
  73438. __webpack_require__.r(__webpack_exports__);
  73439. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function() { return delayWhen; });
  73440. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73441. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73442. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  73443. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  73444. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  73445. /** PURE_IMPORTS_START tslib,_Subscriber,_Observable,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  73446. function delayWhen(delayDurationSelector, subscriptionDelay) {
  73447. if (subscriptionDelay) {
  73448. return function (source) {
  73449. return new SubscriptionDelayObservable(source, subscriptionDelay)
  73450. .lift(new DelayWhenOperator(delayDurationSelector));
  73451. };
  73452. }
  73453. return function (source) { return source.lift(new DelayWhenOperator(delayDurationSelector)); };
  73454. }
  73455. var DelayWhenOperator = /*@__PURE__*/ (function () {
  73456. function DelayWhenOperator(delayDurationSelector) {
  73457. this.delayDurationSelector = delayDurationSelector;
  73458. }
  73459. DelayWhenOperator.prototype.call = function (subscriber, source) {
  73460. return source.subscribe(new DelayWhenSubscriber(subscriber, this.delayDurationSelector));
  73461. };
  73462. return DelayWhenOperator;
  73463. }());
  73464. var DelayWhenSubscriber = /*@__PURE__*/ (function (_super) {
  73465. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DelayWhenSubscriber, _super);
  73466. function DelayWhenSubscriber(destination, delayDurationSelector) {
  73467. var _this = _super.call(this, destination) || this;
  73468. _this.delayDurationSelector = delayDurationSelector;
  73469. _this.completed = false;
  73470. _this.delayNotifierSubscriptions = [];
  73471. return _this;
  73472. }
  73473. DelayWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  73474. this.destination.next(outerValue);
  73475. this.removeSubscription(innerSub);
  73476. this.tryComplete();
  73477. };
  73478. DelayWhenSubscriber.prototype.notifyError = function (error, innerSub) {
  73479. this._error(error);
  73480. };
  73481. DelayWhenSubscriber.prototype.notifyComplete = function (innerSub) {
  73482. var value = this.removeSubscription(innerSub);
  73483. if (value) {
  73484. this.destination.next(value);
  73485. }
  73486. this.tryComplete();
  73487. };
  73488. DelayWhenSubscriber.prototype._next = function (value) {
  73489. try {
  73490. var delayNotifier = this.delayDurationSelector(value);
  73491. if (delayNotifier) {
  73492. this.tryDelay(delayNotifier, value);
  73493. }
  73494. }
  73495. catch (err) {
  73496. this.destination.error(err);
  73497. }
  73498. };
  73499. DelayWhenSubscriber.prototype._complete = function () {
  73500. this.completed = true;
  73501. this.tryComplete();
  73502. };
  73503. DelayWhenSubscriber.prototype.removeSubscription = function (subscription) {
  73504. subscription.unsubscribe();
  73505. var subscriptionIdx = this.delayNotifierSubscriptions.indexOf(subscription);
  73506. if (subscriptionIdx !== -1) {
  73507. this.delayNotifierSubscriptions.splice(subscriptionIdx, 1);
  73508. }
  73509. return subscription.outerValue;
  73510. };
  73511. DelayWhenSubscriber.prototype.tryDelay = function (delayNotifier, value) {
  73512. var notifierSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(this, delayNotifier, value);
  73513. if (notifierSubscription && !notifierSubscription.closed) {
  73514. this.add(notifierSubscription);
  73515. this.delayNotifierSubscriptions.push(notifierSubscription);
  73516. }
  73517. };
  73518. DelayWhenSubscriber.prototype.tryComplete = function () {
  73519. if (this.completed && this.delayNotifierSubscriptions.length === 0) {
  73520. this.destination.complete();
  73521. }
  73522. };
  73523. return DelayWhenSubscriber;
  73524. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  73525. var SubscriptionDelayObservable = /*@__PURE__*/ (function (_super) {
  73526. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SubscriptionDelayObservable, _super);
  73527. function SubscriptionDelayObservable(source, subscriptionDelay) {
  73528. var _this = _super.call(this) || this;
  73529. _this.source = source;
  73530. _this.subscriptionDelay = subscriptionDelay;
  73531. return _this;
  73532. }
  73533. SubscriptionDelayObservable.prototype._subscribe = function (subscriber) {
  73534. this.subscriptionDelay.subscribe(new SubscriptionDelaySubscriber(subscriber, this.source));
  73535. };
  73536. return SubscriptionDelayObservable;
  73537. }(_Observable__WEBPACK_IMPORTED_MODULE_2__["Observable"]));
  73538. var SubscriptionDelaySubscriber = /*@__PURE__*/ (function (_super) {
  73539. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SubscriptionDelaySubscriber, _super);
  73540. function SubscriptionDelaySubscriber(parent, source) {
  73541. var _this = _super.call(this) || this;
  73542. _this.parent = parent;
  73543. _this.source = source;
  73544. _this.sourceSubscribed = false;
  73545. return _this;
  73546. }
  73547. SubscriptionDelaySubscriber.prototype._next = function (unused) {
  73548. this.subscribeToSource();
  73549. };
  73550. SubscriptionDelaySubscriber.prototype._error = function (err) {
  73551. this.unsubscribe();
  73552. this.parent.error(err);
  73553. };
  73554. SubscriptionDelaySubscriber.prototype._complete = function () {
  73555. this.subscribeToSource();
  73556. };
  73557. SubscriptionDelaySubscriber.prototype.subscribeToSource = function () {
  73558. if (!this.sourceSubscribed) {
  73559. this.sourceSubscribed = true;
  73560. this.unsubscribe();
  73561. this.source.subscribe(this.parent);
  73562. }
  73563. };
  73564. return SubscriptionDelaySubscriber;
  73565. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73566. //# sourceMappingURL=delayWhen.js.map
  73567. /***/ }),
  73568. /***/ "./node_modules/rxjs/_esm5/internal/operators/dematerialize.js":
  73569. /*!*********************************************************************!*\
  73570. !*** ./node_modules/rxjs/_esm5/internal/operators/dematerialize.js ***!
  73571. \*********************************************************************/
  73572. /*! exports provided: dematerialize */
  73573. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73574. "use strict";
  73575. __webpack_require__.r(__webpack_exports__);
  73576. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function() { return dematerialize; });
  73577. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73578. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73579. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  73580. function dematerialize() {
  73581. return function dematerializeOperatorFunction(source) {
  73582. return source.lift(new DeMaterializeOperator());
  73583. };
  73584. }
  73585. var DeMaterializeOperator = /*@__PURE__*/ (function () {
  73586. function DeMaterializeOperator() {
  73587. }
  73588. DeMaterializeOperator.prototype.call = function (subscriber, source) {
  73589. return source.subscribe(new DeMaterializeSubscriber(subscriber));
  73590. };
  73591. return DeMaterializeOperator;
  73592. }());
  73593. var DeMaterializeSubscriber = /*@__PURE__*/ (function (_super) {
  73594. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DeMaterializeSubscriber, _super);
  73595. function DeMaterializeSubscriber(destination) {
  73596. return _super.call(this, destination) || this;
  73597. }
  73598. DeMaterializeSubscriber.prototype._next = function (value) {
  73599. value.observe(this.destination);
  73600. };
  73601. return DeMaterializeSubscriber;
  73602. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73603. //# sourceMappingURL=dematerialize.js.map
  73604. /***/ }),
  73605. /***/ "./node_modules/rxjs/_esm5/internal/operators/distinct.js":
  73606. /*!****************************************************************!*\
  73607. !*** ./node_modules/rxjs/_esm5/internal/operators/distinct.js ***!
  73608. \****************************************************************/
  73609. /*! exports provided: distinct, DistinctSubscriber */
  73610. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73611. "use strict";
  73612. __webpack_require__.r(__webpack_exports__);
  73613. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinct", function() { return distinct; });
  73614. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "DistinctSubscriber", function() { return DistinctSubscriber; });
  73615. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73616. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  73617. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  73618. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  73619. function distinct(keySelector, flushes) {
  73620. return function (source) { return source.lift(new DistinctOperator(keySelector, flushes)); };
  73621. }
  73622. var DistinctOperator = /*@__PURE__*/ (function () {
  73623. function DistinctOperator(keySelector, flushes) {
  73624. this.keySelector = keySelector;
  73625. this.flushes = flushes;
  73626. }
  73627. DistinctOperator.prototype.call = function (subscriber, source) {
  73628. return source.subscribe(new DistinctSubscriber(subscriber, this.keySelector, this.flushes));
  73629. };
  73630. return DistinctOperator;
  73631. }());
  73632. var DistinctSubscriber = /*@__PURE__*/ (function (_super) {
  73633. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DistinctSubscriber, _super);
  73634. function DistinctSubscriber(destination, keySelector, flushes) {
  73635. var _this = _super.call(this, destination) || this;
  73636. _this.keySelector = keySelector;
  73637. _this.values = new Set();
  73638. if (flushes) {
  73639. _this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(_this, flushes));
  73640. }
  73641. return _this;
  73642. }
  73643. DistinctSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  73644. this.values.clear();
  73645. };
  73646. DistinctSubscriber.prototype.notifyError = function (error, innerSub) {
  73647. this._error(error);
  73648. };
  73649. DistinctSubscriber.prototype._next = function (value) {
  73650. if (this.keySelector) {
  73651. this._useKeySelector(value);
  73652. }
  73653. else {
  73654. this._finalizeNext(value, value);
  73655. }
  73656. };
  73657. DistinctSubscriber.prototype._useKeySelector = function (value) {
  73658. var key;
  73659. var destination = this.destination;
  73660. try {
  73661. key = this.keySelector(value);
  73662. }
  73663. catch (err) {
  73664. destination.error(err);
  73665. return;
  73666. }
  73667. this._finalizeNext(key, value);
  73668. };
  73669. DistinctSubscriber.prototype._finalizeNext = function (key, value) {
  73670. var values = this.values;
  73671. if (!values.has(key)) {
  73672. values.add(key);
  73673. this.destination.next(value);
  73674. }
  73675. };
  73676. return DistinctSubscriber;
  73677. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  73678. //# sourceMappingURL=distinct.js.map
  73679. /***/ }),
  73680. /***/ "./node_modules/rxjs/_esm5/internal/operators/distinctUntilChanged.js":
  73681. /*!****************************************************************************!*\
  73682. !*** ./node_modules/rxjs/_esm5/internal/operators/distinctUntilChanged.js ***!
  73683. \****************************************************************************/
  73684. /*! exports provided: distinctUntilChanged */
  73685. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73686. "use strict";
  73687. __webpack_require__.r(__webpack_exports__);
  73688. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function() { return distinctUntilChanged; });
  73689. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73690. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73691. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  73692. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  73693. /** PURE_IMPORTS_START tslib,_Subscriber,_util_tryCatch,_util_errorObject PURE_IMPORTS_END */
  73694. function distinctUntilChanged(compare, keySelector) {
  73695. return function (source) { return source.lift(new DistinctUntilChangedOperator(compare, keySelector)); };
  73696. }
  73697. var DistinctUntilChangedOperator = /*@__PURE__*/ (function () {
  73698. function DistinctUntilChangedOperator(compare, keySelector) {
  73699. this.compare = compare;
  73700. this.keySelector = keySelector;
  73701. }
  73702. DistinctUntilChangedOperator.prototype.call = function (subscriber, source) {
  73703. return source.subscribe(new DistinctUntilChangedSubscriber(subscriber, this.compare, this.keySelector));
  73704. };
  73705. return DistinctUntilChangedOperator;
  73706. }());
  73707. var DistinctUntilChangedSubscriber = /*@__PURE__*/ (function (_super) {
  73708. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](DistinctUntilChangedSubscriber, _super);
  73709. function DistinctUntilChangedSubscriber(destination, compare, keySelector) {
  73710. var _this = _super.call(this, destination) || this;
  73711. _this.keySelector = keySelector;
  73712. _this.hasKey = false;
  73713. if (typeof compare === 'function') {
  73714. _this.compare = compare;
  73715. }
  73716. return _this;
  73717. }
  73718. DistinctUntilChangedSubscriber.prototype.compare = function (x, y) {
  73719. return x === y;
  73720. };
  73721. DistinctUntilChangedSubscriber.prototype._next = function (value) {
  73722. var keySelector = this.keySelector;
  73723. var key = value;
  73724. if (keySelector) {
  73725. key = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(this.keySelector)(value);
  73726. if (key === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  73727. return this.destination.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"].e);
  73728. }
  73729. }
  73730. var result = false;
  73731. if (this.hasKey) {
  73732. result = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(this.compare)(this.key, key);
  73733. if (result === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  73734. return this.destination.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"].e);
  73735. }
  73736. }
  73737. else {
  73738. this.hasKey = true;
  73739. }
  73740. if (Boolean(result) === false) {
  73741. this.key = key;
  73742. this.destination.next(value);
  73743. }
  73744. };
  73745. return DistinctUntilChangedSubscriber;
  73746. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73747. //# sourceMappingURL=distinctUntilChanged.js.map
  73748. /***/ }),
  73749. /***/ "./node_modules/rxjs/_esm5/internal/operators/distinctUntilKeyChanged.js":
  73750. /*!*******************************************************************************!*\
  73751. !*** ./node_modules/rxjs/_esm5/internal/operators/distinctUntilKeyChanged.js ***!
  73752. \*******************************************************************************/
  73753. /*! exports provided: distinctUntilKeyChanged */
  73754. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73755. "use strict";
  73756. __webpack_require__.r(__webpack_exports__);
  73757. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return distinctUntilKeyChanged; });
  73758. /* harmony import */ var _distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./distinctUntilChanged */ "./node_modules/rxjs/_esm5/internal/operators/distinctUntilChanged.js");
  73759. /** PURE_IMPORTS_START _distinctUntilChanged PURE_IMPORTS_END */
  73760. function distinctUntilKeyChanged(key, compare) {
  73761. return Object(_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_0__["distinctUntilChanged"])(function (x, y) { return compare ? compare(x[key], y[key]) : x[key] === y[key]; });
  73762. }
  73763. //# sourceMappingURL=distinctUntilKeyChanged.js.map
  73764. /***/ }),
  73765. /***/ "./node_modules/rxjs/_esm5/internal/operators/elementAt.js":
  73766. /*!*****************************************************************!*\
  73767. !*** ./node_modules/rxjs/_esm5/internal/operators/elementAt.js ***!
  73768. \*****************************************************************/
  73769. /*! exports provided: elementAt */
  73770. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73771. "use strict";
  73772. __webpack_require__.r(__webpack_exports__);
  73773. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return elementAt; });
  73774. /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js");
  73775. /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter */ "./node_modules/rxjs/_esm5/internal/operators/filter.js");
  73776. /* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./throwIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js");
  73777. /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js");
  73778. /* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./take */ "./node_modules/rxjs/_esm5/internal/operators/take.js");
  73779. /** PURE_IMPORTS_START _util_ArgumentOutOfRangeError,_filter,_throwIfEmpty,_defaultIfEmpty,_take PURE_IMPORTS_END */
  73780. function elementAt(index, defaultValue) {
  73781. if (index < 0) {
  73782. throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__["ArgumentOutOfRangeError"]();
  73783. }
  73784. var hasDefaultValue = arguments.length >= 2;
  73785. return function (source) {
  73786. return source.pipe(Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(function (v, i) { return i === index; }), Object(_take__WEBPACK_IMPORTED_MODULE_4__["take"])(1), hasDefaultValue
  73787. ? Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__["defaultIfEmpty"])(defaultValue)
  73788. : Object(_throwIfEmpty__WEBPACK_IMPORTED_MODULE_2__["throwIfEmpty"])(function () { return new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_0__["ArgumentOutOfRangeError"](); }));
  73789. };
  73790. }
  73791. //# sourceMappingURL=elementAt.js.map
  73792. /***/ }),
  73793. /***/ "./node_modules/rxjs/_esm5/internal/operators/endWith.js":
  73794. /*!***************************************************************!*\
  73795. !*** ./node_modules/rxjs/_esm5/internal/operators/endWith.js ***!
  73796. \***************************************************************/
  73797. /*! exports provided: endWith */
  73798. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73799. "use strict";
  73800. __webpack_require__.r(__webpack_exports__);
  73801. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "endWith", function() { return endWith; });
  73802. /* harmony import */ var _observable_fromArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  73803. /* harmony import */ var _observable_scalar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../observable/scalar */ "./node_modules/rxjs/_esm5/internal/observable/scalar.js");
  73804. /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  73805. /* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../observable/concat */ "./node_modules/rxjs/_esm5/internal/observable/concat.js");
  73806. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  73807. /** PURE_IMPORTS_START _observable_fromArray,_observable_scalar,_observable_empty,_observable_concat,_util_isScheduler PURE_IMPORTS_END */
  73808. function endWith() {
  73809. var array = [];
  73810. for (var _i = 0; _i < arguments.length; _i++) {
  73811. array[_i] = arguments[_i];
  73812. }
  73813. return function (source) {
  73814. var scheduler = array[array.length - 1];
  73815. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(scheduler)) {
  73816. array.pop();
  73817. }
  73818. else {
  73819. scheduler = null;
  73820. }
  73821. var len = array.length;
  73822. if (len === 1 && !scheduler) {
  73823. return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(source, Object(_observable_scalar__WEBPACK_IMPORTED_MODULE_1__["scalar"])(array[0]));
  73824. }
  73825. else if (len > 0) {
  73826. return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(source, Object(_observable_fromArray__WEBPACK_IMPORTED_MODULE_0__["fromArray"])(array, scheduler));
  73827. }
  73828. else {
  73829. return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(source, Object(_observable_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(scheduler));
  73830. }
  73831. };
  73832. }
  73833. //# sourceMappingURL=endWith.js.map
  73834. /***/ }),
  73835. /***/ "./node_modules/rxjs/_esm5/internal/operators/every.js":
  73836. /*!*************************************************************!*\
  73837. !*** ./node_modules/rxjs/_esm5/internal/operators/every.js ***!
  73838. \*************************************************************/
  73839. /*! exports provided: every */
  73840. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73841. "use strict";
  73842. __webpack_require__.r(__webpack_exports__);
  73843. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "every", function() { return every; });
  73844. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73845. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  73846. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  73847. function every(predicate, thisArg) {
  73848. return function (source) { return source.lift(new EveryOperator(predicate, thisArg, source)); };
  73849. }
  73850. var EveryOperator = /*@__PURE__*/ (function () {
  73851. function EveryOperator(predicate, thisArg, source) {
  73852. this.predicate = predicate;
  73853. this.thisArg = thisArg;
  73854. this.source = source;
  73855. }
  73856. EveryOperator.prototype.call = function (observer, source) {
  73857. return source.subscribe(new EverySubscriber(observer, this.predicate, this.thisArg, this.source));
  73858. };
  73859. return EveryOperator;
  73860. }());
  73861. var EverySubscriber = /*@__PURE__*/ (function (_super) {
  73862. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](EverySubscriber, _super);
  73863. function EverySubscriber(destination, predicate, thisArg, source) {
  73864. var _this = _super.call(this, destination) || this;
  73865. _this.predicate = predicate;
  73866. _this.thisArg = thisArg;
  73867. _this.source = source;
  73868. _this.index = 0;
  73869. _this.thisArg = thisArg || _this;
  73870. return _this;
  73871. }
  73872. EverySubscriber.prototype.notifyComplete = function (everyValueMatch) {
  73873. this.destination.next(everyValueMatch);
  73874. this.destination.complete();
  73875. };
  73876. EverySubscriber.prototype._next = function (value) {
  73877. var result = false;
  73878. try {
  73879. result = this.predicate.call(this.thisArg, value, this.index++, this.source);
  73880. }
  73881. catch (err) {
  73882. this.destination.error(err);
  73883. return;
  73884. }
  73885. if (!result) {
  73886. this.notifyComplete(false);
  73887. }
  73888. };
  73889. EverySubscriber.prototype._complete = function () {
  73890. this.notifyComplete(true);
  73891. };
  73892. return EverySubscriber;
  73893. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  73894. //# sourceMappingURL=every.js.map
  73895. /***/ }),
  73896. /***/ "./node_modules/rxjs/_esm5/internal/operators/exhaust.js":
  73897. /*!***************************************************************!*\
  73898. !*** ./node_modules/rxjs/_esm5/internal/operators/exhaust.js ***!
  73899. \***************************************************************/
  73900. /*! exports provided: exhaust */
  73901. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73902. "use strict";
  73903. __webpack_require__.r(__webpack_exports__);
  73904. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exhaust", function() { return exhaust; });
  73905. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73906. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  73907. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  73908. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  73909. function exhaust() {
  73910. return function (source) { return source.lift(new SwitchFirstOperator()); };
  73911. }
  73912. var SwitchFirstOperator = /*@__PURE__*/ (function () {
  73913. function SwitchFirstOperator() {
  73914. }
  73915. SwitchFirstOperator.prototype.call = function (subscriber, source) {
  73916. return source.subscribe(new SwitchFirstSubscriber(subscriber));
  73917. };
  73918. return SwitchFirstOperator;
  73919. }());
  73920. var SwitchFirstSubscriber = /*@__PURE__*/ (function (_super) {
  73921. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SwitchFirstSubscriber, _super);
  73922. function SwitchFirstSubscriber(destination) {
  73923. var _this = _super.call(this, destination) || this;
  73924. _this.hasCompleted = false;
  73925. _this.hasSubscription = false;
  73926. return _this;
  73927. }
  73928. SwitchFirstSubscriber.prototype._next = function (value) {
  73929. if (!this.hasSubscription) {
  73930. this.hasSubscription = true;
  73931. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, value));
  73932. }
  73933. };
  73934. SwitchFirstSubscriber.prototype._complete = function () {
  73935. this.hasCompleted = true;
  73936. if (!this.hasSubscription) {
  73937. this.destination.complete();
  73938. }
  73939. };
  73940. SwitchFirstSubscriber.prototype.notifyComplete = function (innerSub) {
  73941. this.remove(innerSub);
  73942. this.hasSubscription = false;
  73943. if (this.hasCompleted) {
  73944. this.destination.complete();
  73945. }
  73946. };
  73947. return SwitchFirstSubscriber;
  73948. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  73949. //# sourceMappingURL=exhaust.js.map
  73950. /***/ }),
  73951. /***/ "./node_modules/rxjs/_esm5/internal/operators/exhaustMap.js":
  73952. /*!******************************************************************!*\
  73953. !*** ./node_modules/rxjs/_esm5/internal/operators/exhaustMap.js ***!
  73954. \******************************************************************/
  73955. /*! exports provided: exhaustMap */
  73956. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  73957. "use strict";
  73958. __webpack_require__.r(__webpack_exports__);
  73959. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function() { return exhaustMap; });
  73960. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  73961. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  73962. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  73963. /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  73964. /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../observable/from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  73965. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult,_map,_observable_from PURE_IMPORTS_END */
  73966. function exhaustMap(project, resultSelector) {
  73967. if (resultSelector) {
  73968. return function (source) { return source.pipe(exhaustMap(function (a, i) { return Object(_observable_from__WEBPACK_IMPORTED_MODULE_4__["from"])(project(a, i)).pipe(Object(_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (b, ii) { return resultSelector(a, b, i, ii); })); })); };
  73969. }
  73970. return function (source) {
  73971. return source.lift(new ExhauseMapOperator(project));
  73972. };
  73973. }
  73974. var ExhauseMapOperator = /*@__PURE__*/ (function () {
  73975. function ExhauseMapOperator(project) {
  73976. this.project = project;
  73977. }
  73978. ExhauseMapOperator.prototype.call = function (subscriber, source) {
  73979. return source.subscribe(new ExhaustMapSubscriber(subscriber, this.project));
  73980. };
  73981. return ExhauseMapOperator;
  73982. }());
  73983. var ExhaustMapSubscriber = /*@__PURE__*/ (function (_super) {
  73984. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ExhaustMapSubscriber, _super);
  73985. function ExhaustMapSubscriber(destination, project) {
  73986. var _this = _super.call(this, destination) || this;
  73987. _this.project = project;
  73988. _this.hasSubscription = false;
  73989. _this.hasCompleted = false;
  73990. _this.index = 0;
  73991. return _this;
  73992. }
  73993. ExhaustMapSubscriber.prototype._next = function (value) {
  73994. if (!this.hasSubscription) {
  73995. this.tryNext(value);
  73996. }
  73997. };
  73998. ExhaustMapSubscriber.prototype.tryNext = function (value) {
  73999. var index = this.index++;
  74000. var destination = this.destination;
  74001. try {
  74002. var result = this.project(value, index);
  74003. this.hasSubscription = true;
  74004. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, result, value, index));
  74005. }
  74006. catch (err) {
  74007. destination.error(err);
  74008. }
  74009. };
  74010. ExhaustMapSubscriber.prototype._complete = function () {
  74011. this.hasCompleted = true;
  74012. if (!this.hasSubscription) {
  74013. this.destination.complete();
  74014. }
  74015. };
  74016. ExhaustMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  74017. this.destination.next(innerValue);
  74018. };
  74019. ExhaustMapSubscriber.prototype.notifyError = function (err) {
  74020. this.destination.error(err);
  74021. };
  74022. ExhaustMapSubscriber.prototype.notifyComplete = function (innerSub) {
  74023. this.remove(innerSub);
  74024. this.hasSubscription = false;
  74025. if (this.hasCompleted) {
  74026. this.destination.complete();
  74027. }
  74028. };
  74029. return ExhaustMapSubscriber;
  74030. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  74031. //# sourceMappingURL=exhaustMap.js.map
  74032. /***/ }),
  74033. /***/ "./node_modules/rxjs/_esm5/internal/operators/expand.js":
  74034. /*!**************************************************************!*\
  74035. !*** ./node_modules/rxjs/_esm5/internal/operators/expand.js ***!
  74036. \**************************************************************/
  74037. /*! exports provided: expand, ExpandOperator, ExpandSubscriber */
  74038. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74039. "use strict";
  74040. __webpack_require__.r(__webpack_exports__);
  74041. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "expand", function() { return expand; });
  74042. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpandOperator", function() { return ExpandOperator; });
  74043. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ExpandSubscriber", function() { return ExpandSubscriber; });
  74044. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74045. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  74046. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  74047. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  74048. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  74049. /** PURE_IMPORTS_START tslib,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  74050. function expand(project, concurrent, scheduler) {
  74051. if (concurrent === void 0) {
  74052. concurrent = Number.POSITIVE_INFINITY;
  74053. }
  74054. if (scheduler === void 0) {
  74055. scheduler = undefined;
  74056. }
  74057. concurrent = (concurrent || 0) < 1 ? Number.POSITIVE_INFINITY : concurrent;
  74058. return function (source) { return source.lift(new ExpandOperator(project, concurrent, scheduler)); };
  74059. }
  74060. var ExpandOperator = /*@__PURE__*/ (function () {
  74061. function ExpandOperator(project, concurrent, scheduler) {
  74062. this.project = project;
  74063. this.concurrent = concurrent;
  74064. this.scheduler = scheduler;
  74065. }
  74066. ExpandOperator.prototype.call = function (subscriber, source) {
  74067. return source.subscribe(new ExpandSubscriber(subscriber, this.project, this.concurrent, this.scheduler));
  74068. };
  74069. return ExpandOperator;
  74070. }());
  74071. var ExpandSubscriber = /*@__PURE__*/ (function (_super) {
  74072. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ExpandSubscriber, _super);
  74073. function ExpandSubscriber(destination, project, concurrent, scheduler) {
  74074. var _this = _super.call(this, destination) || this;
  74075. _this.project = project;
  74076. _this.concurrent = concurrent;
  74077. _this.scheduler = scheduler;
  74078. _this.index = 0;
  74079. _this.active = 0;
  74080. _this.hasCompleted = false;
  74081. if (concurrent < Number.POSITIVE_INFINITY) {
  74082. _this.buffer = [];
  74083. }
  74084. return _this;
  74085. }
  74086. ExpandSubscriber.dispatch = function (arg) {
  74087. var subscriber = arg.subscriber, result = arg.result, value = arg.value, index = arg.index;
  74088. subscriber.subscribeToProjection(result, value, index);
  74089. };
  74090. ExpandSubscriber.prototype._next = function (value) {
  74091. var destination = this.destination;
  74092. if (destination.closed) {
  74093. this._complete();
  74094. return;
  74095. }
  74096. var index = this.index++;
  74097. if (this.active < this.concurrent) {
  74098. destination.next(value);
  74099. var result = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_1__["tryCatch"])(this.project)(value, index);
  74100. if (result === _util_errorObject__WEBPACK_IMPORTED_MODULE_2__["errorObject"]) {
  74101. destination.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_2__["errorObject"].e);
  74102. }
  74103. else if (!this.scheduler) {
  74104. this.subscribeToProjection(result, value, index);
  74105. }
  74106. else {
  74107. var state = { subscriber: this, result: result, value: value, index: index };
  74108. this.add(this.scheduler.schedule(ExpandSubscriber.dispatch, 0, state));
  74109. }
  74110. }
  74111. else {
  74112. this.buffer.push(value);
  74113. }
  74114. };
  74115. ExpandSubscriber.prototype.subscribeToProjection = function (result, value, index) {
  74116. this.active++;
  74117. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(this, result, value, index));
  74118. };
  74119. ExpandSubscriber.prototype._complete = function () {
  74120. this.hasCompleted = true;
  74121. if (this.hasCompleted && this.active === 0) {
  74122. this.destination.complete();
  74123. }
  74124. };
  74125. ExpandSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  74126. this._next(innerValue);
  74127. };
  74128. ExpandSubscriber.prototype.notifyComplete = function (innerSub) {
  74129. var buffer = this.buffer;
  74130. this.remove(innerSub);
  74131. this.active--;
  74132. if (buffer && buffer.length > 0) {
  74133. this._next(buffer.shift());
  74134. }
  74135. if (this.hasCompleted && this.active === 0) {
  74136. this.destination.complete();
  74137. }
  74138. };
  74139. return ExpandSubscriber;
  74140. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  74141. //# sourceMappingURL=expand.js.map
  74142. /***/ }),
  74143. /***/ "./node_modules/rxjs/_esm5/internal/operators/filter.js":
  74144. /*!**************************************************************!*\
  74145. !*** ./node_modules/rxjs/_esm5/internal/operators/filter.js ***!
  74146. \**************************************************************/
  74147. /*! exports provided: filter */
  74148. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74149. "use strict";
  74150. __webpack_require__.r(__webpack_exports__);
  74151. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return filter; });
  74152. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74153. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74154. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  74155. function filter(predicate, thisArg) {
  74156. return function filterOperatorFunction(source) {
  74157. return source.lift(new FilterOperator(predicate, thisArg));
  74158. };
  74159. }
  74160. var FilterOperator = /*@__PURE__*/ (function () {
  74161. function FilterOperator(predicate, thisArg) {
  74162. this.predicate = predicate;
  74163. this.thisArg = thisArg;
  74164. }
  74165. FilterOperator.prototype.call = function (subscriber, source) {
  74166. return source.subscribe(new FilterSubscriber(subscriber, this.predicate, this.thisArg));
  74167. };
  74168. return FilterOperator;
  74169. }());
  74170. var FilterSubscriber = /*@__PURE__*/ (function (_super) {
  74171. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](FilterSubscriber, _super);
  74172. function FilterSubscriber(destination, predicate, thisArg) {
  74173. var _this = _super.call(this, destination) || this;
  74174. _this.predicate = predicate;
  74175. _this.thisArg = thisArg;
  74176. _this.count = 0;
  74177. return _this;
  74178. }
  74179. FilterSubscriber.prototype._next = function (value) {
  74180. var result;
  74181. try {
  74182. result = this.predicate.call(this.thisArg, value, this.count++);
  74183. }
  74184. catch (err) {
  74185. this.destination.error(err);
  74186. return;
  74187. }
  74188. if (result) {
  74189. this.destination.next(value);
  74190. }
  74191. };
  74192. return FilterSubscriber;
  74193. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74194. //# sourceMappingURL=filter.js.map
  74195. /***/ }),
  74196. /***/ "./node_modules/rxjs/_esm5/internal/operators/finalize.js":
  74197. /*!****************************************************************!*\
  74198. !*** ./node_modules/rxjs/_esm5/internal/operators/finalize.js ***!
  74199. \****************************************************************/
  74200. /*! exports provided: finalize */
  74201. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74202. "use strict";
  74203. __webpack_require__.r(__webpack_exports__);
  74204. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "finalize", function() { return finalize; });
  74205. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74206. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74207. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  74208. /** PURE_IMPORTS_START tslib,_Subscriber,_Subscription PURE_IMPORTS_END */
  74209. function finalize(callback) {
  74210. return function (source) { return source.lift(new FinallyOperator(callback)); };
  74211. }
  74212. var FinallyOperator = /*@__PURE__*/ (function () {
  74213. function FinallyOperator(callback) {
  74214. this.callback = callback;
  74215. }
  74216. FinallyOperator.prototype.call = function (subscriber, source) {
  74217. return source.subscribe(new FinallySubscriber(subscriber, this.callback));
  74218. };
  74219. return FinallyOperator;
  74220. }());
  74221. var FinallySubscriber = /*@__PURE__*/ (function (_super) {
  74222. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](FinallySubscriber, _super);
  74223. function FinallySubscriber(destination, callback) {
  74224. var _this = _super.call(this, destination) || this;
  74225. _this.add(new _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"](callback));
  74226. return _this;
  74227. }
  74228. return FinallySubscriber;
  74229. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74230. //# sourceMappingURL=finalize.js.map
  74231. /***/ }),
  74232. /***/ "./node_modules/rxjs/_esm5/internal/operators/find.js":
  74233. /*!************************************************************!*\
  74234. !*** ./node_modules/rxjs/_esm5/internal/operators/find.js ***!
  74235. \************************************************************/
  74236. /*! exports provided: find, FindValueOperator, FindValueSubscriber */
  74237. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74238. "use strict";
  74239. __webpack_require__.r(__webpack_exports__);
  74240. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "find", function() { return find; });
  74241. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FindValueOperator", function() { return FindValueOperator; });
  74242. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "FindValueSubscriber", function() { return FindValueSubscriber; });
  74243. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74244. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74245. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  74246. function find(predicate, thisArg) {
  74247. if (typeof predicate !== 'function') {
  74248. throw new TypeError('predicate is not a function');
  74249. }
  74250. return function (source) { return source.lift(new FindValueOperator(predicate, source, false, thisArg)); };
  74251. }
  74252. var FindValueOperator = /*@__PURE__*/ (function () {
  74253. function FindValueOperator(predicate, source, yieldIndex, thisArg) {
  74254. this.predicate = predicate;
  74255. this.source = source;
  74256. this.yieldIndex = yieldIndex;
  74257. this.thisArg = thisArg;
  74258. }
  74259. FindValueOperator.prototype.call = function (observer, source) {
  74260. return source.subscribe(new FindValueSubscriber(observer, this.predicate, this.source, this.yieldIndex, this.thisArg));
  74261. };
  74262. return FindValueOperator;
  74263. }());
  74264. var FindValueSubscriber = /*@__PURE__*/ (function (_super) {
  74265. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](FindValueSubscriber, _super);
  74266. function FindValueSubscriber(destination, predicate, source, yieldIndex, thisArg) {
  74267. var _this = _super.call(this, destination) || this;
  74268. _this.predicate = predicate;
  74269. _this.source = source;
  74270. _this.yieldIndex = yieldIndex;
  74271. _this.thisArg = thisArg;
  74272. _this.index = 0;
  74273. return _this;
  74274. }
  74275. FindValueSubscriber.prototype.notifyComplete = function (value) {
  74276. var destination = this.destination;
  74277. destination.next(value);
  74278. destination.complete();
  74279. };
  74280. FindValueSubscriber.prototype._next = function (value) {
  74281. var _a = this, predicate = _a.predicate, thisArg = _a.thisArg;
  74282. var index = this.index++;
  74283. try {
  74284. var result = predicate.call(thisArg || this, value, index, this.source);
  74285. if (result) {
  74286. this.notifyComplete(this.yieldIndex ? index : value);
  74287. }
  74288. }
  74289. catch (err) {
  74290. this.destination.error(err);
  74291. }
  74292. };
  74293. FindValueSubscriber.prototype._complete = function () {
  74294. this.notifyComplete(this.yieldIndex ? -1 : undefined);
  74295. };
  74296. return FindValueSubscriber;
  74297. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74298. //# sourceMappingURL=find.js.map
  74299. /***/ }),
  74300. /***/ "./node_modules/rxjs/_esm5/internal/operators/findIndex.js":
  74301. /*!*****************************************************************!*\
  74302. !*** ./node_modules/rxjs/_esm5/internal/operators/findIndex.js ***!
  74303. \*****************************************************************/
  74304. /*! exports provided: findIndex */
  74305. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74306. "use strict";
  74307. __webpack_require__.r(__webpack_exports__);
  74308. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return findIndex; });
  74309. /* harmony import */ var _operators_find__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../operators/find */ "./node_modules/rxjs/_esm5/internal/operators/find.js");
  74310. /** PURE_IMPORTS_START _operators_find PURE_IMPORTS_END */
  74311. function findIndex(predicate, thisArg) {
  74312. return function (source) { return source.lift(new _operators_find__WEBPACK_IMPORTED_MODULE_0__["FindValueOperator"](predicate, source, true, thisArg)); };
  74313. }
  74314. //# sourceMappingURL=findIndex.js.map
  74315. /***/ }),
  74316. /***/ "./node_modules/rxjs/_esm5/internal/operators/first.js":
  74317. /*!*************************************************************!*\
  74318. !*** ./node_modules/rxjs/_esm5/internal/operators/first.js ***!
  74319. \*************************************************************/
  74320. /*! exports provided: first */
  74321. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74322. "use strict";
  74323. __webpack_require__.r(__webpack_exports__);
  74324. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "first", function() { return first; });
  74325. /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/EmptyError */ "./node_modules/rxjs/_esm5/internal/util/EmptyError.js");
  74326. /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter */ "./node_modules/rxjs/_esm5/internal/operators/filter.js");
  74327. /* harmony import */ var _take__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./take */ "./node_modules/rxjs/_esm5/internal/operators/take.js");
  74328. /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js");
  74329. /* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./throwIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js");
  74330. /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js");
  74331. /** PURE_IMPORTS_START _util_EmptyError,_filter,_take,_defaultIfEmpty,_throwIfEmpty,_util_identity PURE_IMPORTS_END */
  74332. function first(predicate, defaultValue) {
  74333. var hasDefaultValue = arguments.length >= 2;
  74334. return function (source) { return source.pipe(predicate ? Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(function (v, i) { return predicate(v, i, source); }) : _util_identity__WEBPACK_IMPORTED_MODULE_5__["identity"], Object(_take__WEBPACK_IMPORTED_MODULE_2__["take"])(1), hasDefaultValue ? Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_3__["defaultIfEmpty"])(defaultValue) : Object(_throwIfEmpty__WEBPACK_IMPORTED_MODULE_4__["throwIfEmpty"])(function () { return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__["EmptyError"](); })); };
  74335. }
  74336. //# sourceMappingURL=first.js.map
  74337. /***/ }),
  74338. /***/ "./node_modules/rxjs/_esm5/internal/operators/groupBy.js":
  74339. /*!***************************************************************!*\
  74340. !*** ./node_modules/rxjs/_esm5/internal/operators/groupBy.js ***!
  74341. \***************************************************************/
  74342. /*! exports provided: groupBy, GroupedObservable */
  74343. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74344. "use strict";
  74345. __webpack_require__.r(__webpack_exports__);
  74346. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return groupBy; });
  74347. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "GroupedObservable", function() { return GroupedObservable; });
  74348. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74349. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74350. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  74351. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  74352. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  74353. /** PURE_IMPORTS_START tslib,_Subscriber,_Subscription,_Observable,_Subject PURE_IMPORTS_END */
  74354. function groupBy(keySelector, elementSelector, durationSelector, subjectSelector) {
  74355. return function (source) {
  74356. return source.lift(new GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector));
  74357. };
  74358. }
  74359. var GroupByOperator = /*@__PURE__*/ (function () {
  74360. function GroupByOperator(keySelector, elementSelector, durationSelector, subjectSelector) {
  74361. this.keySelector = keySelector;
  74362. this.elementSelector = elementSelector;
  74363. this.durationSelector = durationSelector;
  74364. this.subjectSelector = subjectSelector;
  74365. }
  74366. GroupByOperator.prototype.call = function (subscriber, source) {
  74367. return source.subscribe(new GroupBySubscriber(subscriber, this.keySelector, this.elementSelector, this.durationSelector, this.subjectSelector));
  74368. };
  74369. return GroupByOperator;
  74370. }());
  74371. var GroupBySubscriber = /*@__PURE__*/ (function (_super) {
  74372. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](GroupBySubscriber, _super);
  74373. function GroupBySubscriber(destination, keySelector, elementSelector, durationSelector, subjectSelector) {
  74374. var _this = _super.call(this, destination) || this;
  74375. _this.keySelector = keySelector;
  74376. _this.elementSelector = elementSelector;
  74377. _this.durationSelector = durationSelector;
  74378. _this.subjectSelector = subjectSelector;
  74379. _this.groups = null;
  74380. _this.attemptedToUnsubscribe = false;
  74381. _this.count = 0;
  74382. return _this;
  74383. }
  74384. GroupBySubscriber.prototype._next = function (value) {
  74385. var key;
  74386. try {
  74387. key = this.keySelector(value);
  74388. }
  74389. catch (err) {
  74390. this.error(err);
  74391. return;
  74392. }
  74393. this._group(value, key);
  74394. };
  74395. GroupBySubscriber.prototype._group = function (value, key) {
  74396. var groups = this.groups;
  74397. if (!groups) {
  74398. groups = this.groups = new Map();
  74399. }
  74400. var group = groups.get(key);
  74401. var element;
  74402. if (this.elementSelector) {
  74403. try {
  74404. element = this.elementSelector(value);
  74405. }
  74406. catch (err) {
  74407. this.error(err);
  74408. }
  74409. }
  74410. else {
  74411. element = value;
  74412. }
  74413. if (!group) {
  74414. group = (this.subjectSelector ? this.subjectSelector() : new _Subject__WEBPACK_IMPORTED_MODULE_4__["Subject"]());
  74415. groups.set(key, group);
  74416. var groupedObservable = new GroupedObservable(key, group, this);
  74417. this.destination.next(groupedObservable);
  74418. if (this.durationSelector) {
  74419. var duration = void 0;
  74420. try {
  74421. duration = this.durationSelector(new GroupedObservable(key, group));
  74422. }
  74423. catch (err) {
  74424. this.error(err);
  74425. return;
  74426. }
  74427. this.add(duration.subscribe(new GroupDurationSubscriber(key, group, this)));
  74428. }
  74429. }
  74430. if (!group.closed) {
  74431. group.next(element);
  74432. }
  74433. };
  74434. GroupBySubscriber.prototype._error = function (err) {
  74435. var groups = this.groups;
  74436. if (groups) {
  74437. groups.forEach(function (group, key) {
  74438. group.error(err);
  74439. });
  74440. groups.clear();
  74441. }
  74442. this.destination.error(err);
  74443. };
  74444. GroupBySubscriber.prototype._complete = function () {
  74445. var groups = this.groups;
  74446. if (groups) {
  74447. groups.forEach(function (group, key) {
  74448. group.complete();
  74449. });
  74450. groups.clear();
  74451. }
  74452. this.destination.complete();
  74453. };
  74454. GroupBySubscriber.prototype.removeGroup = function (key) {
  74455. this.groups.delete(key);
  74456. };
  74457. GroupBySubscriber.prototype.unsubscribe = function () {
  74458. if (!this.closed) {
  74459. this.attemptedToUnsubscribe = true;
  74460. if (this.count === 0) {
  74461. _super.prototype.unsubscribe.call(this);
  74462. }
  74463. }
  74464. };
  74465. return GroupBySubscriber;
  74466. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74467. var GroupDurationSubscriber = /*@__PURE__*/ (function (_super) {
  74468. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](GroupDurationSubscriber, _super);
  74469. function GroupDurationSubscriber(key, group, parent) {
  74470. var _this = _super.call(this, group) || this;
  74471. _this.key = key;
  74472. _this.group = group;
  74473. _this.parent = parent;
  74474. return _this;
  74475. }
  74476. GroupDurationSubscriber.prototype._next = function (value) {
  74477. this.complete();
  74478. };
  74479. GroupDurationSubscriber.prototype._unsubscribe = function () {
  74480. var _a = this, parent = _a.parent, key = _a.key;
  74481. this.key = this.parent = null;
  74482. if (parent) {
  74483. parent.removeGroup(key);
  74484. }
  74485. };
  74486. return GroupDurationSubscriber;
  74487. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74488. var GroupedObservable = /*@__PURE__*/ (function (_super) {
  74489. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](GroupedObservable, _super);
  74490. function GroupedObservable(key, groupSubject, refCountSubscription) {
  74491. var _this = _super.call(this) || this;
  74492. _this.key = key;
  74493. _this.groupSubject = groupSubject;
  74494. _this.refCountSubscription = refCountSubscription;
  74495. return _this;
  74496. }
  74497. GroupedObservable.prototype._subscribe = function (subscriber) {
  74498. var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"]();
  74499. var _a = this, refCountSubscription = _a.refCountSubscription, groupSubject = _a.groupSubject;
  74500. if (refCountSubscription && !refCountSubscription.closed) {
  74501. subscription.add(new InnerRefCountSubscription(refCountSubscription));
  74502. }
  74503. subscription.add(groupSubject.subscribe(subscriber));
  74504. return subscription;
  74505. };
  74506. return GroupedObservable;
  74507. }(_Observable__WEBPACK_IMPORTED_MODULE_3__["Observable"]));
  74508. var InnerRefCountSubscription = /*@__PURE__*/ (function (_super) {
  74509. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](InnerRefCountSubscription, _super);
  74510. function InnerRefCountSubscription(parent) {
  74511. var _this = _super.call(this) || this;
  74512. _this.parent = parent;
  74513. parent.count++;
  74514. return _this;
  74515. }
  74516. InnerRefCountSubscription.prototype.unsubscribe = function () {
  74517. var parent = this.parent;
  74518. if (!parent.closed && !this.closed) {
  74519. _super.prototype.unsubscribe.call(this);
  74520. parent.count -= 1;
  74521. if (parent.count === 0 && parent.attemptedToUnsubscribe) {
  74522. parent.unsubscribe();
  74523. }
  74524. }
  74525. };
  74526. return InnerRefCountSubscription;
  74527. }(_Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"]));
  74528. //# sourceMappingURL=groupBy.js.map
  74529. /***/ }),
  74530. /***/ "./node_modules/rxjs/_esm5/internal/operators/ignoreElements.js":
  74531. /*!**********************************************************************!*\
  74532. !*** ./node_modules/rxjs/_esm5/internal/operators/ignoreElements.js ***!
  74533. \**********************************************************************/
  74534. /*! exports provided: ignoreElements */
  74535. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74536. "use strict";
  74537. __webpack_require__.r(__webpack_exports__);
  74538. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function() { return ignoreElements; });
  74539. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74540. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74541. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  74542. function ignoreElements() {
  74543. return function ignoreElementsOperatorFunction(source) {
  74544. return source.lift(new IgnoreElementsOperator());
  74545. };
  74546. }
  74547. var IgnoreElementsOperator = /*@__PURE__*/ (function () {
  74548. function IgnoreElementsOperator() {
  74549. }
  74550. IgnoreElementsOperator.prototype.call = function (subscriber, source) {
  74551. return source.subscribe(new IgnoreElementsSubscriber(subscriber));
  74552. };
  74553. return IgnoreElementsOperator;
  74554. }());
  74555. var IgnoreElementsSubscriber = /*@__PURE__*/ (function (_super) {
  74556. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](IgnoreElementsSubscriber, _super);
  74557. function IgnoreElementsSubscriber() {
  74558. return _super !== null && _super.apply(this, arguments) || this;
  74559. }
  74560. IgnoreElementsSubscriber.prototype._next = function (unused) {
  74561. };
  74562. return IgnoreElementsSubscriber;
  74563. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74564. //# sourceMappingURL=ignoreElements.js.map
  74565. /***/ }),
  74566. /***/ "./node_modules/rxjs/_esm5/internal/operators/isEmpty.js":
  74567. /*!***************************************************************!*\
  74568. !*** ./node_modules/rxjs/_esm5/internal/operators/isEmpty.js ***!
  74569. \***************************************************************/
  74570. /*! exports provided: isEmpty */
  74571. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74572. "use strict";
  74573. __webpack_require__.r(__webpack_exports__);
  74574. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return isEmpty; });
  74575. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74576. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74577. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  74578. function isEmpty() {
  74579. return function (source) { return source.lift(new IsEmptyOperator()); };
  74580. }
  74581. var IsEmptyOperator = /*@__PURE__*/ (function () {
  74582. function IsEmptyOperator() {
  74583. }
  74584. IsEmptyOperator.prototype.call = function (observer, source) {
  74585. return source.subscribe(new IsEmptySubscriber(observer));
  74586. };
  74587. return IsEmptyOperator;
  74588. }());
  74589. var IsEmptySubscriber = /*@__PURE__*/ (function (_super) {
  74590. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](IsEmptySubscriber, _super);
  74591. function IsEmptySubscriber(destination) {
  74592. return _super.call(this, destination) || this;
  74593. }
  74594. IsEmptySubscriber.prototype.notifyComplete = function (isEmpty) {
  74595. var destination = this.destination;
  74596. destination.next(isEmpty);
  74597. destination.complete();
  74598. };
  74599. IsEmptySubscriber.prototype._next = function (value) {
  74600. this.notifyComplete(false);
  74601. };
  74602. IsEmptySubscriber.prototype._complete = function () {
  74603. this.notifyComplete(true);
  74604. };
  74605. return IsEmptySubscriber;
  74606. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74607. //# sourceMappingURL=isEmpty.js.map
  74608. /***/ }),
  74609. /***/ "./node_modules/rxjs/_esm5/internal/operators/last.js":
  74610. /*!************************************************************!*\
  74611. !*** ./node_modules/rxjs/_esm5/internal/operators/last.js ***!
  74612. \************************************************************/
  74613. /*! exports provided: last */
  74614. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74615. "use strict";
  74616. __webpack_require__.r(__webpack_exports__);
  74617. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "last", function() { return last; });
  74618. /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/EmptyError */ "./node_modules/rxjs/_esm5/internal/util/EmptyError.js");
  74619. /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter */ "./node_modules/rxjs/_esm5/internal/operators/filter.js");
  74620. /* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./takeLast */ "./node_modules/rxjs/_esm5/internal/operators/takeLast.js");
  74621. /* harmony import */ var _throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./throwIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js");
  74622. /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js");
  74623. /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js");
  74624. /** PURE_IMPORTS_START _util_EmptyError,_filter,_takeLast,_throwIfEmpty,_defaultIfEmpty,_util_identity PURE_IMPORTS_END */
  74625. function last(predicate, defaultValue) {
  74626. var hasDefaultValue = arguments.length >= 2;
  74627. return function (source) { return source.pipe(predicate ? Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(function (v, i) { return predicate(v, i, source); }) : _util_identity__WEBPACK_IMPORTED_MODULE_5__["identity"], Object(_takeLast__WEBPACK_IMPORTED_MODULE_2__["takeLast"])(1), hasDefaultValue ? Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_4__["defaultIfEmpty"])(defaultValue) : Object(_throwIfEmpty__WEBPACK_IMPORTED_MODULE_3__["throwIfEmpty"])(function () { return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_0__["EmptyError"](); })); };
  74628. }
  74629. //# sourceMappingURL=last.js.map
  74630. /***/ }),
  74631. /***/ "./node_modules/rxjs/_esm5/internal/operators/map.js":
  74632. /*!***********************************************************!*\
  74633. !*** ./node_modules/rxjs/_esm5/internal/operators/map.js ***!
  74634. \***********************************************************/
  74635. /*! exports provided: map, MapOperator */
  74636. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74637. "use strict";
  74638. __webpack_require__.r(__webpack_exports__);
  74639. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "map", function() { return map; });
  74640. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MapOperator", function() { return MapOperator; });
  74641. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74642. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74643. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  74644. function map(project, thisArg) {
  74645. return function mapOperation(source) {
  74646. if (typeof project !== 'function') {
  74647. throw new TypeError('argument is not a function. Are you looking for `mapTo()`?');
  74648. }
  74649. return source.lift(new MapOperator(project, thisArg));
  74650. };
  74651. }
  74652. var MapOperator = /*@__PURE__*/ (function () {
  74653. function MapOperator(project, thisArg) {
  74654. this.project = project;
  74655. this.thisArg = thisArg;
  74656. }
  74657. MapOperator.prototype.call = function (subscriber, source) {
  74658. return source.subscribe(new MapSubscriber(subscriber, this.project, this.thisArg));
  74659. };
  74660. return MapOperator;
  74661. }());
  74662. var MapSubscriber = /*@__PURE__*/ (function (_super) {
  74663. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MapSubscriber, _super);
  74664. function MapSubscriber(destination, project, thisArg) {
  74665. var _this = _super.call(this, destination) || this;
  74666. _this.project = project;
  74667. _this.count = 0;
  74668. _this.thisArg = thisArg || _this;
  74669. return _this;
  74670. }
  74671. MapSubscriber.prototype._next = function (value) {
  74672. var result;
  74673. try {
  74674. result = this.project.call(this.thisArg, value, this.count++);
  74675. }
  74676. catch (err) {
  74677. this.destination.error(err);
  74678. return;
  74679. }
  74680. this.destination.next(result);
  74681. };
  74682. return MapSubscriber;
  74683. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74684. //# sourceMappingURL=map.js.map
  74685. /***/ }),
  74686. /***/ "./node_modules/rxjs/_esm5/internal/operators/mapTo.js":
  74687. /*!*************************************************************!*\
  74688. !*** ./node_modules/rxjs/_esm5/internal/operators/mapTo.js ***!
  74689. \*************************************************************/
  74690. /*! exports provided: mapTo */
  74691. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74692. "use strict";
  74693. __webpack_require__.r(__webpack_exports__);
  74694. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mapTo", function() { return mapTo; });
  74695. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74696. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74697. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  74698. function mapTo(value) {
  74699. return function (source) { return source.lift(new MapToOperator(value)); };
  74700. }
  74701. var MapToOperator = /*@__PURE__*/ (function () {
  74702. function MapToOperator(value) {
  74703. this.value = value;
  74704. }
  74705. MapToOperator.prototype.call = function (subscriber, source) {
  74706. return source.subscribe(new MapToSubscriber(subscriber, this.value));
  74707. };
  74708. return MapToOperator;
  74709. }());
  74710. var MapToSubscriber = /*@__PURE__*/ (function (_super) {
  74711. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MapToSubscriber, _super);
  74712. function MapToSubscriber(destination, value) {
  74713. var _this = _super.call(this, destination) || this;
  74714. _this.value = value;
  74715. return _this;
  74716. }
  74717. MapToSubscriber.prototype._next = function (x) {
  74718. this.destination.next(this.value);
  74719. };
  74720. return MapToSubscriber;
  74721. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74722. //# sourceMappingURL=mapTo.js.map
  74723. /***/ }),
  74724. /***/ "./node_modules/rxjs/_esm5/internal/operators/materialize.js":
  74725. /*!*******************************************************************!*\
  74726. !*** ./node_modules/rxjs/_esm5/internal/operators/materialize.js ***!
  74727. \*******************************************************************/
  74728. /*! exports provided: materialize */
  74729. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74730. "use strict";
  74731. __webpack_require__.r(__webpack_exports__);
  74732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "materialize", function() { return materialize; });
  74733. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74734. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  74735. /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Notification */ "./node_modules/rxjs/_esm5/internal/Notification.js");
  74736. /** PURE_IMPORTS_START tslib,_Subscriber,_Notification PURE_IMPORTS_END */
  74737. function materialize() {
  74738. return function materializeOperatorFunction(source) {
  74739. return source.lift(new MaterializeOperator());
  74740. };
  74741. }
  74742. var MaterializeOperator = /*@__PURE__*/ (function () {
  74743. function MaterializeOperator() {
  74744. }
  74745. MaterializeOperator.prototype.call = function (subscriber, source) {
  74746. return source.subscribe(new MaterializeSubscriber(subscriber));
  74747. };
  74748. return MaterializeOperator;
  74749. }());
  74750. var MaterializeSubscriber = /*@__PURE__*/ (function (_super) {
  74751. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MaterializeSubscriber, _super);
  74752. function MaterializeSubscriber(destination) {
  74753. return _super.call(this, destination) || this;
  74754. }
  74755. MaterializeSubscriber.prototype._next = function (value) {
  74756. this.destination.next(_Notification__WEBPACK_IMPORTED_MODULE_2__["Notification"].createNext(value));
  74757. };
  74758. MaterializeSubscriber.prototype._error = function (err) {
  74759. var destination = this.destination;
  74760. destination.next(_Notification__WEBPACK_IMPORTED_MODULE_2__["Notification"].createError(err));
  74761. destination.complete();
  74762. };
  74763. MaterializeSubscriber.prototype._complete = function () {
  74764. var destination = this.destination;
  74765. destination.next(_Notification__WEBPACK_IMPORTED_MODULE_2__["Notification"].createComplete());
  74766. destination.complete();
  74767. };
  74768. return MaterializeSubscriber;
  74769. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  74770. //# sourceMappingURL=materialize.js.map
  74771. /***/ }),
  74772. /***/ "./node_modules/rxjs/_esm5/internal/operators/max.js":
  74773. /*!***********************************************************!*\
  74774. !*** ./node_modules/rxjs/_esm5/internal/operators/max.js ***!
  74775. \***********************************************************/
  74776. /*! exports provided: max */
  74777. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74778. "use strict";
  74779. __webpack_require__.r(__webpack_exports__);
  74780. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "max", function() { return max; });
  74781. /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reduce */ "./node_modules/rxjs/_esm5/internal/operators/reduce.js");
  74782. /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */
  74783. function max(comparer) {
  74784. var max = (typeof comparer === 'function')
  74785. ? function (x, y) { return comparer(x, y) > 0 ? x : y; }
  74786. : function (x, y) { return x > y ? x : y; };
  74787. return Object(_reduce__WEBPACK_IMPORTED_MODULE_0__["reduce"])(max);
  74788. }
  74789. //# sourceMappingURL=max.js.map
  74790. /***/ }),
  74791. /***/ "./node_modules/rxjs/_esm5/internal/operators/merge.js":
  74792. /*!*************************************************************!*\
  74793. !*** ./node_modules/rxjs/_esm5/internal/operators/merge.js ***!
  74794. \*************************************************************/
  74795. /*! exports provided: merge */
  74796. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74797. "use strict";
  74798. __webpack_require__.r(__webpack_exports__);
  74799. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return merge; });
  74800. /* harmony import */ var _observable_merge__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/merge */ "./node_modules/rxjs/_esm5/internal/observable/merge.js");
  74801. /** PURE_IMPORTS_START _observable_merge PURE_IMPORTS_END */
  74802. function merge() {
  74803. var observables = [];
  74804. for (var _i = 0; _i < arguments.length; _i++) {
  74805. observables[_i] = arguments[_i];
  74806. }
  74807. return function (source) { return source.lift.call(_observable_merge__WEBPACK_IMPORTED_MODULE_0__["merge"].apply(void 0, [source].concat(observables))); };
  74808. }
  74809. //# sourceMappingURL=merge.js.map
  74810. /***/ }),
  74811. /***/ "./node_modules/rxjs/_esm5/internal/operators/mergeAll.js":
  74812. /*!****************************************************************!*\
  74813. !*** ./node_modules/rxjs/_esm5/internal/operators/mergeAll.js ***!
  74814. \****************************************************************/
  74815. /*! exports provided: mergeAll */
  74816. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74817. "use strict";
  74818. __webpack_require__.r(__webpack_exports__);
  74819. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeAll", function() { return mergeAll; });
  74820. /* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mergeMap */ "./node_modules/rxjs/_esm5/internal/operators/mergeMap.js");
  74821. /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js");
  74822. /** PURE_IMPORTS_START _mergeMap,_util_identity PURE_IMPORTS_END */
  74823. function mergeAll(concurrent) {
  74824. if (concurrent === void 0) {
  74825. concurrent = Number.POSITIVE_INFINITY;
  74826. }
  74827. return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(_util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"], concurrent);
  74828. }
  74829. //# sourceMappingURL=mergeAll.js.map
  74830. /***/ }),
  74831. /***/ "./node_modules/rxjs/_esm5/internal/operators/mergeMap.js":
  74832. /*!****************************************************************!*\
  74833. !*** ./node_modules/rxjs/_esm5/internal/operators/mergeMap.js ***!
  74834. \****************************************************************/
  74835. /*! exports provided: mergeMap, MergeMapOperator, MergeMapSubscriber */
  74836. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74837. "use strict";
  74838. __webpack_require__.r(__webpack_exports__);
  74839. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeMap", function() { return mergeMap; });
  74840. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeMapOperator", function() { return MergeMapOperator; });
  74841. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeMapSubscriber", function() { return MergeMapSubscriber; });
  74842. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74843. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  74844. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  74845. /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  74846. /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../observable/from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  74847. /** PURE_IMPORTS_START tslib,_util_subscribeToResult,_OuterSubscriber,_map,_observable_from PURE_IMPORTS_END */
  74848. function mergeMap(project, resultSelector, concurrent) {
  74849. if (concurrent === void 0) {
  74850. concurrent = Number.POSITIVE_INFINITY;
  74851. }
  74852. if (typeof resultSelector === 'function') {
  74853. return function (source) { return source.pipe(mergeMap(function (a, i) { return Object(_observable_from__WEBPACK_IMPORTED_MODULE_4__["from"])(project(a, i)).pipe(Object(_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (b, ii) { return resultSelector(a, b, i, ii); })); }, concurrent)); };
  74854. }
  74855. else if (typeof resultSelector === 'number') {
  74856. concurrent = resultSelector;
  74857. }
  74858. return function (source) { return source.lift(new MergeMapOperator(project, concurrent)); };
  74859. }
  74860. var MergeMapOperator = /*@__PURE__*/ (function () {
  74861. function MergeMapOperator(project, concurrent) {
  74862. if (concurrent === void 0) {
  74863. concurrent = Number.POSITIVE_INFINITY;
  74864. }
  74865. this.project = project;
  74866. this.concurrent = concurrent;
  74867. }
  74868. MergeMapOperator.prototype.call = function (observer, source) {
  74869. return source.subscribe(new MergeMapSubscriber(observer, this.project, this.concurrent));
  74870. };
  74871. return MergeMapOperator;
  74872. }());
  74873. var MergeMapSubscriber = /*@__PURE__*/ (function (_super) {
  74874. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MergeMapSubscriber, _super);
  74875. function MergeMapSubscriber(destination, project, concurrent) {
  74876. if (concurrent === void 0) {
  74877. concurrent = Number.POSITIVE_INFINITY;
  74878. }
  74879. var _this = _super.call(this, destination) || this;
  74880. _this.project = project;
  74881. _this.concurrent = concurrent;
  74882. _this.hasCompleted = false;
  74883. _this.buffer = [];
  74884. _this.active = 0;
  74885. _this.index = 0;
  74886. return _this;
  74887. }
  74888. MergeMapSubscriber.prototype._next = function (value) {
  74889. if (this.active < this.concurrent) {
  74890. this._tryNext(value);
  74891. }
  74892. else {
  74893. this.buffer.push(value);
  74894. }
  74895. };
  74896. MergeMapSubscriber.prototype._tryNext = function (value) {
  74897. var result;
  74898. var index = this.index++;
  74899. try {
  74900. result = this.project(value, index);
  74901. }
  74902. catch (err) {
  74903. this.destination.error(err);
  74904. return;
  74905. }
  74906. this.active++;
  74907. this._innerSub(result, value, index);
  74908. };
  74909. MergeMapSubscriber.prototype._innerSub = function (ish, value, index) {
  74910. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_1__["subscribeToResult"])(this, ish, value, index));
  74911. };
  74912. MergeMapSubscriber.prototype._complete = function () {
  74913. this.hasCompleted = true;
  74914. if (this.active === 0 && this.buffer.length === 0) {
  74915. this.destination.complete();
  74916. }
  74917. };
  74918. MergeMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  74919. this.destination.next(innerValue);
  74920. };
  74921. MergeMapSubscriber.prototype.notifyComplete = function (innerSub) {
  74922. var buffer = this.buffer;
  74923. this.remove(innerSub);
  74924. this.active--;
  74925. if (buffer.length > 0) {
  74926. this._next(buffer.shift());
  74927. }
  74928. else if (this.active === 0 && this.hasCompleted) {
  74929. this.destination.complete();
  74930. }
  74931. };
  74932. return MergeMapSubscriber;
  74933. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]));
  74934. //# sourceMappingURL=mergeMap.js.map
  74935. /***/ }),
  74936. /***/ "./node_modules/rxjs/_esm5/internal/operators/mergeMapTo.js":
  74937. /*!******************************************************************!*\
  74938. !*** ./node_modules/rxjs/_esm5/internal/operators/mergeMapTo.js ***!
  74939. \******************************************************************/
  74940. /*! exports provided: mergeMapTo */
  74941. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74942. "use strict";
  74943. __webpack_require__.r(__webpack_exports__);
  74944. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function() { return mergeMapTo; });
  74945. /* harmony import */ var _mergeMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./mergeMap */ "./node_modules/rxjs/_esm5/internal/operators/mergeMap.js");
  74946. /** PURE_IMPORTS_START _mergeMap PURE_IMPORTS_END */
  74947. function mergeMapTo(innerObservable, resultSelector, concurrent) {
  74948. if (concurrent === void 0) {
  74949. concurrent = Number.POSITIVE_INFINITY;
  74950. }
  74951. if (typeof resultSelector === 'function') {
  74952. return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(function () { return innerObservable; }, resultSelector, concurrent);
  74953. }
  74954. if (typeof resultSelector === 'number') {
  74955. concurrent = resultSelector;
  74956. }
  74957. return Object(_mergeMap__WEBPACK_IMPORTED_MODULE_0__["mergeMap"])(function () { return innerObservable; }, concurrent);
  74958. }
  74959. //# sourceMappingURL=mergeMapTo.js.map
  74960. /***/ }),
  74961. /***/ "./node_modules/rxjs/_esm5/internal/operators/mergeScan.js":
  74962. /*!*****************************************************************!*\
  74963. !*** ./node_modules/rxjs/_esm5/internal/operators/mergeScan.js ***!
  74964. \*****************************************************************/
  74965. /*! exports provided: mergeScan, MergeScanOperator, MergeScanSubscriber */
  74966. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  74967. "use strict";
  74968. __webpack_require__.r(__webpack_exports__);
  74969. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function() { return mergeScan; });
  74970. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeScanOperator", function() { return MergeScanOperator; });
  74971. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MergeScanSubscriber", function() { return MergeScanSubscriber; });
  74972. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  74973. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  74974. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  74975. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  74976. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  74977. /** PURE_IMPORTS_START tslib,_util_tryCatch,_util_errorObject,_util_subscribeToResult,_OuterSubscriber PURE_IMPORTS_END */
  74978. function mergeScan(accumulator, seed, concurrent) {
  74979. if (concurrent === void 0) {
  74980. concurrent = Number.POSITIVE_INFINITY;
  74981. }
  74982. return function (source) { return source.lift(new MergeScanOperator(accumulator, seed, concurrent)); };
  74983. }
  74984. var MergeScanOperator = /*@__PURE__*/ (function () {
  74985. function MergeScanOperator(accumulator, seed, concurrent) {
  74986. this.accumulator = accumulator;
  74987. this.seed = seed;
  74988. this.concurrent = concurrent;
  74989. }
  74990. MergeScanOperator.prototype.call = function (subscriber, source) {
  74991. return source.subscribe(new MergeScanSubscriber(subscriber, this.accumulator, this.seed, this.concurrent));
  74992. };
  74993. return MergeScanOperator;
  74994. }());
  74995. var MergeScanSubscriber = /*@__PURE__*/ (function (_super) {
  74996. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](MergeScanSubscriber, _super);
  74997. function MergeScanSubscriber(destination, accumulator, acc, concurrent) {
  74998. var _this = _super.call(this, destination) || this;
  74999. _this.accumulator = accumulator;
  75000. _this.acc = acc;
  75001. _this.concurrent = concurrent;
  75002. _this.hasValue = false;
  75003. _this.hasCompleted = false;
  75004. _this.buffer = [];
  75005. _this.active = 0;
  75006. _this.index = 0;
  75007. return _this;
  75008. }
  75009. MergeScanSubscriber.prototype._next = function (value) {
  75010. if (this.active < this.concurrent) {
  75011. var index = this.index++;
  75012. var ish = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_1__["tryCatch"])(this.accumulator)(this.acc, value);
  75013. var destination = this.destination;
  75014. if (ish === _util_errorObject__WEBPACK_IMPORTED_MODULE_2__["errorObject"]) {
  75015. destination.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_2__["errorObject"].e);
  75016. }
  75017. else {
  75018. this.active++;
  75019. this._innerSub(ish, value, index);
  75020. }
  75021. }
  75022. else {
  75023. this.buffer.push(value);
  75024. }
  75025. };
  75026. MergeScanSubscriber.prototype._innerSub = function (ish, value, index) {
  75027. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(this, ish, value, index));
  75028. };
  75029. MergeScanSubscriber.prototype._complete = function () {
  75030. this.hasCompleted = true;
  75031. if (this.active === 0 && this.buffer.length === 0) {
  75032. if (this.hasValue === false) {
  75033. this.destination.next(this.acc);
  75034. }
  75035. this.destination.complete();
  75036. }
  75037. };
  75038. MergeScanSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  75039. var destination = this.destination;
  75040. this.acc = innerValue;
  75041. this.hasValue = true;
  75042. destination.next(innerValue);
  75043. };
  75044. MergeScanSubscriber.prototype.notifyComplete = function (innerSub) {
  75045. var buffer = this.buffer;
  75046. this.remove(innerSub);
  75047. this.active--;
  75048. if (buffer.length > 0) {
  75049. this._next(buffer.shift());
  75050. }
  75051. else if (this.active === 0 && this.hasCompleted) {
  75052. if (this.hasValue === false) {
  75053. this.destination.next(this.acc);
  75054. }
  75055. this.destination.complete();
  75056. }
  75057. };
  75058. return MergeScanSubscriber;
  75059. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__["OuterSubscriber"]));
  75060. //# sourceMappingURL=mergeScan.js.map
  75061. /***/ }),
  75062. /***/ "./node_modules/rxjs/_esm5/internal/operators/min.js":
  75063. /*!***********************************************************!*\
  75064. !*** ./node_modules/rxjs/_esm5/internal/operators/min.js ***!
  75065. \***********************************************************/
  75066. /*! exports provided: min */
  75067. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75068. "use strict";
  75069. __webpack_require__.r(__webpack_exports__);
  75070. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "min", function() { return min; });
  75071. /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reduce */ "./node_modules/rxjs/_esm5/internal/operators/reduce.js");
  75072. /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */
  75073. function min(comparer) {
  75074. var min = (typeof comparer === 'function')
  75075. ? function (x, y) { return comparer(x, y) < 0 ? x : y; }
  75076. : function (x, y) { return x < y ? x : y; };
  75077. return Object(_reduce__WEBPACK_IMPORTED_MODULE_0__["reduce"])(min);
  75078. }
  75079. //# sourceMappingURL=min.js.map
  75080. /***/ }),
  75081. /***/ "./node_modules/rxjs/_esm5/internal/operators/multicast.js":
  75082. /*!*****************************************************************!*\
  75083. !*** ./node_modules/rxjs/_esm5/internal/operators/multicast.js ***!
  75084. \*****************************************************************/
  75085. /*! exports provided: multicast, MulticastOperator */
  75086. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75087. "use strict";
  75088. __webpack_require__.r(__webpack_exports__);
  75089. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "multicast", function() { return multicast; });
  75090. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "MulticastOperator", function() { return MulticastOperator; });
  75091. /* harmony import */ var _observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/ConnectableObservable */ "./node_modules/rxjs/_esm5/internal/observable/ConnectableObservable.js");
  75092. /** PURE_IMPORTS_START _observable_ConnectableObservable PURE_IMPORTS_END */
  75093. function multicast(subjectOrSubjectFactory, selector) {
  75094. return function multicastOperatorFunction(source) {
  75095. var subjectFactory;
  75096. if (typeof subjectOrSubjectFactory === 'function') {
  75097. subjectFactory = subjectOrSubjectFactory;
  75098. }
  75099. else {
  75100. subjectFactory = function subjectFactory() {
  75101. return subjectOrSubjectFactory;
  75102. };
  75103. }
  75104. if (typeof selector === 'function') {
  75105. return source.lift(new MulticastOperator(subjectFactory, selector));
  75106. }
  75107. var connectable = Object.create(source, _observable_ConnectableObservable__WEBPACK_IMPORTED_MODULE_0__["connectableObservableDescriptor"]);
  75108. connectable.source = source;
  75109. connectable.subjectFactory = subjectFactory;
  75110. return connectable;
  75111. };
  75112. }
  75113. var MulticastOperator = /*@__PURE__*/ (function () {
  75114. function MulticastOperator(subjectFactory, selector) {
  75115. this.subjectFactory = subjectFactory;
  75116. this.selector = selector;
  75117. }
  75118. MulticastOperator.prototype.call = function (subscriber, source) {
  75119. var selector = this.selector;
  75120. var subject = this.subjectFactory();
  75121. var subscription = selector(subject).subscribe(subscriber);
  75122. subscription.add(source.subscribe(subject));
  75123. return subscription;
  75124. };
  75125. return MulticastOperator;
  75126. }());
  75127. //# sourceMappingURL=multicast.js.map
  75128. /***/ }),
  75129. /***/ "./node_modules/rxjs/_esm5/internal/operators/observeOn.js":
  75130. /*!*****************************************************************!*\
  75131. !*** ./node_modules/rxjs/_esm5/internal/operators/observeOn.js ***!
  75132. \*****************************************************************/
  75133. /*! exports provided: observeOn, ObserveOnOperator, ObserveOnSubscriber, ObserveOnMessage */
  75134. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75135. "use strict";
  75136. __webpack_require__.r(__webpack_exports__);
  75137. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observeOn", function() { return observeOn; });
  75138. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObserveOnOperator", function() { return ObserveOnOperator; });
  75139. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObserveOnSubscriber", function() { return ObserveOnSubscriber; });
  75140. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObserveOnMessage", function() { return ObserveOnMessage; });
  75141. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75142. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  75143. /* harmony import */ var _Notification__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Notification */ "./node_modules/rxjs/_esm5/internal/Notification.js");
  75144. /** PURE_IMPORTS_START tslib,_Subscriber,_Notification PURE_IMPORTS_END */
  75145. function observeOn(scheduler, delay) {
  75146. if (delay === void 0) {
  75147. delay = 0;
  75148. }
  75149. return function observeOnOperatorFunction(source) {
  75150. return source.lift(new ObserveOnOperator(scheduler, delay));
  75151. };
  75152. }
  75153. var ObserveOnOperator = /*@__PURE__*/ (function () {
  75154. function ObserveOnOperator(scheduler, delay) {
  75155. if (delay === void 0) {
  75156. delay = 0;
  75157. }
  75158. this.scheduler = scheduler;
  75159. this.delay = delay;
  75160. }
  75161. ObserveOnOperator.prototype.call = function (subscriber, source) {
  75162. return source.subscribe(new ObserveOnSubscriber(subscriber, this.scheduler, this.delay));
  75163. };
  75164. return ObserveOnOperator;
  75165. }());
  75166. var ObserveOnSubscriber = /*@__PURE__*/ (function (_super) {
  75167. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ObserveOnSubscriber, _super);
  75168. function ObserveOnSubscriber(destination, scheduler, delay) {
  75169. if (delay === void 0) {
  75170. delay = 0;
  75171. }
  75172. var _this = _super.call(this, destination) || this;
  75173. _this.scheduler = scheduler;
  75174. _this.delay = delay;
  75175. return _this;
  75176. }
  75177. ObserveOnSubscriber.dispatch = function (arg) {
  75178. var notification = arg.notification, destination = arg.destination;
  75179. notification.observe(destination);
  75180. this.unsubscribe();
  75181. };
  75182. ObserveOnSubscriber.prototype.scheduleMessage = function (notification) {
  75183. this.add(this.scheduler.schedule(ObserveOnSubscriber.dispatch, this.delay, new ObserveOnMessage(notification, this.destination)));
  75184. };
  75185. ObserveOnSubscriber.prototype._next = function (value) {
  75186. this.scheduleMessage(_Notification__WEBPACK_IMPORTED_MODULE_2__["Notification"].createNext(value));
  75187. };
  75188. ObserveOnSubscriber.prototype._error = function (err) {
  75189. this.scheduleMessage(_Notification__WEBPACK_IMPORTED_MODULE_2__["Notification"].createError(err));
  75190. };
  75191. ObserveOnSubscriber.prototype._complete = function () {
  75192. this.scheduleMessage(_Notification__WEBPACK_IMPORTED_MODULE_2__["Notification"].createComplete());
  75193. };
  75194. return ObserveOnSubscriber;
  75195. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  75196. var ObserveOnMessage = /*@__PURE__*/ (function () {
  75197. function ObserveOnMessage(notification, destination) {
  75198. this.notification = notification;
  75199. this.destination = destination;
  75200. }
  75201. return ObserveOnMessage;
  75202. }());
  75203. //# sourceMappingURL=observeOn.js.map
  75204. /***/ }),
  75205. /***/ "./node_modules/rxjs/_esm5/internal/operators/onErrorResumeNext.js":
  75206. /*!*************************************************************************!*\
  75207. !*** ./node_modules/rxjs/_esm5/internal/operators/onErrorResumeNext.js ***!
  75208. \*************************************************************************/
  75209. /*! exports provided: onErrorResumeNext, onErrorResumeNextStatic */
  75210. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75211. "use strict";
  75212. __webpack_require__.r(__webpack_exports__);
  75213. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return onErrorResumeNext; });
  75214. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNextStatic", function() { return onErrorResumeNextStatic; });
  75215. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75216. /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../observable/from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  75217. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  75218. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  75219. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  75220. /** PURE_IMPORTS_START tslib,_observable_from,_util_isArray,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  75221. function onErrorResumeNext() {
  75222. var nextSources = [];
  75223. for (var _i = 0; _i < arguments.length; _i++) {
  75224. nextSources[_i] = arguments[_i];
  75225. }
  75226. if (nextSources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(nextSources[0])) {
  75227. nextSources = nextSources[0];
  75228. }
  75229. return function (source) { return source.lift(new OnErrorResumeNextOperator(nextSources)); };
  75230. }
  75231. function onErrorResumeNextStatic() {
  75232. var nextSources = [];
  75233. for (var _i = 0; _i < arguments.length; _i++) {
  75234. nextSources[_i] = arguments[_i];
  75235. }
  75236. var source = null;
  75237. if (nextSources.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_2__["isArray"])(nextSources[0])) {
  75238. nextSources = nextSources[0];
  75239. }
  75240. source = nextSources.shift();
  75241. return Object(_observable_from__WEBPACK_IMPORTED_MODULE_1__["from"])(source, null).lift(new OnErrorResumeNextOperator(nextSources));
  75242. }
  75243. var OnErrorResumeNextOperator = /*@__PURE__*/ (function () {
  75244. function OnErrorResumeNextOperator(nextSources) {
  75245. this.nextSources = nextSources;
  75246. }
  75247. OnErrorResumeNextOperator.prototype.call = function (subscriber, source) {
  75248. return source.subscribe(new OnErrorResumeNextSubscriber(subscriber, this.nextSources));
  75249. };
  75250. return OnErrorResumeNextOperator;
  75251. }());
  75252. var OnErrorResumeNextSubscriber = /*@__PURE__*/ (function (_super) {
  75253. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](OnErrorResumeNextSubscriber, _super);
  75254. function OnErrorResumeNextSubscriber(destination, nextSources) {
  75255. var _this = _super.call(this, destination) || this;
  75256. _this.destination = destination;
  75257. _this.nextSources = nextSources;
  75258. return _this;
  75259. }
  75260. OnErrorResumeNextSubscriber.prototype.notifyError = function (error, innerSub) {
  75261. this.subscribeToNextSource();
  75262. };
  75263. OnErrorResumeNextSubscriber.prototype.notifyComplete = function (innerSub) {
  75264. this.subscribeToNextSource();
  75265. };
  75266. OnErrorResumeNextSubscriber.prototype._error = function (err) {
  75267. this.subscribeToNextSource();
  75268. };
  75269. OnErrorResumeNextSubscriber.prototype._complete = function () {
  75270. this.subscribeToNextSource();
  75271. };
  75272. OnErrorResumeNextSubscriber.prototype.subscribeToNextSource = function () {
  75273. var next = this.nextSources.shift();
  75274. if (next) {
  75275. this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(this, next));
  75276. }
  75277. else {
  75278. this.destination.complete();
  75279. }
  75280. };
  75281. return OnErrorResumeNextSubscriber;
  75282. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  75283. //# sourceMappingURL=onErrorResumeNext.js.map
  75284. /***/ }),
  75285. /***/ "./node_modules/rxjs/_esm5/internal/operators/pairwise.js":
  75286. /*!****************************************************************!*\
  75287. !*** ./node_modules/rxjs/_esm5/internal/operators/pairwise.js ***!
  75288. \****************************************************************/
  75289. /*! exports provided: pairwise */
  75290. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75291. "use strict";
  75292. __webpack_require__.r(__webpack_exports__);
  75293. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pairwise", function() { return pairwise; });
  75294. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75295. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  75296. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  75297. function pairwise() {
  75298. return function (source) { return source.lift(new PairwiseOperator()); };
  75299. }
  75300. var PairwiseOperator = /*@__PURE__*/ (function () {
  75301. function PairwiseOperator() {
  75302. }
  75303. PairwiseOperator.prototype.call = function (subscriber, source) {
  75304. return source.subscribe(new PairwiseSubscriber(subscriber));
  75305. };
  75306. return PairwiseOperator;
  75307. }());
  75308. var PairwiseSubscriber = /*@__PURE__*/ (function (_super) {
  75309. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](PairwiseSubscriber, _super);
  75310. function PairwiseSubscriber(destination) {
  75311. var _this = _super.call(this, destination) || this;
  75312. _this.hasPrev = false;
  75313. return _this;
  75314. }
  75315. PairwiseSubscriber.prototype._next = function (value) {
  75316. if (this.hasPrev) {
  75317. this.destination.next([this.prev, value]);
  75318. }
  75319. else {
  75320. this.hasPrev = true;
  75321. }
  75322. this.prev = value;
  75323. };
  75324. return PairwiseSubscriber;
  75325. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  75326. //# sourceMappingURL=pairwise.js.map
  75327. /***/ }),
  75328. /***/ "./node_modules/rxjs/_esm5/internal/operators/partition.js":
  75329. /*!*****************************************************************!*\
  75330. !*** ./node_modules/rxjs/_esm5/internal/operators/partition.js ***!
  75331. \*****************************************************************/
  75332. /*! exports provided: partition */
  75333. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75334. "use strict";
  75335. __webpack_require__.r(__webpack_exports__);
  75336. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return partition; });
  75337. /* harmony import */ var _util_not__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/not */ "./node_modules/rxjs/_esm5/internal/util/not.js");
  75338. /* harmony import */ var _filter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./filter */ "./node_modules/rxjs/_esm5/internal/operators/filter.js");
  75339. /** PURE_IMPORTS_START _util_not,_filter PURE_IMPORTS_END */
  75340. function partition(predicate, thisArg) {
  75341. return function (source) {
  75342. return [
  75343. Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(predicate, thisArg)(source),
  75344. Object(_filter__WEBPACK_IMPORTED_MODULE_1__["filter"])(Object(_util_not__WEBPACK_IMPORTED_MODULE_0__["not"])(predicate, thisArg))(source)
  75345. ];
  75346. };
  75347. }
  75348. //# sourceMappingURL=partition.js.map
  75349. /***/ }),
  75350. /***/ "./node_modules/rxjs/_esm5/internal/operators/pluck.js":
  75351. /*!*************************************************************!*\
  75352. !*** ./node_modules/rxjs/_esm5/internal/operators/pluck.js ***!
  75353. \*************************************************************/
  75354. /*! exports provided: pluck */
  75355. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75356. "use strict";
  75357. __webpack_require__.r(__webpack_exports__);
  75358. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return pluck; });
  75359. /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  75360. /** PURE_IMPORTS_START _map PURE_IMPORTS_END */
  75361. function pluck() {
  75362. var properties = [];
  75363. for (var _i = 0; _i < arguments.length; _i++) {
  75364. properties[_i] = arguments[_i];
  75365. }
  75366. var length = properties.length;
  75367. if (length === 0) {
  75368. throw new Error('list of properties cannot be empty.');
  75369. }
  75370. return function (source) { return Object(_map__WEBPACK_IMPORTED_MODULE_0__["map"])(plucker(properties, length))(source); };
  75371. }
  75372. function plucker(props, length) {
  75373. var mapper = function (x) {
  75374. var currentProp = x;
  75375. for (var i = 0; i < length; i++) {
  75376. var p = currentProp[props[i]];
  75377. if (typeof p !== 'undefined') {
  75378. currentProp = p;
  75379. }
  75380. else {
  75381. return undefined;
  75382. }
  75383. }
  75384. return currentProp;
  75385. };
  75386. return mapper;
  75387. }
  75388. //# sourceMappingURL=pluck.js.map
  75389. /***/ }),
  75390. /***/ "./node_modules/rxjs/_esm5/internal/operators/publish.js":
  75391. /*!***************************************************************!*\
  75392. !*** ./node_modules/rxjs/_esm5/internal/operators/publish.js ***!
  75393. \***************************************************************/
  75394. /*! exports provided: publish */
  75395. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75396. "use strict";
  75397. __webpack_require__.r(__webpack_exports__);
  75398. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return publish; });
  75399. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  75400. /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./multicast */ "./node_modules/rxjs/_esm5/internal/operators/multicast.js");
  75401. /** PURE_IMPORTS_START _Subject,_multicast PURE_IMPORTS_END */
  75402. function publish(selector) {
  75403. return selector ?
  75404. Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(function () { return new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"](); }, selector) :
  75405. Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(new _Subject__WEBPACK_IMPORTED_MODULE_0__["Subject"]());
  75406. }
  75407. //# sourceMappingURL=publish.js.map
  75408. /***/ }),
  75409. /***/ "./node_modules/rxjs/_esm5/internal/operators/publishBehavior.js":
  75410. /*!***********************************************************************!*\
  75411. !*** ./node_modules/rxjs/_esm5/internal/operators/publishBehavior.js ***!
  75412. \***********************************************************************/
  75413. /*! exports provided: publishBehavior */
  75414. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75415. "use strict";
  75416. __webpack_require__.r(__webpack_exports__);
  75417. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return publishBehavior; });
  75418. /* harmony import */ var _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../BehaviorSubject */ "./node_modules/rxjs/_esm5/internal/BehaviorSubject.js");
  75419. /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./multicast */ "./node_modules/rxjs/_esm5/internal/operators/multicast.js");
  75420. /** PURE_IMPORTS_START _BehaviorSubject,_multicast PURE_IMPORTS_END */
  75421. function publishBehavior(value) {
  75422. return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(new _BehaviorSubject__WEBPACK_IMPORTED_MODULE_0__["BehaviorSubject"](value))(source); };
  75423. }
  75424. //# sourceMappingURL=publishBehavior.js.map
  75425. /***/ }),
  75426. /***/ "./node_modules/rxjs/_esm5/internal/operators/publishLast.js":
  75427. /*!*******************************************************************!*\
  75428. !*** ./node_modules/rxjs/_esm5/internal/operators/publishLast.js ***!
  75429. \*******************************************************************/
  75430. /*! exports provided: publishLast */
  75431. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75432. "use strict";
  75433. __webpack_require__.r(__webpack_exports__);
  75434. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return publishLast; });
  75435. /* harmony import */ var _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../AsyncSubject */ "./node_modules/rxjs/_esm5/internal/AsyncSubject.js");
  75436. /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./multicast */ "./node_modules/rxjs/_esm5/internal/operators/multicast.js");
  75437. /** PURE_IMPORTS_START _AsyncSubject,_multicast PURE_IMPORTS_END */
  75438. function publishLast() {
  75439. return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(new _AsyncSubject__WEBPACK_IMPORTED_MODULE_0__["AsyncSubject"]())(source); };
  75440. }
  75441. //# sourceMappingURL=publishLast.js.map
  75442. /***/ }),
  75443. /***/ "./node_modules/rxjs/_esm5/internal/operators/publishReplay.js":
  75444. /*!*********************************************************************!*\
  75445. !*** ./node_modules/rxjs/_esm5/internal/operators/publishReplay.js ***!
  75446. \*********************************************************************/
  75447. /*! exports provided: publishReplay */
  75448. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75449. "use strict";
  75450. __webpack_require__.r(__webpack_exports__);
  75451. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return publishReplay; });
  75452. /* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ReplaySubject */ "./node_modules/rxjs/_esm5/internal/ReplaySubject.js");
  75453. /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./multicast */ "./node_modules/rxjs/_esm5/internal/operators/multicast.js");
  75454. /** PURE_IMPORTS_START _ReplaySubject,_multicast PURE_IMPORTS_END */
  75455. function publishReplay(bufferSize, windowTime, selectorOrScheduler, scheduler) {
  75456. if (selectorOrScheduler && typeof selectorOrScheduler !== 'function') {
  75457. scheduler = selectorOrScheduler;
  75458. }
  75459. var selector = typeof selectorOrScheduler === 'function' ? selectorOrScheduler : undefined;
  75460. var subject = new _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__["ReplaySubject"](bufferSize, windowTime, scheduler);
  75461. return function (source) { return Object(_multicast__WEBPACK_IMPORTED_MODULE_1__["multicast"])(function () { return subject; }, selector)(source); };
  75462. }
  75463. //# sourceMappingURL=publishReplay.js.map
  75464. /***/ }),
  75465. /***/ "./node_modules/rxjs/_esm5/internal/operators/race.js":
  75466. /*!************************************************************!*\
  75467. !*** ./node_modules/rxjs/_esm5/internal/operators/race.js ***!
  75468. \************************************************************/
  75469. /*! exports provided: race */
  75470. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75471. "use strict";
  75472. __webpack_require__.r(__webpack_exports__);
  75473. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "race", function() { return race; });
  75474. /* harmony import */ var _util_isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../util/isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  75475. /* harmony import */ var _observable_race__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../observable/race */ "./node_modules/rxjs/_esm5/internal/observable/race.js");
  75476. /** PURE_IMPORTS_START _util_isArray,_observable_race PURE_IMPORTS_END */
  75477. function race() {
  75478. var observables = [];
  75479. for (var _i = 0; _i < arguments.length; _i++) {
  75480. observables[_i] = arguments[_i];
  75481. }
  75482. return function raceOperatorFunction(source) {
  75483. if (observables.length === 1 && Object(_util_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(observables[0])) {
  75484. observables = observables[0];
  75485. }
  75486. return source.lift.call(_observable_race__WEBPACK_IMPORTED_MODULE_1__["race"].apply(void 0, [source].concat(observables)));
  75487. };
  75488. }
  75489. //# sourceMappingURL=race.js.map
  75490. /***/ }),
  75491. /***/ "./node_modules/rxjs/_esm5/internal/operators/reduce.js":
  75492. /*!**************************************************************!*\
  75493. !*** ./node_modules/rxjs/_esm5/internal/operators/reduce.js ***!
  75494. \**************************************************************/
  75495. /*! exports provided: reduce */
  75496. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75497. "use strict";
  75498. __webpack_require__.r(__webpack_exports__);
  75499. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return reduce; });
  75500. /* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./scan */ "./node_modules/rxjs/_esm5/internal/operators/scan.js");
  75501. /* harmony import */ var _takeLast__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./takeLast */ "./node_modules/rxjs/_esm5/internal/operators/takeLast.js");
  75502. /* harmony import */ var _defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./defaultIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js");
  75503. /* harmony import */ var _util_pipe__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/pipe */ "./node_modules/rxjs/_esm5/internal/util/pipe.js");
  75504. /** PURE_IMPORTS_START _scan,_takeLast,_defaultIfEmpty,_util_pipe PURE_IMPORTS_END */
  75505. function reduce(accumulator, seed) {
  75506. if (arguments.length >= 2) {
  75507. return function reduceOperatorFunctionWithSeed(source) {
  75508. return Object(_util_pipe__WEBPACK_IMPORTED_MODULE_3__["pipe"])(Object(_scan__WEBPACK_IMPORTED_MODULE_0__["scan"])(accumulator, seed), Object(_takeLast__WEBPACK_IMPORTED_MODULE_1__["takeLast"])(1), Object(_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_2__["defaultIfEmpty"])(seed))(source);
  75509. };
  75510. }
  75511. return function reduceOperatorFunction(source) {
  75512. return Object(_util_pipe__WEBPACK_IMPORTED_MODULE_3__["pipe"])(Object(_scan__WEBPACK_IMPORTED_MODULE_0__["scan"])(function (acc, value, index) {
  75513. return accumulator(acc, value, index + 1);
  75514. }), Object(_takeLast__WEBPACK_IMPORTED_MODULE_1__["takeLast"])(1))(source);
  75515. };
  75516. }
  75517. //# sourceMappingURL=reduce.js.map
  75518. /***/ }),
  75519. /***/ "./node_modules/rxjs/_esm5/internal/operators/refCount.js":
  75520. /*!****************************************************************!*\
  75521. !*** ./node_modules/rxjs/_esm5/internal/operators/refCount.js ***!
  75522. \****************************************************************/
  75523. /*! exports provided: refCount */
  75524. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75525. "use strict";
  75526. __webpack_require__.r(__webpack_exports__);
  75527. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "refCount", function() { return refCount; });
  75528. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75529. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  75530. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  75531. function refCount() {
  75532. return function refCountOperatorFunction(source) {
  75533. return source.lift(new RefCountOperator(source));
  75534. };
  75535. }
  75536. var RefCountOperator = /*@__PURE__*/ (function () {
  75537. function RefCountOperator(connectable) {
  75538. this.connectable = connectable;
  75539. }
  75540. RefCountOperator.prototype.call = function (subscriber, source) {
  75541. var connectable = this.connectable;
  75542. connectable._refCount++;
  75543. var refCounter = new RefCountSubscriber(subscriber, connectable);
  75544. var subscription = source.subscribe(refCounter);
  75545. if (!refCounter.closed) {
  75546. refCounter.connection = connectable.connect();
  75547. }
  75548. return subscription;
  75549. };
  75550. return RefCountOperator;
  75551. }());
  75552. var RefCountSubscriber = /*@__PURE__*/ (function (_super) {
  75553. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RefCountSubscriber, _super);
  75554. function RefCountSubscriber(destination, connectable) {
  75555. var _this = _super.call(this, destination) || this;
  75556. _this.connectable = connectable;
  75557. return _this;
  75558. }
  75559. RefCountSubscriber.prototype._unsubscribe = function () {
  75560. var connectable = this.connectable;
  75561. if (!connectable) {
  75562. this.connection = null;
  75563. return;
  75564. }
  75565. this.connectable = null;
  75566. var refCount = connectable._refCount;
  75567. if (refCount <= 0) {
  75568. this.connection = null;
  75569. return;
  75570. }
  75571. connectable._refCount = refCount - 1;
  75572. if (refCount > 1) {
  75573. this.connection = null;
  75574. return;
  75575. }
  75576. var connection = this.connection;
  75577. var sharedConnection = connectable._connection;
  75578. this.connection = null;
  75579. if (sharedConnection && (!connection || sharedConnection === connection)) {
  75580. sharedConnection.unsubscribe();
  75581. }
  75582. };
  75583. return RefCountSubscriber;
  75584. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  75585. //# sourceMappingURL=refCount.js.map
  75586. /***/ }),
  75587. /***/ "./node_modules/rxjs/_esm5/internal/operators/repeat.js":
  75588. /*!**************************************************************!*\
  75589. !*** ./node_modules/rxjs/_esm5/internal/operators/repeat.js ***!
  75590. \**************************************************************/
  75591. /*! exports provided: repeat */
  75592. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75593. "use strict";
  75594. __webpack_require__.r(__webpack_exports__);
  75595. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "repeat", function() { return repeat; });
  75596. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75597. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  75598. /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  75599. /** PURE_IMPORTS_START tslib,_Subscriber,_observable_empty PURE_IMPORTS_END */
  75600. function repeat(count) {
  75601. if (count === void 0) {
  75602. count = -1;
  75603. }
  75604. return function (source) {
  75605. if (count === 0) {
  75606. return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])();
  75607. }
  75608. else if (count < 0) {
  75609. return source.lift(new RepeatOperator(-1, source));
  75610. }
  75611. else {
  75612. return source.lift(new RepeatOperator(count - 1, source));
  75613. }
  75614. };
  75615. }
  75616. var RepeatOperator = /*@__PURE__*/ (function () {
  75617. function RepeatOperator(count, source) {
  75618. this.count = count;
  75619. this.source = source;
  75620. }
  75621. RepeatOperator.prototype.call = function (subscriber, source) {
  75622. return source.subscribe(new RepeatSubscriber(subscriber, this.count, this.source));
  75623. };
  75624. return RepeatOperator;
  75625. }());
  75626. var RepeatSubscriber = /*@__PURE__*/ (function (_super) {
  75627. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RepeatSubscriber, _super);
  75628. function RepeatSubscriber(destination, count, source) {
  75629. var _this = _super.call(this, destination) || this;
  75630. _this.count = count;
  75631. _this.source = source;
  75632. return _this;
  75633. }
  75634. RepeatSubscriber.prototype.complete = function () {
  75635. if (!this.isStopped) {
  75636. var _a = this, source = _a.source, count = _a.count;
  75637. if (count === 0) {
  75638. return _super.prototype.complete.call(this);
  75639. }
  75640. else if (count > -1) {
  75641. this.count = count - 1;
  75642. }
  75643. source.subscribe(this._unsubscribeAndRecycle());
  75644. }
  75645. };
  75646. return RepeatSubscriber;
  75647. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  75648. //# sourceMappingURL=repeat.js.map
  75649. /***/ }),
  75650. /***/ "./node_modules/rxjs/_esm5/internal/operators/repeatWhen.js":
  75651. /*!******************************************************************!*\
  75652. !*** ./node_modules/rxjs/_esm5/internal/operators/repeatWhen.js ***!
  75653. \******************************************************************/
  75654. /*! exports provided: repeatWhen */
  75655. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75656. "use strict";
  75657. __webpack_require__.r(__webpack_exports__);
  75658. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function() { return repeatWhen; });
  75659. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75660. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  75661. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  75662. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  75663. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  75664. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  75665. /** PURE_IMPORTS_START tslib,_Subject,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  75666. function repeatWhen(notifier) {
  75667. return function (source) { return source.lift(new RepeatWhenOperator(notifier)); };
  75668. }
  75669. var RepeatWhenOperator = /*@__PURE__*/ (function () {
  75670. function RepeatWhenOperator(notifier) {
  75671. this.notifier = notifier;
  75672. }
  75673. RepeatWhenOperator.prototype.call = function (subscriber, source) {
  75674. return source.subscribe(new RepeatWhenSubscriber(subscriber, this.notifier, source));
  75675. };
  75676. return RepeatWhenOperator;
  75677. }());
  75678. var RepeatWhenSubscriber = /*@__PURE__*/ (function (_super) {
  75679. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RepeatWhenSubscriber, _super);
  75680. function RepeatWhenSubscriber(destination, notifier, source) {
  75681. var _this = _super.call(this, destination) || this;
  75682. _this.notifier = notifier;
  75683. _this.source = source;
  75684. _this.sourceIsBeingSubscribedTo = true;
  75685. return _this;
  75686. }
  75687. RepeatWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  75688. this.sourceIsBeingSubscribedTo = true;
  75689. this.source.subscribe(this);
  75690. };
  75691. RepeatWhenSubscriber.prototype.notifyComplete = function (innerSub) {
  75692. if (this.sourceIsBeingSubscribedTo === false) {
  75693. return _super.prototype.complete.call(this);
  75694. }
  75695. };
  75696. RepeatWhenSubscriber.prototype.complete = function () {
  75697. this.sourceIsBeingSubscribedTo = false;
  75698. if (!this.isStopped) {
  75699. if (!this.retries) {
  75700. this.subscribeToRetries();
  75701. }
  75702. if (!this.retriesSubscription || this.retriesSubscription.closed) {
  75703. return _super.prototype.complete.call(this);
  75704. }
  75705. this._unsubscribeAndRecycle();
  75706. this.notifications.next();
  75707. }
  75708. };
  75709. RepeatWhenSubscriber.prototype._unsubscribe = function () {
  75710. var _a = this, notifications = _a.notifications, retriesSubscription = _a.retriesSubscription;
  75711. if (notifications) {
  75712. notifications.unsubscribe();
  75713. this.notifications = null;
  75714. }
  75715. if (retriesSubscription) {
  75716. retriesSubscription.unsubscribe();
  75717. this.retriesSubscription = null;
  75718. }
  75719. this.retries = null;
  75720. };
  75721. RepeatWhenSubscriber.prototype._unsubscribeAndRecycle = function () {
  75722. var _unsubscribe = this._unsubscribe;
  75723. this._unsubscribe = null;
  75724. _super.prototype._unsubscribeAndRecycle.call(this);
  75725. this._unsubscribe = _unsubscribe;
  75726. return this;
  75727. };
  75728. RepeatWhenSubscriber.prototype.subscribeToRetries = function () {
  75729. this.notifications = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]();
  75730. var retries = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(this.notifier)(this.notifications);
  75731. if (retries === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  75732. return _super.prototype.complete.call(this);
  75733. }
  75734. this.retries = retries;
  75735. this.retriesSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__["subscribeToResult"])(this, retries);
  75736. };
  75737. return RepeatWhenSubscriber;
  75738. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__["OuterSubscriber"]));
  75739. //# sourceMappingURL=repeatWhen.js.map
  75740. /***/ }),
  75741. /***/ "./node_modules/rxjs/_esm5/internal/operators/retry.js":
  75742. /*!*************************************************************!*\
  75743. !*** ./node_modules/rxjs/_esm5/internal/operators/retry.js ***!
  75744. \*************************************************************/
  75745. /*! exports provided: retry */
  75746. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75747. "use strict";
  75748. __webpack_require__.r(__webpack_exports__);
  75749. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return retry; });
  75750. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75751. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  75752. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  75753. function retry(count) {
  75754. if (count === void 0) {
  75755. count = -1;
  75756. }
  75757. return function (source) { return source.lift(new RetryOperator(count, source)); };
  75758. }
  75759. var RetryOperator = /*@__PURE__*/ (function () {
  75760. function RetryOperator(count, source) {
  75761. this.count = count;
  75762. this.source = source;
  75763. }
  75764. RetryOperator.prototype.call = function (subscriber, source) {
  75765. return source.subscribe(new RetrySubscriber(subscriber, this.count, this.source));
  75766. };
  75767. return RetryOperator;
  75768. }());
  75769. var RetrySubscriber = /*@__PURE__*/ (function (_super) {
  75770. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RetrySubscriber, _super);
  75771. function RetrySubscriber(destination, count, source) {
  75772. var _this = _super.call(this, destination) || this;
  75773. _this.count = count;
  75774. _this.source = source;
  75775. return _this;
  75776. }
  75777. RetrySubscriber.prototype.error = function (err) {
  75778. if (!this.isStopped) {
  75779. var _a = this, source = _a.source, count = _a.count;
  75780. if (count === 0) {
  75781. return _super.prototype.error.call(this, err);
  75782. }
  75783. else if (count > -1) {
  75784. this.count = count - 1;
  75785. }
  75786. source.subscribe(this._unsubscribeAndRecycle());
  75787. }
  75788. };
  75789. return RetrySubscriber;
  75790. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  75791. //# sourceMappingURL=retry.js.map
  75792. /***/ }),
  75793. /***/ "./node_modules/rxjs/_esm5/internal/operators/retryWhen.js":
  75794. /*!*****************************************************************!*\
  75795. !*** ./node_modules/rxjs/_esm5/internal/operators/retryWhen.js ***!
  75796. \*****************************************************************/
  75797. /*! exports provided: retryWhen */
  75798. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75799. "use strict";
  75800. __webpack_require__.r(__webpack_exports__);
  75801. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function() { return retryWhen; });
  75802. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75803. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  75804. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  75805. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  75806. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  75807. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  75808. /** PURE_IMPORTS_START tslib,_Subject,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  75809. function retryWhen(notifier) {
  75810. return function (source) { return source.lift(new RetryWhenOperator(notifier, source)); };
  75811. }
  75812. var RetryWhenOperator = /*@__PURE__*/ (function () {
  75813. function RetryWhenOperator(notifier, source) {
  75814. this.notifier = notifier;
  75815. this.source = source;
  75816. }
  75817. RetryWhenOperator.prototype.call = function (subscriber, source) {
  75818. return source.subscribe(new RetryWhenSubscriber(subscriber, this.notifier, this.source));
  75819. };
  75820. return RetryWhenOperator;
  75821. }());
  75822. var RetryWhenSubscriber = /*@__PURE__*/ (function (_super) {
  75823. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](RetryWhenSubscriber, _super);
  75824. function RetryWhenSubscriber(destination, notifier, source) {
  75825. var _this = _super.call(this, destination) || this;
  75826. _this.notifier = notifier;
  75827. _this.source = source;
  75828. return _this;
  75829. }
  75830. RetryWhenSubscriber.prototype.error = function (err) {
  75831. if (!this.isStopped) {
  75832. var errors = this.errors;
  75833. var retries = this.retries;
  75834. var retriesSubscription = this.retriesSubscription;
  75835. if (!retries) {
  75836. errors = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]();
  75837. retries = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(this.notifier)(errors);
  75838. if (retries === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  75839. return _super.prototype.error.call(this, _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"].e);
  75840. }
  75841. retriesSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__["subscribeToResult"])(this, retries);
  75842. }
  75843. else {
  75844. this.errors = null;
  75845. this.retriesSubscription = null;
  75846. }
  75847. this._unsubscribeAndRecycle();
  75848. this.errors = errors;
  75849. this.retries = retries;
  75850. this.retriesSubscription = retriesSubscription;
  75851. errors.next(err);
  75852. }
  75853. };
  75854. RetryWhenSubscriber.prototype._unsubscribe = function () {
  75855. var _a = this, errors = _a.errors, retriesSubscription = _a.retriesSubscription;
  75856. if (errors) {
  75857. errors.unsubscribe();
  75858. this.errors = null;
  75859. }
  75860. if (retriesSubscription) {
  75861. retriesSubscription.unsubscribe();
  75862. this.retriesSubscription = null;
  75863. }
  75864. this.retries = null;
  75865. };
  75866. RetryWhenSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  75867. var _unsubscribe = this._unsubscribe;
  75868. this._unsubscribe = null;
  75869. this._unsubscribeAndRecycle();
  75870. this._unsubscribe = _unsubscribe;
  75871. this.source.subscribe(this);
  75872. };
  75873. return RetryWhenSubscriber;
  75874. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__["OuterSubscriber"]));
  75875. //# sourceMappingURL=retryWhen.js.map
  75876. /***/ }),
  75877. /***/ "./node_modules/rxjs/_esm5/internal/operators/sample.js":
  75878. /*!**************************************************************!*\
  75879. !*** ./node_modules/rxjs/_esm5/internal/operators/sample.js ***!
  75880. \**************************************************************/
  75881. /*! exports provided: sample */
  75882. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75883. "use strict";
  75884. __webpack_require__.r(__webpack_exports__);
  75885. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return sample; });
  75886. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75887. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  75888. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  75889. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  75890. function sample(notifier) {
  75891. return function (source) { return source.lift(new SampleOperator(notifier)); };
  75892. }
  75893. var SampleOperator = /*@__PURE__*/ (function () {
  75894. function SampleOperator(notifier) {
  75895. this.notifier = notifier;
  75896. }
  75897. SampleOperator.prototype.call = function (subscriber, source) {
  75898. var sampleSubscriber = new SampleSubscriber(subscriber);
  75899. var subscription = source.subscribe(sampleSubscriber);
  75900. subscription.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(sampleSubscriber, this.notifier));
  75901. return subscription;
  75902. };
  75903. return SampleOperator;
  75904. }());
  75905. var SampleSubscriber = /*@__PURE__*/ (function (_super) {
  75906. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SampleSubscriber, _super);
  75907. function SampleSubscriber() {
  75908. var _this = _super !== null && _super.apply(this, arguments) || this;
  75909. _this.hasValue = false;
  75910. return _this;
  75911. }
  75912. SampleSubscriber.prototype._next = function (value) {
  75913. this.value = value;
  75914. this.hasValue = true;
  75915. };
  75916. SampleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  75917. this.emitValue();
  75918. };
  75919. SampleSubscriber.prototype.notifyComplete = function () {
  75920. this.emitValue();
  75921. };
  75922. SampleSubscriber.prototype.emitValue = function () {
  75923. if (this.hasValue) {
  75924. this.hasValue = false;
  75925. this.destination.next(this.value);
  75926. }
  75927. };
  75928. return SampleSubscriber;
  75929. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  75930. //# sourceMappingURL=sample.js.map
  75931. /***/ }),
  75932. /***/ "./node_modules/rxjs/_esm5/internal/operators/sampleTime.js":
  75933. /*!******************************************************************!*\
  75934. !*** ./node_modules/rxjs/_esm5/internal/operators/sampleTime.js ***!
  75935. \******************************************************************/
  75936. /*! exports provided: sampleTime */
  75937. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75938. "use strict";
  75939. __webpack_require__.r(__webpack_exports__);
  75940. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function() { return sampleTime; });
  75941. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  75942. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  75943. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  75944. /** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async PURE_IMPORTS_END */
  75945. function sampleTime(period, scheduler) {
  75946. if (scheduler === void 0) {
  75947. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_2__["async"];
  75948. }
  75949. return function (source) { return source.lift(new SampleTimeOperator(period, scheduler)); };
  75950. }
  75951. var SampleTimeOperator = /*@__PURE__*/ (function () {
  75952. function SampleTimeOperator(period, scheduler) {
  75953. this.period = period;
  75954. this.scheduler = scheduler;
  75955. }
  75956. SampleTimeOperator.prototype.call = function (subscriber, source) {
  75957. return source.subscribe(new SampleTimeSubscriber(subscriber, this.period, this.scheduler));
  75958. };
  75959. return SampleTimeOperator;
  75960. }());
  75961. var SampleTimeSubscriber = /*@__PURE__*/ (function (_super) {
  75962. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SampleTimeSubscriber, _super);
  75963. function SampleTimeSubscriber(destination, period, scheduler) {
  75964. var _this = _super.call(this, destination) || this;
  75965. _this.period = period;
  75966. _this.scheduler = scheduler;
  75967. _this.hasValue = false;
  75968. _this.add(scheduler.schedule(dispatchNotification, period, { subscriber: _this, period: period }));
  75969. return _this;
  75970. }
  75971. SampleTimeSubscriber.prototype._next = function (value) {
  75972. this.lastValue = value;
  75973. this.hasValue = true;
  75974. };
  75975. SampleTimeSubscriber.prototype.notifyNext = function () {
  75976. if (this.hasValue) {
  75977. this.hasValue = false;
  75978. this.destination.next(this.lastValue);
  75979. }
  75980. };
  75981. return SampleTimeSubscriber;
  75982. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  75983. function dispatchNotification(state) {
  75984. var subscriber = state.subscriber, period = state.period;
  75985. subscriber.notifyNext();
  75986. this.schedule(state, period);
  75987. }
  75988. //# sourceMappingURL=sampleTime.js.map
  75989. /***/ }),
  75990. /***/ "./node_modules/rxjs/_esm5/internal/operators/scan.js":
  75991. /*!************************************************************!*\
  75992. !*** ./node_modules/rxjs/_esm5/internal/operators/scan.js ***!
  75993. \************************************************************/
  75994. /*! exports provided: scan */
  75995. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  75996. "use strict";
  75997. __webpack_require__.r(__webpack_exports__);
  75998. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "scan", function() { return scan; });
  75999. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76000. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76001. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  76002. function scan(accumulator, seed) {
  76003. var hasSeed = false;
  76004. if (arguments.length >= 2) {
  76005. hasSeed = true;
  76006. }
  76007. return function scanOperatorFunction(source) {
  76008. return source.lift(new ScanOperator(accumulator, seed, hasSeed));
  76009. };
  76010. }
  76011. var ScanOperator = /*@__PURE__*/ (function () {
  76012. function ScanOperator(accumulator, seed, hasSeed) {
  76013. if (hasSeed === void 0) {
  76014. hasSeed = false;
  76015. }
  76016. this.accumulator = accumulator;
  76017. this.seed = seed;
  76018. this.hasSeed = hasSeed;
  76019. }
  76020. ScanOperator.prototype.call = function (subscriber, source) {
  76021. return source.subscribe(new ScanSubscriber(subscriber, this.accumulator, this.seed, this.hasSeed));
  76022. };
  76023. return ScanOperator;
  76024. }());
  76025. var ScanSubscriber = /*@__PURE__*/ (function (_super) {
  76026. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ScanSubscriber, _super);
  76027. function ScanSubscriber(destination, accumulator, _seed, hasSeed) {
  76028. var _this = _super.call(this, destination) || this;
  76029. _this.accumulator = accumulator;
  76030. _this._seed = _seed;
  76031. _this.hasSeed = hasSeed;
  76032. _this.index = 0;
  76033. return _this;
  76034. }
  76035. Object.defineProperty(ScanSubscriber.prototype, "seed", {
  76036. get: function () {
  76037. return this._seed;
  76038. },
  76039. set: function (value) {
  76040. this.hasSeed = true;
  76041. this._seed = value;
  76042. },
  76043. enumerable: true,
  76044. configurable: true
  76045. });
  76046. ScanSubscriber.prototype._next = function (value) {
  76047. if (!this.hasSeed) {
  76048. this.seed = value;
  76049. this.destination.next(value);
  76050. }
  76051. else {
  76052. return this._tryNext(value);
  76053. }
  76054. };
  76055. ScanSubscriber.prototype._tryNext = function (value) {
  76056. var index = this.index++;
  76057. var result;
  76058. try {
  76059. result = this.accumulator(this.seed, value, index);
  76060. }
  76061. catch (err) {
  76062. this.destination.error(err);
  76063. }
  76064. this.seed = result;
  76065. this.destination.next(result);
  76066. };
  76067. return ScanSubscriber;
  76068. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76069. //# sourceMappingURL=scan.js.map
  76070. /***/ }),
  76071. /***/ "./node_modules/rxjs/_esm5/internal/operators/sequenceEqual.js":
  76072. /*!*********************************************************************!*\
  76073. !*** ./node_modules/rxjs/_esm5/internal/operators/sequenceEqual.js ***!
  76074. \*********************************************************************/
  76075. /*! exports provided: sequenceEqual, SequenceEqualOperator, SequenceEqualSubscriber */
  76076. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76077. "use strict";
  76078. __webpack_require__.r(__webpack_exports__);
  76079. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function() { return sequenceEqual; });
  76080. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SequenceEqualOperator", function() { return SequenceEqualOperator; });
  76081. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "SequenceEqualSubscriber", function() { return SequenceEqualSubscriber; });
  76082. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76083. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76084. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  76085. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  76086. /** PURE_IMPORTS_START tslib,_Subscriber,_util_tryCatch,_util_errorObject PURE_IMPORTS_END */
  76087. function sequenceEqual(compareTo, comparor) {
  76088. return function (source) { return source.lift(new SequenceEqualOperator(compareTo, comparor)); };
  76089. }
  76090. var SequenceEqualOperator = /*@__PURE__*/ (function () {
  76091. function SequenceEqualOperator(compareTo, comparor) {
  76092. this.compareTo = compareTo;
  76093. this.comparor = comparor;
  76094. }
  76095. SequenceEqualOperator.prototype.call = function (subscriber, source) {
  76096. return source.subscribe(new SequenceEqualSubscriber(subscriber, this.compareTo, this.comparor));
  76097. };
  76098. return SequenceEqualOperator;
  76099. }());
  76100. var SequenceEqualSubscriber = /*@__PURE__*/ (function (_super) {
  76101. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SequenceEqualSubscriber, _super);
  76102. function SequenceEqualSubscriber(destination, compareTo, comparor) {
  76103. var _this = _super.call(this, destination) || this;
  76104. _this.compareTo = compareTo;
  76105. _this.comparor = comparor;
  76106. _this._a = [];
  76107. _this._b = [];
  76108. _this._oneComplete = false;
  76109. _this.add(compareTo.subscribe(new SequenceEqualCompareToSubscriber(destination, _this)));
  76110. return _this;
  76111. }
  76112. SequenceEqualSubscriber.prototype._next = function (value) {
  76113. if (this._oneComplete && this._b.length === 0) {
  76114. this.emit(false);
  76115. }
  76116. else {
  76117. this._a.push(value);
  76118. this.checkValues();
  76119. }
  76120. };
  76121. SequenceEqualSubscriber.prototype._complete = function () {
  76122. if (this._oneComplete) {
  76123. this.emit(this._a.length === 0 && this._b.length === 0);
  76124. }
  76125. else {
  76126. this._oneComplete = true;
  76127. }
  76128. };
  76129. SequenceEqualSubscriber.prototype.checkValues = function () {
  76130. var _c = this, _a = _c._a, _b = _c._b, comparor = _c.comparor;
  76131. while (_a.length > 0 && _b.length > 0) {
  76132. var a = _a.shift();
  76133. var b = _b.shift();
  76134. var areEqual = false;
  76135. if (comparor) {
  76136. areEqual = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(comparor)(a, b);
  76137. if (areEqual === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  76138. this.destination.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"].e);
  76139. }
  76140. }
  76141. else {
  76142. areEqual = a === b;
  76143. }
  76144. if (!areEqual) {
  76145. this.emit(false);
  76146. }
  76147. }
  76148. };
  76149. SequenceEqualSubscriber.prototype.emit = function (value) {
  76150. var destination = this.destination;
  76151. destination.next(value);
  76152. destination.complete();
  76153. };
  76154. SequenceEqualSubscriber.prototype.nextB = function (value) {
  76155. if (this._oneComplete && this._a.length === 0) {
  76156. this.emit(false);
  76157. }
  76158. else {
  76159. this._b.push(value);
  76160. this.checkValues();
  76161. }
  76162. };
  76163. return SequenceEqualSubscriber;
  76164. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76165. var SequenceEqualCompareToSubscriber = /*@__PURE__*/ (function (_super) {
  76166. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SequenceEqualCompareToSubscriber, _super);
  76167. function SequenceEqualCompareToSubscriber(destination, parent) {
  76168. var _this = _super.call(this, destination) || this;
  76169. _this.parent = parent;
  76170. return _this;
  76171. }
  76172. SequenceEqualCompareToSubscriber.prototype._next = function (value) {
  76173. this.parent.nextB(value);
  76174. };
  76175. SequenceEqualCompareToSubscriber.prototype._error = function (err) {
  76176. this.parent.error(err);
  76177. };
  76178. SequenceEqualCompareToSubscriber.prototype._complete = function () {
  76179. this.parent._complete();
  76180. };
  76181. return SequenceEqualCompareToSubscriber;
  76182. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76183. //# sourceMappingURL=sequenceEqual.js.map
  76184. /***/ }),
  76185. /***/ "./node_modules/rxjs/_esm5/internal/operators/share.js":
  76186. /*!*************************************************************!*\
  76187. !*** ./node_modules/rxjs/_esm5/internal/operators/share.js ***!
  76188. \*************************************************************/
  76189. /*! exports provided: share */
  76190. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76191. "use strict";
  76192. __webpack_require__.r(__webpack_exports__);
  76193. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "share", function() { return share; });
  76194. /* harmony import */ var _multicast__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./multicast */ "./node_modules/rxjs/_esm5/internal/operators/multicast.js");
  76195. /* harmony import */ var _refCount__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./refCount */ "./node_modules/rxjs/_esm5/internal/operators/refCount.js");
  76196. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  76197. /** PURE_IMPORTS_START _multicast,_refCount,_Subject PURE_IMPORTS_END */
  76198. function shareSubjectFactory() {
  76199. return new _Subject__WEBPACK_IMPORTED_MODULE_2__["Subject"]();
  76200. }
  76201. function share() {
  76202. return function (source) { return Object(_refCount__WEBPACK_IMPORTED_MODULE_1__["refCount"])()(Object(_multicast__WEBPACK_IMPORTED_MODULE_0__["multicast"])(shareSubjectFactory)(source)); };
  76203. }
  76204. //# sourceMappingURL=share.js.map
  76205. /***/ }),
  76206. /***/ "./node_modules/rxjs/_esm5/internal/operators/shareReplay.js":
  76207. /*!*******************************************************************!*\
  76208. !*** ./node_modules/rxjs/_esm5/internal/operators/shareReplay.js ***!
  76209. \*******************************************************************/
  76210. /*! exports provided: shareReplay */
  76211. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76212. "use strict";
  76213. __webpack_require__.r(__webpack_exports__);
  76214. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function() { return shareReplay; });
  76215. /* harmony import */ var _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../ReplaySubject */ "./node_modules/rxjs/_esm5/internal/ReplaySubject.js");
  76216. /** PURE_IMPORTS_START _ReplaySubject PURE_IMPORTS_END */
  76217. function shareReplay(bufferSize, windowTime, scheduler) {
  76218. return function (source) { return source.lift(shareReplayOperator(bufferSize, windowTime, scheduler)); };
  76219. }
  76220. function shareReplayOperator(bufferSize, windowTime, scheduler) {
  76221. var subject;
  76222. var refCount = 0;
  76223. var subscription;
  76224. var hasError = false;
  76225. var isComplete = false;
  76226. return function shareReplayOperation(source) {
  76227. refCount++;
  76228. if (!subject || hasError) {
  76229. hasError = false;
  76230. subject = new _ReplaySubject__WEBPACK_IMPORTED_MODULE_0__["ReplaySubject"](bufferSize, windowTime, scheduler);
  76231. subscription = source.subscribe({
  76232. next: function (value) { subject.next(value); },
  76233. error: function (err) {
  76234. hasError = true;
  76235. subject.error(err);
  76236. },
  76237. complete: function () {
  76238. isComplete = true;
  76239. subject.complete();
  76240. },
  76241. });
  76242. }
  76243. var innerSub = subject.subscribe(this);
  76244. return function () {
  76245. refCount--;
  76246. innerSub.unsubscribe();
  76247. if (subscription && refCount === 0 && isComplete) {
  76248. subscription.unsubscribe();
  76249. }
  76250. };
  76251. };
  76252. }
  76253. //# sourceMappingURL=shareReplay.js.map
  76254. /***/ }),
  76255. /***/ "./node_modules/rxjs/_esm5/internal/operators/single.js":
  76256. /*!**************************************************************!*\
  76257. !*** ./node_modules/rxjs/_esm5/internal/operators/single.js ***!
  76258. \**************************************************************/
  76259. /*! exports provided: single */
  76260. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76261. "use strict";
  76262. __webpack_require__.r(__webpack_exports__);
  76263. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "single", function() { return single; });
  76264. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76265. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76266. /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/EmptyError */ "./node_modules/rxjs/_esm5/internal/util/EmptyError.js");
  76267. /** PURE_IMPORTS_START tslib,_Subscriber,_util_EmptyError PURE_IMPORTS_END */
  76268. function single(predicate) {
  76269. return function (source) { return source.lift(new SingleOperator(predicate, source)); };
  76270. }
  76271. var SingleOperator = /*@__PURE__*/ (function () {
  76272. function SingleOperator(predicate, source) {
  76273. this.predicate = predicate;
  76274. this.source = source;
  76275. }
  76276. SingleOperator.prototype.call = function (subscriber, source) {
  76277. return source.subscribe(new SingleSubscriber(subscriber, this.predicate, this.source));
  76278. };
  76279. return SingleOperator;
  76280. }());
  76281. var SingleSubscriber = /*@__PURE__*/ (function (_super) {
  76282. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SingleSubscriber, _super);
  76283. function SingleSubscriber(destination, predicate, source) {
  76284. var _this = _super.call(this, destination) || this;
  76285. _this.predicate = predicate;
  76286. _this.source = source;
  76287. _this.seenValue = false;
  76288. _this.index = 0;
  76289. return _this;
  76290. }
  76291. SingleSubscriber.prototype.applySingleValue = function (value) {
  76292. if (this.seenValue) {
  76293. this.destination.error('Sequence contains more than one element');
  76294. }
  76295. else {
  76296. this.seenValue = true;
  76297. this.singleValue = value;
  76298. }
  76299. };
  76300. SingleSubscriber.prototype._next = function (value) {
  76301. var index = this.index++;
  76302. if (this.predicate) {
  76303. this.tryNext(value, index);
  76304. }
  76305. else {
  76306. this.applySingleValue(value);
  76307. }
  76308. };
  76309. SingleSubscriber.prototype.tryNext = function (value, index) {
  76310. try {
  76311. if (this.predicate(value, index, this.source)) {
  76312. this.applySingleValue(value);
  76313. }
  76314. }
  76315. catch (err) {
  76316. this.destination.error(err);
  76317. }
  76318. };
  76319. SingleSubscriber.prototype._complete = function () {
  76320. var destination = this.destination;
  76321. if (this.index > 0) {
  76322. destination.next(this.seenValue ? this.singleValue : undefined);
  76323. destination.complete();
  76324. }
  76325. else {
  76326. destination.error(new _util_EmptyError__WEBPACK_IMPORTED_MODULE_2__["EmptyError"]);
  76327. }
  76328. };
  76329. return SingleSubscriber;
  76330. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76331. //# sourceMappingURL=single.js.map
  76332. /***/ }),
  76333. /***/ "./node_modules/rxjs/_esm5/internal/operators/skip.js":
  76334. /*!************************************************************!*\
  76335. !*** ./node_modules/rxjs/_esm5/internal/operators/skip.js ***!
  76336. \************************************************************/
  76337. /*! exports provided: skip */
  76338. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76339. "use strict";
  76340. __webpack_require__.r(__webpack_exports__);
  76341. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skip", function() { return skip; });
  76342. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76343. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76344. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  76345. function skip(count) {
  76346. return function (source) { return source.lift(new SkipOperator(count)); };
  76347. }
  76348. var SkipOperator = /*@__PURE__*/ (function () {
  76349. function SkipOperator(total) {
  76350. this.total = total;
  76351. }
  76352. SkipOperator.prototype.call = function (subscriber, source) {
  76353. return source.subscribe(new SkipSubscriber(subscriber, this.total));
  76354. };
  76355. return SkipOperator;
  76356. }());
  76357. var SkipSubscriber = /*@__PURE__*/ (function (_super) {
  76358. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SkipSubscriber, _super);
  76359. function SkipSubscriber(destination, total) {
  76360. var _this = _super.call(this, destination) || this;
  76361. _this.total = total;
  76362. _this.count = 0;
  76363. return _this;
  76364. }
  76365. SkipSubscriber.prototype._next = function (x) {
  76366. if (++this.count > this.total) {
  76367. this.destination.next(x);
  76368. }
  76369. };
  76370. return SkipSubscriber;
  76371. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76372. //# sourceMappingURL=skip.js.map
  76373. /***/ }),
  76374. /***/ "./node_modules/rxjs/_esm5/internal/operators/skipLast.js":
  76375. /*!****************************************************************!*\
  76376. !*** ./node_modules/rxjs/_esm5/internal/operators/skipLast.js ***!
  76377. \****************************************************************/
  76378. /*! exports provided: skipLast */
  76379. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76380. "use strict";
  76381. __webpack_require__.r(__webpack_exports__);
  76382. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipLast", function() { return skipLast; });
  76383. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76384. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76385. /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js");
  76386. /** PURE_IMPORTS_START tslib,_Subscriber,_util_ArgumentOutOfRangeError PURE_IMPORTS_END */
  76387. function skipLast(count) {
  76388. return function (source) { return source.lift(new SkipLastOperator(count)); };
  76389. }
  76390. var SkipLastOperator = /*@__PURE__*/ (function () {
  76391. function SkipLastOperator(_skipCount) {
  76392. this._skipCount = _skipCount;
  76393. if (this._skipCount < 0) {
  76394. throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_2__["ArgumentOutOfRangeError"];
  76395. }
  76396. }
  76397. SkipLastOperator.prototype.call = function (subscriber, source) {
  76398. if (this._skipCount === 0) {
  76399. return source.subscribe(new _Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"](subscriber));
  76400. }
  76401. else {
  76402. return source.subscribe(new SkipLastSubscriber(subscriber, this._skipCount));
  76403. }
  76404. };
  76405. return SkipLastOperator;
  76406. }());
  76407. var SkipLastSubscriber = /*@__PURE__*/ (function (_super) {
  76408. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SkipLastSubscriber, _super);
  76409. function SkipLastSubscriber(destination, _skipCount) {
  76410. var _this = _super.call(this, destination) || this;
  76411. _this._skipCount = _skipCount;
  76412. _this._count = 0;
  76413. _this._ring = new Array(_skipCount);
  76414. return _this;
  76415. }
  76416. SkipLastSubscriber.prototype._next = function (value) {
  76417. var skipCount = this._skipCount;
  76418. var count = this._count++;
  76419. if (count < skipCount) {
  76420. this._ring[count] = value;
  76421. }
  76422. else {
  76423. var currentIndex = count % skipCount;
  76424. var ring = this._ring;
  76425. var oldValue = ring[currentIndex];
  76426. ring[currentIndex] = value;
  76427. this.destination.next(oldValue);
  76428. }
  76429. };
  76430. return SkipLastSubscriber;
  76431. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76432. //# sourceMappingURL=skipLast.js.map
  76433. /***/ }),
  76434. /***/ "./node_modules/rxjs/_esm5/internal/operators/skipUntil.js":
  76435. /*!*****************************************************************!*\
  76436. !*** ./node_modules/rxjs/_esm5/internal/operators/skipUntil.js ***!
  76437. \*****************************************************************/
  76438. /*! exports provided: skipUntil */
  76439. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76440. "use strict";
  76441. __webpack_require__.r(__webpack_exports__);
  76442. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function() { return skipUntil; });
  76443. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76444. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  76445. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  76446. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  76447. function skipUntil(notifier) {
  76448. return function (source) { return source.lift(new SkipUntilOperator(notifier)); };
  76449. }
  76450. var SkipUntilOperator = /*@__PURE__*/ (function () {
  76451. function SkipUntilOperator(notifier) {
  76452. this.notifier = notifier;
  76453. }
  76454. SkipUntilOperator.prototype.call = function (destination, source) {
  76455. return source.subscribe(new SkipUntilSubscriber(destination, this.notifier));
  76456. };
  76457. return SkipUntilOperator;
  76458. }());
  76459. var SkipUntilSubscriber = /*@__PURE__*/ (function (_super) {
  76460. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SkipUntilSubscriber, _super);
  76461. function SkipUntilSubscriber(destination, notifier) {
  76462. var _this = _super.call(this, destination) || this;
  76463. _this.hasValue = false;
  76464. _this.add(_this.innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(_this, notifier));
  76465. return _this;
  76466. }
  76467. SkipUntilSubscriber.prototype._next = function (value) {
  76468. if (this.hasValue) {
  76469. _super.prototype._next.call(this, value);
  76470. }
  76471. };
  76472. SkipUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  76473. this.hasValue = true;
  76474. if (this.innerSubscription) {
  76475. this.innerSubscription.unsubscribe();
  76476. }
  76477. };
  76478. SkipUntilSubscriber.prototype.notifyComplete = function () {
  76479. };
  76480. return SkipUntilSubscriber;
  76481. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  76482. //# sourceMappingURL=skipUntil.js.map
  76483. /***/ }),
  76484. /***/ "./node_modules/rxjs/_esm5/internal/operators/skipWhile.js":
  76485. /*!*****************************************************************!*\
  76486. !*** ./node_modules/rxjs/_esm5/internal/operators/skipWhile.js ***!
  76487. \*****************************************************************/
  76488. /*! exports provided: skipWhile */
  76489. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76490. "use strict";
  76491. __webpack_require__.r(__webpack_exports__);
  76492. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function() { return skipWhile; });
  76493. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76494. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76495. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  76496. function skipWhile(predicate) {
  76497. return function (source) { return source.lift(new SkipWhileOperator(predicate)); };
  76498. }
  76499. var SkipWhileOperator = /*@__PURE__*/ (function () {
  76500. function SkipWhileOperator(predicate) {
  76501. this.predicate = predicate;
  76502. }
  76503. SkipWhileOperator.prototype.call = function (subscriber, source) {
  76504. return source.subscribe(new SkipWhileSubscriber(subscriber, this.predicate));
  76505. };
  76506. return SkipWhileOperator;
  76507. }());
  76508. var SkipWhileSubscriber = /*@__PURE__*/ (function (_super) {
  76509. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SkipWhileSubscriber, _super);
  76510. function SkipWhileSubscriber(destination, predicate) {
  76511. var _this = _super.call(this, destination) || this;
  76512. _this.predicate = predicate;
  76513. _this.skipping = true;
  76514. _this.index = 0;
  76515. return _this;
  76516. }
  76517. SkipWhileSubscriber.prototype._next = function (value) {
  76518. var destination = this.destination;
  76519. if (this.skipping) {
  76520. this.tryCallPredicate(value);
  76521. }
  76522. if (!this.skipping) {
  76523. destination.next(value);
  76524. }
  76525. };
  76526. SkipWhileSubscriber.prototype.tryCallPredicate = function (value) {
  76527. try {
  76528. var result = this.predicate(value, this.index++);
  76529. this.skipping = Boolean(result);
  76530. }
  76531. catch (err) {
  76532. this.destination.error(err);
  76533. }
  76534. };
  76535. return SkipWhileSubscriber;
  76536. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76537. //# sourceMappingURL=skipWhile.js.map
  76538. /***/ }),
  76539. /***/ "./node_modules/rxjs/_esm5/internal/operators/startWith.js":
  76540. /*!*****************************************************************!*\
  76541. !*** ./node_modules/rxjs/_esm5/internal/operators/startWith.js ***!
  76542. \*****************************************************************/
  76543. /*! exports provided: startWith */
  76544. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76545. "use strict";
  76546. __webpack_require__.r(__webpack_exports__);
  76547. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "startWith", function() { return startWith; });
  76548. /* harmony import */ var _observable_fromArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/fromArray */ "./node_modules/rxjs/_esm5/internal/observable/fromArray.js");
  76549. /* harmony import */ var _observable_scalar__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../observable/scalar */ "./node_modules/rxjs/_esm5/internal/observable/scalar.js");
  76550. /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  76551. /* harmony import */ var _observable_concat__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../observable/concat */ "./node_modules/rxjs/_esm5/internal/observable/concat.js");
  76552. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  76553. /** PURE_IMPORTS_START _observable_fromArray,_observable_scalar,_observable_empty,_observable_concat,_util_isScheduler PURE_IMPORTS_END */
  76554. function startWith() {
  76555. var array = [];
  76556. for (var _i = 0; _i < arguments.length; _i++) {
  76557. array[_i] = arguments[_i];
  76558. }
  76559. return function (source) {
  76560. var scheduler = array[array.length - 1];
  76561. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_4__["isScheduler"])(scheduler)) {
  76562. array.pop();
  76563. }
  76564. else {
  76565. scheduler = null;
  76566. }
  76567. var len = array.length;
  76568. if (len === 1 && !scheduler) {
  76569. return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(Object(_observable_scalar__WEBPACK_IMPORTED_MODULE_1__["scalar"])(array[0]), source);
  76570. }
  76571. else if (len > 0) {
  76572. return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(Object(_observable_fromArray__WEBPACK_IMPORTED_MODULE_0__["fromArray"])(array, scheduler), source);
  76573. }
  76574. else {
  76575. return Object(_observable_concat__WEBPACK_IMPORTED_MODULE_3__["concat"])(Object(_observable_empty__WEBPACK_IMPORTED_MODULE_2__["empty"])(scheduler), source);
  76576. }
  76577. };
  76578. }
  76579. //# sourceMappingURL=startWith.js.map
  76580. /***/ }),
  76581. /***/ "./node_modules/rxjs/_esm5/internal/operators/subscribeOn.js":
  76582. /*!*******************************************************************!*\
  76583. !*** ./node_modules/rxjs/_esm5/internal/operators/subscribeOn.js ***!
  76584. \*******************************************************************/
  76585. /*! exports provided: subscribeOn */
  76586. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76587. "use strict";
  76588. __webpack_require__.r(__webpack_exports__);
  76589. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return subscribeOn; });
  76590. /* harmony import */ var _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/SubscribeOnObservable */ "./node_modules/rxjs/_esm5/internal/observable/SubscribeOnObservable.js");
  76591. /** PURE_IMPORTS_START _observable_SubscribeOnObservable PURE_IMPORTS_END */
  76592. function subscribeOn(scheduler, delay) {
  76593. if (delay === void 0) {
  76594. delay = 0;
  76595. }
  76596. return function subscribeOnOperatorFunction(source) {
  76597. return source.lift(new SubscribeOnOperator(scheduler, delay));
  76598. };
  76599. }
  76600. var SubscribeOnOperator = /*@__PURE__*/ (function () {
  76601. function SubscribeOnOperator(scheduler, delay) {
  76602. this.scheduler = scheduler;
  76603. this.delay = delay;
  76604. }
  76605. SubscribeOnOperator.prototype.call = function (subscriber, source) {
  76606. return new _observable_SubscribeOnObservable__WEBPACK_IMPORTED_MODULE_0__["SubscribeOnObservable"](source, this.delay, this.scheduler).subscribe(subscriber);
  76607. };
  76608. return SubscribeOnOperator;
  76609. }());
  76610. //# sourceMappingURL=subscribeOn.js.map
  76611. /***/ }),
  76612. /***/ "./node_modules/rxjs/_esm5/internal/operators/switchAll.js":
  76613. /*!*****************************************************************!*\
  76614. !*** ./node_modules/rxjs/_esm5/internal/operators/switchAll.js ***!
  76615. \*****************************************************************/
  76616. /*! exports provided: switchAll */
  76617. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76618. "use strict";
  76619. __webpack_require__.r(__webpack_exports__);
  76620. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return switchAll; });
  76621. /* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./switchMap */ "./node_modules/rxjs/_esm5/internal/operators/switchMap.js");
  76622. /* harmony import */ var _util_identity__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/identity */ "./node_modules/rxjs/_esm5/internal/util/identity.js");
  76623. /** PURE_IMPORTS_START _switchMap,_util_identity PURE_IMPORTS_END */
  76624. function switchAll() {
  76625. return Object(_switchMap__WEBPACK_IMPORTED_MODULE_0__["switchMap"])(_util_identity__WEBPACK_IMPORTED_MODULE_1__["identity"]);
  76626. }
  76627. //# sourceMappingURL=switchAll.js.map
  76628. /***/ }),
  76629. /***/ "./node_modules/rxjs/_esm5/internal/operators/switchMap.js":
  76630. /*!*****************************************************************!*\
  76631. !*** ./node_modules/rxjs/_esm5/internal/operators/switchMap.js ***!
  76632. \*****************************************************************/
  76633. /*! exports provided: switchMap */
  76634. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76635. "use strict";
  76636. __webpack_require__.r(__webpack_exports__);
  76637. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMap", function() { return switchMap; });
  76638. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76639. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  76640. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  76641. /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  76642. /* harmony import */ var _observable_from__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../observable/from */ "./node_modules/rxjs/_esm5/internal/observable/from.js");
  76643. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult,_map,_observable_from PURE_IMPORTS_END */
  76644. function switchMap(project, resultSelector) {
  76645. if (typeof resultSelector === 'function') {
  76646. return function (source) { return source.pipe(switchMap(function (a, i) { return Object(_observable_from__WEBPACK_IMPORTED_MODULE_4__["from"])(project(a, i)).pipe(Object(_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (b, ii) { return resultSelector(a, b, i, ii); })); })); };
  76647. }
  76648. return function (source) { return source.lift(new SwitchMapOperator(project)); };
  76649. }
  76650. var SwitchMapOperator = /*@__PURE__*/ (function () {
  76651. function SwitchMapOperator(project) {
  76652. this.project = project;
  76653. }
  76654. SwitchMapOperator.prototype.call = function (subscriber, source) {
  76655. return source.subscribe(new SwitchMapSubscriber(subscriber, this.project));
  76656. };
  76657. return SwitchMapOperator;
  76658. }());
  76659. var SwitchMapSubscriber = /*@__PURE__*/ (function (_super) {
  76660. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](SwitchMapSubscriber, _super);
  76661. function SwitchMapSubscriber(destination, project) {
  76662. var _this = _super.call(this, destination) || this;
  76663. _this.project = project;
  76664. _this.index = 0;
  76665. return _this;
  76666. }
  76667. SwitchMapSubscriber.prototype._next = function (value) {
  76668. var result;
  76669. var index = this.index++;
  76670. try {
  76671. result = this.project(value, index);
  76672. }
  76673. catch (error) {
  76674. this.destination.error(error);
  76675. return;
  76676. }
  76677. this._innerSub(result, value, index);
  76678. };
  76679. SwitchMapSubscriber.prototype._innerSub = function (result, value, index) {
  76680. var innerSubscription = this.innerSubscription;
  76681. if (innerSubscription) {
  76682. innerSubscription.unsubscribe();
  76683. }
  76684. this.add(this.innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, result, value, index));
  76685. };
  76686. SwitchMapSubscriber.prototype._complete = function () {
  76687. var innerSubscription = this.innerSubscription;
  76688. if (!innerSubscription || innerSubscription.closed) {
  76689. _super.prototype._complete.call(this);
  76690. }
  76691. };
  76692. SwitchMapSubscriber.prototype._unsubscribe = function () {
  76693. this.innerSubscription = null;
  76694. };
  76695. SwitchMapSubscriber.prototype.notifyComplete = function (innerSub) {
  76696. this.remove(innerSub);
  76697. this.innerSubscription = null;
  76698. if (this.isStopped) {
  76699. _super.prototype._complete.call(this);
  76700. }
  76701. };
  76702. SwitchMapSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  76703. this.destination.next(innerValue);
  76704. };
  76705. return SwitchMapSubscriber;
  76706. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  76707. //# sourceMappingURL=switchMap.js.map
  76708. /***/ }),
  76709. /***/ "./node_modules/rxjs/_esm5/internal/operators/switchMapTo.js":
  76710. /*!*******************************************************************!*\
  76711. !*** ./node_modules/rxjs/_esm5/internal/operators/switchMapTo.js ***!
  76712. \*******************************************************************/
  76713. /*! exports provided: switchMapTo */
  76714. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76715. "use strict";
  76716. __webpack_require__.r(__webpack_exports__);
  76717. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return switchMapTo; });
  76718. /* harmony import */ var _switchMap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./switchMap */ "./node_modules/rxjs/_esm5/internal/operators/switchMap.js");
  76719. /** PURE_IMPORTS_START _switchMap PURE_IMPORTS_END */
  76720. function switchMapTo(innerObservable, resultSelector) {
  76721. return resultSelector ? Object(_switchMap__WEBPACK_IMPORTED_MODULE_0__["switchMap"])(function () { return innerObservable; }, resultSelector) : Object(_switchMap__WEBPACK_IMPORTED_MODULE_0__["switchMap"])(function () { return innerObservable; });
  76722. }
  76723. //# sourceMappingURL=switchMapTo.js.map
  76724. /***/ }),
  76725. /***/ "./node_modules/rxjs/_esm5/internal/operators/take.js":
  76726. /*!************************************************************!*\
  76727. !*** ./node_modules/rxjs/_esm5/internal/operators/take.js ***!
  76728. \************************************************************/
  76729. /*! exports provided: take */
  76730. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76731. "use strict";
  76732. __webpack_require__.r(__webpack_exports__);
  76733. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "take", function() { return take; });
  76734. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76735. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76736. /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js");
  76737. /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  76738. /** PURE_IMPORTS_START tslib,_Subscriber,_util_ArgumentOutOfRangeError,_observable_empty PURE_IMPORTS_END */
  76739. function take(count) {
  76740. return function (source) {
  76741. if (count === 0) {
  76742. return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_3__["empty"])();
  76743. }
  76744. else {
  76745. return source.lift(new TakeOperator(count));
  76746. }
  76747. };
  76748. }
  76749. var TakeOperator = /*@__PURE__*/ (function () {
  76750. function TakeOperator(total) {
  76751. this.total = total;
  76752. if (this.total < 0) {
  76753. throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_2__["ArgumentOutOfRangeError"];
  76754. }
  76755. }
  76756. TakeOperator.prototype.call = function (subscriber, source) {
  76757. return source.subscribe(new TakeSubscriber(subscriber, this.total));
  76758. };
  76759. return TakeOperator;
  76760. }());
  76761. var TakeSubscriber = /*@__PURE__*/ (function (_super) {
  76762. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TakeSubscriber, _super);
  76763. function TakeSubscriber(destination, total) {
  76764. var _this = _super.call(this, destination) || this;
  76765. _this.total = total;
  76766. _this.count = 0;
  76767. return _this;
  76768. }
  76769. TakeSubscriber.prototype._next = function (value) {
  76770. var total = this.total;
  76771. var count = ++this.count;
  76772. if (count <= total) {
  76773. this.destination.next(value);
  76774. if (count === total) {
  76775. this.destination.complete();
  76776. this.unsubscribe();
  76777. }
  76778. }
  76779. };
  76780. return TakeSubscriber;
  76781. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76782. //# sourceMappingURL=take.js.map
  76783. /***/ }),
  76784. /***/ "./node_modules/rxjs/_esm5/internal/operators/takeLast.js":
  76785. /*!****************************************************************!*\
  76786. !*** ./node_modules/rxjs/_esm5/internal/operators/takeLast.js ***!
  76787. \****************************************************************/
  76788. /*! exports provided: takeLast */
  76789. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76790. "use strict";
  76791. __webpack_require__.r(__webpack_exports__);
  76792. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "takeLast", function() { return takeLast; });
  76793. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76794. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76795. /* harmony import */ var _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/ArgumentOutOfRangeError */ "./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js");
  76796. /* harmony import */ var _observable_empty__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../observable/empty */ "./node_modules/rxjs/_esm5/internal/observable/empty.js");
  76797. /** PURE_IMPORTS_START tslib,_Subscriber,_util_ArgumentOutOfRangeError,_observable_empty PURE_IMPORTS_END */
  76798. function takeLast(count) {
  76799. return function takeLastOperatorFunction(source) {
  76800. if (count === 0) {
  76801. return Object(_observable_empty__WEBPACK_IMPORTED_MODULE_3__["empty"])();
  76802. }
  76803. else {
  76804. return source.lift(new TakeLastOperator(count));
  76805. }
  76806. };
  76807. }
  76808. var TakeLastOperator = /*@__PURE__*/ (function () {
  76809. function TakeLastOperator(total) {
  76810. this.total = total;
  76811. if (this.total < 0) {
  76812. throw new _util_ArgumentOutOfRangeError__WEBPACK_IMPORTED_MODULE_2__["ArgumentOutOfRangeError"];
  76813. }
  76814. }
  76815. TakeLastOperator.prototype.call = function (subscriber, source) {
  76816. return source.subscribe(new TakeLastSubscriber(subscriber, this.total));
  76817. };
  76818. return TakeLastOperator;
  76819. }());
  76820. var TakeLastSubscriber = /*@__PURE__*/ (function (_super) {
  76821. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TakeLastSubscriber, _super);
  76822. function TakeLastSubscriber(destination, total) {
  76823. var _this = _super.call(this, destination) || this;
  76824. _this.total = total;
  76825. _this.ring = new Array();
  76826. _this.count = 0;
  76827. return _this;
  76828. }
  76829. TakeLastSubscriber.prototype._next = function (value) {
  76830. var ring = this.ring;
  76831. var total = this.total;
  76832. var count = this.count++;
  76833. if (ring.length < total) {
  76834. ring.push(value);
  76835. }
  76836. else {
  76837. var index = count % total;
  76838. ring[index] = value;
  76839. }
  76840. };
  76841. TakeLastSubscriber.prototype._complete = function () {
  76842. var destination = this.destination;
  76843. var count = this.count;
  76844. if (count > 0) {
  76845. var total = this.count >= this.total ? this.total : this.count;
  76846. var ring = this.ring;
  76847. for (var i = 0; i < total; i++) {
  76848. var idx = (count++) % total;
  76849. destination.next(ring[idx]);
  76850. }
  76851. }
  76852. destination.complete();
  76853. };
  76854. return TakeLastSubscriber;
  76855. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76856. //# sourceMappingURL=takeLast.js.map
  76857. /***/ }),
  76858. /***/ "./node_modules/rxjs/_esm5/internal/operators/takeUntil.js":
  76859. /*!*****************************************************************!*\
  76860. !*** ./node_modules/rxjs/_esm5/internal/operators/takeUntil.js ***!
  76861. \*****************************************************************/
  76862. /*! exports provided: takeUntil */
  76863. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76864. "use strict";
  76865. __webpack_require__.r(__webpack_exports__);
  76866. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function() { return takeUntil; });
  76867. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76868. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  76869. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  76870. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  76871. function takeUntil(notifier) {
  76872. return function (source) { return source.lift(new TakeUntilOperator(notifier)); };
  76873. }
  76874. var TakeUntilOperator = /*@__PURE__*/ (function () {
  76875. function TakeUntilOperator(notifier) {
  76876. this.notifier = notifier;
  76877. }
  76878. TakeUntilOperator.prototype.call = function (subscriber, source) {
  76879. var takeUntilSubscriber = new TakeUntilSubscriber(subscriber);
  76880. var notifierSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(takeUntilSubscriber, this.notifier);
  76881. if (notifierSubscription && !notifierSubscription.closed) {
  76882. takeUntilSubscriber.add(notifierSubscription);
  76883. return source.subscribe(takeUntilSubscriber);
  76884. }
  76885. return takeUntilSubscriber;
  76886. };
  76887. return TakeUntilOperator;
  76888. }());
  76889. var TakeUntilSubscriber = /*@__PURE__*/ (function (_super) {
  76890. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TakeUntilSubscriber, _super);
  76891. function TakeUntilSubscriber(destination) {
  76892. return _super.call(this, destination) || this;
  76893. }
  76894. TakeUntilSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  76895. this.complete();
  76896. };
  76897. TakeUntilSubscriber.prototype.notifyComplete = function () {
  76898. };
  76899. return TakeUntilSubscriber;
  76900. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  76901. //# sourceMappingURL=takeUntil.js.map
  76902. /***/ }),
  76903. /***/ "./node_modules/rxjs/_esm5/internal/operators/takeWhile.js":
  76904. /*!*****************************************************************!*\
  76905. !*** ./node_modules/rxjs/_esm5/internal/operators/takeWhile.js ***!
  76906. \*****************************************************************/
  76907. /*! exports provided: takeWhile */
  76908. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76909. "use strict";
  76910. __webpack_require__.r(__webpack_exports__);
  76911. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function() { return takeWhile; });
  76912. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76913. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76914. /** PURE_IMPORTS_START tslib,_Subscriber PURE_IMPORTS_END */
  76915. function takeWhile(predicate) {
  76916. return function (source) { return source.lift(new TakeWhileOperator(predicate)); };
  76917. }
  76918. var TakeWhileOperator = /*@__PURE__*/ (function () {
  76919. function TakeWhileOperator(predicate) {
  76920. this.predicate = predicate;
  76921. }
  76922. TakeWhileOperator.prototype.call = function (subscriber, source) {
  76923. return source.subscribe(new TakeWhileSubscriber(subscriber, this.predicate));
  76924. };
  76925. return TakeWhileOperator;
  76926. }());
  76927. var TakeWhileSubscriber = /*@__PURE__*/ (function (_super) {
  76928. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TakeWhileSubscriber, _super);
  76929. function TakeWhileSubscriber(destination, predicate) {
  76930. var _this = _super.call(this, destination) || this;
  76931. _this.predicate = predicate;
  76932. _this.index = 0;
  76933. return _this;
  76934. }
  76935. TakeWhileSubscriber.prototype._next = function (value) {
  76936. var destination = this.destination;
  76937. var result;
  76938. try {
  76939. result = this.predicate(value, this.index++);
  76940. }
  76941. catch (err) {
  76942. destination.error(err);
  76943. return;
  76944. }
  76945. this.nextOrComplete(value, result);
  76946. };
  76947. TakeWhileSubscriber.prototype.nextOrComplete = function (value, predicateResult) {
  76948. var destination = this.destination;
  76949. if (Boolean(predicateResult)) {
  76950. destination.next(value);
  76951. }
  76952. else {
  76953. destination.complete();
  76954. }
  76955. };
  76956. return TakeWhileSubscriber;
  76957. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  76958. //# sourceMappingURL=takeWhile.js.map
  76959. /***/ }),
  76960. /***/ "./node_modules/rxjs/_esm5/internal/operators/tap.js":
  76961. /*!***********************************************************!*\
  76962. !*** ./node_modules/rxjs/_esm5/internal/operators/tap.js ***!
  76963. \***********************************************************/
  76964. /*! exports provided: tap */
  76965. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  76966. "use strict";
  76967. __webpack_require__.r(__webpack_exports__);
  76968. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return tap; });
  76969. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  76970. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  76971. /* harmony import */ var _util_noop__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/noop */ "./node_modules/rxjs/_esm5/internal/util/noop.js");
  76972. /* harmony import */ var _util_isFunction__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/isFunction */ "./node_modules/rxjs/_esm5/internal/util/isFunction.js");
  76973. /** PURE_IMPORTS_START tslib,_Subscriber,_util_noop,_util_isFunction PURE_IMPORTS_END */
  76974. function tap(nextOrObserver, error, complete) {
  76975. return function tapOperatorFunction(source) {
  76976. return source.lift(new DoOperator(nextOrObserver, error, complete));
  76977. };
  76978. }
  76979. var DoOperator = /*@__PURE__*/ (function () {
  76980. function DoOperator(nextOrObserver, error, complete) {
  76981. this.nextOrObserver = nextOrObserver;
  76982. this.error = error;
  76983. this.complete = complete;
  76984. }
  76985. DoOperator.prototype.call = function (subscriber, source) {
  76986. return source.subscribe(new TapSubscriber(subscriber, this.nextOrObserver, this.error, this.complete));
  76987. };
  76988. return DoOperator;
  76989. }());
  76990. var TapSubscriber = /*@__PURE__*/ (function (_super) {
  76991. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TapSubscriber, _super);
  76992. function TapSubscriber(destination, observerOrNext, error, complete) {
  76993. var _this = _super.call(this, destination) || this;
  76994. _this._tapNext = _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  76995. _this._tapError = _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  76996. _this._tapComplete = _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  76997. _this._tapError = error || _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  76998. _this._tapComplete = complete || _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  76999. if (Object(_util_isFunction__WEBPACK_IMPORTED_MODULE_3__["isFunction"])(observerOrNext)) {
  77000. _this._context = _this;
  77001. _this._tapNext = observerOrNext;
  77002. }
  77003. else if (observerOrNext) {
  77004. _this._context = observerOrNext;
  77005. _this._tapNext = observerOrNext.next || _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  77006. _this._tapError = observerOrNext.error || _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  77007. _this._tapComplete = observerOrNext.complete || _util_noop__WEBPACK_IMPORTED_MODULE_2__["noop"];
  77008. }
  77009. return _this;
  77010. }
  77011. TapSubscriber.prototype._next = function (value) {
  77012. try {
  77013. this._tapNext.call(this._context, value);
  77014. }
  77015. catch (err) {
  77016. this.destination.error(err);
  77017. return;
  77018. }
  77019. this.destination.next(value);
  77020. };
  77021. TapSubscriber.prototype._error = function (err) {
  77022. try {
  77023. this._tapError.call(this._context, err);
  77024. }
  77025. catch (err) {
  77026. this.destination.error(err);
  77027. return;
  77028. }
  77029. this.destination.error(err);
  77030. };
  77031. TapSubscriber.prototype._complete = function () {
  77032. try {
  77033. this._tapComplete.call(this._context);
  77034. }
  77035. catch (err) {
  77036. this.destination.error(err);
  77037. return;
  77038. }
  77039. return this.destination.complete();
  77040. };
  77041. return TapSubscriber;
  77042. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  77043. //# sourceMappingURL=tap.js.map
  77044. /***/ }),
  77045. /***/ "./node_modules/rxjs/_esm5/internal/operators/throttle.js":
  77046. /*!****************************************************************!*\
  77047. !*** ./node_modules/rxjs/_esm5/internal/operators/throttle.js ***!
  77048. \****************************************************************/
  77049. /*! exports provided: defaultThrottleConfig, throttle */
  77050. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77051. "use strict";
  77052. __webpack_require__.r(__webpack_exports__);
  77053. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "defaultThrottleConfig", function() { return defaultThrottleConfig; });
  77054. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return throttle; });
  77055. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77056. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  77057. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  77058. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  77059. var defaultThrottleConfig = {
  77060. leading: true,
  77061. trailing: false
  77062. };
  77063. function throttle(durationSelector, config) {
  77064. if (config === void 0) {
  77065. config = defaultThrottleConfig;
  77066. }
  77067. return function (source) { return source.lift(new ThrottleOperator(durationSelector, config.leading, config.trailing)); };
  77068. }
  77069. var ThrottleOperator = /*@__PURE__*/ (function () {
  77070. function ThrottleOperator(durationSelector, leading, trailing) {
  77071. this.durationSelector = durationSelector;
  77072. this.leading = leading;
  77073. this.trailing = trailing;
  77074. }
  77075. ThrottleOperator.prototype.call = function (subscriber, source) {
  77076. return source.subscribe(new ThrottleSubscriber(subscriber, this.durationSelector, this.leading, this.trailing));
  77077. };
  77078. return ThrottleOperator;
  77079. }());
  77080. var ThrottleSubscriber = /*@__PURE__*/ (function (_super) {
  77081. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ThrottleSubscriber, _super);
  77082. function ThrottleSubscriber(destination, durationSelector, _leading, _trailing) {
  77083. var _this = _super.call(this, destination) || this;
  77084. _this.destination = destination;
  77085. _this.durationSelector = durationSelector;
  77086. _this._leading = _leading;
  77087. _this._trailing = _trailing;
  77088. _this._hasValue = false;
  77089. return _this;
  77090. }
  77091. ThrottleSubscriber.prototype._next = function (value) {
  77092. this._hasValue = true;
  77093. this._sendValue = value;
  77094. if (!this._throttled) {
  77095. if (this._leading) {
  77096. this.send();
  77097. }
  77098. else {
  77099. this.throttle(value);
  77100. }
  77101. }
  77102. };
  77103. ThrottleSubscriber.prototype.send = function () {
  77104. var _a = this, _hasValue = _a._hasValue, _sendValue = _a._sendValue;
  77105. if (_hasValue) {
  77106. this.destination.next(_sendValue);
  77107. this.throttle(_sendValue);
  77108. }
  77109. this._hasValue = false;
  77110. this._sendValue = null;
  77111. };
  77112. ThrottleSubscriber.prototype.throttle = function (value) {
  77113. var duration = this.tryDurationSelector(value);
  77114. if (duration) {
  77115. this.add(this._throttled = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(this, duration));
  77116. }
  77117. };
  77118. ThrottleSubscriber.prototype.tryDurationSelector = function (value) {
  77119. try {
  77120. return this.durationSelector(value);
  77121. }
  77122. catch (err) {
  77123. this.destination.error(err);
  77124. return null;
  77125. }
  77126. };
  77127. ThrottleSubscriber.prototype.throttlingDone = function () {
  77128. var _a = this, _throttled = _a._throttled, _trailing = _a._trailing;
  77129. if (_throttled) {
  77130. _throttled.unsubscribe();
  77131. }
  77132. this._throttled = null;
  77133. if (_trailing) {
  77134. this.send();
  77135. }
  77136. };
  77137. ThrottleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  77138. this.throttlingDone();
  77139. };
  77140. ThrottleSubscriber.prototype.notifyComplete = function () {
  77141. this.throttlingDone();
  77142. };
  77143. return ThrottleSubscriber;
  77144. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  77145. //# sourceMappingURL=throttle.js.map
  77146. /***/ }),
  77147. /***/ "./node_modules/rxjs/_esm5/internal/operators/throttleTime.js":
  77148. /*!********************************************************************!*\
  77149. !*** ./node_modules/rxjs/_esm5/internal/operators/throttleTime.js ***!
  77150. \********************************************************************/
  77151. /*! exports provided: throttleTime */
  77152. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77153. "use strict";
  77154. __webpack_require__.r(__webpack_exports__);
  77155. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function() { return throttleTime; });
  77156. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77157. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  77158. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  77159. /* harmony import */ var _throttle__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./throttle */ "./node_modules/rxjs/_esm5/internal/operators/throttle.js");
  77160. /** PURE_IMPORTS_START tslib,_Subscriber,_scheduler_async,_throttle PURE_IMPORTS_END */
  77161. function throttleTime(duration, scheduler, config) {
  77162. if (scheduler === void 0) {
  77163. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_2__["async"];
  77164. }
  77165. if (config === void 0) {
  77166. config = _throttle__WEBPACK_IMPORTED_MODULE_3__["defaultThrottleConfig"];
  77167. }
  77168. return function (source) { return source.lift(new ThrottleTimeOperator(duration, scheduler, config.leading, config.trailing)); };
  77169. }
  77170. var ThrottleTimeOperator = /*@__PURE__*/ (function () {
  77171. function ThrottleTimeOperator(duration, scheduler, leading, trailing) {
  77172. this.duration = duration;
  77173. this.scheduler = scheduler;
  77174. this.leading = leading;
  77175. this.trailing = trailing;
  77176. }
  77177. ThrottleTimeOperator.prototype.call = function (subscriber, source) {
  77178. return source.subscribe(new ThrottleTimeSubscriber(subscriber, this.duration, this.scheduler, this.leading, this.trailing));
  77179. };
  77180. return ThrottleTimeOperator;
  77181. }());
  77182. var ThrottleTimeSubscriber = /*@__PURE__*/ (function (_super) {
  77183. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ThrottleTimeSubscriber, _super);
  77184. function ThrottleTimeSubscriber(destination, duration, scheduler, leading, trailing) {
  77185. var _this = _super.call(this, destination) || this;
  77186. _this.duration = duration;
  77187. _this.scheduler = scheduler;
  77188. _this.leading = leading;
  77189. _this.trailing = trailing;
  77190. _this._hasTrailingValue = false;
  77191. _this._trailingValue = null;
  77192. return _this;
  77193. }
  77194. ThrottleTimeSubscriber.prototype._next = function (value) {
  77195. if (this.throttled) {
  77196. if (this.trailing) {
  77197. this._trailingValue = value;
  77198. this._hasTrailingValue = true;
  77199. }
  77200. }
  77201. else {
  77202. this.add(this.throttled = this.scheduler.schedule(dispatchNext, this.duration, { subscriber: this }));
  77203. if (this.leading) {
  77204. this.destination.next(value);
  77205. }
  77206. }
  77207. };
  77208. ThrottleTimeSubscriber.prototype._complete = function () {
  77209. if (this._hasTrailingValue) {
  77210. this.destination.next(this._trailingValue);
  77211. this.destination.complete();
  77212. }
  77213. else {
  77214. this.destination.complete();
  77215. }
  77216. };
  77217. ThrottleTimeSubscriber.prototype.clearThrottle = function () {
  77218. var throttled = this.throttled;
  77219. if (throttled) {
  77220. if (this.trailing && this._hasTrailingValue) {
  77221. this.destination.next(this._trailingValue);
  77222. this._trailingValue = null;
  77223. this._hasTrailingValue = false;
  77224. }
  77225. throttled.unsubscribe();
  77226. this.remove(throttled);
  77227. this.throttled = null;
  77228. }
  77229. };
  77230. return ThrottleTimeSubscriber;
  77231. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  77232. function dispatchNext(arg) {
  77233. var subscriber = arg.subscriber;
  77234. subscriber.clearThrottle();
  77235. }
  77236. //# sourceMappingURL=throttleTime.js.map
  77237. /***/ }),
  77238. /***/ "./node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js":
  77239. /*!********************************************************************!*\
  77240. !*** ./node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js ***!
  77241. \********************************************************************/
  77242. /*! exports provided: throwIfEmpty */
  77243. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77244. "use strict";
  77245. __webpack_require__.r(__webpack_exports__);
  77246. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function() { return throwIfEmpty; });
  77247. /* harmony import */ var _tap__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./tap */ "./node_modules/rxjs/_esm5/internal/operators/tap.js");
  77248. /* harmony import */ var _util_EmptyError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/EmptyError */ "./node_modules/rxjs/_esm5/internal/util/EmptyError.js");
  77249. /** PURE_IMPORTS_START _tap,_util_EmptyError PURE_IMPORTS_END */
  77250. var throwIfEmpty = function (errorFactory) {
  77251. if (errorFactory === void 0) {
  77252. errorFactory = defaultErrorFactory;
  77253. }
  77254. return Object(_tap__WEBPACK_IMPORTED_MODULE_0__["tap"])({
  77255. hasValue: false,
  77256. next: function () { this.hasValue = true; },
  77257. complete: function () {
  77258. if (!this.hasValue) {
  77259. throw errorFactory();
  77260. }
  77261. }
  77262. });
  77263. };
  77264. function defaultErrorFactory() {
  77265. return new _util_EmptyError__WEBPACK_IMPORTED_MODULE_1__["EmptyError"]();
  77266. }
  77267. //# sourceMappingURL=throwIfEmpty.js.map
  77268. /***/ }),
  77269. /***/ "./node_modules/rxjs/_esm5/internal/operators/timeInterval.js":
  77270. /*!********************************************************************!*\
  77271. !*** ./node_modules/rxjs/_esm5/internal/operators/timeInterval.js ***!
  77272. \********************************************************************/
  77273. /*! exports provided: timeInterval, TimeInterval */
  77274. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77275. "use strict";
  77276. __webpack_require__.r(__webpack_exports__);
  77277. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return timeInterval; });
  77278. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeInterval", function() { return TimeInterval; });
  77279. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  77280. /* harmony import */ var _scan__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./scan */ "./node_modules/rxjs/_esm5/internal/operators/scan.js");
  77281. /* harmony import */ var _observable_defer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../observable/defer */ "./node_modules/rxjs/_esm5/internal/observable/defer.js");
  77282. /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  77283. /** PURE_IMPORTS_START _scheduler_async,_scan,_observable_defer,_map PURE_IMPORTS_END */
  77284. function timeInterval(scheduler) {
  77285. if (scheduler === void 0) {
  77286. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"];
  77287. }
  77288. return function (source) {
  77289. return Object(_observable_defer__WEBPACK_IMPORTED_MODULE_2__["defer"])(function () {
  77290. return source.pipe(Object(_scan__WEBPACK_IMPORTED_MODULE_1__["scan"])(function (_a, value) {
  77291. var current = _a.current;
  77292. return ({ value: value, current: scheduler.now(), last: current });
  77293. }, { current: scheduler.now(), value: undefined, last: undefined }), Object(_map__WEBPACK_IMPORTED_MODULE_3__["map"])(function (_a) {
  77294. var current = _a.current, last = _a.last, value = _a.value;
  77295. return new TimeInterval(value, current - last);
  77296. }));
  77297. });
  77298. };
  77299. }
  77300. var TimeInterval = /*@__PURE__*/ (function () {
  77301. function TimeInterval(value, interval) {
  77302. this.value = value;
  77303. this.interval = interval;
  77304. }
  77305. return TimeInterval;
  77306. }());
  77307. //# sourceMappingURL=timeInterval.js.map
  77308. /***/ }),
  77309. /***/ "./node_modules/rxjs/_esm5/internal/operators/timeout.js":
  77310. /*!***************************************************************!*\
  77311. !*** ./node_modules/rxjs/_esm5/internal/operators/timeout.js ***!
  77312. \***************************************************************/
  77313. /*! exports provided: timeout */
  77314. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77315. "use strict";
  77316. __webpack_require__.r(__webpack_exports__);
  77317. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return timeout; });
  77318. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  77319. /* harmony import */ var _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/TimeoutError */ "./node_modules/rxjs/_esm5/internal/util/TimeoutError.js");
  77320. /* harmony import */ var _timeoutWith__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./timeoutWith */ "./node_modules/rxjs/_esm5/internal/operators/timeoutWith.js");
  77321. /* harmony import */ var _observable_throwError__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../observable/throwError */ "./node_modules/rxjs/_esm5/internal/observable/throwError.js");
  77322. /** PURE_IMPORTS_START _scheduler_async,_util_TimeoutError,_timeoutWith,_observable_throwError PURE_IMPORTS_END */
  77323. function timeout(due, scheduler) {
  77324. if (scheduler === void 0) {
  77325. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"];
  77326. }
  77327. return Object(_timeoutWith__WEBPACK_IMPORTED_MODULE_2__["timeoutWith"])(due, Object(_observable_throwError__WEBPACK_IMPORTED_MODULE_3__["throwError"])(new _util_TimeoutError__WEBPACK_IMPORTED_MODULE_1__["TimeoutError"]()), scheduler);
  77328. }
  77329. //# sourceMappingURL=timeout.js.map
  77330. /***/ }),
  77331. /***/ "./node_modules/rxjs/_esm5/internal/operators/timeoutWith.js":
  77332. /*!*******************************************************************!*\
  77333. !*** ./node_modules/rxjs/_esm5/internal/operators/timeoutWith.js ***!
  77334. \*******************************************************************/
  77335. /*! exports provided: timeoutWith */
  77336. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77337. "use strict";
  77338. __webpack_require__.r(__webpack_exports__);
  77339. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return timeoutWith; });
  77340. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77341. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  77342. /* harmony import */ var _util_isDate__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/isDate */ "./node_modules/rxjs/_esm5/internal/util/isDate.js");
  77343. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  77344. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  77345. /** PURE_IMPORTS_START tslib,_scheduler_async,_util_isDate,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  77346. function timeoutWith(due, withObservable, scheduler) {
  77347. if (scheduler === void 0) {
  77348. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_1__["async"];
  77349. }
  77350. return function (source) {
  77351. var absoluteTimeout = Object(_util_isDate__WEBPACK_IMPORTED_MODULE_2__["isDate"])(due);
  77352. var waitFor = absoluteTimeout ? (+due - scheduler.now()) : Math.abs(due);
  77353. return source.lift(new TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler));
  77354. };
  77355. }
  77356. var TimeoutWithOperator = /*@__PURE__*/ (function () {
  77357. function TimeoutWithOperator(waitFor, absoluteTimeout, withObservable, scheduler) {
  77358. this.waitFor = waitFor;
  77359. this.absoluteTimeout = absoluteTimeout;
  77360. this.withObservable = withObservable;
  77361. this.scheduler = scheduler;
  77362. }
  77363. TimeoutWithOperator.prototype.call = function (subscriber, source) {
  77364. return source.subscribe(new TimeoutWithSubscriber(subscriber, this.absoluteTimeout, this.waitFor, this.withObservable, this.scheduler));
  77365. };
  77366. return TimeoutWithOperator;
  77367. }());
  77368. var TimeoutWithSubscriber = /*@__PURE__*/ (function (_super) {
  77369. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TimeoutWithSubscriber, _super);
  77370. function TimeoutWithSubscriber(destination, absoluteTimeout, waitFor, withObservable, scheduler) {
  77371. var _this = _super.call(this, destination) || this;
  77372. _this.absoluteTimeout = absoluteTimeout;
  77373. _this.waitFor = waitFor;
  77374. _this.withObservable = withObservable;
  77375. _this.scheduler = scheduler;
  77376. _this.action = null;
  77377. _this.scheduleTimeout();
  77378. return _this;
  77379. }
  77380. TimeoutWithSubscriber.dispatchTimeout = function (subscriber) {
  77381. var withObservable = subscriber.withObservable;
  77382. subscriber._unsubscribeAndRecycle();
  77383. subscriber.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_4__["subscribeToResult"])(subscriber, withObservable));
  77384. };
  77385. TimeoutWithSubscriber.prototype.scheduleTimeout = function () {
  77386. var action = this.action;
  77387. if (action) {
  77388. this.action = action.schedule(this, this.waitFor);
  77389. }
  77390. else {
  77391. this.add(this.action = this.scheduler.schedule(TimeoutWithSubscriber.dispatchTimeout, this.waitFor, this));
  77392. }
  77393. };
  77394. TimeoutWithSubscriber.prototype._next = function (value) {
  77395. if (!this.absoluteTimeout) {
  77396. this.scheduleTimeout();
  77397. }
  77398. _super.prototype._next.call(this, value);
  77399. };
  77400. TimeoutWithSubscriber.prototype._unsubscribe = function () {
  77401. this.action = null;
  77402. this.scheduler = null;
  77403. this.withObservable = null;
  77404. };
  77405. return TimeoutWithSubscriber;
  77406. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_3__["OuterSubscriber"]));
  77407. //# sourceMappingURL=timeoutWith.js.map
  77408. /***/ }),
  77409. /***/ "./node_modules/rxjs/_esm5/internal/operators/timestamp.js":
  77410. /*!*****************************************************************!*\
  77411. !*** ./node_modules/rxjs/_esm5/internal/operators/timestamp.js ***!
  77412. \*****************************************************************/
  77413. /*! exports provided: timestamp, Timestamp */
  77414. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77415. "use strict";
  77416. __webpack_require__.r(__webpack_exports__);
  77417. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "timestamp", function() { return timestamp; });
  77418. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Timestamp", function() { return Timestamp; });
  77419. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  77420. /* harmony import */ var _map__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  77421. /** PURE_IMPORTS_START _scheduler_async,_map PURE_IMPORTS_END */
  77422. function timestamp(scheduler) {
  77423. if (scheduler === void 0) {
  77424. scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_0__["async"];
  77425. }
  77426. return Object(_map__WEBPACK_IMPORTED_MODULE_1__["map"])(function (value) { return new Timestamp(value, scheduler.now()); });
  77427. }
  77428. var Timestamp = /*@__PURE__*/ (function () {
  77429. function Timestamp(value, timestamp) {
  77430. this.value = value;
  77431. this.timestamp = timestamp;
  77432. }
  77433. return Timestamp;
  77434. }());
  77435. //# sourceMappingURL=timestamp.js.map
  77436. /***/ }),
  77437. /***/ "./node_modules/rxjs/_esm5/internal/operators/toArray.js":
  77438. /*!***************************************************************!*\
  77439. !*** ./node_modules/rxjs/_esm5/internal/operators/toArray.js ***!
  77440. \***************************************************************/
  77441. /*! exports provided: toArray */
  77442. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77443. "use strict";
  77444. __webpack_require__.r(__webpack_exports__);
  77445. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return toArray; });
  77446. /* harmony import */ var _reduce__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./reduce */ "./node_modules/rxjs/_esm5/internal/operators/reduce.js");
  77447. /** PURE_IMPORTS_START _reduce PURE_IMPORTS_END */
  77448. function toArrayReducer(arr, item, index) {
  77449. if (index === 0) {
  77450. return [item];
  77451. }
  77452. arr.push(item);
  77453. return arr;
  77454. }
  77455. function toArray() {
  77456. return Object(_reduce__WEBPACK_IMPORTED_MODULE_0__["reduce"])(toArrayReducer, []);
  77457. }
  77458. //# sourceMappingURL=toArray.js.map
  77459. /***/ }),
  77460. /***/ "./node_modules/rxjs/_esm5/internal/operators/window.js":
  77461. /*!**************************************************************!*\
  77462. !*** ./node_modules/rxjs/_esm5/internal/operators/window.js ***!
  77463. \**************************************************************/
  77464. /*! exports provided: window */
  77465. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77466. "use strict";
  77467. __webpack_require__.r(__webpack_exports__);
  77468. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "window", function() { return window; });
  77469. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77470. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  77471. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  77472. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  77473. /** PURE_IMPORTS_START tslib,_Subject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  77474. function window(windowBoundaries) {
  77475. return function windowOperatorFunction(source) {
  77476. return source.lift(new WindowOperator(windowBoundaries));
  77477. };
  77478. }
  77479. var WindowOperator = /*@__PURE__*/ (function () {
  77480. function WindowOperator(windowBoundaries) {
  77481. this.windowBoundaries = windowBoundaries;
  77482. }
  77483. WindowOperator.prototype.call = function (subscriber, source) {
  77484. var windowSubscriber = new WindowSubscriber(subscriber);
  77485. var sourceSubscription = source.subscribe(windowSubscriber);
  77486. if (!sourceSubscription.closed) {
  77487. windowSubscriber.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_3__["subscribeToResult"])(windowSubscriber, this.windowBoundaries));
  77488. }
  77489. return sourceSubscription;
  77490. };
  77491. return WindowOperator;
  77492. }());
  77493. var WindowSubscriber = /*@__PURE__*/ (function (_super) {
  77494. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WindowSubscriber, _super);
  77495. function WindowSubscriber(destination) {
  77496. var _this = _super.call(this, destination) || this;
  77497. _this.window = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]();
  77498. destination.next(_this.window);
  77499. return _this;
  77500. }
  77501. WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  77502. this.openWindow();
  77503. };
  77504. WindowSubscriber.prototype.notifyError = function (error, innerSub) {
  77505. this._error(error);
  77506. };
  77507. WindowSubscriber.prototype.notifyComplete = function (innerSub) {
  77508. this._complete();
  77509. };
  77510. WindowSubscriber.prototype._next = function (value) {
  77511. this.window.next(value);
  77512. };
  77513. WindowSubscriber.prototype._error = function (err) {
  77514. this.window.error(err);
  77515. this.destination.error(err);
  77516. };
  77517. WindowSubscriber.prototype._complete = function () {
  77518. this.window.complete();
  77519. this.destination.complete();
  77520. };
  77521. WindowSubscriber.prototype._unsubscribe = function () {
  77522. this.window = null;
  77523. };
  77524. WindowSubscriber.prototype.openWindow = function () {
  77525. var prevWindow = this.window;
  77526. if (prevWindow) {
  77527. prevWindow.complete();
  77528. }
  77529. var destination = this.destination;
  77530. var newWindow = this.window = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]();
  77531. destination.next(newWindow);
  77532. };
  77533. return WindowSubscriber;
  77534. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_2__["OuterSubscriber"]));
  77535. //# sourceMappingURL=window.js.map
  77536. /***/ }),
  77537. /***/ "./node_modules/rxjs/_esm5/internal/operators/windowCount.js":
  77538. /*!*******************************************************************!*\
  77539. !*** ./node_modules/rxjs/_esm5/internal/operators/windowCount.js ***!
  77540. \*******************************************************************/
  77541. /*! exports provided: windowCount */
  77542. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77543. "use strict";
  77544. __webpack_require__.r(__webpack_exports__);
  77545. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowCount", function() { return windowCount; });
  77546. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77547. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  77548. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  77549. /** PURE_IMPORTS_START tslib,_Subscriber,_Subject PURE_IMPORTS_END */
  77550. function windowCount(windowSize, startWindowEvery) {
  77551. if (startWindowEvery === void 0) {
  77552. startWindowEvery = 0;
  77553. }
  77554. return function windowCountOperatorFunction(source) {
  77555. return source.lift(new WindowCountOperator(windowSize, startWindowEvery));
  77556. };
  77557. }
  77558. var WindowCountOperator = /*@__PURE__*/ (function () {
  77559. function WindowCountOperator(windowSize, startWindowEvery) {
  77560. this.windowSize = windowSize;
  77561. this.startWindowEvery = startWindowEvery;
  77562. }
  77563. WindowCountOperator.prototype.call = function (subscriber, source) {
  77564. return source.subscribe(new WindowCountSubscriber(subscriber, this.windowSize, this.startWindowEvery));
  77565. };
  77566. return WindowCountOperator;
  77567. }());
  77568. var WindowCountSubscriber = /*@__PURE__*/ (function (_super) {
  77569. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WindowCountSubscriber, _super);
  77570. function WindowCountSubscriber(destination, windowSize, startWindowEvery) {
  77571. var _this = _super.call(this, destination) || this;
  77572. _this.destination = destination;
  77573. _this.windowSize = windowSize;
  77574. _this.startWindowEvery = startWindowEvery;
  77575. _this.windows = [new _Subject__WEBPACK_IMPORTED_MODULE_2__["Subject"]()];
  77576. _this.count = 0;
  77577. destination.next(_this.windows[0]);
  77578. return _this;
  77579. }
  77580. WindowCountSubscriber.prototype._next = function (value) {
  77581. var startWindowEvery = (this.startWindowEvery > 0) ? this.startWindowEvery : this.windowSize;
  77582. var destination = this.destination;
  77583. var windowSize = this.windowSize;
  77584. var windows = this.windows;
  77585. var len = windows.length;
  77586. for (var i = 0; i < len && !this.closed; i++) {
  77587. windows[i].next(value);
  77588. }
  77589. var c = this.count - windowSize + 1;
  77590. if (c >= 0 && c % startWindowEvery === 0 && !this.closed) {
  77591. windows.shift().complete();
  77592. }
  77593. if (++this.count % startWindowEvery === 0 && !this.closed) {
  77594. var window_1 = new _Subject__WEBPACK_IMPORTED_MODULE_2__["Subject"]();
  77595. windows.push(window_1);
  77596. destination.next(window_1);
  77597. }
  77598. };
  77599. WindowCountSubscriber.prototype._error = function (err) {
  77600. var windows = this.windows;
  77601. if (windows) {
  77602. while (windows.length > 0 && !this.closed) {
  77603. windows.shift().error(err);
  77604. }
  77605. }
  77606. this.destination.error(err);
  77607. };
  77608. WindowCountSubscriber.prototype._complete = function () {
  77609. var windows = this.windows;
  77610. if (windows) {
  77611. while (windows.length > 0 && !this.closed) {
  77612. windows.shift().complete();
  77613. }
  77614. }
  77615. this.destination.complete();
  77616. };
  77617. WindowCountSubscriber.prototype._unsubscribe = function () {
  77618. this.count = 0;
  77619. this.windows = null;
  77620. };
  77621. return WindowCountSubscriber;
  77622. }(_Subscriber__WEBPACK_IMPORTED_MODULE_1__["Subscriber"]));
  77623. //# sourceMappingURL=windowCount.js.map
  77624. /***/ }),
  77625. /***/ "./node_modules/rxjs/_esm5/internal/operators/windowTime.js":
  77626. /*!******************************************************************!*\
  77627. !*** ./node_modules/rxjs/_esm5/internal/operators/windowTime.js ***!
  77628. \******************************************************************/
  77629. /*! exports provided: windowTime */
  77630. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77631. "use strict";
  77632. __webpack_require__.r(__webpack_exports__);
  77633. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowTime", function() { return windowTime; });
  77634. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77635. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  77636. /* harmony import */ var _scheduler_async__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../scheduler/async */ "./node_modules/rxjs/_esm5/internal/scheduler/async.js");
  77637. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  77638. /* harmony import */ var _util_isNumeric__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/isNumeric */ "./node_modules/rxjs/_esm5/internal/util/isNumeric.js");
  77639. /* harmony import */ var _util_isScheduler__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/isScheduler */ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js");
  77640. /** PURE_IMPORTS_START tslib,_Subject,_scheduler_async,_Subscriber,_util_isNumeric,_util_isScheduler PURE_IMPORTS_END */
  77641. function windowTime(windowTimeSpan) {
  77642. var scheduler = _scheduler_async__WEBPACK_IMPORTED_MODULE_2__["async"];
  77643. var windowCreationInterval = null;
  77644. var maxWindowSize = Number.POSITIVE_INFINITY;
  77645. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_5__["isScheduler"])(arguments[3])) {
  77646. scheduler = arguments[3];
  77647. }
  77648. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_5__["isScheduler"])(arguments[2])) {
  77649. scheduler = arguments[2];
  77650. }
  77651. else if (Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_4__["isNumeric"])(arguments[2])) {
  77652. maxWindowSize = arguments[2];
  77653. }
  77654. if (Object(_util_isScheduler__WEBPACK_IMPORTED_MODULE_5__["isScheduler"])(arguments[1])) {
  77655. scheduler = arguments[1];
  77656. }
  77657. else if (Object(_util_isNumeric__WEBPACK_IMPORTED_MODULE_4__["isNumeric"])(arguments[1])) {
  77658. windowCreationInterval = arguments[1];
  77659. }
  77660. return function windowTimeOperatorFunction(source) {
  77661. return source.lift(new WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler));
  77662. };
  77663. }
  77664. var WindowTimeOperator = /*@__PURE__*/ (function () {
  77665. function WindowTimeOperator(windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) {
  77666. this.windowTimeSpan = windowTimeSpan;
  77667. this.windowCreationInterval = windowCreationInterval;
  77668. this.maxWindowSize = maxWindowSize;
  77669. this.scheduler = scheduler;
  77670. }
  77671. WindowTimeOperator.prototype.call = function (subscriber, source) {
  77672. return source.subscribe(new WindowTimeSubscriber(subscriber, this.windowTimeSpan, this.windowCreationInterval, this.maxWindowSize, this.scheduler));
  77673. };
  77674. return WindowTimeOperator;
  77675. }());
  77676. var CountedSubject = /*@__PURE__*/ (function (_super) {
  77677. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](CountedSubject, _super);
  77678. function CountedSubject() {
  77679. var _this = _super !== null && _super.apply(this, arguments) || this;
  77680. _this._numberOfNextedValues = 0;
  77681. return _this;
  77682. }
  77683. CountedSubject.prototype.next = function (value) {
  77684. this._numberOfNextedValues++;
  77685. _super.prototype.next.call(this, value);
  77686. };
  77687. Object.defineProperty(CountedSubject.prototype, "numberOfNextedValues", {
  77688. get: function () {
  77689. return this._numberOfNextedValues;
  77690. },
  77691. enumerable: true,
  77692. configurable: true
  77693. });
  77694. return CountedSubject;
  77695. }(_Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]));
  77696. var WindowTimeSubscriber = /*@__PURE__*/ (function (_super) {
  77697. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WindowTimeSubscriber, _super);
  77698. function WindowTimeSubscriber(destination, windowTimeSpan, windowCreationInterval, maxWindowSize, scheduler) {
  77699. var _this = _super.call(this, destination) || this;
  77700. _this.destination = destination;
  77701. _this.windowTimeSpan = windowTimeSpan;
  77702. _this.windowCreationInterval = windowCreationInterval;
  77703. _this.maxWindowSize = maxWindowSize;
  77704. _this.scheduler = scheduler;
  77705. _this.windows = [];
  77706. var window = _this.openWindow();
  77707. if (windowCreationInterval !== null && windowCreationInterval >= 0) {
  77708. var closeState = { subscriber: _this, window: window, context: null };
  77709. var creationState = { windowTimeSpan: windowTimeSpan, windowCreationInterval: windowCreationInterval, subscriber: _this, scheduler: scheduler };
  77710. _this.add(scheduler.schedule(dispatchWindowClose, windowTimeSpan, closeState));
  77711. _this.add(scheduler.schedule(dispatchWindowCreation, windowCreationInterval, creationState));
  77712. }
  77713. else {
  77714. var timeSpanOnlyState = { subscriber: _this, window: window, windowTimeSpan: windowTimeSpan };
  77715. _this.add(scheduler.schedule(dispatchWindowTimeSpanOnly, windowTimeSpan, timeSpanOnlyState));
  77716. }
  77717. return _this;
  77718. }
  77719. WindowTimeSubscriber.prototype._next = function (value) {
  77720. var windows = this.windows;
  77721. var len = windows.length;
  77722. for (var i = 0; i < len; i++) {
  77723. var window_1 = windows[i];
  77724. if (!window_1.closed) {
  77725. window_1.next(value);
  77726. if (window_1.numberOfNextedValues >= this.maxWindowSize) {
  77727. this.closeWindow(window_1);
  77728. }
  77729. }
  77730. }
  77731. };
  77732. WindowTimeSubscriber.prototype._error = function (err) {
  77733. var windows = this.windows;
  77734. while (windows.length > 0) {
  77735. windows.shift().error(err);
  77736. }
  77737. this.destination.error(err);
  77738. };
  77739. WindowTimeSubscriber.prototype._complete = function () {
  77740. var windows = this.windows;
  77741. while (windows.length > 0) {
  77742. var window_2 = windows.shift();
  77743. if (!window_2.closed) {
  77744. window_2.complete();
  77745. }
  77746. }
  77747. this.destination.complete();
  77748. };
  77749. WindowTimeSubscriber.prototype.openWindow = function () {
  77750. var window = new CountedSubject();
  77751. this.windows.push(window);
  77752. var destination = this.destination;
  77753. destination.next(window);
  77754. return window;
  77755. };
  77756. WindowTimeSubscriber.prototype.closeWindow = function (window) {
  77757. window.complete();
  77758. var windows = this.windows;
  77759. windows.splice(windows.indexOf(window), 1);
  77760. };
  77761. return WindowTimeSubscriber;
  77762. }(_Subscriber__WEBPACK_IMPORTED_MODULE_3__["Subscriber"]));
  77763. function dispatchWindowTimeSpanOnly(state) {
  77764. var subscriber = state.subscriber, windowTimeSpan = state.windowTimeSpan, window = state.window;
  77765. if (window) {
  77766. subscriber.closeWindow(window);
  77767. }
  77768. state.window = subscriber.openWindow();
  77769. this.schedule(state, windowTimeSpan);
  77770. }
  77771. function dispatchWindowCreation(state) {
  77772. var windowTimeSpan = state.windowTimeSpan, subscriber = state.subscriber, scheduler = state.scheduler, windowCreationInterval = state.windowCreationInterval;
  77773. var window = subscriber.openWindow();
  77774. var action = this;
  77775. var context = { action: action, subscription: null };
  77776. var timeSpanState = { subscriber: subscriber, window: window, context: context };
  77777. context.subscription = scheduler.schedule(dispatchWindowClose, windowTimeSpan, timeSpanState);
  77778. action.add(context.subscription);
  77779. action.schedule(state, windowCreationInterval);
  77780. }
  77781. function dispatchWindowClose(state) {
  77782. var subscriber = state.subscriber, window = state.window, context = state.context;
  77783. if (context && context.action && context.subscription) {
  77784. context.action.remove(context.subscription);
  77785. }
  77786. subscriber.closeWindow(window);
  77787. }
  77788. //# sourceMappingURL=windowTime.js.map
  77789. /***/ }),
  77790. /***/ "./node_modules/rxjs/_esm5/internal/operators/windowToggle.js":
  77791. /*!********************************************************************!*\
  77792. !*** ./node_modules/rxjs/_esm5/internal/operators/windowToggle.js ***!
  77793. \********************************************************************/
  77794. /*! exports provided: windowToggle */
  77795. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77796. "use strict";
  77797. __webpack_require__.r(__webpack_exports__);
  77798. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function() { return windowToggle; });
  77799. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77800. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  77801. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  77802. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  77803. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  77804. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  77805. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  77806. /** PURE_IMPORTS_START tslib,_Subject,_Subscription,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  77807. function windowToggle(openings, closingSelector) {
  77808. return function (source) { return source.lift(new WindowToggleOperator(openings, closingSelector)); };
  77809. }
  77810. var WindowToggleOperator = /*@__PURE__*/ (function () {
  77811. function WindowToggleOperator(openings, closingSelector) {
  77812. this.openings = openings;
  77813. this.closingSelector = closingSelector;
  77814. }
  77815. WindowToggleOperator.prototype.call = function (subscriber, source) {
  77816. return source.subscribe(new WindowToggleSubscriber(subscriber, this.openings, this.closingSelector));
  77817. };
  77818. return WindowToggleOperator;
  77819. }());
  77820. var WindowToggleSubscriber = /*@__PURE__*/ (function (_super) {
  77821. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WindowToggleSubscriber, _super);
  77822. function WindowToggleSubscriber(destination, openings, closingSelector) {
  77823. var _this = _super.call(this, destination) || this;
  77824. _this.openings = openings;
  77825. _this.closingSelector = closingSelector;
  77826. _this.contexts = [];
  77827. _this.add(_this.openSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_6__["subscribeToResult"])(_this, openings, openings));
  77828. return _this;
  77829. }
  77830. WindowToggleSubscriber.prototype._next = function (value) {
  77831. var contexts = this.contexts;
  77832. if (contexts) {
  77833. var len = contexts.length;
  77834. for (var i = 0; i < len; i++) {
  77835. contexts[i].window.next(value);
  77836. }
  77837. }
  77838. };
  77839. WindowToggleSubscriber.prototype._error = function (err) {
  77840. var contexts = this.contexts;
  77841. this.contexts = null;
  77842. if (contexts) {
  77843. var len = contexts.length;
  77844. var index = -1;
  77845. while (++index < len) {
  77846. var context_1 = contexts[index];
  77847. context_1.window.error(err);
  77848. context_1.subscription.unsubscribe();
  77849. }
  77850. }
  77851. _super.prototype._error.call(this, err);
  77852. };
  77853. WindowToggleSubscriber.prototype._complete = function () {
  77854. var contexts = this.contexts;
  77855. this.contexts = null;
  77856. if (contexts) {
  77857. var len = contexts.length;
  77858. var index = -1;
  77859. while (++index < len) {
  77860. var context_2 = contexts[index];
  77861. context_2.window.complete();
  77862. context_2.subscription.unsubscribe();
  77863. }
  77864. }
  77865. _super.prototype._complete.call(this);
  77866. };
  77867. WindowToggleSubscriber.prototype._unsubscribe = function () {
  77868. var contexts = this.contexts;
  77869. this.contexts = null;
  77870. if (contexts) {
  77871. var len = contexts.length;
  77872. var index = -1;
  77873. while (++index < len) {
  77874. var context_3 = contexts[index];
  77875. context_3.window.unsubscribe();
  77876. context_3.subscription.unsubscribe();
  77877. }
  77878. }
  77879. };
  77880. WindowToggleSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  77881. if (outerValue === this.openings) {
  77882. var closingSelector = this.closingSelector;
  77883. var closingNotifier = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_3__["tryCatch"])(closingSelector)(innerValue);
  77884. if (closingNotifier === _util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"]) {
  77885. return this.error(_util_errorObject__WEBPACK_IMPORTED_MODULE_4__["errorObject"].e);
  77886. }
  77887. else {
  77888. var window_1 = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]();
  77889. var subscription = new _Subscription__WEBPACK_IMPORTED_MODULE_2__["Subscription"]();
  77890. var context_4 = { window: window_1, subscription: subscription };
  77891. this.contexts.push(context_4);
  77892. var innerSubscription = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_6__["subscribeToResult"])(this, closingNotifier, context_4);
  77893. if (innerSubscription.closed) {
  77894. this.closeWindow(this.contexts.length - 1);
  77895. }
  77896. else {
  77897. innerSubscription.context = context_4;
  77898. subscription.add(innerSubscription);
  77899. }
  77900. this.destination.next(window_1);
  77901. }
  77902. }
  77903. else {
  77904. this.closeWindow(this.contexts.indexOf(outerValue));
  77905. }
  77906. };
  77907. WindowToggleSubscriber.prototype.notifyError = function (err) {
  77908. this.error(err);
  77909. };
  77910. WindowToggleSubscriber.prototype.notifyComplete = function (inner) {
  77911. if (inner !== this.openSubscription) {
  77912. this.closeWindow(this.contexts.indexOf(inner.context));
  77913. }
  77914. };
  77915. WindowToggleSubscriber.prototype.closeWindow = function (index) {
  77916. if (index === -1) {
  77917. return;
  77918. }
  77919. var contexts = this.contexts;
  77920. var context = contexts[index];
  77921. var window = context.window, subscription = context.subscription;
  77922. contexts.splice(index, 1);
  77923. window.complete();
  77924. subscription.unsubscribe();
  77925. };
  77926. return WindowToggleSubscriber;
  77927. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_5__["OuterSubscriber"]));
  77928. //# sourceMappingURL=windowToggle.js.map
  77929. /***/ }),
  77930. /***/ "./node_modules/rxjs/_esm5/internal/operators/windowWhen.js":
  77931. /*!******************************************************************!*\
  77932. !*** ./node_modules/rxjs/_esm5/internal/operators/windowWhen.js ***!
  77933. \******************************************************************/
  77934. /*! exports provided: windowWhen */
  77935. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  77936. "use strict";
  77937. __webpack_require__.r(__webpack_exports__);
  77938. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function() { return windowWhen; });
  77939. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  77940. /* harmony import */ var _Subject__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subject */ "./node_modules/rxjs/_esm5/internal/Subject.js");
  77941. /* harmony import */ var _util_tryCatch__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/tryCatch */ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js");
  77942. /* harmony import */ var _util_errorObject__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../util/errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  77943. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  77944. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  77945. /** PURE_IMPORTS_START tslib,_Subject,_util_tryCatch,_util_errorObject,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  77946. function windowWhen(closingSelector) {
  77947. return function windowWhenOperatorFunction(source) {
  77948. return source.lift(new WindowOperator(closingSelector));
  77949. };
  77950. }
  77951. var WindowOperator = /*@__PURE__*/ (function () {
  77952. function WindowOperator(closingSelector) {
  77953. this.closingSelector = closingSelector;
  77954. }
  77955. WindowOperator.prototype.call = function (subscriber, source) {
  77956. return source.subscribe(new WindowSubscriber(subscriber, this.closingSelector));
  77957. };
  77958. return WindowOperator;
  77959. }());
  77960. var WindowSubscriber = /*@__PURE__*/ (function (_super) {
  77961. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WindowSubscriber, _super);
  77962. function WindowSubscriber(destination, closingSelector) {
  77963. var _this = _super.call(this, destination) || this;
  77964. _this.destination = destination;
  77965. _this.closingSelector = closingSelector;
  77966. _this.openWindow();
  77967. return _this;
  77968. }
  77969. WindowSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  77970. this.openWindow(innerSub);
  77971. };
  77972. WindowSubscriber.prototype.notifyError = function (error, innerSub) {
  77973. this._error(error);
  77974. };
  77975. WindowSubscriber.prototype.notifyComplete = function (innerSub) {
  77976. this.openWindow(innerSub);
  77977. };
  77978. WindowSubscriber.prototype._next = function (value) {
  77979. this.window.next(value);
  77980. };
  77981. WindowSubscriber.prototype._error = function (err) {
  77982. this.window.error(err);
  77983. this.destination.error(err);
  77984. this.unsubscribeClosingNotification();
  77985. };
  77986. WindowSubscriber.prototype._complete = function () {
  77987. this.window.complete();
  77988. this.destination.complete();
  77989. this.unsubscribeClosingNotification();
  77990. };
  77991. WindowSubscriber.prototype.unsubscribeClosingNotification = function () {
  77992. if (this.closingNotification) {
  77993. this.closingNotification.unsubscribe();
  77994. }
  77995. };
  77996. WindowSubscriber.prototype.openWindow = function (innerSub) {
  77997. if (innerSub === void 0) {
  77998. innerSub = null;
  77999. }
  78000. if (innerSub) {
  78001. this.remove(innerSub);
  78002. innerSub.unsubscribe();
  78003. }
  78004. var prevWindow = this.window;
  78005. if (prevWindow) {
  78006. prevWindow.complete();
  78007. }
  78008. var window = this.window = new _Subject__WEBPACK_IMPORTED_MODULE_1__["Subject"]();
  78009. this.destination.next(window);
  78010. var closingNotifier = Object(_util_tryCatch__WEBPACK_IMPORTED_MODULE_2__["tryCatch"])(this.closingSelector)();
  78011. if (closingNotifier === _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"]) {
  78012. var err = _util_errorObject__WEBPACK_IMPORTED_MODULE_3__["errorObject"].e;
  78013. this.destination.error(err);
  78014. this.window.error(err);
  78015. }
  78016. else {
  78017. this.add(this.closingNotification = Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_5__["subscribeToResult"])(this, closingNotifier));
  78018. }
  78019. };
  78020. return WindowSubscriber;
  78021. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_4__["OuterSubscriber"]));
  78022. //# sourceMappingURL=windowWhen.js.map
  78023. /***/ }),
  78024. /***/ "./node_modules/rxjs/_esm5/internal/operators/withLatestFrom.js":
  78025. /*!**********************************************************************!*\
  78026. !*** ./node_modules/rxjs/_esm5/internal/operators/withLatestFrom.js ***!
  78027. \**********************************************************************/
  78028. /*! exports provided: withLatestFrom */
  78029. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78030. "use strict";
  78031. __webpack_require__.r(__webpack_exports__);
  78032. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function() { return withLatestFrom; });
  78033. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78034. /* harmony import */ var _OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../OuterSubscriber */ "./node_modules/rxjs/_esm5/internal/OuterSubscriber.js");
  78035. /* harmony import */ var _util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../util/subscribeToResult */ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js");
  78036. /** PURE_IMPORTS_START tslib,_OuterSubscriber,_util_subscribeToResult PURE_IMPORTS_END */
  78037. function withLatestFrom() {
  78038. var args = [];
  78039. for (var _i = 0; _i < arguments.length; _i++) {
  78040. args[_i] = arguments[_i];
  78041. }
  78042. return function (source) {
  78043. var project;
  78044. if (typeof args[args.length - 1] === 'function') {
  78045. project = args.pop();
  78046. }
  78047. var observables = args;
  78048. return source.lift(new WithLatestFromOperator(observables, project));
  78049. };
  78050. }
  78051. var WithLatestFromOperator = /*@__PURE__*/ (function () {
  78052. function WithLatestFromOperator(observables, project) {
  78053. this.observables = observables;
  78054. this.project = project;
  78055. }
  78056. WithLatestFromOperator.prototype.call = function (subscriber, source) {
  78057. return source.subscribe(new WithLatestFromSubscriber(subscriber, this.observables, this.project));
  78058. };
  78059. return WithLatestFromOperator;
  78060. }());
  78061. var WithLatestFromSubscriber = /*@__PURE__*/ (function (_super) {
  78062. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](WithLatestFromSubscriber, _super);
  78063. function WithLatestFromSubscriber(destination, observables, project) {
  78064. var _this = _super.call(this, destination) || this;
  78065. _this.observables = observables;
  78066. _this.project = project;
  78067. _this.toRespond = [];
  78068. var len = observables.length;
  78069. _this.values = new Array(len);
  78070. for (var i = 0; i < len; i++) {
  78071. _this.toRespond.push(i);
  78072. }
  78073. for (var i = 0; i < len; i++) {
  78074. var observable = observables[i];
  78075. _this.add(Object(_util_subscribeToResult__WEBPACK_IMPORTED_MODULE_2__["subscribeToResult"])(_this, observable, observable, i));
  78076. }
  78077. return _this;
  78078. }
  78079. WithLatestFromSubscriber.prototype.notifyNext = function (outerValue, innerValue, outerIndex, innerIndex, innerSub) {
  78080. this.values[outerIndex] = innerValue;
  78081. var toRespond = this.toRespond;
  78082. if (toRespond.length > 0) {
  78083. var found = toRespond.indexOf(outerIndex);
  78084. if (found !== -1) {
  78085. toRespond.splice(found, 1);
  78086. }
  78087. }
  78088. };
  78089. WithLatestFromSubscriber.prototype.notifyComplete = function () {
  78090. };
  78091. WithLatestFromSubscriber.prototype._next = function (value) {
  78092. if (this.toRespond.length === 0) {
  78093. var args = [value].concat(this.values);
  78094. if (this.project) {
  78095. this._tryProject(args);
  78096. }
  78097. else {
  78098. this.destination.next(args);
  78099. }
  78100. }
  78101. };
  78102. WithLatestFromSubscriber.prototype._tryProject = function (args) {
  78103. var result;
  78104. try {
  78105. result = this.project.apply(this, args);
  78106. }
  78107. catch (err) {
  78108. this.destination.error(err);
  78109. return;
  78110. }
  78111. this.destination.next(result);
  78112. };
  78113. return WithLatestFromSubscriber;
  78114. }(_OuterSubscriber__WEBPACK_IMPORTED_MODULE_1__["OuterSubscriber"]));
  78115. //# sourceMappingURL=withLatestFrom.js.map
  78116. /***/ }),
  78117. /***/ "./node_modules/rxjs/_esm5/internal/operators/zip.js":
  78118. /*!***********************************************************!*\
  78119. !*** ./node_modules/rxjs/_esm5/internal/operators/zip.js ***!
  78120. \***********************************************************/
  78121. /*! exports provided: zip */
  78122. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78123. "use strict";
  78124. __webpack_require__.r(__webpack_exports__);
  78125. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return zip; });
  78126. /* harmony import */ var _observable_zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/zip */ "./node_modules/rxjs/_esm5/internal/observable/zip.js");
  78127. /** PURE_IMPORTS_START _observable_zip PURE_IMPORTS_END */
  78128. function zip() {
  78129. var observables = [];
  78130. for (var _i = 0; _i < arguments.length; _i++) {
  78131. observables[_i] = arguments[_i];
  78132. }
  78133. return function zipOperatorFunction(source) {
  78134. return source.lift.call(_observable_zip__WEBPACK_IMPORTED_MODULE_0__["zip"].apply(void 0, [source].concat(observables)));
  78135. };
  78136. }
  78137. //# sourceMappingURL=zip.js.map
  78138. /***/ }),
  78139. /***/ "./node_modules/rxjs/_esm5/internal/operators/zipAll.js":
  78140. /*!**************************************************************!*\
  78141. !*** ./node_modules/rxjs/_esm5/internal/operators/zipAll.js ***!
  78142. \**************************************************************/
  78143. /*! exports provided: zipAll */
  78144. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78145. "use strict";
  78146. __webpack_require__.r(__webpack_exports__);
  78147. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "zipAll", function() { return zipAll; });
  78148. /* harmony import */ var _observable_zip__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../observable/zip */ "./node_modules/rxjs/_esm5/internal/observable/zip.js");
  78149. /** PURE_IMPORTS_START _observable_zip PURE_IMPORTS_END */
  78150. function zipAll(project) {
  78151. return function (source) { return source.lift(new _observable_zip__WEBPACK_IMPORTED_MODULE_0__["ZipOperator"](project)); };
  78152. }
  78153. //# sourceMappingURL=zipAll.js.map
  78154. /***/ }),
  78155. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/Action.js":
  78156. /*!**************************************************************!*\
  78157. !*** ./node_modules/rxjs/_esm5/internal/scheduler/Action.js ***!
  78158. \**************************************************************/
  78159. /*! exports provided: Action */
  78160. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78161. "use strict";
  78162. __webpack_require__.r(__webpack_exports__);
  78163. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Action", function() { return Action; });
  78164. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78165. /* harmony import */ var _Subscription__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Subscription */ "./node_modules/rxjs/_esm5/internal/Subscription.js");
  78166. /** PURE_IMPORTS_START tslib,_Subscription PURE_IMPORTS_END */
  78167. var Action = /*@__PURE__*/ (function (_super) {
  78168. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](Action, _super);
  78169. function Action(scheduler, work) {
  78170. return _super.call(this) || this;
  78171. }
  78172. Action.prototype.schedule = function (state, delay) {
  78173. if (delay === void 0) {
  78174. delay = 0;
  78175. }
  78176. return this;
  78177. };
  78178. return Action;
  78179. }(_Subscription__WEBPACK_IMPORTED_MODULE_1__["Subscription"]));
  78180. //# sourceMappingURL=Action.js.map
  78181. /***/ }),
  78182. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameAction.js":
  78183. /*!****************************************************************************!*\
  78184. !*** ./node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameAction.js ***!
  78185. \****************************************************************************/
  78186. /*! exports provided: AnimationFrameAction */
  78187. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78188. "use strict";
  78189. __webpack_require__.r(__webpack_exports__);
  78190. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFrameAction", function() { return AnimationFrameAction; });
  78191. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78192. /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js");
  78193. /** PURE_IMPORTS_START tslib,_AsyncAction PURE_IMPORTS_END */
  78194. var AnimationFrameAction = /*@__PURE__*/ (function (_super) {
  78195. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AnimationFrameAction, _super);
  78196. function AnimationFrameAction(scheduler, work) {
  78197. var _this = _super.call(this, scheduler, work) || this;
  78198. _this.scheduler = scheduler;
  78199. _this.work = work;
  78200. return _this;
  78201. }
  78202. AnimationFrameAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  78203. if (delay === void 0) {
  78204. delay = 0;
  78205. }
  78206. if (delay !== null && delay > 0) {
  78207. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  78208. }
  78209. scheduler.actions.push(this);
  78210. return scheduler.scheduled || (scheduler.scheduled = requestAnimationFrame(function () { return scheduler.flush(null); }));
  78211. };
  78212. AnimationFrameAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  78213. if (delay === void 0) {
  78214. delay = 0;
  78215. }
  78216. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  78217. return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
  78218. }
  78219. if (scheduler.actions.length === 0) {
  78220. cancelAnimationFrame(id);
  78221. scheduler.scheduled = undefined;
  78222. }
  78223. return undefined;
  78224. };
  78225. return AnimationFrameAction;
  78226. }(_AsyncAction__WEBPACK_IMPORTED_MODULE_1__["AsyncAction"]));
  78227. //# sourceMappingURL=AnimationFrameAction.js.map
  78228. /***/ }),
  78229. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameScheduler.js":
  78230. /*!*******************************************************************************!*\
  78231. !*** ./node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameScheduler.js ***!
  78232. \*******************************************************************************/
  78233. /*! exports provided: AnimationFrameScheduler */
  78234. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78235. "use strict";
  78236. __webpack_require__.r(__webpack_exports__);
  78237. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AnimationFrameScheduler", function() { return AnimationFrameScheduler; });
  78238. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78239. /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js");
  78240. /** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */
  78241. var AnimationFrameScheduler = /*@__PURE__*/ (function (_super) {
  78242. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AnimationFrameScheduler, _super);
  78243. function AnimationFrameScheduler() {
  78244. return _super !== null && _super.apply(this, arguments) || this;
  78245. }
  78246. AnimationFrameScheduler.prototype.flush = function (action) {
  78247. this.active = true;
  78248. this.scheduled = undefined;
  78249. var actions = this.actions;
  78250. var error;
  78251. var index = -1;
  78252. var count = actions.length;
  78253. action = action || actions.shift();
  78254. do {
  78255. if (error = action.execute(action.state, action.delay)) {
  78256. break;
  78257. }
  78258. } while (++index < count && (action = actions.shift()));
  78259. this.active = false;
  78260. if (error) {
  78261. while (++index < count && (action = actions.shift())) {
  78262. action.unsubscribe();
  78263. }
  78264. throw error;
  78265. }
  78266. };
  78267. return AnimationFrameScheduler;
  78268. }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__["AsyncScheduler"]));
  78269. //# sourceMappingURL=AnimationFrameScheduler.js.map
  78270. /***/ }),
  78271. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/AsapAction.js":
  78272. /*!******************************************************************!*\
  78273. !*** ./node_modules/rxjs/_esm5/internal/scheduler/AsapAction.js ***!
  78274. \******************************************************************/
  78275. /*! exports provided: AsapAction */
  78276. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78277. "use strict";
  78278. __webpack_require__.r(__webpack_exports__);
  78279. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsapAction", function() { return AsapAction; });
  78280. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78281. /* harmony import */ var _util_Immediate__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../util/Immediate */ "./node_modules/rxjs/_esm5/internal/util/Immediate.js");
  78282. /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AsyncAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js");
  78283. /** PURE_IMPORTS_START tslib,_util_Immediate,_AsyncAction PURE_IMPORTS_END */
  78284. var AsapAction = /*@__PURE__*/ (function (_super) {
  78285. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AsapAction, _super);
  78286. function AsapAction(scheduler, work) {
  78287. var _this = _super.call(this, scheduler, work) || this;
  78288. _this.scheduler = scheduler;
  78289. _this.work = work;
  78290. return _this;
  78291. }
  78292. AsapAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  78293. if (delay === void 0) {
  78294. delay = 0;
  78295. }
  78296. if (delay !== null && delay > 0) {
  78297. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  78298. }
  78299. scheduler.actions.push(this);
  78300. return scheduler.scheduled || (scheduler.scheduled = _util_Immediate__WEBPACK_IMPORTED_MODULE_1__["Immediate"].setImmediate(scheduler.flush.bind(scheduler, null)));
  78301. };
  78302. AsapAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  78303. if (delay === void 0) {
  78304. delay = 0;
  78305. }
  78306. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  78307. return _super.prototype.recycleAsyncId.call(this, scheduler, id, delay);
  78308. }
  78309. if (scheduler.actions.length === 0) {
  78310. _util_Immediate__WEBPACK_IMPORTED_MODULE_1__["Immediate"].clearImmediate(id);
  78311. scheduler.scheduled = undefined;
  78312. }
  78313. return undefined;
  78314. };
  78315. return AsapAction;
  78316. }(_AsyncAction__WEBPACK_IMPORTED_MODULE_2__["AsyncAction"]));
  78317. //# sourceMappingURL=AsapAction.js.map
  78318. /***/ }),
  78319. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/AsapScheduler.js":
  78320. /*!*********************************************************************!*\
  78321. !*** ./node_modules/rxjs/_esm5/internal/scheduler/AsapScheduler.js ***!
  78322. \*********************************************************************/
  78323. /*! exports provided: AsapScheduler */
  78324. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78325. "use strict";
  78326. __webpack_require__.r(__webpack_exports__);
  78327. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsapScheduler", function() { return AsapScheduler; });
  78328. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78329. /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js");
  78330. /** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */
  78331. var AsapScheduler = /*@__PURE__*/ (function (_super) {
  78332. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AsapScheduler, _super);
  78333. function AsapScheduler() {
  78334. return _super !== null && _super.apply(this, arguments) || this;
  78335. }
  78336. AsapScheduler.prototype.flush = function (action) {
  78337. this.active = true;
  78338. this.scheduled = undefined;
  78339. var actions = this.actions;
  78340. var error;
  78341. var index = -1;
  78342. var count = actions.length;
  78343. action = action || actions.shift();
  78344. do {
  78345. if (error = action.execute(action.state, action.delay)) {
  78346. break;
  78347. }
  78348. } while (++index < count && (action = actions.shift()));
  78349. this.active = false;
  78350. if (error) {
  78351. while (++index < count && (action = actions.shift())) {
  78352. action.unsubscribe();
  78353. }
  78354. throw error;
  78355. }
  78356. };
  78357. return AsapScheduler;
  78358. }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__["AsyncScheduler"]));
  78359. //# sourceMappingURL=AsapScheduler.js.map
  78360. /***/ }),
  78361. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js":
  78362. /*!*******************************************************************!*\
  78363. !*** ./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js ***!
  78364. \*******************************************************************/
  78365. /*! exports provided: AsyncAction */
  78366. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78367. "use strict";
  78368. __webpack_require__.r(__webpack_exports__);
  78369. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncAction", function() { return AsyncAction; });
  78370. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78371. /* harmony import */ var _Action__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./Action */ "./node_modules/rxjs/_esm5/internal/scheduler/Action.js");
  78372. /** PURE_IMPORTS_START tslib,_Action PURE_IMPORTS_END */
  78373. var AsyncAction = /*@__PURE__*/ (function (_super) {
  78374. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AsyncAction, _super);
  78375. function AsyncAction(scheduler, work) {
  78376. var _this = _super.call(this, scheduler, work) || this;
  78377. _this.scheduler = scheduler;
  78378. _this.work = work;
  78379. _this.pending = false;
  78380. return _this;
  78381. }
  78382. AsyncAction.prototype.schedule = function (state, delay) {
  78383. if (delay === void 0) {
  78384. delay = 0;
  78385. }
  78386. if (this.closed) {
  78387. return this;
  78388. }
  78389. this.state = state;
  78390. var id = this.id;
  78391. var scheduler = this.scheduler;
  78392. if (id != null) {
  78393. this.id = this.recycleAsyncId(scheduler, id, delay);
  78394. }
  78395. this.pending = true;
  78396. this.delay = delay;
  78397. this.id = this.id || this.requestAsyncId(scheduler, this.id, delay);
  78398. return this;
  78399. };
  78400. AsyncAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  78401. if (delay === void 0) {
  78402. delay = 0;
  78403. }
  78404. return setInterval(scheduler.flush.bind(scheduler, this), delay);
  78405. };
  78406. AsyncAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  78407. if (delay === void 0) {
  78408. delay = 0;
  78409. }
  78410. if (delay !== null && this.delay === delay && this.pending === false) {
  78411. return id;
  78412. }
  78413. return clearInterval(id) && undefined || undefined;
  78414. };
  78415. AsyncAction.prototype.execute = function (state, delay) {
  78416. if (this.closed) {
  78417. return new Error('executing a cancelled action');
  78418. }
  78419. this.pending = false;
  78420. var error = this._execute(state, delay);
  78421. if (error) {
  78422. return error;
  78423. }
  78424. else if (this.pending === false && this.id != null) {
  78425. this.id = this.recycleAsyncId(this.scheduler, this.id, null);
  78426. }
  78427. };
  78428. AsyncAction.prototype._execute = function (state, delay) {
  78429. var errored = false;
  78430. var errorValue = undefined;
  78431. try {
  78432. this.work(state);
  78433. }
  78434. catch (e) {
  78435. errored = true;
  78436. errorValue = !!e && e || new Error(e);
  78437. }
  78438. if (errored) {
  78439. this.unsubscribe();
  78440. return errorValue;
  78441. }
  78442. };
  78443. AsyncAction.prototype._unsubscribe = function () {
  78444. var id = this.id;
  78445. var scheduler = this.scheduler;
  78446. var actions = scheduler.actions;
  78447. var index = actions.indexOf(this);
  78448. this.work = null;
  78449. this.state = null;
  78450. this.pending = false;
  78451. this.scheduler = null;
  78452. if (index !== -1) {
  78453. actions.splice(index, 1);
  78454. }
  78455. if (id != null) {
  78456. this.id = this.recycleAsyncId(scheduler, id, null);
  78457. }
  78458. this.delay = null;
  78459. };
  78460. return AsyncAction;
  78461. }(_Action__WEBPACK_IMPORTED_MODULE_1__["Action"]));
  78462. //# sourceMappingURL=AsyncAction.js.map
  78463. /***/ }),
  78464. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js":
  78465. /*!**********************************************************************!*\
  78466. !*** ./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js ***!
  78467. \**********************************************************************/
  78468. /*! exports provided: AsyncScheduler */
  78469. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78470. "use strict";
  78471. __webpack_require__.r(__webpack_exports__);
  78472. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "AsyncScheduler", function() { return AsyncScheduler; });
  78473. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78474. /* harmony import */ var _Scheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../Scheduler */ "./node_modules/rxjs/_esm5/internal/Scheduler.js");
  78475. /** PURE_IMPORTS_START tslib,_Scheduler PURE_IMPORTS_END */
  78476. var AsyncScheduler = /*@__PURE__*/ (function (_super) {
  78477. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](AsyncScheduler, _super);
  78478. function AsyncScheduler(SchedulerAction, now) {
  78479. if (now === void 0) {
  78480. now = _Scheduler__WEBPACK_IMPORTED_MODULE_1__["Scheduler"].now;
  78481. }
  78482. var _this = _super.call(this, SchedulerAction, function () {
  78483. if (AsyncScheduler.delegate && AsyncScheduler.delegate !== _this) {
  78484. return AsyncScheduler.delegate.now();
  78485. }
  78486. else {
  78487. return now();
  78488. }
  78489. }) || this;
  78490. _this.actions = [];
  78491. _this.active = false;
  78492. _this.scheduled = undefined;
  78493. return _this;
  78494. }
  78495. AsyncScheduler.prototype.schedule = function (work, delay, state) {
  78496. if (delay === void 0) {
  78497. delay = 0;
  78498. }
  78499. if (AsyncScheduler.delegate && AsyncScheduler.delegate !== this) {
  78500. return AsyncScheduler.delegate.schedule(work, delay, state);
  78501. }
  78502. else {
  78503. return _super.prototype.schedule.call(this, work, delay, state);
  78504. }
  78505. };
  78506. AsyncScheduler.prototype.flush = function (action) {
  78507. var actions = this.actions;
  78508. if (this.active) {
  78509. actions.push(action);
  78510. return;
  78511. }
  78512. var error;
  78513. this.active = true;
  78514. do {
  78515. if (error = action.execute(action.state, action.delay)) {
  78516. break;
  78517. }
  78518. } while (action = actions.shift());
  78519. this.active = false;
  78520. if (error) {
  78521. while (action = actions.shift()) {
  78522. action.unsubscribe();
  78523. }
  78524. throw error;
  78525. }
  78526. };
  78527. return AsyncScheduler;
  78528. }(_Scheduler__WEBPACK_IMPORTED_MODULE_1__["Scheduler"]));
  78529. //# sourceMappingURL=AsyncScheduler.js.map
  78530. /***/ }),
  78531. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/QueueAction.js":
  78532. /*!*******************************************************************!*\
  78533. !*** ./node_modules/rxjs/_esm5/internal/scheduler/QueueAction.js ***!
  78534. \*******************************************************************/
  78535. /*! exports provided: QueueAction */
  78536. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78537. "use strict";
  78538. __webpack_require__.r(__webpack_exports__);
  78539. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueueAction", function() { return QueueAction; });
  78540. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78541. /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js");
  78542. /** PURE_IMPORTS_START tslib,_AsyncAction PURE_IMPORTS_END */
  78543. var QueueAction = /*@__PURE__*/ (function (_super) {
  78544. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](QueueAction, _super);
  78545. function QueueAction(scheduler, work) {
  78546. var _this = _super.call(this, scheduler, work) || this;
  78547. _this.scheduler = scheduler;
  78548. _this.work = work;
  78549. return _this;
  78550. }
  78551. QueueAction.prototype.schedule = function (state, delay) {
  78552. if (delay === void 0) {
  78553. delay = 0;
  78554. }
  78555. if (delay > 0) {
  78556. return _super.prototype.schedule.call(this, state, delay);
  78557. }
  78558. this.delay = delay;
  78559. this.state = state;
  78560. this.scheduler.flush(this);
  78561. return this;
  78562. };
  78563. QueueAction.prototype.execute = function (state, delay) {
  78564. return (delay > 0 || this.closed) ?
  78565. _super.prototype.execute.call(this, state, delay) :
  78566. this._execute(state, delay);
  78567. };
  78568. QueueAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  78569. if (delay === void 0) {
  78570. delay = 0;
  78571. }
  78572. if ((delay !== null && delay > 0) || (delay === null && this.delay > 0)) {
  78573. return _super.prototype.requestAsyncId.call(this, scheduler, id, delay);
  78574. }
  78575. return scheduler.flush(this);
  78576. };
  78577. return QueueAction;
  78578. }(_AsyncAction__WEBPACK_IMPORTED_MODULE_1__["AsyncAction"]));
  78579. //# sourceMappingURL=QueueAction.js.map
  78580. /***/ }),
  78581. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/QueueScheduler.js":
  78582. /*!**********************************************************************!*\
  78583. !*** ./node_modules/rxjs/_esm5/internal/scheduler/QueueScheduler.js ***!
  78584. \**********************************************************************/
  78585. /*! exports provided: QueueScheduler */
  78586. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78587. "use strict";
  78588. __webpack_require__.r(__webpack_exports__);
  78589. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "QueueScheduler", function() { return QueueScheduler; });
  78590. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78591. /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js");
  78592. /** PURE_IMPORTS_START tslib,_AsyncScheduler PURE_IMPORTS_END */
  78593. var QueueScheduler = /*@__PURE__*/ (function (_super) {
  78594. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](QueueScheduler, _super);
  78595. function QueueScheduler() {
  78596. return _super !== null && _super.apply(this, arguments) || this;
  78597. }
  78598. return QueueScheduler;
  78599. }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__["AsyncScheduler"]));
  78600. //# sourceMappingURL=QueueScheduler.js.map
  78601. /***/ }),
  78602. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/VirtualTimeScheduler.js":
  78603. /*!****************************************************************************!*\
  78604. !*** ./node_modules/rxjs/_esm5/internal/scheduler/VirtualTimeScheduler.js ***!
  78605. \****************************************************************************/
  78606. /*! exports provided: VirtualTimeScheduler, VirtualAction */
  78607. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78608. "use strict";
  78609. __webpack_require__.r(__webpack_exports__);
  78610. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VirtualTimeScheduler", function() { return VirtualTimeScheduler; });
  78611. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "VirtualAction", function() { return VirtualAction; });
  78612. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78613. /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js");
  78614. /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./AsyncScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js");
  78615. /** PURE_IMPORTS_START tslib,_AsyncAction,_AsyncScheduler PURE_IMPORTS_END */
  78616. var VirtualTimeScheduler = /*@__PURE__*/ (function (_super) {
  78617. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](VirtualTimeScheduler, _super);
  78618. function VirtualTimeScheduler(SchedulerAction, maxFrames) {
  78619. if (SchedulerAction === void 0) {
  78620. SchedulerAction = VirtualAction;
  78621. }
  78622. if (maxFrames === void 0) {
  78623. maxFrames = Number.POSITIVE_INFINITY;
  78624. }
  78625. var _this = _super.call(this, SchedulerAction, function () { return _this.frame; }) || this;
  78626. _this.maxFrames = maxFrames;
  78627. _this.frame = 0;
  78628. _this.index = -1;
  78629. return _this;
  78630. }
  78631. VirtualTimeScheduler.prototype.flush = function () {
  78632. var _a = this, actions = _a.actions, maxFrames = _a.maxFrames;
  78633. var error, action;
  78634. while ((action = actions.shift()) && (this.frame = action.delay) <= maxFrames) {
  78635. if (error = action.execute(action.state, action.delay)) {
  78636. break;
  78637. }
  78638. }
  78639. if (error) {
  78640. while (action = actions.shift()) {
  78641. action.unsubscribe();
  78642. }
  78643. throw error;
  78644. }
  78645. };
  78646. VirtualTimeScheduler.frameTimeFactor = 10;
  78647. return VirtualTimeScheduler;
  78648. }(_AsyncScheduler__WEBPACK_IMPORTED_MODULE_2__["AsyncScheduler"]));
  78649. var VirtualAction = /*@__PURE__*/ (function (_super) {
  78650. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](VirtualAction, _super);
  78651. function VirtualAction(scheduler, work, index) {
  78652. if (index === void 0) {
  78653. index = scheduler.index += 1;
  78654. }
  78655. var _this = _super.call(this, scheduler, work) || this;
  78656. _this.scheduler = scheduler;
  78657. _this.work = work;
  78658. _this.index = index;
  78659. _this.active = true;
  78660. _this.index = scheduler.index = index;
  78661. return _this;
  78662. }
  78663. VirtualAction.prototype.schedule = function (state, delay) {
  78664. if (delay === void 0) {
  78665. delay = 0;
  78666. }
  78667. if (!this.id) {
  78668. return _super.prototype.schedule.call(this, state, delay);
  78669. }
  78670. this.active = false;
  78671. var action = new VirtualAction(this.scheduler, this.work);
  78672. this.add(action);
  78673. return action.schedule(state, delay);
  78674. };
  78675. VirtualAction.prototype.requestAsyncId = function (scheduler, id, delay) {
  78676. if (delay === void 0) {
  78677. delay = 0;
  78678. }
  78679. this.delay = scheduler.frame + delay;
  78680. var actions = scheduler.actions;
  78681. actions.push(this);
  78682. actions.sort(VirtualAction.sortActions);
  78683. return true;
  78684. };
  78685. VirtualAction.prototype.recycleAsyncId = function (scheduler, id, delay) {
  78686. if (delay === void 0) {
  78687. delay = 0;
  78688. }
  78689. return undefined;
  78690. };
  78691. VirtualAction.prototype._execute = function (state, delay) {
  78692. if (this.active === true) {
  78693. return _super.prototype._execute.call(this, state, delay);
  78694. }
  78695. };
  78696. VirtualAction.sortActions = function (a, b) {
  78697. if (a.delay === b.delay) {
  78698. if (a.index === b.index) {
  78699. return 0;
  78700. }
  78701. else if (a.index > b.index) {
  78702. return 1;
  78703. }
  78704. else {
  78705. return -1;
  78706. }
  78707. }
  78708. else if (a.delay > b.delay) {
  78709. return 1;
  78710. }
  78711. else {
  78712. return -1;
  78713. }
  78714. };
  78715. return VirtualAction;
  78716. }(_AsyncAction__WEBPACK_IMPORTED_MODULE_1__["AsyncAction"]));
  78717. //# sourceMappingURL=VirtualTimeScheduler.js.map
  78718. /***/ }),
  78719. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/animationFrame.js":
  78720. /*!**********************************************************************!*\
  78721. !*** ./node_modules/rxjs/_esm5/internal/scheduler/animationFrame.js ***!
  78722. \**********************************************************************/
  78723. /*! exports provided: animationFrame */
  78724. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78725. "use strict";
  78726. __webpack_require__.r(__webpack_exports__);
  78727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "animationFrame", function() { return animationFrame; });
  78728. /* harmony import */ var _AnimationFrameAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AnimationFrameAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameAction.js");
  78729. /* harmony import */ var _AnimationFrameScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AnimationFrameScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AnimationFrameScheduler.js");
  78730. /** PURE_IMPORTS_START _AnimationFrameAction,_AnimationFrameScheduler PURE_IMPORTS_END */
  78731. var animationFrame = /*@__PURE__*/ new _AnimationFrameScheduler__WEBPACK_IMPORTED_MODULE_1__["AnimationFrameScheduler"](_AnimationFrameAction__WEBPACK_IMPORTED_MODULE_0__["AnimationFrameAction"]);
  78732. //# sourceMappingURL=animationFrame.js.map
  78733. /***/ }),
  78734. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/asap.js":
  78735. /*!************************************************************!*\
  78736. !*** ./node_modules/rxjs/_esm5/internal/scheduler/asap.js ***!
  78737. \************************************************************/
  78738. /*! exports provided: asap */
  78739. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78740. "use strict";
  78741. __webpack_require__.r(__webpack_exports__);
  78742. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "asap", function() { return asap; });
  78743. /* harmony import */ var _AsapAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AsapAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AsapAction.js");
  78744. /* harmony import */ var _AsapScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsapScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AsapScheduler.js");
  78745. /** PURE_IMPORTS_START _AsapAction,_AsapScheduler PURE_IMPORTS_END */
  78746. var asap = /*@__PURE__*/ new _AsapScheduler__WEBPACK_IMPORTED_MODULE_1__["AsapScheduler"](_AsapAction__WEBPACK_IMPORTED_MODULE_0__["AsapAction"]);
  78747. //# sourceMappingURL=asap.js.map
  78748. /***/ }),
  78749. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/async.js":
  78750. /*!*************************************************************!*\
  78751. !*** ./node_modules/rxjs/_esm5/internal/scheduler/async.js ***!
  78752. \*************************************************************/
  78753. /*! exports provided: async */
  78754. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78755. "use strict";
  78756. __webpack_require__.r(__webpack_exports__);
  78757. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "async", function() { return async; });
  78758. /* harmony import */ var _AsyncAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./AsyncAction */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncAction.js");
  78759. /* harmony import */ var _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./AsyncScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/AsyncScheduler.js");
  78760. /** PURE_IMPORTS_START _AsyncAction,_AsyncScheduler PURE_IMPORTS_END */
  78761. var async = /*@__PURE__*/ new _AsyncScheduler__WEBPACK_IMPORTED_MODULE_1__["AsyncScheduler"](_AsyncAction__WEBPACK_IMPORTED_MODULE_0__["AsyncAction"]);
  78762. //# sourceMappingURL=async.js.map
  78763. /***/ }),
  78764. /***/ "./node_modules/rxjs/_esm5/internal/scheduler/queue.js":
  78765. /*!*************************************************************!*\
  78766. !*** ./node_modules/rxjs/_esm5/internal/scheduler/queue.js ***!
  78767. \*************************************************************/
  78768. /*! exports provided: queue */
  78769. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78770. "use strict";
  78771. __webpack_require__.r(__webpack_exports__);
  78772. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "queue", function() { return queue; });
  78773. /* harmony import */ var _QueueAction__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./QueueAction */ "./node_modules/rxjs/_esm5/internal/scheduler/QueueAction.js");
  78774. /* harmony import */ var _QueueScheduler__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./QueueScheduler */ "./node_modules/rxjs/_esm5/internal/scheduler/QueueScheduler.js");
  78775. /** PURE_IMPORTS_START _QueueAction,_QueueScheduler PURE_IMPORTS_END */
  78776. var queue = /*@__PURE__*/ new _QueueScheduler__WEBPACK_IMPORTED_MODULE_1__["QueueScheduler"](_QueueAction__WEBPACK_IMPORTED_MODULE_0__["QueueAction"]);
  78777. //# sourceMappingURL=queue.js.map
  78778. /***/ }),
  78779. /***/ "./node_modules/rxjs/_esm5/internal/symbol/iterator.js":
  78780. /*!*************************************************************!*\
  78781. !*** ./node_modules/rxjs/_esm5/internal/symbol/iterator.js ***!
  78782. \*************************************************************/
  78783. /*! exports provided: getSymbolIterator, iterator, $$iterator */
  78784. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78785. "use strict";
  78786. __webpack_require__.r(__webpack_exports__);
  78787. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "getSymbolIterator", function() { return getSymbolIterator; });
  78788. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "iterator", function() { return iterator; });
  78789. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$$iterator", function() { return $$iterator; });
  78790. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  78791. function getSymbolIterator() {
  78792. if (typeof Symbol !== 'function' || !Symbol.iterator) {
  78793. return '@@iterator';
  78794. }
  78795. return Symbol.iterator;
  78796. }
  78797. var iterator = /*@__PURE__*/ getSymbolIterator();
  78798. var $$iterator = iterator;
  78799. //# sourceMappingURL=iterator.js.map
  78800. /***/ }),
  78801. /***/ "./node_modules/rxjs/_esm5/internal/symbol/observable.js":
  78802. /*!***************************************************************!*\
  78803. !*** ./node_modules/rxjs/_esm5/internal/symbol/observable.js ***!
  78804. \***************************************************************/
  78805. /*! exports provided: observable */
  78806. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78807. "use strict";
  78808. __webpack_require__.r(__webpack_exports__);
  78809. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "observable", function() { return observable; });
  78810. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  78811. var observable = typeof Symbol === 'function' && Symbol.observable || '@@observable';
  78812. //# sourceMappingURL=observable.js.map
  78813. /***/ }),
  78814. /***/ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js":
  78815. /*!*****************************************************************!*\
  78816. !*** ./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js ***!
  78817. \*****************************************************************/
  78818. /*! exports provided: rxSubscriber, $$rxSubscriber */
  78819. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78820. "use strict";
  78821. __webpack_require__.r(__webpack_exports__);
  78822. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "rxSubscriber", function() { return rxSubscriber; });
  78823. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "$$rxSubscriber", function() { return $$rxSubscriber; });
  78824. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  78825. var rxSubscriber = (typeof Symbol === 'function' && typeof Symbol.for === 'function')
  78826. ? /*@__PURE__*/ Symbol.for('rxSubscriber')
  78827. : '@@rxSubscriber';
  78828. var $$rxSubscriber = rxSubscriber;
  78829. //# sourceMappingURL=rxSubscriber.js.map
  78830. /***/ }),
  78831. /***/ "./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js":
  78832. /*!**************************************************************************!*\
  78833. !*** ./node_modules/rxjs/_esm5/internal/util/ArgumentOutOfRangeError.js ***!
  78834. \**************************************************************************/
  78835. /*! exports provided: ArgumentOutOfRangeError */
  78836. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78837. "use strict";
  78838. __webpack_require__.r(__webpack_exports__);
  78839. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ArgumentOutOfRangeError", function() { return ArgumentOutOfRangeError; });
  78840. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78841. /** PURE_IMPORTS_START tslib PURE_IMPORTS_END */
  78842. var ArgumentOutOfRangeError = /*@__PURE__*/ (function (_super) {
  78843. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ArgumentOutOfRangeError, _super);
  78844. function ArgumentOutOfRangeError() {
  78845. var _this = _super.call(this, 'argument out of range') || this;
  78846. _this.name = 'ArgumentOutOfRangeError';
  78847. Object.setPrototypeOf(_this, ArgumentOutOfRangeError.prototype);
  78848. return _this;
  78849. }
  78850. return ArgumentOutOfRangeError;
  78851. }(Error));
  78852. //# sourceMappingURL=ArgumentOutOfRangeError.js.map
  78853. /***/ }),
  78854. /***/ "./node_modules/rxjs/_esm5/internal/util/EmptyError.js":
  78855. /*!*************************************************************!*\
  78856. !*** ./node_modules/rxjs/_esm5/internal/util/EmptyError.js ***!
  78857. \*************************************************************/
  78858. /*! exports provided: EmptyError */
  78859. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78860. "use strict";
  78861. __webpack_require__.r(__webpack_exports__);
  78862. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "EmptyError", function() { return EmptyError; });
  78863. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78864. /** PURE_IMPORTS_START tslib PURE_IMPORTS_END */
  78865. var EmptyError = /*@__PURE__*/ (function (_super) {
  78866. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](EmptyError, _super);
  78867. function EmptyError() {
  78868. var _this = _super.call(this, 'no elements in sequence') || this;
  78869. _this.name = 'EmptyError';
  78870. Object.setPrototypeOf(_this, EmptyError.prototype);
  78871. return _this;
  78872. }
  78873. return EmptyError;
  78874. }(Error));
  78875. //# sourceMappingURL=EmptyError.js.map
  78876. /***/ }),
  78877. /***/ "./node_modules/rxjs/_esm5/internal/util/Immediate.js":
  78878. /*!************************************************************!*\
  78879. !*** ./node_modules/rxjs/_esm5/internal/util/Immediate.js ***!
  78880. \************************************************************/
  78881. /*! exports provided: Immediate */
  78882. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78883. "use strict";
  78884. __webpack_require__.r(__webpack_exports__);
  78885. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "Immediate", function() { return Immediate; });
  78886. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  78887. var nextHandle = 1;
  78888. var tasksByHandle = {};
  78889. function runIfPresent(handle) {
  78890. var cb = tasksByHandle[handle];
  78891. if (cb) {
  78892. cb();
  78893. }
  78894. }
  78895. var Immediate = {
  78896. setImmediate: function (cb) {
  78897. var handle = nextHandle++;
  78898. tasksByHandle[handle] = cb;
  78899. Promise.resolve().then(function () { return runIfPresent(handle); });
  78900. return handle;
  78901. },
  78902. clearImmediate: function (handle) {
  78903. delete tasksByHandle[handle];
  78904. },
  78905. };
  78906. //# sourceMappingURL=Immediate.js.map
  78907. /***/ }),
  78908. /***/ "./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js":
  78909. /*!**************************************************************************!*\
  78910. !*** ./node_modules/rxjs/_esm5/internal/util/ObjectUnsubscribedError.js ***!
  78911. \**************************************************************************/
  78912. /*! exports provided: ObjectUnsubscribedError */
  78913. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78914. "use strict";
  78915. __webpack_require__.r(__webpack_exports__);
  78916. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "ObjectUnsubscribedError", function() { return ObjectUnsubscribedError; });
  78917. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78918. /** PURE_IMPORTS_START tslib PURE_IMPORTS_END */
  78919. var ObjectUnsubscribedError = /*@__PURE__*/ (function (_super) {
  78920. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](ObjectUnsubscribedError, _super);
  78921. function ObjectUnsubscribedError() {
  78922. var _this = _super.call(this, 'object unsubscribed') || this;
  78923. _this.name = 'ObjectUnsubscribedError';
  78924. Object.setPrototypeOf(_this, ObjectUnsubscribedError.prototype);
  78925. return _this;
  78926. }
  78927. return ObjectUnsubscribedError;
  78928. }(Error));
  78929. //# sourceMappingURL=ObjectUnsubscribedError.js.map
  78930. /***/ }),
  78931. /***/ "./node_modules/rxjs/_esm5/internal/util/TimeoutError.js":
  78932. /*!***************************************************************!*\
  78933. !*** ./node_modules/rxjs/_esm5/internal/util/TimeoutError.js ***!
  78934. \***************************************************************/
  78935. /*! exports provided: TimeoutError */
  78936. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78937. "use strict";
  78938. __webpack_require__.r(__webpack_exports__);
  78939. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "TimeoutError", function() { return TimeoutError; });
  78940. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78941. /** PURE_IMPORTS_START tslib PURE_IMPORTS_END */
  78942. var TimeoutError = /*@__PURE__*/ (function (_super) {
  78943. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](TimeoutError, _super);
  78944. function TimeoutError() {
  78945. var _this = _super.call(this, 'Timeout has occurred') || this;
  78946. _this.name = 'TimeoutError';
  78947. Object.setPrototypeOf(_this, TimeoutError.prototype);
  78948. return _this;
  78949. }
  78950. return TimeoutError;
  78951. }(Error));
  78952. //# sourceMappingURL=TimeoutError.js.map
  78953. /***/ }),
  78954. /***/ "./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js":
  78955. /*!**********************************************************************!*\
  78956. !*** ./node_modules/rxjs/_esm5/internal/util/UnsubscriptionError.js ***!
  78957. \**********************************************************************/
  78958. /*! exports provided: UnsubscriptionError */
  78959. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78960. "use strict";
  78961. __webpack_require__.r(__webpack_exports__);
  78962. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "UnsubscriptionError", function() { return UnsubscriptionError; });
  78963. /* harmony import */ var tslib__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! tslib */ "./node_modules/tslib/tslib.es6.js");
  78964. /** PURE_IMPORTS_START tslib PURE_IMPORTS_END */
  78965. var UnsubscriptionError = /*@__PURE__*/ (function (_super) {
  78966. tslib__WEBPACK_IMPORTED_MODULE_0__["__extends"](UnsubscriptionError, _super);
  78967. function UnsubscriptionError(errors) {
  78968. var _this = _super.call(this, errors ?
  78969. errors.length + " errors occurred during unsubscription:\n " + errors.map(function (err, i) { return i + 1 + ") " + err.toString(); }).join('\n ') : '') || this;
  78970. _this.errors = errors;
  78971. _this.name = 'UnsubscriptionError';
  78972. Object.setPrototypeOf(_this, UnsubscriptionError.prototype);
  78973. return _this;
  78974. }
  78975. return UnsubscriptionError;
  78976. }(Error));
  78977. //# sourceMappingURL=UnsubscriptionError.js.map
  78978. /***/ }),
  78979. /***/ "./node_modules/rxjs/_esm5/internal/util/errorObject.js":
  78980. /*!**************************************************************!*\
  78981. !*** ./node_modules/rxjs/_esm5/internal/util/errorObject.js ***!
  78982. \**************************************************************/
  78983. /*! exports provided: errorObject */
  78984. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78985. "use strict";
  78986. __webpack_require__.r(__webpack_exports__);
  78987. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "errorObject", function() { return errorObject; });
  78988. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  78989. var errorObject = { e: {} };
  78990. //# sourceMappingURL=errorObject.js.map
  78991. /***/ }),
  78992. /***/ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js":
  78993. /*!******************************************************************!*\
  78994. !*** ./node_modules/rxjs/_esm5/internal/util/hostReportError.js ***!
  78995. \******************************************************************/
  78996. /*! exports provided: hostReportError */
  78997. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  78998. "use strict";
  78999. __webpack_require__.r(__webpack_exports__);
  79000. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "hostReportError", function() { return hostReportError; });
  79001. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79002. function hostReportError(err) {
  79003. setTimeout(function () { throw err; });
  79004. }
  79005. //# sourceMappingURL=hostReportError.js.map
  79006. /***/ }),
  79007. /***/ "./node_modules/rxjs/_esm5/internal/util/identity.js":
  79008. /*!***********************************************************!*\
  79009. !*** ./node_modules/rxjs/_esm5/internal/util/identity.js ***!
  79010. \***********************************************************/
  79011. /*! exports provided: identity */
  79012. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79013. "use strict";
  79014. __webpack_require__.r(__webpack_exports__);
  79015. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "identity", function() { return identity; });
  79016. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79017. function identity(x) {
  79018. return x;
  79019. }
  79020. //# sourceMappingURL=identity.js.map
  79021. /***/ }),
  79022. /***/ "./node_modules/rxjs/_esm5/internal/util/isArray.js":
  79023. /*!**********************************************************!*\
  79024. !*** ./node_modules/rxjs/_esm5/internal/util/isArray.js ***!
  79025. \**********************************************************/
  79026. /*! exports provided: isArray */
  79027. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79028. "use strict";
  79029. __webpack_require__.r(__webpack_exports__);
  79030. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArray", function() { return isArray; });
  79031. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79032. var isArray = Array.isArray || (function (x) { return x && typeof x.length === 'number'; });
  79033. //# sourceMappingURL=isArray.js.map
  79034. /***/ }),
  79035. /***/ "./node_modules/rxjs/_esm5/internal/util/isArrayLike.js":
  79036. /*!**************************************************************!*\
  79037. !*** ./node_modules/rxjs/_esm5/internal/util/isArrayLike.js ***!
  79038. \**************************************************************/
  79039. /*! exports provided: isArrayLike */
  79040. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79041. "use strict";
  79042. __webpack_require__.r(__webpack_exports__);
  79043. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isArrayLike", function() { return isArrayLike; });
  79044. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79045. var isArrayLike = (function (x) { return x && typeof x.length === 'number' && typeof x !== 'function'; });
  79046. //# sourceMappingURL=isArrayLike.js.map
  79047. /***/ }),
  79048. /***/ "./node_modules/rxjs/_esm5/internal/util/isDate.js":
  79049. /*!*********************************************************!*\
  79050. !*** ./node_modules/rxjs/_esm5/internal/util/isDate.js ***!
  79051. \*********************************************************/
  79052. /*! exports provided: isDate */
  79053. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79054. "use strict";
  79055. __webpack_require__.r(__webpack_exports__);
  79056. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isDate", function() { return isDate; });
  79057. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79058. function isDate(value) {
  79059. return value instanceof Date && !isNaN(+value);
  79060. }
  79061. //# sourceMappingURL=isDate.js.map
  79062. /***/ }),
  79063. /***/ "./node_modules/rxjs/_esm5/internal/util/isFunction.js":
  79064. /*!*************************************************************!*\
  79065. !*** ./node_modules/rxjs/_esm5/internal/util/isFunction.js ***!
  79066. \*************************************************************/
  79067. /*! exports provided: isFunction */
  79068. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79069. "use strict";
  79070. __webpack_require__.r(__webpack_exports__);
  79071. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isFunction", function() { return isFunction; });
  79072. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79073. function isFunction(x) {
  79074. return typeof x === 'function';
  79075. }
  79076. //# sourceMappingURL=isFunction.js.map
  79077. /***/ }),
  79078. /***/ "./node_modules/rxjs/_esm5/internal/util/isInteropObservable.js":
  79079. /*!**********************************************************************!*\
  79080. !*** ./node_modules/rxjs/_esm5/internal/util/isInteropObservable.js ***!
  79081. \**********************************************************************/
  79082. /*! exports provided: isInteropObservable */
  79083. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79084. "use strict";
  79085. __webpack_require__.r(__webpack_exports__);
  79086. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isInteropObservable", function() { return isInteropObservable; });
  79087. /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js");
  79088. /** PURE_IMPORTS_START _symbol_observable PURE_IMPORTS_END */
  79089. function isInteropObservable(input) {
  79090. return input && typeof input[_symbol_observable__WEBPACK_IMPORTED_MODULE_0__["observable"]] === 'function';
  79091. }
  79092. //# sourceMappingURL=isInteropObservable.js.map
  79093. /***/ }),
  79094. /***/ "./node_modules/rxjs/_esm5/internal/util/isIterable.js":
  79095. /*!*************************************************************!*\
  79096. !*** ./node_modules/rxjs/_esm5/internal/util/isIterable.js ***!
  79097. \*************************************************************/
  79098. /*! exports provided: isIterable */
  79099. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79100. "use strict";
  79101. __webpack_require__.r(__webpack_exports__);
  79102. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isIterable", function() { return isIterable; });
  79103. /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../symbol/iterator */ "./node_modules/rxjs/_esm5/internal/symbol/iterator.js");
  79104. /** PURE_IMPORTS_START _symbol_iterator PURE_IMPORTS_END */
  79105. function isIterable(input) {
  79106. return input && typeof input[_symbol_iterator__WEBPACK_IMPORTED_MODULE_0__["iterator"]] === 'function';
  79107. }
  79108. //# sourceMappingURL=isIterable.js.map
  79109. /***/ }),
  79110. /***/ "./node_modules/rxjs/_esm5/internal/util/isNumeric.js":
  79111. /*!************************************************************!*\
  79112. !*** ./node_modules/rxjs/_esm5/internal/util/isNumeric.js ***!
  79113. \************************************************************/
  79114. /*! exports provided: isNumeric */
  79115. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79116. "use strict";
  79117. __webpack_require__.r(__webpack_exports__);
  79118. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isNumeric", function() { return isNumeric; });
  79119. /* harmony import */ var _isArray__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./isArray */ "./node_modules/rxjs/_esm5/internal/util/isArray.js");
  79120. /** PURE_IMPORTS_START _isArray PURE_IMPORTS_END */
  79121. function isNumeric(val) {
  79122. return !Object(_isArray__WEBPACK_IMPORTED_MODULE_0__["isArray"])(val) && (val - parseFloat(val) + 1) >= 0;
  79123. }
  79124. //# sourceMappingURL=isNumeric.js.map
  79125. /***/ }),
  79126. /***/ "./node_modules/rxjs/_esm5/internal/util/isObject.js":
  79127. /*!***********************************************************!*\
  79128. !*** ./node_modules/rxjs/_esm5/internal/util/isObject.js ***!
  79129. \***********************************************************/
  79130. /*! exports provided: isObject */
  79131. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79132. "use strict";
  79133. __webpack_require__.r(__webpack_exports__);
  79134. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObject", function() { return isObject; });
  79135. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79136. function isObject(x) {
  79137. return x != null && typeof x === 'object';
  79138. }
  79139. //# sourceMappingURL=isObject.js.map
  79140. /***/ }),
  79141. /***/ "./node_modules/rxjs/_esm5/internal/util/isObservable.js":
  79142. /*!***************************************************************!*\
  79143. !*** ./node_modules/rxjs/_esm5/internal/util/isObservable.js ***!
  79144. \***************************************************************/
  79145. /*! exports provided: isObservable */
  79146. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79147. "use strict";
  79148. __webpack_require__.r(__webpack_exports__);
  79149. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isObservable", function() { return isObservable; });
  79150. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  79151. /** PURE_IMPORTS_START _Observable PURE_IMPORTS_END */
  79152. function isObservable(obj) {
  79153. return !!obj && (obj instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"] || (typeof obj.lift === 'function' && typeof obj.subscribe === 'function'));
  79154. }
  79155. //# sourceMappingURL=isObservable.js.map
  79156. /***/ }),
  79157. /***/ "./node_modules/rxjs/_esm5/internal/util/isPromise.js":
  79158. /*!************************************************************!*\
  79159. !*** ./node_modules/rxjs/_esm5/internal/util/isPromise.js ***!
  79160. \************************************************************/
  79161. /*! exports provided: isPromise */
  79162. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79163. "use strict";
  79164. __webpack_require__.r(__webpack_exports__);
  79165. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isPromise", function() { return isPromise; });
  79166. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79167. function isPromise(value) {
  79168. return value && typeof value.subscribe !== 'function' && typeof value.then === 'function';
  79169. }
  79170. //# sourceMappingURL=isPromise.js.map
  79171. /***/ }),
  79172. /***/ "./node_modules/rxjs/_esm5/internal/util/isScheduler.js":
  79173. /*!**************************************************************!*\
  79174. !*** ./node_modules/rxjs/_esm5/internal/util/isScheduler.js ***!
  79175. \**************************************************************/
  79176. /*! exports provided: isScheduler */
  79177. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79178. "use strict";
  79179. __webpack_require__.r(__webpack_exports__);
  79180. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "isScheduler", function() { return isScheduler; });
  79181. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79182. function isScheduler(value) {
  79183. return value && typeof value.schedule === 'function';
  79184. }
  79185. //# sourceMappingURL=isScheduler.js.map
  79186. /***/ }),
  79187. /***/ "./node_modules/rxjs/_esm5/internal/util/noop.js":
  79188. /*!*******************************************************!*\
  79189. !*** ./node_modules/rxjs/_esm5/internal/util/noop.js ***!
  79190. \*******************************************************/
  79191. /*! exports provided: noop */
  79192. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79193. "use strict";
  79194. __webpack_require__.r(__webpack_exports__);
  79195. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "noop", function() { return noop; });
  79196. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79197. function noop() { }
  79198. //# sourceMappingURL=noop.js.map
  79199. /***/ }),
  79200. /***/ "./node_modules/rxjs/_esm5/internal/util/not.js":
  79201. /*!******************************************************!*\
  79202. !*** ./node_modules/rxjs/_esm5/internal/util/not.js ***!
  79203. \******************************************************/
  79204. /*! exports provided: not */
  79205. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79206. "use strict";
  79207. __webpack_require__.r(__webpack_exports__);
  79208. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "not", function() { return not; });
  79209. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79210. function not(pred, thisArg) {
  79211. function notPred() {
  79212. return !(notPred.pred.apply(notPred.thisArg, arguments));
  79213. }
  79214. notPred.pred = pred;
  79215. notPred.thisArg = thisArg;
  79216. return notPred;
  79217. }
  79218. //# sourceMappingURL=not.js.map
  79219. /***/ }),
  79220. /***/ "./node_modules/rxjs/_esm5/internal/util/pipe.js":
  79221. /*!*******************************************************!*\
  79222. !*** ./node_modules/rxjs/_esm5/internal/util/pipe.js ***!
  79223. \*******************************************************/
  79224. /*! exports provided: pipe, pipeFromArray */
  79225. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79226. "use strict";
  79227. __webpack_require__.r(__webpack_exports__);
  79228. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pipe", function() { return pipe; });
  79229. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "pipeFromArray", function() { return pipeFromArray; });
  79230. /* harmony import */ var _noop__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./noop */ "./node_modules/rxjs/_esm5/internal/util/noop.js");
  79231. /** PURE_IMPORTS_START _noop PURE_IMPORTS_END */
  79232. function pipe() {
  79233. var fns = [];
  79234. for (var _i = 0; _i < arguments.length; _i++) {
  79235. fns[_i] = arguments[_i];
  79236. }
  79237. return pipeFromArray(fns);
  79238. }
  79239. function pipeFromArray(fns) {
  79240. if (!fns) {
  79241. return _noop__WEBPACK_IMPORTED_MODULE_0__["noop"];
  79242. }
  79243. if (fns.length === 1) {
  79244. return fns[0];
  79245. }
  79246. return function piped(input) {
  79247. return fns.reduce(function (prev, fn) { return fn(prev); }, input);
  79248. };
  79249. }
  79250. //# sourceMappingURL=pipe.js.map
  79251. /***/ }),
  79252. /***/ "./node_modules/rxjs/_esm5/internal/util/subscribeTo.js":
  79253. /*!**************************************************************!*\
  79254. !*** ./node_modules/rxjs/_esm5/internal/util/subscribeTo.js ***!
  79255. \**************************************************************/
  79256. /*! exports provided: subscribeTo */
  79257. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79258. "use strict";
  79259. __webpack_require__.r(__webpack_exports__);
  79260. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeTo", function() { return subscribeTo; });
  79261. /* harmony import */ var _Observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Observable */ "./node_modules/rxjs/_esm5/internal/Observable.js");
  79262. /* harmony import */ var _subscribeToArray__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./subscribeToArray */ "./node_modules/rxjs/_esm5/internal/util/subscribeToArray.js");
  79263. /* harmony import */ var _subscribeToPromise__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ./subscribeToPromise */ "./node_modules/rxjs/_esm5/internal/util/subscribeToPromise.js");
  79264. /* harmony import */ var _subscribeToIterable__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ./subscribeToIterable */ "./node_modules/rxjs/_esm5/internal/util/subscribeToIterable.js");
  79265. /* harmony import */ var _subscribeToObservable__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ./subscribeToObservable */ "./node_modules/rxjs/_esm5/internal/util/subscribeToObservable.js");
  79266. /* harmony import */ var _isArrayLike__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ./isArrayLike */ "./node_modules/rxjs/_esm5/internal/util/isArrayLike.js");
  79267. /* harmony import */ var _isPromise__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ./isPromise */ "./node_modules/rxjs/_esm5/internal/util/isPromise.js");
  79268. /* harmony import */ var _isObject__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ./isObject */ "./node_modules/rxjs/_esm5/internal/util/isObject.js");
  79269. /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../symbol/iterator */ "./node_modules/rxjs/_esm5/internal/symbol/iterator.js");
  79270. /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js");
  79271. /** PURE_IMPORTS_START _Observable,_subscribeToArray,_subscribeToPromise,_subscribeToIterable,_subscribeToObservable,_isArrayLike,_isPromise,_isObject,_symbol_iterator,_symbol_observable PURE_IMPORTS_END */
  79272. var subscribeTo = function (result) {
  79273. if (result instanceof _Observable__WEBPACK_IMPORTED_MODULE_0__["Observable"]) {
  79274. return function (subscriber) {
  79275. if (result._isScalar) {
  79276. subscriber.next(result.value);
  79277. subscriber.complete();
  79278. return undefined;
  79279. }
  79280. else {
  79281. return result.subscribe(subscriber);
  79282. }
  79283. };
  79284. }
  79285. else if (result && typeof result[_symbol_observable__WEBPACK_IMPORTED_MODULE_9__["observable"]] === 'function') {
  79286. return Object(_subscribeToObservable__WEBPACK_IMPORTED_MODULE_4__["subscribeToObservable"])(result);
  79287. }
  79288. else if (Object(_isArrayLike__WEBPACK_IMPORTED_MODULE_5__["isArrayLike"])(result)) {
  79289. return Object(_subscribeToArray__WEBPACK_IMPORTED_MODULE_1__["subscribeToArray"])(result);
  79290. }
  79291. else if (Object(_isPromise__WEBPACK_IMPORTED_MODULE_6__["isPromise"])(result)) {
  79292. return Object(_subscribeToPromise__WEBPACK_IMPORTED_MODULE_2__["subscribeToPromise"])(result);
  79293. }
  79294. else if (result && typeof result[_symbol_iterator__WEBPACK_IMPORTED_MODULE_8__["iterator"]] === 'function') {
  79295. return Object(_subscribeToIterable__WEBPACK_IMPORTED_MODULE_3__["subscribeToIterable"])(result);
  79296. }
  79297. else {
  79298. var value = Object(_isObject__WEBPACK_IMPORTED_MODULE_7__["isObject"])(result) ? 'an invalid object' : "'" + result + "'";
  79299. var msg = "You provided " + value + " where a stream was expected."
  79300. + ' You can provide an Observable, Promise, Array, or Iterable.';
  79301. throw new TypeError(msg);
  79302. }
  79303. };
  79304. //# sourceMappingURL=subscribeTo.js.map
  79305. /***/ }),
  79306. /***/ "./node_modules/rxjs/_esm5/internal/util/subscribeToArray.js":
  79307. /*!*******************************************************************!*\
  79308. !*** ./node_modules/rxjs/_esm5/internal/util/subscribeToArray.js ***!
  79309. \*******************************************************************/
  79310. /*! exports provided: subscribeToArray */
  79311. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79312. "use strict";
  79313. __webpack_require__.r(__webpack_exports__);
  79314. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToArray", function() { return subscribeToArray; });
  79315. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79316. var subscribeToArray = function (array) {
  79317. return function (subscriber) {
  79318. for (var i = 0, len = array.length; i < len && !subscriber.closed; i++) {
  79319. subscriber.next(array[i]);
  79320. }
  79321. if (!subscriber.closed) {
  79322. subscriber.complete();
  79323. }
  79324. };
  79325. };
  79326. //# sourceMappingURL=subscribeToArray.js.map
  79327. /***/ }),
  79328. /***/ "./node_modules/rxjs/_esm5/internal/util/subscribeToIterable.js":
  79329. /*!**********************************************************************!*\
  79330. !*** ./node_modules/rxjs/_esm5/internal/util/subscribeToIterable.js ***!
  79331. \**********************************************************************/
  79332. /*! exports provided: subscribeToIterable */
  79333. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79334. "use strict";
  79335. __webpack_require__.r(__webpack_exports__);
  79336. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToIterable", function() { return subscribeToIterable; });
  79337. /* harmony import */ var _symbol_iterator__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../symbol/iterator */ "./node_modules/rxjs/_esm5/internal/symbol/iterator.js");
  79338. /** PURE_IMPORTS_START _symbol_iterator PURE_IMPORTS_END */
  79339. var subscribeToIterable = function (iterable) {
  79340. return function (subscriber) {
  79341. var iterator = iterable[_symbol_iterator__WEBPACK_IMPORTED_MODULE_0__["iterator"]]();
  79342. do {
  79343. var item = iterator.next();
  79344. if (item.done) {
  79345. subscriber.complete();
  79346. break;
  79347. }
  79348. subscriber.next(item.value);
  79349. if (subscriber.closed) {
  79350. break;
  79351. }
  79352. } while (true);
  79353. if (typeof iterator.return === 'function') {
  79354. subscriber.add(function () {
  79355. if (iterator.return) {
  79356. iterator.return();
  79357. }
  79358. });
  79359. }
  79360. return subscriber;
  79361. };
  79362. };
  79363. //# sourceMappingURL=subscribeToIterable.js.map
  79364. /***/ }),
  79365. /***/ "./node_modules/rxjs/_esm5/internal/util/subscribeToObservable.js":
  79366. /*!************************************************************************!*\
  79367. !*** ./node_modules/rxjs/_esm5/internal/util/subscribeToObservable.js ***!
  79368. \************************************************************************/
  79369. /*! exports provided: subscribeToObservable */
  79370. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79371. "use strict";
  79372. __webpack_require__.r(__webpack_exports__);
  79373. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToObservable", function() { return subscribeToObservable; });
  79374. /* harmony import */ var _symbol_observable__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../symbol/observable */ "./node_modules/rxjs/_esm5/internal/symbol/observable.js");
  79375. /** PURE_IMPORTS_START _symbol_observable PURE_IMPORTS_END */
  79376. var subscribeToObservable = function (obj) {
  79377. return function (subscriber) {
  79378. var obs = obj[_symbol_observable__WEBPACK_IMPORTED_MODULE_0__["observable"]]();
  79379. if (typeof obs.subscribe !== 'function') {
  79380. throw new TypeError('Provided object does not correctly implement Symbol.observable');
  79381. }
  79382. else {
  79383. return obs.subscribe(subscriber);
  79384. }
  79385. };
  79386. };
  79387. //# sourceMappingURL=subscribeToObservable.js.map
  79388. /***/ }),
  79389. /***/ "./node_modules/rxjs/_esm5/internal/util/subscribeToPromise.js":
  79390. /*!*********************************************************************!*\
  79391. !*** ./node_modules/rxjs/_esm5/internal/util/subscribeToPromise.js ***!
  79392. \*********************************************************************/
  79393. /*! exports provided: subscribeToPromise */
  79394. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79395. "use strict";
  79396. __webpack_require__.r(__webpack_exports__);
  79397. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToPromise", function() { return subscribeToPromise; });
  79398. /* harmony import */ var _hostReportError__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./hostReportError */ "./node_modules/rxjs/_esm5/internal/util/hostReportError.js");
  79399. /** PURE_IMPORTS_START _hostReportError PURE_IMPORTS_END */
  79400. var subscribeToPromise = function (promise) {
  79401. return function (subscriber) {
  79402. promise.then(function (value) {
  79403. if (!subscriber.closed) {
  79404. subscriber.next(value);
  79405. subscriber.complete();
  79406. }
  79407. }, function (err) { return subscriber.error(err); })
  79408. .then(null, _hostReportError__WEBPACK_IMPORTED_MODULE_0__["hostReportError"]);
  79409. return subscriber;
  79410. };
  79411. };
  79412. //# sourceMappingURL=subscribeToPromise.js.map
  79413. /***/ }),
  79414. /***/ "./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js":
  79415. /*!********************************************************************!*\
  79416. !*** ./node_modules/rxjs/_esm5/internal/util/subscribeToResult.js ***!
  79417. \********************************************************************/
  79418. /*! exports provided: subscribeToResult */
  79419. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79420. "use strict";
  79421. __webpack_require__.r(__webpack_exports__);
  79422. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "subscribeToResult", function() { return subscribeToResult; });
  79423. /* harmony import */ var _InnerSubscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../InnerSubscriber */ "./node_modules/rxjs/_esm5/internal/InnerSubscriber.js");
  79424. /* harmony import */ var _subscribeTo__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ./subscribeTo */ "./node_modules/rxjs/_esm5/internal/util/subscribeTo.js");
  79425. /** PURE_IMPORTS_START _InnerSubscriber,_subscribeTo PURE_IMPORTS_END */
  79426. function subscribeToResult(outerSubscriber, result, outerValue, outerIndex) {
  79427. var destination = new _InnerSubscriber__WEBPACK_IMPORTED_MODULE_0__["InnerSubscriber"](outerSubscriber, outerValue, outerIndex);
  79428. return Object(_subscribeTo__WEBPACK_IMPORTED_MODULE_1__["subscribeTo"])(result)(destination);
  79429. }
  79430. //# sourceMappingURL=subscribeToResult.js.map
  79431. /***/ }),
  79432. /***/ "./node_modules/rxjs/_esm5/internal/util/toSubscriber.js":
  79433. /*!***************************************************************!*\
  79434. !*** ./node_modules/rxjs/_esm5/internal/util/toSubscriber.js ***!
  79435. \***************************************************************/
  79436. /*! exports provided: toSubscriber */
  79437. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79438. "use strict";
  79439. __webpack_require__.r(__webpack_exports__);
  79440. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "toSubscriber", function() { return toSubscriber; });
  79441. /* harmony import */ var _Subscriber__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../Subscriber */ "./node_modules/rxjs/_esm5/internal/Subscriber.js");
  79442. /* harmony import */ var _symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../symbol/rxSubscriber */ "./node_modules/rxjs/_esm5/internal/symbol/rxSubscriber.js");
  79443. /* harmony import */ var _Observer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../Observer */ "./node_modules/rxjs/_esm5/internal/Observer.js");
  79444. /** PURE_IMPORTS_START _Subscriber,_symbol_rxSubscriber,_Observer PURE_IMPORTS_END */
  79445. function toSubscriber(nextOrObserver, error, complete) {
  79446. if (nextOrObserver) {
  79447. if (nextOrObserver instanceof _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"]) {
  79448. return nextOrObserver;
  79449. }
  79450. if (nextOrObserver[_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__["rxSubscriber"]]) {
  79451. return nextOrObserver[_symbol_rxSubscriber__WEBPACK_IMPORTED_MODULE_1__["rxSubscriber"]]();
  79452. }
  79453. }
  79454. if (!nextOrObserver && !error && !complete) {
  79455. return new _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"](_Observer__WEBPACK_IMPORTED_MODULE_2__["empty"]);
  79456. }
  79457. return new _Subscriber__WEBPACK_IMPORTED_MODULE_0__["Subscriber"](nextOrObserver, error, complete);
  79458. }
  79459. //# sourceMappingURL=toSubscriber.js.map
  79460. /***/ }),
  79461. /***/ "./node_modules/rxjs/_esm5/internal/util/tryCatch.js":
  79462. /*!***********************************************************!*\
  79463. !*** ./node_modules/rxjs/_esm5/internal/util/tryCatch.js ***!
  79464. \***********************************************************/
  79465. /*! exports provided: tryCatch */
  79466. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79467. "use strict";
  79468. __webpack_require__.r(__webpack_exports__);
  79469. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "tryCatch", function() { return tryCatch; });
  79470. /* harmony import */ var _errorObject__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ./errorObject */ "./node_modules/rxjs/_esm5/internal/util/errorObject.js");
  79471. /** PURE_IMPORTS_START _errorObject PURE_IMPORTS_END */
  79472. var tryCatchTarget;
  79473. function tryCatcher() {
  79474. try {
  79475. return tryCatchTarget.apply(this, arguments);
  79476. }
  79477. catch (e) {
  79478. _errorObject__WEBPACK_IMPORTED_MODULE_0__["errorObject"].e = e;
  79479. return _errorObject__WEBPACK_IMPORTED_MODULE_0__["errorObject"];
  79480. }
  79481. }
  79482. function tryCatch(fn) {
  79483. tryCatchTarget = fn;
  79484. return tryCatcher;
  79485. }
  79486. //# sourceMappingURL=tryCatch.js.map
  79487. /***/ }),
  79488. /***/ "./node_modules/rxjs/_esm5/operators/index.js":
  79489. /*!****************************************************!*\
  79490. !*** ./node_modules/rxjs/_esm5/operators/index.js ***!
  79491. \****************************************************/
  79492. /*! exports provided: audit, auditTime, buffer, bufferCount, bufferTime, bufferToggle, bufferWhen, catchError, combineAll, combineLatest, concat, concatAll, concatMap, concatMapTo, count, debounce, debounceTime, defaultIfEmpty, delay, delayWhen, dematerialize, distinct, distinctUntilChanged, distinctUntilKeyChanged, elementAt, endWith, every, exhaust, exhaustMap, expand, filter, finalize, find, findIndex, first, groupBy, ignoreElements, isEmpty, last, map, mapTo, materialize, max, merge, mergeAll, mergeMap, flatMap, mergeMapTo, mergeScan, min, multicast, observeOn, onErrorResumeNext, pairwise, partition, pluck, publish, publishBehavior, publishLast, publishReplay, race, reduce, repeat, repeatWhen, retry, retryWhen, refCount, sample, sampleTime, scan, sequenceEqual, share, shareReplay, single, skip, skipLast, skipUntil, skipWhile, startWith, subscribeOn, switchAll, switchMap, switchMapTo, take, takeLast, takeUntil, takeWhile, tap, throttle, throttleTime, throwIfEmpty, timeInterval, timeout, timeoutWith, timestamp, toArray, window, windowCount, windowTime, windowToggle, windowWhen, withLatestFrom, zip, zipAll */
  79493. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79494. "use strict";
  79495. __webpack_require__.r(__webpack_exports__);
  79496. /* harmony import */ var _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(/*! ../internal/operators/audit */ "./node_modules/rxjs/_esm5/internal/operators/audit.js");
  79497. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "audit", function() { return _internal_operators_audit__WEBPACK_IMPORTED_MODULE_0__["audit"]; });
  79498. /* harmony import */ var _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(/*! ../internal/operators/auditTime */ "./node_modules/rxjs/_esm5/internal/operators/auditTime.js");
  79499. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "auditTime", function() { return _internal_operators_auditTime__WEBPACK_IMPORTED_MODULE_1__["auditTime"]; });
  79500. /* harmony import */ var _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(/*! ../internal/operators/buffer */ "./node_modules/rxjs/_esm5/internal/operators/buffer.js");
  79501. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "buffer", function() { return _internal_operators_buffer__WEBPACK_IMPORTED_MODULE_2__["buffer"]; });
  79502. /* harmony import */ var _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(/*! ../internal/operators/bufferCount */ "./node_modules/rxjs/_esm5/internal/operators/bufferCount.js");
  79503. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferCount", function() { return _internal_operators_bufferCount__WEBPACK_IMPORTED_MODULE_3__["bufferCount"]; });
  79504. /* harmony import */ var _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(/*! ../internal/operators/bufferTime */ "./node_modules/rxjs/_esm5/internal/operators/bufferTime.js");
  79505. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferTime", function() { return _internal_operators_bufferTime__WEBPACK_IMPORTED_MODULE_4__["bufferTime"]; });
  79506. /* harmony import */ var _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(/*! ../internal/operators/bufferToggle */ "./node_modules/rxjs/_esm5/internal/operators/bufferToggle.js");
  79507. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferToggle", function() { return _internal_operators_bufferToggle__WEBPACK_IMPORTED_MODULE_5__["bufferToggle"]; });
  79508. /* harmony import */ var _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(/*! ../internal/operators/bufferWhen */ "./node_modules/rxjs/_esm5/internal/operators/bufferWhen.js");
  79509. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "bufferWhen", function() { return _internal_operators_bufferWhen__WEBPACK_IMPORTED_MODULE_6__["bufferWhen"]; });
  79510. /* harmony import */ var _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(/*! ../internal/operators/catchError */ "./node_modules/rxjs/_esm5/internal/operators/catchError.js");
  79511. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "catchError", function() { return _internal_operators_catchError__WEBPACK_IMPORTED_MODULE_7__["catchError"]; });
  79512. /* harmony import */ var _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(/*! ../internal/operators/combineAll */ "./node_modules/rxjs/_esm5/internal/operators/combineAll.js");
  79513. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineAll", function() { return _internal_operators_combineAll__WEBPACK_IMPORTED_MODULE_8__["combineAll"]; });
  79514. /* harmony import */ var _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(/*! ../internal/operators/combineLatest */ "./node_modules/rxjs/_esm5/internal/operators/combineLatest.js");
  79515. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "combineLatest", function() { return _internal_operators_combineLatest__WEBPACK_IMPORTED_MODULE_9__["combineLatest"]; });
  79516. /* harmony import */ var _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(/*! ../internal/operators/concat */ "./node_modules/rxjs/_esm5/internal/operators/concat.js");
  79517. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concat", function() { return _internal_operators_concat__WEBPACK_IMPORTED_MODULE_10__["concat"]; });
  79518. /* harmony import */ var _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(/*! ../internal/operators/concatAll */ "./node_modules/rxjs/_esm5/internal/operators/concatAll.js");
  79519. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatAll", function() { return _internal_operators_concatAll__WEBPACK_IMPORTED_MODULE_11__["concatAll"]; });
  79520. /* harmony import */ var _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(/*! ../internal/operators/concatMap */ "./node_modules/rxjs/_esm5/internal/operators/concatMap.js");
  79521. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMap", function() { return _internal_operators_concatMap__WEBPACK_IMPORTED_MODULE_12__["concatMap"]; });
  79522. /* harmony import */ var _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__ = __webpack_require__(/*! ../internal/operators/concatMapTo */ "./node_modules/rxjs/_esm5/internal/operators/concatMapTo.js");
  79523. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "concatMapTo", function() { return _internal_operators_concatMapTo__WEBPACK_IMPORTED_MODULE_13__["concatMapTo"]; });
  79524. /* harmony import */ var _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__ = __webpack_require__(/*! ../internal/operators/count */ "./node_modules/rxjs/_esm5/internal/operators/count.js");
  79525. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "count", function() { return _internal_operators_count__WEBPACK_IMPORTED_MODULE_14__["count"]; });
  79526. /* harmony import */ var _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__ = __webpack_require__(/*! ../internal/operators/debounce */ "./node_modules/rxjs/_esm5/internal/operators/debounce.js");
  79527. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounce", function() { return _internal_operators_debounce__WEBPACK_IMPORTED_MODULE_15__["debounce"]; });
  79528. /* harmony import */ var _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__ = __webpack_require__(/*! ../internal/operators/debounceTime */ "./node_modules/rxjs/_esm5/internal/operators/debounceTime.js");
  79529. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "debounceTime", function() { return _internal_operators_debounceTime__WEBPACK_IMPORTED_MODULE_16__["debounceTime"]; });
  79530. /* harmony import */ var _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__ = __webpack_require__(/*! ../internal/operators/defaultIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/defaultIfEmpty.js");
  79531. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "defaultIfEmpty", function() { return _internal_operators_defaultIfEmpty__WEBPACK_IMPORTED_MODULE_17__["defaultIfEmpty"]; });
  79532. /* harmony import */ var _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__ = __webpack_require__(/*! ../internal/operators/delay */ "./node_modules/rxjs/_esm5/internal/operators/delay.js");
  79533. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delay", function() { return _internal_operators_delay__WEBPACK_IMPORTED_MODULE_18__["delay"]; });
  79534. /* harmony import */ var _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__ = __webpack_require__(/*! ../internal/operators/delayWhen */ "./node_modules/rxjs/_esm5/internal/operators/delayWhen.js");
  79535. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "delayWhen", function() { return _internal_operators_delayWhen__WEBPACK_IMPORTED_MODULE_19__["delayWhen"]; });
  79536. /* harmony import */ var _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__ = __webpack_require__(/*! ../internal/operators/dematerialize */ "./node_modules/rxjs/_esm5/internal/operators/dematerialize.js");
  79537. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "dematerialize", function() { return _internal_operators_dematerialize__WEBPACK_IMPORTED_MODULE_20__["dematerialize"]; });
  79538. /* harmony import */ var _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__ = __webpack_require__(/*! ../internal/operators/distinct */ "./node_modules/rxjs/_esm5/internal/operators/distinct.js");
  79539. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinct", function() { return _internal_operators_distinct__WEBPACK_IMPORTED_MODULE_21__["distinct"]; });
  79540. /* harmony import */ var _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__ = __webpack_require__(/*! ../internal/operators/distinctUntilChanged */ "./node_modules/rxjs/_esm5/internal/operators/distinctUntilChanged.js");
  79541. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilChanged", function() { return _internal_operators_distinctUntilChanged__WEBPACK_IMPORTED_MODULE_22__["distinctUntilChanged"]; });
  79542. /* harmony import */ var _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__ = __webpack_require__(/*! ../internal/operators/distinctUntilKeyChanged */ "./node_modules/rxjs/_esm5/internal/operators/distinctUntilKeyChanged.js");
  79543. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "distinctUntilKeyChanged", function() { return _internal_operators_distinctUntilKeyChanged__WEBPACK_IMPORTED_MODULE_23__["distinctUntilKeyChanged"]; });
  79544. /* harmony import */ var _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__ = __webpack_require__(/*! ../internal/operators/elementAt */ "./node_modules/rxjs/_esm5/internal/operators/elementAt.js");
  79545. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "elementAt", function() { return _internal_operators_elementAt__WEBPACK_IMPORTED_MODULE_24__["elementAt"]; });
  79546. /* harmony import */ var _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__ = __webpack_require__(/*! ../internal/operators/endWith */ "./node_modules/rxjs/_esm5/internal/operators/endWith.js");
  79547. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "endWith", function() { return _internal_operators_endWith__WEBPACK_IMPORTED_MODULE_25__["endWith"]; });
  79548. /* harmony import */ var _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__ = __webpack_require__(/*! ../internal/operators/every */ "./node_modules/rxjs/_esm5/internal/operators/every.js");
  79549. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "every", function() { return _internal_operators_every__WEBPACK_IMPORTED_MODULE_26__["every"]; });
  79550. /* harmony import */ var _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__ = __webpack_require__(/*! ../internal/operators/exhaust */ "./node_modules/rxjs/_esm5/internal/operators/exhaust.js");
  79551. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaust", function() { return _internal_operators_exhaust__WEBPACK_IMPORTED_MODULE_27__["exhaust"]; });
  79552. /* harmony import */ var _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__ = __webpack_require__(/*! ../internal/operators/exhaustMap */ "./node_modules/rxjs/_esm5/internal/operators/exhaustMap.js");
  79553. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "exhaustMap", function() { return _internal_operators_exhaustMap__WEBPACK_IMPORTED_MODULE_28__["exhaustMap"]; });
  79554. /* harmony import */ var _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__ = __webpack_require__(/*! ../internal/operators/expand */ "./node_modules/rxjs/_esm5/internal/operators/expand.js");
  79555. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "expand", function() { return _internal_operators_expand__WEBPACK_IMPORTED_MODULE_29__["expand"]; });
  79556. /* harmony import */ var _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__ = __webpack_require__(/*! ../internal/operators/filter */ "./node_modules/rxjs/_esm5/internal/operators/filter.js");
  79557. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "filter", function() { return _internal_operators_filter__WEBPACK_IMPORTED_MODULE_30__["filter"]; });
  79558. /* harmony import */ var _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__ = __webpack_require__(/*! ../internal/operators/finalize */ "./node_modules/rxjs/_esm5/internal/operators/finalize.js");
  79559. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "finalize", function() { return _internal_operators_finalize__WEBPACK_IMPORTED_MODULE_31__["finalize"]; });
  79560. /* harmony import */ var _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__ = __webpack_require__(/*! ../internal/operators/find */ "./node_modules/rxjs/_esm5/internal/operators/find.js");
  79561. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "find", function() { return _internal_operators_find__WEBPACK_IMPORTED_MODULE_32__["find"]; });
  79562. /* harmony import */ var _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__ = __webpack_require__(/*! ../internal/operators/findIndex */ "./node_modules/rxjs/_esm5/internal/operators/findIndex.js");
  79563. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "findIndex", function() { return _internal_operators_findIndex__WEBPACK_IMPORTED_MODULE_33__["findIndex"]; });
  79564. /* harmony import */ var _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__ = __webpack_require__(/*! ../internal/operators/first */ "./node_modules/rxjs/_esm5/internal/operators/first.js");
  79565. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "first", function() { return _internal_operators_first__WEBPACK_IMPORTED_MODULE_34__["first"]; });
  79566. /* harmony import */ var _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__ = __webpack_require__(/*! ../internal/operators/groupBy */ "./node_modules/rxjs/_esm5/internal/operators/groupBy.js");
  79567. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "groupBy", function() { return _internal_operators_groupBy__WEBPACK_IMPORTED_MODULE_35__["groupBy"]; });
  79568. /* harmony import */ var _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__ = __webpack_require__(/*! ../internal/operators/ignoreElements */ "./node_modules/rxjs/_esm5/internal/operators/ignoreElements.js");
  79569. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "ignoreElements", function() { return _internal_operators_ignoreElements__WEBPACK_IMPORTED_MODULE_36__["ignoreElements"]; });
  79570. /* harmony import */ var _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__ = __webpack_require__(/*! ../internal/operators/isEmpty */ "./node_modules/rxjs/_esm5/internal/operators/isEmpty.js");
  79571. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "isEmpty", function() { return _internal_operators_isEmpty__WEBPACK_IMPORTED_MODULE_37__["isEmpty"]; });
  79572. /* harmony import */ var _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__ = __webpack_require__(/*! ../internal/operators/last */ "./node_modules/rxjs/_esm5/internal/operators/last.js");
  79573. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "last", function() { return _internal_operators_last__WEBPACK_IMPORTED_MODULE_38__["last"]; });
  79574. /* harmony import */ var _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__ = __webpack_require__(/*! ../internal/operators/map */ "./node_modules/rxjs/_esm5/internal/operators/map.js");
  79575. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "map", function() { return _internal_operators_map__WEBPACK_IMPORTED_MODULE_39__["map"]; });
  79576. /* harmony import */ var _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__ = __webpack_require__(/*! ../internal/operators/mapTo */ "./node_modules/rxjs/_esm5/internal/operators/mapTo.js");
  79577. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mapTo", function() { return _internal_operators_mapTo__WEBPACK_IMPORTED_MODULE_40__["mapTo"]; });
  79578. /* harmony import */ var _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__ = __webpack_require__(/*! ../internal/operators/materialize */ "./node_modules/rxjs/_esm5/internal/operators/materialize.js");
  79579. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "materialize", function() { return _internal_operators_materialize__WEBPACK_IMPORTED_MODULE_41__["materialize"]; });
  79580. /* harmony import */ var _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__ = __webpack_require__(/*! ../internal/operators/max */ "./node_modules/rxjs/_esm5/internal/operators/max.js");
  79581. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "max", function() { return _internal_operators_max__WEBPACK_IMPORTED_MODULE_42__["max"]; });
  79582. /* harmony import */ var _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__ = __webpack_require__(/*! ../internal/operators/merge */ "./node_modules/rxjs/_esm5/internal/operators/merge.js");
  79583. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "merge", function() { return _internal_operators_merge__WEBPACK_IMPORTED_MODULE_43__["merge"]; });
  79584. /* harmony import */ var _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__ = __webpack_require__(/*! ../internal/operators/mergeAll */ "./node_modules/rxjs/_esm5/internal/operators/mergeAll.js");
  79585. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeAll", function() { return _internal_operators_mergeAll__WEBPACK_IMPORTED_MODULE_44__["mergeAll"]; });
  79586. /* harmony import */ var _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__ = __webpack_require__(/*! ../internal/operators/mergeMap */ "./node_modules/rxjs/_esm5/internal/operators/mergeMap.js");
  79587. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMap", function() { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["mergeMap"]; });
  79588. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "flatMap", function() { return _internal_operators_mergeMap__WEBPACK_IMPORTED_MODULE_45__["mergeMap"]; });
  79589. /* harmony import */ var _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__ = __webpack_require__(/*! ../internal/operators/mergeMapTo */ "./node_modules/rxjs/_esm5/internal/operators/mergeMapTo.js");
  79590. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeMapTo", function() { return _internal_operators_mergeMapTo__WEBPACK_IMPORTED_MODULE_46__["mergeMapTo"]; });
  79591. /* harmony import */ var _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__ = __webpack_require__(/*! ../internal/operators/mergeScan */ "./node_modules/rxjs/_esm5/internal/operators/mergeScan.js");
  79592. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "mergeScan", function() { return _internal_operators_mergeScan__WEBPACK_IMPORTED_MODULE_47__["mergeScan"]; });
  79593. /* harmony import */ var _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__ = __webpack_require__(/*! ../internal/operators/min */ "./node_modules/rxjs/_esm5/internal/operators/min.js");
  79594. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "min", function() { return _internal_operators_min__WEBPACK_IMPORTED_MODULE_48__["min"]; });
  79595. /* harmony import */ var _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__ = __webpack_require__(/*! ../internal/operators/multicast */ "./node_modules/rxjs/_esm5/internal/operators/multicast.js");
  79596. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "multicast", function() { return _internal_operators_multicast__WEBPACK_IMPORTED_MODULE_49__["multicast"]; });
  79597. /* harmony import */ var _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__ = __webpack_require__(/*! ../internal/operators/observeOn */ "./node_modules/rxjs/_esm5/internal/operators/observeOn.js");
  79598. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "observeOn", function() { return _internal_operators_observeOn__WEBPACK_IMPORTED_MODULE_50__["observeOn"]; });
  79599. /* harmony import */ var _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__ = __webpack_require__(/*! ../internal/operators/onErrorResumeNext */ "./node_modules/rxjs/_esm5/internal/operators/onErrorResumeNext.js");
  79600. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "onErrorResumeNext", function() { return _internal_operators_onErrorResumeNext__WEBPACK_IMPORTED_MODULE_51__["onErrorResumeNext"]; });
  79601. /* harmony import */ var _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__ = __webpack_require__(/*! ../internal/operators/pairwise */ "./node_modules/rxjs/_esm5/internal/operators/pairwise.js");
  79602. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pairwise", function() { return _internal_operators_pairwise__WEBPACK_IMPORTED_MODULE_52__["pairwise"]; });
  79603. /* harmony import */ var _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__ = __webpack_require__(/*! ../internal/operators/partition */ "./node_modules/rxjs/_esm5/internal/operators/partition.js");
  79604. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "partition", function() { return _internal_operators_partition__WEBPACK_IMPORTED_MODULE_53__["partition"]; });
  79605. /* harmony import */ var _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__ = __webpack_require__(/*! ../internal/operators/pluck */ "./node_modules/rxjs/_esm5/internal/operators/pluck.js");
  79606. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "pluck", function() { return _internal_operators_pluck__WEBPACK_IMPORTED_MODULE_54__["pluck"]; });
  79607. /* harmony import */ var _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__ = __webpack_require__(/*! ../internal/operators/publish */ "./node_modules/rxjs/_esm5/internal/operators/publish.js");
  79608. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publish", function() { return _internal_operators_publish__WEBPACK_IMPORTED_MODULE_55__["publish"]; });
  79609. /* harmony import */ var _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__ = __webpack_require__(/*! ../internal/operators/publishBehavior */ "./node_modules/rxjs/_esm5/internal/operators/publishBehavior.js");
  79610. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishBehavior", function() { return _internal_operators_publishBehavior__WEBPACK_IMPORTED_MODULE_56__["publishBehavior"]; });
  79611. /* harmony import */ var _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__ = __webpack_require__(/*! ../internal/operators/publishLast */ "./node_modules/rxjs/_esm5/internal/operators/publishLast.js");
  79612. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishLast", function() { return _internal_operators_publishLast__WEBPACK_IMPORTED_MODULE_57__["publishLast"]; });
  79613. /* harmony import */ var _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__ = __webpack_require__(/*! ../internal/operators/publishReplay */ "./node_modules/rxjs/_esm5/internal/operators/publishReplay.js");
  79614. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "publishReplay", function() { return _internal_operators_publishReplay__WEBPACK_IMPORTED_MODULE_58__["publishReplay"]; });
  79615. /* harmony import */ var _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__ = __webpack_require__(/*! ../internal/operators/race */ "./node_modules/rxjs/_esm5/internal/operators/race.js");
  79616. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "race", function() { return _internal_operators_race__WEBPACK_IMPORTED_MODULE_59__["race"]; });
  79617. /* harmony import */ var _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__ = __webpack_require__(/*! ../internal/operators/reduce */ "./node_modules/rxjs/_esm5/internal/operators/reduce.js");
  79618. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "reduce", function() { return _internal_operators_reduce__WEBPACK_IMPORTED_MODULE_60__["reduce"]; });
  79619. /* harmony import */ var _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__ = __webpack_require__(/*! ../internal/operators/repeat */ "./node_modules/rxjs/_esm5/internal/operators/repeat.js");
  79620. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeat", function() { return _internal_operators_repeat__WEBPACK_IMPORTED_MODULE_61__["repeat"]; });
  79621. /* harmony import */ var _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__ = __webpack_require__(/*! ../internal/operators/repeatWhen */ "./node_modules/rxjs/_esm5/internal/operators/repeatWhen.js");
  79622. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "repeatWhen", function() { return _internal_operators_repeatWhen__WEBPACK_IMPORTED_MODULE_62__["repeatWhen"]; });
  79623. /* harmony import */ var _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__ = __webpack_require__(/*! ../internal/operators/retry */ "./node_modules/rxjs/_esm5/internal/operators/retry.js");
  79624. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retry", function() { return _internal_operators_retry__WEBPACK_IMPORTED_MODULE_63__["retry"]; });
  79625. /* harmony import */ var _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__ = __webpack_require__(/*! ../internal/operators/retryWhen */ "./node_modules/rxjs/_esm5/internal/operators/retryWhen.js");
  79626. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "retryWhen", function() { return _internal_operators_retryWhen__WEBPACK_IMPORTED_MODULE_64__["retryWhen"]; });
  79627. /* harmony import */ var _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__ = __webpack_require__(/*! ../internal/operators/refCount */ "./node_modules/rxjs/_esm5/internal/operators/refCount.js");
  79628. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "refCount", function() { return _internal_operators_refCount__WEBPACK_IMPORTED_MODULE_65__["refCount"]; });
  79629. /* harmony import */ var _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__ = __webpack_require__(/*! ../internal/operators/sample */ "./node_modules/rxjs/_esm5/internal/operators/sample.js");
  79630. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sample", function() { return _internal_operators_sample__WEBPACK_IMPORTED_MODULE_66__["sample"]; });
  79631. /* harmony import */ var _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__ = __webpack_require__(/*! ../internal/operators/sampleTime */ "./node_modules/rxjs/_esm5/internal/operators/sampleTime.js");
  79632. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sampleTime", function() { return _internal_operators_sampleTime__WEBPACK_IMPORTED_MODULE_67__["sampleTime"]; });
  79633. /* harmony import */ var _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__ = __webpack_require__(/*! ../internal/operators/scan */ "./node_modules/rxjs/_esm5/internal/operators/scan.js");
  79634. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "scan", function() { return _internal_operators_scan__WEBPACK_IMPORTED_MODULE_68__["scan"]; });
  79635. /* harmony import */ var _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__ = __webpack_require__(/*! ../internal/operators/sequenceEqual */ "./node_modules/rxjs/_esm5/internal/operators/sequenceEqual.js");
  79636. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "sequenceEqual", function() { return _internal_operators_sequenceEqual__WEBPACK_IMPORTED_MODULE_69__["sequenceEqual"]; });
  79637. /* harmony import */ var _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__ = __webpack_require__(/*! ../internal/operators/share */ "./node_modules/rxjs/_esm5/internal/operators/share.js");
  79638. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "share", function() { return _internal_operators_share__WEBPACK_IMPORTED_MODULE_70__["share"]; });
  79639. /* harmony import */ var _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__ = __webpack_require__(/*! ../internal/operators/shareReplay */ "./node_modules/rxjs/_esm5/internal/operators/shareReplay.js");
  79640. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "shareReplay", function() { return _internal_operators_shareReplay__WEBPACK_IMPORTED_MODULE_71__["shareReplay"]; });
  79641. /* harmony import */ var _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__ = __webpack_require__(/*! ../internal/operators/single */ "./node_modules/rxjs/_esm5/internal/operators/single.js");
  79642. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "single", function() { return _internal_operators_single__WEBPACK_IMPORTED_MODULE_72__["single"]; });
  79643. /* harmony import */ var _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__ = __webpack_require__(/*! ../internal/operators/skip */ "./node_modules/rxjs/_esm5/internal/operators/skip.js");
  79644. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skip", function() { return _internal_operators_skip__WEBPACK_IMPORTED_MODULE_73__["skip"]; });
  79645. /* harmony import */ var _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__ = __webpack_require__(/*! ../internal/operators/skipLast */ "./node_modules/rxjs/_esm5/internal/operators/skipLast.js");
  79646. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipLast", function() { return _internal_operators_skipLast__WEBPACK_IMPORTED_MODULE_74__["skipLast"]; });
  79647. /* harmony import */ var _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__ = __webpack_require__(/*! ../internal/operators/skipUntil */ "./node_modules/rxjs/_esm5/internal/operators/skipUntil.js");
  79648. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipUntil", function() { return _internal_operators_skipUntil__WEBPACK_IMPORTED_MODULE_75__["skipUntil"]; });
  79649. /* harmony import */ var _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__ = __webpack_require__(/*! ../internal/operators/skipWhile */ "./node_modules/rxjs/_esm5/internal/operators/skipWhile.js");
  79650. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "skipWhile", function() { return _internal_operators_skipWhile__WEBPACK_IMPORTED_MODULE_76__["skipWhile"]; });
  79651. /* harmony import */ var _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__ = __webpack_require__(/*! ../internal/operators/startWith */ "./node_modules/rxjs/_esm5/internal/operators/startWith.js");
  79652. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "startWith", function() { return _internal_operators_startWith__WEBPACK_IMPORTED_MODULE_77__["startWith"]; });
  79653. /* harmony import */ var _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__ = __webpack_require__(/*! ../internal/operators/subscribeOn */ "./node_modules/rxjs/_esm5/internal/operators/subscribeOn.js");
  79654. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "subscribeOn", function() { return _internal_operators_subscribeOn__WEBPACK_IMPORTED_MODULE_78__["subscribeOn"]; });
  79655. /* harmony import */ var _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__ = __webpack_require__(/*! ../internal/operators/switchAll */ "./node_modules/rxjs/_esm5/internal/operators/switchAll.js");
  79656. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchAll", function() { return _internal_operators_switchAll__WEBPACK_IMPORTED_MODULE_79__["switchAll"]; });
  79657. /* harmony import */ var _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__ = __webpack_require__(/*! ../internal/operators/switchMap */ "./node_modules/rxjs/_esm5/internal/operators/switchMap.js");
  79658. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMap", function() { return _internal_operators_switchMap__WEBPACK_IMPORTED_MODULE_80__["switchMap"]; });
  79659. /* harmony import */ var _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__ = __webpack_require__(/*! ../internal/operators/switchMapTo */ "./node_modules/rxjs/_esm5/internal/operators/switchMapTo.js");
  79660. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "switchMapTo", function() { return _internal_operators_switchMapTo__WEBPACK_IMPORTED_MODULE_81__["switchMapTo"]; });
  79661. /* harmony import */ var _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__ = __webpack_require__(/*! ../internal/operators/take */ "./node_modules/rxjs/_esm5/internal/operators/take.js");
  79662. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "take", function() { return _internal_operators_take__WEBPACK_IMPORTED_MODULE_82__["take"]; });
  79663. /* harmony import */ var _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__ = __webpack_require__(/*! ../internal/operators/takeLast */ "./node_modules/rxjs/_esm5/internal/operators/takeLast.js");
  79664. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeLast", function() { return _internal_operators_takeLast__WEBPACK_IMPORTED_MODULE_83__["takeLast"]; });
  79665. /* harmony import */ var _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__ = __webpack_require__(/*! ../internal/operators/takeUntil */ "./node_modules/rxjs/_esm5/internal/operators/takeUntil.js");
  79666. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeUntil", function() { return _internal_operators_takeUntil__WEBPACK_IMPORTED_MODULE_84__["takeUntil"]; });
  79667. /* harmony import */ var _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__ = __webpack_require__(/*! ../internal/operators/takeWhile */ "./node_modules/rxjs/_esm5/internal/operators/takeWhile.js");
  79668. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "takeWhile", function() { return _internal_operators_takeWhile__WEBPACK_IMPORTED_MODULE_85__["takeWhile"]; });
  79669. /* harmony import */ var _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__ = __webpack_require__(/*! ../internal/operators/tap */ "./node_modules/rxjs/_esm5/internal/operators/tap.js");
  79670. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "tap", function() { return _internal_operators_tap__WEBPACK_IMPORTED_MODULE_86__["tap"]; });
  79671. /* harmony import */ var _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__ = __webpack_require__(/*! ../internal/operators/throttle */ "./node_modules/rxjs/_esm5/internal/operators/throttle.js");
  79672. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttle", function() { return _internal_operators_throttle__WEBPACK_IMPORTED_MODULE_87__["throttle"]; });
  79673. /* harmony import */ var _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__ = __webpack_require__(/*! ../internal/operators/throttleTime */ "./node_modules/rxjs/_esm5/internal/operators/throttleTime.js");
  79674. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throttleTime", function() { return _internal_operators_throttleTime__WEBPACK_IMPORTED_MODULE_88__["throttleTime"]; });
  79675. /* harmony import */ var _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__ = __webpack_require__(/*! ../internal/operators/throwIfEmpty */ "./node_modules/rxjs/_esm5/internal/operators/throwIfEmpty.js");
  79676. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "throwIfEmpty", function() { return _internal_operators_throwIfEmpty__WEBPACK_IMPORTED_MODULE_89__["throwIfEmpty"]; });
  79677. /* harmony import */ var _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__ = __webpack_require__(/*! ../internal/operators/timeInterval */ "./node_modules/rxjs/_esm5/internal/operators/timeInterval.js");
  79678. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeInterval", function() { return _internal_operators_timeInterval__WEBPACK_IMPORTED_MODULE_90__["timeInterval"]; });
  79679. /* harmony import */ var _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__ = __webpack_require__(/*! ../internal/operators/timeout */ "./node_modules/rxjs/_esm5/internal/operators/timeout.js");
  79680. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeout", function() { return _internal_operators_timeout__WEBPACK_IMPORTED_MODULE_91__["timeout"]; });
  79681. /* harmony import */ var _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__ = __webpack_require__(/*! ../internal/operators/timeoutWith */ "./node_modules/rxjs/_esm5/internal/operators/timeoutWith.js");
  79682. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timeoutWith", function() { return _internal_operators_timeoutWith__WEBPACK_IMPORTED_MODULE_92__["timeoutWith"]; });
  79683. /* harmony import */ var _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__ = __webpack_require__(/*! ../internal/operators/timestamp */ "./node_modules/rxjs/_esm5/internal/operators/timestamp.js");
  79684. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "timestamp", function() { return _internal_operators_timestamp__WEBPACK_IMPORTED_MODULE_93__["timestamp"]; });
  79685. /* harmony import */ var _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__ = __webpack_require__(/*! ../internal/operators/toArray */ "./node_modules/rxjs/_esm5/internal/operators/toArray.js");
  79686. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "toArray", function() { return _internal_operators_toArray__WEBPACK_IMPORTED_MODULE_94__["toArray"]; });
  79687. /* harmony import */ var _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__ = __webpack_require__(/*! ../internal/operators/window */ "./node_modules/rxjs/_esm5/internal/operators/window.js");
  79688. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "window", function() { return _internal_operators_window__WEBPACK_IMPORTED_MODULE_95__["window"]; });
  79689. /* harmony import */ var _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__ = __webpack_require__(/*! ../internal/operators/windowCount */ "./node_modules/rxjs/_esm5/internal/operators/windowCount.js");
  79690. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowCount", function() { return _internal_operators_windowCount__WEBPACK_IMPORTED_MODULE_96__["windowCount"]; });
  79691. /* harmony import */ var _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__ = __webpack_require__(/*! ../internal/operators/windowTime */ "./node_modules/rxjs/_esm5/internal/operators/windowTime.js");
  79692. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowTime", function() { return _internal_operators_windowTime__WEBPACK_IMPORTED_MODULE_97__["windowTime"]; });
  79693. /* harmony import */ var _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__ = __webpack_require__(/*! ../internal/operators/windowToggle */ "./node_modules/rxjs/_esm5/internal/operators/windowToggle.js");
  79694. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowToggle", function() { return _internal_operators_windowToggle__WEBPACK_IMPORTED_MODULE_98__["windowToggle"]; });
  79695. /* harmony import */ var _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__ = __webpack_require__(/*! ../internal/operators/windowWhen */ "./node_modules/rxjs/_esm5/internal/operators/windowWhen.js");
  79696. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "windowWhen", function() { return _internal_operators_windowWhen__WEBPACK_IMPORTED_MODULE_99__["windowWhen"]; });
  79697. /* harmony import */ var _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__ = __webpack_require__(/*! ../internal/operators/withLatestFrom */ "./node_modules/rxjs/_esm5/internal/operators/withLatestFrom.js");
  79698. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "withLatestFrom", function() { return _internal_operators_withLatestFrom__WEBPACK_IMPORTED_MODULE_100__["withLatestFrom"]; });
  79699. /* harmony import */ var _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__ = __webpack_require__(/*! ../internal/operators/zip */ "./node_modules/rxjs/_esm5/internal/operators/zip.js");
  79700. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zip", function() { return _internal_operators_zip__WEBPACK_IMPORTED_MODULE_101__["zip"]; });
  79701. /* harmony import */ var _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__ = __webpack_require__(/*! ../internal/operators/zipAll */ "./node_modules/rxjs/_esm5/internal/operators/zipAll.js");
  79702. /* harmony reexport (safe) */ __webpack_require__.d(__webpack_exports__, "zipAll", function() { return _internal_operators_zipAll__WEBPACK_IMPORTED_MODULE_102__["zipAll"]; });
  79703. /** PURE_IMPORTS_START PURE_IMPORTS_END */
  79704. //# sourceMappingURL=index.js.map
  79705. /***/ }),
  79706. /***/ "./node_modules/tslib/tslib.es6.js":
  79707. /*!*****************************************!*\
  79708. !*** ./node_modules/tslib/tslib.es6.js ***!
  79709. \*****************************************/
  79710. /*! exports provided: __extends, __assign, __rest, __decorate, __param, __metadata, __awaiter, __generator, __exportStar, __values, __read, __spread, __await, __asyncGenerator, __asyncDelegator, __asyncValues, __makeTemplateObject, __importStar, __importDefault */
  79711. /***/ (function(module, __webpack_exports__, __webpack_require__) {
  79712. "use strict";
  79713. __webpack_require__.r(__webpack_exports__);
  79714. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__extends", function() { return __extends; });
  79715. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__assign", function() { return __assign; });
  79716. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__rest", function() { return __rest; });
  79717. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__decorate", function() { return __decorate; });
  79718. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__param", function() { return __param; });
  79719. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__metadata", function() { return __metadata; });
  79720. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__awaiter", function() { return __awaiter; });
  79721. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__generator", function() { return __generator; });
  79722. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__exportStar", function() { return __exportStar; });
  79723. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__values", function() { return __values; });
  79724. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__read", function() { return __read; });
  79725. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__spread", function() { return __spread; });
  79726. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__await", function() { return __await; });
  79727. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncGenerator", function() { return __asyncGenerator; });
  79728. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncDelegator", function() { return __asyncDelegator; });
  79729. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__asyncValues", function() { return __asyncValues; });
  79730. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__makeTemplateObject", function() { return __makeTemplateObject; });
  79731. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importStar", function() { return __importStar; });
  79732. /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "__importDefault", function() { return __importDefault; });
  79733. /*! *****************************************************************************
  79734. Copyright (c) Microsoft Corporation. All rights reserved.
  79735. Licensed under the Apache License, Version 2.0 (the "License"); you may not use
  79736. this file except in compliance with the License. You may obtain a copy of the
  79737. License at http://www.apache.org/licenses/LICENSE-2.0
  79738. THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  79739. KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
  79740. WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
  79741. MERCHANTABLITY OR NON-INFRINGEMENT.
  79742. See the Apache Version 2.0 License for specific language governing permissions
  79743. and limitations under the License.
  79744. ***************************************************************************** */
  79745. /* global Reflect, Promise */
  79746. var extendStatics = function(d, b) {
  79747. extendStatics = Object.setPrototypeOf ||
  79748. ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
  79749. function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
  79750. return extendStatics(d, b);
  79751. };
  79752. function __extends(d, b) {
  79753. extendStatics(d, b);
  79754. function __() { this.constructor = d; }
  79755. d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
  79756. }
  79757. var __assign = function() {
  79758. __assign = Object.assign || function __assign(t) {
  79759. for (var s, i = 1, n = arguments.length; i < n; i++) {
  79760. s = arguments[i];
  79761. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
  79762. }
  79763. return t;
  79764. }
  79765. return __assign.apply(this, arguments);
  79766. }
  79767. function __rest(s, e) {
  79768. var t = {};
  79769. for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
  79770. t[p] = s[p];
  79771. if (s != null && typeof Object.getOwnPropertySymbols === "function")
  79772. for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) if (e.indexOf(p[i]) < 0)
  79773. t[p[i]] = s[p[i]];
  79774. return t;
  79775. }
  79776. function __decorate(decorators, target, key, desc) {
  79777. var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
  79778. if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
  79779. 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;
  79780. return c > 3 && r && Object.defineProperty(target, key, r), r;
  79781. }
  79782. function __param(paramIndex, decorator) {
  79783. return function (target, key) { decorator(target, key, paramIndex); }
  79784. }
  79785. function __metadata(metadataKey, metadataValue) {
  79786. if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(metadataKey, metadataValue);
  79787. }
  79788. function __awaiter(thisArg, _arguments, P, generator) {
  79789. return new (P || (P = Promise))(function (resolve, reject) {
  79790. function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
  79791. function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
  79792. function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
  79793. step((generator = generator.apply(thisArg, _arguments || [])).next());
  79794. });
  79795. }
  79796. function __generator(thisArg, body) {
  79797. var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
  79798. return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
  79799. function verb(n) { return function (v) { return step([n, v]); }; }
  79800. function step(op) {
  79801. if (f) throw new TypeError("Generator is already executing.");
  79802. while (_) try {
  79803. 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;
  79804. if (y = 0, t) op = [op[0] & 2, t.value];
  79805. switch (op[0]) {
  79806. case 0: case 1: t = op; break;
  79807. case 4: _.label++; return { value: op[1], done: false };
  79808. case 5: _.label++; y = op[1]; op = [0]; continue;
  79809. case 7: op = _.ops.pop(); _.trys.pop(); continue;
  79810. default:
  79811. if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
  79812. if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
  79813. if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
  79814. if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
  79815. if (t[2]) _.ops.pop();
  79816. _.trys.pop(); continue;
  79817. }
  79818. op = body.call(thisArg, _);
  79819. } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
  79820. if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
  79821. }
  79822. }
  79823. function __exportStar(m, exports) {
  79824. for (var p in m) if (!exports.hasOwnProperty(p)) exports[p] = m[p];
  79825. }
  79826. function __values(o) {
  79827. var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
  79828. if (m) return m.call(o);
  79829. return {
  79830. next: function () {
  79831. if (o && i >= o.length) o = void 0;
  79832. return { value: o && o[i++], done: !o };
  79833. }
  79834. };
  79835. }
  79836. function __read(o, n) {
  79837. var m = typeof Symbol === "function" && o[Symbol.iterator];
  79838. if (!m) return o;
  79839. var i = m.call(o), r, ar = [], e;
  79840. try {
  79841. while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
  79842. }
  79843. catch (error) { e = { error: error }; }
  79844. finally {
  79845. try {
  79846. if (r && !r.done && (m = i["return"])) m.call(i);
  79847. }
  79848. finally { if (e) throw e.error; }
  79849. }
  79850. return ar;
  79851. }
  79852. function __spread() {
  79853. for (var ar = [], i = 0; i < arguments.length; i++)
  79854. ar = ar.concat(__read(arguments[i]));
  79855. return ar;
  79856. }
  79857. function __await(v) {
  79858. return this instanceof __await ? (this.v = v, this) : new __await(v);
  79859. }
  79860. function __asyncGenerator(thisArg, _arguments, generator) {
  79861. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  79862. var g = generator.apply(thisArg, _arguments || []), i, q = [];
  79863. return i = {}, verb("next"), verb("throw"), verb("return"), i[Symbol.asyncIterator] = function () { return this; }, i;
  79864. 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); }); }; }
  79865. function resume(n, v) { try { step(g[n](v)); } catch (e) { settle(q[0][3], e); } }
  79866. function step(r) { r.value instanceof __await ? Promise.resolve(r.value.v).then(fulfill, reject) : settle(q[0][2], r); }
  79867. function fulfill(value) { resume("next", value); }
  79868. function reject(value) { resume("throw", value); }
  79869. function settle(f, v) { if (f(v), q.shift(), q.length) resume(q[0][0], q[0][1]); }
  79870. }
  79871. function __asyncDelegator(o) {
  79872. var i, p;
  79873. return i = {}, verb("next"), verb("throw", function (e) { throw e; }), verb("return"), i[Symbol.iterator] = function () { return this; }, i;
  79874. 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; }
  79875. }
  79876. function __asyncValues(o) {
  79877. if (!Symbol.asyncIterator) throw new TypeError("Symbol.asyncIterator is not defined.");
  79878. var m = o[Symbol.asyncIterator], i;
  79879. 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);
  79880. 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); }); }; }
  79881. function settle(resolve, reject, d, v) { Promise.resolve(v).then(function(v) { resolve({ value: v, done: d }); }, reject); }
  79882. }
  79883. function __makeTemplateObject(cooked, raw) {
  79884. if (Object.defineProperty) { Object.defineProperty(cooked, "raw", { value: raw }); } else { cooked.raw = raw; }
  79885. return cooked;
  79886. };
  79887. function __importStar(mod) {
  79888. if (mod && mod.__esModule) return mod;
  79889. var result = {};
  79890. if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
  79891. result.default = mod;
  79892. return result;
  79893. }
  79894. function __importDefault(mod) {
  79895. return (mod && mod.__esModule) ? mod : { default: mod };
  79896. }
  79897. /***/ })
  79898. }]);
  79899. //# sourceMappingURL=vendor.js.map